update rounding adj
This commit is contained in:
@@ -7,6 +7,15 @@ class Origami::CreditPaymentsController < BaseOrigamiController
|
|||||||
total = sale_data.grand_total
|
total = sale_data.grand_total
|
||||||
@creditcount = 0
|
@creditcount = 0
|
||||||
others = 0
|
others = 0
|
||||||
|
|
||||||
|
@shop = Shop::ShopDetail
|
||||||
|
if @shop.is_rounding_adj
|
||||||
|
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
|
||||||
|
else
|
||||||
|
new_total = sale_data.grand_total
|
||||||
|
end
|
||||||
|
@rounding_adj = new_total-sale_data.grand_total
|
||||||
|
|
||||||
sale_data.sale_payments.each do |sale_payment|
|
sale_data.sale_payments.each do |sale_payment|
|
||||||
if sale_payment.payment_method == "creditnote"
|
if sale_payment.payment_method == "creditnote"
|
||||||
@creditcount = @creditcount + sale_payment.payment_amount
|
@creditcount = @creditcount + sale_payment.payment_amount
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ class Origami::HomeController < BaseOrigamiController
|
|||||||
@rooms = Room.all.active.order('status desc')
|
@rooms = Room.all.active.order('status desc')
|
||||||
@complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
|
@complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
|
||||||
@orders = Order.all.order('date desc')
|
@orders = Order.all.order('date desc')
|
||||||
@shop = Shop.find_by_id(1)
|
@shop = Shop::ShopDetail
|
||||||
|
|
||||||
# @shift = ShiftSale.current_open_shift(current_user.id)
|
# @shift = ShiftSale.current_open_shift(current_user.id)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -8,6 +8,15 @@ class Origami::JcbController < BaseOrigamiController
|
|||||||
total = sale_data.grand_total
|
total = sale_data.grand_total
|
||||||
@jcbcount = 0
|
@jcbcount = 0
|
||||||
others = 0
|
others = 0
|
||||||
|
|
||||||
|
@shop = Shop::ShopDetail
|
||||||
|
if @shop.is_rounding_adj
|
||||||
|
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
|
||||||
|
else
|
||||||
|
new_total = sale_data.grand_total
|
||||||
|
end
|
||||||
|
@rounding_adj = new_total-sale_data.grand_total
|
||||||
|
|
||||||
sale_data.sale_payments.each do |sale_payment|
|
sale_data.sale_payments.each do |sale_payment|
|
||||||
if sale_payment.payment_method == "jcb"
|
if sale_payment.payment_method == "jcb"
|
||||||
@jcbcount = @jcbcount + sale_payment.payment_amount
|
@jcbcount = @jcbcount + sale_payment.payment_amount
|
||||||
|
|||||||
@@ -8,6 +8,15 @@ class Origami::MasterController < BaseOrigamiController
|
|||||||
total = sale_data.grand_total
|
total = sale_data.grand_total
|
||||||
@mastercount = 0
|
@mastercount = 0
|
||||||
others = 0
|
others = 0
|
||||||
|
|
||||||
|
@shop = Shop::ShopDetail
|
||||||
|
if @shop.is_rounding_adj
|
||||||
|
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
|
||||||
|
else
|
||||||
|
new_total = sale_data.grand_total
|
||||||
|
end
|
||||||
|
@rounding_adj = new_total-sale_data.grand_total
|
||||||
|
|
||||||
sale_data.sale_payments.each do |sale_payment|
|
sale_data.sale_payments.each do |sale_payment|
|
||||||
if sale_payment.payment_method == "master"
|
if sale_payment.payment_method == "master"
|
||||||
@mastercount = @mastercount + sale_payment.payment_amount
|
@mastercount = @mastercount + sale_payment.payment_amount
|
||||||
|
|||||||
@@ -8,6 +8,14 @@ class Origami::MpuController < BaseOrigamiController
|
|||||||
@mpucount = 0
|
@mpucount = 0
|
||||||
others = 0
|
others = 0
|
||||||
|
|
||||||
|
@shop = Shop::ShopDetail
|
||||||
|
if @shop.is_rounding_adj
|
||||||
|
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
|
||||||
|
else
|
||||||
|
new_total = sale_data.grand_total
|
||||||
|
end
|
||||||
|
@rounding_adj = new_total-sale_data.grand_total
|
||||||
|
|
||||||
sale_data.sale_payments.each do |sale_payment|
|
sale_data.sale_payments.each do |sale_payment|
|
||||||
if sale_payment.payment_method == "mpu"
|
if sale_payment.payment_method == "mpu"
|
||||||
@mpucount = @mpucount + sale_payment.payment_amount
|
@mpucount = @mpucount + sale_payment.payment_amount
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
# Print for First Bill to Customer
|
# Print for First Bill to Customer
|
||||||
unique_code = "ReceiptBillPdf"
|
unique_code = "ReceiptBillPdf"
|
||||||
#shop detail
|
#shop detail
|
||||||
shop_details = Shop.find(1)
|
shop_details = Shop::ShopDetail
|
||||||
# customer= Customer.where('customer_id=' +.customer_id)
|
# customer= Customer.where('customer_id=' +.customer_id)
|
||||||
customer= Customer.find(sale_data.customer_id)
|
customer= Customer.find(sale_data.customer_id)
|
||||||
# get member information
|
# get member information
|
||||||
@@ -54,7 +54,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
|
|
||||||
if(Sale.exists?(sale_id))
|
if(Sale.exists?(sale_id))
|
||||||
saleObj = Sale.find(sale_id)
|
saleObj = Sale.find(sale_id)
|
||||||
shop_details = Shop.find(1)
|
shop_details = Shop::ShopDetail
|
||||||
|
|
||||||
if shop_details.is_rounding_adj
|
if shop_details.is_rounding_adj
|
||||||
new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
|
new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
|
||||||
@@ -121,7 +121,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
@accountable_type = ''
|
@accountable_type = ''
|
||||||
@table_no = ''
|
@table_no = ''
|
||||||
|
|
||||||
@shop = Shop.find_by_id(1)
|
@shop = Shop::ShopDetail
|
||||||
if @shop.is_rounding_adj
|
if @shop.is_rounding_adj
|
||||||
new_total = Sale.get_rounding_adjustment(@sale_data.grand_total)
|
new_total = Sale.get_rounding_adjustment(@sale_data.grand_total)
|
||||||
else
|
else
|
||||||
@@ -205,7 +205,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
customer= Customer.find(saleObj.customer_id)
|
customer= Customer.find(saleObj.customer_id)
|
||||||
|
|
||||||
#shop detail
|
#shop detail
|
||||||
shop_details = Shop.find(1)
|
shop_details = Shop::ShopDetail
|
||||||
# get member information
|
# get member information
|
||||||
rebate = MembershipSetting.find_by_rebate(1)
|
rebate = MembershipSetting.find_by_rebate(1)
|
||||||
if customer.membership_id != nil && rebate
|
if customer.membership_id != nil && rebate
|
||||||
@@ -254,7 +254,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
customer= Customer.find(saleObj.customer_id)
|
customer= Customer.find(saleObj.customer_id)
|
||||||
|
|
||||||
#shop detail
|
#shop detail
|
||||||
shop_details = Shop.find(1)
|
shop_details = Shop::ShopDetail
|
||||||
|
|
||||||
# get printer info
|
# get printer info
|
||||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||||
|
|||||||
@@ -5,24 +5,13 @@ class Origami::RedeemPaymentsController < BaseOrigamiController
|
|||||||
@membership_rebate_balance=0
|
@membership_rebate_balance=0
|
||||||
sale_data = Sale.find_by_sale_id(@sale_id)
|
sale_data = Sale.find_by_sale_id(@sale_id)
|
||||||
|
|
||||||
# limit redeem_amount
|
@shop = Shop::ShopDetail
|
||||||
# rebate_prices = SaleItem.calculate_food_beverage(sale_data.sale_items)
|
if @shop.is_rounding_adj
|
||||||
# nonrebate_prices = sale_data.total_amount - rebate_prices
|
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
|
||||||
# @payparcount = 0
|
else
|
||||||
# others = 0
|
new_total = sale_data.grand_total
|
||||||
# sale_data.sale_payments.each do |sale_payment|
|
end
|
||||||
# if sale_payment.payment_method == "paypar"
|
@rounding_adj = new_total-sale_data.grand_total
|
||||||
# @payparcount = @payparcount + sale_payment.payment_amount
|
|
||||||
# else
|
|
||||||
# others = others + sale_payment.payment_amount
|
|
||||||
# end
|
|
||||||
# end
|
|
||||||
# non_rebate_exceed = others - (nonrebate_prices + sale_data.total_tax)
|
|
||||||
# if non_rebate_exceed < 0
|
|
||||||
# @redeem_prices = rebate_prices - @payparcount
|
|
||||||
# else
|
|
||||||
# @redeem_prices = rebate_prices - @payparcount -non_rebate_exceed
|
|
||||||
# end
|
|
||||||
|
|
||||||
@payparcount = 0
|
@payparcount = 0
|
||||||
others = 0
|
others = 0
|
||||||
|
|||||||
@@ -7,6 +7,15 @@ class Origami::VisaController < BaseOrigamiController
|
|||||||
total = sale_data.grand_total
|
total = sale_data.grand_total
|
||||||
@visacount = 0
|
@visacount = 0
|
||||||
others = 0
|
others = 0
|
||||||
|
|
||||||
|
@shop = Shop::ShopDetail
|
||||||
|
if @shop.is_rounding_adj
|
||||||
|
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
|
||||||
|
else
|
||||||
|
new_total = sale_data.grand_total
|
||||||
|
end
|
||||||
|
@rounding_adj = new_total-sale_data.grand_total
|
||||||
|
|
||||||
sale_data.sale_payments.each do |sale_payment|
|
sale_data.sale_payments.each do |sale_payment|
|
||||||
if sale_payment.payment_method == "visa"
|
if sale_payment.payment_method == "visa"
|
||||||
@visacount = @visacount + sale_payment.payment_amount
|
@visacount = @visacount + sale_payment.payment_amount
|
||||||
|
|||||||
@@ -7,6 +7,15 @@ class Origami::VoucherController < BaseOrigamiController
|
|||||||
total = sale_data.grand_total
|
total = sale_data.grand_total
|
||||||
@vouchercount = 0
|
@vouchercount = 0
|
||||||
others = 0
|
others = 0
|
||||||
|
|
||||||
|
@shop = Shop::ShopDetail
|
||||||
|
if @shop.is_rounding_adj
|
||||||
|
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
|
||||||
|
else
|
||||||
|
new_total = sale_data.grand_total
|
||||||
|
end
|
||||||
|
@rounding_adj = new_total-sale_data.grand_total
|
||||||
|
|
||||||
sale_data.sale_payments.each do |sale_payment|
|
sale_data.sale_payments.each do |sale_payment|
|
||||||
if sale_payment.payment_method == "voucher"
|
if sale_payment.payment_method == "voucher"
|
||||||
@vouchercount = @vouchercount + sale_payment.payment_amount
|
@vouchercount = @vouchercount + sale_payment.payment_amount
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
class Shop < ApplicationRecord
|
class Shop < ApplicationRecord
|
||||||
|
ShopDetail = Shop.find_by_id(1)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
<label>You can pay up to </label>
|
<label>You can pay up to </label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||||
|
<%@can_credit = @can_credit +@rounding_adj%>
|
||||||
<input type="text" name="validamount" id="validamount" class="form-control" readonly="" value="<%=@can_credit %>" data-member-value="">
|
<input type="text" name="validamount" id="validamount" class="form-control" readonly="" value="<%=@can_credit %>" data-member-value="">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||||
<label>You can pay up to </label>
|
<label>You can pay up to </label>
|
||||||
|
<%@can_jcb = @can_jcb +@rounding_adj%>
|
||||||
<input type="text" name="validamount" id="validamount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@can_jcb %>" data-member-value="">
|
<input type="text" name="validamount" id="validamount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@can_jcb %>" data-member-value="">
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||||
<label>You can pay up to </label>
|
<label>You can pay up to </label>
|
||||||
|
<%@can_master = @can_master +@rounding_adj%>
|
||||||
<input type="text" name="validamount" id="validamount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@can_master %>" data-member-value="">
|
<input type="text" name="validamount" id="validamount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@can_master %>" data-member-value="">
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||||
<label>You can pay up to </label>
|
<label>You can pay up to </label>
|
||||||
|
<%@can_mpu = @can_mpu +@rounding_adj%>
|
||||||
<input type="text" name="validamount" id="validamount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%= @can_mpu %>" data-member-value="">
|
<input type="text" name="validamount" id="validamount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%= @can_mpu %>" data-member-value="">
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
|
|||||||
@@ -98,7 +98,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="charges-name"><strong>Grand Total</strong></td>
|
<td class="charges-name"><strong>Grand Total</strong></td>
|
||||||
<td class="item-attr"><strong><span><%=@sale_data.grand_total rescue 0%></span></strong></td>
|
<td class="item-attr"><strong><span><%=@sale_data.grand_total+ @rounding_adj rescue 0%></span></strong></td>
|
||||||
</tr>
|
</tr>
|
||||||
<%if @balance > 0%>
|
<%if @balance > 0%>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -121,7 +121,7 @@
|
|||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<div class="row m-l-5 m-r-5">
|
<div class="row m-l-5 m-r-5">
|
||||||
<div class="col-md-8"><strong>Amount Due</strong></div>
|
<div class="col-md-8"><strong>Amount Due</strong></div>
|
||||||
<div class="col-md-4"><strong><span id="amount_due"><%= @sale_data.grand_total %></span></strong></div>
|
<div class="col-md-4"><strong><span id="amount_due"><%= @sale_data.grand_total + @rounding_adj rescue 0%></span></strong></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row payment cash-color p-l-5 p-r-5">
|
<div class="row payment cash-color p-l-5 p-r-5">
|
||||||
@@ -219,7 +219,7 @@
|
|||||||
<!-- <br> -->
|
<!-- <br> -->
|
||||||
<div class="row m-l-5 m-r-5">
|
<div class="row m-l-5 m-r-5">
|
||||||
<div class="col-md-8"><strong>Balance</strong></div>
|
<div class="col-md-8"><strong>Balance</strong></div>
|
||||||
<div class="col-md-4"><strong><span id='balance'><%= @sale_data.grand_total %></span></strong></div>
|
<div class="col-md-4"><strong><span id='balance'><%= @sale_data.grand_total+ @rounding_adj rescue 0 %></span></strong></div>
|
||||||
</div>
|
</div>
|
||||||
<!-- <br> -->
|
<!-- <br> -->
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||||
<label class="">You can redeem up to </label>
|
<label class="">You can redeem up to </label>
|
||||||
|
<%@redeem_prices = @redeem_prices +@rounding_adj%>
|
||||||
<input type="text" name="" id="redeemamt" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%= @redeem_prices %>" data-value="<%=@sale_id %>" data-member-value="<%= @membership_id %>">
|
<input type="text" name="" id="redeemamt" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%= @redeem_prices %>" data-value="<%=@sale_id %>" data-member-value="<%= @membership_id %>">
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||||
<label>You can pay up to </label>
|
<label>You can pay up to </label>
|
||||||
|
<%@can_visa = @can_visa +@rounding_adj%>
|
||||||
<input type="text" name="validamount" id="validamount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@can_visa %>" data-member-value="">
|
<input type="text" name="validamount" id="validamount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@can_visa %>" data-member-value="">
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
|
|||||||
Reference in New Issue
Block a user