Question: Rebuild Single Products Total Quantity

Rebuild Single Products Total Quantity

Hi, there is a way to rebuild the single product total? I'd like to rebuild the single totals (quantity) in "sma_warehouses_products" and in "sma_products". Thank you in advance!

S

Ste

Asked
Hi,

there is a way to rebuild the single product total?

I'd like to rebuild the single totals (quantity) in "sma_warehouses_products" and in "sma_products".

Thank you in advance!
  • S

    Ste

    Answered
    it's ok an SQL script if you have one to share! :)

    Thank you again!
  • MS

    Mian Saleem

    Answered
    Hello,

    The real quantity is tracked with purchase_items' quantity balance column.

    If you want to get the total then you can use sum like

    ```sql
    SELECT SUM(quantity) from sma_products;
    ```

    Thank you
  • S

    Ste

    Answered
    Thank you for your quick reply!

    What i'll need is a way to recount then quantity showed in sma_products for each single product.

    My scenario: Product1 has a quantity of 1300 in sma_products. I want to recount 1300 from the other tables in DB to check its integrity.

    so i'll need to calculate form quanty adjustment and purchases for products and relative variants... i do not use sell product

    thank you in advance
  • S

    Ste

    Answered
    add a question: what is Quantity_balance? in my DB i have some row with quantity_balance greater than quantity total or negative in some case...

    Example: Productpurchase1 quantity 3600, quantity_balance -320000 or Productpurchase2 quantity 2400, quantity_balance 8312... is it ok?

    Thnak you again!
  • MS

    Mian Saleem

    Answered
    Hello,

    I didn't understand your use case.

    > We don't offer support for modifications and modified versions. You are allowed to modify the item as you need as per license at your own risk.

    The `quantity_balance` is the column in the `sma_purcahse_items` that is used to calculate the product quantity and costing. It could have -ve values if the overselling is enabled but it should not have greater value than quantity in the same table. If it has that might be caused by some bug/errors.

    Thank you
  • S

    Ste

    Answered
    Hi, thank you.
    I'm not working on a modified version... i'm only trying to understand how it works. :)

    Can you explain how the system calculate the quantity on sma_products? and how calculate quantity_balance on sma_purchase_items?

    What happen if i insert a purchase with a retro date respect another purchase with same products not completed??

    Thank you again!!
  • MS

    Mian Saleem

    Answered
    Hello,

    System set the quantity_balance on sale and others are update accordingly. The add purchase won't have any effect as the quantity will be consider as quantity_balance and for only completed/partial purchases. If the purchase is not completed the purchase_item won't be considered as received so it will be just a record without any other action on stock.

    Thank you
  • S

    Ste

    Answered
    ok... so quantity_balance is the real amount of pieces in warehouse, right?
  • MS

    Mian Saleem

    Answered
    Yes, that the real quantity.
  • S

    Ste

    Answered
    ok... so... it is the TOTAL amount of pieces of a product?
    but if is it true, it could be greater than quantity in the same row... maybe i don't understand.

    or the TOTAL quantity is the sum (+/-) of quantity_balances in other tables (purchases, variations, sales)??

    so... quantity_balance is present only in sma_purchase_item?? or there are other columns in other tables in DB with this value?

    thank you!
  • Login to Reply