Invoices and Invoice items

Again the use case is:
  • An invoice can refer to several products so the invoice item concept applies.
  • An invoice has an open state and a closed state. You can't add invoice items to a closed invoice. There is no limit for how long an invoice can be kept open (no monthly close of invoicing concept).
  • Invoice items describe the unit price and the quantity of a product. On a given invoice, several invoice items may refer to the same product and have different unit prices (we suspect there will be some paper support for product delivery but we weren't given any concrete details).
  • The product unit price is copied from the product object when the invoice item is added. Subsequent product price changes shouldn't affect existing invoices.
  • Once an invoice item is added to the invoice, it can not be edited neither for the quantity nor for the unit price.
  • Invoice items can be deleted.
  • If two "users" edit the same invoide or invoice item, the optimistic concurrency pattern "first write wins" applies.
  • There must be a form for invoice and invoice item entry.
  • There must be an invoice search form.
  • For a given customer, it must be possible to list all the invoices including all invoice items.

Defining business objects

Invoice

1 - Open the tables folder
2 - Click on Invoices table
3 - Right click and select Create Editable Root
InvoiceCreateEditableRoot.png
  • Click Invoices and check:
    • 01. Common Options - Csla Object Type shows EditableRoot
    • 01. Common Options - Change to InvoiceEdit

Invoice Items

1 - select 'InvoiceItems' table (1)
2 - select all columns (2)
3 - Right click and choose Editable Child Collection** (3)
InvoiceItemsCreatedEditableChildCollection.png
4 - Enter the following:
  • Collection Name: InvoiceItemEditCol
  • Item Name: InvoiceItemEdit
  • Parent Type: InvoiceEdit
  • Property Name in Parent Type: InvoiceItems
  • Choose InvoiceID as 'Parent Properties'

ProductInfo (ReadOnly)

To support adding products to the invoice Creating a ReadOnlyRoot ProductInfo
InvoiceItemsCreatedEditableChildCollection_Values.png
To create the ProductInfo class
ProductInfo.png
1 - Right click on 'Product' table
2 - Select Read Only Root

Last edited Sep 25, 2011 at 12:15 PM by RumbleCow, version 20

Comments

No comments yet.