major fix taxable price for sale and other sale and oqs
This commit is contained in:
@@ -4,16 +4,16 @@ class DiningCharge < ApplicationRecord
|
||||
|
||||
def self.amount_calculate(dining_charges_obj, checkin , checkout)
|
||||
# note :: the first Charge Block will cost all, the Time rounding block will included in 2nd Charge Block
|
||||
if !checkin.nil? && !checkout.nil? && !dining_charges_obj.nil?
|
||||
if !checkin.nil? && !checkout.nil? && !dining_charges_obj.nil?
|
||||
block_count = 0
|
||||
price = 0
|
||||
minutes = DiningCharge.time_diff(checkout, checkin)
|
||||
free_time = DiningCharge.convert_to_minutes(dining_charges_obj.minimum_free_time.utc.localtime.strftime('%H:%M'))
|
||||
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
|
||||
price = 0
|
||||
else
|
||||
charge_type = dining_charges_obj.charge_type
|
||||
charge_type = dining_charges_obj.charge_type
|
||||
if charge_type == 'hr'
|
||||
block_count, price = DiningCharge.charges(dining_charges_obj, dining_minutes, 'hr')
|
||||
elsif charge_type == 'day'
|
||||
@@ -30,7 +30,7 @@ class DiningCharge < ApplicationRecord
|
||||
# dining charges calculate
|
||||
def self.charges(chargesObj, dining_minutes, type)
|
||||
solid_price = 0
|
||||
charge_block = DiningCharge.convert_to_minutes(chargesObj.charge_block.utc.localtime.strftime('%H:%M'))
|
||||
charge_block = DiningCharge.convert_to_minutes(chargesObj.charge_block.utc.strftime('%H:%M'))
|
||||
|
||||
result = dining_minutes / charge_block
|
||||
if result.to_i < 1
|
||||
@@ -40,7 +40,7 @@ class DiningCharge < ApplicationRecord
|
||||
solid_price = result * chargesObj.unit_price
|
||||
|
||||
remain_value = dining_minutes % charge_block
|
||||
rounding_time = DiningCharge.convert_to_minutes(chargesObj.time_rounding_block.utc.localtime.strftime('%H:%M'))
|
||||
rounding_time = DiningCharge.convert_to_minutes(chargesObj.time_rounding_block.utc.strftime('%H:%M'))
|
||||
roundingblock = remain_value / rounding_time
|
||||
if roundingblock.to_i < 1
|
||||
# no time rounding block
|
||||
|
||||
@@ -98,7 +98,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
end
|
||||
# For Print Order Summary
|
||||
else
|
||||
filename = "tmp/booking_summary.pdf"
|
||||
filename = "tmp/booking_summary.pdf"
|
||||
pdf = OrderSummaryPdf.new(print_settings,order, print_status,oqs.use_alternate_name)
|
||||
pdf.render_file filename
|
||||
if oqs.print_copy
|
||||
|
||||
@@ -164,7 +164,7 @@ class Promotion < ApplicationRecord
|
||||
sale_item.qty = qty * (-1)
|
||||
|
||||
sale_item.unit_price = item_price # * (-1)
|
||||
sale_item.taxable_price = qty * item_price # * (-1)
|
||||
sale_item.taxable_price = (qty * item_price) * (-1)
|
||||
sale_item.price = qty * item_price * (-1)
|
||||
|
||||
sale_item.is_taxable = 1
|
||||
|
||||
@@ -48,7 +48,7 @@ class Sale < ApplicationRecord
|
||||
|
||||
# dining charges
|
||||
charges = DiningCharge.where('dining_facility_id=?',booking.dining_facility_id).take
|
||||
if !charges.nil?
|
||||
if !charges.nil?
|
||||
block_count, diningprice = DiningCharge.amount_calculate(charges, booking.checkin_at, booking.checkout_at)
|
||||
dining_time = booking.checkin_at.strftime('%H:%M %p').to_s + " - " + booking.checkout_at.strftime('%H:%M %p').to_s
|
||||
create_saleitem_diningcharges(charges, block_count, diningprice, booking.dining_facility.name, dining_time)
|
||||
|
||||
Reference in New Issue
Block a user