In the previous article Reporting with HMG : Part I, I had shown you how easy it was to code a report using HMG's DO REPORT command.
But what should you do if you have the need to customise your standard application reports for different customers and yet maintain only one executable ?
In this respect, HMG allows you to define and even edit a report format using any text editor (including Notepad) and then print within your Harbour+HMG application without recompiling.
Here is how to achieve the above :-
#include 'minigui.ch'
procedure main()
//
define window MainForm ;
at 0,0 ;
width 100;
height 100 ;
title 'FAS4HMG' ;
main
DEFINE MAIN MENU
POPUP 'File'
ITEM 'Print GL Chart of Accounts ' ACTION PrintExternalGlChart()
END POPUP
END MENU
end window
//
activate window MainForm
Return Nil
function PrintExternalGlChart()
cClient:='Clipper... Clipper... Clipper'
use GLAC
index on glcode to printexternalglchart
go top
DO REPORT FORM GlChart
use
return
GlChart.rpt
DEFINE REPORT TEMPLATE
TITLE 'GL Chart of Accounts|' + cClient
HEADERS {'',' ',' ',' '} , {'GL CODE','GL NAME','GL GROUP','GL TYPE'}
FIELDS {'glcode','glname','glgroup','gltype'}
WIDTHS {10,40,20,10}
TOTALS {.F.,.F.,.F.,.F.}
NFORMATS { , , ,}
WORKAREA glac
LPP 50
CPL 80
LMARGIN 4
PREVIEW
SELECT
IMAGE {'client.jpg', 0,1,1,1 }
GROUPED BY 'GLGROUP'
HEADRGRP 'GL Group:'
END REPORT
More to come..
Hello,
ReplyDeleteThere is a utility called Grid2Print, developed by S. Rathinagiri. Please test it and write about it.
Regards.
Sudip
Hello,
ReplyDeleteThere is a utility called Grid2Print, developed by S. Rathinagiri. Please test it and write about it.
Regards.
Sudip
Hello CCH,
ReplyDeleteThanks a lot :)
IMHO, DO REPORT command cannot be customized to much. (Like all the 'POWER PACKED' commands, e.g., EDIT EXTENDED).
For a real life report original xbase like code is more helpful.
With best regards.
Sudip