⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sale1.c

📁 一款收款机C源代码!因为是几年前的代码了
💻 C
📖 第 1 页 / 共 5 页
字号:
/*
 * Module: SALE1.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 "string.h"
#include "stdlib.h"
#include "disp.h"
#include "keydef.h"
#include "lcd2.h"
#include "mathes.h"
#include "stdio.h"
#include "Tft_disp.h"
#include "font.h"

/*************************************************************/
/**------------------------------------------------**
 ** process RA                                     **
 **------------------------------------------------**/
void Do_RA(void)
{
	if(NewTrans)	/* The transaction not end */
		{errorType(ERR_SALE_NO_END);return;}
    if((Void_flag) || (RM_flag) || (Mul_flag))
   	    {errorType(ERR_KEY_SEQ);return;}
    if((numcnt==0) || (lnum == 0))
   	    {errorType(ERR_DIGIT_ILLEGAL);return;}
    if(lnum > MAX_RA_NUM)
   	    {errorType(ERR_DIGIT_ILLEGAL);return;}

   /** print time and consective number **/
//   if(CurrMode == REGISTER)		/* Update the report */
//   {
//      if((lnum+report.RAamount)>MAXAMT)
//      	{errorType(ERR_DIGIT_ILLEGAL);return;}
//      if((lnum+PTD_report.RAamount)>MAXAMT)
//      	{errorType(ERR_DIGIT_ILLEGAL);return;}
//
//      report.RAamount  +=lnum;
//      report.RACount ++;
//      PTD_report.RAamount  +=lnum;
//      PTD_report.RACount ++;
//
//      report.CashTotal +=lnum;
//      PTD_report.CashTotal +=lnum;
//      report.GrandTotal += lnum;
//      PTD_report.GrandTotal += lnum;
//      DL_Add(&report.NRGT, lnum, sysflag->sysdots);
//      DL_Add(&PTD_report.NRGT, lnum, sysflag->sysdots);
//		Set_Rpt_Flag(RPT_FULL_DAILY);
//		Set_Rpt_Flag(RPT_FULL_PTD);
//		Set_Rpt_Flag(RPT_NRGT);
//   }

    Clr_Dsp_Data();	
//   Insert_Sect(SECT_RA,0);
	//disp_Char_Str(Disp_Sale_RA, 0);
	Lcm_Disp_Str(Disp_Sale_RA, LCM_LINE_2 ,ALIGN_MID, FALSE );
	
	RightDisp(lnum, sysflag->sysdots);
    Lcd_Send_Text_Buff_Str_Sub(BUF_ID_TL_SUB, 1,Disp_Sale_RA,15, lnum, sysflag->sysdots, ALIGN_LEFT);
    Lcd_Disp_Text_Buff(BUF_ID_TL_SUB);
    ra_flag = 1;
    po_flag = 0;
    ra_input = lnum;

//   _DrawOn();
//   Head_Prn_Flag = 0;				/* Not print the flush print head */
//   Logo_Prn_Flag = 0;				/* Not print the logo */
////   prn_Adj(Var_Str_RA,lnum,sysflag->sysdots,RPOSI);
//   Prn_Adj_Ex(Var_Str_RA,lnum,sysflag->sysdots,RPOSI,DESC_NEW);
//   prn_Line('-');
//   prn_Stamp();
//   Logo_Prn_Flag = 1;
//   #ifdef RCPT_REPRN				/* Support the receipt reprint function */
//   Rcpt_RePrn_Cnt = 0;
//   #endif /* End RCPT_REPRN */
}  


/*************************************************************/
/**---------------------------------------------------**
 ** processing paid out operation                     **
 **---------------------------------------------------**/
void Do_PO(void)
{
   if(NewTrans)	/* The transaction not end */
   	{errorType(ERR_SALE_NO_END);return;}
   if((Void_flag) || (RM_flag) || (Mul_flag))
   	{errorType(ERR_KEY_SEQ);return;}
   if((numcnt==0) || (lnum == 0))
   	{errorType(ERR_DIGIT_ILLEGAL);return;}
   if(lnum > MAX_PO_NUM)
   	{errorType(ERR_DIGIT_ILLEGAL);return;}

//   if(CurrMode == REGISTER)			/* Update the PO operation report */
//   {
//      if((lnum + report.POamount)>MAXAMT)
//			{errorType(ERR_DIGIT_ILLEGAL);return;}
//      if((lnum + PTD_report.POamount)>MAXAMT)
//			{errorType(ERR_DIGIT_ILLEGAL);return;}
//
//      report.POamount +=lnum;
//      report.POCount ++;
//      PTD_report.POamount +=lnum;
//      PTD_report.POCount ++;
//
//      report.CashTotal -=lnum;
//      PTD_report.CashTotal -=lnum;
//      report.GrandTotal -= lnum;
//      PTD_report.GrandTotal -= lnum;
//      DL_Add(&report.NRGT, -lnum, sysflag->sysdots);
//      DL_Add(&PTD_report.NRGT, -lnum, sysflag->sysdots);
//		Set_Rpt_Flag(RPT_FULL_DAILY);
//		Set_Rpt_Flag(RPT_FULL_PTD);
//		Set_Rpt_Flag(RPT_NRGT);
//   }

   Clr_Dsp_Data();
//   Insert_Sect(SECT_PO,0);
	//disp_Char_Str(Disp_Sale_PO, 0);
	Lcm_Disp_Str(Disp_Sale_PO, LCM_LINE_2 ,ALIGN_MID , FALSE);
	
   RightDisp(-lnum, sysflag->sysdots);
   Lcd_Send_Text_Buff_Str_Sub(BUF_ID_TL_SUB, 1,Disp_Sale_PO,15, lnum, sysflag->sysdots, ALIGN_LEFT);
   Lcd_Disp_Text_Buff(BUF_ID_TL_SUB);
   po_flag = 1;
   ra_flag = 0;
   po_input = lnum;

//   _DrawOn();
//   Head_Prn_Flag = 0;				/* Not print the flush print head */
//   Logo_Prn_Flag = 0;				/* Not print the logo */
////   prn_Adj(Var_Str_PO,-lnum,sysflag->sysdots,RPOSI);
//   Prn_Adj_Ex(Var_Str_PO,-lnum,sysflag->sysdots,RPOSI,DESC_NEW);
//   prn_Line('-');
//   prn_Stamp();
//   Logo_Prn_Flag = 1;
//   #ifdef RCPT_REPRN				/* Support the receipt reprint function */
//   Rcpt_RePrn_Cnt = 0;
//   #endif /* End RCPT_REPRN */
}

/* Process RA operation */
void	Do_RA_Ex(void)
{
	if(numcnt)
	{
		errorType(ERR_DIGIT_ILLEGAL);
		return;
	}
	if(InCmd == KD_CASH)
	{
        report.RAamount  +=ra_input;
        report.RACount ++;
        PTD_report.RAamount  +=ra_input;
        PTD_report.RACount ++;
        
        report.CashTotal +=ra_input;
        PTD_report.CashTotal +=ra_input;
        report.GrandTotal += ra_input;
        PTD_report.GrandTotal += ra_input;
        DL_Add(&report.NRGT, ra_input, sysflag->sysdots);
        DL_Add(&PTD_report.NRGT, ra_input, sysflag->sysdots);
		Set_Rpt_Flag(RPT_FULL_DAILY);
		Set_Rpt_Flag(RPT_FULL_PTD);
		Set_Rpt_Flag(RPT_NRGT);

	    Clr_Dsp_Data();
	   //Insert_Sect(SECT_RA,0);
	    Lcm_Disp_Str(RA_Cash,LCM_LINE_2 , ALIGN_LEFT, FALSE);
	    RightDisp(ra_input, sysflag->sysdots);
        
	    _DrawOn();
  	    Head_Prn_Flag = 0;				/* Not print the flush print head */
  	    Logo_Prn_Flag = 0;				/* NOt print the logo */
  	    Prn_InsFmtStr(Var_Str_RA, 1, Get_Spec_Len(Var_Str_RA), FLUSH_LEFT);
  	    Print_Ex(1);
  	    Prn_Adj_Ex(Var_Str_Cash,ra_input,sysflag->sysdots,RPOSI, DESC_NEW);
  	    prn_Line('-');
  	    prn_Stamp();
  	    Logo_Prn_Flag = 1;
  	    Flag_Prn_Head = FALSE;
  	    #ifdef	RCPT_REPRN			/* Support the receipt reprint function */
  	    Rcpt_RePrn_Cnt = 0;
  	    #endif /* End RCPT_REPRN */
        
        Lcd_Send_Text_Buff_Str(BUF_ID_LCD_TEXT, 1, RA_Cash, ALIGN_LEFT);
        LongLcdFmt_Text_Buff(BUF_ID_LCD_TEXT, 15, ra_input, sysflag->sysdots, ALIGN_LEFT);
        Lcd_Disp_Text_Buff(BUF_ID_LCD_TEXT);  
        
	}
	else if(InCmd == KD_CHECK)
	{
        report.RAChk1Amt  +=ra_input;
        report.RAChk1Cnt ++;
        PTD_report.RAChk1Amt  +=ra_input;
        PTD_report.RAChk1Cnt ++;
      
        report.Chk1Total +=ra_input;
        PTD_report.Chk1Total +=ra_input;
        report.GrandTotal += ra_input;
        PTD_report.GrandTotal += ra_input;
        DL_Add(&report.NRGT, ra_input, sysflag->sysdots);
        DL_Add(&PTD_report.NRGT, ra_input, sysflag->sysdots);
		Set_Rpt_Flag(RPT_FULL_DAILY);
		Set_Rpt_Flag(RPT_FULL_PTD);
		Set_Rpt_Flag(RPT_NRGT);

	    Clr_Dsp_Data();
	   //Insert_Sect(SECT_RA,0);
	    Lcm_Disp_Str(RA_Check,LCM_LINE_2 , ALIGN_LEFT, FALSE);
	    RightDisp(ra_input, sysflag->sysdots);
        
	    _DrawOn();
	    Head_Prn_Flag = 0;				/* Not print the flush print head */
	    Logo_Prn_Flag = 0;				/* NOt print the logo */
	    Prn_InsFmtStr(Var_Str_RA, 1, Get_Spec_Len(Var_Str_RA), FLUSH_LEFT);
	    Print_Ex(1);
		memcpy(prn_Buf+1, check[0], MAX_DESC_LEN);
		LongPrnFmt(ra_input, sysflag->sysdots, RPOSI, RIGHTFLUSH);
	    print();
	    prn_Line('-');
	    prn_Stamp();
	    Logo_Prn_Flag = 1;
	    Flag_Prn_Head = FALSE;
	   #ifdef	RCPT_REPRN			/* Support the receipt reprint function */
	    Rcpt_RePrn_Cnt = 0;
	   #endif /* End RCPT_REPRN */
       
       Lcd_Send_Text_Buff_Str(BUF_ID_LCD_TEXT, 1, RA_Check, ALIGN_LEFT);
       LongLcdFmt_Text_Buff(BUF_ID_LCD_TEXT, 15, ra_input, sysflag->sysdots, ALIGN_LEFT);
       Lcd_Disp_Text_Buff(BUF_ID_LCD_TEXT);  
	}
	else if(InCmd == KD_CHARGE)
	{
        report.RACrg1Amt  +=ra_input;
        report.RACrg1Cnt ++;
        PTD_report.RACrg1Amt  +=ra_input;
        PTD_report.RACrg1Cnt ++;
      
        report.Crg1Total +=ra_input;
        PTD_report.Crg1Total +=ra_input;
        report.GrandTotal += ra_input;
        PTD_report.GrandTotal += ra_input;
        DL_Add(&report.NRGT, ra_input, sysflag->sysdots);
        DL_Add(&PTD_report.NRGT, ra_input, sysflag->sysdots);
		Set_Rpt_Flag(RPT_FULL_DAILY);
		Set_Rpt_Flag(RPT_FULL_PTD);
		Set_Rpt_Flag(RPT_NRGT);

	    Clr_Dsp_Data();
	   //Insert_Sect(SECT_RA,0);
	    Lcm_Disp_Str(RA_Charge,LCM_LINE_2 , ALIGN_LEFT, FALSE);
	    RightDisp(ra_input, sysflag->sysdots);
        
	    _DrawOn();
	    Head_Prn_Flag = 0;				/* Not print the flush print head */
	    Logo_Prn_Flag = 0;				/* NOt print the logo */
	    Prn_InsFmtStr(Var_Str_RA, 1, Get_Spec_Len(Var_Str_RA), FLUSH_LEFT);
	    Print_Ex(1);
		memcpy(prn_Buf+1, charge[0], MAX_DESC_LEN);
		LongPrnFmt(ra_input, sysflag->sysdots, RPOSI, RIGHTFLUSH);
	    print();
	    prn_Line('-');
	    prn_Stamp();
	    Logo_Prn_Flag = 1;
	    Flag_Prn_Head = FALSE;
	   #ifdef	RCPT_REPRN			/* Support the receipt reprint function */
	    Rcpt_RePrn_Cnt = 0;
	   #endif /* End RCPT_REPRN */
       
       Lcd_Send_Text_Buff_Str(BUF_ID_LCD_TEXT, 1, RA_Charge, ALIGN_LEFT);
       LongLcdFmt_Text_Buff(BUF_ID_LCD_TEXT, 15, ra_input, sysflag->sysdots, ALIGN_LEFT);
       Lcd_Disp_Text_Buff(BUF_ID_LCD_TEXT);  
	}
	else if(InCmd == KD_MISC)
	{
      report.RAMISCAmt  +=ra_input;
      report.RAMISCCnt ++;
      PTD_report.RAMISCAmt  +=ra_input;
      PTD_report.RAMISCCnt ++;
      
      report.MiscTotal +=ra_input;
      PTD_report.MiscTotal +=ra_input;
      report.GrandTotal += ra_input;
      PTD_report.GrandTotal += ra_input;
      DL_Add(&report.NRGT, ra_input, sysflag->sysdots);
      DL_Add(&PTD_report.NRGT, ra_input, sysflag->sysdots);
		Set_Rpt_Flag(RPT_FULL_DAILY);
		Set_Rpt_Flag(RPT_FULL_PTD);
		Set_Rpt_Flag(RPT_NRGT);

	   Clr_Dsp_Data();
	   //Insert_Sect(SECT_RA,0);
	   Lcm_Disp_Str(RA_Misc,LCM_LINE_2 , ALIGN_LEFT, FALSE);
	   RightDisp(ra_input, sysflag->sysdots);
       
	   _DrawOn();
	   Head_Prn_Flag = 0;				/* Not print the flush print head */
	   Logo_Prn_Flag = 0;				/* NOt print the logo */
	   Prn_InsFmtStr(Var_Str_RA, 1, Get_Spec_Len(Var_Str_RA), FLUSH_LEFT);
	   Print_Ex(1);
	   Prn_Adj_Ex(Var_Str_Misc,ra_input,sysflag->sysdots,RPOSI, DESC_NEW);
	   prn_Line('-');
	   prn_Stamp();
	   Logo_Prn_Flag = 1;
	   Flag_Prn_Head = FALSE;
	   #ifdef	RCPT_REPRN			/* Support the receipt reprint function */
	   Rcpt_RePrn_Cnt = 0;
	   #endif /* End RCPT_REPRN */

       Lcd_Send_Text_Buff_Str(BUF_ID_LCD_TEXT, 1, RA_Misc, ALIGN_LEFT);
       LongLcdFmt_Text_Buff(BUF_ID_LCD_TEXT, 15, ra_input, sysflag->sysdots, ALIGN_LEFT);
       Lcd_Disp_Text_Buff(BUF_ID_LCD_TEXT);  
	}
	ra_flag = 0;
    
}


/* Process PO operation */
void	Do_PO_Ex(void)
{
	if(numcnt)
	{
		errorType(ERR_DIGIT_ILLEGAL);
		return;
	}
	if(InCmd == KD_CASH)
	{
      report.POamount +=po_input;
      report.POCount ++;
      PTD_report.POamount +=po_input;
      PTD_report.POCount ++;

      report.CashTotal -=po_input;
      PTD_report.CashTotal -=po_input;
      report.GrandTotal -= po_input;
      PTD_report.GrandTotal -= po_input;
      DL_Add(&report.NRGT, -po_input, sysflag->sysdots);
      DL_Add(&PTD_report.NRGT, -po_input, sysflag->sysdots);
		Set_Rpt_Flag(RPT_FULL_DAILY);
		Set_Rpt_Flag(RPT_FULL_PTD);
		Set_Rpt_Flag(RPT_NRGT);

 	    Clr_Dsp_Data();
 	   //Insert_Sect(SECT_PO,0);
 	    Lcm_Disp_Str(PO_Cash ,LCM_LINE_2 , ALIGN_LEFT, FALSE);
 	    RightDisp(-po_input, sysflag->sysdots);
 
 	    _DrawOn();
  	    Head_Prn_Flag = 0;				/* Not print the flush print head */
  	    Logo_Prn_Flag = 0;				/* Not print the logo */
  	    Prn_InsFmtStr(Var_Str_PO, 1, Get_Spec_Len(Var_Str_PO), FLUSH_LEFT);
  	    Print_Ex(1);
  	    Prn_Adj_Ex(Var_Str_Cash,-po_input,sysflag->sysdots,RPOSI, DESC_NEW);
  	    prn_Line('-');
  	    prn_Stamp();
  	    Logo_Prn_Flag = 1;
  	    Flag_Prn_Head = FALSE;
	   #ifdef	RCPT_REPRN			/* Support the receipt reprint function */
	    Rcpt_RePrn_Cnt = 0;
	   #endif /* End RCPT_REPRN */
       
       Lcd_Send_Text_Buff_Str(BUF_ID_LCD_TEXT, 1, PO_Cash, ALIGN_LEFT);
       LongLcdFmt_Text_Buff(BUF_ID_LCD_TEXT, 15, -po_input, sysflag->sysdots, ALIGN_LEFT);
       Lcd_Disp_Text_Buff(BUF_ID_LCD_TEXT);  
	}
	else if(InCmd == KD_CHECK)
	{
        report.POChk1Amt +=po_input;
        report.POChk1Cnt ++;
        PTD_report.POChk1Amt +=po_input;
        PTD_report.POChk1Cnt ++;
  
        report.Chk1Total -=po_input;
        PTD_report.Chk1Total -=po_input;
        report.GrandTotal -= po_input;
        PTD_report.GrandTotal -= po_input;
        DL_Add(&report.NRGT, -po_input, sysflag->sysdots);
        DL_Add(&PTD_report.NRGT, -po_input, sysflag->sysdots);
		Set_Rpt_Flag(RPT_FULL_DAILY);
		Set_Rpt_Flag(RPT_FULL_PTD);
		Set_Rpt_Flag(RPT_NRGT);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -