diff --git a/routes/web.php b/routes/web.php index 53c34711..da9575b8 100644 --- a/routes/web.php +++ b/routes/web.php @@ -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 ' + + + + + + + '; + 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 ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + } + echo '
Transaction TypeTotalPaidCustomerOrder
' . $invoice->type . '' . $invoice->amount . '' . $paidAmount . ''.$marking.'' . $order->reference . ' - ' . $order->created_at . '
'; +});