mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Merge branch 'maint-owner-report-doclinks' into maint #795
This commit is contained in:
@@ -47,6 +47,7 @@
|
||||
#include "gnc-engine.h"
|
||||
#include "gnc-file.h"
|
||||
#include "gnc-hooks.h"
|
||||
#include "gncInvoice.h"
|
||||
#include "gfec.h"
|
||||
#include "gnc-main-window.h"
|
||||
#include "gnc-menu-extensions.h"
|
||||
@@ -120,6 +121,7 @@ gnc_html_register_url_cb (const char *location, const char *label,
|
||||
Split * split = NULL;
|
||||
Account * account = NULL;
|
||||
Transaction * trans;
|
||||
GncInvoice * invoice;
|
||||
GList * node;
|
||||
GncGUID guid;
|
||||
QofInstance * entity = NULL;
|
||||
@@ -180,6 +182,19 @@ gnc_html_register_url_cb (const char *location, const char *label,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
else if (strncmp ("invoice-doclink-guid=", location,
|
||||
strlen ("invoice-doclink-guid=")) == 0)
|
||||
{
|
||||
if (!validate_type("invoice-doclink-guid=", location, GNC_ID_INVOICE,
|
||||
result, &guid, &entity))
|
||||
return FALSE;
|
||||
|
||||
invoice = (GncInvoice *) entity;
|
||||
gnc_doclink_open_uri (gnc_ui_get_gtk_window (GTK_WIDGET (result->parent)),
|
||||
gncInvoiceGetDocLink (invoice));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
else if (strncmp ("split-guid=", location, strlen ("split-guid=")) == 0)
|
||||
{
|
||||
if (!validate_type("split-guid=", location, GNC_ID_SPLIT, result, &guid, &entity))
|
||||
|
||||
@@ -48,6 +48,9 @@
|
||||
(define (gnc:transaction-doclink-anchor-text trans)
|
||||
(gnc:register-guid "trans-doclink-guid=" (gncTransGetGUID trans)))
|
||||
|
||||
(define (gnc:invoice-doclink-anchor-text invoice)
|
||||
(gnc:register-guid "invoice-doclink-guid=" (gncInvoiceReturnGUID invoice)))
|
||||
|
||||
(define (gnc:report-anchor-text report-id)
|
||||
(gnc-build-url URL-TYPE-REPORT
|
||||
(string-append "id=" (number->string report-id))
|
||||
@@ -159,6 +162,11 @@
|
||||
(gnc:transaction-doclink-anchor-text trans)
|
||||
text)))
|
||||
|
||||
(define (gnc:html-invoice-doclink-anchor invoice text)
|
||||
(gnc:make-html-text (gnc:html-markup-anchor
|
||||
(gnc:invoice-doclink-anchor-text invoice)
|
||||
text)))
|
||||
|
||||
(define (gnc:html-price-anchor price value)
|
||||
(gnc:make-html-text (if price
|
||||
(gnc:html-markup-anchor
|
||||
|
||||
@@ -93,6 +93,7 @@
|
||||
(export gnc:html-split-anchor)
|
||||
(export gnc:html-transaction-anchor)
|
||||
(export gnc:html-transaction-doclink-anchor)
|
||||
(export gnc:html-invoice-doclink-anchor)
|
||||
(export gnc:html-price-anchor)
|
||||
(export gnc:customer-anchor-text)
|
||||
(export gnc:job-anchor-text)
|
||||
|
||||
@@ -56,7 +56,8 @@
|
||||
(define credit-header (N_ "Credits"))
|
||||
(define debit-header (N_ "Debits"))
|
||||
(define balance-header (N_ "Balance"))
|
||||
(define linked-txns-header (N_ "Links"))
|
||||
(define doclink-header (N_ "Document Links"))
|
||||
(define linked-txns-header (N_ "Transaction Links"))
|
||||
|
||||
(define javascript "
|
||||
<script>
|
||||
@@ -162,6 +163,8 @@
|
||||
(vector-ref columns-used 8))
|
||||
(define (bal-col columns-used)
|
||||
(vector-ref columns-used 9))
|
||||
(define (doclink-col columns-used)
|
||||
(vector-ref columns-used 10))
|
||||
|
||||
(define (num-cols columns-used section)
|
||||
(let* ((date? (date-col columns-used))
|
||||
@@ -174,12 +177,14 @@
|
||||
(credit? (credit-col columns-used))
|
||||
(debit? (debit-col columns-used))
|
||||
(bal? (bal-col columns-used))
|
||||
(doclink? (doclink-col columns-used))
|
||||
(spacer? (or date? type? ref? desc? debit? credit?))
|
||||
(amt? (or credit? debit?))
|
||||
(cols-alist
|
||||
(list
|
||||
(list 'lhs-cols date? due? ref? type? desc? sale? tax? credit? debit? bal?)
|
||||
(list 'ptt-span date? due? ref? type? desc?)
|
||||
(list 'lhs-cols date? due? ref? type? desc? sale? tax? credit? debit? bal?
|
||||
doclink?)
|
||||
(list 'ptt-span date? due? ref? type? desc? doclink?)
|
||||
(list 'mid-spac spacer?)
|
||||
(list 'rhs-cols date? ref? type? desc? amt? amt?)
|
||||
(list 'rhs-span date? ref? type? desc?)))
|
||||
@@ -194,7 +199,7 @@
|
||||
(map opt-val
|
||||
(list date-header due-date-header reference-header type-header
|
||||
desc-header sale-header tax-header debit-header credit-header
|
||||
balance-header))))
|
||||
balance-header doclink-header))))
|
||||
|
||||
(define (make-heading-list column-vector link-option acct-type)
|
||||
(let ((heading-list '())
|
||||
@@ -210,6 +215,8 @@
|
||||
(addto! heading-list (G_ type-header)))
|
||||
(if (desc-col column-vector)
|
||||
(addto! heading-list (G_ desc-header)))
|
||||
(if (doclink-col column-vector)
|
||||
(addto! heading-list (C_ "Column header for 'Document Link'" "L")))
|
||||
(if (sale-col column-vector)
|
||||
(addto! heading-list (G_ sale-header)))
|
||||
(if (tax-col column-vector)
|
||||
@@ -340,7 +347,7 @@
|
||||
;; Make a row list based on the visible columns
|
||||
;;
|
||||
(define (add-row table odd-row? column-vector date due-date ref type-str
|
||||
desc currency amt debit credit sale tax lhs-class
|
||||
desc doclink-invoice currency amt debit credit sale tax lhs-class
|
||||
link-option link-rows)
|
||||
(define nrows (if link-rows (length link-rows) 1))
|
||||
(define (link-data->cols link-data)
|
||||
@@ -431,7 +438,12 @@
|
||||
(and due-date (qof-print-date due-date)))
|
||||
(addif (ref-col column-vector) ref)
|
||||
(addif (type-col column-vector) type-str)
|
||||
(addif (desc-col column-vector) desc)))
|
||||
(addif (desc-col column-vector) desc)
|
||||
(addif (doclink-col column-vector)
|
||||
(and doclink-invoice
|
||||
(gnc:html-invoice-doclink-anchor
|
||||
doclink-invoice
|
||||
(C_ "Column header for 'Document Link'" "L"))))))
|
||||
(map
|
||||
(lambda (str)
|
||||
(let ((cell (gnc:make-html-table-cell/size/markup
|
||||
@@ -543,7 +555,7 @@
|
||||
payable? date-type currency)))))
|
||||
|
||||
(define (add-balance-row odd-row? total)
|
||||
(add-row table odd-row? used-columns start-date #f "" (G_ "Balance") ""
|
||||
(add-row table odd-row? used-columns start-date #f "" (G_ "Balance") "" #f
|
||||
currency total #f #f #f #f #f
|
||||
link-option (case link-option
|
||||
((none) '(()))
|
||||
@@ -796,6 +808,7 @@
|
||||
(split->reference split)
|
||||
(split->type-str split payable?)
|
||||
(splits->desc (list split))
|
||||
(and (not (string-null? (gncInvoiceGetDocLink invoice))) invoice)
|
||||
currency (+ total value)
|
||||
(and (>= orig-value 0) (amount->anchor split orig-value))
|
||||
(and (< orig-value 0) (amount->anchor split (- orig-value)))
|
||||
@@ -825,7 +838,7 @@
|
||||
(split->reference split)
|
||||
(split->type-str split payable?)
|
||||
(splits->desc (xaccTransGetAPARAcctSplitList txn #t))
|
||||
currency (+ total value)
|
||||
#f currency (+ total value)
|
||||
(and (>= orig-value 0) (amount->anchor split orig-value))
|
||||
(and (< orig-value 0) (amount->anchor split (- orig-value)))
|
||||
#f #f
|
||||
@@ -929,6 +942,11 @@
|
||||
(N_ "Invoices show list of payments, payments show list of \
|
||||
invoices and amounts.")))))
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(N_ "Display Columns") doclink-header
|
||||
"hd" (N_ "Display document link?") #f))
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-multichoice-option
|
||||
gnc:pagename-general optname-date-driver "k"
|
||||
|
||||
@@ -1681,6 +1681,9 @@ the option '~a'."))
|
||||
("Void Transactions" "Filter" "Void Transactions")
|
||||
("Account Substring" "Filter" "Account Name Filter")
|
||||
("Enable links" #f "Enable Links")
|
||||
;; new-owner-report.scm, renamed Oct 2020 to differentiate with
|
||||
;; Document Links:
|
||||
("Links" #f "Transaction Links")
|
||||
;; invoice.scm, renamed November 2018
|
||||
("Individual Taxes" #f "Use Detailed Tax Summary")
|
||||
;; income-gst-statement.scm
|
||||
|
||||
Reference in New Issue
Block a user