📄 lcd_rpt.c
字号:
Lcd_Cls_Text_Refresh();
for(plucnt = 0; plucnt < Max_Plu_No; plucnt ++) /* Print the PLU's count and amount */
{
if( (Key_Buff_Chk(KD_CLEAR) == OK) && (plucnt != 0) )
{/* If has press CLEAR key, interrupt the print */
plucnt = Max_Plu_No;
Lcd_Send_Text_Buff_Str(BUF_ID_LCD_TEXT, 1, Str_PrnInt_Lcd, ALIGN_MID);
Lcd_Disp_Text_Buff(BUF_ID_LCD_TEXT);
break;
}
quantity = plu[plucnt].inventory;
safity_qty = plu[plucnt].saft_Stock;
if( quantity == 0 && safity_qty == 0 )
continue;
Lcd_Disp_Rpt_Ex(plu[plucnt].desc, quantity, 0, safity_qty, 3,1);
}
Lcd_Set_Text_Refresh();
}
void Lcd_Disp_Daily_Clerk_Rpt(void)
{
Lcd_ClrText();
Lcd_Disp_Rpt_Head();
Lcd_Send_Text_Buff_Str(BUF_ID_TL_TITLE,1, "Daily Clerk Report", ALIGN_MID);
Lcd_Disp_Text_Buff(BUF_ID_TL_TITLE);
Lcd_Disp_Clerk_Rpt(DAILY);
}
void Lcd_Disp_PTD_Clerk_Rpt(void)
{
Lcd_ClrText();
Lcd_Disp_Rpt_Head();
Lcd_Send_Text_Buff_Str(BUF_ID_TL_TITLE,1, "Period Clerk Report", ALIGN_MID);
Lcd_Disp_Text_Buff(BUF_ID_TL_TITLE);
Lcd_Disp_Clerk_Rpt(PTD);
}
/*----------------------------------------------------------------------------------*
* The clerk common print.
* Parameter: mode: The DAILY mode or the P-T-D mode.
* DAILY: select the daily mode.
* PTD: select the period to date mode.
*----------------------------------------------------------------------------------*/
void Lcd_Disp_Clerk_Rpt(byte mode)
{
byte i;
WORD count,ttl_count;
long amount,ttl_amount;
ttl_count = 0;
ttl_amount = 0;
Lcd_Cls_Text_Refresh();
for( i = 0; i < Max_Clerk_No; i ++ ) /* Print each clerks count and amount */
{
if( mode == DAILY )
{
count = clerk[i].count;
amount = clerk[i].amount;
}
else
{
count = clerk[i].PTD_count;
amount = clerk[i].PTD_amount;
}
if(sysflag->zero_skip == 1)
{
if((amount == 0) && (count == 0))
continue;
}
ttl_count += count;
ttl_amount += amount;
Lcd_Disp_Rpt_Ex(clerk[i].desc, count, 1, amount, sysflag->sysdots,1);
}
Lcd_Disp_Line('-');
Lcd_Disp_Rpt(Str_Total, ttl_count, 1, ttl_amount, sysflag->sysdots);
Lcd_Set_Text_Refresh();
}
/*--------------------------------------------------------------------------------*
* Print the check report.
*--------------------------------------------------------------------------------*/
void Lcd_Disp_Check_Rpt(REPORT *report)
{
byte i;
WORD count;
long amount;
count = 0;
amount = 0;
for(i=0; i<MAX_CHECK_NUM; i++)
{
Lcd_Disp_Rpt_Ex(check[i], report->CheckCount[i], 1, report->CheckAmt[i], sysflag->sysdots,1);
count += report->CheckCount[i];
amount += report->CheckAmt[i];
}
if(count == 0)
return;
Lcd_Disp_Line('-');
Lcd_Disp_Rpt(Str_Total, count, 1, amount, sysflag->sysdots);
}
/*--------------------------------------------------------------------------------*
* Print the charge report.
*--------------------------------------------------------------------------------*/
void Lcd_Disp_Charge_Rpt(REPORT *report)
{
byte i;
WORD count;
long amount;
count = 0;
amount = 0;
for(i=0; i<MAX_CHARGE_NUM; i++)
{
Lcd_Disp_Rpt_Ex(charge[i], report->ChargeCount[i], 1, report->ChargeAmt[i], sysflag->sysdots,1);
count += report->ChargeCount[i];
amount += report->ChargeAmt[i];
}
if(count == 0)
return;
Lcd_Disp_Line('-');
Lcd_Disp_Rpt(Str_Total, count, 1, amount, sysflag->sysdots);
}
#ifdef FCE_FUNC
/*----------------------------------------------------------------------------------*
* Print the FCE report
* Parameter: mode: The DAILY mode or the P-T-D mode.
* DAILY: select the daily mode.
* PTD: select the period to date mode.
*----------------------------------------------------------------------------------*/
void Lcd_Disp_FCE_Rpt(byte mode)
{
byte i;
byte len;
WORD count; /* The FCE sales count */
long ttlindwr; /* Total in drawer */
long chg; /* The local currency change */
for(i = 0; i < MAX_FCE_CNT; i ++)
{
if(mode == DAILY) /* Daily report */
{
count = fce[i].count;
ttlindwr = fce[i].ttlindwr;
chg = fce[i].chg;
}
else // mode == PTD /* Period to date report */
{
count = fce[i].PTD_count;
ttlindwr = fce[i].PTD_ttlindwr;
chg = fce[i].PTD_chg;
}
if((count == 0) && (ttlindwr == 0) && (chg == 0))
continue;
Lcd_Disp_FCErate(i);
Lcd_Disp_Adj(Str_Sale_Cnt, count, 0, LCD_POSI_SALE_PRICE);
Lcd_Disp_Adj(Str_Ttlindwr, ttlindwr, sysflag->sysdots, LCD_POSI_SALE_PRICE);
Lcd_Disp_Adj(Str_Chg, chg, sysflag->sysdots, LCD_POSI_SALE_PRICE);
Lcd_Disp_Line('-');
}
}
#endif
/*-------------------------------------------------------------------------------*
* Hourly activity sales report
*-------------------------------------------------------------------------------*/
void Lcd_Disp_Hourly_Rpt(void)
{
byte i;
WORD ttl_count;
long ttl_amount;
byte hour_rpt_area[10];
ttl_count = 0;
ttl_amount =0;
Lcd_Send_Text_Buff_Str(BUF_ID_TL_TITLE,1, "Horuly Report", ALIGN_MID);
Lcd_Disp_Text_Buff(BUF_ID_TL_TITLE);
Lcd_ClrText();
Lcd_Disp_Rpt_Head();
Lcd_Cls_Text_Refresh();
for( i = 0; i < 24; i ++ ) /* Print each hours count and amount */
{
if((Hour_Rept[i].amount == 0) && (Hour_Rept[i].count == 0))
continue;
hour_rpt_area[0] = i/10+'0';
hour_rpt_area[1] = i%10+'0';
xtr_strcpy(hour_rpt_area+2,Str_Hour_Rpt_Arrow);
if((i+1) == 24) /* If the hour is 24, let it print 00 */
{
hour_rpt_area[5] = 0+'0';
hour_rpt_area[6] = 0+'0';
}
else
{
hour_rpt_area[5] = (i+1)/10+'0';
hour_rpt_area[6] = (i+1)%10+'0';
}
hour_rpt_area[7] = '\0';
Lcd_Disp_Rpt(hour_rpt_area,Hour_Rept[i].count, 1, Hour_Rept[i].amount, sysflag->sysdots);
ttl_count += Hour_Rept[i].count;
ttl_amount += Hour_Rept[i].amount;
}
Lcd_Disp_Line('-');
Lcd_Disp_Rpt(Str_Total, ttl_count, 1, ttl_amount, sysflag->sysdots);
Lcd_Set_Text_Refresh();
}
/*----------------------------------------------------------------------*
The reports data print.
Parameter:
src_str: The source print string.
Cnt_Qtt: The count or the quantity, indicated by
the parameter 'flag'.
flag: Indicate the count or the quantity parameter.
1: Count.
0: Quantity.
amount: The print amount.
dots: The print amout's decimal dots.
The reports print format:
12345678901234567890123456789012
--------------------------------
Item Name Cnt/Qty Amount
================================
Department01 1 1234.56
...
Department24 123.45 123456.78
--------------------------------
Total 123456.7
1234567.89
--------------------------------
*----------------------------------------------------------------------*/
void Lcd_Disp_Rpt(char *src_str, long Cnt_Qtt, byte flag, long amount, byte dots)
{
byte len1, len2, len3;
if((Cnt_Qtt == 0) && (amount == 0))
{
return;
}
if(flag == 1)
len2 = Cal_Len2(Cnt_Qtt, 0);
else
{
Qty_Adjust(Cnt_Qtt);
len2 = Cal_Len2(adj_num, adj_dots);
// len2 ++; /* 'Q' */
}
len3 = Cal_Len2(amount, dots);
Lcd_Send_Text_Buff_Str(BUF_ID_LCD_TEXT, 1, src_str, ALIGN_LEFT );
if((len2 + len3 +1) > 18) //display two line add 2006-08-29
{
if(flag == 1)
LongLcdFmt_Text_Buff(BUF_ID_LCD_TEXT, LCD_POSI_SALE_QTY,Cnt_Qtt, 0, ALIGN_LEFT);
else
{
Qty_Adjust(Cnt_Qtt);
LongLcdFmt_Text_Buff_Q(BUF_ID_LCD_TEXT,LCD_POSI_SALE_QTY,adj_num, adj_dots, ALIGN_LEFT);
}
Lcd_Disp_Text_Buff(BUF_ID_LCD_TEXT);
if(len3 > 10)
LongLcdFmt_Text_Buff(BUF_ID_LCD_TEXT,MAX_LCD_TEXT-len3-1,amount, dots, ALIGN_LEFT);
else
LongLcdFmt_Text_Buff(BUF_ID_LCD_TEXT,LCD_POSI_SALE_PRICE,amount, dots, ALIGN_LEFT);
Lcd_Disp_Text_Buff(BUF_ID_LCD_TEXT);
return;
}
// display one line
if(flag == 1)
LongLcdFmt_Text_Buff(BUF_ID_LCD_TEXT,LCD_POSI_SALE_QTY,Cnt_Qtt, 0, ALIGN_LEFT);
else
{
Qty_Adjust(Cnt_Qtt);
LongLcdFmt_Text_Buff_Q(BUF_ID_LCD_TEXT,LCD_POSI_SALE_QTY,adj_num, adj_dots, ALIGN_LEFT);
}
if(len3 > 10)
LongLcdFmt_Text_Buff(BUF_ID_LCD_TEXT,MAX_LCD_TEXT-len3-1,amount, dots, ALIGN_LEFT);
else
LongLcdFmt_Text_Buff(BUF_ID_LCD_TEXT,LCD_POSI_SALE_PRICE,amount, dots, ALIGN_LEFT);
Lcd_Disp_Text_Buff(BUF_ID_LCD_TEXT);
}
/*-----------------------------------------------------------------------------------*
* The universal function for print when gived the information and long number
* Parameter: src_str: The information wanted to print in the left.
* num: The long number wanted to print in the right.
* dots: The number of radix point belong to the long number.
* mode: DESC_OLD: Indicate using the old print buffer
* DESC_NEW: Indicate using the new print buffer.
*-----------------------------------------------------------------------------------*/
void Lcd_Disp_Rpt_Ex(char *src_str, long Cnt_Qtt, byte flag, long amount, byte dots, byte mode)
{
byte len;
byte tmp[MAX_LCD_TEXT +1];
if(mode == 1)
len = Get_Desc_Len(src_str, MAX_DESC_LEN);
else
len = strlen(src_str);
memcpy(tmp, src_str, len);
tmp[len] = '\0';
Lcd_Disp_Rpt(tmp, Cnt_Qtt, flag, amount, dots);
}
void Lcd_Disp_Adj(char *src_str, long num, byte dots, byte posi)
{
byte len; // 2006-08-29 new add. by sts. because some case can't display in
//one line, add judge whether display on one line or two line.
byte len2;
if(num == 0)
{
clr_Prn_Buf();
return;
}
len = strlen(src_str);
len2 = Cal_Len2(num, dots);
if(len + len2 +1 > MAX_LCD2_LEN)// display two lien
{
Lcd_Send_Text_Buff_Str(BUF_ID_LCD_TEXT, 1, src_str, ALIGN_LEFT );
Lcd_Disp_Text_Buff(BUF_ID_LCD_TEXT);
if(len2 > MAX_LCD2_LEN - posi)
LongLcdFmt_Text_Buff(BUF_ID_LCD_TEXT,MAX_LCD2_LEN - posi,num, dots, ALIGN_LEFT);
else
LongLcdFmt_Text_Buff(BUF_ID_LCD_TEXT,posi,num, dots, ALIGN_LEFT);
Lcd_Disp_Text_Buff(BUF_ID_LCD_TEXT);
return;
}
// display on one line
Lcd_Send_Text_Buff_Str(BUF_ID_LCD_TEXT, 1, src_str, ALIGN_LEFT );
if(len2 > MAX_LCD2_LEN - posi)
LongLcdFmt_Text_Buff(BUF_ID_LCD_TEXT,MAX_LCD2_LEN -posi,num, dots, ALIGN_LEFT);
else
LongLcdFmt_Text_Buff(BUF_ID_LCD_TEXT,posi,num, dots, ALIGN_LEFT);
Lcd_Disp_Text_Buff(BUF_ID_LCD_TEXT);
}
void Lcd_Disp_Line(char chr)
{
byte i;
char tmp_str[MAX_LCD_TEXT+1];
memset(tmp_str, chr, MAX_LCD_TEXT);
tmp_str[MAX_LCD_TEXT] = '\0';
Lcd_Send_Text_Buff_Str(BUF_ID_LCD_TEXT, 1, tmp_str, ALIGN_LEFT );
Lcd_Disp_Text_Buff(BUF_ID_LCD_TEXT);
}
/* Print the FCE descriptor and rate */
void Lcd_Disp_FCErate(byte Idx)
{
Lcd_Send_Text_Buff_Desc(BUF_ID_LCD_TEXT, 1, fce[Idx].desc, NO, ALIGN_LEFT);
LongLcdFmt_Text_Buff(BUF_ID_LCD_TEXT, LCD_POSI_SALE_PRICE, fce[Idx].rate, fce[Idx].dot, ALIGN_LEFT );
if(fce[Idx].flag == 1) /* 1/rate */
{
Lcd_Send_Text_Buff_Str(BUF_ID_LCD_TEXT,LCD_POSI_SALE_QTY, Str_Rcpr, ALIGN_LEFT);
}
Lcd_Disp_Text_Buff(BUF_ID_LCD_TEXT);
}
/*************************************************************************
Print the SALE modes VAT or tax value(one transaction).
*************************************************************************/
void Lcd_Disp_REG_TVAT(void)
{
byte i;
byte prn_ttl_tax = 0; /* Print the totoal tax flag */
long ttl_tax_amt = 0; /* Total tax amount */
if(sysflag->Tax_System) /* Tax mode */
{
for(i = 0; i < MAX_TAX_NUM; i ++)
{
if(tmpvars.TVATAmt[i] == 0)
continue;
prn_ttl_tax ++;
ttl_tax_amt += tmpvars.TVATAmt[i];
Lcd_Send_Text_Buff_Desc(BUF_ID_LCD_TEXT, 1, Tax[i].desc, NO, ALIGN_LEFT);
LongLcdFmt_Text_Buff(BUF_ID_LCD_TEXT, LCD_POSI_SALE_PRICE, tmpvars.TVATAmt[i],sysflag->sysdots, ALIGN_LEFT);
Lcd_Disp_Text_Buff(BUF_ID_LCD_TEXT);
}
if(prn_ttl_tax >= 1)
{
Lcd_Disp_Adj(Str_Ttl_Tax, ttl_tax_amt, sysflag->sysdots, LCD_POSI_SALE_PRICE);
}
}
else /* VAT mode */
{
for(i = 0; i < MAX_VAT_NUM; i ++)
{
if(tmpvars.TVATAmt[i] == 0)
continue;
prn_ttl_tax ++;
ttl_tax_amt += tmpvars.TVATAmt[i];
Lcd_Send_Text_Buff_Desc(BUF_ID_LCD_TEXT, 1, VAT[i].desc, NO, ALIGN_LEFT);
LongLcdFmt_Text_Buff(BUF_ID_LCD_TEXT, LCD_POSI_SALE_PRICE, tmpvars.TVATAmt[i],sysflag->sysdots, ALIGN_LEFT);
Lcd_Disp_Text_Buff(BUF_ID_LCD_TEXT);
}
if(prn_ttl_tax >= 1)
{
Lcd_Disp_Adj(Str_Ttl_VAT, ttl_tax_amt, sysflag->sysdots, LCD_POSI_SALE_PRICE);
}
}
}
/*
Check clearing the report or not
*/
BOOL Chk_Clr_Rpt_Sure(void)
{
word key;
BOOL rtn;
Lcd_Init_Pop_Text(POP_ID_SEL);
Lcd_Send_Text_Buff_Str(BUF_ID_POP_TEXT, 1, "CLEAR REPORT!", ALIGN_MID);
Lcd_Disp_Text_Buff(BUF_ID_POP_TEXT);
Lcd_Send_Text_Buff_Str(BUF_ID_POP_TEXT, 1, Str_Null, ALIGN_MID);
Lcd_Disp_Text_Buff(BUF_ID_POP_TEXT);
Lcd_Send_Text_Buff_Str(BUF_ID_POP_TEXT, 1, "Are you sure clear the", ALIGN_LEFT);
Lcd_Disp_Text_Buff(BUF_ID_POP_TEXT);
Lcd_Send_Text_Buff_Str(BUF_ID_POP_TEXT, 1, "report?", ALIGN_LEFT);
Lcd_Disp_Text_Buff(BUF_ID_POP_TEXT);
key = GetKey();
if (key == KD_SEL_YES)
rtn = TRUE;
else
rtn = FALSE;
Lcd_Res_Pop_Text();
return rtn;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -