Looking at the Details for an Invoicing Application in Delphi
In the previous article we discussed the requirements and purpose of the invoicing application that we are creating. We also listed the main application code. In this part of the article we are going to look at how to connect the database that we created earlier to the application code. We will also look at some of the code in detail.
The invoice application works by storing and retrieving its information in the database that we created earlier. When the application is first started, it loads certain application-specific settings from an ini file. See the code below:
The code shows the oncreate event of the first form in the application. This code loads the following information:
con – This string contains the path to the database and will be used throughout the application to connect to the database tables.
vat - This is the VAT rate that the application will use when it calculates the totals.
rav – This variable stores the path to the rave report file that contains the output designs of the invoice.
This method of storing and retrieving data increases the application’s portability. You can change these values in the ini file by clicking on the settings menu item, which will bring up a window for you to set new values. The next page has a screen shot of what that form looks like and also the code listing for the settings unit.