[fpc-pascal] Developing a mini ERP / web based development

Jean SUZINEAU Jean.Suzineau at wanadoo.fr
Wed Jul 24 16:16:18 CEST 2019


I have a big bunch of freepascal code under lgpl, with little 
documentation and a lot of identifiers in French, I hesitated a long 
time before sending this message,  ;-) , but may be it could be useful 
for you.
 From 2002 to 2017 I've been developing functionalities for printing 
documents in an ERP for the building industry. The code was first 
written in Delphi 7 and around 2011 I proposed to my boss to translate 
the code to freepascal for free and in exchange move under LGPL the code 
that is not specific to the ERP (the main part of the ERP is written 
under 4js Genero https://4js.com/ with servers running linux most of the 
It's mainly an ORM, lines of database tables are read through a TDataset 
and placed in objects. You get an object for each line of table. And 
I've written the equivalent components of data controls such as TDBEdit 
that connect directly to this line  object (TChamp_Edit from unit 
ucChamp_Edit, package OD_DelphiReportEngine_Controls in that case).
For printing, after using QuickReport, Rave Reports in Delphi, I choosed 
around 2004 to write my own reporting engine to generate Open Office 
documents. The first versions were using OpenOffice through COM bridge, 
but current version generates directly OpenDocument odt files from 
template ott files.
I use the same design pattern for each database table involved, so very 
quickly I wrote a source code generator based on templates, at first as 
plugin for ModelMaker under Delphi, then moved to plugin for Star UML, 
and currently it's a standalone program which uses a TDataset to get the 
list of fields of a database table and the type of each field. Most of 
the time I use it to generate pascal files for my ORM, but you can 
generate whatever kind of file you need (SQL, C#, PHP, Angular...) for 
your own design pattern.

For the user interface, at first it was a classic Windows program using 
Delphi forms running on the client computer, but around 2014 I needed to 
move my code to the server in web development paradigm. I'm dreaming of 
a Lazarus able to compile forms to webasm.
For now I use Google Angular ( https://angular.io/ ), the typescript 
language it's based upon has been cocreated by Anders Hejlsberg, father 
of Turbo Pascal and Delphi.
Currently I scratch my head, deep meditation, to write for pas2js the 
equivalent of my TChamp_xxx components, using Pas2JS_Widget from 
heliosroots. It shoudn't be too much complicated.

My repository is at :
the most current code is on branch TjsDataContexte (I keep the master 
branch for compatibility with the ERP, a slightly older code).
Most recent release of the code generator:
corresponding source code in 

My unit testing project is in subdirectory fpcunit/fuPASCAL_O_R_MAPPING, 
mainly used to test OpenDocument generation.
My main example is the project jsWorks in subdirectory jsWorks. I use it 
to record and log my working sessions, it serves as a basis for billing 
my hours of work.
It's a desktop application that I compile and use under linux and 
Windows. It's also accessible from a browser through http with a small 
frontend coded in Angular (button Http on the main form of the desktop 
application). The biggest part of the frontend is a skeleton created by 
the code generator, with a small customized part to test html input with 
TinyMCE (a few html tags can be translated into OpenDocument stuff).
The most recent release of jsWorks:

More information about the fpc-pascal mailing list