Mr. Anser,
I am happy. You are on the right way!
Do you mean that we don't have to install EasyReport on each client machine ? Instead, all the contents of the Folder Distribution (ErStart.Exe, many DLL's etc) and the .vrd file (Report File) should be distributed along with our FWH application
Yes. I have a directory inside my program where the EasyReport files are located and one or more where I have the reports.
You define the report – you can also locate the reports on a net drive. Then all the WS have the same.
EASYREPORT oVRD NAME ".\xVRD\Paketaufkleber.vrd" ;
PREVIEW lPreview TO cPrinter OF oWnd PRINTDIALOG IIF( lPreview, .F., .F. )
and from FWH we can call EasyReport using the following command
ShellExecute( 0, "Open", "ERStart.exe", "-File=.\test.vrd -PREVIEW", NIL, 1 )
no this is all handled automatically.
#include "VRD.CH"
1. define the report
2. define you PRINTAREA’s which is in practice an ARRAY with an ID and the value you want to be print to this ID which you have given in your design.
PRINTAREA 1 OF oVRD ;
ITEMIDS { 101,102,103,104,204,205,206,207,208 } ;
ITEMVALUES { cCompany,cAddr1,cAddr2,cAddr3,cAnrede,cName,cStrasse,cOrt,cLandFeld }
Any idea where should be the Distribution folder copied while we distribute the FWH application ?
In the same folder as your program.
Can we use EasyReport to create reports using the data from MySQL tables ?
Yes.
Here a very easy – but much used report. This prints a client address on a white paper:
- Code: Select all Expand view
function f_paket
local oVRD
local lPreview :=.t.
local cPrinter := GetPvProfString( "DRUCKER","Standard","Standard", ".\INI\WINHOTEL.INI" )
local cCompany := ""
local cAddr1 := ""
local cAddr2 := ""
local cAddr3 := ""
local cAnrede := ""
local cName := ""
local cStrasse := ""
local cOrt := ""
local cLandFeld := ""
cCompany := ALLTRIM(setup->company)
cAddr1 := ALLTRIM(setup->addr1)
cAddr2 := ALLTRIM(setup->addr2)
cAddr3 := ALLTRIM(setup->addr3)
cAnrede := kunden->anrede
cName := ALLTRIM(kunden->name)+" "+ALLTRIM(kunden->vorname)+" "+Trim(kunden->titel)
cStrasse := kunden->strasse
cOrt := ALLTRIM(kunden->plz)+" "+kunden->ort
cLandFeld := f_landfeld(kunden->lkz)
//----------------------------------------------------------------------------//
EASYREPORT oVRD NAME ".\xVRD\Paketaufkleber.vrd" ;
PREVIEW lPreview TO cPrinter OF oWnd PRINTDIALOG IIF( lPreview, .F., .F. )
PRINTAREA 1 OF oVRD ;
ITEMIDS { 101,102,103,104,204,205,206,207,208 } ;
ITEMVALUES { cCompany,cAddr1,cAddr2,cAddr3,cAnrede,cName,cStrasse,cOrt,cLandFeld }
oVRD:End()
RETURN NIL
//----------------------------------------------------------------------------//
Then you define the header for your bodytext.
- Code: Select all Expand view
//Print position header
PRINTAREA 2 OF oVRD
Then you define a PRINTAREA for the data that changes.
You request for example the data in a do while and you print every line like this:
In my case the PRINTAREA3 is defined with a high of 5 mm.
(Order positions)
- Code: Select all Expand view
do while .not. eof()
PRINTAREA 3 OF oVRD ;
ITEMIDS { 101,102,105,106,107 } ;
ITEMVALUES { cMenge, ;
cBezeichnung, ;
cPreis, ;
cWert, ;
cRabatt }
enddo
Here democode for the footer:
- Code: Select all Expand view
//Print order footer
cText1 := "Fortsetzung Seite: " + ALLTRIM(str(nSeite))
cText2 := "Zwischensumme " + ALLTRIM(transform( rgsumm ,"999,999.99")) //text Fortsetzungsblatt
PRINTAREA 9 OF oVRD ;
ITEMIDS { 101, 102 } ;
ITEMVALUES { cText1, cText2 }
Important: you have to take care for the pagebreak - but the code is easy:
IF oVRD:nNextRow > oVRD:nPageBreak
nSeite := nSeite + 1
//Print order footer
cText1 := "Fortsetzung Seite: " + ALLTRIM(str(nSeite))
cText2 := "Zwischensumme " + ALLTRIM(transform( rgsumm ,"999,999.99")) //text Fortsetzungsblatt
PRINTAREA 9 OF oVRD ;
ITEMIDS { 101, 102 } ;
ITEMVALUES { cText1, cText2 }
PAGEBREAK oVRD
//Print position header
cText1 := "Seite: " + ALLTRIM(str(nSeite))
cText2 := "Rechnung-NR: " + cOrderNr
PRINTAREA 6 OF oVRD ;
ITEMIDS { 101, 102,105 ,106} ;
ITEMVALUES { cText1, cText2,"Übertrag:",ALLTRIM(transform( rgsumm ,"999,999.99")) }
PRINTAREA 2 OF oVRD
Best regards,
Otto