|
@@ -269,6 +269,7 @@ class TPlusServerService extends Service
|
|
COALESCE(pn.idsaleman, 0) as employee_id_2,
|
|
COALESCE(pn.idsaleman, 0) as employee_id_2,
|
|
COALESCE(pn.code, '') as customer_code,
|
|
COALESCE(pn.code, '') as customer_code,
|
|
COALESCE(pn.name, '') as customer_title,
|
|
COALESCE(pn.name, '') as customer_title,
|
|
|
|
+ COALESCE(pn.priuserdefnvc14, 0) as customer_profit_rate,
|
|
COALESCE(sd.pubuserdefnvc11, '') as channel_finance,
|
|
COALESCE(sd.pubuserdefnvc11, '') as channel_finance,
|
|
COALESCE(sd.pubuserdefnvc12, '') as channel_details,
|
|
COALESCE(sd.pubuserdefnvc12, '') as channel_details,
|
|
COALESCE(it.code, '') as product_code,
|
|
COALESCE(it.code, '') as product_code,
|
|
@@ -355,6 +356,7 @@ class TPlusServerService extends Service
|
|
si.voucherdate as order_time,
|
|
si.voucherdate as order_time,
|
|
COALESCE(pn.code, '') as customer_code,
|
|
COALESCE(pn.code, '') as customer_code,
|
|
COALESCE(pn.name, '') as customer_title,
|
|
COALESCE(pn.name, '') as customer_title,
|
|
|
|
+ COALESCE(pn.priuserdefnvc14, 0) as customer_profit_rate,
|
|
COALESCE(si.idclerk, 0) as employee_id_1,
|
|
COALESCE(si.idclerk, 0) as employee_id_1,
|
|
COALESCE(ps.name, '') as employee_id_1_title,
|
|
COALESCE(ps.name, '') as employee_id_1_title,
|
|
COALESCE(pn.idsaleman, 0) as employee_id_2,
|
|
COALESCE(pn.idsaleman, 0) as employee_id_2,
|
|
@@ -432,8 +434,9 @@ class TPlusServerService extends Service
|
|
->leftJoin('AA_Unit as ui', 'si_b.idbaseunit', '=', 'ui.ID')
|
|
->leftJoin('AA_Unit as ui', 'si_b.idbaseunit', '=', 'ui.ID')
|
|
->where('rp.voucherdate','>=',$data['start_time'])
|
|
->where('rp.voucherdate','>=',$data['start_time'])
|
|
->where('rp.voucherdate','<=',$data['end_time'])
|
|
->where('rp.voucherdate','<=',$data['end_time'])
|
|
|
|
+ ->where('rp_b.idvouchertype','=', 20) // 销售发票
|
|
->where('rp.isReceiveFlag','=', 1)
|
|
->where('rp.isReceiveFlag','=', 1)
|
|
- ->where('rp_b.ID', '>', $lastId) // 用真实字段
|
|
|
|
|
|
+ ->where('rp_b.ID', '>', $lastId)
|
|
->orderBy('rp_b.ID')
|
|
->orderBy('rp_b.ID')
|
|
->limit($limit)
|
|
->limit($limit)
|
|
->selectRaw("
|
|
->selectRaw("
|
|
@@ -442,6 +445,7 @@ class TPlusServerService extends Service
|
|
rp.voucherdate as order_time,
|
|
rp.voucherdate as order_time,
|
|
COALESCE(pn.code, '') as customer_code,
|
|
COALESCE(pn.code, '') as customer_code,
|
|
COALESCE(pn.name, '') as customer_title,
|
|
COALESCE(pn.name, '') as customer_title,
|
|
|
|
+ COALESCE(pn.priuserdefnvc14, 0) as customer_profit_rate,
|
|
COALESCE(it.code, '') as product_code,
|
|
COALESCE(it.code, '') as product_code,
|
|
COALESCE(it.name, '') as product_title,
|
|
COALESCE(it.name, '') as product_title,
|
|
COALESCE(rp.idperson, 0) as employee_id_1,
|
|
COALESCE(rp.idperson, 0) as employee_id_1,
|
|
@@ -565,6 +569,7 @@ class TPlusServerService extends Service
|
|
'id_detail_upstream' => $item->id_detail_upstream?? 0,
|
|
'id_detail_upstream' => $item->id_detail_upstream?? 0,
|
|
'order_number_upstream' => $item->order_number_upstream ?? "",
|
|
'order_number_upstream' => $item->order_number_upstream ?? "",
|
|
'is_activity' => $item->is_activity ?? 0,
|
|
'is_activity' => $item->is_activity ?? 0,
|
|
|
|
+ 'customer_profit_rate' => $item->customer_profit_rate ?? 0,
|
|
'crt_time' => $time,
|
|
'crt_time' => $time,
|
|
];
|
|
];
|
|
})->toArray();
|
|
})->toArray();
|
|
@@ -706,6 +711,7 @@ class TPlusServerService extends Service
|
|
$table->bigInteger('id_detail_upstream')->default(0);
|
|
$table->bigInteger('id_detail_upstream')->default(0);
|
|
$table->string('order_number_upstream', 100)->nullable();
|
|
$table->string('order_number_upstream', 100)->nullable();
|
|
$table->decimal('is_activity', 2, 0)->default(0);
|
|
$table->decimal('is_activity', 2, 0)->default(0);
|
|
|
|
+ $table->string('customer_profit_rate', 20)->default('');
|
|
});
|
|
});
|
|
}
|
|
}
|
|
}
|
|
}
|