PROCEDURE Contratos_ImprimirFormato()
LOCAL oPrn
LOCAL oFont1,oFont2,oFont3
LOCAL cCodCon,cNomSus,cDirSus,cTelSus,cFecNac,cEdaSus,cCedSus,cEstCiv,cProSus,cDirTra,cTelTra
LOCAL cJardin,cBloque,cLote,cPrecio
LOCAL cTotal,cPrima,cSaldo
LOCAL cCTotal,cCPrima,cCSaldo
LOCAL cNumCuo,cValCuo,cDiaPag
LOCAL cDia,cMes,cAno
/*pasa datos a variables de tipo caracter*/
cCodCon := oCont:mc_codcon
cNomSus := ft_proper(oCont:mc_nomsus)
cDirSus := ft_proper(oCont:mc_dirsus)
cTelSus := oCont:mc_teldom
cFecNac := DToC(oCont:mc_fecnac)
cEdaSus := Transform(nEdad,"999")
cCedSus := oCont:mc_cedula
cEstCiv := IIf(oCont:mc_casado,"Casado","Soltero")
cProSus := ft_proper(oCont:mc_prosus)
cDirTra := ft_proper(oCont:mc_dirtra)
cTelTra := oCont:mc_teltra
cTotal := Transform(oCont:mc_totcon,"999,999.99")
cPrima := Transform(oCont:mc_pagpri,"999,999.99")
cSaldo := Transform(oCont:mc_salfin,"999,999.99")
cCTotal := Transform(oCont:mc_totconc,"999,999.99")
cCPrima := Transform(oCont:mc_pagpric,"999,999.99")
cCSaldo := Transform(oCont:mc_salfinc,"999,999.99")
cNumCuo := Transform(oCont:mc_numcuo,"999")
cValCuo := Transform(oCont:mc_valabo,"999,999.99")
cDiaPag := Transform(Day(oCont:mc_diapag),"99")
//cDiaPag := DToC(oCont:mc_diapag)
cDia := Transform(Day(oCont:mc_feccon),"99")
cMes := CMonth(oCont:mc_feccon)
cAno := Transform(Year(oCont:mc_feccon),"9999")
/*define objeto printer*/
PRINTER oPrn FROM USER
/*valida si selecciono una impresora*/
IF Empty( oPrn:hDC )
RETURN
ENDIF
/*define fuentes a usar*/
DEFINE FONT oFont1 NAME "Times New Roman" SIZE 0,-12 OF oPrn
DEFINE FONT oFont2 NAME "Times New Roman" SIZE 0,-08 OF oPrn
DEFINE FONT oFont3 NAME "Times New Roman" SIZE 0,-14 OF oPrn BOLD
/*define tama¤o del papel*/
oPrn:SetPage(DMPAPER_LETTER)
/*ajuste*/
//oPrn:nXOffset:=oPrn:cm2Pix(nXFix)
//oPrn:nYOffset:=oPrn:cm2Pix(nYFix)
/*inicia pagina*/
PAGE
/*inserta datos en pagina*/
/*generales del contratantes*/
oPrn:CmSay(03.80,16.80,cCodCon,oFont3,oPrn:cm2Pix(04.50)) // numero de contrato
oPrn:CmSay(04.80,05.50,cNomSus,oFont1,oPrn:cm2Pix(15.00)) // nombre del suscriptor
oPrn:CmSay(05.60,03.30,cDirSus,oFont1,oPrn:cm2Pix(12.50)) // direccion del suscriptor
oPrn:CmSay(05.60,17.60,cTelSus,oFont1,oPrn:cm2Pix(03.00)) // telefono del suscriptor
oPrn:CmSay(06.50,05.50,cFecNac,oFont1,oPrn:cm2Pix(03.20)) // fecha de nacimiento
oPrn:CmSay(06.50,10.40,cEdaSus,oFont1,oPrn:cm2Pix(01.00)) // edad
oPrn:CmSay(06.50,12.70,cCedSus,oFont2,oPrn:cm2Pix(02.80)) // cedula
oPrn:CmSay(06.50,17.60,cEstCiv,oFont1,oPrn:cm2Pix(03.00)) // estado civil
oPrn:CmSay(07.30,03.30,cProSus,oFont1,oPrn:cm2Pix(05.50)) // profesion
oPrn:CmSay(07.30,11.60,cDirTra,oFont2,oPrn:cm2Pix(03.70)) // trabajo
oPrn:CmSay(07.30,17.60,cTelTra,oFont1,oPrn:cm2Pix(03.00)) // telefono
/*localizacion de lotes*/
DBSELECT "LOTE"
LOTE->(DBGoTop())
/*inicializa variable*/
nFila := 10
/*procesa cada lote*/
DO WHILE !LOTE->(Eof())
/*pasa valores a variables cadena*/
cJardin := ft_proper(StrTran(JARD->MJ_NOMJAR,"JARDIN",""))
cBloque := StrToken(LOTE->ML_CODLOT,2,"-")
cLote := StrToken(LOTE->ML_CODLOT,3,"-")
cPrecio := Transform(LOTE->ML_PREVEN,"999,999.99")
/*imprime datos*/
oPrn:CmSay(nFila,04.50,cLote, oFont1,oPrn:cm2Pix(01.80)) // lote
oPrn:CmSay(nFila,07.20,cJardin,oFont1,oPrn:cm2Pix(04.80)) // jardin
oPrn:CmSay(nFila,14.00,cBloque,oFont1,oPrn:cm2Pix(01.30)) // bloque
oPrn:CmSay(nFila,16.60,cPrecio,oFont1,oPrn:cm2Pix(02.40),,PAD_RIGHT) // precio
/*incrementa fila*/
nFila+=0.5
/*salta hacia el proximo lote*/
LOTE->(DBSkip())
ENDDO
/*restaura area*/
LOTE->(DBGoTop())
DBSELECT "CONT"
/*total*/
oPrn:CmSay(12.50,15.50,cTotal,oFont1,oPrn:cm2Pix(03.00),,PAD_RIGHT) // total
/**/
oPrn:CmSay(13.70,07.00,cTotal, oFont1,oPrn:cm2Pix(03.00),,PAD_RIGHT) // total U$
oPrn:CmSay(14.20,07.00,cPrima, oFont1,oPrn:cm2Pix(03.00),,PAD_RIGHT) // prima U$
oPrn:CmSay(14.70,07.00,cSaldo, oFont1,oPrn:cm2Pix(03.00),,PAD_RIGHT) // total U$
oPrn:CmSay(13.70,15.50,cCTotal,oFont1,oPrn:cm2Pix(03.00),,PAD_RIGHT) // total C$
oPrn:CmSay(14.20,15.50,cCPrima,oFont1,oPrn:cm2Pix(03.00),,PAD_RIGHT) // prima C$
oPrn:CmSay(14.70,15.50,cCSaldo,oFont1,oPrn:cm2Pix(03.00),,PAD_RIGHT) // total C$
oPrn:CmSay(15.20,06.20,cNumCuo,oFont1,oPrn:cm2Pix(01.00),,PAD_RIGHT) // numero de cuotas
oPrn:CmSay(15.20,13.50,cDiaPag,oFont1,oPrn:cm2Pix(02.20),,PAD_RIGHT) // dias de pago
oPrn:CmSay(15.70,03.50,cValCuo,oFont1,oPrn:cm2Pix(03.20),,PAD_RIGHT) // valor de cuotas
oPrn:CmSay(16.60,03.00,cDia,oFont1,oPrn:cm2Pix(01.00)) // dia
oPrn:CmSay(16.60,05.50,cMes,oFont1,oPrn:cm2Pix(03.00)) // mes
oPrn:CmSay(16.60,10.50,cAno,oFont1,oPrn:cm2Pix(02.00)) // a¤o
ENDPAGE
ENDPRINT
oFont1:End()
oFont2:End()
oFont3:End()
RETURN
Kleyber wrote:¿No hay nadie que tenga alguna experiencia con esto?
Saludos,
...
EXTEND CLASS TPRINTER WITH METHOD Cm2Pix
EXTEND CLASS TPRINTER WITH METHOD OSay
EXTEND CLASS TPRINTER WITH DATA nPxL
EXTEND CLASS TPRINTER WITH DATA nPxC
...
/*-------------------------------------------------------------------------------*/
STATIC FUNCTION Cm2Pix(nCm)
LOCAL SELF := HB_QSelf()
IF ValType( ::nXOffset ) == "U"
::nXoffset := 0
ENDIF
nPix := Max( 0, ( nCm * 10 * ::nHorzRes() / ::nHorzSize() ) - ::nXoffset )
RETURN nPix
/*-------------------------------------------------------------------------------*/
STATIC FUNCTION OSay(nRow,nCol,cText,oFont,nWidth,nClrText,nBkMode,nPad)
LOCAL SELF := HB_QSelf()
LOCAL nRowT := ::nPxL * nRow
LOCAL nColT := ::nPxC * nCol
LOCAL nWidT
DEFAULT nWidth := 0
nWidT := ::nPxC * nWidth
::Say(nRowT,nColT,OemToAnsi(cText),oFont,nWidT,nClrText,nBkMode,nPad)
RETURN NIL
/*-------------------------------------------------------------------------------*/
/*-------------------------------------------------------------------------------*/
/*OK*/
PROCEDURE Contratos_ImprimirEstado()
LOCAL nLin := 0
LOCAL oPrn
LOCAL nPxL //pixel por linea
LOCAL nPxC //pixel por columna
LOCAL nRec := LOTE->(RecNo())
LOCAL nTamLin,nLineas,x
/*objeto print*/
PRINT oPrn NAME "Estado actual de contrato" PREVIEW MODAL
/*fuentes a usar*/
DEFINE FONT oFntNor NAME "Courier New" SIZE 0, -10 OF oPrn
DEFINE FONT oFntTit NAME "Courier New" SIZE 0, -10 OF oPrn BOLD
oPrn:setpage(1)
/*obtiene resolucion de impresora*/
nVer := oPrn:nVertRes()
nHor := oPrn:nHorzRes()
/*establece numero de lineas y columnas*/
nPxL := (nVer/66)
nPxC := (nHor/82)
/*pasa calculo a objeto tprinter*/
oPrn:nPxL := nPxL
oPrn:nPxC := nPxC
PAGE
oPrn:osay(01,02,"Fecha y Hora : "+DToC(Date())+"/"+Time(),oFntNor)
oPrn:osay(03,02,NOM_EMPRESA,oFntTit)
oPrn:osay(04,02,"ESTADO ACTUAL DE CONTRATO",oFntTit)
oPrn:osay(06,02,Replicate("=",91),oFntNor)
oPrn:osay(07,02,"Contrato : "+CONT->MC_CODCON,oFntNor)
oPrn:osay(07,40,"Estado : "+Upper(CONT->MC_ESTADO),oFntTit)
oPrn:osay(08,02,"Suscriptor : "+CONT->MC_NOMSUS,oFntNor)
oPrn:osay(09,02,"Domicilio : "+CONT->MC_DIRSUS,oFntNor)
oPrn:osay(10,02,"Trabajo : "+CONT->MC_DIRTRA,oFntNor)
oPrn:osay(11,02,"Tel‚fonos : "+RTrim(CONT->MC_TELDOM)+"/"+RTrim(CONT->MC_TELTRA),oFntNor)
oPrn:osay(12,02,"C‚dula : "+CONT->MC_CEDULA,oFntNor)
oPrn:osay(12,40,"Profesi¢n : "+CONT->MC_PROSUS,oFntNor)
oPrn:osay(13,02,"Fecha venta : "+DToC(CONT->MC_FECCON),oFntNor)
oPrn:osay(13,40,"Tasa cambio : "+Tran(CONT->MC_TASCAM,"C$99.9999"),oFntNor)
oPrn:osay(14,02,"Fecha naci. : "+DToC(CONT->MC_FECNAC),oFntNor)
oPrn:osay(14,40,"Edad : "+Tran(nEdad,"99 A¤os"),oFntNor)
oPrn:osay(15,02,"Estado civil: "+IIf(CONT->MC_CASADO,"CASADO(A)","SOLTERO(A)"),oFntNor)
oPrn:osay(15,40,"Tasa Interes: "+Tran(CONT->MC_PORINT,"99%"),oFntNor)
oPrn:osay(16,02,Replicate("=",91),oFntNor)
/*titulo de lotes*/
oPrn:osay(17,02,"LOTE NO.", oFntTit)
oPrn:osay(17,14,"JARDIN", oFntTit)
oPrn:osay(17,50,"BLOQUE", oFntTit)
oPrn:osay(17,60,"PRECIO U$",oFntTit)
nLin := 17
/*cambia puntero a tabla LOTES*/
DBSELECT "LOTE"
LOTE->(DBGoTop())
/*procesa cada lote del contrato*/
DO WHILE !LOTE->(Eof())
/*imprime datos de lotes*/
oPrn:osay(++nLin, 02, StrToken(LOTE->ML_CODLOT,3,"-"), oFntNor)
oPrn:osay( nLin, 14, JARD->MJ_NOMJAR, oFntNor)
oPrn:osay( nLin, 50, StrToken(LOTE->ML_CODLOT,2,"-"), oFntNor)
oPrn:osay( nLin, 60, Tran(LOTE->ML_PREVEN,"$99,999.99"),oFntNor)
LOTE->(DBSkip())
ENDDO
/*restaura puntero a tabla CONTRATOS*/
LOTE->(DBGoTop(nRec))
DBSELECT "CONT"
oPrn:osay(++nLin,02,Replicate("=",91),oFntNor)
/*imprime datos de valores*/
oPrn:osay(++nLin,02,"Valor de contrato U$:" + tran(CONT->MC_TOTCON, "999,999.99"),oFntNor)
oPrn:osay( nLin,40,"Valor de contrato C$:" + tran(CONT->MC_TOTCONC,"999,999.99"),oFntNor)
oPrn:osay(++nLin,02,"Valor de prima U$:" + tran(CONT->MC_PAGPRI, "999,999.99"),oFntNor)
oPrn:osay( nLin,40,"Valor de prima C$:" + tran(CONT->MC_PAGPRIC,"999,999.99"),oFntNor)
oPrn:osay(++nLin,02,"Saldo a pagar U$:" + tran(CONT->MC_SALFIN, "999,999.99"),oFntNor)
oPrn:osay( nLin,40,"Saldo a pagar C$:" + tran(CONT->MC_SALFINC,"999,999.99"),oFntNor)
oPrn:osay(++nLin,02,Replicate("-",91),oFntNor)
oPrn:osay(++nLin,02,"N£mero de cuotas: " + tran(CONT->MC_NUMCUO, "999"),oFntNor)
oPrn:osay( nLin,29,"Fecha 1er. pago: " + DToC(CONT->MC_DIAPAG),oFntNor)
oPrn:osay( nLin,55,"Valor abono U$:" + tran(CONT->MC_VALABO, "99,999.99"),oFntNor)
oPrn:osay(++nLin,02,Replicate("-",91),oFntNor)
oPrn:osay(++nLin,02,"Vendedor: " + VEND->MV_NOMVEN,oFntNor)
oPrn:osay( nLin,40,"Colector: " + COLE->MC_NOMCOL,oFntNor)
oPrn:osay(++nLin,02,Replicate("-",91),oFntNor)
oPrn:osay(++nLin,02,"Beneficiario #1: " + CONT->MC_BENSE1,oFntNor)
oPrn:osay(++nLin,02,"C‚dula #1: " + CONT->MC_BENCE1,oFntNor)
oPrn:osay(++nLin,02,"Beneficiario #2: " + CONT->MC_BENSE2,oFntNor)
oPrn:osay(++nLin,02,"C‚dula #2: " + CONT->MC_BENCE2,oFntNor)
oPrn:osay(++nLin,02,Replicate("-",91),oFntNor)
oPrn:osay(++nLin,02,"Titulo Numero: " + CONT->MC_NUMTIT,oFntNor)
oPrn:osay( nLin,40,"Fecha Emici¢n: " + DToC(CONT->MC_FECTIT),oFntNor)
oPrn:osay(++nLin,02,Replicate("=",91),oFntNor)
oPrn:osay(++nLin,02,"Esta Asegurado : " + IIf(CONT->MC_INISER,"SI","NO"),oFntNor)
oPrn:osay(++nLin,02,"Nombre de fiador: " + CONT->MC_NOMFIA,oFntNor)
oPrn:osay(++nLin,02,"Direccion : " + CONT->MC_DIRFIA,oFntNor)
oPrn:osay(++nLin,02,"Tel‚fono : " + CONT->MC_TELFIA,oFntNor)
oPrn:osay( nLin,40,"C‚dula: " + CONT->MC_CEDFIA,oFntNor)
oPrn:osay(++nLin,02,Replicate("=",91),oFntNor)
oPrn:osay(++nLin,02,"NOTAS:",oFntTit)
/*imeprime lineas de anotaci¢n*/
IF !Empty(CONT->MC_NOTAS)
nTamLin := 65
nLineas := MLCount(CONT->MC_NOTAS,nTamLin)
FOR x:=1 TO nLineas
oPrn:oSay(nLin+x,02,MemoLine(CONT->MC_NOTAS,nTamLin,x,,TRUE),oFntNor)
NEXT
ENDIF
ENDPAGE
ENDPRINT
RETURN
/*-------------------------------------------------------------------------------*/
CmSay() debería imprimir en la misma posición exactamente. De no hacerlo es un bug que hay que corregir
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: csincuir, Google [Bot] and 38 guests