Payment Vs Tax
This commit is contained in:
@@ -4,7 +4,25 @@ class Origami::RedeemPaymentsController < BaseOrigamiController
|
||||
payment_method = params[:payment_method]
|
||||
@membership_rebate_balance=0
|
||||
sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
@food_prices, @beverage_prices = SaleItem.calculate_food_beverage(sale_data.sale_items)
|
||||
|
||||
# limit redeem_amount
|
||||
food_prices, beverage_prices = SaleItem.calculate_food_beverage(sale_data.sale_items)
|
||||
@payparcount = 0
|
||||
others = 0
|
||||
sale_data.sale_payments.each do |sale_payment|
|
||||
if sale_payment.payment_method == "paypar"
|
||||
@payparcount = @payparcount + sale_payment.payment_amount
|
||||
else
|
||||
others = others + sale_payment.payment_amount
|
||||
end
|
||||
end
|
||||
is_bervage_exceed = others - (beverage_prices + sale_data.total_tax)
|
||||
if is_bervage_exceed < 0
|
||||
@food_prices = food_prices - @payparcount
|
||||
else
|
||||
@food_prices = food_prices - @payparcount -is_bervage_exceed
|
||||
end
|
||||
|
||||
if sale_data
|
||||
if sale_data.customer_id
|
||||
customer_data= Customer.find_by_customer_id(sale_data.customer_id)
|
||||
|
||||
@@ -253,6 +253,6 @@ function update_balance(){
|
||||
var amount_due = $('#amount_due').text();
|
||||
var total = parseFloat(cash) + parseFloat(credit) + parseFloat(card)
|
||||
var result = amount_due - total
|
||||
$('#balance').text(result);
|
||||
$('#balance').text(result.toFixed(2));
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -18,8 +18,11 @@
|
||||
<hr>
|
||||
</div>
|
||||
</div>
|
||||
<p class="">You can rebate upto <span style="color:red;" id="food_prices"><%= @food_prices %></span></p>
|
||||
</div>
|
||||
<% if @payparcount > 0 %>
|
||||
<p class="">Last time rebate amount is <%= @payparcount %></p>
|
||||
<% end %>
|
||||
<p class="">You can rebate upto <span style="color:red;" id="food_prices"><%= @food_prices %></span></p>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-7 col-md-7 col-sm-7">
|
||||
@@ -117,7 +120,7 @@ $("#redeem").click(function(){
|
||||
valid_amount = $("#valid_amount").val();
|
||||
sale_id = $("#valid_amount").attr('data-value');
|
||||
membership_id = $("#valid_amount").attr('data-member-value');
|
||||
redeem_amount = parseInt($("#used_amount").text());
|
||||
redeem_amount = parseFloat($("#used_amount").text());
|
||||
if(redeem_amount<=0 ){
|
||||
alert("Please type valid amount");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user