Переглянути джерело

Merge branch 'dev-wgg' of wugg/cxinv into dev

wugg 1 рік тому
батько
коміт
17b18973d4

+ 1 - 1
app/admin/command/GetOrderInfoAndInvoiceInfo.php

@@ -210,7 +210,7 @@ class GetOrderInfoAndInvoiceInfo extends Command
 	                              "winv_fee"=>$qrdinfo['winv_fee']+$value['cancel_fee'],
 	                              "invtime"=>'',
 	                              "inv_status"=>$qrdinfo['inv_fee']==0 &&($qrdinfo['ainv_fee']-$value['cancel_fee'])==0 ? 1 : 2,
-	                              "status"=>$qrdinfo['inv_fee']==0 &&($qrdinfo['ainv_fee']-$value['cancel_fee'])==0  && $qrdinfo['pay_status']==0 ? 0 : 1,
+	                              "status"=>$qrdinfo['inv_fee']==0 &&($qrdinfo['ainv_fee']-$value['cancel_fee'])==0&& $qrdinfo['pay_status']==1 ? 0 : 1,
 	                              "updatetime"=>date("Y-m-d H:i:s"),
 	                          ];
                           }

+ 16 - 9
app/command/Report.php

@@ -955,7 +955,7 @@ class Report extends Command
 
 	//采购部门销售业绩
 	private function R($param=[]){
-		$where = [["a.is_del","=",0],["a.status","in",[2,3]],["b.is_stock","=",0]];
+		$where = [["a.is_del","=",0],["a.status","in",[2,3]]];
 		if (($param['start'] != '') && ($param['end'] != '')) $where[] = ['a.sendtime', 'between', [date("Y-m-d 00:00:00",
 		strtotime($param['start'])),date("Y-m-d 23:59:59",strtotime($param['end']))]];
 //		if ($param['companyNo'] != '') $where[] = ['supplierNo', '=', $param['companyNo']];
@@ -971,7 +971,7 @@ class Report extends Command
 			a.orderCode 销售单号,
 			b.platform_id 平台类型,
 			b.platform_id 平台名称,
-			d.cgder_id 业务部门,
+			b.apply_id 业务部门,
 			d.cgder 供应商负责人,
 			d.cgder 发货操作人,
 			b.order_source 订单类型,
@@ -979,6 +979,7 @@ class Report extends Command
 			a.sendtime 发货工单发货时间,
 			b.cat_id `一级分类`,
 			b.good_name 商品名称,
+			b.good_code,
 			a.post_name 物流公司,
 			a.post_code 物流单号,
 			a.companyNo `业务公司编号`,
@@ -1004,14 +1005,19 @@ class Report extends Command
 				if(isset($temp['data']) && !empty($temp['data']))
 					$depart[$value['业务部门']]=$temp['data'][$value['业务部门']];
 			}
-			
-			if(!isset($hasAccount[$value['供应商编号']])){
-				$temp = check_has_account_by_supplierNos($value['供应商编号']);
-				if(isset($temp['data']) && !empty($temp['data']))
-					$hasAccount[$value['供应商编号']]=isset($temp['data'][$value['供应商编号']])?$value['供应商名称']:$value['供应商负责人'];
+			if($value['商品类型']==1){
+				$value['采购单价'] = Db::name("purchease_order")->where(["spuCode"=>$value['good_code'],"status"=>3])
+						->order("id desc")->value("good_price",0);
+				$value['本次发货金额']= bcmul($value['本次发货数量'],$value['采购单价'],2);
 			}
+//			if(!isset($hasAccount[$value['供应商编号']])){
+//				$temp = check_has_account_by_supplierNos([$value['供应商编号']]);
+//				if(isset($temp['data'])&& !empty($temp['data'][$value['供应商编号']])){
+//					 $hasAccount[$value['供应商编号']] = $Db->name("process_order")->where(["orderCode"=>$value['发货工单号'],"order_type"=>"FHGD","order_status"=>2])->value("action_name");
+//				}
+//			}
 			$value['业务部门'] = $depart[$value['业务部门']]??"";
-			$value['发货操作人'] = $hasAccount[$value['供应商编号']];
+			$value['发货操作人'] = $Db->name('process_order')->where(['order_code'=>$value['发货工单号'],'order_type'=>'FHGD','action_process'=>2])->value('action_name');
 			$value['一级分类'] = $Db->name("cat")->where(["id"=>$value['一级分类']])->value("search","");
 			if(!isset($platform[$value['平台类型']])){
 				$pal = $Db->name('platform')->where(['id'=>$value['平台类型']])->field('platform_name,use_type')
@@ -1019,10 +1025,11 @@ class Report extends Command
 				$platform[$value['平台类型']] = $pal;
 			}
 			$value['平台类型'] =$this->paltType[$platform[$value['平台类型']]["use_type"]??0];
-			$value['平台名称'] =$platform[$value['平台类型']]["platform_name"]??'';
+			$value['平台名称'] =$platform[$value['平台名称']]["platform_name"]??'';
 			$value['订单类型']=$this->qrdSource[$value['订单类型']]??"";
 			$value['商品类型']=$this->qrdType[$value['商品类型']]??"";
 			$value['物流单号'].='';
+				unset($value['good_code']);
 			yield $value;
 		}
 	}

+ 3 - 1
app/command/companyStats.php

@@ -83,7 +83,7 @@ class companyStats extends Command
 		                ->field("sum(totalPrice+th_fee) as total")->findOrEmpty();
 		    $day_thtotal_cx=Db::name("th_source")->alias("a")
 		                      ->leftJoin("qrd_info b" , "a.th_qrdNo=b.cxCode")
-		                      ->where([['a.th_companyNo' , "=" , $supplierNo] , ["b.is_del" , "=" , 0]])
+		                      ->where([['b.companyNo' , "=" , $supplierNo] , ["b.is_del" , "=" , 0]])
 		                      ->whereDay("a.createtime" , $date)
 		                      ->field("sum(a.th_num*b.goodPrice) as th_total")->findOrEmpty();
 		    $cgdtotal = $this->cgdTotal($supplierNo,$date,2);
@@ -116,6 +116,8 @@ class companyStats extends Command
 			    "day_time"=>$date ,
 			    "sale_total"=>$cgd['cgd_total'] ,
 			    "th_total"=>$cgd['cgd_thtotal'] ,
+			    'cgd_total'=>0,
+			    'cgd_th_total'=>0,
 			    "addtime"=>date("Y-m-d H:i:s")
 		    ];
 //		    $date_tmp++;

+ 2 - 2
app/command/handleCxData.php

@@ -32,10 +32,10 @@ class handleCxData extends command
 	    Db::startTrans();
         $results = Db::name('caixiao_data')
             ->withAttr("data",function ($v){
-            	return json_decode(str_replace(array("\r\n", "\r", "\n"), '', $v),true);
+            	return json_decode(str_replace(array("\r\n", "\r", "\n","\\"), '', $v),true);
             })
             ->where("status",1)
-            ->where("addtime",">=",date("Y-m-d H:i:s",strtotime(time()-1800)))
+            ->where("addtime",">=",date("Y-m-d H:i:s",time()-1800))
             ->lock(true)
             ->limit(100)
             ->select()->toArray();