mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
convert 1688 purchase order to po on document upload
This commit is contained in:
@@ -35,27 +35,6 @@ class Convert1688PurchaseOrderToProductList
|
||||
$discount = array_filter($footer, function($var) { return preg_match("/(Discount|优惠)/", $var); });
|
||||
$discount = (float) filter_var(reset($discount), FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION );
|
||||
|
||||
if($shipping > 0) {
|
||||
$productList[] = [
|
||||
'stockCode' => '',
|
||||
'description' => 'Shipping Fee',
|
||||
'quantity' => 1,
|
||||
'unit_price' => $shipping,
|
||||
'total' => $shipping
|
||||
];
|
||||
}
|
||||
|
||||
if($discount > 0) {
|
||||
$productList[] = [
|
||||
'stockCode' => '',
|
||||
'description' => 'Discount',
|
||||
'quantity' => 1,
|
||||
'unit_price' => $discount * -1,
|
||||
'total' => $discount * -1
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
array_shift($tables);
|
||||
|
||||
foreach ($tables as $table){
|
||||
@@ -81,6 +60,26 @@ class Convert1688PurchaseOrderToProductList
|
||||
}
|
||||
}
|
||||
|
||||
if($shipping > 0) {
|
||||
$productList[] = [
|
||||
'stockCode' => '',
|
||||
'description' => 'Shipping Fee',
|
||||
'quantity' => 1,
|
||||
'unit_price' => $shipping,
|
||||
'total' => $shipping
|
||||
];
|
||||
}
|
||||
|
||||
if($discount > 0) {
|
||||
$productList[] = [
|
||||
'stockCode' => '',
|
||||
'description' => 'Discount',
|
||||
'quantity' => 1,
|
||||
'unit_price' => $discount * -1,
|
||||
'total' => $discount * -1
|
||||
];
|
||||
}
|
||||
|
||||
return $productList;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user