merge with origin master
This commit is contained in:
@@ -25,7 +25,7 @@ class Sale < ApplicationRecord
|
||||
SALE_STATUS_OUTSTANDING = "outstanding"
|
||||
SALE_STATUS_COMPLETED = "completed"
|
||||
|
||||
def generate_invoice_from_booking(booking_id, requested_by, cashier)
|
||||
def generate_invoice_from_booking(booking_id, requested_by, cashier)
|
||||
booking = Booking.find(booking_id)
|
||||
status = false
|
||||
Rails.logger.debug "Booking -> " + booking.id.to_s
|
||||
@@ -66,7 +66,7 @@ class Sale < ApplicationRecord
|
||||
#Default Tax - Values
|
||||
self.tax_type = "exclusive"
|
||||
|
||||
# set cashier
|
||||
# set cashier
|
||||
if cashier != nil
|
||||
self.cashier_id = cashier[0].id
|
||||
self.cashier_name = cashier[0].name
|
||||
@@ -270,8 +270,6 @@ class Sale < ApplicationRecord
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def product_get_unit_price(item_code)
|
||||
menu_item_hash =MenuItem.search_by_item_code(item_code)
|
||||
if (menu_instance_code)
|
||||
@@ -444,10 +442,51 @@ def self.get_by_range_by_saleitems(from,to,status,report_type)
|
||||
|
||||
end
|
||||
|
||||
|
||||
def self.get_by_shiftsales(from,to)
|
||||
return ShiftSale.where("(shift_started_at between ? and ? OR shift_closed_at between ? and ? )", from, to, from, to)
|
||||
end
|
||||
|
||||
def get_cash_amount
|
||||
cash = 0.0
|
||||
self.sale_payments.each do |pay|
|
||||
if pay.payment_method == 'cash'
|
||||
cash = pay.payment_amount
|
||||
end
|
||||
end
|
||||
return cash
|
||||
end
|
||||
|
||||
def get_credit_amount
|
||||
credit = 0.0
|
||||
self.sale_payments.each do |pay|
|
||||
if pay.payment_method == 'creditnote'
|
||||
credit = pay.payment_amount
|
||||
end
|
||||
end
|
||||
return credit
|
||||
end
|
||||
|
||||
def get_other_amount
|
||||
other = 0.0
|
||||
self.sale_payments.each do |pay|
|
||||
if pay.payment_method != 'cash' && pay.payment_method != 'creditnote'
|
||||
other += pay.payment_amount
|
||||
end
|
||||
end
|
||||
return other
|
||||
end
|
||||
|
||||
def get_commerical_tax
|
||||
tax = 0.0
|
||||
self.sale_taxes.each do |tax|
|
||||
if tax.tax_name == "Commerical Tax"
|
||||
tax += tax.tax_payable_amount
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
|
||||
def generate_custom_id
|
||||
|
||||
Reference in New Issue
Block a user