mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Update invoice reports to use totals calculate by gncInvoice
This should give a consistent representation of invoice data across the application.
This commit is contained in:
parent
fcabf6bb96
commit
5389aa22ab
@ -116,18 +116,6 @@
|
||||
(addto! heading-list (_ "Total")))
|
||||
(reverse heading-list)))
|
||||
|
||||
(define (make-account-hash) (make-hash-table 23))
|
||||
|
||||
(define (update-account-hash hash values)
|
||||
(for-each
|
||||
(lambda (item)
|
||||
(let* ((acct (car item))
|
||||
(val (cdr item))
|
||||
(ref (hash-ref hash acct)))
|
||||
|
||||
(hash-set! hash acct (if ref (gnc-numeric-add-fixed ref val) val))))
|
||||
values))
|
||||
|
||||
(define (monetary-or-percent numeric currency entry-type)
|
||||
(if (gnc:entry-type-percent-p entry-type)
|
||||
(string-append (gnc:default-html-gnc-numeric-renderer numeric #f) " " (_ "%"))
|
||||
@ -368,28 +356,23 @@
|
||||
monetary))))
|
||||
|
||||
(define (add-subtotal-row table used-columns
|
||||
subtotal-collector subtotal-style subtotal-label)
|
||||
(let ((currency-totals (subtotal-collector
|
||||
'format gnc:make-gnc-monetary #f)))
|
||||
subtotal subtotal-style subtotal-label)
|
||||
(let ((subtotal-mon (gnc:make-gnc-monetary currency subtotal)))
|
||||
|
||||
(for-each (lambda (currency)
|
||||
(gnc:html-table-append-row/markup!
|
||||
table
|
||||
subtotal-style
|
||||
(append (cons (gnc:make-html-table-cell/markup
|
||||
"total-label-cell" subtotal-label)
|
||||
'())
|
||||
(list (gnc:make-html-table-cell/size/markup
|
||||
1 (colspan currency used-columns)
|
||||
"total-number-cell"
|
||||
(display-subtotal currency used-columns))))))
|
||||
currency-totals)))
|
||||
(gnc:html-table-append-row/markup!
|
||||
table
|
||||
subtotal-style
|
||||
(append (cons (gnc:make-html-table-cell/markup
|
||||
"total-label-cell" subtotal-label)
|
||||
'())
|
||||
(list (gnc:make-html-table-cell/size/markup
|
||||
1 (colspan subtotal-mon used-columns)
|
||||
"total-number-cell"
|
||||
(display-subtotal subtotal-mon used-columns)))))))
|
||||
|
||||
(define (add-payment-row table used-columns split total-collector reverse-payments?)
|
||||
(let* ((t (xaccSplitGetParent split))
|
||||
(currency (xaccTransGetCurrency t))
|
||||
(invoice (opt-val gnc:pagename-general gnc:optname-invoice-number))
|
||||
(owner '())
|
||||
;; Depending on the document type, the payments may need to be sign-reversed
|
||||
(amt (gnc:make-gnc-monetary currency
|
||||
(if reverse-payments?
|
||||
@ -422,36 +405,34 @@
|
||||
table
|
||||
used-columns
|
||||
width
|
||||
odd-row?
|
||||
value-collector
|
||||
tax-collector
|
||||
total-collector
|
||||
acct-hash)
|
||||
odd-row?)
|
||||
(if (null? entries)
|
||||
(begin
|
||||
(let ((total-collector (gnc:make-commodity-collector)))
|
||||
|
||||
; jamie
|
||||
(if (opt-val "Display" "Subtotal")
|
||||
(add-subtotal-row table used-columns value-collector
|
||||
"grand-total" (_ "Net Price")))
|
||||
(if (opt-val "Display" "Subtotal")
|
||||
(add-subtotal-row table used-columns (gncInvoiceGetTotalSubtotal invoice)
|
||||
"grand-total" (_ "Net Price")))
|
||||
|
||||
(if display-all-taxes
|
||||
(hash-for-each
|
||||
(lambda (acct value)
|
||||
(let ((collector (gnc:make-commodity-collector))
|
||||
(commodity (xaccAccountGetCommodity acct))
|
||||
(name (xaccAccountGetName acct)))
|
||||
(collector 'add commodity value)
|
||||
(add-subtotal-row table used-columns collector
|
||||
"grand-total" name)))
|
||||
acct-hash)
|
||||
(if display-all-taxes
|
||||
(let ((acct-val-list (gncInvoiceGetTotalTaxList invoice)))
|
||||
(for-each
|
||||
(lambda (parm)
|
||||
(let* ((value (cdr parm))
|
||||
(acct (car parm))
|
||||
(name (xaccAccountGetName acct)))
|
||||
(add-subtotal-row table used-columns value
|
||||
"grand-total" name)))
|
||||
acct-val-list))
|
||||
|
||||
; nope, just show the total tax.
|
||||
(add-subtotal-row table used-columns tax-collector
|
||||
"grand-total" (_ "Tax")))
|
||||
; nope, just show the total tax.
|
||||
(add-subtotal-row table used-columns (gncInvoiceGetTotalTax invoice)
|
||||
"grand-total" (_ "Tax")))
|
||||
|
||||
(add-subtotal-row table used-columns total-collector
|
||||
"grand-total" (_ "Total Price"))
|
||||
(add-subtotal-row table used-columns (gncInvoiceGetTotal invoice)
|
||||
"grand-total" (_ "Total Price"))
|
||||
|
||||
(total-collector 'add currency (gncInvoiceGetTotal invoice))
|
||||
(if (and show-payments (not (null? lot)))
|
||||
(let ((splits (sort-list!
|
||||
(gnc-lot-get-split-list lot)
|
||||
@ -463,10 +444,11 @@
|
||||
(lambda (split)
|
||||
(if (not (equal? (xaccSplitGetParent split) txn))
|
||||
(add-payment-row table used-columns
|
||||
split total-collector reverse-payments?)))
|
||||
split total-collector
|
||||
reverse-payments?)))
|
||||
splits)))
|
||||
|
||||
(add-subtotal-row table used-columns total-collector
|
||||
(add-subtotal-row table used-columns (cadr (total-collector 'getpair currency #f))
|
||||
"grand-total" (_ "Amount Due")))
|
||||
|
||||
;;
|
||||
@ -484,24 +466,6 @@
|
||||
current-row-style
|
||||
cust-doc? credit-note?)))
|
||||
|
||||
(if display-all-taxes
|
||||
(let ((tax-list (gncEntryGetDocTaxValues current cust-doc? credit-note?)))
|
||||
(update-account-hash acct-hash tax-list))
|
||||
(tax-collector 'add
|
||||
(gnc:gnc-monetary-commodity (cdr entry-values))
|
||||
(gnc:gnc-monetary-amount (cdr entry-values))))
|
||||
|
||||
(value-collector 'add
|
||||
(gnc:gnc-monetary-commodity (car entry-values))
|
||||
(gnc:gnc-monetary-amount (car entry-values)))
|
||||
|
||||
(total-collector 'add
|
||||
(gnc:gnc-monetary-commodity (car entry-values))
|
||||
(gnc:gnc-monetary-amount (car entry-values)))
|
||||
(total-collector 'add
|
||||
(gnc:gnc-monetary-commodity (cdr entry-values))
|
||||
(gnc:gnc-monetary-amount (cdr entry-values)))
|
||||
|
||||
(let ((order (gncEntryGetOrder current)))
|
||||
(if (not (null? order)) (add-order order)))
|
||||
|
||||
@ -509,17 +473,12 @@
|
||||
table
|
||||
used-columns
|
||||
width
|
||||
(not odd-row?)
|
||||
value-collector
|
||||
tax-collector
|
||||
total-collector
|
||||
acct-hash))))
|
||||
(not odd-row?)))))
|
||||
|
||||
(let* ((table (gnc:make-html-table))
|
||||
(used-columns (build-column-used options))
|
||||
(width (num-columns-required used-columns))
|
||||
(entries (gncInvoiceGetEntries invoice))
|
||||
(totals (gnc:make-commodity-collector)))
|
||||
(entries (gncInvoiceGetEntries invoice)))
|
||||
|
||||
(gnc:html-table-set-col-headers!
|
||||
table
|
||||
@ -529,11 +488,7 @@
|
||||
table
|
||||
used-columns
|
||||
width
|
||||
#t
|
||||
(gnc:make-commodity-collector)
|
||||
(gnc:make-commodity-collector)
|
||||
totals
|
||||
(make-account-hash))
|
||||
#t)
|
||||
table)))
|
||||
|
||||
(define (string-expand string character replace-string)
|
||||
|
@ -134,18 +134,6 @@
|
||||
(addto! heading-list (_ "Total")))
|
||||
(reverse heading-list)))
|
||||
|
||||
(define (make-account-hash) (make-hash-table 23))
|
||||
|
||||
(define (update-account-hash hash values)
|
||||
(for-each
|
||||
(lambda (item)
|
||||
(let* ((acct (car item))
|
||||
(val (cdr item))
|
||||
(ref (hash-ref hash acct)))
|
||||
|
||||
(hash-set! hash acct (if ref (gnc-numeric-add-fixed ref val) val))))
|
||||
values))
|
||||
|
||||
|
||||
(define (monetary-or-percent numeric currency entry-type)
|
||||
(if (gnc:entry-type-percent-p entry-type)
|
||||
@ -406,25 +394,19 @@
|
||||
)
|
||||
|
||||
(define (add-subtotal-row table used-columns
|
||||
subtotal-collector subtotal-style subtotal-label)
|
||||
(let ((currency-totals (subtotal-collector
|
||||
'format gnc:make-gnc-monetary #f)))
|
||||
subtotal subtotal-style subtotal-label)
|
||||
(let ((subtotal-mon (gnc:make-gnc-monetary currency subtotal)))
|
||||
|
||||
(for-each (lambda (currency)
|
||||
(gnc:html-table-append-row/markup!
|
||||
table
|
||||
subtotal-style
|
||||
;; oli-custom modified to colspan the subtotal labels
|
||||
;; instead of the data fields
|
||||
(append (cons (gnc:make-html-table-cell/size/markup
|
||||
1 (colspan currency used-columns)
|
||||
"total-label-cell" subtotal-label)
|
||||
'())
|
||||
(list (gnc:make-html-table-cell/markup
|
||||
;; 1 (colspan currency used-columns)
|
||||
"total-number-cell"
|
||||
(display-subtotal currency used-columns))))))
|
||||
currency-totals)))
|
||||
(gnc:html-table-append-row/markup!
|
||||
table
|
||||
subtotal-style
|
||||
(append (cons (gnc:make-html-table-cell/markup
|
||||
"total-label-cell" subtotal-label)
|
||||
'())
|
||||
(list (gnc:make-html-table-cell/size/markup
|
||||
1 (colspan subtotal-mon used-columns)
|
||||
"total-number-cell"
|
||||
(display-subtotal subtotal-mon used-columns)))))))
|
||||
|
||||
(define (add-payment-row table used-columns split total-collector reverse-payments?)
|
||||
(let* ((t (xaccSplitGetParent split))
|
||||
@ -463,16 +445,13 @@
|
||||
table
|
||||
used-columns
|
||||
width
|
||||
odd-row?
|
||||
value-collector
|
||||
tax-collector
|
||||
total-collector
|
||||
acct-hash)
|
||||
odd-row?)
|
||||
(if (null? entries)
|
||||
(begin
|
||||
;; oli-custom - modified to have a minimum of entries per table,
|
||||
;; currently defaults to 24
|
||||
;; also, doesn't count payment rows and stuff
|
||||
(let ((total-collector (gnc:make-commodity-collector)))
|
||||
|
||||
;; oli-custom - modified to have a minimum of entries per table,
|
||||
;; currently defaults to 24
|
||||
;; also, doesn't count payment rows and stuff
|
||||
(do ((entries-added entries-added (+ entries-added 1))
|
||||
(odd-row? odd-row? (not odd-row?)))
|
||||
((> entries-added (opt-val "Display" "Minimum # of entries" )))
|
||||
@ -480,29 +459,31 @@
|
||||
table (if odd-row? "normal-row" "alternate-row")
|
||||
(get-empty-row (num-columns-required used-columns)))
|
||||
)
|
||||
(add-subtotal-row table used-columns value-collector
|
||||
"grand-total" (_ "Net Price"))
|
||||
|
||||
(if display-all-taxes
|
||||
(hash-for-each
|
||||
(lambda (acct value)
|
||||
(let ((collector (gnc:make-commodity-collector))
|
||||
(commodity (xaccAccountGetCommodity acct))
|
||||
(name (xaccAccountGetName acct)))
|
||||
(collector 'add commodity value)
|
||||
(add-subtotal-row table used-columns collector
|
||||
"grand-total" (string-expand
|
||||
name #\space " "))))
|
||||
acct-hash)
|
||||
(add-subtotal-row table used-columns (gncInvoiceGetTotalSubtotal invoice)
|
||||
"grand-total" (_ "Net Price"))
|
||||
|
||||
; nope, just show the total tax.
|
||||
(add-subtotal-row table used-columns tax-collector
|
||||
"grand-total" (_ "Tax")))
|
||||
(if display-all-taxes
|
||||
(let ((acct-val-list (gncInvoiceGetTotalTaxList invoice)))
|
||||
(for-each
|
||||
(lambda (parm)
|
||||
(let* ((value (cdr parm))
|
||||
(acct (car parm))
|
||||
(name (xaccAccountGetName acct)))
|
||||
(add-subtotal-row table used-columns value
|
||||
"grand-total" (string-expand
|
||||
name #\space " "))))
|
||||
acct-val-list))
|
||||
|
||||
(add-subtotal-row table used-columns total-collector
|
||||
"grand-total" (string-expand (_ "Total Price")
|
||||
#\space " "))
|
||||
; nope, just show the total tax.
|
||||
(add-subtotal-row table used-columns (gncInvoiceGetTotalTax invoice)
|
||||
"grand-total" (_ "Tax")))
|
||||
|
||||
(add-subtotal-row table used-columns (gncInvoiceGetTotal invoice)
|
||||
"grand-total" (string-expand (_ "Total Price")
|
||||
#\space " "))
|
||||
|
||||
(total-collector 'add currency (gncInvoiceGetTotal invoice))
|
||||
(if (and show-payments (not (null? lot)))
|
||||
(let ((splits (sort-list!
|
||||
(gnc-lot-get-split-list lot)
|
||||
@ -518,9 +499,9 @@
|
||||
reverse-payments?)))
|
||||
splits)))
|
||||
|
||||
(add-subtotal-row table used-columns total-collector
|
||||
(add-subtotal-row table used-columns (cadr (total-collector 'getpair currency #f))
|
||||
"grand-total" (string-expand (_ "Amount Due")
|
||||
#\space " ")))
|
||||
#\space " ")))
|
||||
|
||||
;;
|
||||
;; End of BEGIN -- now here's the code to handle all the entries!
|
||||
@ -537,24 +518,6 @@
|
||||
current-row-style
|
||||
cust-doc? credit-note?)))
|
||||
|
||||
(if display-all-taxes
|
||||
(let ((tax-list (gncEntryGetDocTaxValues current cust-doc? credit-note?)))
|
||||
(update-account-hash acct-hash tax-list))
|
||||
(tax-collector 'add
|
||||
(gnc:gnc-monetary-commodity (cdr entry-values))
|
||||
(gnc:gnc-monetary-amount (cdr entry-values))))
|
||||
|
||||
(value-collector 'add
|
||||
(gnc:gnc-monetary-commodity (car entry-values))
|
||||
(gnc:gnc-monetary-amount (car entry-values)))
|
||||
|
||||
(total-collector 'add
|
||||
(gnc:gnc-monetary-commodity (car entry-values))
|
||||
(gnc:gnc-monetary-amount (car entry-values)))
|
||||
(total-collector 'add
|
||||
(gnc:gnc-monetary-commodity (cdr entry-values))
|
||||
(gnc:gnc-monetary-amount (cdr entry-values)))
|
||||
|
||||
(let ((order (gncEntryGetOrder current)))
|
||||
(if (not (null? order)) (add-order order)))
|
||||
|
||||
@ -564,17 +527,12 @@
|
||||
table
|
||||
used-columns
|
||||
width
|
||||
(not odd-row?)
|
||||
value-collector
|
||||
tax-collector
|
||||
total-collector
|
||||
acct-hash))))
|
||||
(not odd-row?)))))
|
||||
|
||||
(let* ((table (gnc:make-html-table))
|
||||
(used-columns (build-column-used options))
|
||||
(width (num-columns-required used-columns))
|
||||
(entries (gncInvoiceGetEntries invoice))
|
||||
(totals (gnc:make-commodity-collector)))
|
||||
(entries (gncInvoiceGetEntries invoice)))
|
||||
|
||||
(gnc:html-table-set-col-headers!
|
||||
table
|
||||
@ -584,11 +542,7 @@
|
||||
table
|
||||
used-columns
|
||||
width
|
||||
#t
|
||||
(gnc:make-commodity-collector)
|
||||
(gnc:make-commodity-collector)
|
||||
totals
|
||||
(make-account-hash))
|
||||
#t)
|
||||
table)))
|
||||
|
||||
(define (string-expand string character replace-string)
|
||||
|
@ -110,18 +110,6 @@
|
||||
(addto! heading-list (_ "Total")))
|
||||
(reverse heading-list)))
|
||||
|
||||
(define (make-account-hash) (make-hash-table 23))
|
||||
|
||||
(define (update-account-hash hash values)
|
||||
(for-each
|
||||
(lambda (item)
|
||||
(let* ((acct (car item))
|
||||
(val (cdr item))
|
||||
(ref (hash-ref hash acct)))
|
||||
|
||||
(hash-set! hash acct (if ref (gnc-numeric-add-fixed ref val) val))))
|
||||
values))
|
||||
|
||||
|
||||
(define (monetary-or-percent numeric currency entry-type)
|
||||
(if (gnc:entry-type-percent-p entry-type)
|
||||
@ -323,10 +311,10 @@
|
||||
(display-all-taxes (opt-val "Display" "Individual Taxes"))
|
||||
(lot (gncInvoiceGetPostedLot invoice))
|
||||
(txn (gncInvoiceGetPostedTxn invoice))
|
||||
(job? (opt-val "Display" "Job Details"))
|
||||
(job? (opt-val "Display" "Job Details"))
|
||||
(currency (gncInvoiceGetCurrency invoice))
|
||||
(jobnumber (gncJobGetID (gncOwnerGetJob (gncInvoiceGetOwner invoice))))
|
||||
(jobname (gncJobGetName (gncOwnerGetJob (gncInvoiceGetOwner invoice))))
|
||||
(jobnumber (gncJobGetID (gncOwnerGetJob (gncInvoiceGetOwner invoice))))
|
||||
(jobname (gncJobGetName (gncOwnerGetJob (gncInvoiceGetOwner invoice))))
|
||||
(reverse-payments? (not (gncInvoiceAmountPositive invoice))))
|
||||
|
||||
(define (colspan monetary used-columns)
|
||||
@ -346,28 +334,23 @@
|
||||
monetary))))
|
||||
|
||||
(define (add-subtotal-row table used-columns
|
||||
subtotal-collector subtotal-style subtotal-label)
|
||||
(let ((currency-totals (subtotal-collector
|
||||
'format gnc:make-gnc-monetary #f)))
|
||||
subtotal subtotal-style subtotal-label)
|
||||
(let ((subtotal-mon (gnc:make-gnc-monetary currency subtotal)))
|
||||
|
||||
(for-each (lambda (currency)
|
||||
(gnc:html-table-append-row/markup!
|
||||
table
|
||||
subtotal-style
|
||||
(append (cons (gnc:make-html-table-cell/markup
|
||||
"total-label-cell" subtotal-label)
|
||||
'())
|
||||
(list (gnc:make-html-table-cell/size/markup
|
||||
1 (colspan currency used-columns)
|
||||
"total-number-cell"
|
||||
(display-subtotal currency used-columns))))))
|
||||
currency-totals)))
|
||||
(gnc:html-table-append-row/markup!
|
||||
table
|
||||
subtotal-style
|
||||
(append (cons (gnc:make-html-table-cell/markup
|
||||
"total-label-cell" subtotal-label)
|
||||
'())
|
||||
(list (gnc:make-html-table-cell/size/markup
|
||||
1 (colspan subtotal-mon used-columns)
|
||||
"total-number-cell"
|
||||
(display-subtotal subtotal-mon used-columns)))))))
|
||||
|
||||
(define (add-payment-row table used-columns split total-collector reverse-payments?)
|
||||
(let* ((t (xaccSplitGetParent split))
|
||||
(currency (xaccTransGetCurrency t))
|
||||
(invoice (opt-val gnc:pagename-general gnc:optname-invoice-number))
|
||||
(owner '())
|
||||
;; Depending on the document type, the payments may need to be sign-reversed
|
||||
(amt (gnc:make-gnc-monetary currency
|
||||
(if reverse-payments?
|
||||
@ -400,34 +383,32 @@
|
||||
table
|
||||
used-columns
|
||||
width
|
||||
odd-row?
|
||||
value-collector
|
||||
tax-collector
|
||||
total-collector
|
||||
acct-hash)
|
||||
odd-row?)
|
||||
(if (null? entries)
|
||||
(begin
|
||||
(add-subtotal-row table used-columns value-collector
|
||||
"grand-total" (_ "Net Price"))
|
||||
(let ((total-collector (gnc:make-commodity-collector)))
|
||||
|
||||
(if display-all-taxes
|
||||
(hash-for-each
|
||||
(lambda (acct value)
|
||||
(let ((collector (gnc:make-commodity-collector))
|
||||
(commodity (xaccAccountGetCommodity acct))
|
||||
(name (xaccAccountGetName acct)))
|
||||
(collector 'add commodity value)
|
||||
(add-subtotal-row table used-columns collector
|
||||
"grand-total" name)))
|
||||
acct-hash)
|
||||
(add-subtotal-row table used-columns (gncInvoiceGetTotalSubtotal invoice)
|
||||
"grand-total" (_ "Net Price"))
|
||||
|
||||
; nope, just show the total tax.
|
||||
(add-subtotal-row table used-columns tax-collector
|
||||
"grand-total" (_ "Tax")))
|
||||
(if display-all-taxes
|
||||
(let ((acct-val-list (gncInvoiceGetTotalTaxList invoice)))
|
||||
(for-each
|
||||
(lambda (parm)
|
||||
(let* ((value (cdr parm))
|
||||
(acct (car parm))
|
||||
(name (xaccAccountGetName acct)))
|
||||
(add-subtotal-row table used-columns value
|
||||
"grand-total" name)))
|
||||
acct-val-list))
|
||||
|
||||
(add-subtotal-row table used-columns total-collector
|
||||
"grand-total" (_ "Total Price"))
|
||||
; nope, just show the total tax.
|
||||
(add-subtotal-row table used-columns (gncInvoiceGetTotalTax invoice)
|
||||
"grand-total" (_ "Tax")))
|
||||
|
||||
(add-subtotal-row table used-columns (gncInvoiceGetTotal invoice)
|
||||
"grand-total" (_ "Total Price"))
|
||||
|
||||
(total-collector 'add currency (gncInvoiceGetTotal invoice))
|
||||
(if (and show-payments (not (null? lot)))
|
||||
(let ((splits (sort-list!
|
||||
(gnc-lot-get-split-list lot)
|
||||
@ -443,7 +424,7 @@
|
||||
reverse-payments?)))
|
||||
splits)))
|
||||
|
||||
(add-subtotal-row table used-columns total-collector
|
||||
(add-subtotal-row table used-columns (cadr (total-collector 'getpair currency #f))
|
||||
"grand-total" (_ "Amount Due")))
|
||||
|
||||
;;
|
||||
@ -461,24 +442,6 @@
|
||||
current-row-style
|
||||
cust-doc? credit-note?)))
|
||||
|
||||
(if display-all-taxes
|
||||
(let ((tax-list (gncEntryGetDocTaxValues current cust-doc? credit-note?)))
|
||||
(update-account-hash acct-hash tax-list))
|
||||
(tax-collector 'add
|
||||
(gnc:gnc-monetary-commodity (cdr entry-values))
|
||||
(gnc:gnc-monetary-amount (cdr entry-values))))
|
||||
|
||||
(value-collector 'add
|
||||
(gnc:gnc-monetary-commodity (car entry-values))
|
||||
(gnc:gnc-monetary-amount (car entry-values)))
|
||||
|
||||
(total-collector 'add
|
||||
(gnc:gnc-monetary-commodity (car entry-values))
|
||||
(gnc:gnc-monetary-amount (car entry-values)))
|
||||
(total-collector 'add
|
||||
(gnc:gnc-monetary-commodity (cdr entry-values))
|
||||
(gnc:gnc-monetary-amount (cdr entry-values)))
|
||||
|
||||
(let ((order (gncEntryGetOrder current)))
|
||||
(if (not (null? order)) (add-order order)))
|
||||
|
||||
@ -486,17 +449,12 @@
|
||||
table
|
||||
used-columns
|
||||
width
|
||||
(not odd-row?)
|
||||
value-collector
|
||||
tax-collector
|
||||
total-collector
|
||||
acct-hash))))
|
||||
(not odd-row?)))))
|
||||
|
||||
(let* ((table (gnc:make-html-table))
|
||||
(used-columns (build-column-used options))
|
||||
(width (num-columns-required used-columns))
|
||||
(entries (gncInvoiceGetEntries invoice))
|
||||
(totals (gnc:make-commodity-collector)))
|
||||
(entries (gncInvoiceGetEntries invoice)))
|
||||
|
||||
(gnc:html-table-set-col-headers!
|
||||
table
|
||||
@ -506,11 +464,7 @@
|
||||
table
|
||||
used-columns
|
||||
width
|
||||
#t
|
||||
(gnc:make-commodity-collector)
|
||||
(gnc:make-commodity-collector)
|
||||
totals
|
||||
(make-account-hash))
|
||||
#t)
|
||||
table)))
|
||||
|
||||
(define (string-expand string character replace-string)
|
||||
|
@ -170,10 +170,12 @@
|
||||
|
||||
<tbody> <!-- display invoice entry lines, keeping running totals -->
|
||||
<?scm
|
||||
(let ((tax-total (gnc:make-commodity-collector))
|
||||
(sub-total (gnc:make-commodity-collector))
|
||||
(dsc-total (gnc:make-commodity-collector))
|
||||
(inv-total (gnc:make-commodity-collector)))
|
||||
(let* ((inv-total (gncInvoiceGetTotal opt-invoice))
|
||||
(tax-total (gncInvoiceGetTotalTax opt-invoice))
|
||||
(sub-total (gncInvoiceGetTotalSubtotal opt-invoice))
|
||||
(dsc-total (- inv-total tax-total sub-total))
|
||||
(total-col (gnc:make-commodity-collector)))
|
||||
(total-col 'add currency inv-total)
|
||||
(for entry in entries do
|
||||
(let ((qty (gncEntryGetQuantity entry))
|
||||
(each (gncEntryGetInvPrice entry))
|
||||
@ -186,11 +188,6 @@
|
||||
(acc (gncEntryGetInvAccount entry))
|
||||
(taxable (gncEntryGetInvTaxable entry))
|
||||
(taxtable (gncEntryGetInvTaxTable entry)))
|
||||
(inv-total 'add currency rval)
|
||||
(inv-total 'add currency rtaxval)
|
||||
(tax-total 'add currency rtaxval)
|
||||
(sub-total 'add currency rval)
|
||||
(dsc-total 'add currency rdiscval)
|
||||
?>
|
||||
<tr valign="top">
|
||||
<td align="left"><?scm:d (qof-print-date (gncEntryGetDate entry)) ?></td>
|
||||
@ -227,11 +224,11 @@
|
||||
<?scm (if tax? (begin ?>
|
||||
<tr valign="top">
|
||||
<td align="left" class="subtotal" colspan="<?scm:d (- maxcols 2) ?>"><strong><?scm:d opt-net-price-heading ?></strong></td>
|
||||
<td align="right" class="subtotal" colspan="2>"><strong><?scm (display-comm-coll-total sub-total #f) ?></strong></td>
|
||||
<td align="right" class="subtotal" colspan="2>"><strong><?scm:d (fmtmoney currency sub-total) ?></strong></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="left" class="subtotal" colspan="<?scm:d (- maxcols 2) ?>"><strong><?scm:d opt-tax-amount-heading ?></strong></td>
|
||||
<td align="right" class="subtotal" colspan="2>"><strong><?scm (display-comm-coll-total tax-total #f) ?></strong></td>
|
||||
<td align="right" class="subtotal" colspan="2>"><strong><?scm:d (fmtmoney currency tax-total) ?></strong></td>
|
||||
</tr>
|
||||
<?scm )) ?>
|
||||
|
||||
@ -240,7 +237,7 @@
|
||||
<?scm (if payments? (begin ?>
|
||||
<tr valign="top">
|
||||
<td align="left" class="subtotal" colspan="<?scm:d (- maxcols 2) ?>"><strong><?scm:d opt-total-price-heading ?></strong></td>
|
||||
<td align="right" class="subtotal" colspan="2>"><strong><?scm (display-comm-coll-total inv-total #f) ?></strong></td>
|
||||
<td align="right" class="subtotal" colspan="2>"><strong><?scm:d (fmtmoney currency inv-total) ?></strong></td>
|
||||
</tr>
|
||||
<?scm )) ?>
|
||||
|
||||
@ -251,7 +248,7 @@
|
||||
(if (not (equal? t txn)) ; don't process the entry itself as a split
|
||||
(let ((c (xaccTransGetCurrency t))
|
||||
(a (xaccSplitGetValue split)))
|
||||
(inv-total 'add c a)
|
||||
(total-col 'add c a)
|
||||
?>
|
||||
<tr valign="top">
|
||||
<td align="center"><?scm:d (qof-print-date (xaccTransGetDate t)) ?></td>
|
||||
@ -263,7 +260,7 @@
|
||||
<!-- total row -->
|
||||
<tr valign="top">
|
||||
<td align="left" class="total total_last" colspan="<?scm:d (- maxcols 2) ?>"><strong><?scm:d opt-amount-due-heading ?></strong></td>
|
||||
<td align="right" class="total total_last" colspan="2>"><strong><?scm (display-comm-coll-total inv-total #f) ?></strong></td>
|
||||
<td align="right" class="total total_last" colspan="2>"><strong><?scm (display-comm-coll-total total-col #f) ?></strong></td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
|
@ -324,10 +324,12 @@
|
||||
|
||||
<tbody> <!-- display invoice entry lines, keeping running totals -->
|
||||
<?scm
|
||||
(let ((tax-total (gnc:make-commodity-collector))
|
||||
(sub-total (gnc:make-commodity-collector))
|
||||
(dsc-total (gnc:make-commodity-collector))
|
||||
(inv-total (gnc:make-commodity-collector)))
|
||||
(let* ((inv-total (gncInvoiceGetTotal opt-invoice))
|
||||
(tax-total (gncInvoiceGetTotalTax opt-invoice))
|
||||
(sub-total (gncInvoiceGetTotalSubtotal opt-invoice))
|
||||
(dsc-total (- inv-total tax-total sub-total))
|
||||
(total-col (gnc:make-commodity-collector)))
|
||||
(total-col 'add currency inv-total)
|
||||
(for entry in entries do
|
||||
(let ((qty (gncEntryGetDocQuantity entry credit-note?))
|
||||
(each (gncEntryGetPrice entry cust-doc? opt-netprice))
|
||||
@ -340,11 +342,6 @@
|
||||
(acc (if cust-doc? (gncEntryGetInvAccount entry)(gncEntryGetBillAccount entry)))
|
||||
(taxable (if cust-doc? (gncEntryGetInvTaxable entry)(gncEntryGetBillTaxable entry)))
|
||||
(taxtable (if cust-doc? (gncEntryGetInvTaxTable entry)(gncEntryGetBillTaxTable entry))))
|
||||
(inv-total 'add currency rval)
|
||||
(inv-total 'add currency rtaxval)
|
||||
(tax-total 'add currency rtaxval)
|
||||
(sub-total 'add currency rval)
|
||||
(dsc-total 'add currency rdiscval) ;'
|
||||
?>
|
||||
<tr valign="top">
|
||||
<?scm (if opt-col-date (begin ?>
|
||||
@ -392,16 +389,16 @@
|
||||
(if (and discount?) 1 0)
|
||||
) ?>"><strong><?scm:d opt-subtotal-heading ?></strong></td>
|
||||
<?scm (if discount? (begin ?>
|
||||
<td align="right" class="subtotal"><strong><?scm (display-comm-coll-total dsc-total #f) ?></strong></td>
|
||||
<td align="right" class="subtotal"><strong><?scm:d (fmtmoney currency dsc-total) ?></strong></td>
|
||||
<?scm )) ?>
|
||||
<?scm (if (and tax? taxtables?) (begin ?>
|
||||
<td align="right" class="subtotal"><strong><?scm (display-comm-coll-total sub-total #f) ?></strong></td>
|
||||
<td align="right" class="subtotal"><strong><?scm:d (fmtmoney currency sub-total) ?></strong></td>
|
||||
<?scm (if opt-col-taxrate (begin ?>
|
||||
<td> </td>
|
||||
<?scm )) ?>
|
||||
<td align="right" class="subtotal"><strong><?scm (display-comm-coll-total tax-total #f) ?></strong></td>
|
||||
<td align="right" class="subtotal"><strong><?scm:d (fmtmoney currency tax-total) ?></strong></td>
|
||||
<?scm )) ?>
|
||||
<td align="right" class="subtotal"><strong><?scm (display-comm-coll-total inv-total #f) ?></strong></td>
|
||||
<td align="right" class="subtotal"><strong><?scm:d (fmtmoney currency inv-total) ?></strong></td>
|
||||
</tr>
|
||||
<?scm )) ?>
|
||||
|
||||
@ -416,7 +413,7 @@
|
||||
(gnc-numeric-neg(xaccSplitGetValue split))
|
||||
(xaccSplitGetValue split)))
|
||||
)
|
||||
(inv-total 'add c a) ;'
|
||||
(total-col 'add c a) ;'
|
||||
?>
|
||||
<tr valign="top">
|
||||
<?scm (if opt-col-date (begin ?>
|
||||
@ -432,7 +429,7 @@
|
||||
<td align="left" class="total" colspan="<?scm:d (+ tbl_cols 1) ?>"><strong>
|
||||
<?scm:d opt-amount-due-heading ?><?scm (if (not (string=? (gnc-commodity-get-mnemonic opt-report-currency) "")) (begin ?>,
|
||||
<?scm:d (gnc-commodity-get-mnemonic opt-report-currency) ?><?scm )) ?></strong></td>
|
||||
<td align="right" class="total"><strong><?scm (display-comm-coll-total inv-total #f) ?></strong></td>
|
||||
<td align="right" class="total"><strong><?scm (display-comm-coll-total total-col #f) ?></strong></td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
|
Loading…
Reference in New Issue
Block a user