// Using: GDIPLUS.
#include "FiveWin.ch"
#define PAD_LEFT 0
#define PAD_RIGHT 1
#define PAD_CENTER 2
FUNCTION BoxRed() // CAIXA REDONDA - BOXROUND.
LOCAL oPrn, oFont, oFont2, oFont3, oPen, oPen1, oPen2, oPen3
LOCAL oBrush, oFondo
LOCAL ResLinha, ResColuna, nLinha, nColuna
LOCAL nLinBox, nColBox, nAltBox, nTamBox, lBorEsq, lBorDir
PRINT oPrn NAME "Ejemplo de caja redondeada" PREVIEW
DEFINE BRUSH oBrush COLOR nRGB(250,213,174) // Bello
DEFINE BRUSH oFondo COLOR CLR_GRAY // HGRAY
// DEFINE PEN oPen WIDTH 2 OF oPrn
DEFINE PEN oPen WIDTH 2 COLOR CLR_CYAN OF oPrn
Define Pen oPen1 Width 25 COLOR nRgb( 192, 192, 192 ) OF oPrn
DEFINE PEN oPen2 WIDTH 2 COLOR CLR_BROWN OF oPrn
DEFINE PEN oPen3 WIDTH 50 COLOR nRgb( 192, 192, 192 ) OF oPrn
DEFINE FONT oFont NAME "Arial" SIZE 0, - 6 BOLD OF oPrn
DEFINE FONT oFont2 NAME "Arial" SIZE 0, - 12 BOLD Underline OF oPrn
DEFINE FONT oFont3 NAME "Arial" SIZE 0, - 18 BOLD OF oPrn
ResLinha := oPrn:nLogPixely() / 2.54
ResColuna := oPrn:nLogPixelx() / 2.54
PAGE
nLinha := 2.25
nColuna := 9.50
nLinBox := 1.60 // Linha que Inicia o Box
nColBox := 5.50 // Coluna que inicia o Box
nAltBox := 3.50 // Altura do Box
nTamBox := 13.60 // Tamanho(Largura) do Box horizontal
lBorEsq := 90 // Bordas arredondadas esquerda.
lBorDir := 90 // Bordas arrendondadas direita.
Box_Round( nLinBox , nColBox , nAltBox, nTamBox, oPrn, lBorEsq, lBorDir, oPen, oFondo )
oPrn:Say( nLinha * ResLinha, nColuna * ResColuna, ;
+ "DESCRIZIONE DOCUMENTO", oFont2,, CLR_BLACK,, PAD_CENTER )
nLinha := nLinha + .80
oPrn:Say( nLinha * ResLinha, nColuna * ResColuna, ;
+ "FiveWin is invincible.", oFont,, CLR_BLACK,, PAD_CENTER )
ENDPAGE
ENDPRINT
oBrush:End()
oFondo:End()
oPen:End()
oPen:release()
RETURN nil
FUNCTION Box_Round( nArriba, nIzq, nAbajo, nDerecha, oPrn, a, b, oPen, oBrush )
LOCAL hOldPen, xCor := {} , yCor := {}
LOCAL hOldBrush
// Pasamos coordenadas de cms a pixel
xCor := oPrn:Cmtr2Pix(nArriba,nIzq)
yCor := oPrn:Cmtr2Pix(nAbajo,nDerecha)
// Guardamos el Lapiz y la brocha que teniamos
hOldPen := SelectObject( oPrn:hDcOut, oPen:hPen )
hOldBrush := SelectObject( oPrn:hDcOut, oBrush:hBrush )
//Dibujamos el rectangulo redondeado
roundrect(oPrn:hdcOut,xCor[2],xCor[1],yCor[2],yCor[1],a,b)
// y seleccionamos el que habiamos guardado
selectObject( oPrn:hDcOut, hOldPen )
selectObject( oPrn:hDcOut, hOldBrush )
RETURN NIL
#IFDEF __HARBOUR__
DLL FUNCTION RoundRect( hDC AS LONG, ;
iLeft AS _INT , iTop AS _INT, ;
iRight AS _INT, iBottom AS _INT, ;
iWidth AS _INT, iHeight AS _INT ) AS BOOL PASCAL LIB "GDI32.DLL"
#ELSE
DLL FUNCTION RoundRect( hDC AS WORD, ;
iLeft AS _INT , iTop AS _INT, ;
iRight AS _INT, iBottom AS _INT, ;
iWidth AS _INT, iHeight AS _INT ) AS BOOL PASCAL LIB "GDI.EXE"
#ENDIF
TimStone wrote:Silvio,
I am sorry to be confused. All of my printouts are stored in .prg files. The content is all variables which are filled from the data. For example, an Invoice has a company name at the top ( either in text or a bitmap ), then two boxes for invoice data, side by side, multi line, and two more boxes for customer and vehicle data. These are grey boxes with borders. Then it lists parts in the next section, all properly formatted, and then labor, and then recommendations. Totals come next in a box that is has a white background, and finally the "fine print" plus any advertising info. These can be black and white, or color.
The whole invoice is a .prg file. It is the "template". Some labels are printed every time, but all data is stored at variables. Those variables are set before the print commences, or drawn fromt the .dbf fields as the printing progresses.
It might be like the report capability in FWH except it is all customized using the printer class, and far more can be done with decision trees to control the actual content and output.
I think this is pretty standard using the class. With that in mind, I'm afraid I don't really understand how this differs from what you want. In my example, the user inputs all the data into a workorder which he interacts with on the screen. To print an invoice ( or other document ) he simply presses a single button and the system selects the data from the current files which match that workorder, applies the proper formatting, and prints the invoice ( all with a single press ), or displays it in preview mode if preferred.
Tim
nageswaragunupudi wrote:
- Code: Select all Expand view RUN
function PrnBox()
local oPrn, oFont, oBrush
DEFINE BRUSH oBrush FILE "c:\fwh\bitmaps\backgrnd\pebbles.bmp"
PRINT oPrn PREVIEW
DEFINE FONT oFont NAME "VERDANA" SIZE 0,-30 OF oPrn BOLD
PAGE
oPrn:RoundBox( 1, 1, 5, 5, .5, .5, { CLR_HRED, 3 }, oBrush, ;
{ "FIRST" + CRLF + "SECOND", oFont, CLR_WHITE, "B" }, ;
"INCHES" )
@ 1,1 PRINT TO oPrn TEXT "HOLLOW TEXT" SIZE 4, 4 INCHES FONT oFont ;
COLOR CLR_YELLOW OUTLINE CLR_HRED SIZE 3 ALIGN "T"
ENDPAGE
ENDPRINT
RELEASE FONT oFont
RELEASE BRUSH oBrush
return nil
#include"fivewin.ch"
function PrnBox()
local oPrn, oFont, oFont2
local aDat
PRINT oPrn PREVIEW
DEFINE FONT oFont NAME "VERDANA" SIZE 0,-6 OF oPrn BOLD
DEFINE FONT oFont2 NAME "VERDANA" SIZE 0,-12 OF oPrn BOLD
PAGE
// x , y, nWidth,nHeight
aDat:= {;
{1,5.5,4.5,0.8,"Tipo Documento" },;
{5.5,5.5,2.5,0.8,"Numero Documento" },;
{8,5.5,2.5,0.8,"Data Documento" },;
}
For n= 1 to 3
X:= aDat[n][1]
Y:= aDat[n][2]
nWid:= aDat[n][3]
nHei:= aDat[n][4]
oPrn:Box( x, y,nHei,nWid, { CLR_BLACK, 1 }, CLR_HGRAY, ;
{ aDat[n][5], oFont, CLR_WHITE, "TL" }, ;
"CM" )
next
ENDPAGE
ENDPRINT
RELEASE FONT oFont
RELEASE FONT oFont2
return nil
function PrnBox()
local oPrn, oFont, oFont2
PRINT oPrn PREVIEW
DEFINE FONT oFont NAME "VERDANA" SIZE 0,-6 OF oPrn BOLD
DEFINE FONT oFont2 NAME "VERDANA" SIZE 0,-10 OF oPrn BOLD
PAGE
oPrn:Box(7.50,1,6.6,7.5, { CLR_BLACK, 1 }, CLR_HGRAY, ;
{ "TIPO DOCUMENTO", oFont, CLR_WHITE, "TL" }, ;
"CM" )
oPrn:Box(7.50,7.6,6.6,10.5, { CLR_BLACK, 1 }, CLR_HGRAY, ;
{ "NUMERO DOCUMENTO", oFont, CLR_WHITE, "TR" }, ;
"CM" )
oPrn:Box(7.50,10.6,6.6,14.5, { CLR_BLACK, 1 }, CLR_HGRAY, ;
{ "DATA DOCUMENTO", oFont, CLR_WHITE, "B" }, ;
"CM" )
//FIELD
@ 3.50,1 PRINT TO oPrn TEXT "DESCRIZIONE DOCUMENTO" SIZE 6, 4 CM FONT oFont2 ;
COLOR CLR_BLACK ALIGN "BR"
@ 3.50,5.8 PRINT TO oPrn TEXT "NUMERO" SIZE 4, 4 CM FONT oFont2 ;
COLOR CLR_BLACK ALIGN "BR"
@ 3.50,9.8 PRINT TO oPrn TEXT "DATA" SIZE 4, 4 CM FONT oFont2 ;
COLOR CLR_BLACK ALIGN "BR"
ENDPAGE
ENDPRINT
RELEASE FONT oFont
RELEASE FONT oFont2
return nil
#include"fivewin.ch"
function PrnBox()
local oPrn, oFont, oFont2
local aDat
local nRow,nCol,nHei,nWid
PRINT oPrn PREVIEW
DEFINE FONT oFont NAME "VERDANA" SIZE 0,-6 OF oPrn BOLD
DEFINE FONT oFont2 NAME "VERDANA" SIZE 0,-10 OF oPrn BOLD
PAGE
nRow:= 7.50
nCol:= 1
nHei:= nRow+0.8
nWid:= 7.5
oPrn:Box(nRow,nCol,nHei,nWid, { CLR_BLACK, 1 }, CLR_HGRAY, ;
{ "TIPO DOCUMENTO", oFont, CLR_WHITE, "TL" }, ;
"CM" )
nRow:= 7.50
nCol:= 7.7
nHei:= nRow+0.8
nWid:= 11.5
oPrn:Box(nRow,nCol,nHei,nWid, { CLR_BLACK, 1 }, CLR_HGRAY, ;
{ "NUMERO DOCUMENTO", oFont, CLR_WHITE, "TL" }, ;
"CM" )
nRow:= 7.50
nCol:= 11.7
nHei:= nRow+0.8
nWid:= 15.5
oPrn:Box(nRow,nCol,nHei,nWid, { CLR_BLACK, 1 }, CLR_HGRAY, ;
{ "DATA DOCUMENTO", oFont, CLR_WHITE, "TL" }, ;
"CM" )
nRow:= 4.30
//FIELD
@ nRow,1 PRINT TO oPrn TEXT "DESCRIZIONE DOCUMENTO" SIZE 6, 4 CM FONT oFont2 ;
COLOR CLR_BLACK ALIGN "BR"
@ nRow,5.8 PRINT TO oPrn TEXT "NUMERO" SIZE 4, 4 CM FONT oFont2 ;
COLOR CLR_BLACK ALIGN "BR"
@ nRow,9.8 PRINT TO oPrn TEXT "DATA" SIZE 4, 4 CM FONT oFont2 ;
COLOR CLR_BLACK ALIGN "BR"
ENDPAGE
ENDPRINT
RELEASE FONT oFont
RELEASE FONT oFont2
return nil
Otto wrote:Hello Silvio,
You can try with EasyReport.
Best regards,
Otto
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 41 guests