|
@@ -55,7 +55,9 @@ class NowReportHandle extends Command
|
|
|
case 'D':
|
|
|
$res = $this->D($info['start'], $info['end']);
|
|
|
break;
|
|
|
-
|
|
|
+ case 'E':
|
|
|
+ $res = $this->E($info['start'], $info['end']);
|
|
|
+ break;
|
|
|
default:
|
|
|
throw new Exception('暂不支持这个报表');
|
|
|
}
|
|
@@ -325,4 +327,53 @@ class NowReportHandle extends Command
|
|
|
return $data;
|
|
|
}
|
|
|
|
|
|
+ public function E($start,$end){
|
|
|
+ $list =Db::name("purchease_in")->alias('wpi')->leftJoin("purchease_order wpo","wpo.cgdNo=wpi.cgdNo")
|
|
|
+ ->leftJoin("purchease wp","wpo.bkcode=wp.bk_code")
|
|
|
+ ->leftJoin("good_basic wgb","wgb.spuCode=wpo.spuCode")
|
|
|
+ ->leftJoin("warehouse_info wwi","wwi.wsm_code = wpo.wsm_code")
|
|
|
+ ->leftJoin("supplier ws","ws.code=wpo.supplierNo")
|
|
|
+ ->where('wpi.status',"in", [4,6])
|
|
|
+ ->whereBetween('wpi.addtime', [$start, $end])
|
|
|
+ ->field(" wpo.companyNo '业务公司',
|
|
|
+ bkcode '备库单号',
|
|
|
+ wpi.cgdNo '采购单号',
|
|
|
+ wpo.skuCode '商品编号',
|
|
|
+ '' as '一级分类',
|
|
|
+ '' as '二级分类',
|
|
|
+ cat_id as '三级分类',
|
|
|
+ cat_id as '财务核算编号',
|
|
|
+ wpo.good_name as '商品名称',
|
|
|
+ wpi.send_num '入库数量',
|
|
|
+ round(wpi.send_num* good_price,2) '入库金额',
|
|
|
+ wpo.updatetime '本次入库时间',
|
|
|
+ wgb.tax/100 '采购税率',
|
|
|
+ '' as '不含税入库金额',
|
|
|
+ '' as '税额',
|
|
|
+ wp.apply_id as '业务部门',
|
|
|
+ wp.apply_name as '业务员',
|
|
|
+ wpo.cgder as '采购员',
|
|
|
+ nake_fee '成本裸价',
|
|
|
+ wsm_type '仓库类型',
|
|
|
+ ws.name '供应商名称',
|
|
|
+ wwi.name '仓库名称'
|
|
|
+ ")->cursor();
|
|
|
+ $data=[];
|
|
|
+ foreach($list as $value){
|
|
|
+ $value['业务公司'] = Db::name("business")->where(["companyNo"=>$value['业务公司']])->value('company','');
|
|
|
+ $value['业务部门'] = Db::name("depart_user")->alias("a")->leftJoin("company_item ci","a.itemid=ci.id")
|
|
|
+ ->where(["a.uid"=>$value['业务部门'],"a.status"=>1,"a.is_del"=>0])->value('ci.name','');
|
|
|
+ $cat =made($value['三级分类']);
|
|
|
+ $value['财务核算编码'] =Db::name("cat")->where(["id"=>$value['三级分类']])->value("fund_code",'');
|
|
|
+ $value['一级分类']=isset($cat[0]['name'])?$cat[0]['name']:"";
|
|
|
+ $value['二级分类']=isset($cat[1]['name'])?$cat[1]['name']:"";
|
|
|
+ $value['三级分类']=isset($cat[2]['name'])?$cat[2]['name']:"";
|
|
|
+ $value['不含税入库金额']= round($value['入库金额']/(1+$value['采购税率']),2);
|
|
|
+ $value['税额']= round(($value['入库金额']/(1+$value['采购税率'])) *$value['采购税率'],2);
|
|
|
+ $value['仓库类型'] = Db::name("warehouse_type")->where(["id"=>$value['仓库类型']])->value("name",'');
|
|
|
+ yield $data[] = $value;
|
|
|
+ }
|
|
|
+ return $data;
|
|
|
+ }
|
|
|
+
|
|
|
}
|