Clipper Report Class

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
Anand
Posts: 103
Joined: Tue May 24, 2016 4:36 pm
DBs Used: DBF
Has thanked: 11 times
Been thanked: 21 times

Clipper Report Class

Post by Anand » Sun Feb 26, 2017 5:09 pm

Long, long years ago, I developed programs in Clipper.
The Clipper book by Rick Spence helped me a lot in understanding Class Inheritance, Detached Block etc.
I found the website The Oasis by Phil Barnett that had thousands if not millions of Clipper programs source codes ranging from simple date calculation to full fledged application. I learnt lot of different technique from the source codes from this site. I think many programmers here will recognize the above.

The Oasis website gave me source of CLass(y) by Anton van Straaten, after it became freeware, and many programs which used Class(y). One of them was Report Class by Jon Credit. It is pure Clipper code using Class(y) to generate tabular reports. The plus point of this class was to have the report columns defined by their width only. Column positions was auto calculated. It is some what similar to GridPrint by Rathinagiri Sir.

After I found Harbour and HMG, I learnt a lot, from the given samples, to make old Clipper codes useful again in Windows 32 bit environment. I wandered through the old forgotten Clipper codes and I stumbled on Report Class.

First I tried to compile it in Harbour and found that just by changing "Class(y)" to "hbclass.ch" it compiled and ran successfully in DOS (CMD) window.

I felt the thirst. I wanted to use this Report Class in a way that output can be Text (which it already does), PDF, HTML and XLS. Also I could have it in HMG Preview.

I want to upload the original Report Class here so that other members check it out. And also to upload my changes, after completion, for HMG so that others can also use it and make it more useful.

Now it is OK to upload it as samples for HMG ? The original Clipper code is by Jon Credit and I have made changes for HMG.
Is this correct thread of the Forum to post ?
One more query. Between MiniPrint and HbPrint, I prefer HbPrint (or WinPrint) as it already have +/- keys for zoom in preview, otherwise I found both nearly same in output. I found that there are replies on winprint in the forum but the HMG installation do not have WinPrint.ch file, whereas the MiniGui_Extended had the samples on it.
So I compiled my changes in MiniGUI_EX. Will it be problem to upload the same here at HMG ?
Please advise.

Regards,

Anand
Image

User avatar
Rathinagiri
Posts: 5039
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 76 times
Been thanked: 88 times
Contact:

Post by Rathinagiri » Sun Feb 26, 2017 5:53 pm

Anand,

Half of your story looks like mine. :) As you have said, it might be for many.

In HMG we don't have MiniPrint or HbPrint.

IMHO, you can share whatever way you want. For me, if you share the code, it might be very much useful.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.


User avatar
serge_girard
Posts: 1542
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Has thanked: 154 times
Been thanked: 23 times
Contact:

Post by serge_girard » Sun Feb 26, 2017 8:52 pm

Thanks, Anand !

Familiar story of old Clipper-days !

Serge

User avatar
bpd2000
Posts: 893
Joined: Sat Sep 10, 2011 4:07 am
Location: India
Has thanked: 65 times
Been thanked: 12 times

Post by bpd2000 » Mon Feb 27, 2017 4:56 am

+1
BPD
HMG Convert Dream into Reality

User avatar
esgici
Posts: 4253
Joined: Wed Jul 30, 2008 9:17 pm
Location: iskenderun / Turkiye
Has thanked: 132 times
Been thanked: 42 times
Contact:

Post by esgici » Mon Feb 27, 2017 1:47 pm

...
In HMG we don't have MiniPrint ...
...
:?:
Viva INTERNATIONAL HMG :D

User avatar
Anand
Posts: 103
Joined: Tue May 24, 2016 4:36 pm
DBs Used: DBF
Has thanked: 11 times
Been thanked: 21 times

Post by Anand » Mon Feb 27, 2017 6:21 pm

Thanks for the advise :)

I will post the original source of Report Class and also the changed source for HMG. I am still working on it.

Regards,

Anand
Image

User avatar
Rathinagiri
Posts: 5039
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 76 times
Been thanked: 88 times
Contact:

Post by Rathinagiri » Mon Feb 27, 2017 6:26 pm

esgici wrote:
Mon Feb 27, 2017 1:47 pm
...
In HMG we don't have MiniPrint ...
...
:?:
It is not in that name, I mean.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.

User avatar
Anand
Posts: 103
Joined: Tue May 24, 2016 4:36 pm
DBs Used: DBF
Has thanked: 11 times
Been thanked: 21 times

Post by Anand » Fri Mar 10, 2017 5:06 pm

What I liked about the report class is the beauty of auto calculating column positions based on their widths.
One can also swap columns easily in the code. So was wondering to convert in HMG.

I studied the codes and found that the output was done by two functions only, namely, DEVPOS() and DEVOUT or DEVOUTPICT(). So I planned to make these functions such that they will give required different output, i.e. Text, Xls, Html etc. and also HMG Preview.

I created new functions gDEVPOST(), gDEVOUT() etc. and redirected the Report class to them. That's all.

The original report class does all the processing and the output comes as required.

Since I do not get enough time due to my project work pressure, I found that this enhancement for HMG was getting delayed. So I thought to upload it in the Forum and let other members to see and comment. I am sure you will find many better way to accomplish what I have envisioned and I will be happy to see this report class to become more useful by the members contribution.

I will suggest to first check the original code in Harbour. By changing "class(y).ch" to "hbclass.ch" it will compile fine and give the required output text file.

Now check my code enhancement, specially gdevposout.prg, which has all different output re-directions.

There are still issues with header printing and PDF run throwing error, though output is perfect.

Output to XML and CSV is still not done. I will try to complete them in meantime. And yes, this one compiles under MiniGUI , as I could not fix the errors generated in HMG compile, so HMG compile will also need to be done.

Attached files are:
REPOBJ.ZIP = The original report class in Clipper by Jon Credit, downloaded from The Oasis of Phil Barnett.
Report_Class1.zip = The added enhancement for HMG with extra codes.
images = of different output from the same report code.

sample part of the code is as below, for creating the report. Please note that THIS IS the original code of Clipper given as sample by Jon Credit and still useful in HMG for different output.

Code: Select all

	gDevice(cDevice, lProportionate)

	oCol1 := repColumn():new("THIS IS;THE NAME", fieldwblock("NAME", select( "MASTER" ) ), .T. , 13    , NIL )
	oCol2 := repColumn():new("THIS IS;THE;ADDRESS", fieldwblock("ADDRESS", select( "MASTER" ) ), .T. , 10    , "@!" )
	oCol3 := repColumn():new("THIS;IS;THE;CITY", fieldwblock("CITY", select( "MASTER" ) ), .T.  , 10   , "@!" )
<snip>
	oCol1:cColumnTrim := "L"                      // LTRIM()
	oCol2:cColumnTrim := "R"                      // RTRIM()
	oCol3:cColumnTrim := "R"                      // RTRIM()
<snip>

	oReport := report():new( {|oRepOBj| MyHeader( oRepObj ) },  {|oRepObj| MyFooter( oRepObj ) }, NIL )

	oReport:addColumn( oCol1 )
	oReport:addColumn( oCol2 )
	oReport:addColumn( oCol3 )
<snip>

	oReport:cWorkArea := "MASTER"

	oReport:exec()
Regards,

Anand
Attachments
hbprintp2.png
hbprintp2.png (18.05 KiB) Viewed 248 times
hbprint1.png
hbprint1.png (17.02 KiB) Viewed 248 times
xls1.png
xls1.png (22.31 KiB) Viewed 248 times
html1.png
html1.png (24.37 KiB) Viewed 248 times
pdf1.png
pdf1.png (75.91 KiB) Viewed 248 times
test1.png
test1.png (18.34 KiB) Viewed 248 times
repoclass.png
repoclass.png (214.46 KiB) Viewed 248 times
Report_Class1.zip
(13.34 KiB) Downloaded 42 times
REPOBJ.ZIP
(18.09 KiB) Downloaded 35 times
Image

EduardoLuis
Posts: 474
Joined: Tue Jun 04, 2013 6:33 pm
Location: Argentina
Been thanked: 20 times

Post by EduardoLuis » Fri Mar 10, 2017 8:21 pm

Hi Anand:

Thanks for your knowledge and thanks for share with us.-
Very usefull.- I'll test it next saturday.-
Thanks, again.
Eduardo

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest