mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
debug po upload
This commit is contained in:
@@ -83,7 +83,7 @@ class UploadPurchaseOrderLogic extends AbstractControllerLogic
|
||||
$document = $this->createsDocument->execute($booking, $object);
|
||||
|
||||
$this->createsFile->execute($document, $object);
|
||||
dd($document);
|
||||
|
||||
$this->createPurchaseOrderFor1688OrderProcessor->execute($booking);
|
||||
|
||||
return $this->response([]);
|
||||
|
||||
+5
-3
@@ -50,12 +50,13 @@ class CreatePurchaseOrderFor1688OrderProcessor
|
||||
}
|
||||
|
||||
|
||||
public function execute(Booking $booking){
|
||||
public function execute(Booking $booking)
|
||||
{
|
||||
$billNumber = $this->generatesTransactionBillNumber->execute('PO-');
|
||||
|
||||
$documents = $booking->documents()->where('document_type', DocumentType::ECOMMERCE_PURCHASE_ORDER)->get();
|
||||
$products = [];
|
||||
foreach($documents as $document) {
|
||||
foreach ($documents as $document) {
|
||||
foreach ($document->files as $file) {
|
||||
try {
|
||||
$products = $this->convert1688PurchaseOrderToProductList->execute($file);
|
||||
@@ -65,13 +66,14 @@ class CreatePurchaseOrderFor1688OrderProcessor
|
||||
}
|
||||
}
|
||||
|
||||
if(empty($products))
|
||||
if (empty($products)){
|
||||
$object = new TransactionObject($billNumber, TransactionType::PURCHASE_ORDER, $booking->company->id, 1,
|
||||
1, PaymentMethodType::CASH,
|
||||
0, 0, $booking->fix_currency_id, $booking->fix_currency_id,
|
||||
1, 0, 0, null, ApprovalStatus::PENDING_SUBMISSION, []);
|
||||
$this->createPurchaseOrderTransactionProcessor->execute($booking, $object);
|
||||
return false;
|
||||
}
|
||||
|
||||
$total = collect($products)->sum(function($product){
|
||||
return $product['quantity'] * floatval(str_replace(',', '', $product['unit_price']));
|
||||
|
||||
Reference in New Issue
Block a user