The knee-jerk response many developers will have is to just hack their own QTextDocument derived class. After all, it wouldn’t take much to add a document name to the class, nor would it take much to hack a version of printPage() to place the current date and document name at the top of the page along with the page number.
You might even customize the print() method where pageNumberPos is calculated to make it a slightly cleaner hack.
If you have a Technical/Application/Systems Architect involved in your project they will tell you not to do this. There is a quick test you can perform to determine if you actually have an architect on your project, vs. someone simply given the title. If you are using AGILE there is no architect involved. An architect won’t allow AGILE anywhere in the building, let alone on a project they are running.
Your argument about KATE (K Advanced Text Editor) doing this exact thing will be both true and irrelevant.
Do you know why? Think about it for a bit. What is the difference between a text editor doing this and your application? What is the difference between a text editor doing this and the software developed at your shop?
The text editor has no legal requirements.
When you cheat and put the page heading on at time of printing instead of creation time, you expose yourself to a litany of legal issues down the road if your application generates the output for any financial or regulatory filing.
“Oh! But we’re just writing a worthless phone app!” you counter.
Fine. What is the nature of Object Oriented Programming? What is the mandate at your shop? They should both be the same if you are using C++ and an architect knows this.
To create, when possible, re-usable objects which can be shared and re-used all across the code base.
There are certainly no legal requirements for my expense tracker. It’s a simple application for entering and tracking expenses. The fact the date changes on the page heading is of no consequence. I also didn’t delete the report file for that reason. That file is complete and can be printed from the command line time and again reproducing the exact same output.
I no longer have committed to memory the standard business reports which a publicly traded corporation is required to reproduce on demand for various regulatory agencies, I simply know they exist and have existed for my entire career. This reproduction has to be exact. The date cannot change in the page heading, nor can any part of the report. During the 1980s and even later, in shops which couldn’t afford a lot of tape for off-site storage, or couldn’t run the risk of not being able to read the tape, multiple copies of every regulatory filing were printed and placed in binders. The “extra” copies were sent to off-site storage.
Many prayers were said in hopes mice would never invade the filing cabinets. Some companies I worked at told me about random reproduction requests for prior years from the various regulatory bodies. If anything changed on the report it was an instant audit. It was, and still is, a regulatory method of identifying stupid companies who entered their real accounting information after doctoring their books for a regulatory filing.
Creating your own custom QTextDocument derived class to place report headings on printed output is a time bomb waiting to detonate. People will re-use it and rely on it. Eventually it will get used some place it shouldn’t and you will find out when the audit request arrives. Every large company does things with accounting they hope nobody gets wise to, an audit tends to expose all of that. I would go so far as to wager if you visit Iron Mountain or one of the other old off-site storage/archival facilities and manage to visit the oldest sections you will find filing cabinets companies forgot about but are still paying for containing hundreds of binders with yellowing print out paper because it was archived as “save forever.”
Under certain conditions the IRS can go back 20 years with an audit. I don’t know just how far the SEC can go back. With the FDA it is reported to be the life of the product plus some number of years. Let that concept think in for a bit as you contemplate just how long there have been stethascopes. It just might get even longer when you considered drugs like Penacillin.
So, your guiding directive as a software or application architect is to have the report file contain everything it needs such that it can be printed via an external generic utility, such as the command line, any time another copy is required. You won’t see
I would like this report to meet all current SEC reporting requirements.
in a “user story.” Even if you do, so what? You’re a programmer, not a lawyer or licensed accountant. Even if someone could point you to a link where the SEC documented its reporting requirements it would be in either legalease or accountantease, both of which will be completely undigestable by you.
No, to work on anything that actually matters you need The Four Holy documents, written so an idiot can understand them. You need an application architect who can not only design the application but can either answer your questions or get the answer to your questions in a form you can understand.
I have uploaded an html version of xpnsqt to Sourceforge. It still requires the font to be forced because I simply couldn’t bring myself to code anything which required circular report generation. It creates a passable report file which looks good even when printed from Chrome (with margins turned off.)
When testing the report I used this html validator. This points out a few oddities.
The “&” in “K & J Live Bait” throws errors any time it appears. When escaping it in the tradition method to pass validation, the report browser shows the escape text, not the intended value.