📄 xzreport.c
字号:
/*
* Module: xzreport.c
* Modified by: X.C.Zheng WeiHua
* Modified on: Date: 03-8-11 14:03
* Copyright(c) WeiHua Tech Ltd.
*/
#include "ecrsys.h"
#include "ftype.h"
#include "sysdata.h"
#include "data.h"
#include "keydef.h"
#include "lcd_rpt.h"
#include "disp.h"
#include "mathes.h"
#include <string.h>
#ifdef TE_01P
byte Do_Elec_Jrnl_Rpt_EX(byte flag1, byte flag2);
#endif
#ifdef VER_RSNT /* Support the restaurant function */
word Idvul_TipInCnt; /* Waiters tip in count, used in the waiters individual report */
word Idvul_TipOutCnt;
long Idvul_TipInAmt;
long Idvul_TipOutAmt;
#endif /* End VER_RSNT */
byte Idvul_Head_Prn_Flag; /* Individual report head print flag
0: Has't print the report head.
1: Has print the report head.
*/
byte disp_report_flag = 0;
#if 0
#define do_plu_part() {\
if(( CurrMode == ZREPORT) \
/* #ifdef STOCK /\* Support the stock function */\
&& (Clr_PLU_Stock_Flag == 0)\
/* #endif /\* End STOCK */\
) /* Can't do in the ZREPORT mode */\
{errorType(ERR_Z_MODE);break;}\
if( lnum > Max_Plu_No )\
{errorType(ERR_DIGIT_ILLEGAL);continue;}\
else\
{\
/* #ifdef STOCK /\* Suppor the PLU stock function */\
if(Clr_PLU_Stock_Flag == 1)\
{\
Clr_PLU_Stock_Flag = 0;\
Idx = lnum - 1;\
if(Wait_Sure(Disp_Sure) == NG)\
{\
bellcnt = 120;\
Clr_Dsp_Data();\
RightDisp(0, sysflag->sysdots);\
break;\
}\
plu[Idx].inventory = 0);\
Clr_Dsp_Data();\
RightDisp(0, sysflag->sysdots);\
break;\
}\
/* #endif /\* End STOCK */\
if( (Idvul_Flag == 0) || (Idvul_Flag == 2) )\
Idvul_Flag = 2;\
else /* When press DEPT or CLERK key first, error. */\
{errorType(ERR_IDVUL_NO_END);break;}\
if( Idvul_Head_Prn_Flag == NOTPRINTD )\
{\
Idvul_Head_Prn_Flag = PRINTD;\
Idvul_Tail_Prn_Flag = NOTPRINTD;\
prn_Idvul_Head(2); /* Print the individual report head */\
Idvul_Qty = 0; /* The total count accumulator */\
Idvul_Amt = 0; /* The total amount accumulator */\
}\
Idx = (int)(lnum -1); /* Get the PLU index number */\
Do_Idvul_Rpt(Idx);\
}\
}
#endif
#define MAX_RPT_LIST_NUM 17
const byte XRpt_Idx_List[] = {1, 2, 3, 4, 5, 6, 7, 11, 12, 13, 14, 15, 16, 51, 52, 101, 201};
const byte ZRpt_Idx_List[] = {1, 4, 6, 7, 11, 14, 16, 51, 201};
const byte Zrpt_List[] = {1, 4, 6, 7, 8,11, 13, 14, 17};//z 报表清单序号
/*--------------------------------------------------------------------------*
这里由于可以预见清单的长度, 所以才能如此处理
*--------------------------------------------------------------------------*/
void Get_Full_XZRep_List(void)
{
byte i, j;
byte len;
for(i = 0, j = 0; i < DISP_LCD_TEXT_LINE*3; i++)
{
memset(Text_Lcd.text[i], 0x20, MAX_TEXT);
if(i < MAX_RPT_LIST_NUM)
{
if((CurrMode == ZREPORT)&&( i != Zrpt_List[j]-1))
continue;
len = strlen(Str_XZRpt_List[i]);
len = (len > MAX_TEXT)? MAX_TEXT: len;
memcpy(Text_Lcd.text[j], Str_XZRpt_List[i], len);
j++;
}
}
Text_Lcd.EndLine = j;
Text_Lcd.StartLine = 0;
Text_Lcd.CurrLine = 0;
Lcd_Reflush_List(0);
}
/*--------------------------------<<<<< The report start >>>>>--------------------------------*/
/*****************************************************************/
void xzrepmain(void)
{
int Idx; /* The index number of individual report */
byte rpt_type = 0xff; /* the report type flag
0: no report on display
1: daily report
2: daily dept report
3: daily PLU report
4: daily clerk report
5: hourly report
6:
7:
8: ptd report
9: ptd Dept report
10: ptd PLU report
*/
byte Idvul_Flag; /* The individual select flag
0: Did't press PLU, ECLRK, DEPT key.
1: Indicate press the DEPT key.
2: Indicate press the PLU key.
3: Indicate Press the ECLRK key.
ifdef VER_RSNT // Support the restaurant function.
4: Indicate press the OPEN key.
5: Indicate press the SUBPEND key.
6: Indicate press the WAITER key.
7: Indicate press the menu key.
endif // End VER_RSNT
*/
byte Idvul_Tail_Prn_Flag; /* The individual tail print flag
0: Has't print the report tail.
1: Has print the report tail.
*/
#ifdef STOCK /* Support the stock function */
byte Clr_PLU_Stock_Flag = 0; /* Clear the PLU stock flag */
#endif /* End STOCK */
Idvul_Head_Prn_Flag = NOTPRINTD;
Idvul_Flag = 0;
Idvul_Tail_Prn_Flag = NOTPRINTD;
zero_skip_flag = 0;
if((sysflag->soft_lock_flag) && (CurrMode == ZREPORT)) /* Use the soft control lock mode */
{
Comm_SetStatus(STATUS_REPORT);
Lcm_Disp_Str( Z_Report_mode ,LCM_LINE_2, ALIGN_MID, FALSE);
if(Secr_Pass() == NG) /* Must pass the security authentication */
return;
Comm_SetStatus(STATUS_IDLE);
}
Lcd_Init_Sys_ID(SYS_ID_XZRPT);//2005-12-12 init the map of the xz report
if(CurrMode == ZREPORT)
Lcm_Disp_Str( Z_Report_mode ,LCM_LINE_2, ALIGN_MID, FALSE);
else
Lcm_Disp_Str( X_Report_mode ,LCM_LINE_2, ALIGN_MID, FALSE);
Clr_Dsp_Data();
RightDisp(0L,sysflag->sysdots);
Get_Full_Text_List(Str_XZRpt_List, MAX_RPT_LIST_NUM, 1);
Rpt_Disp_Roll_flag = 0;
rpt_type = 0xff;
while(TRUE)
{
if (Idvul_Head_Prn_Flag == PRINTD)
{
Comm_SetStatus(STATUS_REPORT);
}
else
{
Comm_SetStatus(STATUS_IDLE);
}
if( GetIn() == NG )
{
Clr_Dsp_Data();
RightDisp(0, sysflag->sysdots);
continue;
}
GetMainMode();
if(MainMode != CurrMode)
{
if( Idvul_Head_Prn_Flag == PRINTD ) /* When print the individual reports head information, print the tail for the quit */
prn_Idvul_Tail(Idvul_Flag);
return;
}
Comm_SetStatus(STATUS_REPORT);
switch(InCmd)
{
case KD_PCLINK:
Comm_SetStatus(STATUS_COMM);
Communication();
Comm_SetStatus(STATUS_IDLE);
Clr_Dsp_Data();
RightDisp(0, sysflag->sysdots);
break;
case KD_PAGE_UP:
if(Text_Lcd.CurrLine < DISP_LCD_TEXT_LINE)
{
Text_Lcd.CurrLine = Text_Lcd.EndLine -1;
}
else
Text_Lcd.CurrLine -= DISP_LCD_TEXT_LINE;
Lcd_Reflush_List(0);
break;
case KD_PAGE_DOWN:
Text_Lcd.CurrLine += DISP_LCD_TEXT_LINE;
if((Text_Lcd.CurrLine >= Text_Lcd.EndLine)&&(Text_Lcd.CurrLine < Text_Lcd.EndLine +DISP_LCD_TEXT_LINE))
Text_Lcd.CurrLine = Text_Lcd.EndLine-1;
Lcd_Reflush_List(0);
break;
case KD_UP:
if(Text_Lcd.CurrLine % DISP_LCD_TEXT_LINE >0)
{
Text_Lcd.CurrLine --;
Lcd_Reflush_List(1);
}
else
{
Text_Lcd.CurrLine = (Text_Lcd.CurrLine + Text_Lcd.EndLine -1)%(Text_Lcd.EndLine);
Lcd_Reflush_List(0);
}
break;
case KD_DOWN:
if((Text_Lcd.CurrLine < Text_Lcd.EndLine -1)&&(Text_Lcd.CurrLine%DISP_LCD_TEXT_LINE < DISP_LCD_TEXT_LINE-1))
{
Text_Lcd.CurrLine ++;
Lcd_Reflush_List(1);
}
else
{
Text_Lcd.CurrLine = (Text_Lcd.CurrLine+1)%(Text_Lcd.EndLine);
Lcd_Reflush_List(0);
}
break;
case KD_ENTER:
#ifdef STOCK /* Support the PLU stock function */
Clr_PLU_Stock_Flag = 0;
#endif /* End STOCK */
if( rpt_type != 0xff )// a new item can be sellected
{
errorType(ERR_KEY_ILLEGAL);
break;
}
if(!numcnt)
{
if(CurrMode == XREPORT)
lnum = XRpt_Idx_List[Text_Lcd.CurrLine];
else
lnum = ZRpt_Idx_List[Text_Lcd.CurrLine];
}
if( lnum == 1 ) /* 1.Daily terminal report */
{
rpt_type = (byte)lnum;
Rpt_Disp_Roll_flag = 1;
Lcd_Disp_Daily_Rpt();
break;
}
else if( lnum == 11 ) /* 2.Period to date report */
{
rpt_type = (byte)lnum;
Rpt_Disp_Roll_flag = 1;
Lcd_Disp_PTD_Rpt();
break;
}
else if( lnum == 2 ) /* 3.Daily department sales report */
{
if( CurrMode == ZREPORT )
{errorType(ERR_Z_MODE);continue;}
rpt_type = (byte)lnum;
Rpt_Disp_Roll_flag = 1;
Lcd_Disp_Daily_Dept_Rpt();
break;
}
else if( lnum == 12 ) /* 4.Period to date department sales report */
{
if( CurrMode == ZREPORT )
{errorType(ERR_Z_MODE);continue;}
rpt_type = (byte)lnum;
Rpt_Disp_Roll_flag = 1;
Lcd_Disp_PTD_Dept_Rpt();
break;
}
else if( lnum == 3 ) /* 5.Daily department group sales report */
{
if( CurrMode == ZREPORT )
{errorType(ERR_Z_MODE);continue;}
rpt_type = (byte)lnum;
Rpt_Disp_Roll_flag = 1;
Idx = Get_Dept_PLU_Group_Num(DEPT_GROUP);
if(Idx == NOTOK)
{rpt_type = 0xff;continue;}
Lcd_Disp_Dept_Group_Rpt(DAILY, Idx);
break;
}
else if( lnum == 13 ) /* 6.Period to date department group sales report */
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -