cqp 3 周之前
父節點
當前提交
d8e07e3cc2
共有 1 個文件被更改,包括 12 次插入4 次删除
  1. 12 4
      app/Service/TPlusServerService.php

+ 12 - 4
app/Service/TPlusServerService.php

@@ -251,6 +251,7 @@ class TPlusServerService extends Service
                     ->join('SA_SaleDelivery as sd', 'sd_b.idSaleDeliveryDTO', '=', 'sd.ID')
                     ->leftJoin('AA_Partner as pn', 'sd.idsettlecustomer', '=', 'pn.ID')
                     ->leftJoin('AA_Person as ps', 'sd.idclerk', '=', 'ps.ID')
+                    ->leftJoin('AA_Person as ps2', 'pn.idsaleman', '=', 'ps2.ID')
                     ->leftJoin('AA_Inventory as it', 'sd_b.idinventory', '=', 'it.ID')
                     ->leftJoin('AA_Unit as ui', 'sd_b.idbaseunit', '=', 'ui.ID')
                     ->where('sd.voucherdate', '>=', $data['start_time'])
@@ -264,7 +265,8 @@ class TPlusServerService extends Service
                         sd.voucherdate as order_time,
                         COALESCE(ps.name, '') as employee_id_1_title,
                         COALESCE(sd.idclerk, 0) as employee_id_1,
-                        COALESCE(pn.priuserdefnvc15, '') as employee_id_2_title,
+                        COALESCE(ps2.name, '') as employee_id_2_title,
+                        COALESCE(pn.idsaleman, 0) as employee_id_2,
                         COALESCE(pn.code, '') as customer_code,
                         COALESCE(pn.name, '') as customer_title,
                         COALESCE(sd.pubuserdefnvc11, '') as channel_finance,
@@ -339,6 +341,7 @@ class TPlusServerService extends Service
                     ->leftJoin('SA_SaleDelivery_b as sd_b', 'si_b.sourceVoucherDetailId', '=', 'sd_b.ID')
                     ->leftJoin('AA_Partner as pn', 'si.idsettlecustomer', '=', 'pn.ID')
                     ->leftJoin('AA_Person as ps', 'si.idclerk', '=', 'ps.ID')
+                    ->leftJoin('AA_Person as ps2', 'pn.idsaleman', '=', 'ps2.ID')
                     ->leftJoin('AA_Inventory as it', 'si_b.idinventory', '=', 'it.ID')
                     ->leftJoin('AA_Unit as ui', 'si_b.idbaseunit', '=', 'ui.ID')
                     ->where('si.voucherdate','>=',$data['start_time'])
@@ -354,7 +357,8 @@ class TPlusServerService extends Service
                         COALESCE(pn.name, '') as customer_title,
                         COALESCE(si.idclerk, 0) as employee_id_1,
                         COALESCE(ps.name, '') as employee_id_1_title,
-                        COALESCE(pn.priuserdefnvc15, '') as employee_id_2_title,
+                        COALESCE(pn.idsaleman, 0) as employee_id_2,
+                        COALESCE(ps2.name, '') as employee_id_2_title,
                         COALESCE(it.code, '') as product_code,
                         COALESCE(it.name, '') as product_title,
                         COALESCE(it.specification, '') as product_size,
@@ -423,6 +427,7 @@ class TPlusServerService extends Service
                     ->leftJoin('SA_SaleDelivery_b as sd_b', 'si_b.sourceVoucherDetailId', '=', 'sd_b.ID')
                     ->leftJoin('AA_Partner as pn', 'si.idsettlecustomer', '=', 'pn.ID')
                     ->leftJoin('AA_Person as ps', 'rp.idperson', '=', 'ps.ID')
+                    ->leftJoin('AA_Person as ps2', 'pn.idsaleman', '=', 'ps2.ID')
                     ->leftJoin('AA_Inventory as it', 'si_b.idinventory', '=', 'it.ID')
                     ->leftJoin('AA_Unit as ui', 'si_b.idbaseunit', '=', 'ui.ID')
                     ->where('rp.voucherdate','>=',$data['start_time'])
@@ -441,7 +446,8 @@ class TPlusServerService extends Service
                         COALESCE(it.name, '') as product_title,
                         COALESCE(rp.idperson, 0) as employee_id_1,
                         COALESCE(ps.name, '') as employee_id_1_title,
-                        COALESCE(pn.priuserdefnvc15, '') as employee_id_2_title,
+                        COALESCE(pn.idsaleman, 0) as employee_id_2,
+                        COALESCE(ps2.name, '') as employee_id_2_title,
                         COALESCE(it.specification, '') as product_size,
                         COALESCE(ui.name, '') as unit,
                         COALESCE(si_b.quantity, 0) as quantity,
@@ -531,7 +537,8 @@ class TPlusServerService extends Service
                             'order_number' => $item->order_number,
                             'order_time' => $item->order_time,
                             'employee_id_1_title' => $item->employee_id_1_title,
-                            'employee_id_1' => $item->employee_id_1,
+                            'employee_id_1' => $item->employee_id_1 ?? 0,
+                            'employee_id_2' => $item->employee_id_2 ?? 0,
                             'employee_id_2_title' => $item->employee_id_2_title ?? "",
                             'customer_code' => $item->customer_code,
                             'customer_title' => $item->customer_title,
@@ -673,6 +680,7 @@ class TPlusServerService extends Service
                 $table->integer('order_time')->nullable();
                 $table->string('employee_id_1_title', 100)->default('');
                 $table->bigInteger('employee_id_1')->default(0);
+                $table->bigInteger('employee_id_2')->default(0);
                 $table->string('employee_id_2_title', 100)->default('');
                 $table->string('customer_code', 50)->default('');
                 $table->string('customer_title', 100)->default('');