mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
[taxtxf] compact get-acct-tax-info
This commit is contained in:
parent
7345a4adfa
commit
101f840255
@ -298,94 +298,34 @@
|
||||
(string->symbol (if (string-null? code) "N000" code))))
|
||||
|
||||
(define (get-acct-txf-info info-type acct-type code)
|
||||
(let ((tax-entity-type (gnc-get-current-book-tax-type)))
|
||||
(cond
|
||||
((= acct-type ACCT-TYPE-INCOME)
|
||||
(cond
|
||||
((eqv? info-type 'form)
|
||||
(gnc:txf-get-form txf-income-categories code tax-entity-type))
|
||||
((eqv? info-type 'desc)
|
||||
(gnc:txf-get-description txf-income-categories code tax-entity-type))
|
||||
((eqv? info-type 'pns)
|
||||
(gnc:txf-get-payer-name-source txf-income-categories code
|
||||
tax-entity-type))
|
||||
((eqv? info-type 'format)
|
||||
(gnc:txf-get-format txf-income-categories code tax-entity-type))
|
||||
((eqv? info-type 'multiple)
|
||||
(gnc:txf-get-multiple txf-income-categories code tax-entity-type))
|
||||
((eqv? info-type 'cat-key)
|
||||
(gnc:txf-get-category-key txf-income-categories code tax-entity-type))
|
||||
((eqv? info-type 'line)
|
||||
(gnc:txf-get-line-data txf-income-categories code tax-entity-type))
|
||||
((eqv? info-type 'last-yr)
|
||||
(gnc:txf-get-last-year txf-income-categories code tax-entity-type))
|
||||
(else #f)))
|
||||
((= acct-type ACCT-TYPE-EXPENSE)
|
||||
(cond
|
||||
((eqv? info-type 'form)
|
||||
(gnc:txf-get-form txf-expense-categories code tax-entity-type))
|
||||
((eqv? info-type 'desc)
|
||||
(gnc:txf-get-description txf-expense-categories code tax-entity-type))
|
||||
((eqv? info-type 'pns)
|
||||
(gnc:txf-get-payer-name-source txf-expense-categories code
|
||||
tax-entity-type))
|
||||
((eqv? info-type 'format)
|
||||
(gnc:txf-get-format txf-expense-categories code tax-entity-type))
|
||||
((eqv? info-type 'multiple)
|
||||
(gnc:txf-get-multiple txf-expense-categories code tax-entity-type))
|
||||
((eqv? info-type 'cat-key)
|
||||
(gnc:txf-get-category-key txf-expense-categories code tax-entity-type))
|
||||
((eqv? info-type 'line)
|
||||
(gnc:txf-get-line-data txf-expense-categories code tax-entity-type))
|
||||
((eqv? info-type 'last-yr)
|
||||
(gnc:txf-get-last-year txf-expense-categories code tax-entity-type))
|
||||
(else #f)))
|
||||
((or (= acct-type ACCT-TYPE-BANK) (= acct-type ACCT-TYPE-CASH)
|
||||
(= acct-type ACCT-TYPE-ASSET) (= acct-type ACCT-TYPE-STOCK)
|
||||
(= acct-type ACCT-TYPE-MUTUAL) (= acct-type ACCT-TYPE-RECEIVABLE))
|
||||
(cond
|
||||
((eqv? info-type 'form)
|
||||
(gnc:txf-get-form txf-asset-categories code tax-entity-type))
|
||||
((eqv? info-type 'desc)
|
||||
(gnc:txf-get-description txf-asset-categories code tax-entity-type))
|
||||
((eqv? info-type 'pns)
|
||||
(gnc:txf-get-payer-name-source txf-asset-categories code
|
||||
tax-entity-type))
|
||||
((eqv? info-type 'format)
|
||||
(gnc:txf-get-format txf-asset-categories code tax-entity-type))
|
||||
((eqv? info-type 'multiple)
|
||||
(gnc:txf-get-multiple txf-asset-categories code tax-entity-type))
|
||||
((eqv? info-type 'cat-key)
|
||||
(gnc:txf-get-category-key txf-asset-categories code tax-entity-type))
|
||||
((eqv? info-type 'line)
|
||||
(gnc:txf-get-line-data txf-asset-categories code tax-entity-type))
|
||||
((eqv? info-type 'last-yr)
|
||||
(gnc:txf-get-last-year txf-asset-categories code tax-entity-type))
|
||||
(else #f)))
|
||||
((or (= acct-type ACCT-TYPE-CREDIT) (= acct-type ACCT-TYPE-LIABILITY)
|
||||
(= acct-type ACCT-TYPE-EQUITY) (= acct-type ACCT-TYPE-PAYABLE))
|
||||
(cond
|
||||
((eqv? info-type 'form)
|
||||
(gnc:txf-get-form txf-liab-eq-categories code tax-entity-type))
|
||||
((eqv? info-type 'desc)
|
||||
(gnc:txf-get-description txf-liab-eq-categories code tax-entity-type))
|
||||
((eqv? info-type 'pns)
|
||||
(gnc:txf-get-payer-name-source txf-liab-eq-categories code
|
||||
tax-entity-type))
|
||||
((eqv? info-type 'format)
|
||||
(gnc:txf-get-format txf-liab-eq-categories code tax-entity-type))
|
||||
((eqv? info-type 'multiple)
|
||||
(gnc:txf-get-multiple txf-liab-eq-categories code tax-entity-type))
|
||||
((eqv? info-type 'cat-key)
|
||||
(gnc:txf-get-category-key txf-liab-eq-categories code tax-entity-type))
|
||||
((eqv? info-type 'line)
|
||||
(gnc:txf-get-line-data txf-liab-eq-categories code tax-entity-type))
|
||||
((eqv? info-type 'last-yr)
|
||||
(gnc:txf-get-last-year txf-liab-eq-categories code tax-entity-type))
|
||||
(else #f)))
|
||||
(else #f))
|
||||
)
|
||||
)
|
||||
(let ((categories (assv-ref
|
||||
(list (cons ACCT-TYPE-INCOME txf-income-categories)
|
||||
(cons ACCT-TYPE-EXPENSE txf-expense-categories)
|
||||
(cons ACCT-TYPE-BANK txf-asset-categories)
|
||||
(cons ACCT-TYPE-CASH txf-asset-categories)
|
||||
(cons ACCT-TYPE-ASSET txf-asset-categories)
|
||||
(cons ACCT-TYPE-STOCK txf-asset-categories)
|
||||
(cons ACCT-TYPE-MUTUAL txf-asset-categories)
|
||||
(cons ACCT-TYPE-RECEIVABLE txf-asset-categories)
|
||||
(cons ACCT-TYPE-CREDIT txf-liab-eq-categories)
|
||||
(cons ACCT-TYPE-LIABILITY txf-liab-eq-categories)
|
||||
(cons ACCT-TYPE-EQUITY txf-liab-eq-categories)
|
||||
(cons ACCT-TYPE-PAYABLE txf-liab-eq-categories))
|
||||
acct-type))
|
||||
(get-info-fn
|
||||
(case info-type
|
||||
((form) gnc:txf-get-form)
|
||||
((desc) gnc:txf-get-description)
|
||||
((pns) gnc:txf-get-payer-name-sourcecategories)
|
||||
((format) gnc:txf-get-formatcategories)
|
||||
((multiple) gnc:txf-get-multiplecategories)
|
||||
((cat-key) gnc:txf-get-category-keycategories)
|
||||
((line) gnc:txf-get-line-datacategories)
|
||||
((last-yr) gnc:txf-get-last-yearcategories)
|
||||
(else #f))))
|
||||
(and categories
|
||||
get-info-fn
|
||||
(get-info-fn categories code (gnc-get-current-book-tax-type)))))
|
||||
|
||||
(define (gnc:account-get-txf-payer-source account)
|
||||
(let ((pns (xaccAccountGetTaxUSPayerNameSource account)))
|
||||
|
Loading…
Reference in New Issue
Block a user