|
@@ -208,7 +208,7 @@ class Report extends Base
|
|
|
|
|
|
}
|
|
|
|
|
|
- //【一、采购日报表】1.咨询单总数
|
|
|
+ //【一、采购日报表】1.竞价单总数
|
|
|
public function zixunTotal()
|
|
|
{
|
|
|
$param = $this->request->only([
|
|
@@ -377,7 +377,7 @@ class Report extends Base
|
|
|
|
|
|
}
|
|
|
|
|
|
- //【一、采购日报表】3.采购员回复咨询单数
|
|
|
+ //【一、采购日报表】3.采购员回复竞价单数
|
|
|
public function consultBidsSum()
|
|
|
{
|
|
|
$param = $this->request->only([
|
|
@@ -422,7 +422,7 @@ class Report extends Base
|
|
|
->where($where)
|
|
|
->group('addtime,du.itemid,ci.name ,cb.createrid,du.nickname,s.name')
|
|
|
->order('addtime desc,du.itemid,ci.name ,cb.createrid,du.nickname')
|
|
|
- ->page($param['page'], $param['size'])
|
|
|
+// ->page($param['page'], $param['size'])
|
|
|
->cursor();
|
|
|
|
|
|
$data = [];
|
|
@@ -473,8 +473,8 @@ class Report extends Base
|
|
|
'token',
|
|
|
'start_date' => '',
|
|
|
'end_date' => '',
|
|
|
- 'page' => 1,
|
|
|
- 'size' => 15
|
|
|
+// 'page' => 1,
|
|
|
+// 'size' => 15
|
|
|
], 'post', 'trim');
|
|
|
|
|
|
$val_params = Validate::rule([
|
|
@@ -493,27 +493,30 @@ class Report extends Base
|
|
|
->where($where)
|
|
|
->buildSql();
|
|
|
|
|
|
- $count = Db::table($children_query)
|
|
|
- ->alias('a')
|
|
|
- ->group('addtime,cgder_id,cgder')
|
|
|
- ->count();
|
|
|
+// $count = Db::table($children_query)
|
|
|
+// ->alias('a')
|
|
|
+// ->group('addtime,cgder_id,cgder')
|
|
|
+// ->count();
|
|
|
|
|
|
$rs = Db::table($children_query)
|
|
|
->alias('a')
|
|
|
->field('a.addtime,a.cgder_id,a.cgder,SUM(a.total_fee) total_fee,SUM(a.good_num) good_num,COUNT(a.id) count_num,a.status,0 wait_total_fee,0 wait_good_num')
|
|
|
->group('a.addtime,a.cgder_id,a.cgder,a.status')
|
|
|
->order('a.addtime desc,a.cgder_id')
|
|
|
- ->page($param['page'], $param['size'])
|
|
|
+// ->page($param['page'], $param['size'])
|
|
|
->cursor();
|
|
|
|
|
|
$data = [];
|
|
|
foreach ($rs as $value) {
|
|
|
|
|
|
+ //判断采购员是否公司内部
|
|
|
+ $temp = Db::name('depart_user')->field('id')->where(['uid' => $value['cgder_id'], 'nickname' => $value['cgder']])->findOrEmpty();
|
|
|
+
|
|
|
if (!isset($data[$value['addtime']][$value['cgder_id']])) {
|
|
|
$data[$value['addtime']][$value['cgder_id']] = [
|
|
|
'addtime' => $value['addtime'],
|
|
|
'cgder' => $value['cgder'],
|
|
|
- 'name' => get_company_name_by_uid($value['cgder_id']),
|
|
|
+ 'name' => $temp ? get_company_name_by_uid($value['cgder_id']) : '供应商',
|
|
|
'count_num' => '0',
|
|
|
'total_fee' => '0',
|
|
|
'good_num' => '0',
|
|
@@ -541,7 +544,7 @@ class Report extends Base
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- return app_show(0, '请求成功', ['list' => $da, 'count' => $count]);
|
|
|
+ return app_show(0, '请求成功', $da[0]);
|
|
|
|
|
|
}
|
|
|
|
|
@@ -2263,84 +2266,6 @@ class Report extends Base
|
|
|
|
|
|
}
|
|
|
|
|
|
- //【今日咨询单】列表
|
|
|
- public function todayZx()
|
|
|
- {
|
|
|
- $a = $this->todayZxTotal();
|
|
|
-
|
|
|
- halt($a);
|
|
|
- $param = $this->request->only([
|
|
|
- 'token',
|
|
|
- 'start_date' => '',
|
|
|
- 'end_date' => '',
|
|
|
- 'spuCode' => '',
|
|
|
- 'cgder' => '',
|
|
|
-// 'page' => 1,
|
|
|
-// 'size' => 15
|
|
|
- ], 'post', 'trim');
|
|
|
-
|
|
|
- $val_params = Validate::rule([
|
|
|
- 'start_date|开始日期' => 'date|elt:end_date',
|
|
|
- 'end_date|结束日期' => 'date|egt:start_date'
|
|
|
- ]);
|
|
|
-
|
|
|
- if (!$val_params->check($param)) return error_show(1004, $val_params->getError());
|
|
|
-
|
|
|
- $where = [];
|
|
|
-// 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['spuCode'] != '') $where[] = ['gp.spuCode', 'like', '%' . $param['spuCode'] . '%'];
|
|
|
-
|
|
|
-
|
|
|
- $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')
|
|
|
- ->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')
|
|
|
- ->withAttr('name', function ($val, $data) {
|
|
|
- return get_company_name_by_uid($data['createrid']);
|
|
|
- })
|
|
|
- ->withAttr('salesman_name', function ($val, $data) {
|
|
|
- return get_company_name_by_uid($data['saleid']);
|
|
|
- })
|
|
|
- ->where($where)
|
|
|
-// ->page($param['page'], $param['size'])
|
|
|
- ->order('ci.addtime', 'desc')
|
|
|
- ->select()
|
|
|
- ->toArray();
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- //【今日咨询单】导出
|
|
|
- public function todayZxExport()
|
|
|
- {
|
|
|
- }
|
|
|
-
|
|
|
- //【今日咨询单】今日咨询单总量,为上面列表和导出接口服务
|
|
|
- private function todayZxTotal()
|
|
|
- {
|
|
|
- //今日咨询单总量
|
|
|
- $today_consult_total = Db::name('consult_bids')
|
|
|
- ->where(['is_del' => 0])
|
|
|
- ->whereTime('addtime', 'today')
|
|
|
- ->count('id');
|
|
|
-
|
|
|
- //今日采购单总量
|
|
|
- $today_purchease_order_total = Db::name('purchease_order')
|
|
|
- ->where(['is_del' => 0])
|
|
|
- ->whereTime('addtime', 'today')
|
|
|
- ->count('id');
|
|
|
-
|
|
|
- //to B 订单数量
|
|
|
- $today_purchease_order_total = Db::name('sale')
|
|
|
- ->where(['is_del' => 0])
|
|
|
- ->whereTime('addtime', 'today')
|
|
|
- ->count('id');
|
|
|
-
|
|
|
- return $data;
|
|
|
- }
|
|
|
-
|
|
|
+
|
|
|
|
|
|
}
|