Bug #635632: Update existing eguile reports to use new for syntax.

Patch by Matthijs Kooijman <matthijs@stdin.nl>:

    This makes use of the new for syntax introduced in the previous
    commit, making these reports and templates a bit easier to read and
    modify.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@19889 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Christian Stimming 2010-11-27 21:54:29 +00:00
parent 626f8dfe7a
commit c7cba6884e
4 changed files with 13 additions and 28 deletions

View File

@ -76,8 +76,7 @@
(car (gnc-transaction-get-date-posted t2))))))))
; pre-scan invoice entries to look for discounts and taxes
(for-each
(lambda (entry)
(for entry in entries do
(let ((action (gncEntryGetAction entry))
(qty (gncEntryGetQuantity entry))
(discount (gncEntryGetInvDiscount entry))
@ -96,15 +95,12 @@
; error in SWIG binding -- disable display of tax details
; (see http://bugzilla.gnome.org/show_bug.cgi?id=573645)
(set! taxtables? #f))))))) ; hack required until Swig is fixed
entries)
; pre-scan invoice splits to see if any payments have been made
(for-each
(lambda (split)
(for split in splits do
(let* ((t (xaccSplitGetParent split)))
(if (not (equal? t txn))
(set! payments? #t))))
splits)
?>
@ -285,8 +281,7 @@
(sub-total (gnc:make-commodity-collector))
(dsc-total (gnc:make-commodity-collector))
(inv-total (gnc:make-commodity-collector)))
(for-each ; entry in entries
(lambda (entry)
(for entry in entries do
(let ((qty (gncEntryGetQuantity entry))
(each (gncEntryGetInvPrice entry))
(action (gncEntryGetAction entry))
@ -333,7 +328,7 @@
<!-- TO DO: need an option about whether to display the tax-inclusive total? -->
<td align="right"><?scm:d (fmtmoney currency (gnc-numeric-add rval rtaxval GNC-DENOM-AUTO GNC-RND-ROUND)) ?></td>
</tr>
<?scm )) entries) ?>
<?scm )) ?>
<!-- display subtotals row -->
<?scm (if (or tax? discount? payments?) (begin ?>
@ -354,8 +349,7 @@
<!-- payments -->
<?scm
(if payments?
(for-each
(lambda (split)
(for split in splits do
(let ((t (xaccSplitGetParent split)))
(if (not (equal? t txn)) ; don't process the entry itself as a split
(let ((c (xaccTransGetCurrency t))
@ -367,7 +361,7 @@
<td align="left" colspan="<?scm:d (- spancols1 1) ?>"><?scm:d opt-payment-recd-heading ?></td>
<td align="right"><?scm:d (fmtmoney c a) ?></td>
</tr>
<?scm )))) splits)) ?>
<?scm ))))) ?>
<!-- total row -->
<tr valign="top">

View File

@ -55,8 +55,7 @@
(entries (gncTaxTableGetEntries taxtable))
(amt? #f) ; becomes #t if any entries are amounts
(pc? #f)) ; becomes #t if any entries are percentages
(for-each
(lambda (entry)
(for entry in entries do
(let ((tttype (gncTaxTableEntryGetType entry))
(ttamt (gncTaxTableEntryGetAmount entry)))
(if (equal? tttype GNC-AMT-TYPE-VALUE)
@ -66,7 +65,6 @@
(begin
(set! pc? #t)
(pctot 'add ttamt)))))
entries)
(if pc? (begin (display (fmtnumeric (pctot 'total #f))) (display "%")))
(if (and amt? pc?) (display " +&nbsp;")) ; both - this seems unlikely in practice
(if amt?

View File

@ -76,8 +76,7 @@
onedepth1)
;; Recursively display the accounts table from the given tree
;; (as returned by process-acc-list)
(for-each
(lambda (accrec)
(for accrec in tree do
(let ((rshift2 0) ; adjust the amount column by this much
(showamt? #t)) ; whether to show the amount (e.g. not if zero)
(if (and (accrec-sublist accrec)
@ -122,8 +121,7 @@
(format-comm-coll-total (accrec-subtotal-cc accrec))
(<= (accrec-depth accrec) 1) ; total?
(> (accrec-depth accrec) 0))))))) ; leftoverrule?
tree
))
)
?>
<!-- The HTML starts here... -->
@ -288,8 +286,7 @@
<p><?scm:d (_ "<strong>Exchange Rates</strong> used for this report") ?>
<table border="0">
<?scm
(for-each
(lambda (xpair)
(for xpair in xlist do
(let* ((comm (car xpair))
(one-num (gnc:make-gnc-numeric 10000 1))
(one-foreign-mny (gnc:make-gnc-monetary comm one-num))
@ -308,7 +305,6 @@
</tr>
<?scm
))
xlist)
?>
</table>
<?scm

View File

@ -80,12 +80,11 @@
(define (debug . args)
(if debugging?
(for-each
(lambda (arg)
(for arg in args do
(if (string? arg)
(display (string-append arg " "))
(display (string-append (dump arg) " "))))
args)))
))
(define (hrule cols) ; in fact just puts in an empty row for spacing
(display "<tr valign=\"center\"><td colspan=\"")
@ -164,12 +163,10 @@
(display " sublist: ") (if (accrec-sublist accrec)
(begin
(display "\n<ul>")
(for-each
(lambda (sub-accrec)
(for sub-accrec in (accrec-sublist accrec) do
(display "\n<li>")
(accrec-printer sub-accrec port)
(display "</li>"))
(accrec-sublist accrec))
(display "</ul>"))
(display "#f")))
(define accrectype (make-record-type "accrecc"