mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2026-11-17 18:20:36 -05:00
Show invoice statuses
Invoices get a status badge on the customer page's invoice list and the invoice page: Paid, Partially paid, Overdue, Open or Voided (zero total), worked out from the total, balance and due date like QuickBooks' invoice list (RedmineQboBilling::InvoiceStatus; QuickBooks keeps no status on invoices). The list uses the cached balance and due date; the invoice page uses QuickBooks' current figures. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
This commit is contained in:
7 files changed
+81
-5
No files matched your search
@@ -1,4 +1,5 @@
|
||||
<% unless invoices.empty? %>
|
||||
<%= render partial: 'qbo_estimates/status_styles' %>
|
||||
|
||||
<%= form_with(url: invoice_path, method: :get) do |form| %>
|
||||
|
||||
@@ -10,13 +11,19 @@
|
||||
<hr>
|
||||
<% end %>
|
||||
|
||||
<div class="qbo-invoice-list">
|
||||
<% invoices.sort.reverse.each do |invoice| %>
|
||||
<div class="row">
|
||||
<%= check_box_tag "invoice_ids[]", invoice.id, false, onchange: "updateLink()", data: { url: invoice_path(invoice), text: "Invoice ##{invoice.to_s}" }, class: "invoice-checkbox appointment" if invoices.count > 1 %>
|
||||
<b><%= link_to "##{invoice.doc_number}", invoice_path(invoice), target: :_blank %></b> <%= invoice.txn_date %>
|
||||
<%# Paid / partially paid / overdue / open / voided, from the cached balance and due date %>
|
||||
<% if (status = invoice.status) %>
|
||||
<span class="qbo-estimate-status qbo-invoice-status-<%= status %>"><%= RedmineQboBilling::InvoiceStatus.label(status) %></span>
|
||||
<% end %>
|
||||
<%= render partial: 'qbo_invoices/invoice_actions', locals: { invoice: invoice } if RedmineQboBilling.invoice_writer? %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% if invoices.count > 1 %>
|
||||
<%= form.submit t(:button_bulk_pdf) %>
|
||||
|
||||
@@ -15,9 +15,13 @@
|
||||
<% if form.sent? %>
|
||||
<span class="qbo-estimate-status qbo-estimate-status-sent"><%= l(:label_estimate_sent) %></span>
|
||||
<% end %>
|
||||
<% if invoice && form.locked == :paid %>
|
||||
<% fully_paid = form.balance.to_d.zero? %>
|
||||
<span class="qbo-estimate-status qbo-estimate-status-<%= fully_paid ? 'closed' : 'accepted' %>"><%= l(fully_paid ? :label_invoice_paid : :label_invoice_partially_paid) %></span>
|
||||
<% if invoice %>
|
||||
<% status = RedmineQboBilling::InvoiceStatus.status(total: form.total, balance: form.balance,
|
||||
due_date: RedmineQboBilling::EstimateForm.date(form.due_date),
|
||||
today: User.current.today) %>
|
||||
<% if status %>
|
||||
<span class="qbo-estimate-status qbo-invoice-status-<%= status %>"><%= RedmineQboBilling::InvoiceStatus.label(status) %></span>
|
||||
<% end %>
|
||||
<% elsif !invoice && form.txn_status.present? %>
|
||||
<span class="qbo-estimate-status qbo-estimate-status-<%= form.txn_status.downcase %>"><%= form.txn_status %></span>
|
||||
<% end %>
|
||||
|
||||
@@ -7,4 +7,11 @@
|
||||
.qbo-estimate-status-closed, .qbo-estimate-status-converted { background: #e8eefa; color: #0d47a1; }
|
||||
.qbo-estimate-status-rejected { background: #fdecea; color: #b71c1c; }
|
||||
.qbo-estimate-list .qbo-estimate-status { font-size: .8em; padding: 1px 7px; margin-left: 4px; }
|
||||
/* Invoices (RedmineQboBilling::InvoiceStatus) */
|
||||
.qbo-invoice-status-paid { background: #e6f4e4; color: #108000; }
|
||||
.qbo-invoice-status-partial { background: #fff4d6; color: #8a6100; }
|
||||
.qbo-invoice-status-overdue { background: #fdecea; color: #b71c1c; }
|
||||
.qbo-invoice-status-open { background: #e8eefa; color: #0d47a1; }
|
||||
.qbo-invoice-status-voided { background: #eceef1; color: #6b6c72; text-decoration: line-through; }
|
||||
.qbo-invoice-list .qbo-estimate-status { font-size: .8em; padding: 1px 7px; margin-left: 4px; }
|
||||
</style>
|
||||
Reference in new issue
Block a user