calculate induties bill with min
This commit is contained in:
@@ -17,6 +17,7 @@ class Origami::HomeController < BaseOrigamiController
|
||||
|
||||
# origami table detail
|
||||
def show
|
||||
|
||||
@webview = check_mobile
|
||||
|
||||
@tables = Table.unscoped.all.active.order('status desc')
|
||||
|
||||
@@ -8,7 +8,6 @@ class DiningCharge < ApplicationRecord
|
||||
block_count = 0
|
||||
price = 0
|
||||
minutes = DiningCharge.time_diff(checkout, checkin)
|
||||
checkin_minutes =minutes
|
||||
free_time = DiningCharge.convert_to_minutes(dining_charges_obj.minimum_free_time.utc.strftime('%H:%M'))
|
||||
dining_minutes = minutes #- free_time # stayminutes - free minutes
|
||||
if dining_minutes <= free_time
|
||||
@@ -21,7 +20,7 @@ class DiningCharge < ApplicationRecord
|
||||
block_count, price = DiningCharge.charges(dining_charges_obj, dining_minutes, 'day')
|
||||
end
|
||||
end
|
||||
return block_count, price ,checkin_minutes
|
||||
return block_count, price
|
||||
else
|
||||
puts "<<<<<<<< NO"
|
||||
end
|
||||
|
||||
@@ -50,20 +50,15 @@ class Sale < ApplicationRecord
|
||||
# dining charges
|
||||
charges = DiningCharge.where('dining_facility_id=?',booking.dining_facility_id).take
|
||||
if !charges.nil?
|
||||
block_count, diningprice , checkin_minutes = DiningCharge.amount_calculate(charges, booking.checkin_at, booking.checkout_at)
|
||||
block_count, diningprice = DiningCharge.amount_calculate(charges, booking.checkin_at, booking.checkout_at)
|
||||
if charges.charge_type =='hr'
|
||||
dining_time = booking.checkin_at.strftime('%H:%M %p').to_s + " - " + booking.checkout_at.strftime('%H:%M %p').to_s
|
||||
else
|
||||
dining_time = booking.checkin_at.strftime('%B %d, %H:%M %p').to_s + " - " + booking.checkout_at.strftime('%B %d, %H:%M %p').to_s
|
||||
end
|
||||
# later_time = booking.checkout_at
|
||||
# early_time = booking.checkin_at
|
||||
# distance_in_minutes = ((later_time - early_time)/60.0).round
|
||||
# # time = ((later_time.hour*3600+later_time.min*60+later_time.sec) - (early_time.hour*3600+early_time.min*60+early_time.sec))/24
|
||||
# puts "Hello time"
|
||||
# puts distance_in_minutes
|
||||
# # puts checkin_minutes / 60
|
||||
# puts "Hello block_count"
|
||||
later_time = booking.checkout_at
|
||||
early_time = booking.checkin_at
|
||||
distance_in_minutes = ((later_time - early_time)/60.0).round
|
||||
basic_pay_amount =0
|
||||
name =""
|
||||
if current_checkin_induties_count != "0"
|
||||
@@ -72,7 +67,7 @@ class Sale < ApplicationRecord
|
||||
basic_pay_amount =pay.amount
|
||||
name =pay.name
|
||||
end
|
||||
induties_pay_amount = (current_checkin_induties_count.to_i * (checkin_minutes.to_i / 60).to_f * basic_pay_amount).to_i
|
||||
induties_pay_amount = (current_checkin_induties_count.to_i * (distance_in_minutes / 60.0).to_f * basic_pay_amount).to_i
|
||||
create_saleitem_indutycharges(charges, current_checkin_induties_count.to_i, induties_pay_amount, booking.dining_facility.name, dining_time, order_source, basic_pay_amount)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user