This commit is contained in:
Utkarsh Khedkar
2026-03-13 23:06:19 +05:30
parent c25b468c77
commit 785f2564be
15 changed files with 757 additions and 338 deletions

View File

@@ -269,9 +269,23 @@ class AdminInvoiceController extends Controller
$newPaid = $paidTotal + $request->amount;
$remaining = max(0, $grandTotal - $newPaid);
if ($newPaid >= $grandTotal && $grandTotal > 0) {
$invoice->update(['status' => 'paid']);
}
// Full payment logic (जर पूर्ण भरले तर status paid करणे, नाहीतर pending राहील)
// if ($newPaid >= $grandTotal && $grandTotal > 0) {
// $invoice->update([
// 'payment_method' => $request->payment_method,
// 'reference_no' => $request->reference_no,
// 'status' => ($newPaid >= $grandTotal && $grandTotal > 0) ? 'paid' : $invoice->status,
// ]);
// }
// Partial payment status logic:
$invoice->update([
'payment_method' => $request->payment_method,
'reference_no' => $request->reference_no,
'status' => ($newPaid >= $grandTotal && $grandTotal > 0) ? 'paid' : $invoice->status,
]);
return response()->json([
'status' => 'success',