From 4b71c08cb806f16540cece39c2d819e67a59e778 Mon Sep 17 00:00:00 2001 From: Derek Atkins Date: Mon, 8 Jul 2002 16:32:47 +0000 Subject: [PATCH] Use the Book-KVP-Options for the Company Name and Company Address in the PrintInvoice, Customer, and Vendor reports. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@7100 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/business/business-reports/invoice.scm | 37 +++++++++-------- .../business-reports/owner-report.scm | 40 ++++++++++--------- 2 files changed, 39 insertions(+), 38 deletions(-) diff --git a/src/business/business-reports/invoice.scm b/src/business/business-reports/invoice.scm index 4a6050fc1c..31466ba6e5 100644 --- a/src/business/business-reports/invoice.scm +++ b/src/business/business-reports/invoice.scm @@ -516,8 +516,16 @@ 'attribute (list "valign" "top")) table)) -(define (make-myname-table date-format) - (let ((table (gnc:make-html-table))) +(define (make-myname-table book date-format) + (let* ((table (gnc:make-html-table)) + (slots (gnc:book-get-slots book)) + (name (gnc:kvp-frame-get-slot-path + slots (append gnc:*kvp-option-path* + (list gnc:*business-label* gnc:*company-name*)))) + (addy (gnc:kvp-frame-get-slot-path + slots (append gnc:*kvp-option-path* + (list gnc:*business-label* gnc:*company-addy*))))) + (gnc:html-table-set-style! table "table" 'attribute (list "border" 0) @@ -525,21 +533,12 @@ 'attribute (list "valign" "top") 'attribute (list "cellspacing" 0) 'attribute (list "cellpadding" 0)) - (gnc:html-table-append-row! - table - (list - (gnc:option-value - (gnc:lookup-global-option "User Info" "User Name")))) - (gnc:html-table-append-row! - table - (list - (string-expand - (gnc:option-value - (gnc:lookup-global-option "User Info" "User Address")) - #\newline "
"))) - (gnc:html-table-append-row! - table - (list (date->string (current-date) date-format))) + (gnc:html-table-append-row! table (list (if name name ""))) + (gnc:html-table-append-row! table (list (string-expand + (if addy addy "") + #\newline "
"))) + (gnc:html-table-append-row! table (list (date->string (current-date) + date-format))) table)) (define (make-break! document) @@ -574,7 +573,7 @@ (gnc:html-document-set-title! document title) (if invoice - (begin + (let ((book (gnc:invoice-get-book invoice))) (set! table (make-entry-table invoice (gnc:report-options report-obj) add-order)) @@ -587,7 +586,7 @@ (gnc:html-document-add-object! document - (make-myname-table (opt-val "Display" "Today Date Format"))) + (make-myname-table book (opt-val "Display" "Today Date Format"))) (let ((date-table #f) (post-date (gnc:invoice-get-date-posted invoice)) diff --git a/src/business/business-reports/owner-report.scm b/src/business/business-reports/owner-report.scm index 3c62bd95b8..d362ff99f7 100644 --- a/src/business/business-reports/owner-report.scm +++ b/src/business/business-reports/owner-report.scm @@ -388,8 +388,16 @@ 'attribute (list "valign" "top")) table)) -(define (make-myname-table date-format) - (let ((table (gnc:make-html-table))) +(define (make-myname-table book date-format) + (let* ((table (gnc:make-html-table)) + (slots (gnc:book-get-slots book)) + (name (gnc:kvp-frame-get-slot-path + slots (append gnc:*kvp-option-path* + (list gnc:*business-label* gnc:*company-name*)))) + (addy (gnc:kvp-frame-get-slot-path + slots (append gnc:*kvp-option-path* + (list gnc:*business-label* gnc:*company-addy*))))) + (gnc:html-table-set-style! table "table" 'attribute (list "border" 0) @@ -397,21 +405,14 @@ 'attribute (list "valign" "top") 'attribute (list "cellspacing" 0) 'attribute (list "cellpadding" 0)) - (gnc:html-table-append-row! - table - (list - (gnc:option-value - (gnc:lookup-global-option "User Info" "User Name")))) - (gnc:html-table-append-row! - table - (list - (string-expand - (gnc:option-value - (gnc:lookup-global-option "User Info" "User Address")) - #\newline "
"))) - (gnc:html-table-append-row! - table - (list (date->string (current-date) date-format))) + + (gnc:html-table-append-row! table (list (if name name ""))) + (gnc:html-table-append-row! table (list (string-expand + (if addy addy "") + #\newline "
"))) + (gnc:html-table-append-row! table + (list (date->string (current-date) + date-format))) table)) (define (make-break! document) @@ -435,7 +436,8 @@ (report-date (gnc:timepair-end-day-time (gnc:date-option-absolute-time (opt-val gnc:pagename-general (N_ "To"))))) - (title #f)) + (title #f) + (book (gnc:get-current-book))) ;XXX Grab this from elsewhere (if (not (null? account-list)) (set! account (car account-list))) @@ -479,7 +481,7 @@ (gnc:html-document-add-object! document - (make-myname-table (opt-val gnc:pagename-general (N_ "Today Date Format")))) + (make-myname-table book (opt-val gnc:pagename-general (N_ "Today Date Format")))) (gnc:html-document-add-object! document