mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
[invoice] refactor gncOrder handling
Previously the function addorder was being passed as an argument to add gncOrder references to a list, for later displaying in report. This commit will simplify it - instead of passing a function to make-entry-table, the report will query invoice orders directly when needed.
This commit is contained in:
parent
cf3ccb9f1e
commit
1afacb97ba
@ -287,7 +287,7 @@
|
|||||||
|
|
||||||
gnc:*report-options*)
|
gnc:*report-options*)
|
||||||
|
|
||||||
(define (make-entry-table invoice options add-order cust-doc? credit-note?)
|
(define (make-entry-table invoice options cust-doc? credit-note?)
|
||||||
(define (opt-val section name)
|
(define (opt-val section name)
|
||||||
(gnc:option-value
|
(gnc:option-value
|
||||||
(gnc:lookup-option options section name)))
|
(gnc:lookup-option options section name)))
|
||||||
@ -419,9 +419,6 @@
|
|||||||
current-row-style
|
current-row-style
|
||||||
cust-doc? credit-note?)))
|
cust-doc? credit-note?)))
|
||||||
|
|
||||||
(let ((order (gncEntryGetOrder current)))
|
|
||||||
(if (not (null? order)) (add-order order)))
|
|
||||||
|
|
||||||
(do-rows-with-subtotals rest
|
(do-rows-with-subtotals rest
|
||||||
table
|
table
|
||||||
used-columns
|
used-columns
|
||||||
@ -539,7 +536,6 @@
|
|||||||
title))
|
title))
|
||||||
|
|
||||||
(let* ((document (gnc:make-html-document))
|
(let* ((document (gnc:make-html-document))
|
||||||
(orders '())
|
|
||||||
(invoice (opt-val gnc:pagename-general gnc:optname-invoice-number))
|
(invoice (opt-val gnc:pagename-general gnc:optname-invoice-number))
|
||||||
(references? (opt-val "Display" "References"))
|
(references? (opt-val "Display" "References"))
|
||||||
(job? (opt-val "Display" "Job Details"))
|
(job? (opt-val "Display" "Job Details"))
|
||||||
@ -547,10 +543,6 @@
|
|||||||
(jobname (gncJobGetName (gncOwnerGetJob (gncInvoiceGetOwner invoice))))
|
(jobname (gncJobGetName (gncOwnerGetJob (gncInvoiceGetOwner invoice))))
|
||||||
(custom-title (opt-val gnc:pagename-general "Custom Title")))
|
(custom-title (opt-val gnc:pagename-general "Custom Title")))
|
||||||
|
|
||||||
(define (add-order o)
|
|
||||||
(if (and references? (not (member o orders)))
|
|
||||||
(addto! orders o)))
|
|
||||||
|
|
||||||
(if (null? invoice)
|
(if (null? invoice)
|
||||||
|
|
||||||
(gnc:html-document-add-object! document
|
(gnc:html-document-add-object! document
|
||||||
@ -565,7 +557,6 @@
|
|||||||
(cust-doc? (memq type (list GNC-INVOICE-CUST-INVOICE GNC-INVOICE-CUST-CREDIT-NOTE)))
|
(cust-doc? (memq type (list GNC-INVOICE-CUST-INVOICE GNC-INVOICE-CUST-CREDIT-NOTE)))
|
||||||
(credit-note? (memq type (list GNC-INVOICE-CUST-CREDIT-NOTE GNC-INVOICE-VEND-CREDIT-NOTE
|
(credit-note? (memq type (list GNC-INVOICE-CUST-CREDIT-NOTE GNC-INVOICE-VEND-CREDIT-NOTE
|
||||||
GNC-INVOICE-EMPL-CREDIT-NOTE)))
|
GNC-INVOICE-EMPL-CREDIT-NOTE)))
|
||||||
|
|
||||||
(default-title (case type
|
(default-title (case type
|
||||||
((GNC-INVOICE-VEND-INVOICE)
|
((GNC-INVOICE-VEND-INVOICE)
|
||||||
(_ "Bill"))
|
(_ "Bill"))
|
||||||
@ -578,7 +569,7 @@
|
|||||||
(title (title-string default-title custom-title))
|
(title (title-string default-title custom-title))
|
||||||
(table (make-entry-table invoice
|
(table (make-entry-table invoice
|
||||||
(gnc:report-options report-obj)
|
(gnc:report-options report-obj)
|
||||||
add-order cust-doc? credit-note?)))
|
cust-doc? credit-note?)))
|
||||||
|
|
||||||
(gnc:html-document-set-title! document (format #f (_"~a #~a") title
|
(gnc:html-document-set-title! document (format #f (_"~a #~a") title
|
||||||
(gncInvoiceGetID invoice)))
|
(gncInvoiceGetID invoice)))
|
||||||
@ -607,6 +598,7 @@
|
|||||||
|
|
||||||
(gnc:html-document-add-object! document
|
(gnc:html-document-add-object! document
|
||||||
(make-client-table owner orders))
|
(make-client-table owner orders))
|
||||||
|
|
||||||
(make-break! document)
|
(make-break! document)
|
||||||
(make-break! document)
|
(make-break! document)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user