Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How would you design this?
Message
From
23/10/2002 05:29:06
Andrew Fell-Gordon
Calypso Publications Ltd
Enfield, United Kingdom
 
 
To
22/10/2002 22:39:52
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00714210
Message ID:
00714255
Views:
17
This sort of direct printing is a real pain to do. You can handle the different formats for different clients situation by subclassing the printmanager class, but for this to be effective you need to make it as fine grained as possible.

Each printable element, such as invoice amount, description,tax, total etc should be done in its own method. That way you can replace only the formats that need to change.

Also the parent object should have properties that define the current print positions and widths for text items and the methods should always use these methods rather than hard coding their own location.

Then the control method that controls the printing (which will need to be re-written for each format) becomes the place where you set the print position and for each receipt/invoice element and then calls the method that prints the element. You might even find it an advantage to have the control method call three sub-methods, one for header, one for body and one for totals. Then it you had a format that only changed the header you would only need to replace that method.

Finally create a factory object to deliver the correct subclass for the client/printer configuration.

Hope this helps

Andrew
Previous
Reply
Map
View

Click here to load this message in the networking platform