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

📄 print.c

📁 一款收款机C源代码!因为是几年前的代码了
💻 C
📖 第 1 页 / 共 5 页
字号:
 *    Parameter:  src_str: The information wanted to print in the left.
 *                num:     The long number wanted to print in the right.
 *                dots:    The number of radix point belong to the long number.
 *				This function will print the charcater 'Q' in the last position.
 *-----------------------------------------------------------------------------------*/
void Prn_Adj_Q_Ex(char *src_str, long num, byte dots, byte posi, byte mode)
{
	if(mode == DESC_OLD)
	{
		prn_Buf[posi] = 'Q';
	}
	else // mode == DESC_NEW
	{
		Prn_InsStr("Q", posi, NM_FONT_PRN, FLUSH_LEFT);
	}
   Prn_Adj_Ex(src_str, num, dots, posi - 1, mode);
}



/*-----------------------------------------------------------------------------------*
 *    Print the department's attribute 
 *
 *    The print format:
 *          Department:
 *          x123456789012345678901234
 *          |department01     1    V0 
                  0 7 1 1 1  12345.67
 *          ||    | | | | |     |___________________Price
 *          ||    | | | | |___|____|________________AGE limit
 *          ||    | | | |_____|____|________________dept attribute(negative/..)
 *          ||    | | |_______|____|________________Group
 *          ||    | |_________|____|________________HALO
 *          ||    |___________|____|________________Sing/Mult
 *          ||                |    |________________VAT/TAX code  
 *			||		          |_____________________Send the register information to the KP flag
 *			||
 *          ||______________________________________Description
 *          |_______________________________________The control byte.
 *Modify Record:
 *     the prn format is changed from 32 characters a row to 24 characters a row
 *Author: sts. 2006-08-18.
 *-----------------------------------------------------------------------------------*/
void prn_Dept(byte Dept_No)
{
   byte pflag;
   byte mode;        /* Print the all department mode or print the single department mode */
   #ifdef AUTO_PER		/* Support the department auto percent function */
   byte per_flag;
   #endif /* End AUTO_PER */
   byte max_oper_dept_no;
   return;
   if(!Flag_Prgm_Head)
   {
      Flag_Prgm_Head = 1;
//      memcpy(prn_Buf+1,Dept_Prn_Head,MAX_PRN_LEN);
		xtr_strcpy(prn_Buf+1,Dept_Prn_Head);			/* Modified on 2004-04-07 17:12 */
      prn_Buf[0] = DB_HEIGT_PRN;
      print();
/* prn_Str();*/Line_Feed(1);
   }
   
   if(Dept_No == 0xFF)        /* Print the all department mode */
   {
      mode = 1;
      Dept_No = 0;
   }
   else                       /* Print single department mode */
   {
      mode = 0;
   }
   if(Max_Dept_No <= MAX_REL_DEPT_CNT)
   	max_oper_dept_no = Max_Dept_No;
   else
   	max_oper_dept_no = MAX_REL_DEPT_CNT;

//for(;mode&&(Dept_No<Max_Dept_No);Dept_No++)
   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 department attribute */
//			memcpy(prn_Buf+1,Str_PrnInt,MAX_PRN_LEN);
			xtr_strcpy(prn_Buf+1,Str_PrnInt);			/* Modified on 2004-04-07 17:12 */
			print();
			break;
		}

      pflag  = dept[Dept_No].pflag;
      memcpy(prn_Buf+1,dept[Dept_No].desc,MAX_DESC_LEN_EX);
      prn_Buf[18] = dept[Dept_No].send_kp_flag + '0';
      if(sysflag->Tax_System)        /* Tax mode */
         prn_Buf[23] = 'T';
      else  /* VAT mode */
      	prn_Buf[23] = 'V';
      prn_Buf[24] = ((pflag)&0x0F) + '0';
      print();
      prn_Buf[6] = (pflag>>4) + '0';
      prn_Buf[8] = dept[Dept_No].Hdlo + '0';
      prn_Buf[10] = dept[Dept_No].group + '0';
      prn_Buf[12] = (dept[Dept_No].pflag2 &0x0f) + 0x30;
      prn_Buf[14] = ((dept[Dept_No].pflag2 >>4)&0x0f) + 0x30;
      LongPrnFmt(dept[Dept_No].price,sysflag->sysdots,RPOSI, RIGHTFLUSH);
      print();

      #ifdef AUTO_PER		/* Support the department auto percent function */
      if((sysflag->Auto_Per_Prn_Flag == 1) && (sysflag->Auto_Per_Use_Flag == 1))
      {
//			memcpy(prn_Buf+1, Str_Auto_Per_Rate, strlen(Str_Auto_Per_Rate));
			xtr_strcpy(prn_Buf+1, Str_Auto_Per_Rate);			/* Modified on 2004-04-07 17:11 */
			per_flag = dept[Dept_No].per_flag;
	      LongPrnFmt(((per_flag == 1)?-1:1)*dept[Dept_No].per_rate, 3, MAX_PRN_LEN - 1, RIGHTFLUSH);
	      prn_Buf[MAX_PRN_LEN] = '%';
	      print();
	   }
      #endif /* End AUTO_PER */

      Dept_No ++;
   }while(mode&&(Dept_No<max_oper_dept_no));     /* When is the print all deparment mode, go on printing. */

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


/*-------------------------------------------------------------------------*
 *                   Feed the fixed blank line.
 *-------------------------------------------------------------------------*/
void Line_Feed(byte LineCtr)
{
//	if((sysflag->Rcpt_prn == 0) && (!Rcpt_Reprn_Flag))
//	{
//		clr_Prn_Buf();
//		return;
//	}
   while( LineCtr -- )
   {
///      Flag_Key_Feed_Papr = TRUE;
      prn_Str();
//		Flag_Key_Feed_Papr = FALSE;		/* Already do in the funciont prn_Str */
///		wait_prn_Stop();						/* This function can slower the speed of paper feed */
   }
}



/*--------------------------------------------------------------------------*
 *                   Print the stamp.
 *--------------------------------------------------------------------------*/
void prn_Stamp(void)
{
    prn_Date_Time(GetYear(), GetMonth(), GetDay(), GetHour(), GetMinute());
    if(( CurrMode == REGISTER ) || (CurrMode == TRAINING))
    {
        prn_Clerk_RcptNum();
        prn_Tral_Msg();            /* Print the Trailer or Bottom message */
        if((Logo_Prn_Flag == 1) && (sysflag->LogoPosi_Flag == TAIL))
      	    prn_Logo();
		Flag_Prn_Head = FALSE;
    }
//   Line_Feed(LineFeedCnt);
    if(( CurrMode != REGISTER ) && (CurrMode != TRAINING))
    {
   	    Line_Feed(sysflag->LineFeedCnt+1);
   	    prePrnLine = 0;
    }
	else
	{
		if(sysflag->PrnAdj_Flag)
			Prn_preHead();
		else
		{
	   	    Line_Feed(sysflag->LineFeedCnt+1);
	   	    prePrnLine = 0;
		}
	}
}


/* Print the trailer message */
void prn_Tral_Msg(void)
{
    byte i;
    byte j;
    byte flag = 0;

    if(sysflag->Btm_Msg_Flag == 1)
        return;
    for(i = 0; i < MSG_BTM_LINES; i ++)
    {
        j = Get_Desc_Len_Ex(&Btm_Msg[i][2],MAX_PRN_LEN,YES);
        if(j == 0)								/* If the content is null, skip to print the next line */
        	continue;

        if(flag == 0)
        {
        	Line_Feed(1);
        	flag = 1;
        }
        //      memcpy(prn_Buf,Btm_Msg[i],PRN_BUF_LEN);   /* The print control code value may be 0 */
        //      prn_Str();
        Prn_InsFmtStr(&Btm_Msg[i][2], 1, MAX_PRN_LEN, NULL);
        Prn_Str(1);
    }
}


/*-----------------------------------------------------------------------------------*
 *    Print the PLU's attribute 
 *
 *    The print format:
 *          x123456789012345678901234
 *          |PLU-------01____________________________Description     
 *          |6612583214569    123.456________________STOCK
 *          ||  A01 L01 G01   123.456________________SAFELY STOCK
 *          ||1234.56 1234.56 1234.56   
 *          |||       |       |______________________Price3
 *          ||| |   | | |____________________________PLU GROUP
 *          ||| |   | |______________________________Price2 
 *          ||| |   |________________________________Link Department number
 *          ||| |____________________________________PLU ATTIBUTE
 *          |||______________________________________Price1
 *          ||_______________________________________BARCODE
 *          |________________________________________The control byte
 *    Parameter:
 *          Idx:     The PLU index number, if the value is 0xFFFF, print all PLUs
 * modify record:
 *  1: change the prn format from 32 characters to 24 chracters a row.
 *  2: Add the safely inventory and price2 add price 3 print.
 *Author: STS. 2006-08-18
 *-----------------------------------------------------------------------------------*/
void prn_PLU( word Idx )
{
   byte plink;
   byte mode;        /* Print the all PLU mode or print the single PLU mode */
   byte i,j;
   byte flag = 0;

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

	if((Idx != 0xFFFF) && ((Idx & 0x8000) != 0))
	{
		Idx &= 0x7FFF;
		mode = 0;
//		memcpy(prn_Buf+1, Str_PLU_VOID, strlen(Str_PLU_VOID));
		xtr_strcpy(prn_Buf+1, Str_PLU_VOID);		/* Modified on 2004-04-07 17:10 */
//		memcpy(prn_Buf+1, Str_PLU_No, strlen(Str_PLU_No));
		xtr_strcpy(prn_Buf+1, Str_PLU_No);			/* Modified on 2004-04-07 17:09 */
//		prn_Buf[strlen(Str_PLU_No) + 1] = (Idx + 1)/1000%10 + '0';
//		prn_Buf[strlen(Str_PLU_No) + 2] = (Idx + 1)/100%10 + '0';
//		prn_Buf[strlen(Str_PLU_No) + 3] = (Idx + 1)/10%10 + '0';
//		prn_Buf[strlen(Str_PLU_No) + 4] = (Idx + 1)/1%10 + '0';
		LongtoAsc(prn_Buf + strlen(Str_PLU_No) + 1, Idx+1, 4);
		print();
	}
	else
	{
	   if( Idx == 0xFFFF )     /* Print the all PLU mode */
	   {
	      mode =1;
	      Idx = 0;
	   }
	   else                    /* Print the single PLU 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 PLU 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;
			}

            memcpy(prn_Buf+1,plu[Idx].desc,MAX_DESC_LEN_EX);
            print();
			#ifdef SCANNER 		/* Support the scanner function */
				flag = 1;
				j = 6;
				prn_Buf[++ j] = ((plu[Idx].barcode)[6] & 0x0F) + '0';
				for(i = 6; i > 0; i --)
				{
					prn_Buf[++ j] = ((plu[Idx].barcode)[i - 1] >> 4) + '0';
					prn_Buf[++ j] = ((plu[Idx].barcode)[i - 1] & 0x0F) + '0';
				}
			#endif /* End SCANNER */
			#ifdef STOCK		/* Support the stock function */
				if(sysflag->PLU_Stock_Flag == 1)
				{
					flag = 1;
					LongPrnFmt(plu[Idx].inventory, 3, RPOSI, RIGHTFLUSH);
				}
			#endif /* End STOCK */
			if(flag == 1)
			{
//				prn_Buf[1] = (Idx+1)/1000%10 + '0';
//				prn_Buf[2] = (Idx+1)/100%10 + '0';
//				prn_Buf[3] = (Idx+1)/10%10 + '0';
//				prn_Buf[4] = (Idx+1)/1%10 + '0';
				LongtoAsc(prn_Buf+1, Idx+1, 4);
				print();
			}
	
	      plink = plu[Idx].plink;
	      
	      #ifdef	REST_PLU_FUNC
    	      prn_Buf[4] = 'A';
    	      prn_Buf[5] = plu[Idx].attr.inht +'0';
    	      prn_Buf[6] = plu[Idx].attr.mode +'0';
    	      prn_Buf[8] = 'L';
    	      prn_Buf[9] = (plink / 10) +'0';
    	      prn_Buf[10] = (plink % 10) +'0';
              prn_Buf[12] = 'G';
              prn_Buf[13] = (plu[Idx].group / 10) + '0';
              prn_Buf[14] = (plu[Idx].group % 10) + '0';
		  #else
    	      prn_Buf[6] = 'L';
    	      prn_Buf[7] = (plink / 10) +'0';
    	      prn_Buf[8] = (plink % 10) +'0';
              prn_Buf[12] = 'G';
              prn_Buf[13] = (plu[Idx].group / 10) + '0';
              prn_Buf[14] = (plu[Idx].group % 10) + '0';
		  #endif
          #ifdef STOCK		/* Support the stock function */
      		  if(sysflag->PLU_Stock_Flag == 1)
      		  {
      			  LongPrnFmt(plu[Idx].saft_Stock, 3, RPOSI, RIGHTFLUSH);
      		  }
          #endif /* End STOCK */  
              print();
    	      LongPrnFmt(plu[Idx].price,sysflag->sysdots, 8, RIGHTFLUSH);
              LongPrnFmt(plu[Idx].price2,sysflag->sysdots, 16, RIGHTFLUSH);
              LongPrnFmt(plu[Idx].price3,sysflag->sysdots, RPOSI, RIGHTFLUSH);
    	      print();
    	      Idx ++;
	   }while(mode&&(Idx<Max_Plu_No));
	}

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


/*--------------------------------------------------------------------------------------*
 *                   Print the clerk attribute
 *
 *       The print format:
 *          x12345678901234567890123456789012
 *           Clerk-----01                0001                  
 *           |                             |________Secret
 *           |
 *           |______________________________________Description
 *
 *       Parameter:
 *             Idx:  The clerk index number, if the value is 0xFF, print all clerks.
 *--------------------------------------------------------------------------------------*/
void prn_Clerk(byte Idx)
{
   byte mode;        /* Print the all clerk mode or print the single clerk mode */
   byte i;           /* The circuler temporary variable */
   
   if(!Flag_Prgm_Head)
   {
      Flag_Prgm_Head = 1;
//      memcpy(prn_Buf+1,Clerk_Prn_Head,MAX_PRN_LEN);   /* Print the attribute head */
		xtr_strcpy(prn_Buf+1,Clerk_Prn_Head);			/* Modified on 2004-04-08 9:01 */
      prn_Buf[0] = DB_HEIGT_PRN;
      print();
      Line_Feed(1);
   }
   
   if( Idx == 0xFF )       /* Print the all clerk mode */
   {
      mode = 1;
      Idx = 0;
   }
   else                    /* Print the single clerk mode */
      mode = 0;
      
   do
   {
      i = PRN_BUF_LEN - 4;

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

⌨️ 快捷键说明

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