debug po upload

This commit is contained in:
omair saleh
2022-10-28 10:05:22 +08:00
parent 7892f37ed8
commit 4f7f7bf7aa
2 changed files with 6 additions and 4 deletions
@@ -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([]);
@@ -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']));