Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into adminbsb_ui_changes

This commit is contained in:
phyusin
2017-12-21 18:13:35 +06:30
5 changed files with 18 additions and 11 deletions

View File

@@ -25,6 +25,7 @@ class Origami::HomeController < BaseOrigamiController
@shop = Shop::ShopDetail
@membership = MembershipSetting::MembershipSetting
@payment_methods = PaymentMethodSetting.all
@dining.bookings.active.each do |booking|
if booking.sale_id.nil? && booking.booking_status != 'moved'
@order_items = Array.new

View File

@@ -30,9 +30,10 @@ class Origami::PaymentsController < BaseOrigamiController
# rounding adjustment
if shop_details.is_rounding_adj
a = sale_data.grand_total % 25
b = sale_data.grand_total / 25
a = sale_data.grand_total % 25 # Modulus
b = sale_data.grand_total / 25 # Division
#not calculate rounding if modulus is 0 and division is even
#calculate rounding if modulus is zero or not zero and division are not even
if (a != 0.0 && b%2 != 0.0) || (a==0.0 && b%2 !=0)
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
rounding_adj = new_total-sale_data.grand_total
@@ -74,8 +75,10 @@ class Origami::PaymentsController < BaseOrigamiController
# rounding adjustment
if shop_details.is_rounding_adj
a = saleObj.grand_total % 25
b = saleObj.grand_total / 25
a = saleObj.grand_total % 25 # Modulus
b = saleObj.grand_total / 25 # Division
#not calculate rounding if modulus is 0 and division is even
#calculate rounding if modulus is zero or not zero and division are not even
if (a != 0.0 && b%2 != 0.0) || (a==0.0 && b%2 !=0)
new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
rounding_adj = new_total-saleObj.grand_total
@@ -299,9 +302,11 @@ class Origami::PaymentsController < BaseOrigamiController
@shop = Shop.find_by_id(1)
if @shop.is_rounding_adj
a = saleObj.grand_total % 25 #
b = saleObj.grand_total / 25 #
if (a != 0.0 && b%2 != 0.0) || (a==0.0 && b%2 !=0)
a = saleObj.grand_total % 25 # Modulus
b = saleObj.grand_total / 25 # Division
#not calculate rounding if modulus is 0 and division is even
#calculate rounding if modulus is zero or not zero and division are not even
if (a != 0.0 && b%2 != 0.0) || (a==0.0 && b%2 !=0)
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)

View File

@@ -22,6 +22,7 @@ class Origami::RoomsController < BaseOrigamiController
@shop = Shop::ShopDetail
@membership = MembershipSetting::MembershipSetting
@payment_methods = PaymentMethodSetting.all
@room.bookings.active.each do |booking|
if booking.sale_id.nil? && booking.booking_status != 'moved'
@order_items = Array.new

View File

@@ -147,7 +147,7 @@ class Customer < ApplicationRecord
response = self.rebat(Sale.find(sale.sale_id))
#record an payment in sale-audit
remark = "UPdate Rebate Response - #{response} for Customer #{sale.customer_id} Sale Id [#{sale.sale_id}]| pay amount -> #{sale.received_amount} "
sale_audit = SaleAudit.record_paymal(sale.sale_id, remark, "CronJob")
sale_audit = SaleAudit.record_paymal(sale.sale_id, remark, 1)
if response["status"] == true
status = sale.update_attributes(rebate_status: "true")

View File

@@ -278,7 +278,7 @@ class SalePayment < ApplicationRecord
#record an payment in sale-audit
remark = "#{membership_data} Redeem- for Customer #{self.sale.customer_id} Sale Id [#{self.sale.sale_id}]| pay amount -> #{self.received_amount} "
sale_audit = SaleAudit.record_paymal(self.sale.sale_id, remark, "Cashier")
sale_audit = SaleAudit.record_paymal(self.sale.sale_id, remark, 1)
if membership_data["status"]==true
self.payment_method = "paypar"
@@ -335,7 +335,7 @@ class SalePayment < ApplicationRecord
#record an payment in sale-audit
remark = "#{response} Rebate- for Customer #{self.sale.customer_id} | Sale Id [#{self.sale.sale_id}]| pay amount -> #{self.received_amount} "
sale_audit = SaleAudit.record_paymal(self.sale.sale_id, remark, "Cashier")
sale_audit = SaleAudit.record_paymal(self.sale.sale_id, remark, 1)
if !response.nil?
if response["status"] == true