From ad361d1e69edac8fb352c72305f723c81d9b354b Mon Sep 17 00:00:00 2001 From: Christopher Lam Date: Fri, 14 Sep 2018 19:24:12 +0800 Subject: [PATCH] [invoice] Add customer/vendor ID in client section This aims, but does not completely fixes bug 430259 or 742086 which would require data model changes. It upgrades invoice.scm to add the customer/vendor/employee internal ID. Job invoices will display the job owner's ID. --- gnucash/report/business-reports/invoice.scm | 27 +++++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/gnucash/report/business-reports/invoice.scm b/gnucash/report/business-reports/invoice.scm index 38d0421387..e5750f8091 100644 --- a/gnucash/report/business-reports/invoice.scm +++ b/gnucash/report/business-reports/invoice.scm @@ -110,10 +110,10 @@ (gnc:make-gnc-monetary currency numeric))) (define layout-key-list - (list (cons 'client (list (cons 'text "Client details") - (cons 'tip "Client name and address"))) + (list (cons 'client (list (cons 'text (_ "Their details")) + (cons 'tip (_ "Client or vendor name, address and ID")))) - (cons 'company (list (cons 'text "Company details") + (cons 'company (list (cons 'text "Our details") (cons 'tip "Company name, address and tax-ID"))) (cons 'invoice (list (cons 'text "Invoice details") @@ -333,6 +333,11 @@ for styling the invoice. Please see the exported report for the CSS class names. (N_ "Display") (N_ "Billing ID") "ta" (N_ "Display the billing id?") #t)) + (gnc:register-inv-option + (gnc:make-simple-boolean-option + (N_ "Display") (N_ "Invoice owner ID") + "tam" (N_ "Display the customer/vendor id?") #f)) + (gnc:register-inv-option (gnc:make-simple-boolean-option (N_ "Display") (N_ "Invoice Notes") @@ -669,7 +674,10 @@ for styling the invoice. Please see the exported report for the CSS class names. (gnc:make-html-text (gnc:html-markup-img img-url))) -(define (make-client-table owner orders) +(define (make-client-table owner orders options) + (define (opt-val section name) + (gnc:option-value + (gnc:lookup-option options section name))) ;; this is a single-column table. (let ((table (gnc:make-html-table))) @@ -686,6 +694,14 @@ for styling the invoice. Please see the exported report for the CSS class names. (multiline-to-html-text (gnc:owner-get-address-dep owner))))) + (if (opt-val "Display" "Invoice owner ID") + (gnc:html-table-append-row! table + (list + (gnc:make-html-div/markup + "maybe-align-right client-id" + (multiline-to-html-text + (gnc:owner-get-owner-id owner)))))) + (for-each (lambda (order) (let ((reference (gncOrderGetReference order))) @@ -793,7 +809,8 @@ for styling the invoice. Please see the exported report for the CSS class names. invoice options))) (cons 'client (gnc:make-html-div/markup "client-table" - (make-client-table owner orders))) + (make-client-table + owner orders options))) (cons 'company (gnc:make-html-div/markup "company-table" (make-company-table book)))