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

📄 protest.c

📁 一款收款机C源代码!因为是几年前的代码了
💻 C
📖 第 1 页 / 共 4 页
字号:
   else if(j< 47)
         plu[j].plink = 3;
   else if(j < 88)
         plu[j].plink = 4;
   else if(j < 96)
         plu[j].plink = 5;
   else if(j < 99)
         plu[j].plink = 6;
   else if(j < 102)
         plu[j].plink = 7;
   else if(j < 107)
         plu[j].plink = 8;
   else if(j < 113)
         plu[j].plink = 9;
   else if(j < 125)
         plu[j].plink = 10;
   else if(j < 138)
         plu[j].plink = 11;
   else if(j < 145)
         plu[j].plink = 12;
   else if(j < 146)
         plu[j].plink = 13;
   else if(j < 153)
          plu[j].plink = 14;
   else
          plu[j].plink = 15;
}
/* Reset the PLU programming data to default */
void	Rst_PLU(byte clr_rpt_flag)
{
    word i;
    word j;
    byte desc_len;			/* The description's length */
    word Tmp_Max_Plu = MAX_DFT_PLU_CNT;

    if(Tmp_Max_Plu >Max_Plu_No)
        Tmp_Max_Plu = Max_Plu_No;
    for(j = 0; j < Max_Plu_No; j ++)
    {
      #ifdef SCANNER    /* Support the scanner function */
        {
            memset(plu[j].barcode,0x00,BAR_BUFF_LEN);
            (plu[j].barcode)[BAR_BUFF_LEN-1] = 0x01;

            i = (j+1)/10000%100;
            (plu[j].barcode)[2] = ((i/10)<<4)|(i%10);
            i = (j+1)/100%100;
            (plu[j].barcode)[1] = ((i/10)<<4)|(i%10);
            i = (j+1)/1%100;
            (plu[j].barcode)[0] = ((i/10)<<4)|(i%10);
        }
      /* The default PLU barcode
            100...00001
            100...00002
            100...00003
            ...
            100...09999
      */
        Sindex[j] = j;
      #endif /* End SCANNER */

      #ifdef STOCK      /* Support the stock function */
        plu[j].inventory = 0;
        plu[j].saft_Stock = 0;
      #endif /* End STOCK */

        plu[j].plink = 1;
      
        plu[j].fill_color = DARKPURPLE;
        plu[j].font_color = CYAN;

        plu[j].group = 0;

      #ifdef REST_PLU_FUNC
        plu[j].attr.mode=PLU_NORMAL;
        plu[j].attr.inht=1;
      #endif
        plu[j].price = 0L;
        plu[j].price2 = 0L;
        plu[j].price3 = 0L;
        if(clr_rpt_flag)
        {
            plu[j].quantity = 0;
            plu[j].amount = 0;
          #ifdef	PLU_PTD_RPT
            plu[j].PTD_quantity = 0;
            plu[j].PTD_amount = 0;
          #endif
        }
        /*以后PLU的默认描述符就是为空。*/
        memset(plu[j].desc, 0x20, MAX_DESC_LEN_EX);
        plu[j].desc[MAX_DESC_LEN_EX] = 0;
        
//        desc_len = desc_cpy(plu[j].desc,Str_PLU_Desc,4);
//        LongtoAsc(plu[j].desc+desc_len, j+1, 4);
    }

    /*在原始状态,PLU 全部为Idle状态*/
    for(i = 0; i < MAX_PLU_USED_TBL_CNT; i++)
        PLU_Used_Tbl[i] = 0;

    /*对一些PLU进行初始化,使其具有一定的初始值*/
    for(j = 0; j < Tmp_Max_Plu; j++)
    {
        #ifdef SCANNER    /* Support the scanner function */
        {
            byte tmpc ;
            char tmp_cnt;
            char tmp_j = 12;
            int old_posi;     /* The PLUs old bar code */
            int new_posi;     /* The PLUs new bar code */
            
            memset(Barbuf, 0, BAR_BUFF_LEN*2);
            
            //translate ASCII code into data
            for(tmp_cnt = 13; tmp_cnt > 0; tmp_cnt--)
            {
                tmpc = Str_Cnst_Plu_Barcode[j][tmp_cnt-1] & 0x7F;  
                if ((tmpc >= 0x30) && (tmpc <= 0x39))
                {
                    tmpc &= 0x0F;
                    Barbuf[tmp_j--] = tmpc;
                }
            }
            
            //translate data into BCD code
            SC_TransBcd();
            
            //search the old position
            old_posi = SC_SearchIndex(plu[j].barcode);
            
//           if(Judge_Weight_PLU(BCDbuf) == OK)     /* Judge is the weight PLU bar code or not */
//          {
//                   byte  tmp_buf[BAR_BUFF_LEN];
//                    memcpy(tmp_buf, BCDbuf, BAR_BUFF_LEN);
//                     Do_Weight_PLU(tmp_buf, BCDbuf);
//          }
            new_posi = SC_SearchIndex(BCDbuf);
//           if(new_posi >= 0)       /* The bar code is exist */
//          {
//              continue;
//           }
            memcpy(plu[j].barcode,BCDbuf,BAR_BUFF_LEN);        /* Update the PLUs bar code */
            new_posi = -new_posi;         /* Get the new position */
            /* The newCode's value always not 0 */
            SC_UpdateIndex(old_posi,new_posi-1);      /* Update the index table */
        }
#endif
        plu[j].price = Str_Cnst_Plu_Price[j];

        Rst_PLU_Dft_Dept(j);
        memset(plu[j].desc,0x20, MAX_DESC_LEN_EX);
        desc_len = strlen(Str_Cnst_Plu_Desc[j]);
        desc_len = (MAX_DESC_LEN_EX > desc_len) ? desc_len : MAX_DESC_LEN_EX;
        memcpy(plu[j].desc,Str_Cnst_Plu_Desc[j],desc_len);
        plu[j].desc[MAX_DESC_LEN_EX] = 0;

        PLU_Used_Tbl[j/8] |= 1<<(j%8); 
    }




    for(j = 0; j < PLU_GROUP_LEN; j ++)
    {
//      PLU_Group[0][j] = j+1;                 /* PLU 1~200 contained in the group 1 */
//      for(i=1;i<PLU_GROUP_NUM;i++)           /* Other group has no PLU */
        for(i=0;i<PLU_GROUP_NUM;i++)			/* The default did't include any PLU */
            PLU_Group[i][j] = 0;
    }
    PLU_Group[0][PLU_GROUP_LEN] = NUL_VLU;    /* Set the array end flag */

#ifdef	REST_PLU_FUNC
    do_menu_flag=0;
    menu_sub_total=0;
    menu_sub_count=0;

    for(i = 0; i <MAX_PLUTAB_NO; i ++)
    {
        plu_relation_tab[i].mainplu=0;
        plu_relation_tab[i].slaveplu=0;
    }
    for(i=0;i<MAX_MENU_KEY_CNTR;i++)
    {
        for(j=0;j<MAX_MEAL_ITEM;j++)
        {
            Menu_Table[i].menu_plu[j]=0;
        }
        if(clr_rpt_flag)
        {
            Menu_Table[i].quantity=0;
            Menu_Table[i].amount=0;
            Menu_Table[i].count=0;
            Menu_Table[i].PTD_quantity=0;
            Menu_Table[i].PTD_amount=0;
            Menu_Table[i].PTD_count=0;
        }
    }
#endif

    for(i=0; i<MAX_DPLU_NO; i++)
    {
        Dplu_Pluno[i] = i+1;	
    }
}

/* Reset the clerk programming data to default */
void	Rst_Clerk(byte clr_rpt_flag)
{
	byte i;
	word j;
	byte desc_len;			/* The description's length */

   for(j = 0; j < Max_Clerk_No; j ++)
   {
      clerk[j].secret = j+1;
      if(clr_rpt_flag)
      {
	      clerk[j].count = 0;
	      clerk[j].amount = 0;
	      clerk[j].PTD_count = 0;
	      clerk[j].PTD_amount = 0;
	   }
//      memcpy(clerk[j].desc,Str_Clerk_Desc,MAX_DESC_LEN);
		desc_len = desc_cpy(clerk[j].desc,Str_Clerk_Desc,2);
      clerk[j].desc[desc_len]=((j+1)/10)+'0';
      clerk[j].desc[desc_len+1]=((j+1)%10)+'0';
   }
}

void	Rst_Prog_Other(byte clr_rpt_flag)
{
    byte i;     /* The circular temporary variable */
    word j;     /* The circular temporary variable */
    byte desc_len;			/* The description's length */

    {//Refund
        refund.flag = 0;
        refund.price = 0;
        refund.HALO = 999999;
        //      memcpy(refund.desc,Str_Refund_Desc,MAX_DESC_LEN);
        desc_cpy(refund.desc,Str_Refund_Desc,0);
    }

    for(j = 0; j < MAX_PER_NUM; j++)//Percentage
    {
        if(j == 0)
            percent[j].flag = 1;			/* -% */
        else
            percent[j].flag = 0;			/* +% */
        percent[j].round = 0;
        percent[j].rate = 0;
        percent[j].amount = 0;
        desc_len = desc_cpy(percent[j].desc,Str_Per_Desc,1);
        percent[j].desc[desc_len] = j + 1 + '0';
    }

    for(j = 0; j < MAX_VAT_NUM; j ++)
    {
        VAT[j].rate = 0;
        desc_len = desc_cpy(VAT[j].desc, Str_VAT_Desc,1);
        (VAT[j].desc)[desc_len] = j + 1 + '0';
    }

    for(j = 0; j < MAX_TAX_NUM; j ++)
    {
        Tax[j].rate = 0;
        desc_len = desc_cpy(Tax[j].desc, Str_Tax_Desc,1);
        (Tax[j].desc)[desc_len] = j + 1 + '0';
    }

    for(j = 0; j < MAX_PCASH_NUM; j ++)
    {
        PCASH[j].price = 0;
        desc_len = desc_cpy(PCASH[j].desc, Str_PCASH_Desc, 1);
        (PCASH[j].desc)[desc_len] = j + 1 + '0';
    }

    for(j = 0; j < MAX_CHECK_NUM; j ++)
    {
        desc_len = desc_cpy(check[j],Str_Check_Desc,1);
        check[j][desc_len] = j+1+'0';
    }

    for(j = 0; j < MAX_CHARGE_NUM; j ++)
    {
        desc_len = desc_cpy(charge[j],Str_Charge_Desc,1);
        charge[j][desc_len] = j+1+'0';
    }

    memset(Credit, 0x20, MAX_DESC_LEN);
    xtr_strcpy(Credit, Str_Credit_Desc);
    
#ifdef FCE_FUNC			/* Support the FCE function */
    for(j = 0; j < MAX_FCE_CNT; j ++)
    {
        fce[j].flag = 0;
        fce[j].round = 0;
        fce[j].dot = 0;
        fce[j].local = 0;
        fce[j].rate = 0;
        if(clr_rpt_flag)
        {
            fce[j].count = 0;
            fce[j].ttlindwr = 0;
            fce[j].chg = 0;
            fce[j].PTD_count = 0;
            fce[j].PTD_ttlindwr = 0;
            fce[j].PTD_chg = 0;
        }
        //		memcpy(fce[j].desc, Str_FCE_Desc, MAX_DESC_LEN);
        desc_len = desc_cpy(fce[j].desc, Str_FCE_Desc,1);
        fce[j].desc[desc_len] = (j+1) + '0';
    }
#endif /* End FCE_FUNC */
}

/* Initialize the allocated area */
void Init_Alloc(byte clr_rpt_flag)
{
	byte i;
	word j;
	byte desc_len;			/* The description's length */

	/*----------------------------------------*/
	Rst_Dept(clr_rpt_flag);

	/*----------------------------------------*/
	Rst_PLU(clr_rpt_flag);

	/*----------------------------------------*/
	Rst_Clerk(clr_rpt_flag);

	#ifdef VER_RSNT			/* Support the restaurant function */
	/*----------------------------------------*/
	for(j = 0; j < Max_Table_No; j ++)
	{
//		memcpy((table + j)->desc,Str_Table_Desc,MAX_DESC_LEN);
        sprintf(table[j].desc, "%3d\0", j+1);
        desc_len = strlen(table[j].desc);
        //xtr_strcpy(table[j].desc+desc_len, Str_Table_Desc);
        desc_cpy(table[j].desc+desc_len, Str_Table_Desc,0);
        //desc_len += 

		Clr_Table(j);
		table[j].Logi_No = j + 1;
		if(clr_rpt_flag)
		{
			table[j].count = 0;
			table[j].amount = 0;
		}
        table[j].fill_color = LIGHT_YELLOW;
        table[j].font_color = BLUE;
        table[j].split_cnt = 1;
	}
	currtable = NUL_VLU;

	/*----------------------------------------*/
	for(j = 0; j < Max_Waiter_No; j ++)
	{
		waiter[j].secret = j + 1;
		if(clr_rpt_flag)
		{
			waiter[j].count = 0;
			waiter[j].amount = 0;

⌨️ 快捷键说明

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