mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-24 06:54:02 +00:00
delete 1688 purchase order for special customers
This commit is contained in:
@@ -408,3 +408,24 @@ Route::get('/1688/fix/{reference}', function($reference){
|
||||
// }
|
||||
})->name('ecommerce.fix');
|
||||
|
||||
Route::get('/po/manual/fix', function($reference){
|
||||
|
||||
$purchaseOrders = Transaction::where('type', TransactionType::PURCHASE_ORDER)->where('owner', function($query){
|
||||
return $query->whereIn('company_id', [199, 510])->whereHas('documents', function($query){
|
||||
return $query->where('document_type', DocumentType::ECOMMERCE_PURCHASE_ORDER);
|
||||
});
|
||||
})->first();
|
||||
dd($purchaseOrders);
|
||||
foreach ($purchaseOrders as $purchaseOrder){
|
||||
$purchaseOrder->status = ApprovalStatus::PENDING_SUBMISSION;
|
||||
$purchaseOrder->save();
|
||||
|
||||
$booking = $purchaseOrder->owner;
|
||||
$booking->status = ApprovalStatus::APPROVED;
|
||||
$booking->save();
|
||||
|
||||
$booking->documents()->whereIn('document_type', [DocumentType::PURCHASE_ORDER, DocumentType::DELIVER_ORDER, DocumentType::INVOICE, DocumentType::SUPPLIER_DELIVER_ORDER])->delete();
|
||||
}
|
||||
|
||||
})->name('ecommerce.fix');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user