2 dtaus.c - Datenträgeraustausch mit einer Bank
3 Copyright (c) 1996,8 Martin Schulze <joey@artis.uni-oldenburg.de>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
31 * First: Some control structures
37 unsigned short int pos;
38 unsigned short int len;
50 dtaus_record recA[] = {
52 {"Name", 23, 27, REQ},
53 {"Konto", 60, 10, REQ},
55 {"Referenz", 70, 10, OPT},
56 {"Datum", 50, 6, IGN},
57 {"Euro", 127, 1, OPT},
70 dtaus_record recC[] = {
71 {"Name", 93, 27, REQ},
72 {"Konto", 21, 10, REQ},
74 {"Transaktion", 44, 5, REQ},
75 {"Betrag", 50, 11, REQ},
76 {"Zweck", 155, 27, REQ},
77 {"myName", 128, 27, OPT},
78 {"myKonto", 69, 10, OPT},
79 {"myBLZ", 61, 8, OPT},
80 {"Euro", 182, 1, IGN},
81 {"Text", 187, 29, OPT},
82 {"Extension", 216, 29, OPT},
100 dtaus_record recE[] = {
101 {"Anzahl", 10, 7, IGN},
102 {"Summe", 17, 13, IGN},
103 {"Kontos", 30, 17, IGN},
104 {"BLZs", 47, 17, IGN},
115 * Second: Some low level routines
118 size_t dtaus_nextrec (void **buf, FILE *f)
121 return fread(buf, 128, 1, f);
124 char *upcase(char *s)
130 for (cp=s,xp=x; *cp; cp++,xp++) {
131 if (strchr(" 0123456789.,&-/+*$%ABCDEFGHIJKLMNOPQRSTUVWXYZ",*cp)) {
133 } else if (strchr("abcdefghijklmnopqrstuvwxyz",*cp)) {
135 } else if (strchr ("üÜäÄöÖß", *cp)) {
137 case 'ü': *(xp++) = 'U'; *xp='E'; break;
138 case 'Ü': *(xp++) = 'U'; *xp='E'; break;
139 case 'ä': *(xp++) = 'A'; *xp='E'; break;
140 case 'Ä': *(xp++) = 'A'; *xp='E'; break;
141 case 'ö': *(xp++) = 'O'; *xp='E'; break;
142 case 'Ö': *(xp++) = 'O'; *xp='E'; break;
143 case 'ß': *(xp++) = 'S'; *xp='S'; break;
153 char *downcase(char *s)
158 memset (x, 0, sizeof (x));
167 char *strip_spaces (char *s)
172 for (i=strlen(s);(s[i-1] == ' '||s[i-1] == '\t')&&i>0; i--)
174 for (p=s; *p==' '; p++);
178 char *strip_zeros (char *s)
182 for (p=s; *p=='0'; p++);
186 char *strip_nondigits (char *s)
191 for (x=s,p=s;*x;*x++)
199 char dtaus_char (void *buf, unsigned int pos)
205 memcpy(&res, bufp, 1);
209 char *string2real(char *s)
215 strncpy(res, s, strlen(s)-2);
216 res[strlen(s)-2] = '.';
217 res[strlen(s)-1] = s[strlen(s)-2];
218 res[strlen(s)] = s[strlen(s)-1];
222 char *real2string(char *s)
228 for (cp=res; *cp&&!(*cp == ',')&&!(*cp == '.');cp++);
235 char *string2trans (char *s)
240 if (!strcmp(s, "04000"))
241 sprintf (res, "Abbuchung");
242 else if (!strcmp(s, "05000"))
243 sprintf (res, "Einzug");
244 else if (!strcmp(s, "05005"))
245 sprintf (res, "E-Cash");
246 else if (!strcmp(s, "05006"))
247 sprintf (res, "E-Cash-A");
248 else if (!strcmp(s, "51000"))
249 sprintf (res, "Gutschrift");
250 else if (!strcmp(s, "53000"))
251 sprintf (res, "Lohn");
252 else if (!strncmp(s, "5400", 4))
253 sprintf (res, "Vermögen");
254 /* else if (!strcmp(s, "56000"))
255 sprintf (res, ""); / * Überweisung öffentlicher Kassen */
259 char *trans2string (char *s)
264 if (!strcmp(s, "Abbuchung"))
265 sprintf (res, "04000");
266 else if (!strcmp(s, "Einzug"))
267 sprintf (res, "05000");
268 else if (!strcmp(s, "E-Cash"))
269 sprintf (res, "05005");
270 else if (!strcmp(s, "E-Cash-A"))
271 sprintf (res, "05006");
272 else if (!strcmp(s, "Gutschrift"))
273 sprintf (res, "51000");
274 else if (!strcmp(s, "Lohn"))
275 sprintf (res, "53000");
276 else if (!strncmp(s, "Vermögen", 4))
277 sprintf (res, "5400");
278 /* else if (!strcmp(s, ""))
279 sprintf (res, "56000"); / * Überweisung öffentlicher Kassen */
283 char *string2ext (char *s)
288 if (!strcmp(s, "01"))
289 sprintf (res, "Klient");
290 else if (!strcmp(s, "02"))
291 sprintf (res, "Text");
292 else if (!strcmp(s, "03"))
293 sprintf (res, "Auftraggeber");
297 char *ext2string (char *s)
302 if (!strcmp(s, "Klient"))
304 else if (!strcmp(s, "Text"))
306 else if (!strcmp(s, "Auftraggeber"))
311 unsigned long int dtaus_int(void *buf, unsigned int pos, unsigned int len)
315 static unsigned long int res;
318 memcpy(tmp, bufp, len);
320 sscanf(tmp, "%lu", &res);
325 * returns the first word in this line, returns it and shortens the
328 char *extract_ident (char *line)
331 static char word[30];
333 if (strlen(line) > 0) {
334 x = index (line, ' ');
335 y = index (line, '\t');
338 strncpy(word, line, 29);
343 /* Check which index returns the lower value, and check if the
345 if ((c = (x && x<y)?x:(y?y:x))) {
346 strncpy(word, line, c - line);
348 for (;*c == '\t' || *c == ' '; c++);
349 for (x=line; *c; c++,x++)
352 strcpy(word, downcase(word));
361 * Pads a string with zero's on the left side.
363 char *padzeroclip (char *s, int len)
367 if (strlen(s) == len) return s;
368 if (strlen(s) > len) {
376 for (p=s+strlen(s)-1;p>=s;p--)
378 for (;q>=s;) *(q--)='0';
382 int rec_index(char *ident, int type)
385 dtaus_record *rec = NULL;
388 case REC_A: rec = recA; break;
389 case REC_C: rec = recC; break;
390 case REC_E: rec = recE; break;
393 for (i=0; (rec[i].name); i++) {
394 if (!strcmp(ident, downcase(rec[i].name)))
401 size_t control_nextline (void **buf, int len, FILE *f)
408 bzero (line, sizeof(line));
412 while (!strlen(line) && (cp = fgets(line, 100, f))) {
414 if (line[0] != '#') {
415 if (line[strlen(line)-1] != '\n') {
417 while (tmp[strlen(tmp)-1] != '\n' && (cp = fgets(tmp, 100, f)));
419 line[strlen(line)-1] = '\0';
420 if (line[strlen(line)-1] == '
\r')
421 line[strlen(line)-1] = '\0';
422 for (i=strlen(line);(line[i-1] == ' '||line[i-1] == '\t')&&i>0; i--)
430 for (cp=line; *cp==' '; cp++);
433 memcpy(buf, cp, strlen(cp));
445 timer = time ( NULL );
446 loctime = localtime(&timer);
447 sprintf(res, "%02d.%02d.%02d", loctime->tm_mday, loctime->tm_mon+1, loctime->tm_year % 100);
451 void dtaus_prepareA(char *buf)
459 timer = time ( NULL );
460 loctime = localtime(&timer);
467 for (i=15;i<15+8; i++) buf[i] = '0';
468 sprintf(tmp, "%02d%02d%02d", loctime->tm_mday, loctime->tm_mon+1, loctime->tm_year % 100);
469 for (i=0; i<6; i++) buf[50+i] = tmp[i];
470 for (i=56;i<56+4; i++) buf[i] = ' ';
471 for (i=70;i<70+10; i++) buf[i] = '0';
472 for (i=80;i<80+48; i++) buf[i] = ' ';
475 void dtaus_prepareC(char *buf)
485 for (i=31;i<31+13; i++) buf[i] = '0';
487 for (i=79;i<79+11; i++) buf[i] = '0';
488 for (i=90;i<90+3; i++) buf[i] = ' ';
489 for (i=120;i<120+8; i++) buf[i] = ' ';
490 for (i=182;i<182+3; i++) buf[i] = ' ';
491 for (i=185;i<185+2; i++) buf[i] = '0';
492 for (i=187;i<187+(29*2); i++) buf[i] = ' ';
493 for (i=245;i<245+11; i++) buf[i] = ' ';
496 void dtaus_prepareE(char *buf)
506 for (i=5;i<5+5; i++) buf[i] = ' ';
507 for (i=64;i<64+13; i++) buf[i] = '0';
508 for (i=77;i<77+51; i++) buf[i] = ' ';
511 int dtaus_writeA(FILE *f, char **values)
517 for (i=0; (recA[i].name); i++)
518 if ((recA[i].type == REQ) && !values[i]) {
519 fprintf (stderr, "Anfangsdatensatz ist nicht vollständig, kein %s.\n", recA[i].name);
522 if (!(((values[A_TRANS][0] == 'L')||(values[A_TRANS][0] == 'G'))
523 &&((values[A_TRANS][1] == 'B')||(values[A_TRANS][1] == 'K')))) {
524 fprintf (stderr, "Ungueltiger Typ, nur LK, GK, LB oder GB erlaubt.\n");
528 i=A_NAME;if (values[i] && strlen(values[i]) > recA[i].len)
529 values[i][recA[i].len] = '\0';
532 buf[5] = values[A_TRANS][0];
533 buf[6] = values[A_TRANS][1];
534 sprintf (tmp, "%s", padzeroclip (strip_nondigits (values[A_BLZ]),8));
535 for (i=0; i<8; i++) buf[recA[A_BLZ].pos+i] = tmp[i];
536 sprintf (tmp, "%-27s", upcase(values[A_NAME]));
537 for (i=0; i<27; i++) buf[recA[A_NAME].pos+i] = tmp[i];
538 sprintf (tmp, "%s", padzeroclip (strip_nondigits (values[A_KTO]),10));
539 for (i=0; i<10; i++) buf[recA[A_KTO].pos+i] = tmp[i];
545 int dtaus_writeC(FILE *f, char **valuesA, char **values)
552 for (i=0; (recC[i].name); i++)
554 printf ("%s: %s\n", recC[i].name, values[i]);
557 for (i=0; (recC[i].name); i++)
558 if ((recC[i].type == REQ) && !values[i]) {
559 fprintf (stderr, "Datensatz ist nicht vollständig, kein %s.\n", recC[i].name);
562 sprintf (tmp, "%s", trans2string(values[C_TRANS]));
564 fprintf (stderr, "Ungültiger Typ, nur Abbuchung, Einzug, E-Cash, E-Cash-A, Gutschrift und Lohn erlaubt.\n");
568 i=C_TEXT;if (values[i] && strlen(values[i]) > recC[i].len)
569 values[i][recC[i].len] = '\0';
570 i=C_ZWECK;if (values[i] && strlen(values[i]) > recC[i].len)
571 values[i][recC[i].len] = '\0';
572 i=C_MYNAM;if (values[i] && strlen(values[i]) > recC[i].len)
573 values[i][recC[i].len] = '\0';
574 i=C_TEXT;if (values[i] && strlen(values[i]) > recC[i].len)
575 values[i][recC[i].len] = '\0';
576 i=C_EXT;if (values[i] && strlen(values[i]) > recC[i].len)
577 values[i][recC[i].len] = '\0';
580 if (!values[C_TEXT]) {
585 for (i=0; i<5; i++) buf[recC[C_TRANS].pos+i] = tmp[i];
587 sprintf (tmp, "%s", padzeroclip (strip_nondigits (values[C_MYBLZ]),8));
589 sprintf (tmp, "%s", padzeroclip (strip_nondigits (valuesA[A_BLZ]),8));
590 for (i=0; i<recC[C_MYBLZ].len; i++) buf[5+i] = tmp[i];
591 for (i=0; i<recC[C_MYBLZ].len; i++) buf[recC[C_MYBLZ].pos+i] = tmp[i];
592 sprintf (tmp, "%s", padzeroclip (strip_nondigits (values[C_BLZ]),8));
593 for (i=0; i<recC[C_BLZ].len; i++) buf[recC[C_BLZ].pos+i] = tmp[i];
594 sprintf (tmp, "%s", padzeroclip (strip_nondigits (values[C_KTO]),10));
595 for (i=0; i<recC[C_KTO].len; i++) buf[recC[C_KTO].pos+i] = tmp[i];
596 sprintf (tmp, "%s", padzeroclip (real2string(values[C_VAL]),11));
597 for (i=0; i<recC[C_VAL].len; i++) buf[recC[C_VAL].pos+i] = tmp[i];
599 sprintf (tmp, "%s", padzeroclip (strip_nondigits (values[C_MYKTO]),10));
601 sprintf (tmp, "%s", padzeroclip (strip_nondigits (valuesA[A_KTO]),10));
602 for (i=0; i<recC[C_MYKTO].len; i++) buf[recC[C_MYKTO].pos+i] = tmp[i];
603 sprintf (tmp, "%-27s", upcase(values[C_NAME]));
604 for (i=0; i<recC[C_NAME].len; i++) buf[recC[C_NAME].pos+i] = tmp[i];
606 sprintf (tmp, "%-27s", upcase(values[C_MYNAM]));
608 sprintf (tmp, "%-27s", upcase(valuesA[A_NAME]));
609 for (i=0; i<recC[C_MYNAM].len; i++) buf[recC[C_MYNAM].pos+i] = tmp[i];
610 sprintf (tmp, "%-27s", upcase(values[C_ZWECK]));
611 for (i=0; i<recC[C_ZWECK].len; i++) buf[recC[C_ZWECK].pos+i] = tmp[i];
613 if (!values[C_TEXT]) {
614 buf[recC[C_TEXT].pos+0] = ' ';
615 buf[recC[C_TEXT].pos+1] = ' ';
619 buf[recC[C_TEXT].pos+0] = '0';
620 buf[recC[C_TEXT].pos+1] = '2';
621 sprintf (tmp, "%-27s", upcase(values[C_TEXT]));
622 for (i=0; i<recC[C_TEXT].len-2; i++) buf[recC[C_TEXT].pos+2+i] = tmp[i];
628 int dtaus_writeE(FILE *f, int count, bigint sum, bigint blz, bigint kto)
636 sprintf (tmp, "%07d", count);
637 for (i=0; i<recE[E_COUNT].len; i++) buf[recE[E_COUNT].pos+i] = tmp[i];
638 bigint_sprintf (tmp, "%s", sum);
639 padzeroclip (tmp,13);
640 for (i=0; i<recE[E_VAL].len; i++) buf[recE[E_VAL].pos+i] = tmp[i];
641 bigint_sprintf (tmp, "%s", sum);
642 padzeroclip (tmp,13);
643 for (i=0; i<recE[E_VAL].len; i++) buf[recE[E_VAL].pos+i] = tmp[i];
644 bigint_sprintf (tmp, "%s", kto);
645 padzeroclip (tmp,17);
646 for (i=0; i<recE[E_KTO].len; i++) buf[recE[E_KTO].pos+i] = tmp[i];
647 bigint_sprintf (tmp, "%s", blz);
648 padzeroclip (tmp,17);
649 for (i=0; i<recE[E_BLZ].len; i++) buf[recE[E_BLZ].pos+i] = tmp[i];
655 void printctln(FILE *f, char *field, char *value)
657 if (strlen(field) && strlen(value))
658 fprintf(f, " %s\t%s\n", field, value);
663 * Third: Some high level routines
666 void dtaus2control (char *cdtaus, char *ccontrol)
668 FILE *fdtaus, *fcontrol;
676 if (!(fdtaus = fopen("DTAUS0.TXT", "r")))
677 if (!(fdtaus = fopen("dtaus0.txt", "r")))
680 if (!(fdtaus = fopen(cdtaus, "r")))
685 if (!(fcontrol = fopen(ccontrol, "w")))
687 if (!(buf = (char *)malloc (512)))
693 if (dtaus_nextrec(buf, fdtaus) == 1) {
694 if (dtaus_char(buf,4) == 'A') {
695 fprintf(fcontrol, "BEGIN {\n");
698 for (index=A_TRANS; index < A_DATE; index++) {
699 bufp = buf + recA[index].pos;
700 memcpy(tmp, bufp, recA[index].len); tmp[recA[index].len] = '\0';
701 printctln(fcontrol, recA[index].name, strip_zeros(strip_spaces(tmp)));
704 index = A_DATE; bufp = buf + recA[index].pos;
705 memcpy(tmp, bufp, recA[index].len); tmp[recA[index].len] = '\0';
706 printctln(fcontrol, recA[index].name, strip_spaces(tmp));
708 index = A_EURO; bufp = buf + recA[index].pos;
709 memcpy(tmp, bufp, recA[index].len); tmp[recA[index].len] = '\0';
710 printctln(fcontrol, recA[index].name, strip_zeros(strip_spaces(tmp)));
712 fprintf(fcontrol, "}\n\n");
714 fprintf (stderr, "Datei fängt nicht mit dem Anfangsdatensatz an.\n");
718 fprintf (stderr, "Der Anfangsdatensatz ist kaputt.\n");
725 if (dtaus_nextrec(buf, fdtaus) == 1) {
726 while (dtaus_char(buf,4) == 'C') {
728 if (dtaus_nextrec(bufp, fdtaus) == 1) {
729 fprintf(fcontrol, "{\n");
731 for (index=C_NAME; index <= C_EURO; index++) {
732 bufp = buf + recC[index].pos;
733 memcpy(tmp, bufp, recC[index].len); tmp[recC[index].len] = '\0';
735 printctln(fcontrol, recC[index].name, strip_zeros(string2real(tmp)));
736 else if (index == C_TRANS)
737 printctln(fcontrol, recC[index].name, strip_zeros(string2trans(tmp)));
739 printctln(fcontrol, recC[index].name, strip_zeros(strip_spaces(tmp)));
742 for (index=C_TEXT; index <= C_EXT; index++) {
743 if (!(dtaus_char(buf,recC[index].pos) == ' ')) {
744 bufp = buf + recC[index].pos;
745 memcpy(x, bufp, 2); tmp[2] = '\0'; bufp+=2;
746 memcpy(tmp, bufp, recC[index].len-2); tmp[recC[index].len-2] = '\0';
747 printctln(fcontrol, string2ext(x), strip_spaces(tmp));
751 countC = dtaus_int(buf, 185, 2);
752 countC = countC<3?0:countC-2/4;
753 countC += countC%4>0?1:0;
754 /* FIXME: Erweiterungsfelder werden ignoriert */
756 fprintf(fcontrol, "}\n");
758 fprintf (stderr, "Der zweite Teil der Transaktion ist kaputt.\n");
761 if (dtaus_nextrec(buf, fdtaus) != 1)
762 bzero (buf, sizeof(buf));
768 * (gelesen ist er eigentlich schon...)
770 if (dtaus_char(buf,4) == 'E') {
771 if (dtaus_char(buf,4) == 'E') {
772 fprintf(fcontrol, "END {\n");
774 for (index=E_COUNT; index <= E_BLZ; index++) {
775 bufp = buf + recE[index].pos;
776 memcpy(tmp, bufp, recE[index].len); tmp[recE[index].len] = '\0';
778 printctln(fcontrol, recE[index].name, strip_zeros(string2real(tmp)));
780 printctln(fcontrol, recE[index].name, strip_zeros(tmp));
783 fprintf(fcontrol, "}\n");
785 fprintf (stderr, "Das ist kein Abschlußdatensatz.\n");
789 fprintf (stderr, "Der Abschlußdatensatz ist leer oder kaputt.\n");
796 int control2dtaus (char *ccontrol, char *cdtaus, char *cbeleg, char *ccheck)
798 FILE *fdtaus, *fcontrol, *fbeleg, *fcheck;
804 char *valA[A_LEN], *valC[C_LEN];
806 bigint sum_val, sum_blz, sum_kto, bi;
809 if (!(fdtaus = fopen("dtaus0.txt", "w")))
812 if (!(fdtaus = fopen(cdtaus, "w")))
815 if (!(fcontrol = fopen("dtaus0.ctl", "r")))
816 if (!(fcontrol = fopen("DTAUS0.CTL", "r")))
819 if (!(fcontrol = fopen(ccontrol, "r")))
822 if (!(fbeleg = fopen("dtaus0.doc", "w")))
825 if (!(fbeleg = fopen(cbeleg, "w")))
830 if (!(fcheck = fopen(ccheck, "w")))
834 if (!(buf = (char *)malloc (512)))
840 bzero(valA, sizeof(valA));
841 control_nextline ((void *)line, 100, fcontrol);
842 ident = extract_ident(line);
843 if (!strcmp(ident, "begin") && (line[0] == '{')) {
844 control_nextline ((void *)line, 100, fcontrol);
845 while (strlen(line) && line[0] != '}') {
846 ident = extract_ident(line);
847 if ((recindex = rec_index(ident, REC_A)) != -1)
848 if (recA[recindex].type != IGN)
849 if ((valA[recindex] = (char *)malloc (strlen(line)+1)))
850 strcpy(valA[recindex], line);
851 control_nextline ((void *)line, 100, fcontrol);
853 if (((recindex = rec_index("art", REC_A)) != -1) && valA[recindex] && strlen(valA[recindex])) {
854 fprintf(fbeleg, "\n\n");
855 fprintf(fbeleg, "\n Begleitzettel\n\n");
856 fprintf(fbeleg, "\n Belegloser Datentraegeraustausch\n\n");
857 if (valA[recindex][0] == 'L')
858 fprintf(fbeleg, "\n Sammeleinziehungsauftrag\n\n");
859 else if (valA[recindex][0] == 'G')
860 fprintf(fbeleg, "\n Sammelueberweisungsauftrag\n\n");
862 fprintf(fbeleg, "\n Sammelauftrag\n\n");
863 fprintf(fbeleg, "\n VOL ........................:\n");
864 fprintf(fbeleg, "\n Erstellungsdatum ...........: %s\n", get_date());
866 if (!dtaus_writeA(fdtaus, valA)) {
867 fprintf (stderr, "Konnte den Anfangsdatensatz nicht schreiben.\n");
871 fprintf (fcheck, "\n\n\n");
872 fprintf (fcheck, " Sammeleinzeiehungsauftrag\n\n");
873 fprintf (fcheck, " Erstellungsdatum : %s\n\n\n", get_date());
874 fprintf (fcheck, " %-10s %-8s %-30s %12s\n", "Kontonr.", "BLZ", "Name", "Betrag");
875 fprintf (fcheck, " --------------------------------------------------------------------\n");
877 fprintf (stderr, "Datei fängt nicht mit dem Anfangsdatensatz (BEGIN) an.\n");
885 sum_val = bigint_int(0);
886 sum_blz = bigint_int(0);
887 sum_kto = bigint_int(0);
888 bzero(valC, sizeof(valC));
889 control_nextline ((void *)line, 100, fcontrol);
890 if (line[0] == '{') {
891 while (strlen(line) && line[0] == '{') {
892 control_nextline ((void *)line, 100, fcontrol);
893 while (strlen(line) && line[0] != '}') {
894 ident = extract_ident(line);
895 if ((recindex = rec_index(ident, REC_C)) != -1)
896 if (recC[recindex].type != IGN)
897 if ((valC[recindex] = (char *)malloc (strlen(line)+1)))
898 strcpy(valC[recindex], line);
901 control_nextline ((void *)line, 100, fcontrol);
903 if (!dtaus_writeC(fdtaus, valA, valC)) {
904 fprintf (stderr, "Konnte den regulären Datensatz nicht schreiben.\n");
908 bi = bigint_string(real2string(valC[C_VAL])); sum_val = bigint_add(sum_val, bi);
909 bi = bigint_string(valC[C_BLZ]); sum_blz = bigint_add(sum_blz, bi);
910 bi = bigint_string(valC[C_KTO]); sum_kto = bigint_add(sum_kto, bi);
912 fprintf (fcheck, " %10s %8s %-30s %12s\n", valC[C_KTO], valC[C_BLZ], valC[C_NAME], valC[C_VAL]);
913 for (recindex=0; recindex<C_LEN; recindex++)
915 free(valC[recindex]);
916 bzero(valC, sizeof(valC));
917 control_nextline ((void *)line, 100, fcontrol);
920 fprintf (stderr, "Kein regulärer Datensatz?\n");
927 dtaus_writeE(fdtaus, count, sum_val, sum_blz, sum_kto);
928 fprintf (fcheck, " --------------------------------------------------------------------\n");
929 bigint_sprintf (tmp, "%s", sum_val);
930 fprintf (fbeleg, "\n Anzahl .....................: %d\n", count);
931 recindex=strlen(tmp);
932 tmp[recindex+1] = '\0';
933 tmp[recindex] = tmp[recindex-1];
934 tmp[recindex-1] = tmp[recindex-2];
935 tmp[recindex-2] = '.';
936 fprintf (fcheck, " %-52s %14s\n", "Summe", tmp);
937 fprintf (fbeleg, "\n Summe ......................: %s\n", tmp);
938 bigint_sprintf (tmp, "%s", sum_kto);
939 fprintf (fbeleg, "\n Kontrollsumme Kontonummern .: %s\n", tmp);
940 bigint_sprintf (tmp, "%s", sum_blz);
941 fprintf (fbeleg, "\n Kontrollsumme Bankleitzahlen: %s\n", tmp);
942 fprintf (fbeleg, "\n Unsere Kontonummer .........: %s\n", valA[A_KTO]);
943 fprintf (fbeleg, "\n Unsere Bankleitzahl ........: %s\n", valA[A_BLZ]);
944 fprintf (fbeleg, "\n\n\n\n\n __________________________________________________\n");
945 fprintf (fbeleg, " Ort, Datum Unterschrift\n");
946 for (recindex=0; recindex<A_LEN; recindex++)
948 free(valA[recindex]);