My goal in programming the WPCubed Multi-Demo was to show how the various WP products can be combined in an advantageous manner, thus allowing the programmer to quickly create an impressive reporting and text-generating application that is easily understood by the end user. This combination makes many solutions possible that are not usually found in other products*. The WP product family includes WPTools – a text editor and word processor, wPDF – a tool for generating PDFs and WPViewPDF – a viewing component that also is a tool to manipulate the PDF data generated. All of these are very powerful components and can be used to build attractive and versatile applications. Combined with the fourth member of the WP product family, WPReporter, the developer can add programmed controlled text generation, to produce complicated contracts and multi-tiered invoices or reports.
Standard mini-demos are not capable of demonstrating how well each WPCubed component works when combined with its siblings. For that reason I decided to dedicate my time to developing a demo application which can actually be used and demonstrates in details the various facets of the tools. This multi-demo – WPCubed Calculus is the core of a customer management application with the ability to write invoices which are created as PDFs and consequently saved to database in this form. It only uses a minimum set of database tables and database fields to demonstrate how the components can work together.
Starting in 2015 purchases from all EU countries must be taxed at the local VAT rate. I.e. a customer from Ireland, purchasing a WPCubed product in Germany must pay the Irish rate for VAT, which is currently 21%, as opposed to the 19% in Germany. This is automatically done in the multi-demo WPCubed Calculus.
The program manages EU countries and their corresponding VAT rates. In this case it is possible to select a country for each customer and, when creating any invoice, the correct VAT is automatically used. As you know, VAT rates change often. In order to solve this problem the individual countries are stored with their corresponding VAT rate in a database and this rate is copied to the order record set at the time the invoice is created. The templates for the invoices and lists are also stored in the database, thus allowing customization at runtime.
The application was developed with Delphi XE7 and SQLight with FireDAC.
I will describe the creation of the WPCubed Calculus application in this BLOG in various steps. First the anticipated program logic is shown, then a database module is created. Subsequently the WPCubed component specific programming starts and the use of EditFields, mail merge and reporting is demonstrated.
Later PDF printing with wPDF will be added, including the possibility of saving the printout as a PDF to a database and displaying it later using WPViewPDF.
The application uses parameters lists for easy customization. For example adding a new list type does require not more than adding a record to a constant array. But dealing with SQL specialties was not within the scope of this project. So the use of SQL logic is quite easy. For example the reporting logic could be easily converted to any other data base logic or does not need to use a database at all.
Next: Application Architecture