rounding adj fix

This commit is contained in:
Yan
2017-12-07 15:06:38 +06:30
parent a7b2107624
commit cb0559a1ab
7 changed files with 49 additions and 29 deletions

View File

@@ -40,6 +40,7 @@ class Origami::CreditPaymentsController < BaseOrigamiController
saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj) saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj)
end end
saleObj = Sale.find(sale_id)
sale_payment = SalePayment.new sale_payment = SalePayment.new
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "creditnote") @status, @sale = sale_payment.process_payment(saleObj, @user, cash, "creditnote")
end end

View File

@@ -45,6 +45,7 @@ class Origami::JcbController < BaseOrigamiController
saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj) saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj)
end end
saleObj = Sale.find(sale_id)
sale_payment = SalePayment.new sale_payment = SalePayment.new
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "jcb") @status, @sale = sale_payment.process_payment(saleObj, @user, cash, "jcb")
end end

View File

@@ -34,6 +34,16 @@ class Origami::MasterController < BaseOrigamiController
cash = params[:amount] cash = params[:amount]
sale_id = params[:sale_id] sale_id = params[:sale_id]
if(Sale.exists?(sale_id)) if(Sale.exists?(sale_id))
saleObj = Sale.find(sale_id)
shop_details = Shop::ShopDetail
# rounding adjustment
if shop_details.is_rounding_adj
new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
rounding_adj = new_total-saleObj.grand_total
saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj)
end
saleObj = Sale.find(sale_id) saleObj = Sale.find(sale_id)
sale_payment = SalePayment.new sale_payment = SalePayment.new
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "master") @status, @sale = sale_payment.process_payment(saleObj, @user, cash, "master")

View File

@@ -44,6 +44,7 @@ class Origami::MpuController < BaseOrigamiController
saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj) saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj)
end end
saleObj = Sale.find(sale_id)
sale_payment = SalePayment.new sale_payment = SalePayment.new
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "mpu") @status, @sale = sale_payment.process_payment(saleObj, @user, cash, "mpu")
end end

View File

@@ -43,6 +43,7 @@ class Origami::VisaController < BaseOrigamiController
saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj) saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj)
end end
saleObj = Sale.find(sale_id)
#end rounding adjustment #end rounding adjustment
sale_payment = SalePayment.new sale_payment = SalePayment.new
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "visa") @status, @sale = sale_payment.process_payment(saleObj, @user, cash, "visa")

View File

@@ -1,42 +1,48 @@
if @zones if @zones
json.array! @zones do |zone| json.array! @zones do |zone|
json.id zone.id if zone.is_active
json.name zone.name json.id zone.id
#List all tables json.name zone.name
json.tables zone.tables do |table| #List all tables
json.tables zone.tables do |table|
if table.is_active
json.id table.id
json.name table.name
json.status table.status
json.zone_id table.zone_id #Add this zone_id to keep data structure consistance
json.current_booking table.get_current_booking.booking_id rescue ""
end
end
json.rooms zone.rooms do |room|
if room.is_active
json.id room.id
json.name room.name
json.status room.status
json.zone_id room.zone_id #Add this zone_id to keep data structure consistance
json.current_booking room.get_current_booking.booking_id rescue ""
end
end
end
end
else #list all tables and rooms with out zones
json.tables @all_tables do |table|
if table.is_active
json.id table.id json.id table.id
json.name table.name json.name table.name
json.status table.status json.status table.status
json.zone_id table.zone_id #Add this zone_id to keep data structure consistance json.zone_id table.zone_id #Add this zone_id to keep data structure consistance
json.current_booking table.get_current_booking.booking_id rescue "" json.current_booking table.get_current_booking.booking_id rescue ""
end end
end
json.rooms zone.rooms do |room| json.rooms @all_rooms do |room|
if room.is_active
json.id room.id json.id room.id
json.name room.name json.name room.name
json.status room.status json.status room.status
json.zone_id room.zone_id #Add this zone_id to keep data structure consistance json.zone_id room.zone_id #Add this zone_id to keep data structure consistance
json.current_booking room.get_current_booking.booking_id rescue "" json.current_booking room.get_current_booking.booking_id rescue ""
end end
end
else #list all tables and rooms with out zones
json.tables @all_tables do |table|
json.id table.id
json.name table.name
json.status table.status
json.zone_id table.zone_id #Add this zone_id to keep data structure consistance
json.current_booking table.get_current_booking.booking_id rescue ""
end
json.rooms @all_rooms do |room|
json.id room.id
json.name room.name
json.status room.status
json.zone_id room.zone_id #Add this zone_id to keep data structure consistance
json.current_booking room.get_current_booking.booking_id rescue ""
end end
end end