Created
April 19, 2011 20:28
-
-
Save anonymous/929551 to your computer and use it in GitHub Desktop.
Fix GnuCash Quarters for German Tax Reports
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/report/locale-specific/us/taxtxf-de_DE.scm b/src/report/locale-specific/us/taxtxf-de_DE.scm | |
index 101a187..f549a0c 100644 | |
--- a/src/report/locale-specific/us/taxtxf-de_DE.scm | |
+++ b/src/report/locale-specific/us/taxtxf-de_DE.scm | |
@@ -137,14 +137,11 @@ | |
(list->vector | |
(list '1st-est (N_ "1st Est Tax Quarter") (N_ "Jan 1 - Mar 31"))) | |
(list->vector | |
- (list '2nd-est (N_ "2nd Est Tax Quarter") (N_ "Apr 1 - May 31"))) | |
+ (list '2nd-est (N_ "2nd Est Tax Quarter") (N_ "Apr 1 - Jun 31"))) | |
(list->vector | |
- ;; Translators: The US tax quarters are different from | |
- ;; actual year's quarters! See the definition of | |
- ;; tax-qtr-real-qtr-year variable above. | |
- (list '3rd-est (N_ "3rd Est Tax Quarter") (N_ "Jun 1 - Aug 31"))) | |
+ (list '3rd-est (N_ "3rd Est Tax Quarter") (N_ "Jul 1 - Sep 31"))) | |
(list->vector | |
- (list '4th-est (N_ "4th Est Tax Quarter") (N_ "Sep 1 - Dec 31"))) | |
+ (list '4th-est (N_ "4th Est Tax Quarter") (N_ "Oct 1 - Dec 31"))) | |
(list->vector | |
(list 'last-year (N_ "Last Year") (N_ "Last Year"))) | |
(list->vector | |
@@ -152,13 +149,13 @@ | |
(N_ "Jan 1 - Mar 31, Last year"))) | |
(list->vector | |
(list '2nd-last (N_ "Last Yr 2nd Est Tax Qtr") | |
- (N_ "Apr 1 - May 31, Last year"))) | |
+ (N_ "Apr 1 - Jun 31, Last year"))) | |
(list->vector | |
(list '3rd-last (N_ "Last Yr 3rd Est Tax Qtr") | |
- (N_ "Jun 1 - Aug 31, Last year"))) | |
+ (N_ "Jul 1 - Sep 31, Last year"))) | |
(list->vector | |
(list '4th-last (N_ "Last Yr 4th Est Tax Qtr") | |
- (N_ "Sep 1 - Dec 31, Last year")))))) | |
+ (N_ "Oct 1 - Dec 31, Last year")))))) | |
(gnc:register-tax-option | |
(gnc:make-account-list-option | |
@@ -204,6 +201,10 @@ | |
(let ((code (xaccAccountGetTaxUSCode account))) | |
(string->symbol (if (string-null? code) "N000" code)))) | |
+(define (gnc:account-is-inc-exp-ass-lia? account) | |
+ (let ((type (xaccAccountGetType account))) | |
+ (member type (list ACCT-TYPE-INCOME ACCT-TYPE-EXPENSE ACCT-TYPE-ASSET ACCT-TYPE-LIABILITY)))) | |
+ | |
(define (gnc:get-txf-format code income?) | |
(gnc:txf-get-format (if income? | |
txf-income-categories | |
@@ -502,27 +503,15 @@ | |
3rd-last 4th-last)) | |
(set-tm:year bdtm (- (tm:year bdtm) 1))) | |
(set-tm:mday bdtm 1) | |
- (if (< (gnc:date-get-year bdtm) | |
- tax-qtr-real-qtr-year) | |
- (case alt-period | |
- ((1st-est 1st-last last-year) ; Jan 1 | |
- (set-tm:mon bdtm 0)) | |
- ((2nd-est 2nd-last) ; Apr 1 | |
- (set-tm:mon bdtm 3)) | |
- ((3rd-est 3rd-last) ; Jun 1 | |
- (set-tm:mon bdtm 5)) | |
- ((4th-est 4th-last) ; Sep 1 | |
- (set-tm:mon bdtm 8))) | |
- ;; Tax quaters equal Real quarters | |
- (case alt-period | |
- ((1st-est 1st-last last-year) ; Jan 1 | |
- (set-tm:mon bdtm 0)) | |
- ((2nd-est 2nd-last) ; Apr 1 | |
- (set-tm:mon bdtm 3)) | |
- ((3rd-est 3rd-last) ; Jul 1 | |
- (set-tm:mon bdtm 6)) | |
- ((4th-est 4th-last) ; Oct 1 | |
- (set-tm:mon bdtm 9)))) | |
+ (case alt-period | |
+ ((1st-est 1st-last last-year) ; Jan 1 | |
+ (set-tm:mon bdtm 0)) | |
+ ((2nd-est 2nd-last) ; Apr 1 | |
+ (set-tm:mon bdtm 3)) | |
+ ((3rd-est 3rd-last) ; Jul 1 | |
+ (set-tm:mon bdtm 6)) | |
+ ((4th-est 4th-last) ; Oct 1 | |
+ (set-tm:mon bdtm 9))) | |
(set-tm:isdst bdtm -1) | |
(cons (car (mktime bdtm)) 0)))) | |
@@ -541,31 +530,20 @@ | |
3rd-last 4th-last)) | |
(set-tm:year bdtm (+ (tm:year bdtm) 1))) | |
(set-tm:mday bdtm 31) | |
- (if (< (gnc:date-get-year bdtm) tax-qtr-real-qtr-year) | |
- (case alt-period | |
- ((1st-est 1st-last) ; Mar 31 | |
- (set-tm:mon bdtm 2)) | |
- ((2nd-est 2nd-last) ; May 31 | |
- (set-tm:mon bdtm 4)) | |
- ((3rd-est 3rd-last) ; Aug 31 | |
- (set-tm:mon bdtm 7)) | |
- ((4th-est 4th-last last-year) ; Dec 31 | |
- (set-tm:mon bdtm 11)) | |
- (else (set! bdtm (gnc:timepair->date to-value)))) | |
- ;; Tax quaters equal Real quarters | |
- (case alt-period | |
- ((1st-est 1st-last) ; Mar 31 | |
- (set-tm:mon bdtm 2)) | |
- ((2nd-est 2nd-last) ; Jun 30 | |
- (set-tm:mday bdtm 30) | |
- (set-tm:mon bdtm 5)) | |
- ((3rd-est 3rd-last) ; Sep 30 | |
- (set-tm:mday bdtm 30) | |
- (set-tm:mon bdtm 8)) | |
- ((4th-est 4th-last last-year) ; Dec 31 | |
- (set-tm:mon bdtm 11)) | |
- (else | |
- (set! bdtm (gnc:timepair->date to-value))))) | |
+ ;; Tax quaters equal Real quarters | |
+ (case alt-period | |
+ ((1st-est 1st-last) ; Mar 31 | |
+ (set-tm:mon bdtm 2)) | |
+ ((2nd-est 2nd-last) ; Jun 30 | |
+ (set-tm:mday bdtm 30) | |
+ (set-tm:mon bdtm 5)) | |
+ ((3rd-est 3rd-last) ; Sep 30 | |
+ (set-tm:mday bdtm 30) | |
+ (set-tm:mon bdtm 8)) | |
+ ((4th-est 4th-last last-year) ; Dec 31 | |
+ (set-tm:mon bdtm 11)) | |
+ (else | |
+ (set! bdtm (gnc:timepair->date to-value)))) | |
(set-tm:isdst bdtm -1) | |
(cons (car (mktime bdtm)) 0)))) | |
@@ -642,7 +620,7 @@ | |
(if (< level max-level) | |
(let ((sum 0)) | |
(for-each (lambda (x) | |
- (if (gnc:account-is-inc-exp? x) | |
+ (if (gnc:account-is-inc-exp-ass-lia? x) | |
(set! sum (+ sum (+ 1 (count-accounts (+ 1 level) | |
(gnc-account-get-children x))))) | |
0)) | |
@@ -656,7 +634,7 @@ | |
(gnc:report-percent-done (* 100 (if (> work-to-do 0) | |
(/ work-done work-to-do) | |
1))) | |
- (if (gnc:account-is-inc-exp? account) | |
+ (if (gnc:account-is-inc-exp-ass-lia? account) | |
(let* ((children (gnc-account-get-children-sorted account)) | |
(to-special #f) ; clear special-splits-period | |
(from-special #f) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment