There are special cases to take care about if the default currency is
DM or Euro but the selected currency is the other one. This patch
implements this by switching index values forth and back, quite
kludgy, though.
Broken DM support after support for Euro was noticed by
Stefan Beckert <becki@web.de>
#define DEFAULT_EURO
#ifndef DEFAULT_EURO
int use_euro = 0;
#define DEFAULT_EURO
#ifndef DEFAULT_EURO
int use_euro = 0;
+#else
+int use_euro = 1;
{"Referenz", 70, 10, OPT},
{"Datum", 50, 6, IGN},
{"Ausfuehrung", 95, 8, OPT},
{"Referenz", 70, 10, OPT},
{"Datum", 50, 6, IGN},
{"Ausfuehrung", 95, 8, OPT},
+ {"Currency", 127, 1, OPT},
#define A_REF 4
#define A_DATE 5
#define A_TODO 6
#define A_REF 4
#define A_DATE 5
#define A_TODO 6
-#define A_EURO 7
-#define A_LEN 8
+#define A_CURR 7
+#define A_EURO 8
+#define A_DM 9
+#define A_LEN 10
+#define A_LOOP 7
dtaus_record recC[] = {
{"Name", 93, 27, REQ},
dtaus_record recC[] = {
{"Name", 93, 27, REQ},
{"myName", 128, 27, OPT},
{"myKonto", 69, 10, OPT},
{"myBLZ", 61, 8, OPT},
{"myName", 128, 27, OPT},
{"myKonto", 69, 10, OPT},
{"myBLZ", 61, 8, OPT},
{"Text", 187, 29, OPT},
{"Extension", 216, 29, OPT},
{"Text", 187, 29, OPT},
{"Extension", 216, 29, OPT},
+ {"Currency", 182, 1, IGN},
#ifndef DEFAULT_EURO
{"Betrag-Euro", 79, 11, IGN},
#ifndef DEFAULT_EURO
{"Betrag-Euro", 79, 11, IGN},
+#else
+ {"Betrag-DM", 50, 11, IGN},
#define C_MYNAM 6
#define C_MYKTO 7
#define C_MYBLZ 8
#define C_MYNAM 6
#define C_MYKTO 7
#define C_MYBLZ 8
-#define C_EURO 9
-#define C_TEXT 10
-#define C_EXT 11
+#define C_TEXT 9
+#define C_EXT 10
+#define C_EURO 11
#ifndef DEFAULT_EURO
#define C_EUR 12
#ifndef DEFAULT_EURO
#define C_EUR 12
+#define C_LEN 13
+#define C_LOOP 11
{"BLZs", 47, 17, IGN},
#ifndef DEFAULT_EURO
{"Summe-Euro", 64, 13, IGN},
{"BLZs", 47, 17, IGN},
#ifndef DEFAULT_EURO
{"Summe-Euro", 64, 13, IGN},
+#else
+ {"Summe-DM", 17, 13, IGN},
#define E_BLZ 3
#ifndef DEFAULT_EURO
#define E_EUR 4
#define E_BLZ 3
#ifndef DEFAULT_EURO
#define E_EUR 4
/*
* Second: Some low level routines
/*
* Second: Some low level routines
for (i=56;i<56+4; i++) buf[i] = ' '; /* A8 */
for (i=70;i<70+10; i++) buf[i] = '0'; /* A10 */
for (i=80;i<80+48; i++) buf[i] = ' '; /* A11 */
for (i=56;i<56+4; i++) buf[i] = ' '; /* A8 */
for (i=70;i<70+10; i++) buf[i] = '0'; /* A10 */
for (i=80;i<80+48; i++) buf[i] = ' '; /* A11 */
-#ifdef DEFAULT_EURO
- buf[recA[A_EURO].pos] = '1'; /* A12 (Currency) */
-#else
- buf[recA[A_EURO].pos] = '1'; /* A12 (Currency) */
+ buf[recA[A_CURR].pos] = '1'; /* A12 (Currency) */
- buf[recA[A_EURO].pos] = ' '; /* A12 (Currency) */
-#endif
+ buf[recA[A_CURR].pos] = ' '; /* A12 (Currency) */
for (i=90;i<90+3; i++) buf[i] = ' '; /* C13 */
for (i=93;i<90+27; i++) buf[i] = ' '; /* C14a (Kunde) */
for (i=120;i<120+8; i++) buf[i] = ' '; /* C14b */
for (i=90;i<90+3; i++) buf[i] = ' '; /* C13 */
for (i=93;i<90+27; i++) buf[i] = ' '; /* C14a (Kunde) */
for (i=120;i<120+8; i++) buf[i] = ' '; /* C14b */
-#ifdef DEFAULT_EURO
- buf[recC[C_EURO].pos] = '1'; /* C17a (Currency) */
-#else
if (use_euro)
buf[recC[C_EURO].pos] = '1'; /* C17a (Currency) */
else
buf[recC[C_EURO].pos] = ' '; /* C17a (Currency) */
if (use_euro)
buf[recC[C_EURO].pos] = '1'; /* C17a (Currency) */
else
buf[recC[C_EURO].pos] = ' '; /* C17a (Currency) */
for (i=183;i<183+2; i++) buf[i] = ' '; /* C17b */
for (i=187;i<187+(29*2); i++) buf[i] = ' '; /* C19-C22 (misc text) */
for (i=245;i<245+11; i++) buf[i] = ' '; /* C23 */
for (i=183;i<183+2; i++) buf[i] = ' '; /* C17b */
for (i=187;i<187+(29*2); i++) buf[i] = ' '; /* C19-C22 (misc text) */
for (i=245;i<245+11; i++) buf[i] = ' '; /* C23 */
else
for (i=0; i<recC[C_EUR].len; i++) buf[recC[C_EUR].pos+i] = tmp[i];
#else
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];
+ 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_DM].len; i++) buf[recC[C_DM].pos+i] = tmp[i];
#endif
if (values[C_MYKTO])
sprintf (tmp, "%s", padzeroclip (strip_nondigits (values[C_MYKTO]),10));
#endif
if (values[C_MYKTO])
sprintf (tmp, "%s", padzeroclip (strip_nondigits (values[C_MYKTO]),10));
else
for (i=0; i<recE[E_EUR].len; i++) buf[recE[E_EUR].pos+i] = tmp[i];
#else
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];
+ 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_DM].len; i++) buf[recE[E_DM].pos+i] = tmp[i];
#endif
bigint_sprintf (tmp, "%s", kto);
padzeroclip (tmp,17);
#endif
bigint_sprintf (tmp, "%s", kto);
padzeroclip (tmp,17);
fprintf(fcontrol, "BEGIN {\n");
bufp = buf;
fprintf(fcontrol, "BEGIN {\n");
bufp = buf;
-#ifndef DEFAULT_EURO
- for (index=A_TRANS; index <= A_EURO; index++) {
-#else
- for (index=A_TRANS; index < A_EURO; index++) {
-#endif
+ for (index=A_TRANS; index < A_LOOP; index++) {
bufp = buf + recA[index].pos;
memcpy(tmp, bufp, recA[index].len); tmp[recA[index].len] = '\0';
if (index == A_DATE || index == A_TODO)
bufp = buf + recA[index].pos;
memcpy(tmp, bufp, recA[index].len); tmp[recA[index].len] = '\0';
if (index == A_DATE || index == A_TODO)
printctln(fcontrol, recA[index].name, strip_zeros(strip_spaces(tmp)));
}
printctln(fcontrol, recA[index].name, strip_zeros(strip_spaces(tmp)));
}
-#ifndef DEFAULT_EURO
- if (tmp[recA[index].pos] == '1')
+ bufp = buf + recA[A_CURR].pos;
+ if (*bufp == '1') {
+ fprintf(fcontrol, " Euro\n");
+ } else {
+ use_euro = 0;
+ fprintf(fcontrol, " DM\n");
+ }
fprintf(fcontrol, "}\n\n");
} else {
fprintf(fcontrol, "}\n\n");
} else {
} else {
fprintf(fcontrol, "{\n");
} else {
fprintf(fcontrol, "{\n");
- for (index=C_NAME; index < C_EURO; index++) {
+ for (index=C_NAME; index < C_LOOP; index++) {
#ifndef DEFAULT_EURO
if (use_euro && index == C_VAL)
index = C_EUR;
#ifndef DEFAULT_EURO
if (use_euro && index == C_VAL)
index = C_EUR;
+#else
+ if (!use_euro && index == C_VAL)
+ index = C_DM;
#endif
bufp = buf + recC[index].pos;
memcpy(tmp, bufp, recC[index].len); tmp[recC[index].len] = '\0';
#endif
bufp = buf + recC[index].pos;
memcpy(tmp, bufp, recC[index].len); tmp[recC[index].len] = '\0';
+
+ /*
+ * C_EUR and C_DM are outside of the loop, can only be
+ * selected for the non-default currency, but the value
+ * should be stored in the normal record field.
+ */
#ifndef DEFAULT_EURO
if (index == C_EUR)
#ifndef DEFAULT_EURO
if (index == C_EUR)
- printctln(fcontrol, recC[C_VAL].name, strip_zeros(string2real(tmp)));
- else
+#else
+ if (index == C_DM)
+ printctln(fcontrol, recC[C_VAL].name, strip_zeros(string2real(tmp)));
+ else if (index == C_VAL)
printctln(fcontrol, recC[index].name, strip_zeros(string2real(tmp)));
else if (index == C_TRANS)
printctln(fcontrol, recC[index].name, strip_zeros(string2trans(tmp)));
printctln(fcontrol, recC[index].name, strip_zeros(string2real(tmp)));
else if (index == C_TRANS)
printctln(fcontrol, recC[index].name, strip_zeros(string2trans(tmp)));
#ifndef DEFAULT_EURO
if (use_euro && index == C_EUR)
index = C_VAL;
#ifndef DEFAULT_EURO
if (use_euro && index == C_EUR)
index = C_VAL;
+#else
+ if (!use_euro && index == C_DM)
+ index = C_VAL;
#ifndef DEFAULT_EURO
if (use_euro && index == E_VAL)
index = E_EUR;
#ifndef DEFAULT_EURO
if (use_euro && index == E_VAL)
index = E_EUR;
+#else
+ if (!use_euro && index == E_VAL)
+ index = E_DM;
bufp = buf + recE[index].pos;
memcpy(tmp, bufp, recE[index].len); tmp[recE[index].len] = '\0';
bufp = buf + recE[index].pos;
memcpy(tmp, bufp, recE[index].len); tmp[recE[index].len] = '\0';
#ifndef DEFAULT_EURO
if (index == E_VAL || index == E_EUR)
#else
#ifndef DEFAULT_EURO
if (index == E_VAL || index == E_EUR)
#else
+ if (index == E_VAL || index == E_DM)
- printctln(fcontrol, recE[index].name, strip_zeros(string2real(tmp)));
+ printctln(fcontrol, recE[E_VAL].name, strip_zeros(string2real(tmp)));
else
printctln(fcontrol, recE[index].name, strip_zeros(tmp));
#ifndef DEFAULT_EURO
if (use_euro && index == E_EUR)
index = E_VAL;
else
printctln(fcontrol, recE[index].name, strip_zeros(tmp));
#ifndef DEFAULT_EURO
if (use_euro && index == E_EUR)
index = E_VAL;
+#else
+ if (!use_euro && index == E_DM)
+ index = E_VAL;
while (strlen(line) && line[0] != '}') {
ident = extract_ident(line);
if ((recindex = rec_index(ident, REC_A)) != -1)
while (strlen(line) && line[0] != '}') {
ident = extract_ident(line);
if ((recindex = rec_index(ident, REC_A)) != -1)
if (recA[recindex].type != IGN)
if ((valA[recindex] = (char *)malloc (strlen(line)+1)))
strcpy(valA[recindex], line);
if (recA[recindex].type != IGN)
if ((valA[recindex] = (char *)malloc (strlen(line)+1)))
strcpy(valA[recindex], line);
} else {
if (! strcasecmp (ident, "euro"))
use_euro = 1;
} else {
if (! strcasecmp (ident, "euro"))
use_euro = 1;
+ if (! strcasecmp (ident, "dm"))
+ use_euro = 0;
control_nextline ((void *)line, 100, fcontrol);
}
if (((recindex = rec_index("art", REC_A)) != -1) && valA[recindex] && strlen(valA[recindex])) {
control_nextline ((void *)line, 100, fcontrol);
}
if (((recindex = rec_index("art", REC_A)) != -1) && valA[recindex] && strlen(valA[recindex])) {
if (valA[A_TODO]) {
fprintf(fbeleg, "\n Ausfuehrugsdatum ...........: %s\n", valA[A_TODO]);
}
if (valA[A_TODO]) {
fprintf(fbeleg, "\n Ausfuehrugsdatum ...........: %s\n", valA[A_TODO]);
}
if (use_euro)
fprintf(fbeleg, "\n Waehrung ...................: Euro\n");
else
fprintf(fbeleg, "\n Waehrung ...................: DM\n");
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");
}
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());
else
fprintf (fcheck, " Sammelauftrag\n\n");
fprintf (fcheck, " Erstellungsdatum : %s\n\n", get_date());
if (use_euro)
fprintf (fcheck, " Waehrung : Euro\n\n\n");
else
fprintf (fcheck, " Waehrung : DM\n\n\n");
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 {
fprintf (fcheck, " %-10s %-8s %-30s %12s\n", "Kontonr.", "BLZ", "Name", "Betrag");
fprintf (fcheck, " --------------------------------------------------------------------\n");
} else {