Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into crm
This commit is contained in:
@@ -4,7 +4,25 @@ class Origami::RedeemPaymentsController < BaseOrigamiController
|
|||||||
payment_method = params[:payment_method]
|
payment_method = params[:payment_method]
|
||||||
@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)
|
||||||
@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
|
||||||
if sale_data.customer_id
|
if sale_data.customer_id
|
||||||
customer_data= Customer.find_by_customer_id(sale_data.customer_id)
|
customer_data= Customer.find_by_customer_id(sale_data.customer_id)
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
<div id="order-title">
|
<div id="order-title">
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width:55%;"><strong>Receipt No : <%=@sale_data.receipt_no rescue ' '%></strong></td>
|
<td style="width:50%;"><strong>Receipt No : <%=@sale_data.receipt_no rescue ' '%></strong></td>
|
||||||
<td style="width:45%;"><strong>Receipt Date : <%=@sale_data.receipt_date.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></strong></td>
|
<td style="width:50%;"><strong>Receipt Date : <%=@sale_data.receipt_date.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></strong></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><strong>Table No</strong> <% if @sale_data%>- <%=@sale_data.receipt_no%><% end %></td>
|
<td><strong>Table No</strong> <% if @sale_data%>- <%=@sale_data.receipt_no%><% end %></td>
|
||||||
@@ -253,6 +253,6 @@ function update_balance(){
|
|||||||
var amount_due = $('#amount_due').text();
|
var amount_due = $('#amount_due').text();
|
||||||
var total = parseFloat(cash) + parseFloat(credit) + parseFloat(card)
|
var total = parseFloat(cash) + parseFloat(credit) + parseFloat(card)
|
||||||
var result = amount_due - total
|
var result = amount_due - total
|
||||||
$('#balance').text(result);
|
$('#balance').text(result.toFixed(2));
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -5,21 +5,24 @@
|
|||||||
<div class="rebate-form">
|
<div class="rebate-form">
|
||||||
<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="col-lg-4 col-md-4 col-sm-4">Valid Redeem Amount</label>
|
<label class="col-lg-4 col-md-4 col-sm-4">Valid Rebate Amount</label>
|
||||||
<input type="text" name="valid_amount" id="valid_amount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@membership_rebate_balance%>" data-value="<%=@sale_id %>" data-member-value="<%= @membership_id %>">
|
<input type="text" name="valid_amount" id="valid_amount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@membership_rebate_balance%>" data-value="<%=@sale_id %>" data-member-value="<%= @membership_id %>">
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
</div>
|
</div>
|
||||||
<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="col-lg-4 col-md-4 col-sm-4">Used Amount</label>
|
<label class="col-lg-4 col-md-4 col-sm-4">Redeem Amount</label>
|
||||||
<div id="used_amount" class="form-control col-lg-7 col-md-7 col-sm-7">0.0</div>
|
<div id="used_amount" class="form-control col-lg-7 col-md-7 col-sm-7">0.0</div>
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<p class="">You can rebate upto <span style="color:red;" id="food_prices"><%= @food_prices %></span></p>
|
|
||||||
</div>
|
</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>
|
||||||
|
|
||||||
<div class="col-lg-7 col-md-7 col-sm-7">
|
<div class="col-lg-7 col-md-7 col-sm-7">
|
||||||
@@ -117,7 +120,7 @@ $("#redeem").click(function(){
|
|||||||
valid_amount = $("#valid_amount").val();
|
valid_amount = $("#valid_amount").val();
|
||||||
sale_id = $("#valid_amount").attr('data-value');
|
sale_id = $("#valid_amount").attr('data-value');
|
||||||
membership_id = $("#valid_amount").attr('data-member-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 ){
|
if(redeem_amount<=0 ){
|
||||||
alert("Please type valid amount");
|
alert("Please type valid amount");
|
||||||
|
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ Rails.application.routes.draw do
|
|||||||
|
|
||||||
get 'sale/:sale_id/payment/others_payment/MPU' => "mpu#index"
|
get 'sale/:sale_id/payment/others_payment/MPU' => "mpu#index"
|
||||||
post 'payment/mpu' => "mpu#create"
|
post 'payment/mpu' => "mpu#create"
|
||||||
get 'sale/:sale_id/payment/others_payment/REDEEM' => "redeem_payments#index"
|
get 'sale/:sale_id/payment/others_payment/Redeem' => "redeem_payments#index"
|
||||||
|
|
||||||
#---------Add Customer --------------#
|
#---------Add Customer --------------#
|
||||||
#resources :customers
|
#resources :customers
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ member_actions= MembershipAction.create([{membership_type:"get_account_balance",
|
|||||||
|
|
||||||
payment_methods = PaymentMethodSetting.create({payment_method:"MPU",gateway_url: "http//192.168.1.47:3006"})
|
payment_methods = PaymentMethodSetting.create({payment_method:"MPU",gateway_url: "http//192.168.1.47:3006"})
|
||||||
|
|
||||||
payment_methods = PaymentMethodSetting.create({payment_method:"REDEEM",gateway_url: "http://192.168.1.47:3006",merchant_account_id:"vWSsseoZCzxd6xcNf_uS"})
|
payment_methods = PaymentMethodSetting.create({payment_method:"Redeem",gateway_url: "http://192.168.1.47:3006",merchant_account_id:"vWSsseoZCzxd6xcNf_uS"})
|
||||||
|
|
||||||
|
|
||||||
# shop = Shop.create(
|
# shop = Shop.create(
|
||||||
|
|||||||
Reference in New Issue
Block a user