Line items again!

Line items again!

Old forum URL: forums.lhotka.net/forums/t/3067.aspx


ajj3085 posted on Thursday, June 21, 2007

Hi,

I have some document objects, which contains line items.  One of the documents is an Rma.  A requested feature, that should ONLY be available for Rma documents is that the price of the line item be hidden on print.  The user must select which lines will be hidden and which will display prices when printed or exported to pdf.

My intial thought is yet another line item class, which would wrap the item to be hidden.  Its more complicated though, because there are some line items which contain other line items.

Another thought is to simply enable all line items to hide their prices (although there are some for which a price doesn't apply at all, like a Note line item), but that let all documents to allow the functionality.

Any ideas how best to proceed?

malloc1024 replied on Friday, June 22, 2007

Instead of using another decorator to decorate your LineItem class, you could use the strategy pattern on the print function in the LineItem class.  One print function would print the amount while the other wouldn’t.

ajj3085 replied on Tuesday, June 26, 2007

That would make it available to ever line item within any document type... which is really the part I'm trying to grapple with.

malloc1024 replied on Tuesday, June 26, 2007

You could allow all line items to hide their price but only allow the user to hide the price of a line item that belongs to a RMA document through the user interface. You don't need to give the user a way to hide line items through the user interface for other documents. I am assuming that you would like to enforce this rule in your business layer. If so, the document object is responisble for enforcing it. It could check to see if all line items are displaying their price before it prints the document. If a few line items are not displaying their price, the document object can change the line item to display their price or throw an exception. If a line item doesn't have a price, and it is told to print a price, it would print a blank line.

Copyright (c) Marimer LLC