Results 1 to 15 of 15

Thread: First In, First Out subtraction from rows?

Hybrid View

  1. #1

    Thread Starter
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: First In, First Out subtraction from rows?

    Quote Originally Posted by wes4dbt View Post
    Hard to suggest anything without more information.

    Why are you subtracting from "a" until it's "0", then start subtracting from "b", and so on...

    What is the purpose of this process?
    It's a FIFO as I've already mentioned, "a" is the first so it has to be "zeroed" first before moving to the next "stock" which is "b", and so on.
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  2. #2
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    5,517

    Re: First In, First Out subtraction from rows?

    Quote Originally Posted by dee-u View Post
    It's a FIFO as I've already mentioned, "a" is the first so it has to be "zeroed" first before moving to the next "stock" which is "b", and so on.
    I know, you said that in your first post. You haven't added any clarification.

    What does each row represent? Is this an Inventory system or Stocks or ...... If this is an Inventory system then I'd say this is a bad design.

    It should have at least 2 Tables, 3 Tables would work well too. A simple example,

    2 Table design:

    Table 1: InventoryItems - Fields: ItemId ItemDescription Price Cost QuantityOnHand QuantityOnOrder

    Table 2: ItemTransactions - Fields: TransactionId ItemId Quantity Cost Total TransactionType (this field would indicate if this was a Purchase or a Sale)

    The 3 table method would breakup the ItemTransactions into ItemsPurchased and ItemsSold.

    It really depends on how much detailed history you want. If you don't care about Purchase or Sales history and the only thing you will ever want to know is the Average cost then you could use one table.

    Table 1: ItemTransactions - Fields: ItemId Quantity Cost Total QuantityBalance

    With this method QuantityBalance would initially be the same as Quantity and then you would subtract from QuantityBalance as items are sold.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width