bill print format and tax fix
This commit is contained in:
@@ -23,8 +23,7 @@ class Sale < ApplicationRecord
|
||||
if (booking)
|
||||
Rails.logger.debug "Booking -> Booking Order Count -> " + booking.booking_orders.count.to_s
|
||||
#get all order attached to this booking and combine into 1 invoice
|
||||
|
||||
puts booking.booking_orders.length
|
||||
|
||||
booking.booking_orders.each do |order|
|
||||
if booking.sale_id
|
||||
status, sale_id = generate_invoice_from_order(order.order_id, nil, booking, requested_by)
|
||||
@@ -90,6 +89,8 @@ class Sale < ApplicationRecord
|
||||
order.save
|
||||
|
||||
booking.sale_id = self.id
|
||||
booking.checkout_at = Time.now.utc
|
||||
booking.checkout_by = requested_by.name
|
||||
booking.save
|
||||
|
||||
return true, self.id
|
||||
@@ -190,9 +191,14 @@ class Sale < ApplicationRecord
|
||||
|
||||
# Tax Calculate
|
||||
def apply_tax(total_taxable)
|
||||
#if tax is not apply create new record
|
||||
# self.sale_taxes.each do |existing_tax|
|
||||
# #delete existing and create new
|
||||
# existing_tax.delete
|
||||
# end
|
||||
|
||||
#if tax is not apply create new record
|
||||
self.sale_taxes.each do |existing_tax|
|
||||
SaleTax.where("sale_id='#{self.sale_id}'").find_each do |existing_tax|
|
||||
#delete existing and create new
|
||||
existing_tax.delete
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user