1 Reply Latest reply on Aug 2, 2012 1:15 PM by philmodjunk

    Product sold and quantity automatically decrease

    RedzwanLatif

      Title

      Product sold and quantity automatically decrease

      Post

      Hi. How to automatically decrease quantity after a product have been sold? Also automatically delete the product after the quantity reach zero. Etc I got 5 eggs. Then I sell 3 of them and the quantity will be 2. Thanks

        • 1. Re: Product sold and quantity automatically decrease
          philmodjunk

          There are more than one option for doing this. I prefer to set up the lineitems table for a typical invoice as a "ledger" where a Qty added to inventory is entered in an "in" field and items sold (or removed from inventory for other reasons are entered in an "out" field. The Qty field in the typical lineitems portal would then be this "out" field.

          You'd then add these additional fields to LineItems:

          QtyIn  (Number)
          QtyOut (Number)
          Description ( text, records reason for inventory change, "Sale", "Shrinkage", "Return", etc.)
          cBal       ( calculation: QtyIn - QtyOut )
          srBalance ( Summary : Total of cBal, running total, restart totals with each productID )
          sBalance ( Summary : Total of cBal )

          This enables you to set up a list view layout that looks like an accounting ledger but enables you to not only see the current inventory levels for each item, but how they have changed over time--useful for adjusting re-order points.

          A script can check these inventory totals when either the invoice or a line item is committed to remove items with zero on hand, but I wouldn't actually delete them if I were you, I'd set a value that marks them as "deleted" so that they can be excluded from reports, portals and value lists. After all, that chicken might just lay a few more eggs or a customer might return one to you and then you'll need the product record you just deleted.