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

📄 print.c

📁 一款收款机C源代码!因为是几年前的代码了
💻 C
📖 第 1 页 / 共 5 页
字号:
      }
      print();
      Idx ++;
   }while(mode && (Idx < Max_Clerk_No));    /* If print the all clerk mode, continue. */
   
   if(mode == 1)
   {
      prn_Line('-');
      prn_Stamp();
      Flag_Prgm_Head = 0;
   }
}

#ifdef VER_RSNT			/* Support the restaurant function */
/*--------------------------------------------------------------------------------------*
 *                   Print the waiter attribute
 *
 *       The print format:
 *          x12345678901234567890123456789012
 *           Waiter----01                0001                  
 *           |                             |________Secret
 *           |
 *           |______________________________________Description
 *
 *       Parameter:
 *             Idx:  The waiter index number, if the value is 0xFF, print all waiters.
 *--------------------------------------------------------------------------------------*/
void prn_Waiter(byte Idx)
{
   byte mode;        /* Print the all waiter mode or print the single waiter mode */
   byte i;           /* The circuler temporary variable */
   
   if(!Flag_Prgm_Head)
   {
      Flag_Prgm_Head = 1;
//      memcpy(prn_Buf+1,Waiter_Prn_Head,MAX_PRN_LEN);   /* Print the attribute head */
		xtr_strcpy(prn_Buf+1,Waiter_Prn_Head);			/* Modified on 2004-04-07 17:08 */
      prn_Buf[0] = DB_HEIGT_PRN;
      print();
      Line_Feed(1);
   }
   
   if( Idx == 0xFF )       /* Print the all waiter mode */
   {
      mode = 1;
      Idx = 0;
   }
   else                    /* Print the single waiter mode */
      mode = 0;
      
   do
   {
		if(Key_Buff_Chk(KD_CLEAR) == OK)		/* Check the key buffer contain the key KD_CLEAR or not */
		{							/* If press the CLEAR key, stotp printing the waiter attribute */
//			memcpy(prn_Buf+1,Str_PrnInt,MAX_PRN_LEN);
			xtr_strcpy(prn_Buf+1,Str_PrnInt);		/* Modified on 2004-04-07 17:08 */
			print();
			break;
		}

      i = PRN_BUF_LEN - 4;
      memcpy(prn_Buf+1,waiter[Idx].desc,MAX_DESC_LEN);
      LongPrnFmt(waiter[Idx].secret,0,RPOSI, RIGHTFLUSH);   /* Print the description */
      while(i < PRN_BUF_LEN)
      {
         if(prn_Buf[i] == ' ')
            prn_Buf[i] = '0';
         i ++;
      }
      print();

      Idx ++;
   }while(mode && (Idx < Max_Waiter_No));    /* If print the all waiter mode, continue. */
   
   if(mode == 1)
   {
      prn_Line('-');
      prn_Stamp();
      Flag_Prgm_Head = 0;
   }
}
#endif /* End VER_RSNT */

/*------------------------------------------------------------------------*
 *                Print the PLU group content
 *             PLU group print format:
 *          x12345678901234567890123456789012
 *           001    002    003    004     005
 *            |      |      |      |       |________The 5th PLU.
 *            |      |      |      |________________The 4th PLU.
 *            |      |      |_______________________The 3rd PLU.
 *            |      |______________________________The 2nd PLU.
 *            |_____________________________________The 1st PLU.
 *
 *          x12345678901234567890123456789012
 *           ----------PLU group xx----------
 *Modify record:
 * Change the prn format from 32 characters to 24 characters a row.
 *Ahthor: STS. 2006-08-18.
 *------------------------------------------------------------------------*/
void Group_Print( byte Idx )
{
   word pnum;        /* the PLU no. */
   byte posi;        /* The current print position */
   byte cntr;        /* the counter used note the PLUs quantity printed in one line */

   posi = 0;
   cntr = 0;

//   memcpy(prn_Buf+1,PLU_Group_Prn_Head,MAX_PRN_LEN);
   xtr_strcpy(prn_Buf+1,PLU_Group_Prn_Head);			/* Modified on 2004-04-07 19:07 */
   prn_Buf[17] = (Idx + 1) / 10 + '0';
   prn_Buf[18] = (Idx +1 ) % 10 + '0';
   prn_Buf[0] = DB_HEIGT_PRN;
   print();
   Line_Feed(1);

   while(PLU_Group[Idx][posi] != 0)
   {
   	if(Key_Buff_Chk(KD_CLEAR) == OK)
   	{
//   		memcpy(prn_Buf+1,Str_PrnInt,MAX_PRN_LEN);
			xtr_strcpy(prn_Buf+1,Str_PrnInt);		/* Modified on 2004-04-07 17:07 */
   		print();
   		break;
   	}
      pnum = PLU_Group[Idx][posi];
//      prn_Buf[0 + 7*cntr + 1] = (pnum/1000%10) + '0';
//      prn_Buf[1 + 7*cntr + 1] = (pnum/100%10) + '0';
//      prn_Buf[2 + 7*cntr + 1] = (pnum/10%10) + '0';
//      prn_Buf[3 + 7*cntr + 1] = (pnum/1%10) + '0';
		LongtoAsc(prn_Buf + 6*cntr + 1, pnum, 4);
      cntr ++;
      if( cntr == 4 )
      {
         cntr = 0;
         print();
      }
      posi ++;
   }
   if( cntr != 0 )
      print();
	if(PLU_Group[Idx][0] == 0)						/* The Empty group */
	{
		xtr_strcpy(prn_Buf+1, str_menu_group_void);
		print();
	}

   prn_Line('-');
   prn_Stamp();
}


/*--------------------------------------------------------------------------------*
 *                   Print the VAT or the tax rate
 *--------------------------------------------------------------------------------*/
void prn_VAT_Tax( byte Idx )
{
   byte Idx_Num;     /* The VAT/Tax index number */
   byte mode;
   long rate;        /* The VAT/Tax rate */

   if(Idx == 0xFF)
   {
      mode = 1;
      Idx = 0;
   }
   else
      mode = 0;

   if(!Flag_Prgm_Head)
   {
      Flag_Prgm_Head = 1;
      if(sysflag->Tax_System == 1)
//         memcpy(prn_Buf+1,Tax_Prn_Head,MAX_PRN_LEN);
			xtr_strcpy(prn_Buf+1,Tax_Prn_Head);		/* Modified on 2004-04-07 19:07 */
      else
//         memcpy(prn_Buf+1,VAT_Prn_Head,MAX_PRN_LEN);
			xtr_strcpy(prn_Buf+1,VAT_Prn_Head);		/* Modified on 2004-04-07 17:06 */
      prn_Buf[0] = DB_HEIGT_PRN;
      print();
      Line_Feed(1);
   }

   if(sysflag->Tax_System == 1)
      Idx_Num = MAX_TAX_NUM;
   else
      Idx_Num = MAX_VAT_NUM;

   do
   {
      if(sysflag->Tax_System == 1)		/* Tax mode */
      {
         rate = Tax[Idx].rate;
         memcpy(prn_Buf+1, Tax[Idx].desc, MAX_DESC_LEN);
      }
      else
      {
         rate = VAT[Idx].rate;
         memcpy(prn_Buf+1, VAT[Idx].desc, MAX_DESC_LEN);
      }
               /*      |------->>> VAT and TAX all is 3 dots */
      SetNoAsterPrn();
      SetNoSplitPrn();
      LongPrnFmt(rate,VAT_TAX_DOTS,MAX_PRN_LEN-1, RIGHTFLUSH);
      prn_Buf[MAX_PRN_LEN] = '%';
      print();

      Idx ++;
   }while((Idx < Idx_Num) && mode);

   if(mode == 1)
   {
      prn_Line('-');
      prn_Stamp();
      Flag_Prgm_Head = 0;
   }
}


/*-------------------------------------------------------------------------------------*
 *                   Print the free function key settings.
 *
 *             The print format:
 *          x12345678901234567890123456789012                   
 *           01=TRSVOID 02=TAXSFT1 03=TAXSFT2                   
 *                |        |           |____________The 3rd key.
 *                |        |                                    
 *                |        |________________________The 2nd key.
 *                |_________________________________The 1st key.
 *
 *           So the each print item length is 11.
 *
 由于时间关系, 目前只打印POS键盘表
 *-------------------------------------------------------------------------------------*/
void prn_FFkey(void)
{
    word posi;           /* The read position in the FF_Key_Tabl table */
    word key_code;       /* The key code */
    word logi_code;      /* The logical code */
    byte cntr;           /* The counter of print position */

    cntr = 0;
   
	xtr_strcpy(prn_Buf+1,FFkey_Prn_Head);			/* Modified on 2004-04-07 17:06 */
    prn_Buf[0] = DB_HEIGT_PRN;
    print();
    Line_Feed(1);

    for( posi = 0; posi < MAX_KEY_CNT; posi ++ )
    {
        key_code = FF_Key_Tabl[posi]; /* Get the key code */
        prn_Buf[1] = (posi + 1)/10 + '0';
        prn_Buf[2] = (posi + 1)%10 + '0';
        prn_Buf[3] = (posi + 1)%10 + '0';
        prn_Buf[4] = '=';
        if(key_code <= KD_0)
            prn_Buf[5] = '*';
        else
        {
            Get_All_Key_Desc(prn_Buf+5,MAX_PRN_LEN - 4, key_code);
        }
        print();
   }
      
   prn_Line('-');
   prn_Stamp();
}


/*-----------------------------------------------------------------------------------------*
 *                Print the welcome messages information 
 *-----------------------------------------------------------------------------------------*/
void prn_Wlcm_Msg(byte Idx)
{
   byte mode;     /* The print all messages mode or print the single message mode
                     1: Print all messange
                     0: Print single message
                     */
   byte j;

   if(!Flag_Prgm_Head)
   {
      Flag_Prgm_Head = 1;
//      memcpy(prn_Buf+1,Wlcm_Msg_Prn_Head,MAX_PRN_LEN);
		xtr_strcpy(prn_Buf+1,Wlcm_Msg_Prn_Head);		/* Modified on 2004-04-07 17:04 */
      prn_Buf[0] = DB_HEIGT_PRN;
      print();
      Line_Feed(1);
   }

   if(Idx == 0xFF)
   {
      mode = 1;   /*Print all message mode */
      Idx = 0;
   }
   else
   {
      mode = 0;   /* Print single message mode */
   }

   do
   {
		j = Get_Desc_Len_Ex(&Wlcm_Msg[Idx][2], MAX_PRN_LEN, YES);
		if(j == 0)								/* If the content is null, skip to print the next line */
		{
			Idx ++;
			continue;
		}
         
//      memcpy(prn_Buf,Wlcm_Msg[Idx],PRN_BUF_LEN);   /* The print control code value may be 0 */
//      print();
		Prn_InsFmtStr(&Wlcm_Msg[Idx][2], 1, MAX_PRN_LEN, NULL);
		Print_Ex(1);
      
      Idx ++;
   }while(mode&&(Idx<MSG_HEAD_LINES));

   if(mode == 1)
   {
      prn_Line('-');
      prn_Stamp();
      Flag_Prgm_Head = 0;
   }
}




/*-----------------------------------------------------------------------------------------*
 *                Print the welcome messages information
 *modify Record:
 * change the pen format from 32 chracters to 24 characters.
 *Author STS 2006-08-18
 *-----------------------------------------------------------------------------------------*/
void prn_Btm_Msg(byte Idx)
{
   byte mode;     /* The print all messages mode or print the single message mode
                     1: Print all messange
                     0: Print single message
                     */
   byte j;

   if(!Flag_Prgm_Head)
   {
      Flag_Prgm_Head = 1;
//      memcpy(prn_Buf+1,Btm_Msg_Prn_Head,MAX_PRN_LEN);
		xtr_strcpy(prn_Buf+1,Btm_Msg_Prn_Head);			/* Modified on 2004-04-07 17:04 */
      prn_Buf[0] = DB_HEIGT_PRN;
      print();
      Line_Feed(1);
   }

   if(Idx == 0xFF)
   {
      mode = 1;   /*Print all message mode */
      Idx = 0;
   }
   else
   {
      mode = 0;   /* Print single message mode */
   }

   do
   {
		j = Get_Desc_Len_Ex(&Btm_Msg[Idx][2], MAX_PRN_LEN, YES);
		if(j == 0)
		{
			Idx ++;
			continue;
		}
         
//      memcpy(prn_Buf,Btm_Msg[Idx],PRN_BUF_LEN); /* The print control code value may be 0 */
//      print();
		Prn_InsFmtStr(&Btm_Msg[Idx][2], 1, MAX_PRN_LEN, NULL);
		Print_Ex(1);

      Idx ++;
   }while(mode&&(Idx<MSG_BTM_LINES));

   if(mode == 1)
   {
      prn_Line('-');
      prn_Stamp();
      Flag_Prgm_Head = 0;
   }
}


/*--------------------------------------------------------------------------------------*
 *             Print the time and date preset data.
 *       The date and time print has in the function 'prn_Stamp'.
 *--------------------------------------------------------------------------------------*/
void prn_Prog_Time_Date(void)
{
//   memcpy(prn_Buf+1,Time_Date_Prn_Head,MAX_PRN_LEN);
	xtr_strcpy(prn_Buf+1,Time_Date_Prn_Head);		/* Modified on 2004-04-07 17:03 */
   prn_Buf[0] = DB_HEIGT_PRN;
   print();
   Line_Feed(1);

   prn_Stamp();
}


/*--------------------------------------------------------------------------

⌨️ 快捷键说明

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