]> git.madduck.net Git - etc/texmf.git/blob - .texmf/tex/latex/invoice.sty

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

082c61c5bd8aa454f04a3f9f9256c8401e7b02db
[etc/texmf.git] / .texmf / tex / latex / invoice.sty
1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 %        Datei: invoice.sty
3 %        Autor: Oliver Corff
4 %      Contact: corff@zedat.fu-berlin.de, oliver.corff@email.de
5 %        Datum: December 16, 2003
6 %      Version: 0.7
7 %    Copyright: Ulaanbaatar, Beijing, Berlin, Zagreb, Shenyang, Shanghai
8 %  Description: This collection of macros provides
9 %               tools for generating complex invoices
10 %
11 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12 %
13 % Corrections, suggestions and contributions by:
14 %%%%%%
15 % Jacopo, May 2003
16 % e-mail: jacopo@
17 %
18 %   Contributed labels in Italian.
19 %
20 %%%%%%
21 % O. Corff, July 2003 
22
23 %   fixed one nasty spacing bug, simplified internal table 
24 %   construction (table now has five instead of six columns,
25 %   the second of which was never used).
26 %
27 %%%%%%
28 % Johann Spies, January 21, 2002
29 % e-mail: jspies@sun.ac.za
30 %
31 %   Hinted that \Subtotal Project should show the project name
32 %   rather than just `Project'.
33 %
34 %   Contributed labels in Afrikaans.
35 %
36 %%%%%%
37 % Robin Fairbairns, December 6, 2001
38
39 %   Hinted that the dollar sign can also be printed by saying
40 %   \string$.
41 %
42 %%%%%%
43 % Vincent Tougait, France, November 27, 2001
44 %
45 %   Pointed out that fractions of VAT percents were not allowed.
46 %   Bugfix on December 06, 2001
47 %
48 %%%%%%
49 % Fred Donck, The Hague, The Netherlands, October, 2001
50 % e-mail: fd0@donck.com
51 %
52 % Dutch labels
53 %
54 %%%%%%
55 % Ian Wormsbecker, October 31, 2001
56 %
57 %   Skips the VAT lines if VAT=0
58 %   Noticed that the terminal message will not accept a Dollar sign.
59 %   The only workaround is to say \char`$ in \begin{invoice}{}
60 %
61 %%%%%%
62 % Fred Donck, The Hague, The Netherlands, Sept 18, 2001
63 % e-mail: fd0@donck.com
64 %
65 % fixed some minor issues:
66 %   real arithmetic will use integer intermediate values, so
67 %   some calculations failed with the \Fee{title}{rate}{amount}
68 %   where \rate is not an integer
69 %
70 %   another fix is that in my opinion the VAT line should be 
71 %   printed also even though only one project is specified
72 %
73 %   third fix is that the subtotal-line should not be printed 
74 %   on a project with only one \Fee line
75 %
76 %%%%%%
77 % Jacco Kok (fixed some labels),
78 %
79 %%%%%%
80 % Thilo Barth (discussed alternative names and command clashes
81 %       with KOMA Script class scrlettr.cls),
82 %
83 %%%%%%
84 % Robert Inder (discussed general issues)
85 %
86 % were gladly and gratefully received and accepted.
87 %
88 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
89 % -------------------     identification     -------------------
90 %
91 \NeedsTeXFormat{LaTeX2e}
92 \ProvidesPackage{invoice}[2003/12/16]
93 %
94 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
95 % -------------------    language options    -------------------
96 %
97 %
98 \newcount\invoice@language
99 \let\invoice@language=\language
100 %
101 \ifx\l@english\undefined        \newlanguage\l@english \fi
102 \ifx\l@german\undefined         \newlanguage\l@german \fi
103 \ifx\l@dutch\undefined          \newlanguage\l@dutch \fi
104 \ifx\l@french\undefined         \newlanguage\l@french \fi
105 \ifx\l@afrikaans\undefined      \newlanguage\l@afrikaans \fi
106 \ifx\l@italian\undefined        \newlanguage\l@italian \fi
107 %
108 \DeclareOption{english}{\invoice@language=\number\l@english}
109 \DeclareOption{german}{\invoice@language=\number\l@german}
110 \DeclareOption{dutch}{\invoice@language=\number\l@dutch}
111 \DeclareOption{french}{\invoice@language=\number\l@french}
112 \DeclareOption{afrikaans}{\invoice@language=\number\l@afrikaans}
113 \DeclareOption{italian}{\invoice@language=\number\l@italian}
114 %
115 \ProcessOptions
116 %
117 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
118 % -------------------      initial code      -------------------
119 %
120 \RequirePackage{ifthen}
121 \RequirePackage{longtable}
122 \RequirePackage{calc}
123 \input{realcalc}
124 \input{invoice.def}
125 %
126 \newcommand{\InvoiceVersion}{0.7}%
127 \newcounter{Fee}                %
128 \newcounter{VAT}                %
129 %\newcounter{VAT@rate}          %
130 \newcounter{Expenses}           %
131 \newcounter{Discount}           % Discount item
132 \newcounter{Total}              %
133 \newcounter{Project}            %
134 %
135 \newcounter{Fee@ctr}            % Number of fees per project
136                                 % no subtotal will be printed in case of
137                                 % value < 2
138 %
139 \newcounter{Expense@ctr}        % Number of expense items per project
140                                 % no subtotal will be printed in case of
141                                 % value < 2
142 %
143 \newcounter{One@Fee}            % Individual Fee
144 \newcounter{One@VAT}            % Individual VAT
145 \newcounter{One@Expense}        % Individual Expense
146 %
147 \newcounter{ST@Fee}             % Subtotal Fee
148 \newcounter{ST@VAT}             % Subtotal VAT
149 \newcounter{ST@Expenses}        % Subtotal Expenses
150 \newcounter{ST@Project}         % Subtotal Project
151 %
152 \gdef\Flag{0}%                  % State 0: Invoice not started yet
153                                 % State 1: Start invoice
154                                 % State 2: Start project, print title
155                                 % State 3: Fee Item
156                                 % State 4: Print Subtotal Fee
157                                 % State 5: Expense Item
158                                 % State 6: Print Subtotal Expenses
159                                 % State 7: Print Subtotal Project
160                                 % State 8: Print Total, Close invoice
161 %
162 \gdef\Project{}%                % Empty Project Name
163 \def\Null{0}%
164 \newif\ifVATnonzero
165 % \def\BC{Euro}
166 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
167 %\newcommand{\my@message}[1]{\message{^^J#1^^J^^J}}
168 \newcommand{\error@message}[1]{\errmessage{^^J\Error: #1^^J^^J}}
169 \newcommand{\warning@message}[1]{\message{^^J\Warning: #1^^J^^J}}
170 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
171 \ifx\invoice\undefined                  % False if KOMA Script scrlettr.cls
172         \def\my@invoice{invoice}        % loaded. In this case one may say
173 \else                                   % "invoice". If true, the environ-
174         \def\my@invoice{invoiceenv}     % ment is renamed to "invoiceenv"
175         \let\invoiceno\invoice          % and the scrlettr macro is renamed
176         \def\invoice#1{%                % to "invoiceno". Thank you, Thilo,
177                 \error@message{\KOMA}}  % for this hint!
178 \fi                                     %
179 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
180 \newenvironment{\my@invoice}[2]{%
181         \setcounter{Fee@ctr}{0}%                % reset counter
182         \setcounter{Expense@ctr}{0}%            % reset counter
183         \def\Null{0}%
184         \setcounter{Project}{0}%
185         \ST@Reset\Total@Reset%
186         \def\BC{#1}%
187         \def\VAT@rate{#2}%
188         \ifx\VAT@rate\Null\VATnonzerofalse\else\VATnonzerotrue\fi%
189         \ifVATnonzero
190                 \message{^^J^^JVAT is not zero!^^J^^J}%
191         \else
192                 \message{^^J^^JVAT is zero!^^J^^J}%
193         \fi%
194         % The VAT is: \the\VAT@rate % Debugging Diagnostics only
195         \parindent=0cm%
196         \ifcase\Flag % 0: Invoice not started yet
197                 %
198                 \gdef\Flag{1}%
199                 \begin{center}%
200                 \begin{longtable}{p{5cm}lrrr}%
201                 %
202         \else \error@message{\NoInvoiceNesting}%
203         \fi}%
204 % At the end of environment: 
205 % Yields state 8->0, Close and complete invoice, finish tables, etc.
206 {% 
207         \ifcase\Flag % 0: Invoice not started yet
208                 %
209                 \error@message{\MissingOpening}%
210                 %
211         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
212         \or     % 1: Start invoice
213                 %
214                 \error@message{\MissingProject}%
215                 %
216         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
217         \or     % 2: Start project, print title
218                 %
219                 \error@message{\MissingInputData}%
220                 %
221         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
222         \or     % 3: Print remuneration item
223                 %
224                 \ifnum\theProject>0 \ST@Fee\ST@Project\fi%
225                 \Tot@l%
226                 %
227         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
228         \or     % 4: Print subtotal remuneration
229                 %
230                 \ifnum\theProject>1 \ST@Project\fi%
231                 \Tot@l%
232                 %
233         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
234         \or     % 5: Expense item
235                 %
236                 \ifnum\theProject>1 \ST@Expenses\ST@Project\fi%
237                 \Tot@l%
238                 %
239         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
240         \or     % 6: Print subtotal expenses
241                 %
242                 \ifnum\theProject>1 \ST@Project\fi%
243                 \Tot@l%
244                 %
245         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
246         \or     % 7: Print subtotal project
247                 %
248                 \Tot@l%
249                 %
250         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
251         \or     % 8: Print total, close invoice
252                 %
253                 \warning@message{\InvoiceCompleted}%
254                 %
255         \else \error@message{\InternalError}%
256         \fi%
257         \gdef\Flag{0}%
258 }%
259 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
260 \newcommand{\ProjectTitle}[1]{% Yields state 2: Start Project
261         %\gdef\NewProject{#1}
262         %
263         \ifcase\Flag% 0: Invoice not started yet
264         %
265         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
266         \or     % 1: Start invoice
267                 %
268                 \Project@Title{#1}%
269                 %
270         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
271         \or     % 2: Start project, print title
272                 %
273                 \error@message{\NoProjectNesting}%
274                 %
275         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
276         \or     % 3: Print remuneration item
277                 %
278                 \ST@Fee%
279                 \ST@Project%
280                 \Project@Title{#1}%
281                 %
282         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
283         \or     % 4: Print subtotal remuneration
284                 %
285                 \ST@Project%
286                 \Project@Title{#1}%
287                 %
288         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
289         \or     % 5: Expense item
290                 %
291                 \ST@Expenses%
292                 \ST@Project%
293                 \Project@Title{#1}%
294                 %
295         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
296         \or     % 6: Print subtotal expenses
297                 %
298                 \ST@Project%
299                 \Project@Title{#1}%
300                 %
301         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
302         \or     % 7: Print subtotal project
303                 %
304                 \Project@Title{#1}%
305                 %
306         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
307         \or     % 8: Print total, close invoice
308                 %
309                 \error@message{\InvoiceCompletedNoProject}%
310                 %
311         \else \error@message{\InternalError}%
312         \fi%
313         \setcounter{Fee@ctr}{0}%                % reset counter
314         \setcounter{Expense@ctr}{0}%            % reset counter
315 }
316 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
317 \newcommand{\Fee}[3]{% Yields state 3, Print Fee Item
318         %
319         % #1 Contents
320         % #2 Fee per Unit
321         % #3 Unit Count
322         %
323         \ifcase\Flag % 0: Invoice not started yet
324                 \error@message{\MissingOpening}%
325                 %
326         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
327         \or     % 1: Start invoice
328                 %
329                 \error@message{\MissingProject}%
330                 %
331         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
332         \or     % 2: Start project, print title
333                 %
334                 \Fee@Title%
335                 \Fee@Line{#1}{#2}{#3}%
336                 %
337         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
338         \or     % 3: Print remuneration item
339                 %
340                 \Fee@Line{#1}{#2}{#3}%
341                 %
342         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
343         \or     % 4: Print subtotal remuneration
344                 %
345                 \warning@message{\FeeSTExists}%
346                 %
347         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
348         \or     % 5: Expense item
349                 %
350                 \error@message{\FeeBeforeExpense}%
351                 %
352         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
353         \or     % 6: Print subtotal expenses
354                 %
355                 \error@message{\FeeBeforeExpense}%
356                 %
357         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
358         \or     % 7: Print subtotal project
359                 %
360                 \error@message{\ProjectCompletedNoFee}%
361                 %
362         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
363         \or     % 8: Print total, close invoice
364                 %
365                 \error@message{\InvoiceCompletedNoFee}%
366                 %
367                 %
368         \else \error@message{\InternalError}%
369         \fi%
370 }%
371 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
372 \newcommand{\STFee}{% Yields state 4, print subtotal remuneration
373         %
374         \ifcase\Flag % 0: Invoice not started yet
375                 %
376                 \error@message{\MissingOpening}%
377                 %
378         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
379         \or     % 1: Start invoice
380                 %
381                 \error@message{\MissingProject}%
382                 %
383         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
384         \or     % 2: Start project, print title
385                 %
386                 \error@message{\MissingFee}%
387                 %
388         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
389         \or     % 3: Print remuneration item
390                 %
391                 \Print@ST@Fees%
392                 %
393         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
394         \or     % 4: Print subtotal remuneration
395                 %
396                 \warning@message{\FeeSTExists}%
397                 %
398         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
399         \or     % 5: Expense item
400                 %
401                 \error@message{\FeeBeforeExpense}%
402                 %
403         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
404         \or     % 6: Print subtotal expenses
405                 %
406                 \error@message{\FeeBeforeExpense}%
407                 %
408         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
409         \or     % 7: Print subtotal project
410                 %
411                 \error@message{\ProjectCompletedNoFee}%
412                 %
413         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
414         \or     % 8: Print total, close invoice
415                 %
416                 \error@message{\ProjectCompletedNoFee}%
417                 %
418         \else \error@message{\InternalError}%
419         \fi%
420 }%
421 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
422 \newcommand{\EBC}[2]{% Yields state 5: Expenses in BaseCurrency 
423         %
424         % #1 Contents und Datum
425         % #2 Amount in BaseCurrency
426         %
427         \ifcase\Flag % 0: Invoice not started yet
428                 %
429                 \error@message{\MissingOpening}%
430                 %
431         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
432         \or     % 1: Start invoice
433                 %
434                 \error@message{\MissingProject}%
435                 %
436         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
437         \or     % 2: Start project, print title
438                 %
439                 \Expense@Title%
440                 \Expense@BaseCurrency{#1}{#2}%
441                 %
442         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
443         \or     % 3: Print remuneration item
444                 %
445                 \ST@Fee%
446                 \Expense@Title%
447                 \Expense@BaseCurrency{#1}{#2}%
448                 %
449         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
450         \or     % 4: Print subtotal remuneration
451                 %
452                 \Expense@Title%
453                 \Expense@BaseCurrency{#1}{#2}%
454                 %
455         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
456         \or     % 5: Expense item
457                 %   
458                 \Expense@BaseCurrency{#1}{#2}%
459                 %
460         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
461         \or     % 6: Print subtotal expenses
462                 %
463         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
464         \or     % 7: Print subtotal project
465                 %
466         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
467         \or     % 8: Print total, close invoice
468                 %
469                 \error@message{\InvoiceCompletedNoExpense}%
470                 %
471         \else \error@message{\InternalError}%
472         \fi%
473 }%
474 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
475 \newcommand{\EBCi}[2]{% Yields state 5: Expenses in BaseCurrency 
476         %                               But, unlike base form (no
477         %                               'invisible') this version does
478         %                               not state the item, it only
479         %                               the total amount of expenses. 
480         %
481         % #1 Contents und Datum
482         % #2 Amount in BaseCurrency
483         %
484         \ifcase\Flag % 0: Invoice not started yet
485                 %
486                 \error@message{\MissingOpening}%
487                 %
488         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
489         \or     % 1: Start invoice
490                 %
491                 \error@message{\MissingProject}%
492                 %
493         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
494         \or     % 2: Start project, print title
495                 %
496                 %\Expense@Title%
497                 \Expense@Base@Currency{#1}{#2}%
498                 %
499         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
500         \or     % 3: Print remuneration item
501                 %
502                 \ST@Fee%
503                 %\Expense@Title%
504                 \Expense@Base@Currency{#1}{#2}%
505                 %
506         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
507         \or     % 4: Print subtotal remuneration
508                 %
509                 %\Expense@Title%
510                 \Expense@Base@Currency{#1}{#2}%
511                 %
512         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
513         \or     % 5: Expense item
514                 %   
515                 \Expense@Base@Currency{#1}{#2}%
516                 %
517         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
518         \or     % 6: Print subtotal expenses
519                 %
520         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
521         \or     % 7: Print subtotal project
522                 %
523         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
524         \or     % 8: Print total, close invoice
525                 %
526                 \error@message{\InvoiceCompletedNoExpense}%
527                 %
528         \else \error@message{\InternalError}%
529         \fi%
530 }%
531 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
532 \newcommand{\EFC}[5]{% Yields state 5: Expenses in ForeignCurrency
533         %
534         % #1 Contents und Datum
535         % #2 Currency
536         % #3 Amount
537         % #4 Exchange Rate
538         % #5 Amount Zielwaehrung
539         %
540         % Usage:
541         % 1. {Contents}{ForeignCurrency}{ExchangeRate}{}
542         % 2. {Contents}{ForeignCurrency}{}{BaseCurrency}
543         % 3. {Contents}{ForeignCurrency}{ExchangeRate}{BaseCurrency}
544         %
545         \ifcase\Flag % 0: Invoice not started yet
546                 %
547                 \error@message{\MissingOpening}%
548                 %
549         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
550         \or     % 1: Start invoice
551                 %
552                 \error@message{\MissingProject}%
553                 %
554         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
555         \or     % 2: Start project, print title
556                 %
557                 \Expense@Title%
558                 \Expense@ForeignCurrency{#1}{#2}{#3}{#4}{#5}%
559                 %
560         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
561         \or     % 3: Print remuneration item
562                 %
563                 \ST@Fee%
564                 \Expense@Title%
565                 \Expense@ForeignCurrency{#1}{#2}{#3}{#4}{#5}%
566                 %
567         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
568         \or     % 4: Print subtotal remuneration
569                 %
570                 \Expense@Title%
571                 \Expense@ForeignCurrency{#1}{#2}{#3}{#4}{#5}%
572                 %
573         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
574         \or     % 5: Expense item
575                 %
576                 \Expense@ForeignCurrency{#1}{#2}{#3}{#4}{#5}%
577                 %
578         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
579         \or     % 6: Print subtotal expenses
580                 %
581                 \error@message{\ProjectCompletedNoExpense}%
582                 %
583         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
584         \or     % 7: Print subtotal project
585                 %
586                 \error@message{\ProjectCompletedNoExpense}%
587                 %
588         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
589         \or     % 8: Print total, close invoice
590                 %
591                 \error@message{\InvoiceCompletedNoExpense}%
592                 %
593         \else \error@message{\InternalError}%
594         \fi%
595 }%
596 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
597 \newcommand{\EFCi}[5]{% Yields state 5: Expenses in ForeignCurrency
598         %                               But, unlike base form (no
599         %                               'invisible') this version does
600         %                               not state the item, it only
601         %                               the total amount of expenses. 
602         %
603         % #1 Contents und Datum
604         % #2 Currency
605         % #3 Amount
606         % #4 Exchange Rate
607         % #5 Amount Zielwaehrung
608         %
609         % Usage:
610         % 1. {Contents}{ForeignCurrency}{ExchangeRate}{}
611         % 2. {Contents}{ForeignCurrency}{}{BaseCurrency}
612         % 3. {Contents}{ForeignCurrency}{ExchangeRate}{BaseCurrency}
613         %
614         \ifcase\Flag % 0: Invoice not started yet
615                 %
616                 \error@message{\MissingOpening}%
617                 %
618         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
619         \or     % 1: Start invoice
620                 %
621                 \error@message{\MissingProject}%
622                 %
623         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
624         \or     % 2: Start project, print title
625                 %
626                 \Expense@Title%
627                 \Expense@Foreign@Currency{#1}{#2}{#3}{#4}{#5}%
628                 %
629         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
630         \or     % 3: Print remuneration item
631                 %
632                 \ST@Fee%
633                 % \Expense@Title%
634                 \Expense@Foreign@Currency{#1}{#2}{#3}{#4}{#5}%
635                 %
636         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
637         \or     % 4: Print subtotal remuneration
638                 %
639                 % \Expense@Title%
640                 \Expense@Foreign@Currency{#1}{#2}{#3}{#4}{#5}%
641                 %
642         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
643         \or     % 5: Expense item
644                 %
645                 \Expense@Foreign@Currency{#1}{#2}{#3}{#4}{#5}%
646                 %
647         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
648         \or     % 6: Print subtotal expenses
649                 %
650                 \error@message{\ProjectCompletedNoExpense}%
651                 %
652         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
653         \or     % 7: Print subtotal project
654                 %
655                 \error@message{\ProjectCompletedNoExpense}%
656                 %
657         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
658         \or     % 8: Print total, close invoice
659                 %
660                 \error@message{\InvoiceCompletedNoExpense}%
661                 %
662         \else \error@message{\InternalError}%
663         \fi%
664 }%
665 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
666 \newcommand{\STExpenses}{% Yields state 6: Ausgabe der ST Expenses
667         %
668         \ifcase\Flag % 0: Invoice not started yet
669                 %
670                 \error@message{\MissingOpening}%
671                 %
672         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
673         \or     % 1: Start invoice
674                 %
675                 \error@message{\MissingProject}%
676                 %
677         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
678                 %
679         \or     % 2: Start project, print title
680                 %
681         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
682                 %
683         \or     % 3: Print remuneration item
684                 %
685         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
686                 %
687         \or     % 4: Print subtotal remuneration
688                 %
689         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
690         \or     % 5: Expense item
691                 %
692                 \Print@ST@Expenses%
693                 %
694         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
695         \or     % 6: Print subtotal expenses
696                 %
697                 \warning@message{\ProjectCompletedNoExpense}%
698                 %
699         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
700         \or     % 7: Print subtotal project
701                 %
702         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
703         \or     % 8: Print total, close invoice
704                 %
705                 \error@message{\InvoiceCompletedNoExpense}%
706                 %
707         \else \error@message{\InternalError}%
708         \fi%
709 }%
710 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
711 \newcommand{\STProject}{% Yields state 7: Ausgabe der ST Project
712         %
713         \ifcase\Flag % 0: Invoice not started yet
714                 %
715                 \error@message{\MissingOpening}%
716                 %
717         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
718         \or     % 1: Start invoice
719                 %
720                 \error@message{\MissingProject}%
721                 %
722         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
723         \or     % 2: Start project, print title
724                 %
725                 \warning@message{\ProjectEmpty}%
726                 %
727         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
728         \or     % 3: Print remuneration item
729                 %
730                 \ST@Fee%
731                 \ST@Project%
732                 %
733         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
734         \or     % 4: Print subtotal remuneration
735                 %
736                 \ST@Project%
737                 %
738         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
739         \or     % 5: Expense item
740                 %
741                 \ST@Expenses%
742                 \ST@Project%
743                 %
744         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
745         \or     % 6: Print subtotal expenses
746                 %
747                 \ST@Project%
748                 %
749         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
750         \or     % 7: Print subtotal project
751                 %
752                 \warning@message{\ProjectSTExists}%
753                 %
754         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
755         \or     % 8: Print total, close invoice
756                 %
757                 \error@message{\InvoiceCompletedNoProjectST}%
758                 %
759         \else \error@message{\InternalError}%
760         \fi%
761 }%
762 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
763 \newcommand{\Discount}[2]{%     Yields no particular state.
764         %                       Inserts discount in project total,
765         %                       names discount reason
766         %                       and amount of discount
767         %
768         \gdef\Discount@Contents{#1}%
769         \setcounter{Discount}{100 * \real{-#2}}%
770 }%
771 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
772 \newcommand{\Total@Reset}{%
773         \setcounter{Fee}{0}%
774         \setcounter{VAT}{0}%
775         \setcounter{Expenses}{0}%
776         \setcounter{Total}{0}%
777 }%
778 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
779 \newcommand{\ST@Reset}{%
780         \setcounter{ST@Fee}{0}%
781         \setcounter{ST@VAT}{0}%
782         \setcounter{ST@Expenses}{0}%
783         \setcounter{ST@Project}{0}%
784 }%
785 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
786 \newcommand{\Print@Value}[1]{%
787         \Rmul\r#1{0.01}%% <- Reduce to BaseCurrency
788         \Rtrunc\r{2}\r% % <- Truncate to two digits
789         \r%             % <- Output data!
790 }%
791 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
792 \newcommand{\Message@Value}[1]{%
793         \Rmul\r#1{0.01}%% <- Reduce to BaseCurrency
794         \Rtrunc\r{2}\r% % <- Truncate to two digits
795         \message{\r}%   % <- Output data!
796 }%
797 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
798 \newcommand{\Project@Title}[1]{%
799         % Internal command called by \ProjectTitle.
800         %
801         \gdef\Flag{2}%
802         \gdef\Project{#1}%
803         \ST@Reset\addtocounter{Project}{1}%
804         \ifnum\theProject>1 \\\\\else\\\fi%
805         \multicolumn{5}{c}{\textbf{\large#1}}\\%
806 }%
807 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
808 \newcommand{\Fee@Title}{%
809         \\
810         \noindent\textbf{\Activity}&&\UnitRate&\Count&\Amount\ (\BC)\\
811         \hline%
812 }%
813 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
814 \newcommand{\Fee@Line}[3]{%
815         %
816         % #1 Contents
817         % #2 Charged Fee per Unit
818         % #3 Count
819         %
820         % Internal command, called by \Fee.
821         %
822         \gdef\Flag{3}%
823         %
824         #1                      &       &#2     &#3 &
825 %
826 %   next is reversed to allow real arithmetic.
827 %   intermediate results are stored in integer format, so calculations are
828 %   incorrect in case #2 is a real.
829 %   fixed by exchanging the 1 and the 100
830 %
831                 \setcounter{One@Fee}{100 * \real{#2} * \real{#3} * 1}%
832 %
833                 \addtocounter{ST@Fee}{\theOne@Fee}%
834                 \addtocounter{Fee}{\theOne@Fee}%
835                 \addtocounter{Fee@ctr}{1}%          increase counter with 1
836                 \Print@Value{\theOne@Fee}\\%
837 }%
838 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
839 \newcommand{\ST@Fee}{%
840         % \gdef\Flag{4}%
841         \ifnum\theST@Fee>0%
842             \ifthenelse{\theFee@ctr>1} %            % if more than 1 \Fee line
843                 {\Print@ST@Fees%                                        % print it, else
844                 }%
845             {}%                                                                 % do nothing
846                 \ifVATnonzero\ST@VAT@Printout\fi%
847         \fi%
848 }%
849 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
850 \newcommand{\Print@ST@Fees}{%
851         \gdef\Flag{4}%
852         \SubtotalFee &  &       &       &%      print the subtotal of fees
853                 \Print@Value{\theST@Fee}\\%
854 }%
855 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
856 \newcommand{\ST@VAT@Printout}{%
857                 \VAT\ (\VAT@rate\%)      &      &       &       &%
858                         \setcounter{ST@VAT}{\theST@Fee * \real{\VAT@rate} / 100}%
859                                 \Print@Value{\theST@VAT}\\%
860 }%
861 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
862 \newcommand{\Expense@BaseCurrency}[2]{%
863         #1                      & \BC           &       &       &%
864         \gdef\Flag{5}%
865         \Rmul\r{100}{#2}%
866         \setcounter{One@Expense}{1*\real{\r}}%
867         \addtocounter{ST@Expenses}{\theOne@Expense}%
868         \addtocounter{Expenses}{\theOne@Expense}%
869         \addtocounter{Expense@ctr}{1}%advance counter
870                                 \Print@Value{\theOne@Expense}\\%
871 }%
872 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
873 \newcommand{\Expense@Base@Currency}[2]{%
874         \gdef\Flag{5}%
875         \Rmul\r{100}{#2}%
876         \setcounter{One@Expense}{1*\real{\r}}%
877         \addtocounter{ST@Expenses}{\theOne@Expense}%
878         \addtocounter{Expenses}{\theOne@Expense}%
879         \addtocounter{Expense@ctr}{1}%advance counter
880                 &       &       &       &       \\[-1.2em]% This is an ugly kludge:
881                                                                   %     Inserting an empty line
882                                                                   % which rolls backwards
883                                                                   % makes disappear the spurious
884                                                                   % spaces caused by external
885                                                                   % routines.
886 }%
887 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
888 \newcommand{\Expense@ForeignCurrency}[5]{%
889         \gdef\Flag{5}%
890         %
891         % Folgende Angaben sind moeglich:
892         % 1. {Contents}{Currency}{Amount}{Umrechnung}{  }
893         % 2. {Contents}{Currency}{Amount}{          }{BaseCurrency}
894         % 3. {Contents}{Currency}{Amount}{Umrechnung}{BaseCurrency}
895         %
896         #1       & #2   & #3    & #4&%
897         \ifthenelse{\equal{#5}{}}% Target in BaseCurrency or not?
898                 {% Target not in BaseCurrency
899                         \Rmul\r{100}{#3}%
900                         \Rmul\r \r {#4}%
901                 }%
902                 {% Target in BaseCurrency
903                         \Rmul\r{100}{#5}%
904                 }%
905         \setcounter{One@Expense}{1*\real{\r}}%
906         \addtocounter{ST@Expenses}{\theOne@Expense}%
907         \addtocounter{Expenses}{\theOne@Expense}%
908         \addtocounter{Expense@ctr}{1}%advance counter
909         \Print@Value{\theOne@Expense}%
910 \\%
911 }%
912 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
913 \newcommand{\Expense@Foreign@Currency}[5]{%
914         \gdef\Flag{5}%
915         %
916         % Folgende Angaben sind moeglich:
917         % 1. {Contents}{Currency}{Amount}{Umrechnung}{  }
918         % 2. {Contents}{Currency}{Amount}{          }{BaseCurrency}
919         % 3. {Contents}{Currency}{Amount}{Umrechnung}{BaseCurrency}
920         %
921         \ifthenelse{\equal{#5}{}}% Target in BaseCurrency or not?
922                 {% Target not in BaseCurrency
923                         \Rmul\r{100}{#3}%
924                         \Rmul\r\r{#4}%
925                 }%
926                 {% Target in BaseCurrency
927                         \Rmul\r{100}{#5}%
928                 }%
929         \setcounter{One@Expense}{1*\real{\r}}%
930         \addtocounter{ST@Expenses}{\theOne@Expense}%
931         \addtocounter{Expenses}{\theOne@Expense}%
932         \addtocounter{Expense@ctr}{1}%advance counter
933                 &       &       &       &       \\[-1.2em]% ugly kludge as above
934 }%
935 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
936 \newcommand{\Expense@Title}{%
937         \\%
938         \textbf{\Expense}&\Currency&\Amount&\Factor &\BC\\%
939         \hline%
940 }%
941 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
942 \newcommand{\ST@Expenses}{%
943         % \gdef\Flag{6}%
944         \ifnum\theST@Expenses>0%
945             \ifthenelse{\theExpense@ctr>1}%         % if more than 1 Expense line
946                 {\Print@ST@Expenses}%                           % print it, else
947                 {}%                                                                     % do nothing
948         \fi%
949 }%
950 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
951 \newcommand{\Print@ST@Expenses}{%
952         \gdef\Flag{6}%
953                 &       &       &       &       \\[-1.2em]% ugly kludge as above
954         \SubtotalExpenses &     &       &       &%      print the subtotal of expenses
955                 \Print@Value{\theST@Expenses}\\%
956 }%
957 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
958 \newcommand{\ST@Project}{%
959         \gdef\Flag{7}%
960         \\
961         %\multicolumn{4}{l}{\SubtotalProject}%
962         %\let\Project\NewProject%
963         %&
964         \SubtotalProject &      &       &       & 
965                         \addtocounter{ST@Project}{\theST@Fee}%
966                         \addtocounter{ST@Project}{\theST@VAT}%
967                         \addtocounter{ST@Project}{\theST@Expenses}%
968                         \Print@Value{\theST@Project}\\
969 }
970 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
971 \newcommand{\Total@VAT@Printout}{%
972                 \setcounter{VAT}{\theFee*\real{\VAT@rate}/100}%
973                         \SumVAT &       &       &       &\Print@Value{\theVAT}\\%
974 }%
975 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
976 \newcommand{\Tot@l}{%
977         \\\hline
978         \ifnum\theFee>0 \SumFees&       &       &       &%
979                                 \Print@Value{\theFee}\\ 
980                 \ifVATnonzero%
981                         \Total@VAT@Printout%
982                 \fi%
983         \fi%
984         \ifnum\theExpenses>0 \SumExpenses&      &       &       &%
985                                 \Print@Value{\theExpenses}\\ 
986         \fi%
987         \ifnum\theDiscount=0 \else \Discount@Contents&  &       &       &%
988                                 \Print@Value{\theDiscount}\\ 
989         \fi%
990         \hline\hline
991         \textbf{\Total} &       &       &       &%
992                 \message{^^J\Currency: \BC}%
993                 \message{^^J\VAT: \VAT@rate}%
994                 \addtocounter{Total}{\theFee}%
995                 \message{^^J\SumFees: }\Message@Value{\theFee}%
996                 \addtocounter{Total}{\theVAT}%
997                 \message{^^J\SumVAT: }\Message@Value{\theVAT}%
998                 \addtocounter{Total}{\theExpenses}%
999                 \message{^^J\SumExpenses: }\Message@Value{\theExpenses}%
1000                 \ifnum\theDiscount=0 \else %
1001                 \addtocounter{Total}{\theDiscount}%
1002                 \message{^^J\Discount@Contents: }\Message@Value{\theDiscount}%
1003                 \fi %
1004                 \textbf{\Print@Value{\theTotal}}%
1005                 \message{^^J\Total: }%
1006                         \Message@Value{\theTotal}\message{^^J^^J}\\%
1007         \end{longtable}
1008         \end{center}
1009         \gdef\Flag{8}%
1010 }
1011 \endinput
1012 % vim:ts=4:sw=4