|
@@ -485,11 +485,17 @@ class SaleReport extends Base
|
|
|
//【一、管理报表】3.订单报表
|
|
|
public function saleList()
|
|
|
{
|
|
|
- $param = $this->request->only(['token', 'start_date' => '', 'end_date' => '', 'page' => 1, 'size' => 15], 'post', 'trim');
|
|
|
-
|
|
|
+ $param = $this->request->only(['token','depart_id'=>'', 'plat_type'=>'', 'start_date' => '', 'end_date' => '', 'page' => 1, 'size' => 15], 'post', 'trim');
|
|
|
$where = [['s.is_del', '=', 0]];
|
|
|
if ($param['start_date'] != '' && $param['end_date'] != '') $where[] = ['s.addtime', 'between', [$param['start_date'] . ' 00:00:00', $param['end_date'] . ' 23:59:59']];
|
|
|
-
|
|
|
+ if ($param['depart_id'] != ''){
|
|
|
+ $uidArr = get_company_item_user_by_name('',$param['depart_id']);
|
|
|
+ $where[] = ['a.apply_id', 'in',$uidArr];
|
|
|
+ }
|
|
|
+ if ($param['plat_type'] !== ''){
|
|
|
+ $plat =Db::name('platform')->where(['use_type'=>$param['plat_type'],'is_del'=>0])->column('id');
|
|
|
+ $where[] = ['a.platform_id', 'in',$plat];
|
|
|
+ }
|
|
|
$count = Db::name('sale')
|
|
|
->alias('s')
|
|
|
// ->leftJoin('customer_info csi', 'csi.companyNo=s.customer_code')
|
|
@@ -552,11 +558,18 @@ class SaleReport extends Base
|
|
|
//【一、管理报表】3.订单报表_导出
|
|
|
public function saleExport()
|
|
|
{
|
|
|
- $param = $this->request->only(['token', 'start_date' => '', 'end_date' => ''], 'post', 'trim');
|
|
|
+ $param = $this->request->only(['token',"depart_id"=>"", "plat_type"=>"",'start_date' => '', 'end_date' => ''], 'post', 'trim');
|
|
|
|
|
|
$where = [['s.is_del', '=', 0]];
|
|
|
if ($param['start_date'] != '' && $param['end_date'] != '') $where[] = ['s.addtime', 'between', [$param['start_date'] . ' 00:00:00', $param['end_date'] . ' 23:59:59']];
|
|
|
-
|
|
|
+ if ($param['depart_id'] != ''){
|
|
|
+ $uidArr = get_company_item_user_by_name('',$param['depart_id']);
|
|
|
+ $where[] = ['a.apply_id', 'in',$uidArr];
|
|
|
+ }
|
|
|
+ if ($param['plat_type'] !== ''){
|
|
|
+ $plat =Db::name("platform")->where(["use_type"=>$param['plat_type'],"is_del"=>0])->column("id");
|
|
|
+ $where[] = ['a.platform_id', 'in',$plat];
|
|
|
+ }
|
|
|
$data = Db::name('sale')
|
|
|
->alias('s')
|
|
|
->field('s.apply_name 创建人,"" 创建人所属部门,s.addtime 下单时间,s.orderCode 订单号,"" 一级企业,"" 二级企业,"" 客户名称,s.good_name 商品名称,s.good_num 数量,"" 单位,s.sale_price 单价,s.total_price 金额,s.is_stock 是否库存,s.order_type 订单类型,s.good_code,s.apply_id,s.cat_id,s.customer_code')
|