Invoice Generator

Demo

Introduction

I built my first desktop application for a friend who is an insurance agent. The application generates invoice in pdf format and keep track of all the invoices generated, allowing users to modify or delete them however they like. I opted to use Windows Forms for this project instead of WPF due to better design-time experience in Visual Studio for WinForms. I also do not need any flashy UI provided by WPF. You can download the installer from the demo button above.

Image
Inno Setup

The installer is compiled with Inno Setup, a free installer script for windows programs that you can write with pascal.

I love Inno Setup for its capabilities, it can create the necessary folders and put in the files needed during installation, deal with registry keys, and handle complex procedures.

Image
FreeSpire.Doc

I decided to use FreeSpire NuGet package to generate/edit word document and pdf document. FreeSpire does not work like JasperReport, which allows you to design the format inside itself. For FreeSpire, I had to create a template word document, and put in text box with hidden text key. I then pass in the data given by user to replace those hidden text key, and convert the word document to pdf format.

Storing data

The invoice data is stored in a file named "data.dat" in JSON format, and the word and pdf documents generated are also kept in separate folders.

As you can see in the screen shots, the application also calculates GST for you, and launch the created invoice in pdf format upon clicking create invoice.

Image
Software Update, Settings

After several bug fixes and features changes, I got tired of having to pass the new release installer everytime, so I added the update feature. By putting the latest release on my server, user just need to click "File->Update" to download and run the latest installer.

There are also features such as filters for the list, and change settings such as GST in case they are required in the future.

Summary

While developing this project, I took great care to maintain a good code base. Proper error logging has saved me so much time tracking down reported bugs. Any changes or extra features requested can be easily implemented without being a pain thanks to the good code structure.

I suspect however this will be difficult in professional work environment where time frame is always short-changed, resulting in huge technical debt overtime.