1 (edited by apmuthu 01/09/2015 07:41:31 am)

Topic: Reports Tutorial Discussion

This is a prelude to fleshing out a Wiki page on DIY FA Reports - Innards and Construction and to address a request from @mkisekka:

....
I am a php newbie but generally understand programming concepts and work with oracle databases.
I have a task to customize some FA reports, such as the cash flow statement, profit and loss statement - adding some rows, changing layout and the like.

I was wondering what general advice you would give to someone starting out - in terms of understanding report structure and/or using Repgenerator.
I've installed FA and tinkered abit with some code but so far its only hacking and I might need a more structured approach. E.g. say I took rep707.php and wanted to understand how the report is structured, should I study line by line or?
....

The following notes are to act as a general guide for code and layout information:

1. The reporting/includes/header2.inc file contains elements of the top portion of any standard report.
2. The reporting/includes/doctext.inc obtains all the variables needed for the reports
3. The actual reporting/repXXX.php file contains the body of the report where line items are listed.
4. The reporting/includes/pdf_report.inc has the FA reporting classes and common includes
5. The reporting/reports_main.php file has the form elements that tailor the report (filter choices)
6. The reporting/includes/reporting.inc file has the code for Non Field DB Data where many key#value pairs delimited by # and space separated are placed in some large text field and parsed out on demand. This needs to be backported for v2.3 or taken from my GitHub's FAMods folder.

The first 3 above can also act as company overrides by placing them in the appropriate company/#/ folder.

Examples are in my GitHub FAMods folder.

The RegGen extension was hacked in to work in a rudimentary manner and was made for a much earlier version of FA. It is not very secure and can at best be used for development purposes in a trusted secure environment.

Hitherto, FA users who have successfully built reports have not significantly shared their work and hence it is in a state of relative freeze at present. With the knowledge of DIY reports becoming common, this situation will hopefully reverse itself into competing betterment and result in wider FA adoption.

Re: Reports Tutorial Discussion

First off, thanks apmuthu for opening the post and the general report information.

Some background:
I currently have a task for a supermarket chain (2 locations and growing) to modify the cash flow statement to look more like the Profit and Loss statement - with field names changed (income => cash inflow, costs => cash outflow...and the like). I also need to add banking into cash outflow to track transfers from cash account to any bank account.

So far, I've taken rep707.php and replaced the cash flow statement module (rep_cash_flow_statement.php), altered the menu in reports_custom.php as needed. So far so good - I've changed the fields and added banking from cash account.

We are using Dimension1 for the different locations as we intend to use one FA database that can be synced. The cash flow statement menu has start-date, end-date and dimension1 as parameters for the report.

Current challenge:
How to add dimension1 field to "Bank Account Transfers" screen (under Banking and General Ledger)? Having the dimension1 field would allow transfers to be made with the location selected. Therefore the cash flow report would reflect this.

Re: Reports Tutorial Discussion

It will be easy if you forked a Git (either the official one for the core alone or mine for both the core and the extensions and my mods) and then began developing so that others can study the code and assist you and possibly include it in the core if found useful to many.

The gl/bank_transfer.php file has a function gl_payment_controls() that populates the form you refer to (Banking and GL => Bank Account Transfers). Refer how the dimensions are populated in some other forms you wish to emulate.

Re: Reports Tutorial Discussion

Hi!
I would like to modify the invoice statement so that the address "Charge To" fits a window envelope. The window is 100 x 35 mm, is positioned about 104 mm from the left edge, and is placed about 36 mm from the top edge. Of course, I have to adapt other fields accordingly.
How can I accomplish this in the easiest way?

Re: Reports Tutorial Discussion

The file reporting/rep107.php outputs the Invoice in FA.

The variable $cols shows the start of each field in mm. for the item list lines in the body of the invoice.
The variable $aligns sets the alignments for the above fields.

As the Header2 template is used in this report, check out the lines for address1 (154-157) and address2 (160-163) in reporting/includes/header2.inc which represent the "Charge To" and "Delivered To" addresses.