mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/portal.git
synced 2026-08-19 04:23:59 +00:00
estimate container shipping cost
This commit is contained in:
+21
-20
@@ -492,26 +492,6 @@ Route::get('/container/billing/{month}/{year}', function($month, $year){
|
||||
->where('type', \App\Classes\ValueObjects\Constants\TransactionType::SHIPPING_INVOICE)->whereIn('status', [\App\Classes\ValueObjects\Constants\ApprovalStatus::APPROVED, \App\Classes\ValueObjects\Constants\ApprovalStatus::COMPLETED])
|
||||
->first();
|
||||
|
||||
if(!$invoice) {
|
||||
echo '<p style="color: red">'.$packingList->reference .' Warning: no billing</p>';
|
||||
continue;
|
||||
}
|
||||
|
||||
$payments = $invoice->transactions()
|
||||
->where('type', \App\Classes\ValueObjects\Constants\TransactionType::PAYMENT)->whereIn('status', [\App\Classes\ValueObjects\Constants\ApprovalStatus::APPROVED, \App\Classes\ValueObjects\Constants\ApprovalStatus::COMPLETED])
|
||||
->get();
|
||||
|
||||
$billed += 1;
|
||||
$containerBilled += 1;
|
||||
|
||||
$totalBilled += $invoice->amount;
|
||||
$containerTotalBilled += $invoice->amount;
|
||||
|
||||
$totalPaid += $payments->sum('amount');
|
||||
$containerTotalPaid += $payments->sum('amount');
|
||||
|
||||
echo '<span style="color: '.(($invoice->amount - $payments->sum('amount')) < 0.01 ? 'green' : 'red').'">'.$packingList->reference.' | Amount: '.$invoice->amount.' | Paid: '.$payments->sum('amount').' | Invoice Date: '.$invoice->created_at->format('d-m-Y'). (($invoice->amount - $payments->sum('amount')) < 0.01 ? '' : '('.$invoice->created_at->diffForHumans().')').'</span>';
|
||||
echo '<br>';
|
||||
|
||||
$packing_list_drop_date = PackingList::where('reference', $packingList->reference)->where('type', 1)->first()->transports->first()->drop_date;
|
||||
$order = $packingList->owner;
|
||||
@@ -555,6 +535,27 @@ Route::get('/container/billing/{month}/{year}', function($month, $year){
|
||||
echo 'supplier cost:'.$cost;
|
||||
echo '<br><br>';
|
||||
|
||||
if(!$invoice) {
|
||||
echo '<p style="color: red">'.$packingList->reference .' Warning: no billing</p>';
|
||||
continue;
|
||||
}
|
||||
|
||||
$payments = $invoice->transactions()
|
||||
->where('type', \App\Classes\ValueObjects\Constants\TransactionType::PAYMENT)->whereIn('status', [\App\Classes\ValueObjects\Constants\ApprovalStatus::APPROVED, \App\Classes\ValueObjects\Constants\ApprovalStatus::COMPLETED])
|
||||
->get();
|
||||
|
||||
$billed += 1;
|
||||
$containerBilled += 1;
|
||||
|
||||
$totalBilled += $invoice->amount;
|
||||
$containerTotalBilled += $invoice->amount;
|
||||
|
||||
$totalPaid += $payments->sum('amount');
|
||||
$containerTotalPaid += $payments->sum('amount');
|
||||
|
||||
echo '<span style="color: '.(($invoice->amount - $payments->sum('amount')) < 0.01 ? 'green' : 'red').'">'.$packingList->reference.' | Amount: '.$invoice->amount.' | Paid: '.$payments->sum('amount').' | Invoice Date: '.$invoice->created_at->format('d-m-Y'). (($invoice->amount - $payments->sum('amount')) < 0.01 ? '' : '('.$invoice->created_at->diffForHumans().')').'</span>';
|
||||
echo '<br>';
|
||||
|
||||
}
|
||||
|
||||
echo '<h4>Container Invoices: '.$containerBilled.'/'.$containerTotalBillable.'</h4>';
|
||||
|
||||
Reference in New Issue
Block a user