Prechádzať zdrojové kódy

up - 新增查询列

liugc 1 rok pred
rodič
commit
cdd470c11f

+ 5 - 0
app/adminapi/lists/master_commission/MasterWorkerCommissionNoticeLists.php

@@ -17,7 +17,9 @@ namespace app\adminapi\lists\master_commission;
 
 use app\adminapi\lists\BaseAdminDataLists;
 use app\common\lists\ListsSearchInterface;
+use app\common\model\master_commission\MasterWorkerCommissionConfig;
 use app\common\model\master_worker\MasterWorker;
+use app\common\model\works\ServiceWorkAllocateWorkerLog;
 use think\facade\Db;
 
 
@@ -67,6 +69,8 @@ class MasterWorkerCommissionNoticeLists extends BaseAdminDataLists implements Li
             $mw_ids = MasterWorker::where([[ 'mw.worker_number','like','%'.$this->params['real_name'].'%']])->column('id');
             $where[] = [ 'n.master_worker_id','in',$mw_ids?:[0]];
         }
+        $mwids = MasterWorkerCommissionConfig::where('voucher_status', 2)->column('master_worker_id');
+        $where[] = [ 'n.master_worker_id','in',$mwids?:[0]];
         return $where;
     }
 
@@ -97,6 +101,7 @@ class MasterWorkerCommissionNoticeLists extends BaseAdminDataLists implements Li
             ->select()->toArray();
         foreach ($lists as &$item) {
             $item['labels'] = $item['labels']?array_map(function ($item) { return intval($item); },explode(',',$item['labels'])):'';
+            $item['allocate_num'] = ServiceWorkAllocateWorkerLog::where(['master_worker_id'=>$item['master_worker_id']])->count();
         }
         return $lists;
     }

+ 5 - 3
app/adminapi/lists/sale/PropertyHeadAnalysisLists.php

@@ -70,7 +70,7 @@ class PropertyHeadAnalysisLists extends BaseAdminDataLists implements ListsSearc
             ->leftJoin('property_head c', 'a.property_head_id = c.id')
             ->leftJoin('sale d', 'a.sale_id = d.id')
             ->field([
-                'a.property_head_id','c.property_name','c.village_name','c.address','c.head_name','c.head_mobile','d.sale_name',
+                'a.property_head_id','c.property_name','c.village_name','c.address','c.head_name','c.head_mobile','c.ratio','d.sale_name',
                 Db::raw("COUNT(a.work_id) AS work_count,SUM(b.work_amount) AS total_sales_amount")
             ])
             ->where('a.sale_type', 'in', [1, 2])
@@ -107,9 +107,11 @@ class PropertyHeadAnalysisLists extends BaseAdminDataLists implements ListsSearc
     public function setExcelComplexFields(): array
     {
         $zh_cn_fields = [
-            '所属代理','所属小区', '所属销售','单数','总金额'
+            '所属代理','所属小区', '所属销售','单数','总金额','分成比例','分成金额'
         ];
-        $data_fields = ['property_name','village_name','sale_name','work_count','total_sales_amount'];
+        $data_fields = ['property_name','village_name','sale_name','work_count','total_sales_amount','ratio',function($row){
+            return bcmul($row['total_sales_amount'], bcdiv($row['ratio'], 100, 4),2);
+        }];
         return [
             'zh_cn_fields' => $zh_cn_fields,
             'data_fields' => $data_fields