mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
* owner-report.scm: add a due-date column; change "Invoice" to
"Bill" for vendor reports. Fix the aging table. Reverse the numerics for vendor reports. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@7106 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
439be2a6b7
commit
77e67e293b
@ -6,6 +6,10 @@
|
|||||||
* add "centered-label-cell" markup type to define a cell with tag
|
* add "centered-label-cell" markup type to define a cell with tag
|
||||||
'b' and attribute "align center".
|
'b' and attribute "align center".
|
||||||
|
|
||||||
|
* owner-report.scm: add a due-date column; change "Invoice" to
|
||||||
|
"Bill" for vendor reports. Fix the aging table. Reverse the
|
||||||
|
numerics for vendor reports.
|
||||||
|
|
||||||
2002-07-08 Derek Atkins <derek@ihtfp.com>
|
2002-07-08 Derek Atkins <derek@ihtfp.com>
|
||||||
|
|
||||||
* kvp-option-registry.scm: create a registry of kvp-options
|
* kvp-option-registry.scm: create a registry of kvp-options
|
||||||
|
@ -34,16 +34,18 @@
|
|||||||
|
|
||||||
(define (date-col columns-used)
|
(define (date-col columns-used)
|
||||||
(vector-ref columns-used 0))
|
(vector-ref columns-used 0))
|
||||||
(define (num-col columns-used)
|
(define (date-due-col columns-used)
|
||||||
(vector-ref columns-used 1))
|
(vector-ref columns-used 1))
|
||||||
(define (type-col columns-used)
|
(define (num-col columns-used)
|
||||||
(vector-ref columns-used 2))
|
(vector-ref columns-used 2))
|
||||||
(define (memo-col columns-used)
|
(define (type-col columns-used)
|
||||||
(vector-ref columns-used 3))
|
(vector-ref columns-used 3))
|
||||||
(define (value-col columns-used)
|
(define (memo-col columns-used)
|
||||||
(vector-ref columns-used 4))
|
(vector-ref columns-used 4))
|
||||||
|
(define (value-col columns-used)
|
||||||
|
(vector-ref columns-used 5))
|
||||||
|
|
||||||
(define columns-used-size 5)
|
(define columns-used-size 6)
|
||||||
|
|
||||||
(define (build-column-used options)
|
(define (build-column-used options)
|
||||||
(define (opt-val section name)
|
(define (opt-val section name)
|
||||||
@ -61,16 +63,19 @@
|
|||||||
(let* ((col-vector (make-vector columns-used-size #f))
|
(let* ((col-vector (make-vector columns-used-size #f))
|
||||||
(set-col (make-set-col col-vector)))
|
(set-col (make-set-col col-vector)))
|
||||||
(set-col (opt-val "Display Columns" "Date") 0)
|
(set-col (opt-val "Display Columns" "Date") 0)
|
||||||
(set-col (opt-val "Display Columns" "Num") 1)
|
(set-col (opt-val "Display Columns" "Due Date") 1)
|
||||||
(set-col (opt-val "Display Columns" "Type") 2)
|
(set-col (opt-val "Display Columns" "Num") 2)
|
||||||
(set-col (opt-val "Display Columns" "Memo") 3)
|
(set-col (opt-val "Display Columns" "Type") 3)
|
||||||
(set-col (opt-val "Display Columns" "Value") 4)
|
(set-col (opt-val "Display Columns" "Memo") 4)
|
||||||
|
(set-col (opt-val "Display Columns" "Value") 5)
|
||||||
col-vector))
|
col-vector))
|
||||||
|
|
||||||
(define (make-heading-list column-vector)
|
(define (make-heading-list column-vector)
|
||||||
(let ((heading-list '()))
|
(let ((heading-list '()))
|
||||||
(if (date-col column-vector)
|
(if (date-col column-vector)
|
||||||
(addto! heading-list (_ "Date")))
|
(addto! heading-list (_ "Date")))
|
||||||
|
(if (date-col column-vector)
|
||||||
|
(addto! heading-list (_ "Due Date")))
|
||||||
(if (num-col column-vector)
|
(if (num-col column-vector)
|
||||||
(addto! heading-list (_ "Reference")))
|
(addto! heading-list (_ "Reference")))
|
||||||
(if (type-col column-vector)
|
(if (type-col column-vector)
|
||||||
@ -94,7 +99,7 @@
|
|||||||
(gnc:make-date-list begindate to-date ThirtyDayDelta)))
|
(gnc:make-date-list begindate to-date ThirtyDayDelta)))
|
||||||
|
|
||||||
|
|
||||||
(define (make-aging-table options query bucket-intervals)
|
(define (make-aging-table options query bucket-intervals reverse?)
|
||||||
(let ((lots (gnc:query-get-lots query 'query-txn-match-any))
|
(let ((lots (gnc:query-get-lots query 'query-txn-match-any))
|
||||||
(buckets (new-bucket-vector))
|
(buckets (new-bucket-vector))
|
||||||
(payments (gnc:numeric-zero))
|
(payments (gnc:numeric-zero))
|
||||||
@ -129,10 +134,13 @@
|
|||||||
(post-date (gnc:invoice-get-date-posted invoice)))
|
(post-date (gnc:invoice-get-date-posted invoice)))
|
||||||
|
|
||||||
(if (not (gnc:numeric-zero-p bal))
|
(if (not (gnc:numeric-zero-p bal))
|
||||||
|
(begin
|
||||||
|
(if reverse?
|
||||||
|
(set! bal (gnc:numeric-neg bal)))
|
||||||
(if invoice
|
(if invoice
|
||||||
(begin
|
(begin
|
||||||
(apply-invoice post-date bal))
|
(apply-invoice post-date bal))
|
||||||
(apply-payment bal)))))
|
(apply-payment bal))))))
|
||||||
lots)
|
lots)
|
||||||
|
|
||||||
(gnc:html-table-set-col-headers!
|
(gnc:html-table-set-col-headers!
|
||||||
@ -156,9 +164,10 @@
|
|||||||
;;
|
;;
|
||||||
;; Return a pair of (date . value)
|
;; Return a pair of (date . value)
|
||||||
;;
|
;;
|
||||||
(define (add-txn-row table txn acc column-vector row-style)
|
(define (add-txn-row table txn acc column-vector row-style inv-str reverse?)
|
||||||
(let* ((type (gnc:transaction-get-txn-type txn))
|
(let* ((type (gnc:transaction-get-txn-type txn))
|
||||||
(date (gnc:transaction-get-date-posted txn))
|
(date (gnc:transaction-get-date-posted txn))
|
||||||
|
(due-date #f)
|
||||||
(value (gnc:transaction-get-account-value txn acc))
|
(value (gnc:transaction-get-account-value txn acc))
|
||||||
(split (gnc:transaction-get-split txn 0))
|
(split (gnc:transaction-get-split txn 0))
|
||||||
(invoice (gnc:invoice-get-invoice-from-txn txn))
|
(invoice (gnc:invoice-get-invoice-from-txn txn))
|
||||||
@ -170,14 +179,26 @@
|
|||||||
(gnc:make-html-text
|
(gnc:make-html-text
|
||||||
(gnc:html-markup-anchor
|
(gnc:html-markup-anchor
|
||||||
(gnc:invoice-anchor-text invoice)
|
(gnc:invoice-anchor-text invoice)
|
||||||
(N_ "Invoice")))
|
inv-str))
|
||||||
(N_ "Invoice")))
|
inv-str))
|
||||||
((equal? type gnc:transaction-type-payment) (N_ "Payment, thank you"))
|
((equal? type gnc:transaction-type-payment) (N_ "Payment, thank you"))
|
||||||
(else (N_ "UNK"))))
|
(else (N_ "UNK"))))
|
||||||
(row-contents '()))
|
(row-contents '()))
|
||||||
|
|
||||||
|
(if reverse?
|
||||||
|
(set! value (gnc:numeric-neg value)))
|
||||||
|
|
||||||
|
(if invoice
|
||||||
|
(set! due-date (gnc:invoice-get-date-due invoice)))
|
||||||
|
|
||||||
(if (date-col column-vector)
|
(if (date-col column-vector)
|
||||||
(addto! row-contents (gnc:print-date date)))
|
(addto! row-contents (gnc:print-date date)))
|
||||||
|
(if (date-due-col column-vector)
|
||||||
|
(addto! row-contents
|
||||||
|
(if (and due-date
|
||||||
|
(not (equal? due-date (cons 0 0))))
|
||||||
|
(gnc:print-date due-date)
|
||||||
|
"")))
|
||||||
(if (num-col column-vector)
|
(if (num-col column-vector)
|
||||||
(addto! row-contents (gnc:transaction-get-num txn)))
|
(addto! row-contents (gnc:transaction-get-num txn)))
|
||||||
(if (type-col column-vector)
|
(if (type-col column-vector)
|
||||||
@ -202,7 +223,11 @@
|
|||||||
(odd-row? #t)
|
(odd-row? #t)
|
||||||
(total (gnc:numeric-zero))
|
(total (gnc:numeric-zero))
|
||||||
(currency (gnc:default-currency)) ;XXX
|
(currency (gnc:default-currency)) ;XXX
|
||||||
(table (gnc:make-html-table)))
|
(table (gnc:make-html-table))
|
||||||
|
(inv-str (gnc:option-value (gnc:lookup-option options "__reg"
|
||||||
|
"inv-str")))
|
||||||
|
(reverse? (gnc:option-value (gnc:lookup-option options "__reg"
|
||||||
|
"reverse?"))))
|
||||||
|
|
||||||
(gnc:html-table-set-col-headers!
|
(gnc:html-table-set-col-headers!
|
||||||
table
|
table
|
||||||
@ -218,7 +243,8 @@
|
|||||||
(if
|
(if
|
||||||
(or (equal? type gnc:transaction-type-invoice)
|
(or (equal? type gnc:transaction-type-invoice)
|
||||||
(equal? type gnc:transaction-type-payment))
|
(equal? type gnc:transaction-type-payment))
|
||||||
(let ((dv (add-txn-row table txn acc used-columns row-style)))
|
(let ((dv (add-txn-row table txn acc used-columns row-style
|
||||||
|
inv-str reverse?)))
|
||||||
|
|
||||||
(set! odd-row? (not odd-row?))
|
(set! odd-row? (not odd-row?))
|
||||||
(set! total (gnc:numeric-add-fixed total (cdr dv)))
|
(set! total (gnc:numeric-add-fixed total (cdr dv)))
|
||||||
@ -244,19 +270,25 @@
|
|||||||
table
|
table
|
||||||
"grand-total"
|
"grand-total"
|
||||||
(list (gnc:make-html-table-cell/size/markup
|
(list (gnc:make-html-table-cell/size/markup
|
||||||
0 (value-col used-columns)
|
1 (+ 1 (value-col used-columns))
|
||||||
"total-number-cell"
|
"centered-label-cell"
|
||||||
(make-aging-table options query interval-vec)))))
|
(make-aging-table options query interval-vec reverse?)))))
|
||||||
|
|
||||||
table))
|
table))
|
||||||
|
|
||||||
(define (options-generator acct-type-list owner-type)
|
(define (options-generator acct-type-list owner-type inv-str reverse?)
|
||||||
|
|
||||||
(define gnc:*report-options* (gnc:new-options))
|
(define gnc:*report-options* (gnc:new-options))
|
||||||
|
|
||||||
(define (gnc:register-inv-option new-option)
|
(define (gnc:register-inv-option new-option)
|
||||||
(gnc:register-option gnc:*report-options* new-option))
|
(gnc:register-option gnc:*report-options* new-option))
|
||||||
|
|
||||||
|
(gnc:register-inv-option
|
||||||
|
(gnc:make-internal-option "__reg" "inv-str" inv-str))
|
||||||
|
|
||||||
|
(gnc:register-inv-option
|
||||||
|
(gnc:make-simple-boolean-option "__reg" "reverse?" "" "" reverse?))
|
||||||
|
|
||||||
(gnc:register-inv-option
|
(gnc:register-inv-option
|
||||||
(gnc:make-owner-option owner-page owner-string "v"
|
(gnc:make-owner-option owner-page owner-string "v"
|
||||||
(N_ "The company for this report")
|
(N_ "The company for this report")
|
||||||
@ -275,6 +307,11 @@
|
|||||||
(N_ "Display Columns") (N_ "Date")
|
(N_ "Display Columns") (N_ "Date")
|
||||||
"b" (N_ "Display the transaction date?") #t))
|
"b" (N_ "Display the transaction date?") #t))
|
||||||
|
|
||||||
|
(gnc:register-inv-option
|
||||||
|
(gnc:make-simple-boolean-option
|
||||||
|
(N_ "Display Columns") (N_ "Due Date")
|
||||||
|
"c" (N_ "Display the transaction date?") #t))
|
||||||
|
|
||||||
(gnc:register-inv-option
|
(gnc:register-inv-option
|
||||||
(gnc:make-simple-boolean-option
|
(gnc:make-simple-boolean-option
|
||||||
(N_ "Display Columns") (N_ "Num")
|
(N_ "Display Columns") (N_ "Num")
|
||||||
@ -306,10 +343,10 @@
|
|||||||
gnc:*report-options*)
|
gnc:*report-options*)
|
||||||
|
|
||||||
(define (customer-options-generator)
|
(define (customer-options-generator)
|
||||||
(options-generator '(receivable) 'gnc-owner-customer))
|
(options-generator '(receivable) 'gnc-owner-customer (N_ "Invoice") #f))
|
||||||
|
|
||||||
(define (vendor-options-generator)
|
(define (vendor-options-generator)
|
||||||
(options-generator '(payable) 'gnc-owner-vendor))
|
(options-generator '(payable) 'gnc-owner-vendor (N_ "Bill") #t))
|
||||||
|
|
||||||
(define (string-expand string character replace-string)
|
(define (string-expand string character replace-string)
|
||||||
(define (car-line chars)
|
(define (car-line chars)
|
||||||
|
Loading…
Reference in New Issue
Block a user