update mobilepayment
This commit is contained in:
@@ -35,7 +35,7 @@ class InventoryDefinition < ApplicationRecord
|
||||
end
|
||||
|
||||
def self.check_balance(item,inventory_definition) # item => saleItemOBj
|
||||
stock = StockJournal.where('item_code=?', item.item_instance_code).order('created_at desc').take
|
||||
stock = StockJournal.where('item_code=?', item.item_instance_code).last
|
||||
unless stock.nil?
|
||||
modify_balance(item, stock, inventory_definition)
|
||||
else
|
||||
@@ -77,7 +77,7 @@ class InventoryDefinition < ApplicationRecord
|
||||
|
||||
def self.get_by_category(filter)
|
||||
least_stock = "SELECT (CASE WHEN stock_journals.remark != 'out of stock'
|
||||
THEN (SELECT balance FROM stock_journals
|
||||
THEN (SELECT min(balance) FROM stock_journals
|
||||
WHERE item_code = inventory_definitions.item_code AND remark != 'out of stock'
|
||||
ORDER BY created_at DESC LIMIT 1) ELSE 0 END)
|
||||
FROM stock_journals
|
||||
|
||||
Reference in New Issue
Block a user