|
@@ -367,6 +367,8 @@ class ReportByRelaComNo extends Base
|
|
|
'wait_confirm_total_num' => '0',//待与供应商确认-总单数
|
|
|
'wait_in_total_fee' => '0',//待入库-总金额
|
|
|
'wait_in_total_num' => '0',//待入库-总单数
|
|
|
+ 'relaComNo' => $this->relaComNo,
|
|
|
+ 'relaComName' => $this->relaComName,
|
|
|
];
|
|
|
}
|
|
|
|
|
@@ -386,8 +388,6 @@ class ReportByRelaComNo extends Base
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
- $value['业务公司编码'] = $this->relaComNo;
|
|
|
- $value['业务公司名称'] = $this->relaComName;
|
|
|
|
|
|
// if ($value['status'] == 0) {
|
|
|
// $data[$value['addtime']][$value['itemid']]['wait_total_fee'] += $value['total_fee'];
|
|
@@ -431,7 +431,6 @@ class ReportByRelaComNo extends Base
|
|
|
if (!$val_params->check($param)) return error_show(1004, $val_params->getError());
|
|
|
|
|
|
//@todo 此处无法添加业务公司筛选
|
|
|
- //@todo 关联表 depart_user、company_item和supplier都需要更换
|
|
|
$where = [['cb.is_del', '=', 0]];
|
|
|
if ($param['start_date'] != '' && $param['end_date'] != '') $where[] = ['cb.addtime', 'between', [$param['start_date'] . ' 00:00:00', $param['end_date'] . ' 23:59:59']];
|
|
|
// if ($param['supplier'] != '') $where[] = ['s.name', 'like', '%' . $param['supplier'] . '%'];
|
|
@@ -450,20 +449,38 @@ class ReportByRelaComNo extends Base
|
|
|
|
|
|
$list = Db::name('consult_bids')
|
|
|
->alias('cb')
|
|
|
- ->field('DATE_FORMAT(cb.addtime,"%Y-%m-%d") addtime,du.itemid,cb.createrid,SUM(c.num) num,COUNT(cb.id) total,IF(ISNULL(`du`.`nickname`),`s`.`name`,`du`.`nickname`) nickname,IF(ISNULL(`ci`.`name`),"供应商",`ci`.`name`) name,s.name supplierName')
|
|
|
+// ->field('DATE_FORMAT(cb.addtime,"%Y-%m-%d") addtime,du.itemid,cb.createrid,SUM(c.num) num,COUNT(cb.id) total,IF(ISNULL(`du`.`nickname`),`s`.`name`,`du`.`nickname`) nickname,IF(ISNULL(`ci`.`name`),"供应商",`ci`.`name`) name,cb.supplierName')
|
|
|
+ ->field('DATE_FORMAT(cb.addtime,"%Y-%m-%d") addtime,cb.createrid,SUM(c.num) num,COUNT(cb.id) total,"" nickname,"" name,cb.supplierName')
|
|
|
->leftJoin('consult_info c', 'c.infoNo=cb.infoNo')
|
|
|
- ->leftJoin('depart_user du', 'du.uid=cb.createrid AND du.is_del=0')
|
|
|
- ->leftJoin('company_item ci', 'ci.id=du.itemid')
|
|
|
- ->leftJoin('supplier s', 's.code=cb.supplierNo')
|
|
|
+// ->leftJoin('depart_user du', 'du.uid=cb.createrid AND du.is_del=0')
|
|
|
+// ->leftJoin('company_item ci', 'ci.id=du.itemid')
|
|
|
+// ->leftJoin('supplier s', 's.code=cb.supplierNo')
|
|
|
->where($where)
|
|
|
- ->group('addtime,du.itemid,ci.name ,cb.createrid,du.nickname,s.name')
|
|
|
+// ->group('addtime,du.itemid,ci.name ,cb.createrid,du.nickname,cb.supplierName')
|
|
|
+ ->group('addtime,cb.createrid,cb.supplierNo')
|
|
|
->order('addtime desc,du.itemid,ci.name ,cb.createrid,du.nickname')
|
|
|
// ->page($param['page'], $param['size'])
|
|
|
->cursor();
|
|
|
|
|
|
+ //所有账号
|
|
|
+ $user=Db::connect('mysql_sys')
|
|
|
+ ->name('user')
|
|
|
+ ->alias('a')
|
|
|
+ ->leftJoin('account_item b','b.account_id=a.account_id')
|
|
|
+ ->leftJoin('company_item c','c.id=b.itemid')
|
|
|
+ ->column('a.nickname,c.name','a.account_id');
|
|
|
+
|
|
|
$data = [];
|
|
|
foreach ($list as $value) {
|
|
|
|
|
|
+ if(isset($user[$value['createrid']])){
|
|
|
+ $value['nickname']=$user[$value['createrid']]['nickname'];
|
|
|
+ $value['name']=$user[$value['createrid']]['name'];
|
|
|
+ }else{
|
|
|
+ $value['nickname']=$value['supplierName'];
|
|
|
+ $value['name']='供应商';
|
|
|
+ }
|
|
|
+
|
|
|
if ($value['name'] == '供应商') {
|
|
|
$data[] = $value;
|
|
|
continue;
|