📄 tool.c
字号:
errorType(ERR_DPSF_INHT);
return (NG);
}
else if((key == KD_DPLUSF)&&(!sysflag->DPLU_shift))
{
errorType(ERR_DPLUSF_INHT);
return (NG);
}
if ( !(((CurrMode == REGISTER)||(CurrMode == TRAINING)) && (sysflag->clerk_mode == 1)
&& (currclerk == NUL_VLU)) && (!waiter_input_flag) )
/* If currclerk is null and in the register mode,
indicate the program is in wait the clerk password input. */
{
if(key == KD_DPSF) /* Active or not the function of it. */
{
if(mode_disp_flag) /* Dispalying the working */
{
mode_disp_flag = 0;
DeptShiftFlag = 0;
Clr_Dsp_Data();
RightDisp(0, sysflag->sysdots);
Clr_DPSF_Disp();
}
DeptShiftFlag++;
if(DeptShiftFlag==4)
{
DeptShiftFlag=0;
Clr_DPSF_Disp(); /* Clear the period displayed in the VFD. */
}
else
VFDSetPeriod(DeptShiftFlag-1,SET); /* Display the decimal point */
//change the dept display on the LCD.
Lcd_Shift_Exchange(key);
}
else if(key == KD_DPLUSF)
{
if(mode_disp_flag) /* Dispalying the working */
{
mode_disp_flag = 0;
DPLUShiftFlag = 0;
Clr_Dsp_Data();
RightDisp(0, sysflag->sysdots);
Clr_DPSF_Disp();
}
DPLUShiftFlag++;
if(DPLUShiftFlag==4)
{
DPLUShiftFlag=0;
Clr_DPSF_Disp(); /* Clear the period displayed in the VFD. */
}
else
VFDSetPeriod(DPLUShiftFlag-1,SET); /* Display the decimal point */
//change the dept display on the LCD.
Lcd_Shift_Exchange(key);
}
else
{
errorType(ERR_DPSF_INHT);
return (NG);
}
}
else
return (NG);
break;
#ifdef SCANNER /* Support the scanner function */
case SPLU:
// if (SC_TranToBcd() == OK)
if (SpluKeyIn == OK)
{
SC_TransBcd();
lastincmd = InCmd;
InCmd = SPLU;
Clr_DPSF_Disp();
Lcd_Tl_Input_Disp(TL_INPUT_INPUTED, 0);
return (OK);
}
else
{
errorType(ERR_BAR_FORMAT);
return (NG);
}
break;
#endif /* End SCANNER */
case KD_PCLINK:
InCmd = KD_PCLINK;
Clr_DPSF_Disp();
Lcd_Tl_Input_Disp(TL_INPUT_INPUTED, 0);
return (OK);
break;
case CTRL_LOCK_CHG: /* Control lock changed */
InCmd = KD_NULL;
Clr_DPSF_Disp();
Lcd_Tl_Input_Disp(TL_INPUT_INPUTED, 0);
return (OK);
default :
keybak=key;
key = Isdigit(key, digit_code_table); /* Isdigit() returns 0xFF for not digit */
if(key != 0xFF) /* Is the digit key */
{
if(dec_flag)
dec_cnt ++;
In_Buff[numcnt++]= key;
TransDis(numcnt);
}
else /* do for command */
{
Clr_DPSF_Disp();
#ifdef SCANNER /* Support the scanner function */
if((numcnt > NUMLIMIT) || ((keybak == KD_PLU) && (numcnt > 5))
|| ((keybak == KD_SUBTTL||keybak==KD_SURE||keybak == KD_ENTER) && (ProgBar == 1))
|| ((sysflag->Input_Bar_Mode == 1) && (keybak == KD_PLU) && (numcnt != 0) && (PPLU_Group_Flag == 0)))
/* When the data is larger than the number limit, indicate input the bar code */
{
if(!((numcnt == 1) && (In_Buff[0] == 0) && (keybak == KD_PLU)))
{
if(en_longnum_chk(keybak) == NG)
{
errorType(ERR_DIGIT_ILLEGAL);
return (NG);
}
lastincmd = InCmd;
InCmd = keybak;
In_Buff[numcnt] = 0xFF;
if((numcnt <= 4)&&(ProgBar == 1)&&(keybak == KD_SUBTTL||keybak==KD_SURE||keybak == KD_ENTER))
asc2long();
else
lnum = 999999999L; /* A virtual value */
SC_KBToBcd(In_Buff); /* Changed to the compressed BCD */
if(key != KD_CLEAR)
BarInFlag = 1; /* Set the bar input flag */
Lcd_Tl_Input_Disp(TL_INPUT_INPUTED, 0);
return (OK);
}
}
#endif /* End SCANNER */
if(dec_flag) /* If has input the DEC key, check the DEC key press in legal or illegal */
{
if(en_dec_chk(keybak) == NG)
{
errorType(ERR_DEC_KEY);
return (NG);
}
}
lastincmd=InCmd; /** this place will change **/
InCmd = keybak;
if (numcnt)
{
In_Buff[numcnt] = 0xFF;
asc2long(); /* Change the BCD code number to the long data, store in 'lnum' */
}
else
lnum = 0L;
Lcd_Tl_Input_Disp(TL_INPUT_INPUTED, lnum);
return (OK);
} /* end else */
break;
} /* end switch */
} /* end while */
Lcd_Tl_Input_Disp(TL_INPUT_INPUTED, 0);
return (OK);
} /* end GetIn */
/******************************************************************************
Input ASCII code change to long data.
03-8-13 16:39
******************************************************************************/
long asc2long(void)
{
char cnt;
lnum = 0L;
for( cnt = 0;cnt < numcnt;cnt ++ )
lnum= lnum*10 + In_Buff[cnt];
if((Calc_Flag) && (Calc_Sign == NEGATIVE))
lnum = -lnum;
return(lnum);
}
/*------------------------------------------------------------------------------
* Change long data to a ASCII string and store to *addr,
* Input : unsigned long data -- > data need change.
* : *addr -- > data need store address.
* : len -- > the length of the ASCII data need.
* output :
* None
* 03-8-13 14:32
*
* For example,
* Input data is 12345678, and the len is 9;
* so:
*
* addr[0] 1 2 3 4 5 6 7 8
* +-----+-----+-----+-----+-----+-----+-----+-----+-----+
* | \0 | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' |
* +-----+-----+-----+-----+-----+-----+-----+-----+-----+
*
*------------------------------------------------------------------------------*/
void ltoa( unsigned long data, char *addr, char len )
{
char i;
addr += (len - 1);
// memset(addr,0x00,len);
while( ( len -- != 0 ) && data != 0)
{
i = (data % 10);
data = ((data - (data % 10))/10);
*addr-- = i + '0';
}
}
/*--------------------------------------------------------------------------------
* check the display blank arear start position
* In: String need check
* e.g. string is
* addr[0] 1 2 3 4 5 6 7 8
* +-----+-----+-----+-----+-----+-----+-----+-----+-----+
* | \0 | \0 | \0 | '3' | '4' | '5' | '6' | '7' | '8' |
* +-----+-----+-----+-----+-----+-----+-----+-----+-----+
* So the return is 2;
* 03-8-13 15:00
*-------------------------------------------------------------------------------*/
char disp_blk_chk(char *str,char len)
{
// char i;
str+=(len-1);
for ( ; len>0; len-- )
{
if ( *str -- == ' ' )
break;
}
return ( len-1 );
}
#if 1
/******************************************************************************/
void DisTime(void) /* Display thte time to the LCD */
{
byte month = 0, day = 0, year = 0;
byte hour, minute, second;
byte DateTime; /* The flag used to display the date or the time.
* 0: Display the time
* 1: Display the date
*/
word key; /* The press key code */
byte disp_buff[MAX_LCD_NUM];
byte bak_buff[MAX_LCD_NUM];
byte mon_posi_1, mon_posi_2;
byte day_posi_1, day_posi_2;
byte year_posi_1, year_posi_2;
byte last_datetime;
char lcd2_buff[MAX_LCD2_LEN+1];
char bak_lcd2_buff[MAX_LCD2_LEN+1];
/* The display style: [12/10/05 15:43:30] */
/* 12345678901234567890123456 */
DateTime=0; /* The first display the time */
last_datetime = !DateTime;
Clr_Period(); /* Clear the decimal point display */
Disp_Spec_Period();
Clr_Dsp_Data(); /* Clear the last display to the LCD */
RM_flag = 0; /* If the flag is 1, clear it */
if (sysflag->datefmt == 0)
{ /* MDY */
mon_posi_1 = 0;
mon_posi_2 = 1;
day_posi_1 = 3;
day_posi_2= 4;
year_posi_1 = 6;
year_posi_2= 7;
}
else if (sysflag->datefmt == 1)
{ /* DMY */
mon_posi_1 = 3;
mon_posi_2= 4;
day_posi_1 = 0;
day_posi_2= 1;
year_posi_1 = 6;
year_posi_2= 7;
}
else
{ /* YMD */
mon_posi_1 = 3;
mon_posi_2= 4;
day_posi_1 = 6;
day_posi_2= 7;
year_posi_1 = 0;
year_posi_2= 1;
}
memset(bak_buff, 0, MAX_LCD_NUM);
memset(bak_lcd2_buff, 0, MAX_LCD2_LEN);
while(1)
{
KPRP_BusyChk(); /*check the kp/rp timer out */
if(DateTime==0) /* Display the time */
{
disint();
year = GetYear();
month = GetMonth();
day = GetDay();
hour = GetHour();
minute = GetMinute();
second = GetSecond();
enint();
memset(disp_buff, ' ', MAX_LCD_NUM);
memset(disp_buff+1, '-', 6);
disp_buff[1]=(char)(hour/10+'0'); /* hour */
disp_buff[2]=(char)(hour%10+'0');
disp_buff[4]=(char)(minute/10+'0'); /* minute */
disp_buff[5]=(char)(minute%10+'0');
disp_buff[7]=(char)(second/10+'0'); /* second */
disp_buff[8]=(char)(second%10+'0');
if(memcmp(disp_buff, bak_buff, MAX_LCD_NUM) != 0)
{
memcpy(bak_buff, disp_buff, MAX_LCD_NUM);
VFDDisplay(disp_buff, NOTCLEARD, ALIGN_MID);
memset(lcd2_buff, ' ', MAX_LCD2_LEN);
lcd2_buff[mon_posi_1] = month/10 + '0';
lcd2_buff[mon_posi_2] = month%10 + '0';
lcd2_buff[2] = '/';
lcd2_buff[day_posi_1] = day/10 + '0';
lcd2_buff[day_posi_2] = day%10 + '0';
lcd2_buff[5] = '/';
lcd2_buff[year_posi_1] = year/10 + '0';
lcd2_buff[year_posi_2] = year%10 + '0';
lcd2_buff[10] = hour/10 + '0';
lcd2_buff[11] = hour%10 + '0';
lcd2_buff[12] = ':';
lcd2_buff[13] = minute/10 + '0';
lcd2_buff[14] = minute%10 + '0';
lcd2_buff[15] = '\0';
if (memcmp(lcd2_buff, bak_lcd2_buff, 15) != 0)
{
memcpy(bak_lcd2_buff, lcd2_buff, 15);
if (Lcd_Mode == LCD_10_INCH)
{
Lcd_Send_Text_Buff_Str(BUF_ID_TL_SUB, 1, lcd2_buff, ALIGN_MID);
}
else
{
Lcd_Send_Text_Buff_Mem(BUF_ID_TL_SUB, 1, lcd2_buff+10, 5, ALIGN_MID);
}
Lcd_Disp_Text_Buff(BUF_ID_TL_SUB);
}
if (Lcd_Mode == LCD_7_INCH && last_datetime != DateTime)
{
Lcd_Send_Text_Buff_Mem(BUF_ID_TL_SUB, 1, bak_lcd2_buff+10, 5, ALIGN_MID);
Lcd_Disp_Text_Buff(BUF_ID_TL_SUB);
}
}
}
else /* Display the date */
{
memset(disp_buff,'-',9);
disp_buff[0] = ' ';
if(sysflag->datefmt==2) /* Chinese date format YY-MM-DD */
{
disp_buff[1] = year /10 + '0'; /* year */
disp_buff[2] = year % 10 + '0';
disp_buff[4] = month / 10 + '0'; /* month */
disp_buff[5] = month % 10 + '0';
disp_buff[7] = day / 10 + '0'; /* day */
disp_buff[8] = day % 10 + '0';
}
else if(sysflag->datefmt==0) /* American date format MM-DD-YY */
{
disp_buff[1] = month / 10 + '0'; /* month */
disp_buff[2] = month % 10 + '0';
disp_buff[4] = day / 10 + '0'; /* day */
disp_buff[5] = day % 10 + '0';
disp_buff[7] = year / 10 + '0'; /* year */
disp_buff[8] = year % 10 + '0';
}
else if(sysflag->datefmt == 1) /* English date format DD-MM-YY */
{
disp_buff[1] = day / 10 + '0'; /* day */
disp_buff[2] = day % 10 + '0';
disp_buff[4] = month / 10 + '0'; /* month */
disp_buff[5] = month % 10 + '0';
disp_buff[7] = year / 10 + '0'; /* year */
disp_buff[8] = year % 10 + '0';
}
else
sysflag->datefmt = 1; /* When the other format, set it to the English format */
if(memcmp(disp_buff, bak_buff, MAX_LCD_NUM) != 0)
{
memcpy(bak_buff, disp_buff, MAX_LCD_NUM);
VFDDisplay(disp_buff, NOTCLEARD, LEFT); /* Display the year to the LCD */
if (Lcd_Mode == LCD_7_INCH)
{
Lcd_Send_Text_Buff_Mem(BUF_ID_TL_SUB, 1, disp_buff+1, 8, ALIGN_MID);
Lcd_Disp_Text_Buff(BUF_ID_TL_SUB);
}
}
} /* end else DateTime */
last_datetime = DateTime;
if(KBPress()) /* Judge one key perssed */
{
key = Rcode(KBCheck()); /* Get the key code */
switch(key)
{
case KD_CASH:
#ifdef RCPT_REPRN /* Support the receipt reprint function */
if(Rcpt_RePrn_Cnt != 0) /* Reprint the receipt */
{
Clr_Dsp_Data(); /* Clear the last disp */
RightDisp(0L,sysflag->sysdots);
Rst_Tl_Sub();
Lcd_Disp_Text_Buff(BUF_ID_TL_SUB);
return;
}
#endif /* End RCPT_REPRN */
case KD_CHECK: /* Do nothing */
case KD_CHARGE:
case KD_SUBTTL:
break;
case KD_CLEAR:
GetKey(); /* Clear the key buffer */
Clr_Dsp_Data();
RightDisp(0L,sysflag->sysdots);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -