mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Merge branch 'maint-797852-bis' into maint #776
This commit is contained in:
commit
98c8b23351
@ -213,7 +213,7 @@ ownerreportCB (const char *location, const char *label,
|
||||
GncOwner owner;
|
||||
Account *acc;
|
||||
GHashTable *query_ht;
|
||||
time64 enddate;
|
||||
time64 enddate = INT64_MAX;
|
||||
gboolean show_report = TRUE;
|
||||
|
||||
g_return_val_if_fail (location != NULL, FALSE);
|
||||
@ -293,7 +293,13 @@ ownerreportCB (const char *location, const char *label,
|
||||
|
||||
/* Ok, let's run this report */
|
||||
if (show_report)
|
||||
{
|
||||
if (enddate != INT64_MAX)
|
||||
gnc_business_call_owner_report_with_enddate (result->parent, &owner,
|
||||
acc, enddate);
|
||||
else
|
||||
gnc_business_call_owner_report (result->parent, &owner, acc);
|
||||
}
|
||||
|
||||
g_hash_table_destroy (query_ht);
|
||||
return show_report;
|
||||
|
@ -1161,6 +1161,14 @@ void gnc_invoice_window_new_invoice_cb (GtkWindow *parent, gpointer data)
|
||||
}
|
||||
|
||||
void gnc_business_call_owner_report (GtkWindow *parent, GncOwner *owner, Account *acc)
|
||||
{
|
||||
gnc_business_call_owner_report_with_enddate (parent, owner, acc, INT64_MAX);
|
||||
}
|
||||
|
||||
void gnc_business_call_owner_report_with_enddate (GtkWindow *parent,
|
||||
GncOwner *owner,
|
||||
Account *acc,
|
||||
time64 enddate)
|
||||
{
|
||||
int id;
|
||||
SCM args;
|
||||
@ -1171,9 +1179,13 @@ void gnc_business_call_owner_report (GtkWindow *parent, GncOwner *owner, Account
|
||||
|
||||
args = SCM_EOL;
|
||||
|
||||
func = scm_c_eval_string ("gnc:owner-report-create");
|
||||
func = scm_c_eval_string ("gnc:owner-report-create-with-enddate");
|
||||
g_return_if_fail (scm_is_procedure (func));
|
||||
|
||||
/* set the enddate */
|
||||
arg = (enddate != INT64_MAX) ? scm_from_int64 (enddate) : SCM_BOOL_F;
|
||||
args = scm_cons (arg, args);
|
||||
|
||||
if (acc)
|
||||
{
|
||||
swig_type_info * qtype = SWIG_TypeQuery("_p_Account");
|
||||
|
@ -67,6 +67,11 @@ GNCSearchWindow * gnc_invoice_search (GtkWindow *parent, GncInvoice *start, GncO
|
||||
|
||||
void gnc_business_call_owner_report (GtkWindow* parent, GncOwner *owner, Account *acc);
|
||||
|
||||
void gnc_business_call_owner_report_with_enddate (GtkWindow* parent,
|
||||
GncOwner *owner,
|
||||
Account *acc,
|
||||
time64 enddate);
|
||||
|
||||
void gnc_invoice_window_sort (InvoiceWindow *iw, invoice_sort_type_t sort_code);
|
||||
|
||||
GtkWidget * gnc_invoice_window_create_summary_bar (InvoiceWindow *iw);
|
||||
|
@ -94,7 +94,7 @@
|
||||
(else
|
||||
""))))
|
||||
|
||||
(define (gnc:owner-report-text owner acc)
|
||||
(define* (gnc:owner-report-text owner acc #:optional date)
|
||||
(let* ((end-owner (gncOwnerGetEndOwner owner))
|
||||
(type (gncOwnerGetType end-owner)))
|
||||
(gnc-build-url
|
||||
@ -105,6 +105,7 @@
|
||||
((eqv? type GNC-OWNER-EMPLOYEE) "owner=e:")
|
||||
(else "unknown-type="))
|
||||
(gncOwnerReturnGUID end-owner)
|
||||
(if date (format #f "&enddate=~a" date) "")
|
||||
(if (null? acc) "" (string-append "&acct=" (gncAccountGetGUID acc))))
|
||||
"")))
|
||||
|
||||
|
@ -908,7 +908,13 @@
|
||||
(let* ((invoice (gncInvoiceGetInvoiceFromTxn
|
||||
(xaccSplitGetParent (car splits))))
|
||||
(lot (gncInvoiceGetPostedLot invoice))
|
||||
(bal (gnc-lot-get-balance lot))
|
||||
(lot-splits (gnc-lot-get-split-list lot))
|
||||
(bal (fold
|
||||
(lambda (a b)
|
||||
(if (<= (xaccTransGetDate (xaccSplitGetParent a)) to-date)
|
||||
(+ (xaccSplitGetAmount a) b)
|
||||
b))
|
||||
0 lot-splits))
|
||||
(bal (if receivable? bal (- bal)))
|
||||
(date (if (eq? date-type 'postdate)
|
||||
(gncInvoiceGetDatePosted invoice)
|
||||
|
@ -807,7 +807,7 @@ copying this report to a spreadsheet for use in a mail merge.")
|
||||
(cons
|
||||
(gnc:make-html-text
|
||||
(gnc:html-markup-anchor
|
||||
(gnc:owner-report-text owner account)
|
||||
(gnc:owner-report-text owner account report-date)
|
||||
total))
|
||||
rest))))
|
||||
|
||||
|
@ -38,6 +38,7 @@
|
||||
(export gnc:payables-report-create)
|
||||
(export gnc:receivables-report-create)
|
||||
(export gnc:owner-report-create)
|
||||
(export gnc:owner-report-create-with-enddate)
|
||||
|
||||
(define report-dirs (list
|
||||
'(gnucash reports standard) ; prefix for standard reports included in gnucash
|
||||
@ -48,7 +49,8 @@
|
||||
; and then load all reports found in the given prefixes
|
||||
(let* ((loc (gnc-locale-name))
|
||||
(loc-spec (if (string-prefix? "de_DE" loc) 'de_DE 'us))
|
||||
(all-dirs (append report-dirs (list (list 'gnucash 'reports 'locale-specific loc-spec)))))
|
||||
(all-dirs (append report-dirs
|
||||
`((gnucash reports locale-specific ,loc-spec)))))
|
||||
(report-module-loader all-dirs))
|
||||
|
||||
(use-modules (gnucash engine))
|
||||
@ -86,3 +88,4 @@
|
||||
|
||||
(use-modules (gnucash reports standard new-owner-report))
|
||||
(define gnc:owner-report-create owner-report-create)
|
||||
(define gnc:owner-report-create-with-enddate owner-report-create-with-enddate)
|
||||
|
@ -230,7 +230,9 @@ exist but have no suitable transactions."))
|
||||
(else (op-num (car aging1) (car aging2)))))))))
|
||||
|
||||
;; set default title
|
||||
(gnc:html-document-set-title! document report-title)
|
||||
(gnc:html-document-set-title!
|
||||
document
|
||||
(format #f "~a - ~a" report-title (qof-print-date report-date)))
|
||||
|
||||
(cond
|
||||
((null? accounts)
|
||||
@ -309,7 +311,7 @@ exist but have no suitable transactions."))
|
||||
"number-cell"
|
||||
(gnc:make-html-text
|
||||
(gnc:html-markup-anchor
|
||||
(gnc:owner-report-text owner account)
|
||||
(gnc:owner-report-text owner account report-date)
|
||||
(gnc:make-gnc-monetary comm aging-total)))))
|
||||
(options->address options receivable owner)))))
|
||||
(sort owners-and-aging sort-aging<?))
|
||||
|
@ -29,6 +29,7 @@
|
||||
(define-module (gnucash reports standard new-owner-report))
|
||||
|
||||
(use-modules (srfi srfi-1))
|
||||
(use-modules (srfi srfi-2))
|
||||
(use-modules (srfi srfi-8))
|
||||
(use-modules (srfi srfi-9))
|
||||
(use-modules (srfi srfi-11)) ;for let-values
|
||||
@ -1193,28 +1194,28 @@ invoices and amounts.")))))
|
||||
'in-menu? #t)
|
||||
|
||||
|
||||
(define (owner-report-create-internal report-guid owner owner-type)
|
||||
(define (owner-report-create-internal report-guid owner owner-type enddate)
|
||||
(let* ((options (gnc:make-report-options report-guid))
|
||||
(owner-op (gnc:lookup-option options owner-page (owner-string owner-type))))
|
||||
(owner-op (gnc:lookup-option options owner-page (owner-string owner-type)))
|
||||
(date-op (gnc:lookup-option options gnc:pagename-general optname-to-date)))
|
||||
|
||||
(gnc:option-set-value owner-op owner)
|
||||
(when enddate
|
||||
(gnc:option-set-value date-op (cons 'absolute enddate)))
|
||||
(gnc:make-report report-guid options)))
|
||||
|
||||
(define (owner-report-create owner account)
|
||||
(define (owner-report-create-with-enddate owner account enddate)
|
||||
;; note account isn't actually used
|
||||
(let ((type (gncOwnerGetType (gncOwnerGetEndOwner owner))))
|
||||
(cond
|
||||
((eqv? type GNC-OWNER-CUSTOMER)
|
||||
;; Not sure whether to pass type, or to use the guid in the report function
|
||||
(owner-report-create-internal customer-report-guid owner type))
|
||||
(define guid-alist
|
||||
(list (cons GNC-OWNER-CUSTOMER customer-report-guid)
|
||||
(cons GNC-OWNER-VENDOR vendor-report-guid)
|
||||
(cons GNC-OWNER-EMPLOYEE employee-report-guid)))
|
||||
(and-let* ((type (gncOwnerGetType (gncOwnerGetEndOwner owner)))
|
||||
(guid (assv-ref guid-alist type)))
|
||||
(owner-report-create-internal guid owner type enddate)))
|
||||
|
||||
((eqv? type GNC-OWNER-VENDOR)
|
||||
(owner-report-create-internal vendor-report-guid owner type))
|
||||
|
||||
((eqv? type GNC-OWNER-EMPLOYEE)
|
||||
(owner-report-create-internal employee-report-guid owner type))
|
||||
|
||||
(else #f))))
|
||||
(define (owner-report-create owner account)
|
||||
(owner-report-create-with-enddate owner account #f))
|
||||
|
||||
(define (gnc:owner-report-create-internal
|
||||
account split query journal? double? title debit-string credit-string)
|
||||
@ -1229,3 +1230,4 @@ invoices and amounts.")))))
|
||||
(gnc:register-report-hook ACCT-TYPE-RECEIVABLE #t gnc:owner-report-create-internal)
|
||||
(gnc:register-report-hook ACCT-TYPE-PAYABLE #t gnc:owner-report-create-internal)
|
||||
(export owner-report-create)
|
||||
(export owner-report-create-with-enddate)
|
||||
|
Loading…
Reference in New Issue
Block a user