FUNCTION InvoiceMask()
local j
local x := 0
local y := 0
local aSeries1 := {}
local aSeries2 := {}
local nCount := 0
local nIva0SinDes := 0
local nIva10SinDes := 0
local nIva0ConDes := 0
local nIva10ConDes := 0
local nSubSinDesBonif := 0
local nSubBonif := 0
local nValSinDesBonif := 0
local nValBonif := 0
local nSubDescuento := 0
local nValDescuento := 0
local oFp := tWg_FormasPagoDocus():new()
local nLineas
#define ANCHO_FACTURA 1
#define COD_SERVICIO_TECNICO 'nnnn'
// #define HPDF_DEF_PAGE_WIDTH 595.276
// #define HPDF_DEF_PAGE_HEIGHT 841.89
oPdf:nMargin = 0
//* HPDF_PageSizes */
//#define HPDF_PAGE_SIZE_LETTER 0
//#define HPDF_PAGE_SIZE_LEGAL 1
//#define HPDF_PAGE_SIZE_A3 2
//#define HPDF_PAGE_SIZE_A4 3
//#define HPDF_PAGE_SIZE_A5 4
//#define HPDF_PAGE_SIZE_B4 5
//#define HPDF_PAGE_SIZE_B5 6
//#define HPDF_PAGE_SIZE_EXECUTIVE 7
//#define HPDF_PAGE_SIZE_US4x6 8
//#define HPDF_PAGE_SIZE_US4x8 9
//#define HPDF_PAGE_SIZE_US5x7 10
//#define HPDF_PAGE_SIZE_COMM10 11
//#define HPDF_PAGE_SIZE_EOF 12
oPdf:nPageSize = 1
oPdf:PAGE_WIDTH = 221.10
oPdf:PAGE_HEIGHT = 1050.00 //para 11 lineas es 1.4 por cada producto
// es decir es 15.4 para 11
// debemos restar los 15.4 y luego aumentar
// 1.4 por cada fila
nLineas = lineasDocu( factura->num_fact, 'factura' )
//oPdf:PAGE_HEIGHT = 700.00 - 15.4 + nLineas * 1.4
//oPdf:PAGE_HEIGHT = 700.00 - 30 + nLineas * 1.4
oPDF:PageHeader()
//oPdf:DrawImage( 'ARCHIVO', FILA, COLUMNA, ANCHO, LARGO )
oPdf:DrawImage( 'logo.jpg', 09.5, 1, 48, 10 )
// oPDF:DrawRetangle( 0, 0, 41, 75 ) // cuadro total
oPDF:DrawText( 2.0, 0, substr(setup->se_nomcom,1,38), '@!', 9.5,'Courier-Bold' , 0 )
oPDF:DrawText( 3.0, 1, 'R U C : ', '@!', 7.5,'Courier-Bold' , 0 )
oPDF:DrawText( 3.0, 11, setup->se_ruc, '@!', 9.5,'Courier-Bold' , 0 )
//*************************************************************************************
//*****************INCIO DATOS DE LA FACTURA*******************************************
//*************************************************************************************
//oPDF:DrawRetangle( Y, X, ANCHO, LARGO ) //cuadro datos factura
oPDF:DrawRetangle( 9.3, 1, 39, 19.2 )
//oPDF:DrawText(FILA, COLUMNA, 'TEXTO', 'FORMATO', TAMAÑO,'TIPO DE LETRA' , 0 )
oPDF:DrawText( 10, 1, FACTURA->Num_Fact, '9999999', 5.5,'Courier-Bold' , 0 )
oPDF:DrawText( 10, 06, 'Factura No. ', '@', 8.5,'Courier-Bold' , 0 )
if empty( factura->num_num_fa )
oPDF:DrawText( 10, 17,strzero(cajas->num_local,3)+'-'+strzero(cajas->num_establ,3)+'-'+strzero(factura->num_fact,9), '@!', 9.5, 'Courier' , 0 )
else
oPDF:DrawText( 10, 17,strzero(cajas->num_local,3)+'-'+strzero(cajas->num_establ,3)+'-'+strzero(factura->num_num_fa,9), '@!', 9.5, 'Courier' , 0 )
end
oPDF:DrawText( 10.7, 2, ' Fecha : ', '@', 6.5,'Courier-Bold' , 0 )
oPDF:DrawText( 10.7, 14, Factura->Fecha_Fa, '99/99/9999!', 7.0, , 0 )
oPDF:DrawText( 11.4, 2, ' Ambiente : ', '@', 6.5,'Courier-Bold' , 0 )
oPDF:DrawText( 11.4, 14, 'PRODUCCION ', '@', 7.0, , 0 )
oPDF:DrawText( 12.1, 2, 'Contribuyente : ', '@', 6.5,'Courier-Bold' , 0 )
oPDF:DrawText( 12.1, 14, 'OBLIGADO A LLEVAR CONTABILIDAD', '@', 7.0, , 0 )
oPDF:DrawText( 12.1, 38, 'SI', '@', 7.0,'Courier-Bold' , 0 )
oPDF:DrawText( 12.8, 2, ' Dir. Matriz : ', '@', 6.5,'Courier-Bold' , 0 )
oPDF:DrawText( 13.5, 2, 'CALLE S59 S/N Y CALLE E2 C CDLA. MATILDE DE ', '@!',7.0, , 0 )
oPDF:DrawText( 14.2, 2, ' ALVAREZ - GUAMANI - QUITO', '@!',7.0, , 0 )
oPDF:DrawText( 14.9, 2, 'Numero de Autorizacion SRI : ', '@', 6.5,'Courier-Bold' , 0 )
#ifdef __FE_OFFLINE__
oPDF:DrawText( 15.6, 2, factura->sri_acceso, '@!',7.0, , 0 )
#else
oPDF:DrawText( 15.6, 2, factura->sri_autori, '@!',7.0, , 0 )
#endif
oPDF:DrawText( 16.3, 2, 'Clave de Acceso SRI : ', '@', 6.5,'Courier-Bold' , 0 )
//*************************************************************************************
//*****************INICIO CODIGO DE BARRAS*********************************************
//*************************************************************************************
if factura->anulada == .T.
oPDF:Drawtext( 17.0, 2, '>>>>FACTURA ANULADA<<<<', '@!',12, 'Courier' , 0 )
else
if !empty( factura->sri_acceso )
//DrawBarcode( oPdf:oPage, y , ancho, "CODE128", alltrim( factura->sri_acceso ), , margen izq)
DrawBarcode( oPdf:oPage, 197, 0.61 , "CODE128", alltrim( factura->sri_acceso ), , 13 )
end
end
//FIN CODIGO DE BARRAS//
oPDF:DrawText( 21.0, 2.5, Factura->Sri_Acceso, '@!',6.7, , 0 )
oPDF:DrawText( 21.7, 2, 'Nombres y Apellidos / Razon Social :', '@', 6.5,'Courier-Bold' , 0 )
if '9999999999999' $ clientes->ruc
oPDF:DrawText( 22.4, 2, factura->nombre , '@!',7.0, , 0 )
else
oPDF:DrawText( 22.4, 2, clientes->nomcli+clientes->nomcli2 , '@!',7.0, , 0 )
end
oPDF:DrawText( 23.1, 2, 'C.I. / R.U.C. : ', '@', 6.5,'Courier-Bold' , 0 )
if '9999999999999' $ clientes->ruc
oPDF:DrawText( 23.1, 14 ,factura->cedula , '@!',7.0, , 0 )
else
oPDF:DrawText( 23.1, 14 ,clientes->ruc , '@!',7.0, , 0 )
end
oPDF:DrawText( 23.1, 20, ' Codigo :', '@', 6.5,'Courier-Bold' , 0 )
oPDF:DrawText( 23.1, 35, strzero(clientes->codcli,5), '@!',7.0, , 0 )
oPDF:DrawText( 23.8, 2, 'Fecha y Hora de Emision : ', '@', 6.5,'Courier-Bold' , 0 )
oPDF:DrawText( 23.8, 22, SUBSTR(factura->sri_feauto,1,10), '@!', 7.0, , 0 )
oPDF:DrawText( 23.8, 32, SUBSTR(factura->sri_feauto,12,8), '@!', 7.0, , 0 )
//*************************************************************************************
//**************INICIO lineas de las columnas del detalle de la factura***************
//*************************************************************************************
oPDF:DrawRetangle( 24.5, 1, 39, 1.4,,2, {0.75, 0.75, 0.75}) //Sombra cuadro cabecera líneas
oPDF:DrawRetangle( 24.5, 1, 39, 1.4 )//cuadro cabecera líneas
oPDF:DrawText( 25.2, 1, ' D E T A L L E % CANTIDAD P. UNIT P. TOTAL','@', 6.5,'Courier-Bold' , 0 )
x= 1
while ventas->num_fact == factura->num_fact .and. !ventas->(eof())
oPDF:DrawRetangle( x + 25.9, 1, 39, 0.1, , 7, {0.9, 0.9, 0.9} ) // dibuja las lineas transparentes del cuerpo
producto->( dbseek( ventas->cod_prod ) )
oPDF:Drawtext( x + 25.0, 2.0, saycodigo( producto->CODBARRAS ), '@!', 6.5, 'Courier' ) //cod barras líneas
oPDF:Drawtext( x + 25.0, 22.0, saycodigo( ventas->cod_prod ) , '@!', 6.5, 'Courier' ) //código línes
oPDF:Drawtext( x + 25.7, 1.0, substr(saycodigo( producto->descrip, 1 ),1,16), '@!', 6.5, 'Courier' ) //producto líenas
oPDF:Drawtext( x + 25.7, 13.0, ventas->descuento, '999.99', 6.5, 'Courier' ) // descuento líneas
oPDF:Drawtext( x + 25.7, 17.0, ventas->cantidad , '999,999.99', 6.5, 'Courier' ) //cantidad líneas
oPDF:Drawtext( x + 25.7, 26.0, ventas->precio, '999.9999', 6.5, 'Courier' ) // precio líneas
oPDF:Drawtext( x + 25.7, 33.0, ventas->sub_tot, '999,999.99', 6.5, 'Courier' ) // sub total línes
nIva0SinDes += if( Producto->Iva >0, 0 , ventas->PRECIO * ventas->VENTA )
nIva10SinDes += if( Producto->Iva >0, ventas->PRECIO * ventas->VENTA , 0 )
nIva0ConDes += if( Producto->Iva >0, 0 ,ventas->Sub_Tot )
nIva10ConDes += if( Producto->Iva >0, ventas->Sub_Tot, 0 )
nSubSinDesBonif += ventas->Cantidad * ventas->Precio
nSubBonif += ventas->Bonif * ventas->Precio
nValSinDesBonif := ventas->Cantidad * ventas->Precio
nValBonif := ventas->Bonif * ventas->Precio
nSubDescuento += ventas->Venta * ventas->Precio * ventas->descuento/100
nValDescuento := ventas->Venta * ventas->Precio * ventas->descuento/100
x += (0.7*2)
nCount = 0
ventas->( dbskip() )
end
y=x+25
// Fin detalle de la factura
//*************************************************************************************
//**************Inicio Pie de FACTURA datos adicionales del cliente********************
//*************************************************************************************
oPDF:DrawRetangle( y, 1, 21, 0.8 ) //cuadro datos cliente
oPDF:DrawText( y+0.5, 2, 'DATOS ADICIONALES CLIENTES', '@', 6.5,'Courier-Bold' , 0 )
oPDF:DrawRetangle( y, 1, 21, 7.8 ) //cuadro datos cliente
oPDF:DrawText( y+1.4, 2, 'Direccion : ', '@', 6.5,'Courier-Bold' , 0 )
oPDF:DrawText( y+2.1, 2, if( '9999999999999' $ clientes->ruc , substr(factura->direccion,1,30) , substr(clientes->dirtrabaj+left(clientes->direc1,12),1,30)), '@!', 6.5, , 0 )
oPDF:DrawText( y+2.1, 2, if( '9999999999999' $ clientes->ruc , substr(factura->direccion,31,60) , substr(clientes->dirtrabaj+left(clientes->direc1,12),31,60)), '@!', 6.5, , 0 )
oPDF:DrawText( y+2.8, 2, 'Telefono : ', '@', 6.5,'Courier-Bold' , 0 )
oPDF:DrawText( y+2.8, 14.5, if( '9999999999999' $ clientes->ruc , factura->telefono , clientes->teleftrab), '@!', 6.5, , 0 )
oPDF:DrawText( y+3.5, 2, 'E-mail : ', '@', 6.5,'Courier-Bold' , 0 )
oPDF:DrawText( y+4.2, 2, if( '9999999999999' $ clientes->ruc ,substr(factura->email,1,30) , substr(clientes->email,1,30)), '@!', 6.5, , 0 )
oPDF:DrawText( y+4.8, 2, if( '9999999999999' $ clientes->ruc ,substr(factura->email,31,60) , substr(clientes->email,31,60)), '@!', 6.5, , 0 )
//*************************************************************************************
//***********************Inicio Pie de FACTURA TOTALES ********************************
//*************************************************************************************
oPDF:DrawRetangle( y, 22, 18, 7.8 )
oPDF:DrawText( y+0.8, 22.6, 'S. Total '+ str( GLB_Iva * 100,2 ) + '% :', '@', 6.1,'Courier-Bold' , 0 )
oPDF:DrawText( y+0.8, 29.8, nIva10ConDes, '99,999,999.99', 7.0,'Courier-Bold' , 0 )
oPDF:DrawText( y+1.8, 22.6, 'S. Total 0% :', '@', 6.1,'Courier-Bold' , 0 )
oPDF:DrawText( y+1.8, 29.8, nIva0SinDes, '99,999,999.99', 7.0,'Courier-Bold' , 0 )
oPDF:DrawText( y+2.8, 22.6, 'S.Total sin Iva:', '@', 6.1,'Courier-Bold' , 0 )
oPDF:DrawText( y+2.8, 29.8, factura->subtotal-factura->descuent, '99,999,999.99', 7.0,'Courier-Bold' , 0 )
oPDF:DrawText( y+3.8, 22.6, 'IVA '+ str( GLB_Iva * 100,2 ) + '% : ', '@!', 6.1,'Courier-Bold' , 0 )
oPDF:DrawText( y+3.8, 29.8, factura->iva, '99,999,999.99', 7.0,'Courier-Bold' , 0 )
oPDF:DrawText( y+5.5, 22.6, 'VALOR USD : ', '@!',8.0,'Courier-Bold' , 0 )
oPDF:DrawText( y+5.5, 31.7, factura->total, '99,999,999.99', 9.5, "Helvetica-Bold",0 )
//*************************************************************************************
//***************************Inicio Pie DEDUCIBLES ************************************
//*************************************************************************************
oPDF:DrawRetangle( y+6.5, 1, 21, 0.8 ) //cuadro datos DEDUCIBLES PEQUEÑO
oPDF:DrawRetangle( y+6.5, 1, 21, 6.5 ) //cuadro datos DEDUCIBLES GRANDE
oPDF:DrawText( y+ 7.0, 1.5, ' DEDUCIBLES ', '@!', 6.5,'Courier-Bold' , 0 )
oPDF:DrawText( y+ 8.0, 1.5, 'SORTEO : ', '@!', 6.5,'Courier-Bold' , 0 )
oPDF:DrawText( y+ 8.0, 11.0, 0, '99,999,999.99', 7.5,'Courier-Bold' , 0 )
oPDF:DrawText( y+ 8.7, 1.5, 'EDUCACION : ', '@', 6.5,'Courier-Bold' , 0 )
oPDF:DrawText( y+ 8.7, 11.0, 0, '99,999,999.99', 7.5,'Courier-Bold' , 0 )
oPDF:DrawText( y+ 9.4, 1.5, 'QUIFATEX : ', '@', 6.5,'Courier-Bold' , 0 )
oPDF:DrawText( y+ 9.4, 11.0, 0, '99,999,999.99', 7.5,'Courier-Bold' , 0 )
oPDF:DrawText( y+10.1, 1.5, 'SALUD : ', '@', 6.5,'Courier-Bold' , 0 )
oPDF:DrawText( y+10.1, 11.0, 0, '99,999,999.99', 7.5,'Courier-Bold' , 0 )
oPDF:DrawText( y+10.8, 1.5, 'VESTIMENTA : ', '@', 6.5,'Courier-Bold' , 0 )
oPDF:DrawText( y+10.8, 11.0, 0, '99,999,999.99', 7.5,'Courier-Bold' , 0 )
//*************************************************************************************
//*******************************Inicio AHORRO*****************************************
//*************************************************************************************
oPDF:DrawRetangle( y+6.5, 22, 18, 6.5 ) //cuadro datos cliente
if nSubDescuento <> 0
oPDF:DrawText( y+8.5, 22.0, ' SU AHORRO 4X4 ES DE: ', '@!', 7.5,'Courier-Bold' , 0 )
nOtrosCar = factura->OtrosCar
if empty( factura->iva )
n10 := 0
n0 := factura->subtotal - factura->descuent
else
n10 := factura->Iva / GLB_Iva
n0 := factura->subtotal - factura->descuent + nOtrosCar - n10
if n0 >= 0.1
else
n0 := 0
end
if empty( n0 )
n10 = factura->subtotal - factura->descuent
end
end
oPDF:DrawText( y+10.3, 31.0, nSubDescuento, '99,999,999.99', 9.5,'Helvetica-Bold' , 0 )
oPDF:DrawText( y+10.3, 23.8, 'Usd ', '@!', 9.5,'Helvetica-Bold' , 0 )
else
oPDF:DrawText( y+9.5, 21.5, ' GRACIAS POR SU VISITA', '@!', 7.5,'Courier-Bold' , 0 )
end
//*************************************************************************************
//***************************Inicio FORMAS DE PAGO*************************************
//*************************************************************************************
oPDF:DrawRetangle( y+11.9, 1, 21, 0.8 ) //cuadro datos DEDUCIBLES PEQUEÑO
oPDF:DrawRetangle( y+11.9, 1, 21, 6.5 ) //cuadro datos DEDUCIBLES GRANDE
oPDF:DrawText( y+12.4, 1.5,' FORMAS DE PAGO ', '@', 6.5,'Courier-Bold' , 0 )
oPDF:DrawText( y+13.1, 1.5, 'EF Efectivo: ', '@', 6.5,'Courier-Bold' , 0 )
oPDF:DrawText( y+13.1, 11.0, wg_formasdepago( factura->num_fact, 5, 'EF', 'AB' ), '99,999,999.99', 7.5,'Courier-Bold' , 0 )
oPDF:DrawText( y+13.8, 1.5, 'CHEQUES : ', '@', 6.5,'Courier-Bold' , 0 )
oPDF:DrawText( y+13.8, 11.0, wg_formasdepago( factura->num_fact, 5, 'CF,CD' ), '99,999,999.99', 7.5,'Courier-Bold' , 0 )
oPDF:DrawText( y+14.5, 1.5, 'TARJETAS CR: ', '@', 6.5,'Courier-Bold' , 0 )
oPDF:DrawText( y+14.5, 11.0, wg_formasdepago( factura->num_fact, 5, 'VC,VD,F2,F8,TC,TD' ), '99,999,999.99', 7.5,'Courier-Bold' , 0 )
oPDF:DrawText( y+15.2, 1.5, 'OTROS ', '@', 6.5,'Courier-Bold' , 0 )
oPDF:DrawText( y+15.2, 11.0, wg_formasdepago( factura->num_fact, 5, 'CR,VV' ), '99,999,999.99', 7.5,'Courier-Bold' , 0 )
oPDF:DrawText( y+15.9, 1.5, 'R1 RET FTE : ', '@', 6.5,'Courier-Bold' , 0 )
oPDF:DrawText( y+15.9, 11.0, wg_formasdepago( factura->num_fact, 5, 'VV' ), '99,999,999.99', 7.5,'Courier-Bold' , 0 )
oPDF:DrawText( y+16.6, 1.5, 'R2 RET IVA : ', '@', 6.5,'Courier-Bold' , 0 )
oPDF:DrawText( y+16.6, 11.0, 0, '99,999,999.99', 7.5,'Courier-Bold' , 0 )
//*************************************************************************************
//********************************Inicio PAGO*****************************************
//*************************************************************************************
oPDF:DrawRetangle( y+11.9, 22, 18, 6.5 ) //cuadro datos cliente
oPDF:DrawText( y+12.6, 22.6, 'ENTREGA :', '@', 6.5,'Courier-Bold' , 0 )
oPDF:DrawText( y+12.6, 33.0, factura->cobrado, '99,999,999.99', 8.0, "Helvetica-Bold",0 )
oPDF:DrawText( y+13.6, 22.6, 'CAMBIO :', '@', 6.5,'Courier-Bold' , 0 )
oPDF:DrawText( y+13.6, 33.0, factura->vuelto, '99,999,999.99', 8.0, "Helvetica-Bold",0 )
oPDF:DrawText( y+14.6, 22.6, 'CAJA :', '@', 6.5,'Courier-Bold' , 0 )
oPDF:DrawText( y+14.6, 33.0, cajas->num_caja, '999,999,999', 8.0, "Helvetica-Bold",0 )
oPDF:DrawText( y+15.6, 22.6, 'USUARIO :', '@', 6.5,'Courier-Bold' , 0 )
oPDF:DrawText( y+15.6, 30.0, substr(Ejecutiv->E_nombre,1,11), '@!', 8.0, "Helvetica-Bold",0 )
oPDF:DrawText( y+16.6, 22.6, 'IMPRESO :', '@', 6.5,'Courier-Bold' , 0 )
oPDF:DrawText( y+16.6, 33.0, Factura->Hora, '@!', 8.0, "Helvetica-Bold",0 )
//oPDF:DrawText( y+26.6, 39.4, " ", '@!', 8.0, "Helvetica-Bold",0 )
RETURN nil