mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 04:24:12 +00:00
show all extra payments from customer
This commit is contained in:
@@ -1253,3 +1253,46 @@ Route::get('fix-payment-status-updated-but-failed-update-invoice', function (Upd
|
||||
Route::get('/payment-and-billing-2', function () {
|
||||
return view('pages.paymentAndBilling2');
|
||||
})->name('admin.payment-and-billing-2');
|
||||
|
||||
Route::get('/show-all-extra-payments', function () {
|
||||
ini_set('memory_limit', '-1');
|
||||
|
||||
$invoices = Transaction::where('type', TransactionType::SHIPPING_INVOICE)
|
||||
->where('status', ApprovalStatus::COMPLETED)
|
||||
->whereHas('transactions', function ($query) {
|
||||
$query->where('type', TransactionType::PAYMENT)
|
||||
->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]);
|
||||
})
|
||||
->get();
|
||||
|
||||
echo '<table>
|
||||
<tr>
|
||||
<th>Transaction Type</th>
|
||||
<th>Total</th>
|
||||
<th>Paid</th>
|
||||
<th>Customer</th>
|
||||
<th>Order</th>
|
||||
</tr>';
|
||||
foreach ($invoices as $invoice) {
|
||||
$paidAmount = $invoice->transactions()->where('type', TransactionType::PAYMENT)->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->sum('amount');
|
||||
|
||||
$packingList = $invoice->owner;
|
||||
$order = $packingList->owner;
|
||||
|
||||
$companyModule= $order->companyModule;
|
||||
$marking = $companyModule->getMarking();
|
||||
|
||||
if (($paidAmount <= $invoice->amount) || ($paidAmount - $invoice->amount < 0.01)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
echo '<tr>';
|
||||
echo '<td>' . $invoice->type . '</td>';
|
||||
echo '<td>' . $invoice->amount . '</td>';
|
||||
echo '<td>' . $paidAmount . '</td>';
|
||||
echo '<td><a href="'.route('customer.profile', $marking).'" target="_blank">'.$marking.'</a></td>';
|
||||
echo '<td><a target="_blank" href="' . route('order.show', $order->reference) . '">' . $order->reference . ' - ' . $order->created_at . '</a><br></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
echo '</table>';
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user