Skip links

Forum for developers and users

Customizable ERP software as an open license for FileMaker developers

New module for printing...
 
Notifications
Clear all

Add a new module to the printing system


Markus Schall
member Admin
Joined: 14 years ago
Posts: 95
Topic starter  

Moin Moin,

In the following, I will explain how to add a newly developed module to the printing system so that print layouts can be created for the new module in the file "gFM_Printlayouts". Once the following steps have been carried out, a normal print dialog and any number of print layouts can be added for your new module.

To add a new module to the printing system, extensions are required in the files "gFM_Business" and "gFM_Printlayouts".

Print dialog of the gFM-Business print system

Extensions in the "gFM_Business" file

In my explanation, I assume that there are already relationships for the new module that can be used. As an example for the new relationship of your new module, I will simply use the relationship "Customers" in this article. In the "gFM-Business" file, the variable $multiline can be extended to include a partial calculation for your new relationship.

Insert the following sub-calculation into all definitions of the variable $multiline according to the following pattern, replacing "customer" with the relationship of your new module:

$modul = "Customers" AND $toc = "Customers";
   If($data records = "All accessed data records";
      SetVar(
      [

        $$sumText = "";
        vResult = cfSumTextEx ( Customer::_pk_Customer_ID; Get ( NumberOfRecordsFound ) )
      ]; $$sumText );
   Customer::_pk_Customer_ID
);

Expand all definitions of the variable $multiline, which you can find in the script "lay.print dialog" in version 6.0.3 in lines 15, 28, 49 and 217. In the "ts.print dialog" script, this variable is only defined once in line 29.

Create a new layout for the print dialog by duplicating an existing layout of a print dialog and setting the "Show records from" field in the FileMaker "Layout settings" dialog to the table of your new module.

Attention! The table of your new module must be linked to the "prf" table via a global key field such as "sGlobal". 

Extensions in the "gFM_Print layouts" file

Several changes must be made in the "gFM_Printlayouts" file: 

  1. Create a new foreign key for your new table (e.g. _fk_Customer_ID) in the "Print file" table.
  2. Create a new table appearance for your new table. Connect the new foreign key from table "Print file" with the primary key of your new table
  3. If required, create additional relationships if you also want to display data from linked tables for your new table on your print layout

With the above steps you have created your new table in the file "gFM_Drucklayouts" with all the desired relationships. In the last step, your new TOC (your new table) must now be inserted into the scripts of the printing system. A total of three scripts must be extended, whereby the extensions are identical in each case.

Make all the following changes in the "ts.Print", "ts.Create_PDF" and "ts.Create_Preview" scripts:

1. add a new subscript in the "Create new data record in the print system" area from line 72. Duplicate an existing partial script and change the TOC in each case from, e.g. "Customers" to the relationship name of your new table.

If [ PatternNumber($TOC; "Customers") > 0 ] 
   Set field value [ Print file::_fk_Customer_ID ; $Multiline ] 
   Set variable [ $TOC ; Value: "Customers" ] 
End (if)
 

2. add a new partial script in the "Call print layout via 'GoToRelatedRecord'" area from line 221. Duplicate an existing partial script and change the TOC in each case from, e.g. "Customers" to the relationship name of your new table.

 
If [ $TOC = "Customers" ] 
   Go to related data record [ Show only related data records ; From table: "Customers" ; With layout: $Layout ] 
   If [ NOT IsEmpty($ sort field) ] 
      Execute script [ Specified: From list ; "ts.sort_customers" ; Parameters: $Sort field & "|" & $Sort order & "|" ]
   End (if)
End (if)
 
3. only if you have added a new document type as a new module in the "Billing" module, you must also duplicate the sub-scripts below in the "Print output" sub-script and then also extend the queries If($TOC = "Quotation items..." etc.) accordingly. The best way to do this is to enter the name of a TOC, e.g. "Offer items", in the MBS search field at the top of the script workspace, duplicate the respective script sections and adapt them or extend calculations in queries accordingly.
 
The programming is now complete. A new print layout with the new table appearance can now be added and this can be created and assigned in the "Print layouts" table.
This topic was modified 4 years ago 3 times by Markus Schall

Greetings from Kirchhatten
Markus Schall
gofilemaker.com - MSITS


Quote

CRM, merchandise management and billing customizable with FileMaker Pro

Share:

The forum for the Claris FileMaker-based gFM-Business ERP software with CRM, merchandise management system and invoicing for Apple Mac, PC and iOS. It serves the exchange between users, developers and gofilemaker.de. The forum boards are divided into overarching topics and modules such as customer management, merchandise management or invoicing. Anyone interested is welcome to actively participate in the forum.

You are here: Add new module to printing system - Main Forum - Support Forum for gFM Business ERP Software and Claris FileMaker