Convert non-deposit payments to customer credits on invoice void
When voiding an invoice that has non-deposit payments (e.g. CC charges), those payments are now converted to CRED- Deposit records so the money trail is preserved and the credit auto-applies to the replacement invoice. Deposits that were applied to the voided invoice are also re-released so they can auto-apply again. Void confirmation dialog and success message both reflect the credit amount when applicable. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -28,6 +28,9 @@
|
||||
var onlinePaymentsEnabled = ViewBag.OnlinePaymentsEnabled == true;
|
||||
var showOnlinePaymentCard = !isDraft && !isVoided && Model.BalanceDue > 0 && onlinePaymentsEnabled;
|
||||
var guidedActivationCallout = ViewBag.GuidedActivationCallout as PowderCoating.Web.ViewModels.GuidedActivation.GuidedActivationCalloutViewModel;
|
||||
var nonDepositPaymentTotal = Model.Payments
|
||||
.Where(p => !(p.Reference ?? "").StartsWith("Deposit "))
|
||||
.Sum(p => p.Amount);
|
||||
}
|
||||
|
||||
<div class="row justify-content-center">
|
||||
@@ -694,7 +697,9 @@
|
||||
@if (!isVoided && Model.Status != InvoiceStatus.Paid)
|
||||
{
|
||||
<form asp-action="Void" asp-route-id="@Model.Id" method="post"
|
||||
onsubmit="return confirm('Void this invoice? This will reverse the remaining balance on the customer account.')">
|
||||
onsubmit="return confirm('@(nonDepositPaymentTotal > 0
|
||||
? $"Void this invoice? {nonDepositPaymentTotal.ToString("C")} in payments will be converted to a customer credit and auto-applied to the next invoice."
|
||||
: "Void this invoice? This will reverse the remaining balance on the customer account.")')">
|
||||
@Html.AntiForgeryToken()
|
||||
<button type="submit" class="btn btn-outline-warning w-100">
|
||||
<i class="bi bi-x-circle me-2"></i>Void Invoice
|
||||
|
||||
Reference in New Issue
Block a user