The End-Of-Financial-Year is usually a very busy time for me and this year was no exception. I generally spend my time assisting clients to snapshot their financial data and prepare for the new fiscal period. This year, however, proved to be really challenging.
On top of the usual EOY jobs I had two clients who needed a few extras and they wanted them by July 1. I had 21 days to develop these solutions and sleep wasn’t to be an option.
The first client had received notification from the ATO (Australian Tax Office) regarding a new Excise that was to be charged on certain products from the 1st of July onward. They were in a panic as this new excise was to be accounted for per litre before GST and they had no way to do it.
The second client wanted to streamline the generation and delivery of customer statements. Statements had always been printed and then either posted or manually faxed to the relevant recipient. What the client wanted was for these documents to be routed directly via either e-mail or fax with the option to print them if needed.
Challenge #1 – Excise and GST.
This was to be the most invasive set of changes I’ve had to make to my old DOS based accounting system since the introduction of GST. This new excise had to be calculated to 5 decimal places and to further complicate the issue certain products containing a percentage of excisable product also needed to be catered for. If this wasn’t bad enough the excise was to be added to the price of goods prior to GST.
After several discussions with the client I set down to work. These changes affected stock control, invoicing, debtors, sales orders, creditors, supplier orders, the general ledger and all transaction and history sub systems. End of Month processes were also affected. By far the simplest part was adding an excise rate and excisable percentage fields to the stock record. Making sure there were no rounding errors was a real headache.
The finished product went in on the 28th of June for testing. A few small adjustments were made here and there over the next couple of days and the project looks like it is working as required.
The only difficulty remaining is solely on the shoulders of the client. The excise has to be remitted to the ATO within 7 days of supplying the goods. The clients average trading terms are 30 to 45 days. The challenge they face is purely cash-flow related. I wish them well.
Challenge #2 – Generate and route PDF documents.
Allan from Office Choice wanted to be able to e-mail or fax customer statements at the end of the month as this would save time and money.
Firstly I had to find a way to produce PDF documents from my DOS based accounting system. Secondly I needed to be able to send them to either an e-mail address, a fax number or to the printer. Allan wanted the system to make the appropriate choice based on certain criteria and also needed to be able to override the destination if and when necessary.
The original statements were written specifically for a HP LaserJet printer which meant they were not easily converted to PDF let alone routed anywhere other than to a printer. I also couldn’t create PDF’s directly from within Equity.
To solve the problem I created a new statement processor within Equity to produce an XML representation of the document that would later be interpreted by another process. The XML document contained the usual data for the statement plus a simple header which controlled where to send it once generated.
The logic to control the destination went something like this:-
If the customer has an e-mail address then use it. If no e-mail address but has a fax number then use that. If customer has no e-mail address or fax number then print it.
The next stage was to monitor the output directory looking for XML files to process. I wrote a Python script that monitored the directory via pyinotify that would react once a file was closed. Once a new file was detected the script would read the XML file and build a PDF using pdfgen which is part of the piddle library. This all went very well and within a few hours I could produce PDF statements on demand. Well it worked on my development machine at least.
It didn’t work at all on the server where it was to be used. The server didn’t support the inotify mechanism as it was running a 2.6.9 kernel and we needed a more up-to-date version. I mentioned my problem to Ned from Mad-For-IT and he pointed me to a more recent kernel build that solved the problem.
Sending the resulting PDF to an e-mail address was easily solved with Pythons email and smtp libraries. With e-mail out of the way all that was left was fax and printing. Installing Hylafax on the server solved the fax problem and using the GPL version of ghostscript to convert PDF to PostScript rounded out the solution.
The finished product was installed on Friday June 30th and later that same day the customer statements were sent via the new facility.
Over the weekend I made additional changes to Equity and extended the program to produce customer invoices, supplier orders and EFT payment advices.
The time savings alone have made these changes worthwhile. They save money in postage and handling and within a few months will have saved a tree or two as well.
The downside? Now that Allan is no longer running back and forth to the fax machine he has more time on his hands to dream up even more challenges for me.