|
@@ -32,9 +32,13 @@ class stat extends Command
|
|
|
->findOrEmpty();
|
|
|
$uidArr =$this->getuid($itmeid);
|
|
|
$sale=$this->GetData($uidArr,$companyNo,$date);
|
|
|
+ $zy=$this->GetData($uidArr,$companyNo,$date,1);
|
|
|
+ $channel=$this->GetData($uidArr,$companyNo,$date,2);
|
|
|
if($ist){
|
|
|
$ist['sale_total']=$sale['sale_total']??0;
|
|
|
$ist['th_total']=$sale['th_total']??0;
|
|
|
+ $ist['zy_sale_total']=$zy['sale_total']-$zy['th_total'];
|
|
|
+ $ist['channel_sale_total']=$channel['sale_total']-$channel['th_total'];
|
|
|
}else{
|
|
|
$ist=[
|
|
|
"depart_id"=>$itmeid,
|
|
@@ -42,6 +46,8 @@ class stat extends Command
|
|
|
"day_time"=>date("Y-m-d"),
|
|
|
"sale_total"=>$sale['sale_total']??0,
|
|
|
"th_total"=>$sale['th_total']??0,
|
|
|
+ "zy_sale_total"=>$zy['sale_total']-$zy['th_total'],
|
|
|
+ "channel_sale_total"=>$channel['sale_total']-$channel['th_total'],
|
|
|
"companyNo"=>$companyNo,
|
|
|
"companyName"=>$company[$companyNo],
|
|
|
];
|
|
@@ -60,20 +66,25 @@ class stat extends Command
|
|
|
* @param $date
|
|
|
* @return array
|
|
|
*/
|
|
|
- public function GetData($uid,$companyNo,$date):array{
|
|
|
-
|
|
|
+ public function GetData($uid,$companyNo,$date,$type=0):array{
|
|
|
|
|
|
+ $where=[];
|
|
|
+ if($type==1) $where=["cxCode","=",''];
|
|
|
+ if($type==2) $where=["cxCode","<>",''];
|
|
|
$day_total =Db::name("qrd_info")->where([["ownerid","in",$uid],["is_del","=",0],['companyNo',"=",$companyNo]])
|
|
|
->whereDay("createdTime",$date)
|
|
|
+ ->where($where)
|
|
|
->sum(Db::raw('totalPrice+th_fee'));
|
|
|
$day_thtotal=Db::name("th_source")->alias("a")
|
|
|
->leftJoin("qrd_info b","a.th_qrdNo=b.sequenceNo or a.th_qrdNo=b.cxCode")
|
|
|
->where([["b.ownerid","in",$uid],['a.th_companyNo',"=",$companyNo]])
|
|
|
+ ->where($where)
|
|
|
->whereDay("a.createtime",$date)->sum('a.th_qrd_fee');
|
|
|
return ["sale_total"=>$day_total,"th_total"=>$day_thtotal];
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* @param $depart_id
|
|
|
* @return array|mixed
|