Hi pls i want to know if it posible for me getting from my stock table both the stock_rate and the stock_id of each stock. this is what i have done but nothing
private function check_rate($product_id, $stock_id) {
$stock_rate =DB:: table('tbl_stock')
->where('product_id','stock_id', $product_id, $stock_id)
->first();
return $stock_rate->stock_rate;
}
i get this error
Missing argument 2 for App\Http\Controllers\SellController::check_rate(), called in C:\inventorybackup\app\Http\Controllers\SellController.php on line 154 and defined
what i am trying to do is i want the total of each sales to be calculated taking into consideration the differences at the level of the stock prices. For example i have 10pens in my stock table where i baught the first five pens at a rate of 100 each and the last five at a rate of 110 each. I want that if i carry out a sale of 6pens using my FIFO method the first 5pens should be calculated at a rate of 100 each and the last pen should be at the rate of 110 since it is from the last stock i baught so that i can have a total of 610.
With this methode
private function check_rate($product_id) {
$stock_rate =DB:: table('tbl_stock')
->where('product_id', $product_id)
->first();
return $stock_rate->stock_rate;
}
it uses the stock_rate of the first stock to calculate since the have same ID.
please how can i query my table in other to have the above done? thanks for your helps in advance