osaka menu update and void tax calc fix
This commit is contained in:
@@ -21,6 +21,10 @@ class Origami::SaleEditController < BaseOrigamiController
|
||||
@newsaleitem.is_taxable = 1
|
||||
@newsaleitem.product_name = saleitemObj.product_name + " - void"
|
||||
@newsaleitem.save
|
||||
|
||||
# re-calc tax
|
||||
saleObj = Sale.find(saleitemObj.sale_id)
|
||||
saleObj.compute_without_void
|
||||
end
|
||||
|
||||
# def item_edit
|
||||
@@ -56,6 +60,10 @@ class Origami::SaleEditController < BaseOrigamiController
|
||||
# saleitemObj.remark = 'edit'
|
||||
saleitemObj.product_name = saleitemObj.product_name + " - updated"
|
||||
saleitemObj.save
|
||||
|
||||
# re-calc tax
|
||||
saleObj = Sale.find(saleitemObj.sale_id)
|
||||
saleObj.compute_without_void
|
||||
end
|
||||
|
||||
|
||||
@@ -71,6 +79,10 @@ class Origami::SaleEditController < BaseOrigamiController
|
||||
end
|
||||
end
|
||||
saleitemObj.destroy
|
||||
|
||||
# re-calc tax
|
||||
saleObj = Sale.find(saleitemObj.sale_id)
|
||||
saleObj.compute_without_void
|
||||
end
|
||||
|
||||
# remove all void items
|
||||
@@ -85,6 +97,9 @@ class Origami::SaleEditController < BaseOrigamiController
|
||||
end
|
||||
item.save
|
||||
end
|
||||
|
||||
# re-calc tax
|
||||
saleObj.compute_without_void
|
||||
end
|
||||
|
||||
def apply_void
|
||||
|
||||
@@ -12,9 +12,10 @@ class Origami::VoidController < BaseOrigamiController
|
||||
|
||||
# update count for shift sale
|
||||
if(sale.sale_status == "void")
|
||||
# shift = ShiftSale.current_open_shift(sale.cashier_id)
|
||||
shift = ShiftSale.find(sale.shift_sale_id)
|
||||
shift.calculate(sale_id, "void")
|
||||
if sale.shift_sale_id != nil
|
||||
shift = ShiftSale.find(sale.shift_sale_id)
|
||||
shift.calculate(sale_id, "void")
|
||||
end
|
||||
end
|
||||
|
||||
bookings = sale.bookings
|
||||
|
||||
@@ -42,8 +42,8 @@ class Sale < ApplicationRecord
|
||||
booking.sale_id = sale_id
|
||||
end
|
||||
|
||||
order = booking.booking_orders.take.order
|
||||
link_order_sale(order.id)
|
||||
order = booking.booking_orders.take.order
|
||||
link_order_sale(order.id)
|
||||
|
||||
return status, sale_id
|
||||
end
|
||||
@@ -323,7 +323,8 @@ class Sale < ApplicationRecord
|
||||
sale_tax.tax_rate = tax.rate
|
||||
#include or execulive
|
||||
# sale_tax.tax_payable_amount = total_taxable * tax.rate
|
||||
sale_tax.tax_payable_amount = total_taxable * tax.rate / 100
|
||||
total_tax = total_taxable - self.total_discount
|
||||
sale_tax.tax_payable_amount = total_tax * tax.rate / 100
|
||||
#new taxable amount is standard rule for step by step
|
||||
# total_taxable = total_taxable + sale_tax.tax_payable_amount
|
||||
|
||||
|
||||
Reference in New Issue
Block a user