TMU + TPRINT

TMU + TPRINT

Postby LuisPonce » Thu Jan 22, 2009 10:29 pm

Hola

Tengo una ticketera TMU en un puerto COM1, y para imprimir sobre ella nombre la impresora como TIKCETS para el windows XP, pero al momento de mandar el texto con la clase TPRINTER me da "No es posible imprimir en el puerto COM1", ya hice todas las pruebas sobre windows "pagina de prueba", un texto en Word y todo eso y sale normal, el problema estara en mi codigo ???

lImpDos = si es impresion DOS o NO si es asi uso la TDOSPRN

IF lImpDos

nVer:=13
nVerSon:=(nVer+nMaxDoc)
nRow:=2

oPrnCmp:=TDosPrn():New(cLptDoc)
oPrnCmp:Command( { 27, 64 } )

IF IMPCBT // imprime cabecera ??

oPrnCmp:Say( nRow, 00, PADC(TRIM(cMiCia),40), )
nRow++

DO CASE
CASE UPPER(cMiCia)="ELECTROSERVIS"
oPrnCmp:Say( nRow, 00, PADC('De : '+TRIM(cMiPro),40), nCompress )
nRow++
oPrnCmp:Say( nRow, 00, PADC('Pri. '+TRIM(cMiDir)+' ABANCAY',40), nCompress )
OTHER
nRow++
oPrnCmp:Say( nRow, 00, PADC(TRIM(cMiDi3)+' LIMA',40), nCompress )
ENDCASE

IF IMPSUC
DO CASE
CASE UPPER(cMiCia)="ELECTROSERVIS"
nRow++
oPrnCmp:Say( nRow, 00, PADC('Suc. '+TRIM(cMiDi2)+" "+TRIM(IMPSDE),40), nCompress )
CASE cMiCia="HOREB"
nRow++
oPrnCmp:Say( nRow, 00, PADC(TRIM(cMiDi3)+' LIMA',40), nCompress )
ENDCASE
ENDIF

nRow++
oPrnCmp:Say( nRow, 00, PADC('R.U.C. '+IMPRUC,40), nCompress )
nRow++
oPrnCmp:Say( nRow, 00, PADC('N/s '+TRIM(IMPSIT),40), nCompress )
nRow++
ENDIF

oPrnCmp:Say( nRow, 00, Repl("-",40), nCompress )
nRow ++

IF !EMPTY(cNombre)
oPrnCmp:Say( nRow, 00, PADR("Nombre: "+LEFT(cNombre,32),40), nCompress )
nRow++

nVer++
ENDIF

IF !EMPTY(cDirClt)
oPrnCmp:Say( nRow, 00, PADR("Direccion: "+LEFT(cDirClt,29),40), nCompress )
nRow++

nVer++

IF LEN(TRIM(cDirClt))>29

oPrnCmp:Say( nRow, 00, SUBSTR(cDirClt,30,20), nCompress )
nRow++

nVer++

ENDIF

ENDIF

oPrnCmp:Say( nRow, 00, Repl("-",40), nCompress )
nRow ++
oPrnCmp:Say( nRow, 00, PADR(TRIM(cDesDoc)+' N° '+cNroSer+'-'+cNroTik,40), nCompress )
oPrnCmp:Say( nRow, 00, PADL(LEFT(cGrFero,5),40), nCompress )
nRow ++
oPrnCmp:Say( nRow, 00, PADL(CFECHA(dFecAct,'E')+' '+TIME(),40), nCompress )
nRow ++
oPrnCmp:Say( nRow, 00, 'Cantidad CodigoUniversal Descrip Importe', nCompress )
nRow ++

Select("IFacturas")
IF IFacturas->( DbSeek( cCodDoc+cNroSer+'-'+cNroTik ) )
WHILE IFacturas->CARGO=cCodDoc.and.IFacturas->TIKET=cNroSer+'-'+cNroTik
cCodSer :=IFacturas->CODSER
nCanSer :=IFacturas->CANTIDAD
nPrecio :=IFacturas->PRECIO
nItmPre :=IFacturas->PREBSE // Reemplaza al ItmPre de Abajo

Select("IItems")
If IItems->( DbSeek( UPPER( cCodSer) ) )
cItmDes:=PADL(IItems->DESITM,27)
cItmUnd:=IItems->UNDITM
ELSE
cItmDes:=PADL('NO EXISTE...',27)
cItmUnd:='XXX'
ENDIF

Select("IFacturas")
oPrnCmp:Say( nVer, 00, TRANS(IFacturas->CANTIDAD,MA52)+' '+cCodSer+SPACE(8)+TRANS(IFacturas->IMPORTE,MA52), nCompress )
nVer ++
oPrnCmp:Say( nVer, 09, cItmDes, nCompress )
nVer ++
nVer ++

nTotIgv+=IFacturas->IGV
nTotFac+=IFacturas->IMPORTE
nTotBse+=IFacturas->BSEIMP
nTotCan+=IFacturas->CANTIDAD

* Continua con otro item

IFacturas->(DbSKIP())

END
ENDIF

* a pagar

oPrnCmp:Say( nVer, 00, PADL("TOTAL"+cMoneda+" "+TRANS(nTotFac,MA72C),40), nCompress )

nVer ++
oPrnCmp:Say( nVer, 00, cGrFero+" "+"FW"+" "+mmINICIAL+" "+LEFT(cCancela,3)+" "+AUT, nCompress )
nVer ++
oPrnCmp:Say( nVer, 00, IIF(EMPTY(IMPMS1)," ",IMPMS1), nCompress )
nVer ++
nVer+=8
oPrnCmp:Say( nVer, 00, chr(27) + chr(105) , nCompress ) // Corte Parcial

oPrnCmp:End()

ELSE

nVer:=12
nRow:=8

PRINT oPrnCmp NAME "Impresion de Tiket" TO "TICKET" //FROM USER // TO "TICKET"

IF Empty( oPrnCmp:hDC )
Return Nil
ELSE
oPrnCmp:lPrvModal:=.T.
ENDIF

DEFINE FONT oFntArial NAME "Arial" SIZE 0, -8 OF oPrnCmp
DEFINE FONT oFntArial1 NAME "DRAFT 12CPI" SIZE 0, -8 OF oPrnCmp
DEFINE FONT oFntArial2 NAME "Arial" SIZE 0, -12 OF oPrnCmp

PAGE

StepRow := oPrnCmp:nVertRes() / 60 // estuvo en 50
StepCol := oPrnCmp:nHorzRes() / 40

IF IMPCBT // imprime cabecera ??
oPrnCmp:Say( StepRow*1, StepCol*0, PADC(UPPER(cMiCia),33) )
oPrnCmp:Say( StepRow*2, StepCol*0, Repl("-",33) ) // oFntArial1

DO CASE
CASE !EMPTY(cMiCia)
oPrnCmp:Say( StepRow*3, StepCol*0, PADC("De : "+TRIM(cMiPro),33) )
oPrnCmp:Say( StepRow*4, StepCol*0, PADC("Pri. "+TRIM(cMiDir)+" ABANCAY",33) )
OTHER
oPrnCmp:Say( StepRow*3, StepCol*0, PADC(TRIM(cMiDi3)+" "+TRIM(IMPSDE),33) )
ENDCASE

IF IMPSUC
DO CASE
CASE UPPER(cMiCia)="ELECTROSERVIS"
oPrnCmp:Say( StepRow*5, StepCol*0, PADC("Suc. "+TRIM(cMiDi2)+" "+TRIM(IMPSDE),33) )
CASE UPPER(cMiCia)="HOREB"
oPrnCmp:Say( StepRow*5, StepCol*0, PADC(TRIM(cMiDi3)+" LIMA",33) )
ENDCASE
ENDIF

oPrnCmp:Say( StepRow*6, StepCol*0, PADC("R.U.C. "+IMPRUC,33) )
oPrnCmp:Say( StepRow*7, StepCol*0, PADC("N/s "+TRIM(IMPSIT),33) )

ENDIF

IF !EMPTY(cNombre)

oPrnCmp:Say( StepRow*nRow, StepCol*0, Repl("-",33) )
nRow++
oPrnCmp:Say( StepRow*nRow, StepCol*0, "Nombre: "+cNombre )
nRow++

ENDIF

IF !EMPTY(cDirClt)
oPrnCmp:Say( StepRow*nRow, StepCol*0, "Direccion: "+cDirClt )
nRow++

ENDIF

oPrnCmp:Say( StepRow*nRow, StepCol*0, Repl("-",33) )
nRow++
oPrnCmp:Say( StepRow*nRow, StepCol*0, TRIM(cDesDoc)+" N. "+cNroSer+"-"+cNroTik+" Ven : "+LEFT(cGrFero,5) )
nRow++
oPrnCmp:Say( StepRow*nRow, StepCol*0, PADL(CFECHA(dFecAct,"E")+" "+TIME(),33) )
nRow++
oPrnCmp:Say( StepRow*nRow, StepCol*0, "Cantidad CodigoUniversal" )
nRow++

nVer:=nRow

Select("IFacturas")
IF IFacturas->( DbSeek( cCodDoc+cNroSer+"-"+cNroTik ) )

WHILE IFacturas->CARGO=cCodDoc.and.IFacturas->TIKET=cNroSer+"-"+cNroTik

cCodSer :=IFacturas->CODSER
nCanSer :=IFacturas->CANTIDAD
nPrecio :=IFacturas->PRECIO
nItmPre :=IFacturas->PREBSE // Reemplaza al ItmPre de Abajo

Select("IItems")
If IItems->( DbSeek( UPPER( cCodSer) ) )
cItmDes:=PADL(IItems->DESITM,27)
cItmUnd:=IItems->UNDITM
ELSE
cItmDes:=PADL("NO EXISTE...",27)
cItmUnd:="XXX"
ENDIF

Select("IFacturas")

oPrnCmp:Say( StepRow*nVer,StepCol*0, TRANS(IFacturas->CANTIDAD,MA52)+" "+cCodSer+TRANS(IFacturas->IMPORTE,MA52) )
nVer += 1
oPrnCmp:Say( StepRow*nVer,StepCol*3, cItmDes )
nVer += 1

nTotIgv+=IFacturas->IGV
nTotFac+=IFacturas->IMPORTE
nTotBse+=IFacturas->BSEIMP
nTotCan+=IFacturas->CANTIDAD

* Continua con otro item

IFacturas->(DbSKIP())

END

ENDIF

* a pagar

oPrnCmp:Say( StepRow*nVer,0, TRANS(nTotCan,MA52)+"Pz(s)" )
nVer ++
oPrnCmp:Say( StepRow*nVer,StepCol*8, "TOTAL => "+cMoneda+TRANS(nTotFac,MA72C) )
nVer ++
nVer ++
oPrnCmp:Say( StepRow*nVer,0, cGrFero+" "+"FW"+" "+mmINICIAL+" "+LEFT(cCancela,3)+" "+AUT )
nVer ++
oPrnCmp:Say( StepRow*nVer,0, IIF(EMPTY(IMPMS1)," ",IMPMS1) )
nVer ++

ENDPAGE

ENDPRINT

ENDIF

Donde podra estar la falla, mi estimado Antonio tal vez ud.pueda darme una luz.

Gracias
Luis Ponce
User avatar
LuisPonce
 
Posts: 192
Joined: Tue Jul 01, 2008 6:34 pm
Location: PERU

Re: TMU + TPRINT

Postby LuisPonce » Tue Feb 24, 2009 11:54 pm

GRACIAS

Encontre la solucion, en las propiedades de la impresora le baje los baudios, estaba en 9600, lo puse a 1200 y eso fue todo
User avatar
LuisPonce
 
Posts: 192
Joined: Tue Jul 01, 2008 6:34 pm
Location: PERU

Re: TMU + TPRINT

Postby Antonio Linares » Wed Feb 25, 2009 2:37 pm

Luis,

gracias por compartir la solución con todos :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41283
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin para CA-Clipper

Who is online

Users browsing this forum: No registered users and 2 guests