mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 04:24:12 +00:00
auto generate invoices
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
namespace App\Classes\Modules\Transactions\Processors;
|
||||
|
||||
use App\Classes\Exceptions\MalformedRequestException;
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\PackingLists\Services\FetchesPackingList;
|
||||
use App\Classes\Modules\SegmentConstants\Services\FetchesSegmentConstant;
|
||||
@@ -65,6 +66,9 @@ class CreateInvoiceTransactionProcessor
|
||||
$this->createsTransactionDetail = $createsTransactionDetail;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws MalformedRequestException
|
||||
*/
|
||||
public function execute(PackingList $packingList)
|
||||
{
|
||||
$packing_list = PackingList::where('reference', $packingList->reference)->where('type', PackingListType::SHIPPING_PACKING_LIST)->first();
|
||||
@@ -104,7 +108,11 @@ class CreateInvoiceTransactionProcessor
|
||||
})->sort()->first();
|
||||
$segment_price = $segment_price ? $segment_price : 0;
|
||||
|
||||
$packing_list_drop_date = PackingList::where('reference', $packing_list->reference)->where('type', 1)->first()->transports->first()->drop_date->format('Y-m-d');
|
||||
$arrivalTransport = PackingList::where('reference', $packing_list->reference)->where('type', 1)->first()->transports->first();
|
||||
if(!$arrivalTransport) {
|
||||
throw new MalformedRequestException('Arrival date is unknow can\'t generate invoice');
|
||||
}
|
||||
$packing_list_drop_date = $arrivalTransport->drop_date->format('Y-m-d');
|
||||
$base_price = $this->getConstantByKey($base_price_constant, $packing_list_drop_date);
|
||||
|
||||
$warehouseId = $order->orderRoles()->where('role_id', OrderRoleTypes::ORIGIN_WAREHOUSE)->first()->company_module_id;
|
||||
|
||||
Reference in New Issue
Block a user