|
@@ -430,8 +430,7 @@ class ReportByRelaComNo extends Base
|
|
|
|
|
|
if (!$val_params->check($param)) return error_show(1004, $val_params->getError());
|
|
|
|
|
|
- //@todo 此处无法添加业务公司筛选
|
|
|
- $where = [['cb.is_del', '=', 0]];
|
|
|
+ $where = [['cb.is_del', '=', 0], ['d.companyNo', '=', $this->relaComNo]];
|
|
|
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'] . '%'];
|
|
|
|
|
@@ -452,33 +451,34 @@ class ReportByRelaComNo extends Base
|
|
|
// ->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('consult_order d', 'd.zxNo=cb.zxNo')
|
|
|
// ->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,cb.supplierName')
|
|
|
- ->group('addtime,cb.createrid,cb.supplierNo')
|
|
|
- ->order('addtime desc,du.itemid,ci.name ,cb.createrid,du.nickname')
|
|
|
+ ->group('addtime,cb.createrid,cb.supplierName')
|
|
|
+ ->order('addtime desc,cb.createrid')
|
|
|
// ->page($param['page'], $param['size'])
|
|
|
->cursor();
|
|
|
|
|
|
//所有账号
|
|
|
- $user=Db::connect('mysql_sys')
|
|
|
+ $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');
|
|
|
+ ->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 (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'] == '供应商') {
|
|
@@ -493,6 +493,8 @@ class ReportByRelaComNo extends Base
|
|
|
'nickname' => $value['nickname'],
|
|
|
'num' => '0',
|
|
|
'total' => '0',
|
|
|
+ 'relaComNo' => $this->relaComNo,
|
|
|
+ 'relaComName' => $this->relaComName,
|
|
|
];
|
|
|
}
|
|
|
|
|
@@ -514,7 +516,7 @@ class ReportByRelaComNo extends Base
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- $da[] = ['addtime' => '汇总', 'itemid' => 0, 'createrid' => 0, 'num' => array_sum(array_column($da, 'num')), 'total' => array_sum(array_column($da, 'total')), 'nickname' => '', 'name' => ''];
|
|
|
+ $da[] = ['addtime' => '汇总', 'itemid' => 0, 'createrid' => 0, 'num' => array_sum(array_column($da, 'num')), 'total' => array_sum(array_column($da, 'total')), 'nickname' => '', 'name' => '', 'relaComNo' => $this->relaComNo, 'relaComName' => $this->relaComName];
|
|
|
return json_show(0, '请求成功', $da);
|
|
|
|
|
|
}
|
|
@@ -644,7 +646,6 @@ class ReportByRelaComNo extends Base
|
|
|
if ($param['creater'] != '') $where[] = ['cb.creater', 'like', '%' . $param['creater'] . '%'];
|
|
|
if ($param['zxNo'] != '') $where[] = ['cb.infoNo', 'like', '%' . $param['zxNo'] . '%'];
|
|
|
|
|
|
-
|
|
|
$count = Db::name('consult_bids')
|
|
|
->alias('cb')
|
|
|
->leftJoin('consult_info ci', 'ci.infoNo=cb.infoNo')
|
|
@@ -656,7 +657,7 @@ class ReportByRelaComNo extends Base
|
|
|
|
|
|
$data = Db::name('consult_bids')
|
|
|
->alias('cb')
|
|
|
- ->field('cb.id,ci.addtime,cb.bidNo,cb.infoNo zxNo,cb.addtime cbaddtime,cb.good_name,s.name supplier,cb.total_fee,cb.delivery_day,cb.work_day,cb.expire_day,cb.creater,cb.createrid,"" name,ci.num,ci.arrival_time,co.saleid,co.salesman,"" salesman_name,csi.companyName')
|
|
|
+ ->field('cb.id,ci.addtime,cb.bidNo,cb.infoNo zxNo,cb.addtime cbaddtime,cb.good_name,cb.supplierName supplier,cb.total_fee,cb.delivery_day,cb.work_day,cb.expire_day,cb.creater,cb.createrid,"" name,ci.num,ci.arrival_time,co.saleid,co.salesman,"" salesman_name,"" companyName,co.khNo')
|
|
|
->leftJoin('consult_info ci', 'ci.infoNo=cb.infoNo')
|
|
|
->leftJoin('consult_order co', 'co.zxNo=cb.zxNo')
|
|
|
// ->leftJoin('supplier s', 's.code=cb.supplierNo')
|
|
@@ -675,8 +676,10 @@ class ReportByRelaComNo extends Base
|
|
|
|
|
|
//获取所有创建人的部门
|
|
|
$item_name = get_company_name_by_uid(array_unique(array_merge(array_column($data, 'createrid'), array_column($data, 'saleid'))));
|
|
|
+ $names = get_headquarters_code_and_name(array_unique(array_column($data,'khNo')));
|
|
|
|
|
|
foreach ($data as &$value) {
|
|
|
+ $value['companyName'] = $names[$value['khNo']] ?? '';
|
|
|
$value['name'] = $item_name[$value['createrid']] ?? '';
|
|
|
$value['salesman_name'] = $item_name[$value['saleid']] ?? '';
|
|
|
$value['relaComNo'] = $this->relaComNo;
|
|
@@ -748,22 +751,25 @@ class ReportByRelaComNo extends Base
|
|
|
|
|
|
|
|
|
$data = $rs
|
|
|
- ->field('ci.addtime as 咨询时间,cb.bidNo as 采购单反馈单号,cb.infoNo as 咨询订单号,cb.addtime as 回复时间,cb.good_name as 产品名称,s.name as 供应商名称,cb.total_fee 成本合计,cb.delivery_day 物流时间,cb.work_day 产品工期,cb.expire_day 信息有效期,cb.creater 采购员,"" 采购员所属部门,ci.num 需求数量,ci.arrival_time 要求到货日期,co.salesman 业务人员,"" 业务人员所属部门,csi.companyName 客户名称,cb.createrid,co.saleid')
|
|
|
+ ->field('ci.addtime as 咨询时间,cb.bidNo as 采购单反馈单号,cb.infoNo as 咨询订单号,cb.addtime as 回复时间,cb.good_name as 产品名称,cb.supplierName as 供应商名称,cb.total_fee 成本合计,cb.delivery_day 物流时间,cb.work_day 产品工期,cb.expire_day 信息有效期,cb.creater 采购员,"" 采购员所属部门,ci.num 需求数量,ci.arrival_time 要求到货日期,co.salesman 业务人员,"" 业务人员所属部门,"" 客户名称,cb.createrid,co.saleid,co.khNo')
|
|
|
->leftJoin('consult_info ci', 'ci.infoNo=cb.infoNo')
|
|
|
->leftJoin('consult_order co', 'co.zxNo=cb.zxNo')
|
|
|
- ->leftJoin('supplier s', 's.code=cb.supplierNo')
|
|
|
- ->leftJoin('customer_info csi', 'csi.companyNo=co.khNo')
|
|
|
+// ->leftJoin('supplier s', 's.code=cb.supplierNo')
|
|
|
+// ->leftJoin('customer_info csi', 'csi.companyNo=co.khNo')
|
|
|
->select()
|
|
|
->toArray();
|
|
|
|
|
|
$item_name = get_company_name_by_uid(array_unique(array_merge(array_column($data, 'createrid'), array_column($data, 'saleid'))));
|
|
|
+ $names = get_headquarters_code_and_name(array_unique(array_column($data,'khNo')));
|
|
|
|
|
|
$list = [];
|
|
|
foreach ($data as $value) {
|
|
|
+ $value['客户名称'] = $names[$value['khNo']] ?? '';
|
|
|
$value['采购员所属部门'] = $item_name[$value['createrid']] ?? '';
|
|
|
$value['业务人员所属部门'] = $item_name[$value['saleid']] ?? '';
|
|
|
unset($value['createrid']);
|
|
|
unset($value['saleid']);
|
|
|
+ unset($value['khNo']);
|
|
|
$value['业务公司编码'] = $this->relaComNo;
|
|
|
$value['业务公司名称'] = $this->relaComName;
|
|
|
$list[] = $value;
|
|
@@ -1015,7 +1021,7 @@ class ReportByRelaComNo extends Base
|
|
|
|
|
|
if (!$val_params->check($param)) return json_show(1004, $val_params->getError());
|
|
|
|
|
|
- $where = [['po.is_del', '=', 0], ['po.companyNo', '=', $this->relaComNo]];
|
|
|
+ $where = [['po.is_del', '=', 0], ['po.order_type','<>',1],['po.companyNo', '=', $this->relaComNo]];
|
|
|
if ($param['start_date'] != '' && $param['end_date'] != '') $where[] = ['po.addtime', 'between', [$param['start_date'] . ' 00:00:00', $param['end_date'] . ' 23:59:59']];
|
|
|
if ($param['status'] != '') $where[] = ['po.status', '=', $param['status']];
|
|
|
|
|
@@ -1320,6 +1326,8 @@ class ReportByRelaComNo extends Base
|
|
|
// ->where($where)
|
|
|
// ->order('s.addtime desc')
|
|
|
// ->cursor();
|
|
|
+ $param['start'] = $param['start_date'];
|
|
|
+ $param['end'] = $param['end_date'];
|
|
|
$param['size'] = PHP_INT_MAX;
|
|
|
|
|
|
$list = \app\admin\common\User::getIns()->handle('sGetList', $param);
|
|
@@ -1489,10 +1497,10 @@ class ReportByRelaComNo extends Base
|
|
|
|
|
|
if (!$val_params->check($param)) return error_show(1004, $val_params->getError());
|
|
|
|
|
|
- $where = [['s.is_del', '=', 0], ['gp.exam_status', '=', 6], ['gb.companyNo', '=', $this->relaComNo]]; //exam_status==6 上线成功
|
|
|
+ $where = [['gp.is_del', '=', 0], ['gp.exam_status', '=', 6], ['gb.companyNo', '=', $this->relaComNo]]; //exam_status==6 上线成功
|
|
|
if ($param['start_date'] != '' && $param['end_date'] != '') $where[] = ['gp.online_time', 'between', [$param['start_date'] . ' 00:00:00', $param['end_date'] . ' 23:59:59']];//当上面状态确定为exam_status==6时,上线时间也可以取 updatetime
|
|
|
if ($param['creater'] != '') $where[] = ['gb.creater', 'like', '%' . $param['creater'] . '%'];
|
|
|
- if ($param['supplier_name'] != '') $where[] = ['s.name', 'like', '%' . $param['supplier_name'] . '%'];
|
|
|
+// if ($param['supplier_name'] != '') $where[] = ['s.name', 'like', '%' . $param['supplier_name'] . '%'];
|
|
|
|
|
|
$count = Db::name('good_platform')
|
|
|
->alias('gp')
|
|
@@ -2145,7 +2153,7 @@ class ReportByRelaComNo extends Base
|
|
|
|
|
|
if (!$val_params->check($param)) return error_show(1004, $val_params->getError());
|
|
|
|
|
|
- $where = [['s.is_del', '=', 0], ['gb.companyNo', '=', $this->relaComNo]];
|
|
|
+ $where = [['gp.is_del', '=', 0], ['gb.companyNo', '=', $this->relaComNo]];
|
|
|
if ($param['start_date'] != '' && $param['end_date'] != '') $where[] = ['gp.addtime', 'between', [$param['start_date'] . ' 00:00:00', $param['end_date'] . ' 23:59:59']];
|
|
|
if ($param['creater'] != '') $where[] = ['gb.creater', 'like', '%' . $param['creater'] . '%'];
|
|
|
if ($param['supplier_name'] != '') $where[] = ['s.name', 'like', '%' . $param['supplier_name'] . '%'];
|
|
@@ -2235,14 +2243,14 @@ class ReportByRelaComNo extends Base
|
|
|
|
|
|
if (!$val_params->check($param)) return error_show(1004, $val_params->getError());
|
|
|
|
|
|
- $where = [['s.is_del', '=', 0], ['gb.companyNo', '=', $this->relaComNo]]; //exam_status==6 上线成功
|
|
|
+ $where = [['gp.is_del', '=', 0], ['gb.companyNo', '=', $this->relaComNo]]; //exam_status==6 上线成功
|
|
|
if ($param['start_date'] != '' && $param['end_date'] != '') $where[] = ['gp.addtime', 'between', [$param['start_date'] . ' 00:00:00', $param['end_date'] . ' 23:59:59']];
|
|
|
if ($param['creater'] != '') $where[] = ['gb.creater', 'like', '%' . $param['creater'] . '%'];
|
|
|
if ($param['supplier_name'] != '') $where[] = ['s.name', 'like', '%' . $param['supplier_name'] . '%'];
|
|
|
|
|
|
$list = Db::name('good_platform')
|
|
|
->alias('gp')
|
|
|
- ->field('gp.skuCode as 商品上线编号,gp.spuCode as 商品成本编号,gp.plat_code as 平台商品编码,gb.good_name as 商品名称,b.brand_name as 品牌名称,gb.cat_id as 分类,gb.gb.companyNo as 业务公司编码,gb.companyName as 业务公司名称,gb.creater as 采购员,p.platform_name as 上线平台,gp.online_time as 上线完成时间,gp.exam_status as 上下线状态,gb.is_stock as 是否库存品,gb.good_type as 是否定制,"" as 规格,"" as 型号,u.unit as 单位,gb.good_remark as 商品备注,gb.craft_desc as 工艺说明,gb.noble_metal as 贵金属信息,gb.cgd_gold_price as 供应商采购金价,gb.demo_fee as 打样费,gb.open_fee as 开模费,gb.sample_fee as 调样费,gb.tax as 税点,gb.supply_area as 供货区域,gb.supplierName as 供应商名称,gp.addtime 申请上线时间')
|
|
|
+ ->field('gp.skuCode as 商品上线编号,gp.spuCode as 商品成本编号,gp.plat_code as 平台商品编码,gb.good_name as 商品名称,b.brand_name as 品牌名称,gb.cat_id as 分类,gb.companyNo as 业务公司编码,gb.companyName as 业务公司名称,gb.creater as 采购员,p.platform_name as 上线平台,gp.online_time as 上线完成时间,gp.exam_status as 上下线状态,gb.is_stock as 是否库存品,gb.good_type as 是否定制,"" as 规格,"" as 型号,u.unit as 单位,gb.good_remark as 商品备注,gb.craft_desc as 工艺说明,gb.noble_metal as 贵金属信息,gb.cgd_gold_price as 供应商采购金价,gb.demo_fee as 打样费,gb.open_fee as 开模费,gb.sample_fee as 调样费,gb.tax as 税点,gb.supply_area as 供货区域,gb.supplierName as 供应商名称,gp.addtime 申请上线时间')
|
|
|
->leftJoin('good_basic gb', 'gb.spuCode=gp.spuCode AND gb.is_del=0')
|
|
|
->leftJoin('brand b', 'b.id=gb.brand_id')
|
|
|
->leftJoin('unit u', 'u.id=gb.good_unit')
|