Bug 645786 - Fancy invoice report still doesn't use fancy date format preference

Use fancy date consistently for all invoice reports
This commit is contained in:
Geert Janssens 2015-08-04 15:00:57 +02:00
parent c64f58f54f
commit 678cc189a3
4 changed files with 34 additions and 37 deletions

View File

@ -611,12 +611,14 @@
'attribute (list "valign" "top"))
table))
(define (make-date-row! table label date)
(define (make-date-row! table label date date-format)
(gnc:html-table-append-row!
table
(list
(string-append label ": ")
(string-expand (gnc-print-date date) #\space " "))))
(string-expand (strftime date-format
(localtime (car date)))
#\space " "))))
(define (make-date-table)
(let ((table (gnc:make-html-table)))
@ -731,7 +733,7 @@
(add-html! document "<tr><td align='left'>")
(if (not (null? invoice))
(begin
(let* ((date-format (gnc:fancy-date-info gnc:*fancy-date-format*)))
; invoice number and ID String table
(add-html! document "<table width='100%'><tr>")
(add-html! document "<td align='left'>")
@ -779,26 +781,16 @@
)
; add the date
(let ((post-date (gncInvoiceGetDatePosted invoice))
(let ((date-table #f)
(post-date (gncInvoiceGetDatePosted invoice))
(due-date (gncInvoiceGetDateDue invoice)))
(if (not (equal? post-date (cons 0 0)))
(begin
(add-html! document "<table border=0><tr>")
(add-html! document "<td>")
(add-html! document (string-append (_ "Date") ": "))
(add-html! document "</td>")
(add-html! document "<td>")
(add-html! document (gnc-print-date post-date))
(add-html! document "</td>")
(set! date-table (make-date-table))
(make-date-row! date-table (_ "Date") post-date date-format)
(if (opt-val "Display" "Due Date")
(begin
(add-html! document "<tr><td>")
(add-html! document (string-append (_ "Due") ": "))
(add-html! document "</td>")
(add-html! document "<td>")
(add-html! document (gnc-print-date due-date))
(add-html! document "</td>")))
(add-html! document "</tr></table>"))
(make-date-row! date-table (_ "Due") due-date date-format))
(gnc:html-document-add-object! document date-table))
(add-html! document
(string-append "<font color='red'>"
(_ "INVOICE NOT POSTED")

View File

@ -661,18 +661,14 @@
'attribute (list "valign" "top"))
table))
(define (make-date-row! table label date)
(define (make-date-row! table label date date-format)
(gnc:html-table-append-row!
table
(list
(string-append label ":&nbsp;")
;; oli-custom - modified to display a custom format
;; for the invoice date/due date fields
;; I could have taken the format from the report options, but... ;)
(string-expand (strftime (gnc-default-strftime-date-format)
(string-expand (strftime date-format
(localtime (car date)))
#\space "&nbsp;")
;;(string-expand (gnc-print-date date) #\space "&nbsp;")
#\space "&nbsp;")
)))
(define (make-date-table)
@ -815,7 +811,9 @@
(if (not (null? invoice))
(let* ((date-object #f)
(let ((book (gncInvoiceGetBook invoice))
(date-object #f)
(date-format (gnc:fancy-date-info gnc:*fancy-date-format*))
(helper-table (gnc:make-html-table))
(title (title-string default-title custom-title)))
(set! table (make-entry-table invoice
@ -877,8 +875,8 @@
;; options. This string sucks for i18n, but I don't
;; have a better solution right now without breaking
;; other people's invoices.
(make-date-row! date-table (sprintf #f (_ "%s&nbsp;Date") title) post-date)
(make-date-row! date-table (_ "Due Date") due-date)
(make-date-row! date-table (sprintf #f (_ "%s&nbsp;Date") title) post-date date-format)
(make-date-row! date-table (_ "Due&nbsp;Date") due-date date-format)
date-table)
(gnc:make-html-text
;; oli-custom - FIXME: I have a feeling I broke a

View File

@ -587,12 +587,15 @@
'attribute (list "valign" "top"))
table))
(define (make-date-row! table label date)
(define (make-date-row! table label date date-format)
(gnc:html-table-append-row!
table
(list
(string-append label ":&nbsp;")
(string-expand (gnc-print-date date) #\space "&nbsp;"))))
(string-expand (strftime date-format
(localtime (car date)))
#\space "&nbsp;")
)))
(define (make-date-table)
(let ((table (gnc:make-html-table)))
@ -665,7 +668,7 @@
(if (not (null? invoice))
(begin
(set! owner (gncInvoiceGetOwner invoice))
(set! owner (gncInvoiceGetOwner invoice))
(let ((type (gncInvoiceGetType invoice)))
(cond
((eqv? type GNC-INVOICE-CUST-INVOICE)
@ -694,7 +697,8 @@
(gncInvoiceGetID invoice)))
(if (not (null? invoice))
(let ((book (gncInvoiceGetBook invoice)))
(let* ((book (gncInvoiceGetBook invoice))
(date-format (gnc:fancy-date-info gnc:*fancy-date-format*)))
(set! table (make-entry-table invoice
(gnc:report-options report-obj)
add-order cust-doc? credit-note?))
@ -716,8 +720,8 @@
(if (not (equal? post-date (cons 0 0)))
(begin
(set! date-table (make-date-table))
(make-date-row! date-table (string-append title " " (_ "Date")) post-date)
(make-date-row! date-table (_ "Due Date") due-date)
(make-date-row! date-table (string-append title " " (_ "Date")) post-date date-format)
(make-date-row! date-table (_ "Due Date") due-date date-format)
(gnc:html-document-add-object! document date-table))
(gnc:html-document-add-object!
document

View File

@ -47,6 +47,7 @@
(currency (gncInvoiceGetCurrency opt-invoice))
(entries (gncInvoiceGetEntries opt-invoice))
(splits '());'
(dateformat (gnc:fancy-date-info gnc:*fancy-date-format*))
(coyname (gnc:company-info gnc:*company-name*))
(coycontact (gnc:company-info gnc:*company-contact*))
(coyaddr (gnc:company-info gnc:*company-addy*))
@ -249,11 +250,13 @@
<?scm ) (begin ?>
<tr>
<td align="right"><?scm:d (nbsp (_ "Invoice Date")) ?>:&nbsp;</td>
<td align="right"><?scm:d (gnc-print-date postdate) ?></td>
<td align="right"><?scm:d (nbsp (strftime dateformat
(localtime (car postdate)))) ?></td>
</tr>
<tr>
<td align="right"><?scm:d (nbsp (_ "Due Date")) ?>:&nbsp;</td>
<td align="right"><?scm:d (gnc-print-date duedate) ?></td>
<td align="right"><?scm:d (nbsp (strftime dateformat
(localtime (car duedate)))) ?></td>
</tr> <?scm )) ?>
<?scm (if (not (string=? billingid "")) (begin ?>
<tr>