mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
[taxtxf] set export-string for export-type='csv
This commit is contained in:
parent
0891e117c9
commit
b0ab79bed7
@ -2899,69 +2899,32 @@
|
|||||||
))
|
))
|
||||||
|
|
||||||
(if (not tax-mode?) ; Do Txf mode
|
(if (not tax-mode?) ; Do Txf mode
|
||||||
(if tax-entity-type-valid?
|
(begin
|
||||||
(if file-name ; cancel TXF if no file selected
|
(if tax-entity-type-valid?
|
||||||
(let ((port (catch #t ;;e.g., system-error
|
(gnc:html-document-set-export-string
|
||||||
(lambda () (open-output-file file-name))
|
doc
|
||||||
(lambda (key . args)
|
(call-with-output-string
|
||||||
(let ((msg (format #f "Could not open the file: ~a. The error is: ~a - ~a"
|
(lambda (port)
|
||||||
file-name key (caaddr args))))
|
(gnc:display-report-list-item
|
||||||
(gnc:gui-error msg msg)
|
(list
|
||||||
#f)))))
|
"V042" crlf "AGnuCash " gnc:version crlf
|
||||||
(if port ;; port opened successfully
|
today-date crlf "^" crlf
|
||||||
(let* ((output (map (lambda (form-line-acct)
|
(map handle-tax-code selected-accounts-sorted-by-form-line-acct)
|
||||||
(handle-tax-code form-line-acct))
|
(if (or (zero? tax-code-USD-total) (not prior-account))
|
||||||
selected-accounts-sorted-by-form-line-acct))
|
'()
|
||||||
(output-txf
|
(render-txf-account
|
||||||
(list
|
prior-account
|
||||||
"V042" crlf
|
(if (= 4 (get-acct-txf-info
|
||||||
"AGnuCash " gnc:version crlf
|
'format (xaccAccountGetType prior-account)
|
||||||
today-date crlf
|
(gnc:account-get-txf-code prior-account)))
|
||||||
"^" crlf
|
(- tax-code-cap-gain-sales-USD-total)
|
||||||
output
|
tax-code-USD-total-as-dr)
|
||||||
(if (or
|
#f #f #f #f (xaccAccountGetType prior-account)
|
||||||
(gnc-numeric-zero-p tax-code-USD-total)
|
(gnc:account-get-txf-code prior-account)
|
||||||
(not prior-account))
|
prior-account-copy tax-entity-type #f)))
|
||||||
'()
|
port "taxtxf.scm - "))))
|
||||||
(render-txf-account
|
(gnc:html-document-set-export-error doc "tax-entity-type is invalid"))
|
||||||
prior-account
|
doc)
|
||||||
(if (= 4 (get-acct-txf-info
|
|
||||||
'format
|
|
||||||
(xaccAccountGetType
|
|
||||||
prior-account)
|
|
||||||
(gnc:account-get-txf-code
|
|
||||||
prior-account)))
|
|
||||||
(gnc-numeric-neg
|
|
||||||
tax-code-cap-gain-sales-USD-total)
|
|
||||||
tax-code-USD-total-as-dr)
|
|
||||||
#f #f #f #f
|
|
||||||
(xaccAccountGetType prior-account)
|
|
||||||
(gnc:account-get-txf-code
|
|
||||||
prior-account)
|
|
||||||
prior-account-copy
|
|
||||||
tax-entity-type #f))
|
|
||||||
))
|
|
||||||
)
|
|
||||||
;; prior-account can be #f if selected accounts are
|
|
||||||
;; marked as 'tax-related' in the account edit
|
|
||||||
;; dialog but not actually assigned to a tax code
|
|
||||||
;; using the 'Tax Options' dialog (UI bug?).
|
|
||||||
;; An empty file is unfortunately put out with
|
|
||||||
;; no user warning other than message on report.
|
|
||||||
(if prior-account
|
|
||||||
(gnc:display-report-list-item output-txf port
|
|
||||||
"taxtxf.scm - ")
|
|
||||||
#f)
|
|
||||||
(close-output-port port)
|
|
||||||
#t
|
|
||||||
) ; end of let
|
|
||||||
;; Could not open port successfully
|
|
||||||
#t ;; to prevent 2nd error dialog in
|
|
||||||
;; gnc_plugin_page_report_export_cb
|
|
||||||
) ;; end of if
|
|
||||||
) ;; end of let*
|
|
||||||
#f) ;;end of if
|
|
||||||
#f) ;;end of if
|
|
||||||
(begin ; else do tax report
|
(begin ; else do tax report
|
||||||
(gnc:html-document-set-style!
|
(gnc:html-document-set-style!
|
||||||
doc "header-just-top"
|
doc "header-just-top"
|
||||||
|
Loading…
Reference in New Issue
Block a user