lPortaArg = 1
lTabArg = "TMP_IMPRIMIR"

DECLARE integer A_CreatePrn in WINPPLA.DLL integer,string 
DECLARE integer A_CreateUSBPort in WINPPLA.DLL integer
DECLARE INTEGER A_GetUSBBufferLen IN WINPPLA.DLL
DECLARE INTEGER A_EnumUSB IN WINPPLA.DLL INTEGER
DECLARE integer A_Prn_Text_TrueType in WINPPLA.DLL integer,integer,integer,string,integer,integer,integer,integer,integer,string,string,integer
DECLARE integer A_Prn_Text in WINPPLA.DLL integer,integer,integer,integer,integer,integer,integer,short,integer,string
DECLARE integer A_Prn_Barcode in WINPPLA.DLL integer,integer,integer,short,integer,integer,integer,short,integer,string
DECLARE integer A_Get_Graphic in WINPPLA.DLL integer,integer,integer,short,string
DECLARE integer A_Set_Darkness in WINPPLA.DLL integer
DECLARE integer A_Set_Backfeed in WINPPLA.DLL integer
DECLARE integer A_Print_Out in WINPPLA.DLL integer,integer,integer,integer
DECLARE A_ClosePrn in WINPPLA.DLL 

*cUsb = A_GetUSBBufferLen()

*A_CreateUSBPort(1)

CREATE CURSOR TMP_OPCAO(CODIGO N(1),DESC C(30))


SELECT &lTabArg
GO TOP IN &lTabArg
DO WHILE ! EOF(lTabArg)

   *A_CreatePrn(lPortaArg,"PPLA.prn")
   cUsb = A_GetUSBBufferLen()
   A_CreateUSBPort(1)
   A_Set_Backfeed(320)
   A_Set_Darkness(20)
   cCodBar1 = TMP_IMPRIMIR.CODIGO
   nSelect = "SELECT CODIGO FROM Tslc003 WHERE CODBAR = ?cCodBar1 "
   TSEXEC("T",nSelect,"TMP_COD")
   cCodProd = TMP_COD.CODIGO
   nSelect = "SELECT * FROM Tslc049b WHERE ?cCodProd = SEQ003 AND SEQ049 = 1 "
   TSEXEC("T",nSelect,"TMP_PRECO")
   cTextoAG1 = SUBSTR(&lTabArg..DESC,1,22)

   *A_Prn_Text_TrueType(5,50,20,"Arial",1,400,0,0,0,"AA",cTextoAG1,1) && DECRIO 01

   *cTextoAG1B = SUBSTR(&lTabArg..DESC,23,22)

   *A_Prn_Text_TrueType(10,50,35,"Arial",1,400,0,0,0,"A4",cTextoAG1B,1) && DECRIO 02

   cTextoAG1A = "R$: " + TRANSFORM(&lTabArg..PRECO1,"999.99")

   cBarA1 = SUBSTR(&lTabArg..CODIGO,9,8)

   A_Prn_Barcode(20,5,1,68,0,0,20,98,1,cBarA1) && CDIGO DE BARRAS 98

   A_Prn_Text_TrueType(100,5,35,"Arial",1,400,0,0,0,"A1",cTextoAG1A,1) && vALOR
   
   A_Print_Out(1,1,1,1)
   =A_ClosePrn()
   
   IF ! EOF(lTabArg)
      SKIP IN &lTabArg
   ENDIF
   LOOP
ENDDO
   