Refunds for canceled orders and returned parts (SOP-OPS-014)

A Refund page on the customer: the canceled order's estimate fills in
the parts the 30% restocking fee is worked out on. Refunding makes the
fee invoice, pays it from the customer's credit, records the rest as a
Check (company check) or Expense (card refund on the terminal) with the
category Accounts Receivable, applies the credit to it so the balance
comes back to $0.00, and optionally marks the estimate Rejected,
cancels its work orders with the reason as a note and emails the
customer. Each refund has a page with a PDF of it.

New permission: Issue refunds. New settings under Billing » Refunds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rickyandClaude Opus 5.5 committed 2026-11-16 20:43:36 -05:00
1 parent 16f9441568
commit 9fa199aa98
21 files changed
+1737

No files matched your search

+102
View File
@@ -422,3 +422,105 @@ en:
label_activity_payment: "Payment from %{customer}: %{amount}"
text_activity_invoice_owed: "%{amount} owed"
text_activity_payment_unapplied: "%{amount} not applied to an invoice"
# ---- Refunds (SOP-OPS-014) ----
permission_issue_refunds: "Issue refunds"
label_refund: "Refund"
label_refunds: "Refunds"
label_refund_incomplete: "Incomplete"
label_refund_estimate: "Canceled order"
label_refund_no_estimate: "None (customer credit only)"
label_refund_your_order: "your order"
label_refund_parts: "Parts"
label_refund_method: "Refund by"
label_refund_method_check: "Company check"
label_refund_method_card: "Card (on the terminal)"
label_refund_check_number: "Check no."
label_refund_date: "Refund date"
label_refund_reason: "Reason"
label_refund_also: "Also"
label_refund_close_estimate: "Mark the estimate Rejected in QuickBooks"
label_refund_cancel_issues: "Cancel the order's work orders"
label_refund_email_customer: "Email the customer a summary"
label_refund_summary: "Refund"
label_refund_credit_from: "Credit from payment"
label_refund_credit: "Customer credit"
label_refund_fee_rate: "Restocking fee (%{rate}% of parts)"
label_refund_amount: "Refund"
label_refund_fee_invoice: "Invoice #%{number}"
label_refund_open_check: "Check in QuickBooks"
label_refund_open_expense: "Expense in QuickBooks"
label_refund_settings: "Refunds"
label_refund_balance_after: "Customer balance afterwards"
label_refund_recorded_by: "Recorded by"
label_refund_received_by: "Received by (customer signature)"
label_refund_fee_invoice_pdf: "Fee invoice PDF"
label_refund_pdf_fee: "Restocking fee: %{rate}% × %{parts} parts"
label_refund_pdf_work_orders: "Work orders canceled"
label_refund_pdf_estimate: "Estimate"
text_refund_pdf_estimate_rejected: "E%{number} marked Rejected in QuickBooks"
label_restocking_fee_rate: "Restocking fee"
label_restocking_item: "Restocking fee product/service"
label_refund_check_account: "Refund checks from"
label_refund_card_account: "Card refunds from"
label_refund_first_bank_account: "The first bank account"
label_refund_canceled_status: "Canceled work order status"
button_refund: "Refund"
button_refund_email: "Email the customer"
button_refund_email_again: "Email again"
notice_refund_emailed: "Refund summary emailed to %{email}."
notice_refund_done: "Refund of %{amount} recorded in QuickBooks."
error_refund_method: "Choose how the refund is paid: company check or card."
error_refund_check_number: "Enter the check number."
error_refund_reason: "Enter the reason for the refund."
error_refund_parts_amount: "Parts must be an amount of $0.00 or more."
error_refund_estimate_customer: "That estimate is for another customer."
error_refund_no_fee_item: "Pick the restocking fee product/service in the QuickBooks plugin settings (Billing » Refunds)."
error_refund_no_credit: "This customer has no credit (unapplied payments) to refund."
error_refund_fee_over_credit: "The restocking fee (%{fee}) isn't less than the customer's credit (%{credit}), so there's nothing to refund."
error_refund_no_ar_account: "QuickBooks has no Accounts Receivable account."
error_refund_no_bank_account: "QuickBooks has no bank account to record the refund from. Pick one in the plugin settings."
error_refund_fee_not_saved: "QuickBooks didn't save the restocking fee invoice."
error_refund_fee_unpaid: "The customer's credit didn't cover the restocking fee invoice (%{amount} still open)."
error_refund_nothing_left: "No credit is left to refund after the restocking fee."
error_refund_not_saved: "QuickBooks didn't save the refund."
error_refund_step_fee: "The restocking fee invoice couldn't be made or paid from the customer's credit: %{error}. Nothing was refunded. Finish or undo it in QuickBooks."
error_refund_step_refund: "The refund couldn't be recorded in QuickBooks: %{error}. The restocking fee invoice (if any) is made. Record the refund in QuickBooks (Check or Expense, category Accounts Receivable) and apply the customer's credit to it."
text_refund_final_sale: "Custom fabricated assemblies and discontinued or closeout items are final sale. Don't refund them without Shop Manager approval (SOP-OPS-014). No cash refunds: card payments are refunded on the terminal, everything else by company check."
text_refund_no_credit: "This customer has no credit (unapplied payments) to refund."
text_refund_estimate: "The order being canceled. Its parts fill in the restocking fee, and the refund refers to it."
text_refund_parts: "The parts returned or canceled, before tax. The restocking fee is %{rate}% of this; labor carries no fee. Enter 0 to refund without a fee."
text_refund_method: "The way the order was paid: card payments are refunded on the card terminal (a partial refund, of the amount below); cash and check payments by company check."
text_refund_reason: "Goes on the refund in QuickBooks and on the canceled work orders."
text_refund_summary: "The restocking fee invoice is paid from the customer's credit, and the rest is refunded. Refund exactly this amount on the terminal or check."
text_refund_email_confirm: "Email the customer this refund's summary?"
text_refund_confirm: "Make the restocking fee invoice and record the refund in QuickBooks?"
text_refund_no_email: "The customer has no email in QuickBooks."
text_refund_balance: "Done. The customer's QuickBooks balance is now %{balance}."
text_refund_balance_unknown: "Done, but the customer's QuickBooks balance couldn't be read. Check it's $0.00 in QuickBooks."
text_refund_incomplete: "This refund is incomplete. See below which step failed, and finish it in QuickBooks."
text_refund_fee_line: "Restocking fee: %{rate}% × %{parts} parts%{on} = %{fee}"
text_refund_line: "Refund for deposit on E%{number}"
text_refund_line_credit: "Refund of customer credit"
text_refund_line_card: "(card refund on the terminal)"
text_refund_private_note: "Refund made in Redmine (SOP-OPS-014). Reason: %{reason}"
text_refund_issue_note: "Order canceled and refunded: %{reason}. Restocking fee %{fee}, refunded %{refund} by %{method}."
text_refund_issues_not_canceled: "Some work orders couldn't be set to canceled: %{issues}"
text_refund_no_canceled_status: "The work orders weren't canceled: pick the canceled status in the plugin settings."
text_refund_estimate_not_closed: "The estimate couldn't be marked Rejected in QuickBooks: %{error}"
text_refund_email_failed: "The customer wasn't emailed: %{error}"
text_refund_email_off: "Redmine's email delivery is turned off."
text_refund_email_subject: "Your refund from %{shop}: %{amount}"
text_refund_email_greeting: "Hello %{name},"
text_refund_email_intro: "We've processed the refund for %{order}."
text_refund_email_check: "It's being paid by company check (no. %{number})."
text_refund_email_card: "It's been refunded to the card you paid with. It can take a few business days to show on your statement."
text_refund_email_terms: "As in our posted terms, returned and canceled parts carry a restocking fee. Labor that wasn't done isn't charged."
text_restocking_fee_rate: "Of the parts returned or canceled (SOP-OPS-014: 30%)."
text_restocking_item: "The QuickBooks product/service on the restocking fee invoice (e.g. \"Restocking Fee\"). It sets the income account the fee is booked to."
text_refund_check_account: "The bank account refund checks are written from."
text_refund_card_account: "The account card refunds come out of (where card payments are deposited)."
text_refund_canceled_status: "Work orders of a canceled order are set to this status, with the reason as a note."
+8
View File
@@ -71,6 +71,14 @@ end
# Estimate and invoice drafts, kept in Redmine until they're saved to QuickBooks (continued on the editors)
resources :qbo_drafts, only: [:index, :destroy]
# Customer refunds (SOP-OPS-014): /qbo_refunds/new?customer_id=
resources :qbo_refunds, only: [:new, :create, :show] do
member do
get :pdf
post :email
end
end
# Receive payment pages, and a customer's payments (/qbo_payments?customer_id=)
resources :qbo_payments, only: [:index, :new, :create, :show, :edit, :update] do
member do