[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.
This commit is contained in:
Christopher Lam 2018-09-14 19:24:12 +08:00
parent 941acee04e
commit ad361d1e69

View File

@ -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)))