Debian Codegraph @

texmf-dist/doc/latex/bankstatement/bankstatement.dtx

raw
1 % \iffalse meta-comment
2 % !TEX program = pdfLaTeX
3 %<*internal>
4 \iffalse
5 %</internal>
6 %<*readme>
7 # README #
8
9 More and more banks allow their customers to download posting
10 records in various formats. By using the `bankstatement` class,
11 you can create bank statements - as long as a csv format is
12 available! The `csv-mt940` and `csv-camt` formats - used by
13 many german Sparkassen - are supported. Moreover, it supports
14 `csv-standard-bank-na`!
15
16 Furthermore, the following languages are supported: english,
17 german, namibian
18
19 You can quite easily add support for other languages or csv
20 formats. Simply define the order of the keys in the csv data
21 file and how to use them.
22
23 The terminology in this class like `BIC` (Business Identifier
24 Codes) or `IBAN` (International Bank Account Number) is based on
25 `SEPA` (Single Euro Payments Area). But you can adjust the
26 terminology to suit your needs.
27
28 License: **LPPL**
29
30 Changes in v0.9.2:
31
32 * use of `siunitx` to force two decimals, if csv data contains
33 other formats like `16.2 -> 16.20`
34
35 * added support for Standard Bank (Namibia) and namibian
36
37 feature requests by Dr. Eberhard Lisse
38
39 * organized package in `dtx` format
40 %</readme>
41 %<*csv>
42 "Auftragskonto";"Buchungstag";"Valutadatum";"Buchungstext";"Verwendungszweck";"Glaeubiger ID";"Mandatsreferenz";"Kundenreferenz (End-to-End)";"Sammlerreferenz";"Lastschrift Ursprungsbetrag";"Auslagenersatz Ruecklastschrift";"Beguenstigter/Zahlungspflichtiger";"Kontonummer/IBAN";"BIC (SWIFT-Code)";"Betrag";"Waehrung";"Info"
43 "240408336";"30.12.14";"01.01.15";"ABSCHLUSS";"Abrechnung 30.12.2014 siehe Anlage ";"";"";"";"";"";"";"";"0240408336";"62841530";"0,00";"EUR";"Umsatz gebucht"
44 "240408336";"30.12.14";"01.01.15";"ENTGELTABSCHLUSS";"Entgeltabrechnung siehe Anlage ";"";"";"";"";"";"";"";"0000000000";"62841530";"-2,50";"EUR";"Umsatz gebucht"
45 "240408336";"18.12.14";"18.12.14";"FOLGELASTSCHRIFT";"302-4433811-1222731 Amazon.de 1045123487483681 ";"DE24ZZZ00000561652";"v:Bs73iT6BOB1wnSrLHmN7QpAe6c19";"1045684687483681";"";"";"";"AMAZON EU S.A.R.L. 5 RUE PLAETIS";"DE51300308801938072015";"TUBDDEDD";"-19,90";"EUR";"Umsatz gebucht"
46 "240408336";"16.12.14";"16.12.14";"GUTSCHRIFT";"ebayDDR2 Speicherriegel ";"";"";"ZV0100172628619600000002";"";"";"";"Hubert Schmidt";"DE90370100500236608109";"PBNKDEFFXXX";"7,54";"EUR";"Umsatz gebucht"
47 "240408336";"10.12.14";"10.12.14";"ERSTLASTSCHRIFT";"1000138169 Rechnung EDEKA mobil ";"DE26ZZZ00000006194";"EDEL01063189";"1000138169";"";"";"";"Vodafone GmbH";"DE91300400000174585007";"COBADEFF300";"-9,99";"EUR";"Umsatz gebucht"
48 "240408336";"08.12.14";"08.12.14";"ONLINE-UEBERWEISUNG";"Ebay 141671448786 klejo2011 Bahn Extra 06 2014 DATUM 08.12.2014, 15.55 UHR1.TAN 085028 ";"";"";"";"";"";"";"Reinhold Zwack";"DE02750905000024965237";"GENODEF1S05";"-9,58";"EUR";"Umsatz gebucht"
49 "240408336";"02.12.14";"02.12.14";"FOLGELASTSCHRIFT";"PP.6422.PP . elefantenbaby29, Ihr Einkauf bei elefantenbaby29, Artikel-321512375783 ";"LU96ZZZ0000000000000000058";"44X2224NAC48U";"YYIJ222223N6KX7N PP.6422.PP PAYPAL";"";"";"";"PayPal Europe S.a.r.l. et Cie S.C.A";"DE88500700100175526303";"DEUTDEFFXXX";"-18,60";"EUR";"Umsatz gebucht"
50 "240408336";"02.12.14";"02.12.14";"EINZAHLUNG";"SB-EINZAHLUNG ErdingW2 GA 2121 / 02.12.14 18.28.520240408336 / 1812 /0 / 0 ";"";"";"";"";"";"";"";"0240408336";"62841530";"150,00";"EUR";"Umsatz gebucht"
51 "240408336";"01.12.14";"29.11.14";"ENTGELTABSCHLUSS";"Entgeltabrechnung siehe Anlage ";"";"";"";"";"";"";"";"0000000000";"62841530";"-2,50";"EUR";"Umsatz gebucht"
52 %</csv>
53 %<*english>
54 \renewcommand*\STM@JK@holdername{Account Holder}%
55 \renewcommand*\STM@JK@bicname{BIC}%
56 \renewcommand*\STM@JK@ibanname{IBAN}%
57 \renewcommand*\STM@JK@firstcolumnheading{\bfseries Date}%
58 \renewcommand*\STM@JK@secondcolumnheading{\bfseries Reference}%
59 \renewcommand*\STM@JK@thirdcolumnheading{\bfseries Amount (GBP)}%
60 \renewcommand*\STM@JK@openingbalancename{Opening Balance}%
61 \renewcommand*\STM@JK@closingbalancename{Closing Balance}%
62 \sisetup{output-decimal-marker={.}}%
63 %</english>
64 %<*german>
65 \renewcommand*\STM@JK@holdername{Kontoinhaber}%
66 \renewcommand*\STM@JK@bicname{BIC}%
67 \renewcommand*\STM@JK@ibanname{IBAN}%
68 \renewcommand*\STM@JK@firstcolumnheading{\bfseries Datum}%
69 \renewcommand*\STM@JK@secondcolumnheading{\bfseries Verwendungszweck}%
70 \renewcommand*\STM@JK@thirdcolumnheading{\bfseries Betrag (EUR)}%
71 \renewcommand*\STM@JK@openingbalancename{Anfangssaldo}%
72 \renewcommand*\STM@JK@closingbalancename{Endsaldo}%
73 \sisetup{output-decimal-marker={,}}%
74 %</german>
75 %<*namibian>
76 \renewcommand*\STM@JK@holdername{Account Holder}%
77 \renewcommand*\STM@JK@bicname{Branch Code}%
78 \renewcommand*\STM@JK@ibanname{Account Number}%
79 \renewcommand*\STM@JK@firstcolumnheading{\bfseries Date}%
80 \renewcommand*\STM@JK@secondcolumnheading{\bfseries Reference}%
81 \renewcommand*\STM@JK@thirdcolumnheading{\bfseries Amount (NAD)}%
82 \renewcommand*\STM@JK@openingbalancename{Opening Balance}%
83 \renewcommand*\STM@JK@closingbalancename{Closing Balance}%
84 \sisetup{output-decimal-marker={.}}%
85 %</namibian>
86 %<*mt940>
87 %
88 % definitions for the csv-mt940 format
89 %
90 % define the order of keys in your csv file
91 % simply use arbitrary keys for unused fields
92 \renewcommand*\STM@JK@dbkeys{Account,PostingDate,ValueDate,Type,Reference,Recipient,IBAN,BIC,Amount,Currency,Info}%
93 % define usage of key values inside the used longtable
94 % dates & mixed information & amount
95 \renewcommand*\STM@JK@DTLforeach%
96 {%
97 \DTLforeach{\STM@JK@dbname}%
98 {\postingdate=PostingDate,\valuedate=ValueDate,\type=Type,\reference=Reference,\recipient=Recipient,\iban=IBAN,\bic=BIC,\amount=Amount,\currency=Currency}%
99 {%
100 \parbox[t]{\widthof{ DD.MM.YYYY }}{\leavevmode\hphantom{(}\postingdate\\(\valuedate)} &%
101 \parbox[t]{\STM@JK@referencewidth}{\raggedright%
102 \DTLifstringeq{\type}{}{}{\type\\}%
103 \DTLifstringeq{\bic}{}{-}{\bic{}}\DTLifstringeq{\iban}{}{}{ / \iban}\\%
104 \DTLifstringeq{\recipient}{}{}{\recipient\\}%
105 \reference} &%
106 \DTLifStartsWith{\amount}{-}{\textcolor{\STM@JK@negativecolor}{\num{\amount}}}{\num{\amount}}%
107 \DTLiflastrow{%
108 \ifthenelse{\equal{\STM@JK@closingbalance}{none}}%
109 {}%
110 {\\\midrule\\ & \STM@JK@closingbalancename & \DTLifStartsWith{\STM@JK@closingbalance}{-}{\textcolor{\STM@JK@negativecolor}{\num{\STM@JK@closingbalance}}}{\num{\STM@JK@closingbalance}}}%
111 \\\bottomrule%
112 }%
113 {\\ & & \\}%
114 }%
115 }%
116 % set separator of csv file
117 \DTLsetseparator{;}%
118 % does the csv file (not) have a header row? ;-)
119 \renewcommand*\STM@JK@noheader{false}%
120 % setup siunitx; see section 5 of siunitx manual for a list of all options
121 % detect-all detect all kind of font settings
122 % round-integer-to-decimal round integers like decimals (12 -> 12.00)
123 % round-mode=places use round mode places
124 % round-precision=2 set round precision to 2 places
125 \sisetup{detect-all,round-integer-to-decimal,round-mode=places,round-precision=2}%
126 %</mt940>
127 %<*camt>
128 %
129 % definitions for the csv-camt format
130 %
131 % define the order of keys in your csv file
132 % simply use arbitrary keys for unused fields
133 \renewcommand*\STM@JK@dbkeys{Account,PostingDate,ValueDate,Type,Reference,CreditorIdentifier,MandateReference,EndToEndReference,AAA,BBB,CCC,Recipient,IBAN,BIC,Amount,Currency,Info}%
134 % define usage of key values inside the used longtable
135 % dates & mixed information & amount
136 \renewcommand*\STM@JK@DTLforeach%
137 {%
138 \DTLforeach{\STM@JK@dbname}%
139 {\postingdate=PostingDate,\valuedate=ValueDate,\type=Type,\reference=Reference,\credid=CreditorIdentifier,\mref=MandateReference,\eref=EndToEndReference,\recipient=Recipient,\iban=IBAN,\bic=BIC,\amount=Amount,\currency=Currency}%
140 {%
141 \parbox[t]{\widthof{ DD.MM.YYYY }}{\leavevmode\hphantom{(}\postingdate\\(\valuedate)} &%
142 \parbox[t]{\STM@JK@referencewidth}{\raggedright%
143 \DTLifstringeq{\type}{}{}{\type\\}%
144 \DTLifstringeq{\bic}{}{-}{\bic{}}\DTLifstringeq{\iban}{}{}{ / \iban}\\%
145 \DTLifstringeq{\recipient}{}{}{\recipient\\}%
146 \DTLifstringeq{\credid}{}{}{CRED: \credid\\}%
147 \DTLifstringeq{\mref}{}{}{MREF: \mref\\}%
148 \DTLifstringeq{\eref}{}{}{EREF: \eref\\}%
149 \reference} &%
150 \DTLifStartsWith{\amount}{-}{\textcolor{\STM@JK@negativecolor}{\num{\amount}}}{\num{\amount}}%
151 \DTLiflastrow{%
152 \ifthenelse{\equal{\STM@JK@closingbalance}{none}}%
153 {}%
154 {\\\midrule\\ & \STM@JK@closingbalancename & \DTLifStartsWith{\STM@JK@closingbalance}{-}{\textcolor{\STM@JK@negativecolor}{\num{\STM@JK@closingbalance}}}{\num{\STM@JK@closingbalance}}}%
155 \\\bottomrule%
156 }%
157 {\\ & & \\}%
158 }%
159 }%
160 % set separator of csv file
161 \DTLsetseparator{;}%
162 % does the csv file (not) have a header row? ;-)
163 \renewcommand*\STM@JK@noheader{false}%
164 %
165 % setup siunitx; see section 5 of siunitx manual for a list of all options
166 % detect-all detect all kind of font settings
167 % round-integer-to-decimal round integers like decimals (12 -> 12.00)
168 % round-mode=places use round mode places
169 % round-precision=2 set round precision to 2 places
170 \sisetup{detect-all,round-integer-to-decimal,round-mode=places,round-precision=2}%
171 %</camt>
172 %<*stdbankna>
173 %
174 % definitions for the csv-standard-bank-na format
175 %
176 % define the order of keys in your csv file
177 % simply use arbitrary keys for unused fields
178 \renewcommand*\STM@JK@dbkeys{ValueDate,PostingDate,Reference,Narrative,Amount,Balance}%
179 % define usage of key values inside the used longtable
180 % dates & mixed information & amount
181 \renewcommand*\STM@JK@DTLforeach%
182 {%
183 \DTLforeach{\STM@JK@dbname}%
184 {\postingdate=PostingDate,\valuedate=ValueDate,\reference=Reference,\narrative=Narrative,\amount=Amount,\balance=Balance}%
185 {%
186 \parbox[t]{\widthof{ (YYYY-MM-DD) }}{\leavevmode\hphantom{(}\postingdate\\(\valuedate)} &%
187 \parbox[t]{\STM@JK@referencewidth}{\raggedright%
188 \DTLifstringeq{\reference}{}{}{\reference\\}%
189 \DTLifstringeq{\narrative}{}{}{\narrative\\}%
190 } &%
191 \parbox[t]{\widthof{1234567.89)}}{\raggedleft\DTLifStartsWith{\amount}{-}{\textcolor{\STM@JK@negativecolor}{\num{\amount}\hphantom{)}}}{\num{\amount}\hphantom{)}}\\(\num{\balance})}
192 \DTLiflastrow{%
193 \ifthenelse{\equal{\STM@JK@closingbalance}{none}}%
194 {}%
195 {\\\midrule\\ & \STM@JK@closingbalancename & \DTLifStartsWith{\STM@JK@closingbalance}{-}%
196 {\textcolor{\STM@JK@negativecolor}{\num{\STM@JK@closingbalance}}}{\num{\STM@JK@closingbalance}}}%
197 \\\bottomrule%
198 }%
199 {\\ & & \\}%
200 }%
201 }%
202 % set separator of csv file
203 \DTLsetseparator{,}%
204 % does the csv file (not) have a header row?
205 \renewcommand*\STM@JK@noheader{false}%
206 %
207 % setup siunitx; see section 5 of siunitx manual for a list of all options
208 % detect-all detect all kind of font settings
209 % round-integer-to-decimal round integers like decimals (12 -> 12.00)
210 % round-mode=places use round mode places
211 % round-precision=2 set round precision to 2 places
212 \sisetup{detect-all,round-integer-to-decimal,round-mode=places,round-precision=2}%
213 %</stdbankna>
214 %<*bibfile>
215 @misc{bib:datatool,
216 author = {Talbot, {Nicola L.C.}},
217 note = {\href{http://mirrors.ctan.org/macros/latex/contrib/datatool/datatool-user.pdf}{http://mirrors.ctan.org/macros/latex/contrib/datatool/datatool-user.pdf}},
218 title = {{User Manual for datatool bundle version 2.22}},
219 year = {2014},
220 }
221
222 @misc{bib:siunitx,
223 author = {Wright, Joseph},
224 note = {\href{http://mirrors.ctan.org/macros/latex/contrib/siunitx/siunitx.pdf}{http://mirrors.ctan.org/macros/latex/contrib/siunitx/siunitx.pdf}},
225 title = {{siunitx -- A comprehensive (SI) units package}},
226 year = {2014},
227 }
228
229 @misc{bib:sepa,
230 author = {{wikipedia.org}},
231 note = {\href{https://en.wikipedia.org/wiki/Single_Euro_Payments_Area}{https://en.wikipedia.org/wiki/Single\_Euro\_Payments\_Area}},
232 title = {{Single Euro Payments Area}},
233 year = {2014},
234 }
235
236 @misc{bib:bic,
237 author = {{wikipedia.org}},
238 note = {\href{https://en.wikipedia.org/wiki/ISO_9362}{https://en.wikipedia.org/wiki/ISO\_9362}},
239 title = {{ISO 9362}},
240 year = {2014},
241 }
242
243 @misc{bib:iban,
244 author = {{wikipedia.org}},
245 note = {\href{https://en.wikipedia.org/wiki/International_Bank_Account_Number}{https://en.wikipedia.org/wiki/International\_Bank\_Account\_Number}},
246 title = {{International Bank Account Number}},
247 year = {2014},
248 }
249
250 @misc{bib:lang,
251 author = {{Josef Kleber}},
252 note = {\href{http://bankstatement.jklatex.de/en/2015/11/howto-support-other-languages/}{http://bankstatement.jklatex.de/en/2015/11/howto-support-other-languages/}},
253 title = {{HowTo support other languages}},
254 year = {2015},
255 }
256
257 @misc{bib:csv,
258 author = {{Josef Kleber}},
259 note = {\href{http://bankstatement.jklatex.de/en/2015/11/howto-support-arbitrary-csv-formats-2/}{http://bankstatement.jklatex.de/en/2015/11/howto-support-arbitrary-csv-formats-2/}},
260 title = {{HowTo support arbitrary CSV formats}},
261 year = {2015},
262 }
263
264 %</bibfile>
265 %<*examplefile>
266 \documentclass[a4paper,10pt,bic=BYLADEM1ERD,
267 iban=DE70753574230240408336,
268 holder={Josef Kleber},
269 language=german,logo=stmlogo,
270 format=csv-camt,
271 logowidth=4cm,negativecolor=red]
272 {bankstatement}
273 \usepackage[german]{babel}
274 \usepackage[utf8]{inputenc}
275 \usepackage[T1]{fontenc}
276 \usepackage{textcomp}
277 \usepackage{bera}
278 \renewcommand\familydefault{\sfdefault}
279 \begin{document}
280 \bankstatement[title={Kontoauszug 12/2014},
281 openingbalance={-12,34},
282 closingbalance={82,13}]{201412.csv}
283 \end{document}
284 %</examplefile>
285 %<*manifest>
286 This work consists of the following files:
287
288 bankstatement.pdf
289 bankstatement.dtx
290 README
291 makefile
292
293 Files packaged in bankstatement.dtx:
294
295 bankstatement.sty
296 bankstatement-example.tex
297 manifest.txt
298 stmenglish.def
299 stmgerman.def
300 stmnamibian.def
301 csv-mt940.def
302 csv-camt.def
303 csv-standard-bank-na.def
304 %</manifest>
305 %<*internal>
306 \fi
307 \def\nameofplainTeX{plain}
308 \ifx\fmtname\nameofplainTeX\else
309 \expandafter\begingroup
310 \fi
311 %</internal>
312 %<*install>
313 \input docstrip.tex
314 \keepsilent
315 \askforoverwritefalse
316 \preamble
317
318 Copyright (C) 2015 by:
319 Josef Kleber
320 <[email protected]>
321
322 This file may be distributed and/or modified under the conditions of
323 the LaTeX Project Public License, either version 1.3 of this license
324 or (at your option) any later version. The latest version of this
325 license is in:
326
327 http://www.latex-project.org/lppl.txt
328
329 and version 1.3 or later is part of all distributions of LaTeX version
330 2003/12/01 or later.
331
332 This work has the LPPL maintenance status "maintained".
333
334 The Current Maintainer of this work is Josef Kleber.
335
336 This work consists of all files listed in manifest.txt.
337
338 \endpreamble
339
340 \usedir{tex/latex/bankstatement}
341 \generate{
342 \file{\jobname.cls}{\from{\jobname.dtx}{class}}
343 }
344 \generate{
345 \file{stmenglish.def}{\from{\jobname.dtx}{english}}
346 }
347 \generate{
348 \file{stmgerman.def}{\from{\jobname.dtx}{german}}
349 }
350 \generate{
351 \file{stmnamibian.def}{\from{\jobname.dtx}{namibian}}
352 }
353 \generate{
354 \file{csv-mt940.def}{\from{\jobname.dtx}{mt940}}
355 }
356 \generate{
357 \file{csv-camt.def}{\from{\jobname.dtx}{camt}}
358 }
359 \generate{
360 \file{csv-standard-bank-na.def}{\from{\jobname.dtx}{stdbankna}}
361 }
362 \generate{
363 \file{\jobname-example}{\from{\jobname.dtx}{examplefile}}
364 }
365 %</install>
366 %<install>\endbatchfile
367 %<*internal>
368 \nopreamble\nopostamble
369 \usedir{doc/latex/bankstatement}
370 \generate{
371 \file{README.md}{\from{\jobname.dtx}{readme}}
372 }
373 \generate{
374 \file{201412.csv}{\from{\jobname.dtx}{csv}}
375 }
376 \generate{
377 \file{manifest.txt}{\from{\jobname.dtx}{manifest}}
378 }
379 \generate{
380 \file{\jobname.bib}{\from{\jobname.dtx}{bibfile}}
381 }
382 \ifx\fmtname\nameofplainTeX
383 \expandafter\endbatchfile
384 \else
385 \expandafter\endgroup
386 \fi
387 %</internal>
388 %<*driver>
389 \documentclass[a4paper]{ltxdoc}%
390 \usepackage[english]{babel}%
391 \usepackage[latin1]{inputenc}%
392 \usepackage[T1]{fontenc}%
393 \usepackage{textcomp}%
394 \usepackage{lmodern}%
395 \usepackage{bera}%
396 \usepackage{microtype}%
397 \usepackage{cite}%
398 \usepackage{marginnote}%
399 \usepackage[svgnames,rgb]{xcolor}%
400 \usepackage{listings}%
401 \usepackage{makeidx}
402 \usepackage[numbered]{hypdoc}
403 \usepackage{ragged2e}%
404 \usepackage{url}%
405 \usepackage[automark,nouppercase]{scrpage2}
406 \usepackage{tikz}
407 \usetikzlibrary{calc}%
408 % turn off idiotic tikz error in doc generation
409 \makeatletter
410 \global\let\tikz@ensure@dollar@catcode=\relax
411 \makeatother
412 \usepackage{hyperref}
413 \EnableCrossrefs
414 \CodelineIndex
415 \RecordChanges
416 \makeatletter
417 \setlength{\headheight}{1.1\baselineskip}%
418 \renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
419 {-2.5ex\@plus -1ex \@minus -.25ex}%
420 {1.25ex \@plus .25ex}%
421 {\normalfont\normalsize\bfseries}}
422 \setcounter{secnumdepth}{5}
423 \setcounter{tocdepth}{5}
424 \hypersetup{colorlinks=true,urlcolor=NavyBlue,linkcolor=NavyBlue,citecolor=CornflowerBlue}%
425 \lstset{literate=%
426 {Ö}{{\"O}}1
427 {Ä}{{\"A}}1
428 {Ü}{{\"U}}1
429 {ß}{{\ss}}1
430 {ü}{{\"u}}1
431 {ä}{{\"a}}1
432 {ö}{{\"o}}1
433 {~}{{\textasciitilde}}1
434 }
435 \lstset{language=[LaTeX]TeX,numbers=left,numberstyle=\tiny, basicstyle=\ttfamily, aboveskip=\baselineskip, frame=single, backgroundcolor=\color{LightGoldenrodYellow}, keywordstyle=\color{Blue},
436 emph={}}
437 \renewcommand{\maketitle}%
438 {%
439 \thispagestyle{empty}%
440 \pagecolor{Ivory}%
441 \begin{titlepage}%
442 \begin{tikzpicture}[remember picture,overlay]%
443 \node[yshift=-2cm] at (current page.north west)%
444 {%
445 \begin{tikzpicture}[remember picture, overlay]%
446 \draw[fill=CornflowerBlue,color=CornflowerBlue] (0,0) rectangle%
447 (\paperwidth,2cm);%
448 \draw[anchor=west,yshift=-4cm,xshift=3cm,color=NavyBlue] (0,0) node%
449 {\parbox{15cm}{\RaggedRight\Huge\sffamily\textbf{\@title}}};%
450 \draw[anchor=west,yshift=-6cm,xshift=3cm,color=NavyBlue] (0,0) node%
451 {\parbox{15cm}{\huge\sffamily\textbf{\@fileversion}}};%
452 \draw[anchor=west,yshift=-9cm,xshift=3cm,color=NavyBlue] (0,0) node%
453 {\parbox{15cm}{\RaggedRight\huge\sffamily\textbf{\@subtitle}}};%
454 \draw[anchor=west,yshift=-18cm,xshift=3cm,color=NavyBlue] (0,0) node%
455 {\parbox{15cm}{\huge\sffamily\textbf{\@date}}};%
456 \draw[anchor=west,yshift=-20cm,xshift=3cm,color=NavyBlue] (0,0) node%
457 {\parbox{15cm}{\Large\sffamily{\@authorline\\\textbf{\@author}}}};%
458 \end{tikzpicture}%
459 };%
460 \node[yshift=0cm] at (current page.south west)%
461 {%
462 \begin{tikzpicture}[remember picture, overlay]%
463 \draw[fill=NavyBlue,color=NavyBlue,yshift=6cm,xshift=2cm] (0,0) rectangle (0.2cm,19cm);%
464 \draw[fill=CornflowerBlue,color=CornflowerBlue] (0,0) rectangle (\paperwidth,2cm);%
465 \draw[anchor=west,yshift=1cm,xshift=3cm,color=NavyBlue] (0,0) node%
466 {\parbox{15cm}{\large\sffamily{\@refline}}};%
467 \end{tikzpicture}%
468 };%
469 \end{tikzpicture}%
470 \end{titlepage}%
471 \pagecolor{white}%
472 }%
473 %
474 \newcommand*{\@tikzhead}[1]%
475 {%
476 \begin{tikzpicture}[remember picture,overlay]%
477 \node[yshift=-2cm] at (current page.north west)%
478 {%
479 \begin{tikzpicture}[remember picture, overlay]%
480 \draw[fill=CornflowerBlue] (0,0) rectangle (\paperwidth,2cm);%
481 \draw[anchor=west,yshift=1cm,xshift=1.5cm,color=NavyBlue] (0,0) node%
482 {\parbox{15cm}{\LARGE\sffamily\textbf{\@title}}};%
483 \node[anchor=east,xshift=.9\paperwidth,rectangle,%
484 rounded corners=15pt,inner sep=11pt,fill=NavyBlue]%
485 {\color{white}\textsc{#1}};%
486 \end{tikzpicture}%
487 };%
488 \end{tikzpicture}%
489 }%
490 \clearscrheadings%
491 \ihead{\@tikzhead{\headmark}}%
492 \cfoot{\upshape\thepage}%
493 \pagestyle{scrheadings}%
494 %
495 \newcommand*{\Headline}[1]{\@mkboth{#1}{#1}}%
496 %
497 \renewcommand{\headfont}{\normalfont\mdseries\scshape}
498 %
499 \gdef\@subtitle{}%
500 \providecommand*{\Subtitle}[1]{\gdef\@subtitle{#1}}%
501 \gdef\@fileversion{}%
502 \providecommand*{\Fileversion}[1]{\gdef\@fileversion{#1}}%
503 \gdef\@author{}%
504 \providecommand*{\Author}[1]{\gdef\@author{#1}}%
505 \gdef\@authorline{Package author:}%
506 \providecommand*{\Authorline}[1]{\gdef\@authorline{#1}}%
507 \gdef\@refline{}%
508 \providecommand*{\Refline}[1]{\gdef\@refline{#1}}%
509 \gdef\and{\unskip{}, }%
510 \newcommand\doubledash{-\kern0.5pt-}
511 \def\enoteformat{\rightskip\z@ \leftskip\z@ \parindent=1em\leavevmode\llap{\makeenmark}}
512 \def\XeLaTeX{Xe\LaTeX}%
513 %
514 \newenvironment{optionlist}
515 {\begin{trivlist}\setlength\leftskip{2em}}
516 {\end{trivlist}}
517 \newcommand\optitem[3]{\item [\texttt{\textbf{\textcolor{DodgerBlue}{#1}} \lbrack\textcolor{Crimson}{#2}\rbrack}] #3}
518 \renewcommand\tableofcontents%
519 {%
520 %\section*{\contentsname}%
521 \@mkboth{%
522 \MakeUppercase\contentsname}{\MakeUppercase\contentsname}%
523 \@starttoc{toc}%
524 }%
525 %
526 %\newcommand\env[1]{\texttt{#1}}%
527 \newcommand\layer[1]{\texttt{#1}\SortIndex{#1}{\texttt{#1} (PGF layer)}%
528 \SortIndex{PGF layer>#1}{\texttt{#1}}}%
529 \newcommand\styleoption[1]{\texttt{#1}\SortIndex{#1}{\texttt{#1} (Style option)}%
530 \SortIndex{Style option>#1}{\texttt{#1}}}%
531 \newcommand\envoption[1]{\texttt{#1}\SortIndex{#1}{\texttt{#1} (Puzzle option)}%
532 \SortIndex{Puzzle option>#1}{\texttt{#1}}}%
533 \newcommand\stylename[1]{\texttt{#1}\SortIndex{#1}{\texttt{#1} (Style file)}%
534 \SortIndex{Style file>#1}{\texttt{#1}}}%
535 \newcommand\package[1]{\texttt{#1}\SortIndex{#1}{\texttt{#1} (Package)}%
536 \SortIndex{Package>#1}{\texttt{#1}}}%
537 \newcommand*\margcs[1]{\marginnote{\hbadness=10000\RaggedLeft\scriptsize #1}}%
538 \def\PrintIndex{\clearpage\Headline{Index}\@input@{\jobname.ind}%
539 \global\let\PrintIndex\@empty}
540 \renewenvironment{theindex}
541 {\if@twocolumn
542 \@restonecolfalse
543 \else
544 \@restonecoltrue
545 \fi
546 \columnseprule \z@
547 \columnsep 35\p@
548 \def\see##1##2{\textit{See} ##1}%
549 \def\seealso##1##2{\textit{See also} ##1}%
550 \long\def\cmd##1{\cs{\expandafter\cmd@to@cs\string##1}}%
551 \def\@url##1{\url@break\ttt{##1}\endgroup}%
552 \def\ttt{\begingroup\@sanitize\ttfamily\@ttt}%
553 \def\@ttt##1{##1\endgroup}%
554 \mathchardef\save@secnumdepth\c@secnumdepth
555 \c@secnumdepth\m@ne
556 \phantomsection%
557 \twocolumn%[\section{\indexname}]%
558 \refstepcounter{section}
559 \addcontentsline{toc}{section}{\protect\numberline{\thesection}Index}%
560 \c@secnumdepth\save@secnumdepth
561 %\thispagestyle{plain}
562 \parindent\z@
563 \parskip\z@ \@plus .3\p@\relax
564 \let\item\@idxitem}
565 {\if@restonecol\onecolumn\else\clearpage\fi}
566 \setlength\parindent{0pt}%
567 \newcommand*\myref[1]{[see: \ref{#1} on page \pageref{#1}]}
568 \makeatother
569 \begin{document}
570 \DocInput{\jobname.dtx}
571 \end{document}
572 %</driver>
573 % \fi
574 %
575 % \def\filename{bankstatement.cls}
576 % \def\filedate{2015/11/14}
577 % \def\fileversion{0.9.2}
578 % \hypersetup{pdfauthor={Josef Kleber},pdftitle={A LaTeX class for bank statements based on csv data},pdfsubject={Documentation for LaTeX class \filename}}%
579 % \lstset{language=[LaTeX]TeX,numbers=left,numberstyle=\tiny, basicstyle=\ttfamily, aboveskip=\baselineskip, frame=single, backgroundcolor=\color{LightGoldenrodYellow}, keywordstyle=\color{Blue},
580 % emph={bankstatement},emphstyle=\color{Tomato},
581 % emph={[2]logo,bic,iban,holder,title,language,10pt,a4paper,format,logowidth,negativecolor,openingbalance,closingbalance},emphstyle={[2]\color{OliveDrab}},
582 % morekeywords={bankstatement}}
583 % \DoNotIndex{\,,\\,\begin,\end,\begingroup,\endgroup,\csname,\def,\else,\endcsname,\equal,\expandafter,
584 % \fi,\gdef,\ifnum,\ifthenelse,\immediate,\MessageBreak,\NeedsTeXFormat,\newcommand,\newif,
585 % \PackageInfo,\PackageError,\ProcessOptionsX,\ProvidesPackage,\relax,\RequirePackage,
586 % \space,\errmessage,\ExecuteOptionsX,}
587 %
588 % \bibliographystyle{plain}
589 % \title{\filename}%
590 % \Subtitle{A \LaTeX{} class for bank statements based on csv data}%
591 % \author{Josef Kleber}
592 % \Fileversion{\fileversion}
593 % \date{\filedate}
594 % \Refline{\href{mailto:[email protected]}{\texttt{[email protected]}}\\\href{http://bankstatement.jklatex.de/}{\texttt{http://bankstatement.jklatex.de/}}}
595 % \maketitle
596 % \stepcounter{page}
597 % \tableofcontents
598 % \clearpage
599 % \setlength\parskip{6pt}%
600 %
601 %
602 %\StopEventually{^^A
603 % {
604 % \clearpage
605 % \raggedright
606 % \nocite{*}
607 % \bibliography{\jobname}
608 % }
609 % \clearpage
610 % \PrintChanges
611 % \PrintIndex
612 %}
613 %
614 % \Headline{Abstract}
615 % \begin{abstract}
616 % More and more banks allow their customers to download posting records in various formats.
617 % By using the \texttt{bankstatement} class, you can create bank statements -- as long as a csv format is available!
618 % At the moment, the \texttt{csv-mt940} \texttt{and csv-camt} formats -- used by many german Sparkassen -- are supported.
619 % Moreover, it supports \texttt{csv-standard-bank-na}!
620 %
621 % Furthermore, the following languages are supported: english, german, namibian
622 %
623 % You can quite easily add support for other languages or csv formats.
624 % Simply define the order of the keys in the csv data file and how to use them.
625 %
626 % The terminology in this class like BIC (Business Identifier Codes) or IBAN (International Bank Account Number) is based on SEPA (Single Euro Payments Area).
627 % But you can adjust the terminology to suit your needs.
628 % \end{abstract}
629 % \clearpage
630 % \tableofcontents
631 % \clearpage
632 % \section{Class options}
633 % \begin{description}
634 % \item[format (\texttt{csv-mt940})] specifies the csv format of your data files
635 % \item[language (\texttt{english})] specifies the language of your document
636 % \item[left (\texttt{2cm})] specifies the left margin
637 % \item[right (\texttt{2cm})] specifies the right margin
638 % \item[top (\texttt{2cm})] specifies the top margin
639 % \item[bottom (\texttt{2cm})] specifies the bottom margin
640 % \end{description}
641 % \section{The \texttt{bankstatement} command}
642 % The \cmd\bankstatement{}\marginnote{\cmd\bankstatement\\\oarg{options}\{\marg{csv file}\}} command reads in \marg{csv file} and outputs your bank statement.
643 % It supports the following options, which can also be used as class options with global scope:
644 % \begin{description}
645 % \item[title (\texttt{})] specifies the title of your bank statement
646 % \item[logo (\texttt{})] specifies the logo used in the bank statement. It may be the logo of your bank or the sports club, whose treasurer you are.
647 % \item[logowidth (\texttt{4cm})] defines the width of the logo
648 % \item[holder (\texttt{})] specifies the account holder
649 % \item[bic (\texttt{})] specisfies the BIC (Business Identifier Codes)
650 % \item[iban (\texttt{})] specifies the IBAN (International Bank Account Number)
651 % \item[referencewidth (\texttt{11cm})] specifies the width of the second table column used for the reference. Depending on page size, margins and font you may need to adjust the width.
652 % \item[negativecolor (\texttt{red})] specifies the color used for negative amounts
653 % \item[sort (\texttt{PostingDate})] defines the sort key of the csv data base
654 % \item[openingbalance (\texttt{none})] specifies the opening balance. csv posting records do not contain an opening balance, only postings.
655 % \item[closingbalance (\texttt{none})] specifies the closing balance
656 % \end{description}
657 %
658 % Make sure to use the same encoding in your document than in the csv file(s)!
659 % \section{Customization}
660 % You can quite easily add support for other languages\cite{bib:lang} and formats\cite{bib:csv}. Please send a copy to the maintainer of \texttt{bankstatement}.
661 % \subsection{Languages}
662 % Supported languages:
663 %
664 % \begin{itemize}
665 % \item \texttt{\bfseries english}
666 % \item \texttt{german}
667 % \item \texttt{namibian}
668 % \end{itemize}
669 %
670 % To support other languages, simply copy \texttt{stmenglish.def} to your local \TeX{} tree, rename it and translate the definitions to your language!\cite{bib:lang}
671 %
672 % \subsection{Formats}
673 %
674 % Supported formats:
675 %
676 % \begin{itemize}
677 % \item \texttt{\bfseries csv-mt940}
678 % \item \texttt{csv-camt}
679 % \item \texttt{csv-standard-bank-na}
680 % \end{itemize}
681 %
682 % To support other formats\cite{bib:csv}, simply copy \texttt{csv-mt940.def} to your local \TeX{} tree, rename it and adjust the definitions to your needs!
683 % That is, define the order of keys in your format and specify how to use them. Furthermore, you should specify the separator of the csv file and whether the csv file has a header row or not.
684 %
685 % \section{Example}
686 % \iffalse
687 %<*example>
688 % \fi
689 \begin{lstlisting}
690 \documentclass[a4paper,10pt,bic=BYLADEM1ERD,
691 iban=DE70753574230240408336,
692 holder={Josef Kleber},
693 language=german,logo=stmlogo,
694 format=csv-camt,
695 logowidth=4cm,negativecolor=red]
696 {bankstatement}
697 \usepackage[german]{babel}
698 \usepackage[utf8]{inputenc}
699 \usepackage[T1]{fontenc}
700 \usepackage{textcomp}
701 \usepackage{bera}
702 \renewcommand\familydefault{\sfdefault}
703 \begin{document}
704 \bankstatement[title={Kontoauszug 12/2014},
705 openingbalance={-12,34},
706 closingbalance={82,13}]{201412.csv}
707 \end{document}
708 \end{lstlisting}
709 % \iffalse
710 %</example>
711 % \fi
712 %
713 % \section{Implementation}
714 % \changes{v0.9.1}{2015/01/07}{CTAN upload}
715 % \changes{v0.9.2}{2015/01/24}{updated stmenglish.def}
716 % \changes{v0.9.2}{2015/01/24}{added stmnamibian.def}
717 % \changes{v0.9.2}{2015/01/24}{added csv-standard-bank-na.def}
718 % \begin{macrocode}
719 %<*class>
720 % \end{macrocode}
721 % First, we provide the \LaTeX\ class \package{bankstatement}.
722 % \begin{macrocode}
723 \NeedsTeXFormat{LaTeX2e}%
724 \ProvidesClass{bankstatement}[2015/11/14 class for csv based bank statements v0.9.2]%
725 % \end{macrocode}
726 % We need the \package{xkeyval} package and the \package{xkvlxp} package to allow curly braces and a bit more
727 % in global class options!
728 % \begin{macrocode}
729 \RequirePackage{xkeyval}%
730 \RequirePackage{xkvltxp}%
731 % \end{macrocode}
732 % We provide a macro \cmd\STM@JK@define@key, which defines class options with global scope%
733 % and options for \cmd\bankstatement\ with local scope. It takes four arguments \marg{prefix},%
734 % \marg{package},\marg{option} and \marg{default}.
735 % \begin{macrocode}
736 \newcommand*\STM@JK@define@key[4]%
737 {%
738 \expandafter\gdef\csname#1@#3\endcsname{#4}%
739 \define@key{#2.cls}{#3}[#4]%
740 {%
741 \expandafter\gdef\csname#1@#3\endcsname{##1}%
742 }%
743 \define@key{#2}{#3}%
744 {%
745 \expandafter\def\csname#1@#3\endcsname{##1}%
746 }%
747 }%
748 % \end{macrocode}
749 % Now, we can use this macro to define our options.
750 % \begin{macrocode}
751 \STM@JK@define@key{STM@JK}{bankstatement}{format}{csv-mt940}%
752 \STM@JK@define@key{STM@JK}{bankstatement}{language}{english}%
753 \STM@JK@define@key{STM@JK}{bankstatement}{title}{}%
754 \STM@JK@define@key{STM@JK}{bankstatement}{logo}{}%
755 \STM@JK@define@key{STM@JK}{bankstatement}{logowidth}{4cm}%
756 \STM@JK@define@key{STM@JK}{bankstatement}{holder}{}%
757 \STM@JK@define@key{STM@JK}{bankstatement}{bic}{}%
758 \STM@JK@define@key{STM@JK}{bankstatement}{iban}{}%
759 \STM@JK@define@key{STM@JK}{bankstatement}{referencewidth}{11cm}%
760 \STM@JK@define@key{STM@JK}{bankstatement}{negativecolor}{red}%
761 \STM@JK@define@key{STM@JK}{bankstatement}{sort}{PostingDate}%
762 \STM@JK@define@key{STM@JK}{bankstatement}{openingbalance}{none}%
763 \STM@JK@define@key{STM@JK}{bankstatement}{closingbalance}{none}%
764 \STM@JK@define@key{STM@JK}{bankstatement}{left}{2cm}%
765 \STM@JK@define@key{STM@JK}{bankstatement}{right}{2cm}%
766 \STM@JK@define@key{STM@JK}{bankstatement}{top}{2cm}%
767 \STM@JK@define@key{STM@JK}{bankstatement}{bottom}{2cm}%
768 % \end{macrocode}
769 % We execute the class options to define and set the option macros.
770 % \begin{macrocode}
771 \DeclareOptionX*{\PassOptionsToClass{\CurrentOption}{article}}%
772 \ExecuteOptionsX{format,language,title,logo,logowidth,holder,bic,iban,%
773 referencewidth,negativecolor,sort,openingbalance,%
774 closingbalance,left,right,top,bottom}%
775 \ProcessOptionsX*\relax%
776 \LoadClass{article}%
777 % \end{macrocode}
778 % We load some more needed packages.
779 % \changes{v0.9.2}{2015/01/24}{added siunitx package to force output of exactly two digital places}
780 % \begin{macrocode}
781 \RequirePackage[left=\STM@JK@left,right=\STM@JK@right,top=\STM@JK@top,%
782 bottom=\STM@JK@bottom]{geometry}%
783 \RequirePackage{longtable}%
784 \RequirePackage{tabularx}%
785 \RequirePackage{xcolor}%
786 \RequirePackage{graphicx}%
787 \RequirePackage{booktabs}%
788 \RequirePackage{datatool}%
789 \RequirePackage{calc}%
790 \RequirePackage{ifthen}%
791 \RequirePackage{siunitx}%
792 % \end{macrocode}
793 % We define some macros, which will be redefined in language and format definition files!
794 % \begin{macrocode}
795 \newcommand*\STM@JK@dbkeys{}%
796 \newcommand*\STM@JK@DTLforeach{}%
797 \newcommand*\STM@JK@holdername{}%
798 \newcommand*\STM@JK@bicname{}%
799 \newcommand*\STM@JK@ibanname{}%
800 \newcommand*\STM@JK@firstcolumnheading{}%
801 \newcommand*\STM@JK@secondcolumnheading{}%
802 \newcommand*\STM@JK@thirdcolumnheading{}%
803 \newcommand*\STM@JK@openingbalancename{}%
804 \newcommand*\STM@JK@closingbalancename{}%
805 % \end{macrocode}
806 % We set some defaults and create a counter for unique data base names.
807 % \begin{macrocode}
808 \newcommand*\STM@JK@headingsep{0.5cm}%
809 \newcommand*\STM@JK@noheader{false}%
810 %
811 \newcounter{STM@JK@count}%
812 % \end{macrocode}
813 % We load the language and format definition files specified as class options.
814 % \begin{macrocode}
815 \input{\STM@[email protected]}%
816 \input{stm\STM@[email protected]}%
817 % \end{macrocode}
818 % This macro typesets a given logo at the right border.
819 % \begin{macrocode}
820 \newcommand*\STM@JK@includelogo%
821 {%
822 \ifthenelse{\equal{\STM@JK@logo}{}}%
823 {}%
824 {\hfill\includegraphics[width=\STM@JK@logowidth]{\STM@JK@logo}}%
825 }%
826 % \end{macrocode}
827 % This macro typesets the header of the bank statement.
828 % \begin{macrocode}
829 \newcommand*\STM@JK@header%
830 {%
831 \noindent%
832 \begin{tabularx}{\textwidth}{XXr}%
833 \multicolumn{3}{l}{\Huge{}\hspace{.22em}\STM@JK@title\STM@JK@includelogo}\\%
834 & &\\%
835 \begin{tabular}{l}\textbf{\STM@JK@holdername}\\\STM@JK@holder\end{tabular} &%
836 \begin{tabular}{l}\textbf{\STM@JK@bicname}\\\STM@JK@bic\end{tabular} &%
837 \begin{tabular}{l}\textbf{\STM@JK@ibanname}\\\STM@JK@iban\end{tabular}\\%
838 \end{tabularx}%
839 \vspace{\STM@JK@headingsep}%
840 }%
841 % \end{macrocode}
842 % \begin{macro}{\bankstatement}
843 % Here, we define the user command to typeset the bank statement.
844 %
845 % \cs{bankstatement}\oarg{options}\marg{csv file}
846 % \begin{macrocode}
847 \newcommand\bankstatement[2][]%
848 {%
849 % \end{macrocode}
850 % We start a group to keep the setting of options local.
851 % Then we step our unique counter and define a macro for the current data base name for multi command usage!
852 % \begin{macrocode}
853 \begingroup%
854 \setkeys{bankstatement}{#1}%
855 \stepcounter{STM@JK@count}%
856 \xdef\STM@JK@dbname{stm\arabic{STM@JK@count}}%
857 % \end{macrocode}
858 % Then we can load \marg{csv file} into our data base depending on the \texttt{noheader} option!
859 % Finally, we sort our data base depending on the data base key specified with the \texttt{sort} option!
860 % \changes{v0.9.2}{2015/01/24}{changed \cmd\DTLloaddb $\rightarrow$ \cmd\DTLloadrawdb}
861 % \changes{v0.9.2}{2015/01/24}{catch empty sort key $\rightarrow$ no sorting}
862 % \begin{macrocode}
863 \ifthenelse{\equal{\STM@JK@noheader}{false}}%
864 {\DTLloadrawdb[keys={\STM@JK@dbkeys},noheader=false]{\STM@JK@dbname}{#2}}%
865 {\DTLloadrawdb[keys={\STM@JK@dbkeys},noheader=true]{\STM@JK@dbname}{#2}}%
866 \ifthenelse{\equal{\STM@JK@sort}{}}%
867 {}%
868 {\DTLsort{\STM@JK@sort}{\STM@JK@dbname}}%
869 % \end{macrocode}
870 % Now we can typeset the header of the bank statement and start the \package{longtable}.
871 % Maybe, we still need to typeset an opening balance.
872 % \begin{macrocode}
873 \STM@JK@header%
874 \begin{longtable}{llr}%
875 \toprule%
876 \STM@JK@firstcolumnheading &%
877 \STM@JK@secondcolumnheading &%
878 \STM@JK@thirdcolumnheading%
879 \\\toprule%
880 \endhead%
881 \ifthenelse{\equal{\STM@JK@openingbalance}{none}}%
882 {}%
883 { & & \\ & \STM@JK@openingbalancename &%
884 \DTLifStartsWith{\STM@JK@openingbalance}{-}%
885 {\textcolor{\STM@JK@negativecolor}{\num{\STM@JK@openingbalance}}}%
886 {\num{\STM@JK@openingbalance}} \\\midrule}%
887 % \end{macrocode}
888 % Now, we can loop through our database and create a new row for each line in \marg{csv file}.
889 % Finally, we can end the \package{longtable}.
890 % \begin{macrocode}
891 \STM@JK@DTLforeach%
892 \end{longtable}%
893 \endgroup%
894 }%
895 % \end{macrocode}
896 % \end{macro}
897 % Finally, we disable the global class options \cmd\AtBeginDocument.
898 % \begin{macrocode}
899 \AtBeginDocument{\disable@keys{bankstatement}%
900 {format,language,left,right,top,bottom}}%
901 % \end{macrocode}
902 % \begin{macrocode}
903 %</class>
904 % \end{macrocode}
905 %\Finale