From: Joey Schulze Date: Fri, 6 Aug 2004 20:23:12 +0000 (+0000) Subject: Added support for the 'Begleitzettel' via LaTeX document X-Git-Url: https://git.infodrom.org/?p=infodrom%2Fdtaus;a=commitdiff_plain;h=97e6d21c2a53ea3474aaa4b6c0a042706f027df2 Added support for the 'Begleitzettel' via LaTeX document --- diff --git a/dtaus.c b/dtaus.c index f9eb30b..69177f8 100644 --- a/dtaus.c +++ b/dtaus.c @@ -27,6 +27,7 @@ #include #include #include +#include "latex.h" #define DEFAULT_EURO #ifndef DEFAULT_EURO @@ -1119,7 +1120,7 @@ void dtaus2control (char *cdtaus, char *ccontrol) fclose(fdtaus); } -int control2dtaus (char *ccontrol, char *cdtaus, char *cbeleg, char *ccheck) +int control2dtaus (char *ccontrol, char *cdtaus, char *cbeleg, char *ccheck, char *latex) { FILE *fdtaus, *fcontrol, *fbeleg, *fcheck; void *buf; @@ -1366,6 +1367,13 @@ int control2dtaus (char *ccontrol, char *cdtaus, char *cbeleg, char *ccheck) fprintf (fbeleg, "\n Unsere Bankleitzahl ........: %s\n", valA[A_BLZ]); fprintf (fbeleg, "\n\n\n\n\n __________________________________________________\n"); fprintf (fbeleg, " Ort, Datum Unterschrift\n"); + + if (latex) + generate_latex_receipt (latex, type, get_date(), date_todo, + currency, count, + ssum_val, ssum_kto, ssum_blz, + valA[A_KTO], valA[A_BLZ]); + for (recindex=0; recindex + + 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$ + */ + +#include +#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} +-------------------- */ + diff --git a/latex.h b/latex.h new file mode 100644 index 0000000..af771a5 --- /dev/null +++ b/latex.h @@ -0,0 +1,39 @@ +/* + latex.h - Datentraegeraustausch mit einer Bank + Copyright (c) 2004 Martin Schulze + + 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$ + */ + +#ifndef _LATEX_H_ +#define _LATEX_H_ + +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 + ); + +#endif /* _LATEX_H_ */