#include "Fivewin.ch"
#include "Report.ch"
#include "FileIo.ch"
#define VERSION "Versión 1.2 <14-01-2011> (Rev. 00.13)"
#define K_ENTER 13
#define COMPARTIDO .T.
#define EXCLUSIVO .F.
#define COLBLANCO 255,255,255
#define COL_BRTEX 255,255,255
#define COL_BRFON 0,75,105
#define ID_VTDBF OemToAnsi(' Facturaci¢n PYME ')+VERSION+CRLF+;
OemToAnsi(' (c) CEPEDA Servicios Inform ticos 2004')
#define NL Chr( 10 ) + Chr( 13 )
#define SAF 100
Static oBar
Static oWnd
Static oFont
Static oIcon
Static oBrush
Static cNomEmp
Static cPathEm
Static lSelEmp
Static cNifEmp
#include "rpreview.prg"
Function Main()
LOCAL aStruct
LOCAL lCreado := .F.
LOCAL oSay
LOCAL aFieldsNew := {}
LOCAL lActivado := .F.
SET DATE ITALIAN
SET DELETED ON
SET CENTURY ON
SET EPOCH TO 1960
SET CONFIRM ON
SET 3DLOOK ON
DEFINE FONT oFont NAME "Arial" SIZE 0, -12
ACTIVATE FONT oFont
DEFINE ICON oIcon FILENAME "..\icons\fivetech.ICO"
DEFINE BRUSH oBrush FILENAME "..\bitmaps\backgrnd\sky3.bmp"
DEFINE WINDOW oWnd MDI FROM 04, 10 TO 30, 90;
TITLE OemToAnsi( "Facturaci¢n PYME" ) ;
MENU Menu() ;
ICON oIcon ;
BRUSH oBrush
SET FONT OF oWnd TO oFont
SET MESSAGE OF oWnd TO ;
OemToAnsi('Facturaci¢n PYME Usuario = '+WNetGetUser());
TIME DATE KEYBOARD 2007
DEFINE BUTTONBAR oBar _3D SIZE 45, 45 TOP OF oWnd 2007
DEFINE BUTTON OF oBar FILENAME "..\bitmaps\cascade.bmp" TOOLTIP ;
'Facturación' ACTION PintUnaFac( oWnd ) MESSAGE 'Emisión de facturas' GROUP
DEFINE BUTTON OF oBar FILENAME "..\bitmaps\exit.bmp" TOOLTIP 'Terminar';
ACTION oWnd:End() MESSAGE 'Termina el programa' GROUP
ACTIVATE WINDOW oWnd MAXIMIZED
Return NIL
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Static Function Menu()
LOCAL oMenu
MENU oMenu
MENUITEM '&Selección' MESSAGE 'Selecci¢n de Empresa'
MENU
MENUITEM '&Terminar' ACTION oWnd:End() MESSAGE 'Termina el programa'
ENDMENU
MENUITEM '&Ventas' MESSAGE 'Procesos generales de VENTAS'
MENU
MENUITEM '&Facturas' ACTION PintUnaFac( oWnd ) MESSAGE 'Emisión de facturas'
ENDMENU
ENDMENU
Return oMenu
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Static Function PintUnaFac( oWnd )
LOCAL oDlg, oFont, aoBtn[ 2 ]
DEFINE FONT oFont NAME "Arial" SIZE 0, -12
DEFINE DIALOG oDlg TITLE "FWH Ver. 7.11 queda el preview detrás";
FROM 0, 0 TO 380, 350 ; //Alto y Ancho
PIXEL OF oWnd FONT oFont
@ 164, 72 BUTTON aoBtn[ 1 ] PROMPT "&Imprimir" PIXEL SIZE 35,10 OF oDlg ;
ACTION Imprimir( oDlg )
@ 164,130 BUTTON aoBtn[ 2 ] PROMPT "Sa&lir" PIXEL SIZE 35,10 OF oDlg ;
ACTION oDlg:End()
ACTIVATE DIALOG oDlg CENTER
Return NIL
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Static Function Imprimir( oWnd )
LOCAL oPrn, oFont1, oFont2, oFont3, oFont4, oFont5, oFont6, oFont7, oFont8, ;
oFontLogo, oPen1, oPen2
LOCAL aCoord1[ 2 ], aCoord2[ 2 ]
LOCAL nFil, nCol, nTop, nBot
LOCAL nAnch, nAlto
LOCAL nPixHorz, nPixVert
LOCAL nAncho_1, nAncho_2
oWnd:End()
PRINT oPrn NAME "Impresión de facturas" PREVIEW
IF Empty( oPrn:hDC )
MsgStop( OemToAnsi( "¡ No hay IMPRESORA para imprimir !" ))
Return NIL
EndIF
nPixVert := oPrn:nVertRes()
nPixHorz := oPrn:nHorzRes()
IF nPixHorz < 3000
nAnch := 8913290
nAlto := 12255652
nAncho_1 := 4
nAncho_2 := 7
ELSE
nAnch := 8913494
nAlto := 12256000
nAncho_1 := 6
nAncho_2 := 11
EndIf
DEFINE FONT oFont1 NAME "Arial" SIZE 0, -6 OF oPrn
DEFINE FONT oFont2 NAME "Arial" SIZE 0, -9 OF oPrn
DEFINE FONT oFont3 NAME "Arial" SIZE 0, -12 BOLD OF oPrn
DEFINE FONT oFont4 NAME "Arial" SIZE 0, -11 OF oPrn
DEFINE FONT oFont5 NAME "Arial" SIZE 0, -16 OF oPrn
DEFINE FONT oFont6 NAME "Arial" SIZE 0, -10 OF oPrn
DEFINE FONT oFont7 NAME "Courier New" SIZE 0, -10 OF oPrn
DEFINE FONT oFont8 NAME "Times New Roman" SIZE 0, -10 BOLD OF oPrn
DEFINE FONT oFontLogo NAME "Arial" SIZE 0, -19 BOLD OF oPrn
DEFINE PEN oPen1 WIDTH nAncho_1
DEFINE PEN oPen2 WIDTH nAncho_2
PAGE
// Cabecera
nFil := 1.6
nCol := 2.2
aCoord1 := oPrn:Cmtr2Pix( @nFil, @nCol )
oPrn:CmSay ( 3.1, 2.3, "PRUEBA DE IMPRESIÓN", oFontLogo )
nFil := 4.4
nCol := 10.9
nTop := 7.7
nBot := 20.15
aCoord1 := oPrn:Cmtr2Pix( @nFil, @nCol )
aCoord2 := oPrn:Cmtr2Pix( @nTop, @nBot )
oPrn:Box ( nFil, nCol, nTop, nBot, oPen2 ) //Caja Cliente
oPrn:CmSay ( 4.0, 11.0, 'Dirección Correspondencia del Cliente:', oFont2 )
oPrn:CmSay ( 4.7, 11.1, "Juan Pérez de las Heras", oFont4 )
oPrn:CmSay ( 5.2, 11.1, "Compras", oFont4 )
oPrn:CmSay ( 5.7, 11.1, "La Calle, 22", oFont4 )
oPrn:CmSay ( 6.7, 11.1, "Madrid", oFont4 )
nFil := 8.15
nCol := 2.20
nTop := 8.75
nBot := 20.15
aCoord1 := oPrn:Cmtr2Pix( @nFil, @nCol )
aCoord2 := oPrn:Cmtr2Pix( @nTop, @nBot )
oPrn:Box ( nFil, nCol, nTop, nBot, oPen2 ) //Caja n§ fra. etc
oPrn:CmSay ( 8.15, 2.30, 'C.I.F.:', oFont3 )
oPrn:CmSay ( 8.15, 6.00, 'Nº Factura :', oFont3 )
oPrn:CmSay ( 8.15, 11.20, 'Fecha : ', oFont3 )
oPrn:CmSay ( 8.15, 15.60, 'F. Pago :', oFont3 )
nFil := 8.90
nCol := 2.20
nTop := 9.50
nBot := 20.15
aCoord1 := oPrn:Cmtr2Pix( @nFil, @nCol )
aCoord2 := oPrn:Cmtr2Pix( @nTop, @nBot )
oPrn:Box ( nFil, nCol, nTop, nBot, oPen2 ) //Caja observaciones
oPrn:CmSay ( 9.10, 2.30, 'Observaciones:', oFont2 )
nFil := 9.65
nCol := 2.20
nTop := 23.25
nBot := 20.15
aCoord1 := oPrn:Cmtr2Pix( @nFil, @nCol )
aCoord2 := oPrn:Cmtr2Pix( @nTop, @nBot )
oPrn:Box ( nFil, nCol, nTop, nBot, oPen2 ) //Caja cuerpo factura
nFil := 9.65
nCol := 5.20
nTop := 23.25
nBot := 5.20
aCoord1 := oPrn:Cmtr2Pix( @nFil, @nCol )
aCoord2 := oPrn:Cmtr2Pix( @nTop, @nBot )
oPrn:Line ( nFil, nCol, nTop, nBot, oPen2 ) //1¦ VERTICAL
nFil := 9.65
nCol := 12.20
nTop := 23.25
nBot := 12.20
aCoord1 := oPrn:Cmtr2Pix( @nFil, @nCol )
aCoord2 := oPrn:Cmtr2Pix( @nTop, @nBot )
oPrn:Line ( nFil, nCol, nTop, nBot, oPen2 ) //2¦ VERTICAL
nFil := 9.65
nCol := 13.80
nTop := 23.25
nBot := 13.80
aCoord1 := oPrn:Cmtr2Pix( @nFil, @nCol )
aCoord2 := oPrn:Cmtr2Pix( @nTop, @nBot )
oPrn:Line ( nFil, nCol, nTop, nBot, oPen2 ) //3¦ VERTICAL
nFil := 9.65
nCol := 15.80
nTop := 23.25
nBot := 15.80
aCoord1 := oPrn:Cmtr2Pix( @nFil, @nCol )
aCoord2 := oPrn:Cmtr2Pix( @nTop, @nBot )
oPrn:Line ( nFil, nCol, nTop, nBot, oPen2 ) //4¦ VERTICAL
nFil := 9.65
nCol := 17.10
nTop := 23.25
nBot := 17.10
aCoord1 := oPrn:Cmtr2Pix( @nFil, @nCol )
aCoord2 := oPrn:Cmtr2Pix( @nTop, @nBot )
oPrn:Line ( nFil, nCol, nTop, nBot, oPen2 ) //5¦ VERTICAL
nFil := 10.20
nCol := 2.20
nTop := 10.20
nBot := 20.15
aCoord1 := oPrn:Cmtr2Pix( @nFil, @nCol )
aCoord2 := oPrn:Cmtr2Pix( @nTop, @nBot )
oPrn:Line ( nFil, nCol, nTop, nBot, oPen2 ) // Subrayado HORIZONTAL
oPrn:CmSay( 9.65, 2.30, 'Código' , oFont3 )
oPrn:CmSay( 9.65, 5.30, 'Descripción', oFont3 )
oPrn:CmSay( 9.65, 12.30, 'Unid.' , oFont3 )
oPrn:CmSay( 9.65, 14.00, 'Precio' , oFont3 )
// oPrn:CmSay( 9.65, 16.20, 'Dto.' , oFont3 )
oPrn:CmSay( 9.65, 18.20, 'Importe' , oFont3 )
nFil := 23.40
nCol := 2.20
nTop := 27.20
nBot := 20.15
aCoord1 := oPrn:Cmtr2Pix( @nFil, @nCol )
aCoord2 := oPrn:Cmtr2Pix( @nTop, @nBot )
oPrn:Box ( nFil, nCol, nTop, nBot, oPen2 ) //Caja Final TOTALES
oPrn:CmSay ( 23.50, 2.40, 'BASE', oFont7 )
oPrn:CmSay ( 23.50, 5.20, '%IVA', oFont7 )
oPrn:CmSay ( 23.50, 6.75, 'CUOTA', oFont7 )
oPrn:CmSay ( 23.50, 9.60, '%RE', oFont7 )
oPrn:CmSay ( 23.50, 11.20, 'CUOTA', oFont7 )
oPrn:CmSay ( 23.50, 14.10, 'IMPORTE', oFont7 )
nFil := 24.00
nCol := 2.20
nTop := 24.00
nBot := 16.70
aCoord1 := oPrn:Cmtr2Pix( @nFil, @nCol )
aCoord2 := oPrn:Cmtr2Pix( @nTop, @nBot )
oPrn:Line ( nFil, nCol, nTop, nBot, oPen1 ) //1¦ HORIZONT TOTALES
nFil := 23.40
nCol := 4.95
nTop := 26.20
nBot := 4.95
aCoord1 := oPrn:Cmtr2Pix( @nFil, @nCol )
aCoord2 := oPrn:Cmtr2Pix( @nTop, @nBot )
oPrn:Line ( nFil, nCol, nTop, nBot, oPen1 ) //1¦ VERTICAL TOTALES
nFil := 23.40
nCol := 6.45
nTop := 26.20
nBot := 6.45
aCoord1 := oPrn:Cmtr2Pix( @nFil, @nCol )
aCoord2 := oPrn:Cmtr2Pix( @nTop, @nBot )
oPrn:Line ( nFil, nCol, nTop, nBot, oPen1 ) //2¦ VERTICAL TOTALES
nFil := 23.40
nCol := 9.35
nTop := 26.20
nBot := 9.35
aCoord1 := oPrn:Cmtr2Pix( @nFil, @nCol )
aCoord2 := oPrn:Cmtr2Pix( @nTop, @nBot )
oPrn:Line ( nFil, nCol, nTop, nBot, oPen1 ) //3¦ VERTICAL TOTALES
nFil := 23.40
nCol := 10.95
nTop := 26.20
nBot := 10.95
aCoord1 := oPrn:Cmtr2Pix( @nFil, @nCol )
aCoord2 := oPrn:Cmtr2Pix( @nTop, @nBot )
oPrn:Line ( nFil, nCol, nTop, nBot, oPen1 ) //4¦ VERTICAL TOTALES
nFil := 23.40
nCol := 13.80
nTop := 26.20
nBot := 13.80
aCoord1 := oPrn:Cmtr2Pix( @nFil, @nCol )
aCoord2 := oPrn:Cmtr2Pix( @nTop, @nBot )
oPrn:Line ( nFil, nCol, nTop, nBot, oPen1 ) //5¦ VERTICAL TOTALES
nFil := 23.40
nCol := 16.65
nTop := 26.20
nBot := 16.65
aCoord1 := oPrn:Cmtr2Pix( @nFil, @nCol )
aCoord2 := oPrn:Cmtr2Pix( @nTop, @nBot )
oPrn:Line ( nFil, nCol, nTop, nBot, oPen2 ) //6¦ VERTICAL TOTALES
oPrn:CmSay ( 23.50, 16.95, 'SUMA BASES:', oFont6 )
oPrn:CmSay ( 26.44, 2.40, 'TOTAL IVA:', oFont6 )
oPrn:CmSay ( 26.44, 7.70, 'TOTAL R.E.:', oFont6 )
oPrn:CmSay ( 26.44, 13.35, 'TOTAL FACTURA:', oFont4 )
ENDPAGE
ENDPRINT
oFont1:End()
oFont2:End()
oFont3:End()
oFont4:End()
oFont5:End()
oFont6:End()
oFont7:End()
oFont8:End()
oFontLogo:End()
oPen1:End()
oPen2:End()
Return NIL