|
@@ -83,12 +83,15 @@ class U8ServerService extends Service
|
|
|
->leftJoin('Inventory as b', 'b.cInvCode', 'a.cInvCode')
|
|
->leftJoin('Inventory as b', 'b.cInvCode', 'a.cInvCode')
|
|
|
->leftJoin('ComputationUnit as c', 'c.cComunitCode', 'b.cComUnitCode')
|
|
->leftJoin('ComputationUnit as c', 'c.cComunitCode', 'b.cComUnitCode')
|
|
|
->where('a.ID', $order['id'])
|
|
->where('a.ID', $order['id'])
|
|
|
- ->select('b.cInvName as product_title','b.cInvCode as product_code','c.cComUnitName as unit_title',DB::raw("CONVERT(varchar(10), a.dRequirDate, 120) as need_arrived_date"),DB::raw("LTRIM(STR(a.fQuantity, 20, 2)) as quantity"))
|
|
|
|
|
|
|
+ ->select('b.cInvName as product_title','b.cInvStd as product_size','b.cInvCode as product_code','c.cComUnitName as unit_title',DB::raw("CONVERT(varchar(10), a.dRequirDate, 120) as need_arrived_date"),DB::raw("LTRIM(STR(a.fQuantity, 20, 2)) as quantity"))
|
|
|
->get();
|
|
->get();
|
|
|
// 转为数组的数组
|
|
// 转为数组的数组
|
|
|
$detail = array_map(function ($item) {
|
|
$detail = array_map(function ($item) {
|
|
|
return (array) $item;
|
|
return (array) $item;
|
|
|
}, $detail->toArray());
|
|
}, $detail->toArray());
|
|
|
|
|
+ foreach ($detail as $key => $value){
|
|
|
|
|
+ if(! empty($value['product_size'])) $detail[$key]['product_title'] = $value['product_title'] . '|' . $value['product_size'];
|
|
|
|
|
+ }
|
|
|
$order['detail'] = $detail;
|
|
$order['detail'] = $detail;
|
|
|
|
|
|
|
|
return [true, $order];
|
|
return [true, $order];
|
|
@@ -143,12 +146,15 @@ class U8ServerService extends Service
|
|
|
->leftJoin('Inventory as b', 'b.cInvCode', 'a.cInvCode')
|
|
->leftJoin('Inventory as b', 'b.cInvCode', 'a.cInvCode')
|
|
|
->leftJoin('ComputationUnit as c', 'c.cComunitCode', 'b.cComUnitCode')
|
|
->leftJoin('ComputationUnit as c', 'c.cComunitCode', 'b.cComUnitCode')
|
|
|
->where('a.POID', $order['id'])
|
|
->where('a.POID', $order['id'])
|
|
|
- ->select('b.cInvName as product_title','b.cInvCode as product_code','c.cComUnitName as unit_title',DB::raw("LTRIM(STR(a.iQuantity, 20, 2)) as quantity"),DB::raw("LTRIM(STR(a.iSum, 20, 2)) as amount"))
|
|
|
|
|
|
|
+ ->select('b.cInvName as product_title','b.cInvStd as product_size','b.cInvCode as product_code','c.cComUnitName as unit_title',DB::raw("LTRIM(STR(a.iQuantity, 20, 2)) as quantity"),DB::raw("LTRIM(STR(a.iSum, 20, 2)) as amount"))
|
|
|
->get();
|
|
->get();
|
|
|
// 转为数组的数组
|
|
// 转为数组的数组
|
|
|
$detail = array_map(function ($item) {
|
|
$detail = array_map(function ($item) {
|
|
|
return (array) $item;
|
|
return (array) $item;
|
|
|
}, $detail->toArray());
|
|
}, $detail->toArray());
|
|
|
|
|
+ foreach ($detail as $key => $value){
|
|
|
|
|
+ if(! empty($value['product_size'])) $detail[$key]['product_title'] = $value['product_title'] . '|' . $value['product_size'];
|
|
|
|
|
+ }
|
|
|
$order['detail'] = $detail;
|
|
$order['detail'] = $detail;
|
|
|
|
|
|
|
|
return [true, $order];
|
|
return [true, $order];
|
|
@@ -200,13 +206,16 @@ class U8ServerService extends Service
|
|
|
->leftJoin('Inventory as b', 'b.cInvCode', 'a.cInvCode')
|
|
->leftJoin('Inventory as b', 'b.cInvCode', 'a.cInvCode')
|
|
|
->leftJoin('ComputationUnit as c', 'c.cComunitCode', 'b.cComUnitCode')
|
|
->leftJoin('ComputationUnit as c', 'c.cComunitCode', 'b.cComUnitCode')
|
|
|
->where('a.PID', $order['id'])
|
|
->where('a.PID', $order['id'])
|
|
|
- ->select('a.cSource as source','a.cCoVouchID as source_order_number','b.cInvName as product_title','c.cComUnitName as unit_title',DB::raw("LTRIM(STR(a.iApplyAmt_s, 20, 2)) as number"),
|
|
|
|
|
|
|
+ ->select('a.cSource as source','a.cCoVouchID as source_order_number','b.cInvName as product_title','b.cInvStd as product_size','c.cComUnitName as unit_title',DB::raw("LTRIM(STR(a.iApplyAmt_s, 20, 2)) as number"),
|
|
|
DB::raw("LTRIM(STR(a.iApplyAmt_f, 20, 2)) as amount"))
|
|
DB::raw("LTRIM(STR(a.iApplyAmt_f, 20, 2)) as amount"))
|
|
|
->get();
|
|
->get();
|
|
|
// 转为数组的数组
|
|
// 转为数组的数组
|
|
|
$detail = array_map(function ($item) {
|
|
$detail = array_map(function ($item) {
|
|
|
return (array) $item;
|
|
return (array) $item;
|
|
|
}, $detail->toArray());
|
|
}, $detail->toArray());
|
|
|
|
|
+ foreach ($detail as $key => $value){
|
|
|
|
|
+ if(! empty($value['product_size'])) $detail[$key]['product_title'] = $value['product_title'] . '|' . $value['product_size'];
|
|
|
|
|
+ }
|
|
|
// 使用 array_column 提取所有 amount 并求和
|
|
// 使用 array_column 提取所有 amount 并求和
|
|
|
$order['total_amount'] = number_format(array_sum(array_column($detail, 'amount')), 2, '.', '');
|
|
$order['total_amount'] = number_format(array_sum(array_column($detail, 'amount')), 2, '.', '');
|
|
|
$order['detail'] = $detail;
|
|
$order['detail'] = $detail;
|