Index: fancy-invoice.scm =================================================================== --- fancy-invoice.scm (revision 16547) +++ fancy-invoice.scm (working copy) @@ -45,6 +45,7 @@ ;; Modifed to use settable options instead of the hard coded ones. ;; modified by Brian Dolbec <dol-sen at telus dot net> Feb. 6, 2006 +;; Added a user changeable title and tax name, total ex tax and friendlier no invoice prompt Sept 2007. Bryan Cebuliak <bryan.cebuliak at gmail> (define-module (gnucash report fancy-invoice)) @@ -127,7 +128,7 @@ (set-col (opt-val "Display Columns" "Total") 8) col-vector)) -(define (make-heading-list column-vector) +(define (make-heading-list column-vector taxname) (let ((heading-list '())) (if (date-col column-vector) @@ -145,9 +146,9 @@ (if (tax-col column-vector) (addto! heading-list (_ "Taxable"))) (if (taxvalue-col column-vector) - (addto! heading-list (_ "Tax Amount"))) + (addto! heading-list (_ taxname))) (if (value-col column-vector) - (addto! heading-list (_ "Total"))) + (addto! heading-list (string-append (_ "Total ex ") (_ taxname)))) (reverse heading-list))) (define (make-account-hash) (make-hash-table 23)) @@ -290,7 +291,7 @@ (gnc:register-inv-option (gnc:make-simple-boolean-option (N_ "Display Columns") (N_ "Tax Amount") - "m" (N_ "Display each entry's total total tax") #f)) + "m" (N_ "Display each entry's total total tax") #t)) (gnc:register-inv-option (gnc:make-simple-boolean-option @@ -300,7 +301,7 @@ (gnc:register-inv-option (gnc:make-simple-boolean-option (N_ "Display") (N_ "Individual Taxes") - "o" (N_ "Display all the individual taxes?") #t)) + "o" (N_ "Display all the individual taxes?") #f)) (gnc:register-inv-option (gnc:make-simple-boolean-option @@ -335,19 +336,30 @@ (gnc:register-inv-option (gnc:make-number-range-option (N_ "Display") (N_ "Minimum # of entries") - "u" (N_ "The minimum number of invoice entries to display. (-1)") 23 + "td" (N_ "The minimum number of invoice entries to display. (-1)") 23 4 23 3 1)) (gnc:register-inv-option + (gnc:make-string-option + (N_ "Text") (N_ "Invoice Title") + "te" (N_ "Enter invoice title here") (N_ "Invoice"))) + + (gnc:register-inv-option + (gnc:make-string-option + (N_ "Text") (N_ "Tax Name") + "tf" (N_ "Enter tax name: Tax, GST, VAT, Sales Tax, etc, here.") (N_ "Tax"))) + + + (gnc:register-inv-option (gnc:make-text-option - (N_ "Display") (N_ "Extra Notes") + (N_ "Text") (N_ "Extra Notes") "u" (N_ "Extra notes to put on the invoice") "")) (gnc:register-inv-option (gnc:make-complex-boolean-option (N_ "Display") (N_ "Payable to") - "ua1" (N_ "Display the Payable to: information") #t #f + "ua1" (N_ "Display the Payable to information") #t #f (lambda (x) (gnc-option-db-set-option-selectable-by-name gnc:*report-options* "Display" "Payable to string" x)))) @@ -391,6 +403,7 @@ (lot (gncInvoiceGetPostedLot invoice)) (txn (gncInvoiceGetPostedTxn invoice)) (currency (gncInvoiceGetCurrency invoice)) + (taxname (opt-val "Text" "Tax Name")) (entries-added 0)) (define (colspan monetary used-columns) @@ -497,7 +510,7 @@ ; nope, just show the total tax. (add-subtotal-row table used-columns tax-collector - "grand-total" (_ "Tax"))) + "grand-total" taxname)) (if (and show-payments (not (null? lot))) (let ((splits (sort-list! @@ -573,7 +586,7 @@ (gnc:html-table-set-col-headers! table - (make-heading-list used-columns)) + (make-heading-list used-columns taxname)) (do-rows-with-subtotals entries table @@ -662,7 +675,7 @@ 'attribute (list "valign" "top")) table)) -(define (make-myname-table book date-format) +(define (make-myname-table title book date-format) (let* ((table (gnc:make-html-table)) (slots (gnc-book-get-slots book)) (name (kvp-frame-get-slot-path-gslist @@ -695,6 +708,7 @@ ;; and add an "INVOICE" title to the upper right, also, ;; put some contact information in the middle ;; FIXME: "INVOICE" should be translated and support bills/expense vouchers + ;; fixed by adding title parameter (gnc:html-table-set-style! table "table" 'attribute (list "border" 0) @@ -702,7 +716,7 @@ 'attribute (list "cellpadding" 0) 'attribute (list "width" "100%")) (gnc:html-table-cell-append-objects! - invoice-cell (_"INVOICE")) + invoice-cell (_ title)) (gnc:html-table-cell-set-style! invoice-cell "td" 'font-size "+2") @@ -758,7 +772,8 @@ (invoice (opt-val invoice-page invoice-name)) (owner '()) (references? (opt-val "Display" "References")) - (title (_ "Invoice")) + (title (opt-val "Text" "Invoice Title")) + (striptitle (_ title)) (invoice? #f)) (define (add-order o) @@ -777,6 +792,7 @@ (set! title (_ "Bill"))) ((eqv? type GNC-OWNER-EMPLOYEE) (set! title (_ "Expense Voucher"))))) + (set! striptitle (_ title)) (set! title (sprintf #f (_"%s #%d") title (gncInvoiceGetID invoice))))) ;; oli-custom - title redundant, "Invoice" moved to myname-table, @@ -815,7 +831,7 @@ "50%" "60%"))) (gnc:html-document-add-object! - document (make-myname-table + document (make-myname-table striptitle book ;;(opt-val "Display" "Today Date Format"))) "")) @@ -944,14 +960,14 @@ document (gnc:make-html-text (gnc:html-markup-br) - (string-expand (opt-val "Display" "Extra Notes") #\newline "<br>") + (string-expand (opt-val "Text" "Extra Notes") #\newline "<br>") (gnc:html-markup-br)))) ; else (gnc:html-document-add-object! document (gnc:make-html-text - (_ "No valid invoice selected. Click on the Options button and select the invoice to use.")))) + (_ "Select an Invoice with Options > General > Select")))) document)) Index: easy-invoice.scm =================================================================== --- easy-invoice.scm (revision 16547) +++ easy-invoice.scm (working copy) @@ -27,6 +27,7 @@ ;; 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 ;; Boston, MA 02110-1301, USA gnu@gnu.org ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Added a user changeable title and tax name, total ex tax and friendlier no invoice prompt Sept 2007. Bryan Cebuliak <bryan.cebuliak at gmail> (define-module (gnucash report easy-invoice)) @@ -109,7 +110,7 @@ (set-col (opt-val "Display Columns" "Total") 8) col-vector)) -(define (make-heading-list column-vector) +(define (make-heading-list column-vector taxname) (let ((heading-list '())) (if (date-col column-vector) @@ -127,9 +128,9 @@ (if (tax-col column-vector) (addto! heading-list (_ "Taxable"))) (if (taxvalue-col column-vector) - (addto! heading-list (_ "Tax Amount"))) + (addto! heading-list (_ taxname))) (if (value-col column-vector) - (addto! heading-list (_ "Total"))) + (addto! heading-list (string-append (_ "Total ex ") (_ taxname)))) (reverse heading-list))) (define (make-account-hash) (make-hash-table 23)) @@ -258,7 +259,7 @@ (gnc:register-inv-option (gnc:make-simple-boolean-option (N_ "Display Columns") (N_ "Action") - "g" (N_ "Display the action?") #t)) + "g" (N_ "Display the action?") #f)) (gnc:register-inv-option (gnc:make-simple-boolean-option @@ -273,17 +274,17 @@ (gnc:register-inv-option (gnc:make-simple-boolean-option (N_ "Display Columns") (N_ "Discount") - "k" (N_ "Display the entry's discount") #t)) + "k" (N_ "Display the entry's discount") #f)) (gnc:register-inv-option (gnc:make-simple-boolean-option (N_ "Display Columns") (N_ "Taxable") - "l" (N_ "Display the entry's taxable status") #t)) + "l" (N_ "Display the entry's taxable status") #f)) (gnc:register-inv-option (gnc:make-simple-boolean-option (N_ "Display Columns") (N_ "Tax Amount") - "m" (N_ "Display each entry's total total tax") #f)) + "m" (N_ "Display each entry's total total tax") #t)) (gnc:register-inv-option (gnc:make-simple-boolean-option @@ -351,7 +352,17 @@ "u" (N_ "The minimum width of the invoice.") 600 100 1600 0 10)) +(gnc:register-inv-option + (gnc:make-string-option + (N_ "Text") (N_ "Invoice Title") + "ua" (N_ "Enter invoice title here") (N_ "Invoice"))) + (gnc:register-inv-option + (gnc:make-string-option + (N_ "Text") (N_ "Tax Name") + "ub" (N_ "Enter tax name: Tax, GST, VAT, Sales Tax, etc, here.") (N_ "Tax"))) + + (gnc:register-inv-option (gnc:make-text-option (N_ "Text") (N_ "Extra Notes") "v" (N_ "Extra notes to put on the invoice (simple HTML is accepted)") @@ -377,7 +388,8 @@ (display-all-taxes (opt-val "Display" "Individual Taxes")) (lot (gncInvoiceGetPostedLot invoice)) (txn (gncInvoiceGetPostedTxn invoice)) - (currency (gncInvoiceGetCurrency invoice))) + (currency (gncInvoiceGetCurrency invoice)) + (taxname (opt-val "Text" "Tax Name"))) (define (colspan monetary used-columns) (cond @@ -470,7 +482,7 @@ ; nope, just show the total tax. (add-subtotal-row table used-columns tax-collector - "grand-total" (_ "Tax"))) + "grand-total" taxname)) (if (and show-payments (not (null? lot))) (let ((splits (sort-list! @@ -543,7 +555,7 @@ (gnc:html-table-set-col-headers! table - (make-heading-list used-columns)) + (make-heading-list used-columns taxname)) (do-rows-with-subtotals entries table @@ -675,7 +687,7 @@ (invoice (opt-val invoice-page invoice-name)) (owner '()) (references? (opt-val "Display" "References")) - (title (_ "Invoice")) + (title (opt-val "Text" "Invoice Title")) (invoice? #f)) (define (add-order o) @@ -712,8 +724,10 @@ (add-html! document "<table width='100%'><tr>") (add-html! document "<td align='left'>") (add-html! document "<b><u>") - (add-html! document (sprintf #f (_ "Invoice #%d") - (gncInvoiceGetID invoice))) + ;(add-html! document (sprintf #f (_ "Invoice #%d") + ; (gncInvoiceGetID invoice))) + (add-html! document (sprintf #f (_ title) + (gncInvoiceGetID invoice))) (add-html! document "</u></b></td>") (add-html! document "<td align='right'>") @@ -847,8 +861,8 @@ (gnc:html-document-add-object! document (gnc:make-html-text - (_ "No valid invoice selected. Click on the Options button and select the invoice to use.")))) - + ;(_ "No Valid Invoice Selected")))) This is not very user friendly. Be informative here: + (_ "Select an invoice with Options > General > Select")))) document)) (gnc:define-report Index: invoice.scm =================================================================== --- invoice.scm (revision 16547) +++ invoice.scm (working copy) @@ -20,8 +20,8 @@ ;; Free Software Foundation Voice: +1-617-542-5942 ;; 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 ;; Boston, MA 02110-1301, USA gnu@gnu.org +;; Added a user changeable title and tax name, total ex tax and friendlier no invoice prompt Sept 2007. Bryan Cebuliak <bryan.cebuliak at gmail> - (define-module (gnucash report invoice)) (use-modules (srfi srfi-1)) @@ -103,7 +103,7 @@ (set-col (opt-val "Display Columns" "Total") 8) col-vector)) -(define (make-heading-list column-vector) +(define (make-heading-list column-vector taxname) (let ((heading-list '())) (if (date-col column-vector) @@ -121,9 +121,9 @@ (if (tax-col column-vector) (addto! heading-list (_ "Taxable"))) (if (taxvalue-col column-vector) - (addto! heading-list (_ "Tax Amount"))) + (addto! heading-list (_ taxname))) (if (value-col column-vector) - (addto! heading-list (_ "Total"))) + (addto! heading-list (string-append (_ "Total ex ") (_ taxname)))) (reverse heading-list))) (define (make-account-hash) (make-hash-table 23)) @@ -266,17 +266,17 @@ (gnc:register-inv-option (gnc:make-simple-boolean-option (N_ "Display Columns") (N_ "Discount") - "k" (N_ "Display the entry's discount") #t)) + "k" (N_ "Display the entry's discount") #f)) (gnc:register-inv-option (gnc:make-simple-boolean-option (N_ "Display Columns") (N_ "Taxable") - "l" (N_ "Display the entry's taxable status") #t)) + "l" (N_ "Display the entry's taxable status") #f)) (gnc:register-inv-option (gnc:make-simple-boolean-option (N_ "Display Columns") (N_ "Tax Amount") - "m" (N_ "Display each entry's total total tax") #f)) + "m" (N_ "Display each entry's total total tax") #t)) (gnc:register-inv-option (gnc:make-simple-boolean-option @@ -319,14 +319,25 @@ "tc" (N_ "Display the payments applied to this invoice?") #f)) (gnc:register-inv-option + (gnc:make-string-option + (N_ "Text") (N_ "Invoice Title") + "td" (N_ "Enter invoice title here") (N_ "Invoice"))) + + (gnc:register-inv-option + (gnc:make-string-option + (N_ "Text") (N_ "Tax Name") + "te" (N_ "Enter tax name: Tax, GST, VAT, Sales Tax, etc, here.") (N_ "Tax"))) + + + (gnc:register-inv-option (gnc:make-text-option - (N_ "Display") (N_ "Extra Notes") + (N_ "Text") (N_ "Extra Notes") "u" (N_ "Extra notes to put on the invoice") (_ "Thank you for your patronage"))) (gnc:register-inv-option (gnc:make-string-option - (N_ "Display") (N_ "Today Date Format") + (N_ "Text") (N_ "Today Date Format") "v" (N_ "The format for the date->string conversion for today's date.") "%B %e, %Y")) @@ -343,7 +354,8 @@ (display-all-taxes (opt-val "Display" "Individual Taxes")) (lot (gncInvoiceGetPostedLot invoice)) (txn (gncInvoiceGetPostedTxn invoice)) - (currency (gncInvoiceGetCurrency invoice))) + (currency (gncInvoiceGetCurrency invoice)) + (taxname (opt-val "Text" "Tax Name"))) (define (colspan monetary used-columns) (cond @@ -434,7 +446,7 @@ ; nope, just show the total tax. (add-subtotal-row table used-columns tax-collector - "grand-total" (_ "Tax"))) + "grand-total" taxname)) (if (and show-payments (not (null? lot))) (let ((splits (sort-list! @@ -507,7 +519,7 @@ (gnc:html-table-set-col-headers! table - (make-heading-list used-columns)) + (make-heading-list used-columns taxname)) (do-rows-with-subtotals entries table @@ -628,7 +640,7 @@ (invoice (opt-val invoice-page invoice-name)) (owner '()) (references? (opt-val "Display" "References")) - (title (_ "Invoice")) + (title (opt-val "Text" "Invoice Title")) (invoice? #f)) (define (add-order o) @@ -666,7 +678,7 @@ (gnc:html-document-add-object! document - (make-myname-table book (opt-val "Display" "Today Date Format"))) + (make-myname-table book (opt-val "Text" "Today Date Format"))) (let ((date-table #f) (post-date (gncInvoiceGetDatePosted invoice)) @@ -736,14 +748,14 @@ document (gnc:make-html-text (gnc:html-markup-br) - (string-expand (opt-val "Display" "Extra Notes") #\newline "<br>") + (string-expand (opt-val "Text" "Extra Notes") #\newline "<br>") (gnc:html-markup-br)))) ; else (gnc:html-document-add-object! document (gnc:make-html-text - (_ "No valid invoice selected. Click on the Options button and select the invoice to use.")))) + (_ "Select an Invoice with Options > General > Select")))) document))