File: latex.c

package info (click to toggle)
dtaus 0.7-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, lenny
  • size: 156 kB
  • ctags: 131
  • sloc: ansic: 1,408; makefile: 76
file content (116 lines) | stat: -rw-r--r-- 3,224 bytes parent folder | download | duplicates (2)
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
/*
    latex.c - Belegloser Datentr�geraustausch mit einer Bank
    Copyright (c) 2004  Martin Schulze <joey@infodrom.org>

    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, write to the Free Software
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.

    $Id: latex.c,v 1.1 2004/08/06 20:21:28 joey Exp $
 */

#include <stdio.h>
#include "bigint.h"

#define LATEX_HEADER	"%% Automatically generated by dtaus, requires dtaus.cls from the\n\
%% source distribution or derivative class.\n\
%%\n\
\\documentclass{dtaus}\n\
\n\
\\begin{document}\n\
\n\
\\header\n\
\n\
\\headline{Begleitzettel}\n\
\n\
\\subheadline{Belegloser Datentr�geraustausch}\n\
"

#define LATEX_FOOTER	"\\vfill\n\
\n\
\\signature\n\
\n\
\\footer\n\
\n\
\\end{document}\n\
"

#define LATEX_TYPE	"\\subheadline{%s}\n\n"

#define LATEX_TAB_BEGIN	"\\begin{tabular}{l@{ : }l}\n"
#define LATEX_TAB_END	"\\end{tabular}\n\n"
#define LATEX_TAB_ROW	"\\tabline{%s}{%s}\n"

void generate_latex_receipt (
			     char *fname,
			     char *type,
			     char *created,
			     char *todo,
			     char *currency,
			     int quantity,
			     char *sum_val,
			     char *sum_kto,
			     char *sum_blz,
			     char *kto,
			     char *blz
			     )
{
  FILE *f;
  char tmp[10];

  if (!(f = fopen(fname, "w"))) {
    fprintf (stderr, "Cannot open LaTeX output file %s, ignoring.\n", fname);
    return;
  }

  /* fopen() */
  fprintf (f, LATEX_HEADER);
  fprintf (f, LATEX_TYPE, type);

  fprintf (f, LATEX_TAB_BEGIN);
  fprintf (f, LATEX_TAB_ROW, "VOL", "");
  fprintf (f, LATEX_TAB_ROW, "Erstellungsdatum", created);
  if (todo)
    fprintf (f, LATEX_TAB_ROW, "Ausf�hrugsdatum", todo);
  fprintf (f, LATEX_TAB_ROW, "W�hrung", currency);
  snprintf (tmp, sizeof (tmp), "%d", quantity);
  fprintf (f, LATEX_TAB_ROW, "Anzahl", tmp);
  fprintf (f, LATEX_TAB_ROW, "Summe", sum_val);
  fprintf (f, LATEX_TAB_ROW, "Kontrollsumme Kontonummern", sum_kto);
  fprintf (f, LATEX_TAB_ROW, "Kontrollsumme Bankleitzahlen", sum_blz);
  fprintf (f, LATEX_TAB_ROW, "Unsere Kontonummer", kto);
  fprintf (f, LATEX_TAB_ROW, "Unsere Bankleitzahl", blz);
  fprintf (f, LATEX_TAB_END);

  fprintf (f, LATEX_FOOTER);

  fclose (f);
}

/* --------------------
\subheadline{Sammeleinziehungsauftrag}

\begin{tabular}{l@{ : }l}
\tabline{VOL}{}
\tabline{Erstellungsdatum}{05.08.04}
\tabline{Ausf�hrugsdatum}{24.12.2001}
\tabline{W�hrung}{Euro}
\tabline{Anzahl}{2}
\tabline{Summe}{50.00}
\tabline{Kontrollsumme Kontonummern}{2469134}
\tabline{Kontrollsumme Bankleitzahlen}{94221630}
\tabline{Unsere Kontonummer}{0000123545}
\tabline{Unsere Bankleitzahl}{02004002}
\end{tabular}
-------------------- */