/*
- dtaus.c - Datenträgeraustausch mit einer Bank
+ dtaus.c - Belegloser Datenträgeraustausch mit einer Bank
Copyright (c) 1996,8,2001 Martin Schulze <joey@infodrom.org>
This program is free software; you can redistribute it and/or modify
#include <malloc.h>
/* #define DEFAULT_EURO */
+#ifndef DEFAULT_EURO
+int use_euro = 0;
+#endif
/*
* First: Some control structures
{"Konto", 21, 10, REQ},
{"BLZ", 13, 8, REQ},
{"Transaktion", 44, 5, REQ},
+#ifndef DEFAULT_EURO
{"Betrag", 50, 11, REQ},
+#else
+ {"Betrag", 79, 11, REQ},
+#endif
{"Zweck", 155, 27, REQ},
{"myName", 128, 27, OPT},
{"myKonto", 69, 10, OPT},
{"Euro", 182, 1, IGN},
{"Text", 187, 29, OPT},
{"Extension", 216, 29, OPT},
+#ifndef DEFAULT_EURO
+ {"Betrag-Euro", 79, 11, IGN},
+#endif
{NULL, 0, 0}
};
#define C_EURO 9
#define C_TEXT 10
#define C_EXT 11
+#ifndef DEFAULT_EURO
+#define C_EUR 12
+#define C_LEN 13
+#else
#define C_LEN 12
+#endif
#define MAX_TEXT 14
dtaus_record recE[] = {
{"Anzahl", 10, 7, IGN},
+#ifndef DEFAULT_EURO
{"Summe", 17, 13, IGN},
+#else
+ {"Summe", 64, 13, IGN},
+#endif
{"Kontos", 30, 17, IGN},
{"BLZs", 47, 17, IGN},
+#ifndef DEFAULT_EURO
+ {"Summe-Euro", 64, 13, IGN},
+#endif
{NULL, 0, 0}
};
#define E_VAL 1
#define E_KTO 2
#define E_BLZ 3
-#define E_LEN 0
+#ifndef DEFAULT_EURO
+#define E_EUR 4
+#endif
/*
* Second: Some low level routines
#ifdef DEFAULT_EURO
buf[127] = '1'; /* A12 (Currency) */
#else
- buf[127] = ' '; /* A12 (Currency) */
+ if (use_euro)
+ buf[127] = '1'; /* A12 (Currency) */
+ else
+ buf[127] = ' '; /* A12 (Currency) */
#endif
}
#ifdef DEFAULT_EURO
buf[182] = '1'; /* C17a (Currency) */
#else
- buf[182] = ' '; /* C17a (Currency) */
+ if (use_euro)
+ buf[182] = '1'; /* C17a (Currency) */
+ else
+ buf[182] = ' '; /* C17a (Currency) */
#endif
for (i=183;i<183+2; i++) buf[i] = ' '; /* C17b */
for (i=187;i<187+(29*2); i++) buf[i] = ' '; /* C19-C22 (misc text) */
sprintf (tmp, "%s", padzeroclip (strip_nondigits (values[C_KTO]),10));
for (i=0; i<recC[C_KTO].len; i++) buf[recC[C_KTO].pos+i] = tmp[i];
sprintf (tmp, "%s", padzeroclip (real2string(values[C_VAL]),11));
+#ifndef DEFAULT_EURO
+ if (!use_euro)
+ for (i=0; i<recC[C_VAL].len; i++) buf[recC[C_VAL].pos+i] = tmp[i];
+ else
+ for (i=0; i<recC[C_EUR].len; i++) buf[recC[C_EUR].pos+i] = tmp[i];
+#else
for (i=0; i<recC[C_VAL].len; i++) buf[recC[C_VAL].pos+i] = tmp[i];
+#endif
if (values[C_MYKTO])
sprintf (tmp, "%s", padzeroclip (strip_nondigits (values[C_MYKTO]),10));
else
for (i=0; i<recE[E_COUNT].len; i++) buf[recE[E_COUNT].pos+i] = tmp[i];
bigint_sprintf (tmp, "%s", sum);
padzeroclip (tmp,13);
+#ifndef DEFAULT_EURO
+ if (!use_euro)
+ for (i=0; i<recE[E_VAL].len; i++) buf[recE[E_VAL].pos+i] = tmp[i];
+ else
+ for (i=0; i<recE[E_EUR].len; i++) buf[recE[E_EUR].pos+i] = tmp[i];
+#else
for (i=0; i<recE[E_VAL].len; i++) buf[recE[E_VAL].pos+i] = tmp[i];
- bigint_sprintf (tmp, "%s", sum);
- padzeroclip (tmp,13);
- for (i=0; i<recE[E_VAL].len; i++) buf[recE[E_VAL].pos+i] = tmp[i];
+#endif
bigint_sprintf (tmp, "%s", kto);
padzeroclip (tmp,17);
for (i=0; i<recE[E_KTO].len; i++) buf[recE[E_KTO].pos+i] = tmp[i];
while (strlen(line) && line[0] != '}') {
ident = extract_ident(line);
if ((recindex = rec_index(ident, REC_A)) != -1)
+#ifndef DEFAULT_EURO
+ {
+#endif
if (recA[recindex].type != IGN)
if ((valA[recindex] = (char *)malloc (strlen(line)+1)))
strcpy(valA[recindex], line);
+#ifndef DEFAULT_EURO
+ } else {
+ if (! strcasecmp (ident, "euro"))
+ use_euro = 1;
+ }
+#endif
control_nextline ((void *)line, 100, fcontrol);
}
if (((recindex = rec_index("art", REC_A)) != -1) && valA[recindex] && strlen(valA[recindex])) {
fprintf(fbeleg, "\n Sammelauftrag\n\n");
fprintf(fbeleg, "\n VOL ........................:\n");
fprintf(fbeleg, "\n Erstellungsdatum ...........: %s\n", get_date());
- fprintf(fbeleg, "\n Waehrung ...................: DM\n");
+#ifndef DEFAULT_EURO
+ if (use_euro)
+ fprintf(fbeleg, "\n Waehrung ...................: Euro\n");
+ else
+ fprintf(fbeleg, "\n Waehrung ...................: DM\n");
+#else
+ fprintf(fbeleg, "\n Waehrung ...................: Euro\n");
+#endif
}
if (!dtaus_writeA(fdtaus, valA)) {
fprintf (stderr, "Konnte den Anfangsdatensatz nicht schreiben.\n");
else
fprintf (fcheck, " Sammelauftrag\n\n");
fprintf (fcheck, " Erstellungsdatum : %s\n\n", get_date());
- fprintf (fcheck, " Waehrung : DM\n\n\n");
+#ifndef DEFAULT_EURO
+ if (use_euro)
+ fprintf (fcheck, " Waehrung : Euro\n\n\n");
+ else
+ fprintf (fcheck, " Waehrung : DM\n\n\n");
+#else
+ fprintf (fcheck, " Waehrung : Euro\n\n\n");
+#endif
fprintf (fcheck, " %-10s %-8s %-30s %12s\n", "Kontonr.", "BLZ", "Name", "Betrag");
fprintf (fcheck, " --------------------------------------------------------------------\n");
} else {