Merge branch 'maint'

pull/565/head
Christopher Lam 7 years ago
commit e6c6d4e0bb

@ -873,18 +873,19 @@
(buckets (make-vector num-buckets 0)))
(define (addbucket! idx amt)
(vector-set! buckets idx (+ amt (vector-ref buckets idx))))
(let lp ((splits splits))
(let lp ((splits splits)
(invoices-and-splits '()))
(cond
((null? splits)
(vector->list buckets))
;; next split is an invoice posting split. note we don't need
;; to handle invoice payments because these payments will
;; reduce the lot balance automatically.
;; next split is an invoice posting split. add its balance to
;; bucket, and add splits to invoices-and-splits for payments.
((eqv? (xaccTransGetTxnType (xaccSplitGetParent (car splits)))
TXN-TYPE-INVOICE)
(let* ((invoice (gncInvoiceGetInvoiceFromTxn
(xaccSplitGetParent (car splits))))
(inv-splits (gnc-lot-get-split-list (gncInvoiceGetPostedLot invoice)))
(lot (gncInvoiceGetPostedLot invoice))
(bal (gnc-lot-get-balance lot))
(bal (if receivable? bal (- bal)))
@ -895,23 +896,33 @@
(let loop ((idx 0) (bucket-dates bucket-dates))
(if (< date (car bucket-dates))
(addbucket! idx bal)
(loop (1+ idx) (cdr bucket-dates)))))
(lp (cdr splits)))
;; next split is a prepayment
((and (eqv? (xaccTransGetTxnType (xaccSplitGetParent (car splits)))
TXN-TYPE-PAYMENT)
(null? (gncInvoiceGetInvoiceFromLot (xaccSplitGetLot (car splits)))))
(let* ((prepay (xaccSplitGetAmount (car splits)))
(prepay (if receivable? prepay (- prepay))))
(gnc:pk 'next=prepay (car splits) prepay)
(addbucket! (1- num-buckets) prepay))
(lp (cdr splits)))
(loop (1+ idx) (cdr bucket-dates))))
(lp (cdr splits)
(cons (cons invoice inv-splits) invoices-and-splits))))
;; next split is a payment. find the associated invoices,
;; deduct their totals. the remaining is an overpayment.
((eqv? (xaccTransGetTxnType (xaccSplitGetParent (car splits)))
TXN-TYPE-PAYMENT)
(let* ((txn (xaccSplitGetParent (car splits)))
(payment (apply + (map xaccSplitGetAmount
(xaccTransGetAPARAcctSplitList txn #f))))
(overpayment
(fold
(lambda (inv-and-splits payment-left)
(if (member txn (map xaccSplitGetParent (cdr inv-and-splits)))
(- payment-left (gncInvoiceGetTotal (car inv-and-splits)))
payment-left))
(if receivable? (- payment) payment) invoices-and-splits)))
(gnc:pk 'payment (car splits) payment "->" overpayment)
(when (positive? overpayment)
(addbucket! (1- num-buckets) (- overpayment)))
(lp (cdr splits) invoices-and-splits)))
;; not invoice/prepayment. regular or payment split.
(else
(gnc:pk 'next=skipped (car splits))
(lp (cdr splits)))))))
(lp (cdr splits) invoices-and-splits))))))
;; ***************************************************************************

@ -251,7 +251,7 @@
(define link-cols (assq-ref '((none . 0) (simple . 1) (detailed . 3)) link-option))
(define (print-totals total debit credit tax sale)
(define (total-cell cell)
(gnc:make-html-table-cell/markup "total-label-cell" cell))
(gnc:make-html-table-cell/markup "total-number-cell" cell))
(define (make-cell amt)
(total-cell (gnc:make-gnc-monetary currency amt)))
(define span
@ -263,7 +263,8 @@
(gnc:html-table-append-row/markup!
table "grand-total"
(append
(list (total-cell (_ "Period Totals")))
(list (gnc:make-html-table-cell/markup
"total-label-cell" (_ "Period Totals")))
(addif (>= span 2) (gnc:make-html-table-cell/size 1 (1- span) ""))
(addif (sale-col used-columns) (make-cell sale))
(addif (tax-col used-columns) (make-cell tax))
@ -277,7 +278,8 @@
(gnc:html-table-append-row/markup!
table "grand-total"
(append
(list (total-cell
(list (gnc:make-html-table-cell/markup
"total-label-cell"
(if (negative? total)
(_ "Total Credit")
(_ "Total Due")))
@ -302,36 +304,42 @@
currency total #f #f #f #f (list (make-list link-cols #f))))
(define (make-invoice->payments-table invoice invoice-splits currency txn)
(append
(map
(lambda (pmt-split)
(list
(qof-print-date
(xaccTransGetDate
(xaccSplitGetParent pmt-split)))
(let ((text (gnc-get-num-action
(xaccSplitGetParent pmt-split)
pmt-split)))
(if (string-null? text)
(_ "Payment")
text))
(make-cell
(gnc:make-html-text
(gnc:html-markup-anchor
(gnc:split-anchor-text pmt-split)
(gnc:make-gnc-monetary
currency (- (xaccSplitGetAmount pmt-split))))))))
(filter (lambda (s) (not (equal? (xaccSplitGetParent s) txn)))
invoice-splits))
(if (gncInvoiceIsPaid invoice)
'()
(list
(list (gnc:make-html-table-cell/size 1 2 (_ "Outstanding"))
(make-cell
(gnc:make-gnc-monetary
currency
(gnc-lot-get-balance
(gncInvoiceGetPostedLot invoice)))))))))
(let lp ((invoice-splits invoice-splits) (result '()))
(cond
((null? invoice-splits)
(reverse
(if (gncInvoiceIsPaid invoice)
result
(cons (list (gnc:make-html-table-cell/size 1 2 (_ "Outstanding"))
(make-cell
(gnc:make-gnc-monetary
currency (gnc-lot-get-balance
(gncInvoiceGetPostedLot invoice)))))
result))))
(else
(let* ((lot-split (car invoice-splits))
(lot-txn (xaccSplitGetParent lot-split))
(tfr-splits (xaccTransGetPaymentAcctSplitList lot-txn)))
(let lp1 ((tfr-splits tfr-splits) (result result))
(cond
((equal? lot-txn txn) (lp (cdr invoice-splits) result))
((null? tfr-splits) (lp (cdr invoice-splits) result))
(else
(let* ((tfr-split (car tfr-splits))
(tfr-acct (xaccSplitGetAccount tfr-split))
(tfr-curr (xaccAccountGetCommodity tfr-acct))
(tfr-amt (xaccSplitGetAmount tfr-split)))
(lp1 (cdr tfr-splits)
(cons (list
(qof-print-date (xaccTransGetDate lot-txn))
(let ((num (gnc-get-num-action lot-txn lot-split)))
(if (string-null? num) (_ "Payment") num))
(make-cell
(gnc:make-html-text
(gnc:html-markup-anchor
(gnc:split-anchor-text tfr-split)
(gnc:make-gnc-monetary tfr-curr tfr-amt)))))
result)))))))))))
(define (make-payment->invoices-list invoice payment-splits)
(list
@ -347,29 +355,33 @@
#f)))
payment-splits)))))
(define (make-payment->invoices-table split payment-splits currency)
(if (null? payment-splits)
(list (list (gnc:make-html-table-cell/size 1 2 (_ "Prepayments"))
(make-cell
(gnc:make-gnc-monetary
currency (- (xaccSplitGetAmount split))))))
(map
(lambda (inv-splits)
(let ((inv (car inv-splits))
(inv-split (cadr inv-splits)))
(list
(qof-print-date
(gncInvoiceGetDatePosted inv))
(gnc:make-html-text
(gnc:html-markup-anchor
(gnc:invoice-anchor-text inv)
(gnc-get-num-action
(gncInvoiceGetPostedTxn inv) #f)))
(make-cell
(gnc:make-gnc-monetary
currency
(- (xaccSplitGetAmount inv-split)))))))
payment-splits)))
(define (make-payment->invoices-table amount payment-splits currency)
(let lp ((payment-splits payment-splits)
(amount (- amount))
(result '()))
(cond
((null? payment-splits)
(reverse
(if (positive? amount)
(cons (list (gnc:make-html-table-cell/size 1 2 (_ "Prepayments"))
(make-cell (gnc:make-gnc-monetary currency amount)))
result)
result)))
(else
(let* ((payment-split (car payment-splits))
(inv (car payment-split))
(inv-split (cadr payment-split))
(inv-amount (xaccSplitGetAmount inv-split)))
(lp (cdr payment-splits)
(- amount inv-amount)
(cons (list
(qof-print-date (gncInvoiceGetDatePosted inv))
(gnc:make-html-text
(gnc:html-markup-anchor
(gnc:invoice-anchor-text inv)
(gnc-get-num-action (gncInvoiceGetPostedTxn inv) #f)))
(make-cell (gnc:make-gnc-monetary currency inv-amount)))
result)))))))
(define (split->type-str split)
(let* ((txn (xaccSplitGetParent split))
@ -382,10 +394,12 @@
(gnc:invoice-anchor-text invoice)
(gncInvoiceGetTypeString invoice))))
((txn-is-payment? txn)
(gnc:make-html-text
(gnc:html-markup-anchor
(gnc:split-anchor-text split)
(_ "Payment"))))
(apply gnc:make-html-text
(map (lambda (pmt-split)
(gnc:html-markup-anchor
(gnc:split-anchor-text pmt-split)
(_ "Payment")))
(xaccTransGetPaymentAcctSplitList txn))))
(else (_ "Unknown")))))
(define (invoice->sale invoice)
@ -493,7 +507,7 @@
((and payment-splits (eq? link-option 'simple))
(make-payment->invoices-list invoice payment-splits))
((and payment-splits (eq? link-option 'detailed))
(make-payment->invoices-table split payment-splits currency))
(make-payment->invoices-table value payment-splits currency))
;; some error occurred, show 1 line containing empty-list
(else '(()))))

@ -1540,18 +1540,9 @@ PrintAmountInternal(char *buf, gnc_numeric val, const GNCPrintAmountInfo *info)
val = gnc_numeric_convert(val, denom, GNC_HOW_RND_ROUND_HALF_UP);
value_is_decimal = gnc_numeric_to_decimal(&val, NULL);
}
/* Force at least auto_decimal_places zeros */
if (auto_decimal_enabled)
{
min_dp = MAX(auto_decimal_places, info->min_decimal_places);
max_dp = MAX(auto_decimal_places, info->max_decimal_places);
}
else
{
min_dp = info->min_decimal_places;
max_dp = info->max_decimal_places;
}
min_dp = info->min_decimal_places;
max_dp = info->max_decimal_places;
/* Don to limit the number of decimal places _UNLESS_ force_fit is
* true. */
if (!info->force_fit)

@ -25,8 +25,8 @@ msgstr ""
"Report-Msgid-Bugs-To: https://bugs.gnucash.org/enter_bug.cgi?"
"product=GnuCash&component=Translations\n"
"POT-Creation-Date: 2019-09-29 21:34+0200\n"
"PO-Revision-Date: 2019-09-29 21:44+0200\n"
"Last-Translator: Christian Stimming <christian@cstimming.de>\n"
"PO-Revision-Date: 2019-11-12 21:44+0200\n"
"Last-Translator: pianoslum <pianoslum@mailbox.org>\n"
"Language-Team: GnuCash-de <gnucash-de@gnucash.org>\n"
"Language: de\n"
"MIME-Version: 1.0\n"
@ -27429,11 +27429,11 @@ msgstr "Eine Spalte mit der Differenz zwischen Budget (Soll) und Ist anzeigen."
#: gnucash/report/standard-reports/budget.scm:58
msgid "Use accumulated amounts"
msgstr ""
msgstr "Aufsummierte Buchungen anzeigen"
#: gnucash/report/standard-reports/budget.scm:59
msgid "Values are accumulated across periods."
msgstr ""
msgstr "Werte werden über Perioden aufsummiert."
#: gnucash/report/standard-reports/budget.scm:60
msgid "Show Column with Totals"
@ -27565,7 +27565,7 @@ msgstr "Differenz"
#. of only using the budget-period amounts.
#: gnucash/report/standard-reports/budget.scm:702
msgid "using accumulated amounts"
msgstr ""
msgstr "aufsummierte Beträge verwenden"
#: gnucash/report/standard-reports/cashflow-barchart.scm:40
msgid "Cash Flow Barchart"

Loading…
Cancel
Save