Question: Asking about average cost method

Asking about average cost method

I want to ask how this feature work. Can i get more explanation about this one, because i tried to purchase a product from 2 supplier with 2 different price. The first price is "5" and the s

EH

Einnlleinhatt Ha

Asked
I want to ask how this feature work. Can i get more explanation about this one, because i tried to purchase a product from 2 supplier with 2 different price. The first price is "5" and the second is "8". After that i tried to make a pos sale for that product, i sold it one by one and see my daily sales report. The cost, profit, revenue is correct. But when i check the "sma_warehouses_product" table with that product id the avg cost is 5.7500, shouldnt it be 6.5 because of the 2 number 5 and 8 ?
  • MS

    Mian Saleem

    Answered
    Hello,

    Not only cost but the quantity purchased matters too. Please check the `updateAVCO` method of the `app/models/admin/Purchases_model.php`

    ```
    avg cost = ((old quantity * old avg cost) + (new quantity * new cost)) / (old quantity + new quantity)
    ```

    Thank you
  • EH

    Einnlleinhatt Ha

    Answered
    I have checked that file and my line was
    ```
    $avg_cost = ($total_cost / $total_quantity);
    ```

    Should i change it like you write ?
  • MS

    Mian Saleem

    Answered
    No. The `$total_cost` & `$total_quantity` already calculated above that line. You don't have to change any thing unless you know what you doing. The method is provided just for reference. Thank you
  • EH

    Einnlleinhatt Ha

    Answered
    Does that mean it will make my profit become inaccurate? Or if I don't use over selling the avg method doesn't matter at all?
  • MS

    Mian Saleem

    Answered
    Doesn't the profit calculated correct? Why are you saying that the avg cost should be `6.5`? How much quantity did you purchase on each order with 5 and 8? Did you calculated the avg cost with above shared formula?

    I don't understand, what is the issue actually?
  • EH

    Einnlleinhatt Ha

    Answered
    Oh nvm, I misunderstood your reply. My bad, everything is working fine.
  • Login to Reply