shop code

This commit is contained in:
Myat Zin Wai Maw
2019-11-22 18:24:02 +06:30
parent 5a3f328789
commit d1ab2c194d
106 changed files with 834 additions and 895 deletions

View File

@@ -1,7 +1,7 @@
class Origami::TableInvoicesController < BaseOrigamiController
def index
@table = DiningFacility.find(params[:table_id])
shop = Shop.first
# shop = Shop.first
puts "table bookig lenght"
@sale_array = Array.new
@table.bookings.each do |booking|
@@ -11,7 +11,7 @@ class Origami::TableInvoicesController < BaseOrigamiController
else
sale = Sale.find(booking.sale_id)
# rounding adjustment
if shop.is_rounding_adj
if @shop.is_rounding_adj
a = sale.grand_total % 25 # Modulus
b = sale.grand_total / 25 # Division
#not calculate rounding if modulus is 0 and division is even
@@ -32,16 +32,17 @@ class Origami::TableInvoicesController < BaseOrigamiController
def show
# puts 'Catch me if you can.......................'
@table = DiningFacility.find(params[:table_id])
@membership = MembershipSetting::MembershipSetting
@payment_methods = PaymentMethodSetting.all
shop = Shop.first
@membership = MembershipSetting.find_by_shop_code(@shop.shop_code)
@payment_methods = PaymentMethodSetting.where("shop_code='#{@shop.shop_code}'")
# shop = Shop.first
@sale_array = Array.new
@table.bookings.each do |booking|
if booking.sale_id.nil?
else
sale = Sale.find(booking.sale_id)
# rounding adjustment
if shop.is_rounding_adj
if @shop.is_rounding_adj
a = sale.grand_total % 25 # Modulus
b = sale.grand_total / 25 # Division
#not calculate rounding if modulus is 0 and division is even
@@ -49,7 +50,7 @@ class Origami::TableInvoicesController < BaseOrigamiController
if (a != 0.0 && b%2 != 0.0) || (a==0.0 && b%2 !=0)
new_total = Sale.get_rounding_adjustment(sale.grand_total)
sale.rounding_adjustment = new_total-sale.grand_total
sale.update_attributes(grand_total: new_total,old_grand_total: sale.grand_total,rounding_adjustment:sale.rounding_adjustment)
sale.update_attributes(grand_total: new_total,old_grand_total: sale.grand_total,rounding_adjustment:sale.rounding_adjustment)
end
end
#end rounding adjustment
@@ -64,7 +65,7 @@ class Origami::TableInvoicesController < BaseOrigamiController
@status_sale = 'sale'
@customer = @sale.customer
#for split bill
lookup_spit_bill = Lookup.collection_of('split_bill')
lookup_spit_bill = Lookup.where("shop_code='#{@shop.shop_code}'").collection_of('split_bill')
@split_bill = 0
if !lookup_spit_bill[0].nil?
@split_bill = lookup_spit_bill[0][1]