update other charge add to recipt bill and close pdf

This commit is contained in:
Aung Myo
2018-07-10 15:16:49 +06:30
parent 82ede72f34
commit 5c8fd3666d
9 changed files with 74 additions and 17 deletions

View File

@@ -150,6 +150,19 @@ class SaleItem < ApplicationRecord
return price,type
end
# Get Prices for each accounts (eg: food, beverage)
def self.calculate_other_charges(sale_items)
total = 0
# Check for actual sale items
sale_items.each do |si|
if si.product_code == "Other Charges" && si.item_instance_code == nil
total = total + si.price
end
end
return total
end
# def self.get_overall_discount(sale_id)
# price = 0.0
# item=SaleItem.where("product_code=?", sale_id)