Question: Can You Tell Me How This Product Report Works

Can You Tell Me How This Product Report Works

Can you tell me how this product report works? In the image I see the product that ends in 1206, I bought 140 units and I have sold 96, in earnings I have 2900 plus the stock that I have in

MS

Michael Salcedo

Asked
Can you tell me how this product report works?
In the image I see the product that ends in 1206, I bought 140 units and I have sold 96, in earnings I have 2900 plus the stock that I have in the warehouse, but the product that ends in 7716 I have bought 248 and I have sold 99 but the profit was gives with negative value.
The question is why some products appear to me with negative gains and others with positive gains?
  • MS

    Mian Saleem

    Answered
    Hello,

    The products report is calculated as

    `SUM( (CASE WHEN pi.purchase_id IS NOT NULL THEN (pi.subtotal) ELSE 0 END) ) as totalPurchase` & `SUM(quantity_balance) as balacneQty` from `sma_purchase_items` for purchases.

    `SUM(subtotal) as totalSale` & `SUM(quantity) as soldQty` from `sma_sale_items` for sales.

    If the purchase value is more than sale then the profit will be -ve. It is calculated as `totalSale - totalPurchase`

    Thank you
  • Login to Reply