|
@@ -2319,7 +2319,7 @@ class SaleReport extends Base
|
|
|
$count_row = Db::name('sale')
|
|
|
->alias('a')
|
|
|
->where($where)
|
|
|
- ->field(" a.good_num-th_num - (select sum('receipt_quantity') from wsm_order_addr where orderCode=a.orderCode and is_del=0) not_addr_address_good_num,count(a.id) as count")
|
|
|
+ ->field(" a.good_num-th_num - IFNULL((select sum('receipt_quantity') from wsm_order_addr where orderCode=a.orderCode and is_del=0),0) not_addr_address_good_num,count(a.id) as count")
|
|
|
->having("not_addr_address_good_num>0")
|
|
|
->find();
|
|
|
$data = Db::name('sale')
|
|
@@ -2335,7 +2335,7 @@ class SaleReport extends Base
|
|
|
a.send_num,
|
|
|
a.wsend_num,
|
|
|
a.status,
|
|
|
- a.good_num-a.th_num - (select sum('receipt_quantity') from wsm_order_addr where orderCode=a.orderCode and is_del=0) not_addr_address_good_num,
|
|
|
+ a.good_num-a.th_num - IFNULL((select sum('receipt_quantity') from wsm_order_addr where orderCode=a.orderCode and is_del=0),0) not_addr_address_good_num,
|
|
|
a.apply_name nickname,
|
|
|
a.apply_id,
|
|
|
a.addtime")
|
|
@@ -3293,6 +3293,7 @@ class SaleReport extends Base
|
|
|
$value['收货联系人'] = "";
|
|
|
$value['联系方式'] ="";
|
|
|
$value['时效'] =report_sx($value['时效']);
|
|
|
+ $value['状态'] = $this->order_out_status[$value['状态']]??"";
|
|
|
if(isset($addr[$value['addrid']])){
|
|
|
if($addr[$value['addrid']]['addr_code']!=''){
|
|
|
if (!json_decode($addr[$value['addrid']]['addr_code'])) {
|
|
@@ -3315,7 +3316,7 @@ class SaleReport extends Base
|
|
|
//待采购备货
|
|
|
public function OrderOutBk(){
|
|
|
$param = $this->request->only(['token', 'supplierNo' => '', 'supplier_name' => '', 'start_day' => date('Y-m-01'), 'end_day' => date('Y-m-t'),'page' => 1, 'size' => 15], 'post', 'trim');
|
|
|
- $where = [['a.is_del', '=', 0]];
|
|
|
+ $where = [['a.is_del', '=', 0],['a.status', '=', 0]];
|
|
|
if ($param['supplierNo'] != '') $where[] = ['b.supplierNo', 'like', '%' . $param['supplierNo'] . '%'];
|
|
|
if ($param['supplier_name'] != '') $where[] = ['b.supplierName', 'like', '%' . $param['supplier_name'] . '%'];
|
|
|
if ($param['start_day'] != '' && $param['end_day'] != '') $where[] = ['a.addtime', 'between', [$param['start_day'] . ' 00:00:00', $param['end_day'] . ' 23:59:59']];
|
|
@@ -3331,6 +3332,7 @@ class SaleReport extends Base
|
|
|
,b.customerName,b.customer_code,b.supplierName,b.supplierNo,d.contactor,d.mobile,a.post_name,a.post_code,a.post_fee,'' send_time,
|
|
|
a.apply_id,a.apply_name,a.addtime,b.addtime createdTime,datediff(now(),a.addtime) sx,b.cgder")
|
|
|
->page($param['page'],$param['size'])
|
|
|
+ ->where($where)
|
|
|
->select()->toArray();
|
|
|
$data=[];
|
|
|
$platArr =array_column($list,"platform_id");
|
|
@@ -3356,7 +3358,7 @@ class SaleReport extends Base
|
|
|
//待采购备货
|
|
|
public function OrderOutExport(){
|
|
|
$param = $this->request->only(['token', 'supplierNo' => '', 'supplier_name' => '', 'start_day' => date('Y-m-01'), 'end_day' => date('Y-m-t'),'page' => 1, 'size' => 15], 'post', 'trim');
|
|
|
- $where = [['a.is_del', '=', 0]];
|
|
|
+ $where = [['a.is_del', '=', 0],['a.status', '=', 0]];
|
|
|
if ($param['supplierNo'] != '') $where[] = ['b.supplierNo', 'like', '%' . $param['supplierNo'] . '%'];
|
|
|
if ($param['supplier_name'] != '') $where[] = ['b.supplierName', 'like', '%' . $param['supplier_name'] . '%'];
|
|
|
if ($param['start_day'] != '' && $param['end_day'] != '') $where[] = ['a.addtime', 'between', [$param['start_day'] . ' 00:00:00', $param['end_day'] . ' 23:59:59']];
|
|
@@ -3391,9 +3393,10 @@ class SaleReport extends Base
|
|
|
a.apply_name 申请人,
|
|
|
a.addtime 添加时间,
|
|
|
b.addtime 下单日期,
|
|
|
- datediff(now(),a.ddtime) 时效,
|
|
|
+ datediff(now(),a.addtime) 时效,
|
|
|
b.cgder 供应商负责人")
|
|
|
->page($param['page'],$param['size'])
|
|
|
+ ->where($where)
|
|
|
->cursor();
|
|
|
$data=[];
|
|
|
// $platArr =array_column($list,"平台类型");
|
|
@@ -3408,7 +3411,7 @@ class SaleReport extends Base
|
|
|
foreach ($list as $item) {
|
|
|
if(!isset($depart[$item['申请人部门']])){
|
|
|
$temp=get_company_name_by_uid($item['申请人部门']);
|
|
|
- $depart[$item['申请人部门']]=$temp[$item['申请人部门']];
|
|
|
+ $depart[$item['申请人部门']]=$temp;
|
|
|
}
|
|
|
if(!isset($cat[$item['商品分类']])){
|
|
|
$cat[$item['商品分类']]= Db::name("cat")->where("id",$item['商品分类'])->value("search","");
|
|
@@ -3418,6 +3421,7 @@ class SaleReport extends Base
|
|
|
}
|
|
|
$item['平台类型'] = $this->plat_type[$plafrom[$item['平台类型']]];
|
|
|
$item['申请人部门'] = $depart[$item['申请人部门']]??"";
|
|
|
+ $item['状态'] = $this->order_out_status[$item['状态']]??"";
|
|
|
$item['订单来源'] = $this->order_source[$item['订单来源']]??"";
|
|
|
$item['商品类型'] = $this->all_order_type[$item['商品类型']]??"";
|
|
|
$item['商品分类'] = $cat[$item['商品分类']]??"";
|