From SeedCode Documentation

SeedCodeComplete2: ItemsForSale

How can I create new items for sale (invoiceable items)?

New items are created on the "Items" tab on the Settings layout. You can create items for physical things, like products you sell, or for intangible things like services you offer.

How does inventory control work?

Begin by adding a Quantity on Hand for each of the items you'd like to inventory: and check "track qty on hand" for these items. Also enter a re-order quantity: when inventory falls below this level, item quantities will turn orange on this Settings screen and on invoices containing this item.

Once this is set up, invoices containing an item for which "track qty on hand" is turned on will display an "update inventory" button. As inventories items are added to the invoice, we lookup the current qty on hand. After "update inventory" is clicked, we write the new qty on hand into the item's record on the settings screen and pull the new qty on hand down into the invoice line item: this way we never debit the same invoice line from inventory twice.

Changed to the items' quantity on hand are transactional, so if the item is being edited by another user, or another order's "update" script, the changes are reverted and users told to try updating again in a moment.

One advantage of this set up is that the qty on hand in the items record is indexed, so it doesn't matter how many items you have, nor how many invoices you have: the system stays fast.

Caveats

This is a solid, but simple way to track inventory levels. There are a few things you may want to change or extend to make this into a more sophisticated inventory system:

Invoices here are not locked, so an invoice line can be deleted at any time, and new lines create, possibly long after the invoice has shipped. And, we do not adjust inventory when invoice lines are deleted or when invoices are deleted. You may want to add locking and rules surrounding this as you modify Complete.
We don't have any provision for adding new quantities into inventory, other than manually adjusting the quantity on hand. You may want to create a table of in-bound inventory transactions to record purchasing new quantities of inventory: then write script to have those add to inventory much as the scripts here debit from inventory.
While we highlight in orange items that have fallen below their re-order level, our scripts do not prevent users from going below the re-order level, nor do they prevent users from ordering more than the qty currently on hand. Accordingly, there is no routine here for backordering an item.
Inventory control happens when items are invoiced not when they are bid.

Can I create an invoice from an appointment

Yes. You can bill appointments by selecting the "invoice" tab on the Event Details mini window (this is the window the comes up when you click on an event in the calendar). Lines created here are added to a new invoice linked to this event. That invoice is also linked to the event's contact and project.

Once lines are added you can close the event window and work on the invoice later, or you can jump right to the invoice by clicking on the green arrow pointing to "Invoice" on the Event Details window.

Extending this

You can take this idea (and the scripts used here) and extend this to bill other entities like time. This takes a bit of work, but two scripts in particular should help...

One an invoice is created you can add lines to it from other contexts (like time) using the script "Create Invoice Line { InvoiceID , ItemID , Qty , Name , PriceEa, Desc , Taxable , Override }"

That is your real worker script to make new invoice lines for an existing invoice.

And "New Invoice" is the basic script for creating a new invoice.

Retrieved from http://archive.seedcode.com/pmwiki/pmwiki.php?n=SeedCodeComplete2.ItemsForSale
Page last modified on July 21, 2010, at 07:24 PM