/
general-ledger.scm
162 lines (141 loc) · 5.56 KB
/
general-ledger.scm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; general-ledger.scm: general ledger report
;;
;; By David Montenegro <sunrise2000@comcast.net> 2004.07.13
;;
;; * BUGS:
;;
;; See any "FIXME"s in the code.
;;
;; Largely borrowed from welcome-to-gnucash.scm by
;; Bill Gribble <grib@gnumatic.com>
;;
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;; published by the Free Software Foundation; either version 2 of
;; the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, contact:
;;
;; Free Software Foundation Voice: +1-617-542-5942
;; 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
;; Boston, MA 02110-1301, USA gnu@gnu.org
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define-module (gnucash report standard-reports general-ledger))
(export gnc:make-general-ledger-report)
(use-modules (gnucash utilities))
(use-modules (gnucash gnc-module))
(use-modules (gnucash gettext))
(gnc:module-load "gnucash/report/report-system" 0)
(define reportname (N_ "General Ledger"))
(define xactrptguid "2fe3b9833af044abb929a88d5a59620f")
(define xactrptname "Transaction Report")
;; report constructor
(define (gnc:make-general-ledger-report)
(let* ((xactrpt (gnc:make-report xactrptguid)))
xactrpt))
;; options generator
(define (general-ledger-options-generator)
(let ((options (gnc:trep-options-generator)))
(define pagename-sorting (N_ "Sorting"))
(define (set-option! section name value)
(gnc:option-set-default-value
(gnc:lookup-option options section name) value))
;; set options in the accounts tab...
(set-option! gnc:pagename-accounts "Filter Type" 'none)
(set-option! "Filter" "Void Transactions" 'non-void-only)
;; set options in the display tab...
(for-each
(lambda (l)
(set-option! gnc:pagename-display (car l) (cadr l)))
;; One list per option here with: option-name, default-value
(if (qof-book-use-split-action-for-num-field (gnc-get-current-book))
(list
(list (N_ "Date") #t)
(list (N_ "Reconciled Date") #f)
(list (N_ "Num/Action") #f)
(list (N_ "Trans Number") #f)
(list (N_ "Description") #t)
(list (N_ "Memo") #f)
(list (N_ "Account Name") #f)
(list (N_ "Use Full Account Name") #f)
(list (N_ "Account Code") #f)
(list (N_ "Other Account Name") #f)
(list (N_ "Use Full Other Account Name") #f)
(list (N_ "Other Account Code") #f)
(list (N_ "Shares") #f)
(list (N_ "Price") #f)
;; note the "Amount" multichoice option here
(list (N_ "Amount") 'double)
(list (N_ "Running Balance") #t)
(list (N_ "Totals") #f)
(list (N_ "Sign Reverses") 'credit-accounts)
)
(list
(list (N_ "Date") #t)
(list (N_ "Reconciled Date") #f)
(list (N_ "Num") #f)
(list (N_ "Description") #t)
(list (N_ "Memo") #f)
(list (N_ "Account Name") #f)
(list (N_ "Use Full Account Name") #f)
(list (N_ "Account Code") #f)
(list (N_ "Other Account Name") #f)
(list (N_ "Use Full Other Account Name") #f)
(list (N_ "Other Account Code") #f)
(list (N_ "Shares") #f)
(list (N_ "Price") #f)
;; note the "Amount" multichoice option here
(list (N_ "Amount") 'double)
(list (N_ "Running Balance") #t)
(list (N_ "Totals") #f)
(list (N_ "Sign Reverses") 'credit-accounts)
)
)
)
;; set options in the general tab...
(set-option!
gnc:pagename-display (N_ "Detail Level") 'single)
;; we can't (currently) set the Report name here
;; because it is automatically set to the template
;; name... :(
;; set options in the sorting tab...
(for-each
(lambda (l)
(set-option! pagename-sorting (car l) (cadr l)))
;; One list per option here with: option-name, default-value
(list
(list (N_ "Primary Key") 'account-code)
(list (N_ "Show Full Account Name") #f)
(list (N_ "Show Account Code") #t)
(list (N_ "Primary Subtotal") #t)
(list (N_ "Primary Subtotal for Date Key") 'none)
(list (N_ "Primary Sort Order") 'ascend)
(list (N_ "Secondary Key") 'register-order)
(list (N_ "Secondary Subtotal") #t)
(list (N_ "Secondary Subtotal for Date Key") 'none)
(list (N_ "Secondary Sort Order") 'ascend)
)
)
options)
)
;; report renderer
(define (general-ledger-renderer report-obj)
;; just delegate rendering to the Transaction Report renderer...
((gnc:report-template-renderer/report-guid xactrptguid xactrptname) report-obj))
(gnc:define-report
'version 1
'name reportname
'report-guid "2e22929e5c5b4b769f615a815ef0c20f"
'menu-path (list gnc:menuname-asset-liability)
'options-generator general-ledger-options-generator
'renderer general-ledger-renderer
)
;; END