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

📄 protest.c

📁 一款收款机C源代码!因为是几年前的代码了
💻 C
📖 第 1 页 / 共 4 页
字号:
//				errorType(ERR_FLASH_EXIST);
//				Init_Jrnl_Para(0);
//			}
//		}
	}
	#endif /* End ELEC_JRNL */

   /*** Print the all clear operations information ***/
	prn_Str();						/* Print a blank line */
   prn_Line('*');
   prn_Alloc();					/* Print the allocate information */
   memcpy(prn_Buf+1,Str_Protest,MAX_PRN_LEN);
//   print();
	prn_Str();
   prn_Line('*');
   Line_Feed(6);

   /*** Initialize the check data ***/
   CMOS_Legl_Set();
   Isp_ClrCmos();
	
   /** Clear the dispaly, indicate the all clear operation is completed ***/
	Clr_Dsp_Data();
	Ts_MinMax_Define();
	Tax_Init();
}
/*============================================================================*
 * Reset the system flag to default 
 *	初使化系统标志为默认值,
 *  总共有三个部分可以操作, system flag, system option, print option
 *  输入参数:	flag -- 0xff <-- 对上述三个区域都进行默认值设定
 *						0x01 <-- 仅仅对print option进行设定
 *						0x02 <-- system option
 *						0x03 <-- system configuration
 *============================================================================*/
void	Rst_Sysflag(byte flag)
{
   sysflag = &sys_flag;          /** Initial the pointer **/

    /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
            Terminal status 1 -- print set parameters
     * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */   
    if(flag == 0xff || flag == 1 )//Part 1
    {
        sysflag->date_prn = 1;       //print date on the receipt?            0-NO / 1-YES 
        sysflag->time_prn = 1;       //Print Time on reeipt?                 0-NO / 1-YES 
        sysflag->clerk_prn = 1;      //Print Clerk on receipt?               0-NO / 1-YES                   
        sysflag->Header_prn = 1;     //Print Header on receipt?              0-NO / 1-YES                 
        sysflag->footer_prn = 1;     //Print footer on receipt?                      0-NO / 1-YES                
        sysflag->Tax_prn = 1;        //Print Tax Amount on receipt?          0-NO / 1-YES                   
        sysflag->Tax_Ttl_prn = 1;    //Print Tax Total on receipt?                   0-NO / 1-YES                      
        sysflag->Blank_Line_prn = 0; //Print Blank line on receipt?                  0-NO / 1-YES                  
        sysflag->Subt_PressPrn = 1;       /**  Print the subttl data when press the subttl key
                                     **  in the REGISTER mode flag
                                     **  0: Do not print the subttldata when press the subttl key
                                     **  1: Print the subttl data when press the subttl key
                                     **/    
        sysflag->Subt_Prn = 1;
        sysflag->Mche_Num_prn = 1;   //Print the machine No. on receipt?         0-NO / 1-YES      
        sysflag->Rcpt_Num_prn = 1;   //Print the receipt No. on receipt?           0-NO / 1-YES
        sysflag->zero_skip = 1;      //Zero item skip when X/Z report printing?    0-NO / 1-YES
        sysflag->Z_Rpt_Reprn = 1;    //Z report second copy Active or not?    0-NO / 1-YES
        sysflag->Rcpt_Reprn = 1;     //Multiple receipt allow or not?                0-NO / 1-YES
        sysflag->Z_Cntr_prn = 1;     //Print the Z counter to Z report?            0-NO / 1-YES
        sysflag->RPLDP_flag = 0;     //Print Dept No. when PLU sale?                     0-NO / 1-YES
        sysflag->NS_switch = 1;      //Print the receipt when #/NS key is depressed?0-NO / 1-YES
        sysflag->Rcpt_prn = 1;       //Print the sale receipt or not?                0-NO / 1-YES
        if(sysflag->Rcpt_prn == 0)
            VFDSetPeriod(9, SET);
        
        sysflag->Crncy_Symbl_Prn = 0;
        sysflag->PLU_Prn_Fmt = 0;    /*  PLU sale's print format 
                                    0-name and price only
                                    1-barcode and PLU # only
                                    2-name and PLU#/Barcode only
                                */
        sysflag->Logo_Prn_Flag = 1;//    {"Picture Logo active"},                            0-NO / 1-YES
        sysflag->LogoPosi_Flag = 1;   //Position of picture logo select      0-Head / 1-Tail
    }    
    /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
              Terminal status 2 -- system sections parameters 
     * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */   
    if(flag == 0xff || flag == 2)
    {
        sysflag->dept_shift = 1;//    {"Dept Shift key active"},
        sysflag->DPLU_shift = 1;//    {"DPLU shift key active"},
    #ifdef STOCK            /* Support the PLU stock function */
        #if COUNTRY == HONGKONG
        sysflag->PLU_Stock_Flag = 0;//    {"Inventory function active"},
        #else
        sysflag->PLU_Stock_Flag = 1;//    {"Inventory function active"},
        #endif
    #endif /* End STOCK */
        sysflag->zero_trans_flag = 0;//    {"Zero price for Dept/PLU sale"},
//    #ifdef ELEC_JRNL
        sysflag->Log_Atv_Flag = 0;//    {"EJ features active"},
//    #endif
        sysflag->Cmpls_Amt_Mode = 0;//    {"Compulsory amount tend when payment"},
        sysflag->DPAmt_Per_Ttl_Flag = 0; //    {"% IN DEPT for report"},//部门所占销售总额的百分比.
        sysflag->z_reset_rcpt_no = 1;//    {"Reset the receipt# after daily Z report printed"},
        sysflag->Rst_ZCntr_Flag = 1;//    {"Reset the Z counter aftere daily Z report printed"},
        sysflag->Rst_GndTt_Flag = 1;//    {"Reset the Ground Total after daily Z report printed"},
        sysflag->clerk_mode = 1;//    {"Clerk System active"},
        sysflag->Clerk_Pscd_Flag = 0;//    {"Clerk passcode active"},
        sysflag->Screen_Saver = 0;
        sysflag->Crncy_Symbol = 0;
    }
    /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
              Terminal status 3 -- system config parameters 
     * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */   
    if(flag == 0xff || flag == 3)
    {
        sysflag->datefmt = 0;             // Date Format: 0: MM-DD-YY/ 1: DD-MM-YY/ 2: YY-MM-DD
        sysflag->timefmt = 0;             //Time Format:  0: 24 hour / 1: 12 hour with AM/PM
        sysflag->Language = 0;            //Language choice (0: English/1: French/2: Spanish)  
        sysflag->Tax_System = TAX_MODE;          //Tax system (0: USA Tax/1: VAT/2: GST-PST)                    
        sysflag->sysdots = 2;             /** decimal point(0~3) **/   
        sysflag->Power_Save = 0;          //Power saving                                    
        sysflag->Bright = 0;              //Brightless of TFT display                       
    }
    /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
          Terminal status 4 -- system parameters 
    * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */   
    if(flag == 0xff)
    {
        sysflag->HaloNum = 99999999;  /** High amount lock out number, the default is 88888888 **/
        sysflag->McheNum = 0001;      /** Machine number, the default is 0001 **/
        sysflag->RcptNum = 000001;    /** Recepit number, the default is 0001 **/

        sysflag->top_cash_ttl = 99999999;/* The top cash total in drawer */
        memset(&(sysflag->GrandTotal), 0, sizeof(DoubleLong));
    	sysflag->CurrLogoNo = 4;
        sysflag->XPasscode = 123456;
        sysflag->PZPasscode = 123456;
        sysflag->TraningPscd = 123456;
    /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
          Terminal status 5 -- Weight Barcode ID 
    * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */   
        sysflag->wgt_bar.id = 99;           /* The default is 99 */
        sysflag->wgt_bar.len = 5;           /* The default is 5 */
        sysflag->wgt_bar.flag = PRIC;       /* The default is store the price */
        
    }
    if(flag == 0xff)
    {
        /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
              Terminal status 6 -- Reserved flag
        * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */   
    	#ifdef STOCK		/* Support the PLU stock function */
    	sysflag->Udt_Stock_Mode = 1;	/** The mode of update stock
    		 									 ** 0: Overwrite the stock attribute.
    		 									 ** 1: Increase the stock attribute.
    		 									 ** 2: Decrease the stock attribute.
    		 									 **/
    	#endif /* End STOCK */


       sysflag->xCount_round = 0;    /** The REGISTER mode do the multiplucation roundings.
                                      ** 00:  Round    (1.544=1.54, 1.545=1.55 )           
                                      ** 01:  Round up (1.544=1.55, 1.545=1.55 )           
                                      ** 10:  Cuf off  (1.544=1.54, 1.545=1.54 )           
                                      **/

       sysflag->tax_round = 0;       /** Tax or VAT rounding                                     
                                      ** 00:  Round 2 decimal places             round     
                                      ** 01:  Round up to 2 decimal places       round up  
                                      ** 10:  Round off 2 decimal places  (10)   round off 
                                      **/


    	sysflag->Btm_Msg_Flag = 0;		/**  The Bottom message printed in the receipt's head flag.
    											 **	1: Print the bottom message in the receipt's head.
    											 **	0: Print the bottom message in the receipt's tail.
    											 **/

       sysflag->BackLight = 1;       /**  The LCD backlight flag
                                      **  0: Close the Backlight 
                                      **  1: Open the Backlight  
                                      **/
       LCD_Back(ON);                 /* Open the LCD backlight */

       sysflag->fl_wmotor = 1;       /**  Wind motor switch                             
                                      **  0:  Do not wind the paper during printing feed 
                                      **  1:  Wind the paper during feed                 
                                      **/

    	#ifdef SCANNER			/* Support the scanner function */
    	sysflag->Input_Bar_Mode = 0;	/**  Input the PLU's barcode mode or not flag, 
    											 **  0: Not input the PLU's barcode mode.(In this mode, 
    											 **     when input more then 6 digits, it will considered
    											 **	  to be input the PLU's barcode)
    											 **  1: The all input is input the PLU barcode mode.
    											 **/
    	#endif /* End SCANNER */

    	#ifdef AUTO_PER		/* Support the department auto percent function */
    	sysflag->Auto_Per_Use_Flag = 0;/**  Use the auto percent function or not flag
    											 **  0: Not use the auto percent function.
    											 **  1: Use the auto percent function.
    											 **/

    	sysflag->Auto_Per_Prn_Flag = 1;/**  When print the department's attribute, print the auto
    											 **  percent rate or not.
    											 **  0:  Can not print the auto percent rate.
    											 **  1:  Must print the auto percent rate.
    		                            **/
    	#endif /* End AUTO_PER */


       #ifdef VER_RSNT      /* Support the restaurant function */
       sysflag->Waiter_Must_Flag = 0;/**  The restaurant mode, when open the table, must input 
    											 **  the waiter's password or not.
    											 **  0: Not the must input the waiter's password.
    											 **  1: Must input the waiter's password when open the table
    											 **/

    	sysflag->Waiter_Sure_Flag = 0;/**  The restaurant mode, when awake an active table, 
    											 **  whether sure the waiters password or not.
    											 **  0: Not to sure the password.
    											 **  1: Must sure the password.
    											 **/
       #endif /* End VER_RSNT */

       sysflag->tax_shift_mode = 0;  /**  When press tax shift key, the function is ont shot or stay down
                                      **  0:  Tax shift one-shot                                         
                                      **  1:  Tax shift stay-down                                        
                                      **/

    	#ifdef ELEC_JRNL			/* Support the electronic journal function */
    	sysflag->Elec_Jrnl_VAT_Flag = 1;/**  The restaurant mode, when open the table, must input 
    											 **  the waiter's password or not.
    											 **  0: Not the must input the waiter's password.
    											 **  1: Must input the waiter's password when open the table
    											 **/
    	#endif /* End ELEC_JRNL */

    	#if	COUNTRY == SWEDEN
    	sysflag->prn_table_detail = 1;/**  Print the table detail transaction information flag
    											 **  0: Not print the table detail transaction information 
    											 **	  when tender the table.
    											 **  1: Print a table detail transaction information
    											 **	  when tender the table.
    											 **/
    	#else /* Else COUNTRY == SWEDEN */
    	sysflag->prn_table_detail = 0;/**  Print the table detail transaction information flag
    											 **  0: Not print the table detail transaction information 
    											 **	  when tender the table.
    											 **  1: Print a table detail transaction information
    											 **	  when tender the table.
    											 **/
    	#endif /* End COUNTRY == SWEDEN */


    	sysflag->Security = 0;			/** The security of the P&Z mode, when in the soft control lock mode */

    	sysflag->Dept_Shift_Inc = MAX_DEPT_KEY_CNTR;			/* The default increment is 6 */
    	sysflag->DPLU_Shift_Inc = MAX_DPLU_KEY_CNTR;			/* The default increment is 6 */
    	sysflag->PrnAdj_Flag = 1;
    //	if(sysflag->PrnAdj_Flag)
    //		sysflag->LogoPosi_Flag = TAIL;
    //	else
    //		sysflag->LogoPosi_Flag = HEAD;
    	
    	sysflag->LCD_BL_Time = DFT_LCD_BL_TIME;
    	sysflag->set_timmer = 500;
    	sysflag->LineFeedCnt = 6;
    	#if SW_VER == SW_WD2
    	sysflag->Max_Reprn_Cnt = 1;
    	#endif
    	sysflag->Prn_Bar_Flag = 0;			/* Not to print the PLU bar code when in doing the register operation and PLU report operation */
    	sysflag->prn_tab_pre_posi = 2;
    	sysflag->check_clerk = 1;			/* The default use the previous style */
    }
}

/* Reset the department programming data to default */
void	Rst_Dept(byte clr_rpt_flag)
{
	byte i;
	word j;
	byte desc_len;			/* The description's length */
      byte tmp_max_Dept = MAX_DFT_DEPT_CNT;
    byte cm_idx;

   if(tmp_max_Dept > Max_Dept_No)
      tmp_max_Dept = Max_Dept_No;
   
   for(j = 0; j < Max_Dept_No; j ++)
   {
      dept[j].pflag = 0x00;
      dept[j].pflag2 = 0x00;
      dept[j].sale = 0;
      dept[j].group = 1;
      dept[j].Hdlo = 7;
      dept[j].price = 0L;
      #ifdef AUTO_PER		/* Support the department auto percent function */
      dept[j].per_flag = 1;
      dept[j].per_rate = 0;
      #endif /* End AUTO_PER */
      #ifdef VER_RSNT		/* Support the restaurant function */
      dept[j].send_kp_flag = 0;			/* Allow send the information to the kitchen printer */
      #endif /* End VER_RSNT */
      dept[j].fill_color = DARKGREEN;
      dept[j].font_color = YELLOW;
      if(clr_rpt_flag)
      {
	      dept[j].quantity = 0;
	      dept[j].PTD_quantity = 0;
	      dept[j].amount = 0;
	      dept[j].PTD_amount = 0;
	   }
//      memcpy(dept[j].desc,Str_Dept_Desc,MAX_DESC_LEN);
      memset(dept[j].desc, 0x20, MAX_DESC_LEN_EX);
		desc_len = desc_cpy(dept[j].desc,Str_Dept_Desc,2);
      dept[j].desc[desc_len]=(j+1)/100+'0';
      dept[j].desc[desc_len+1]=((j+1)%100)/10+'0';
		dept[j].desc[desc_len+1+1]=(j+1)%10+'0';
        dept[j].desc[MAX_DESC_LEN_EX] = 0;

        cm_idx = 0;
        dept[j].cm_cnt = 0;
        for (i = 0; (i < MAX_DEPT_CM_NO)&&(i < DFT_CM_CNT); i++)        // The default has cooking message
        {
            if (cm_idx == j)
                cm_idx++;
            cm_idx++;
            if (cm_idx > DFT_CM_CNT)
                break;
            dept[j].CkMsg[i] = cm_idx;
            dept[j].cm_cnt++;
        }
   }
   for(j = 0; j < tmp_max_Dept; j++)
   {
      dept[j].price = (j+1)*100 + 10000;
      memset(dept[j].desc, 0x20, MAX_DESC_LEN_EX);
      dept[j].desc[MAX_DESC_LEN_EX] = 0;
      desc_len = strlen(Str_Cnst_DEPT_Desc[j]);
      if(desc_len > MAX_DESC_LEN_EX)
         desc_len = MAX_DESC_LEN_EX;
      memcpy(dept[j].desc, Str_Cnst_DEPT_Desc[j], desc_len);
   }

    // 最后3个部门允许用于直接销售
    if (Max_Dept_No <= 3)
        j = 0;
    else
        j = Max_Dept_No - 3;
    for (; j < Max_Dept_No; j++)
    {
        dept[j].sale = 1;
    }
}
/*------------------------------------------------------------------------------
 * 对PLU 所连接的部门恢复到默认的部门值
 * 输入参数: j -- PLUIndex No
 * 最后出机的时候,所有的PLU在初使化以后,都是默认连接的到部门1,此处为了演示,用了
 * 一个条件判断,从而根据不同的PLU号码区间,连接部门从1~~~15
*-----------------------------------------------------------------------------*/
void Rst_PLU_Dft_Dept(word j)
{
   if(j < 9)
         plu[j].plink = 1;
   else if(j< 39)
         plu[j].plink = 2;

⌨️ 快捷键说明

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