From: Michael Stapelberg Date: Sat, 31 Oct 2009 11:53:09 +0000 (+0100) Subject: log deposits and new credits to printer X-Git-Tag: rgb2rv6~8 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=f93848dd6af71774e3c63dfb3541fb73ac1a22e7;p=c128-kasse log deposits and new credits to printer --- diff --git a/include/kasse.h b/include/kasse.h index 96e1ed4..2546c96 100644 --- a/include/kasse.h +++ b/include/kasse.h @@ -1,6 +1,8 @@ #ifndef _KASSE_H #define _KASSE_H +void print_the_buffer(); + #ifdef _IS_KASSE BYTE printing = 1; char print_buffer[81]; @@ -9,5 +11,6 @@ int log_lines_written = 0; #else extern int log_num; extern int log_lines_written; +extern char print_buffer[81]; #endif #endif diff --git a/src/credit_manager.c b/src/credit_manager.c index 1a270d8..06946ac 100644 --- a/src/credit_manager.c +++ b/src/credit_manager.c @@ -11,6 +11,7 @@ #include "config.h" #include "general.h" +#include "kasse.h" static char *filter = NULL; static BYTE filter_len; @@ -72,9 +73,12 @@ static void deposit_credit() { credit->credit += deposit; toggle_videomode(); - cprintf("%d Cent eingezahlt fuer %s.\r\nRestguthaben: %d\r\n", deposit, credit->nickname, credit->credit); + cprintf("%d Cent eingezahlt fuer %s.\r\nRestguthaben: %d\r\n", deposit, credit->nickname); + sprintf(print_buffer, "%c%d Cent eingezahlt fuer %s. Restguthaben: %d Cent\r", 17, deposit, credit->nickname, credit->credit); + cprintf("%s", print_buffer); toggle_videomode(); - cprintf("\r\nEinzahlung durchgefuehrt, drucke RETURN...\r\n"); + print_the_buffer(); + cprintf("\r\nEinzahlung durchgefuehrt, druecke RETURN...\r\n"); input = get_input(); toggle_videomode(); clrscr(); @@ -101,6 +105,10 @@ static void new_credit() { return; strcpy(credits.credits[credits.num_items].nickname, name); credits.credits[credits.num_items].credit = credit; + + sprintf(print_buffer, "%cGuthaben mit %d Cent fuer %s angelegt\r", 17, credit, name); + print_the_buffer(); + credits.num_items++; free(name); } diff --git a/src/kasse.c b/src/kasse.c index f286d0c..19b9b18 100644 --- a/src/kasse.c +++ b/src/kasse.c @@ -107,7 +107,6 @@ static char retry_or_quit() { /* Prints a line and logs it to file */ static void print_log(char *name, int item_price, int einheiten, char *nickname, char *rest) { - BYTE c; char *time = get_time(); char price[10]; /* Format: @@ -130,6 +129,11 @@ static void print_log(char *name, int item_price, int einheiten, char *nickname, sprintf(print_buffer, "%c[%lu] %s - %-9s - %s - r %s - %d - an %s\r", 17, items_sold, time, name, price, rest, einheiten, (*nickname != '\0' ? nickname : "Unbekannt")); + print_the_buffer(); +} + +void print_the_buffer() { + BYTE c; RETRY: c = cbm_open((BYTE)4, (BYTE)4, (BYTE)0, NULL); if (c != 0) {