other payments
This commit is contained in:
5
app/views/origami/others_payments/create.json.jbuilder
Normal file
5
app/views/origami/others_payments/create.json.jbuilder
Normal file
@@ -0,0 +1,5 @@
|
||||
if(@status)
|
||||
json.status @status
|
||||
else
|
||||
json.status false
|
||||
end
|
||||
@@ -19,7 +19,7 @@
|
||||
<div class="row clearfix"></div>
|
||||
<% end %>
|
||||
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
|
||||
<div class="purple others-payment text-center m-l-10 m-b-10 <%= payment_method.payment_method %>" data-type="<%= payment_method.payment_method %>" id="<%= payment_method.payment_method %>" data-url="<%=payment_method.gateway_url%>" data-sale-id="<%= @sale_id%>"><%= payment_method.payment_method %></div>
|
||||
<div class="purple others-payment text-center m-l-10 m-b-10 <%= payment_method.payment_method %>" data-type="<%= payment_method.payment_method.parameterize %>" id="<%= payment_method.payment_method %>" data-url="<%=payment_method.gateway_url%>" data-sale-id="<%= @sale_id%>"><%= payment_method.payment_method %></div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
@@ -45,7 +45,7 @@
|
||||
payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment");
|
||||
if(payment_type) {
|
||||
$(".others-payment").hide();
|
||||
$(payment_type).each(function(i){
|
||||
$(payment_type).each(function(i){
|
||||
$("."+payment_type[i]).show();
|
||||
});
|
||||
}
|
||||
|
||||
279
app/views/origami/others_payments/new.html.erb
Normal file
279
app/views/origami/others_payments/new.html.erb
Normal file
@@ -0,0 +1,279 @@
|
||||
<div class="container-fluid">
|
||||
<div id="loading_wrapper" style="display:none;">
|
||||
<div id="loading"></div>
|
||||
</div>
|
||||
<!-- <div class="page-header">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="<%=origami_root_path %>"><%= t :home %></a></li>
|
||||
<li class="breadcrumb-item"><a href="/origami/sale/<%=@sale_id %>/payment"><%= t("views.btn.payment") %></a></li>
|
||||
<li class="breadcrumb-item active"><%= t("views.btn.mpu") %></li>
|
||||
<span class="float-right">
|
||||
<%= link_to t('.back',:default => t("views.btn.back")),'/origami/sale/'+@sale_id+'/payment/others_payment'%>
|
||||
</span>
|
||||
</ol>
|
||||
</div> -->
|
||||
<div class="row">
|
||||
<div class="col-lg-5 col-md-5 col-sm-5">
|
||||
<span class="hidden" id="membership_id"><%= @membership_id%></span>
|
||||
<span class="hidden" id="member_discount"><%= @member_discount%></span>
|
||||
<span class="hidden" id="sub-total"><%= @sub_total%></span>
|
||||
<div class="card" style="margin-top:10px;padding:20px;">
|
||||
<div class="card-block">
|
||||
<div class="rebate-form">
|
||||
<% if @bank_integration == '1' %>
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label for="com_port_name">Select Device</label>
|
||||
<select id="com_port_name" name="com_port_name" class="form-control select col-lg-7 col-md-7 col-sm-7">
|
||||
|
||||
</select>
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label>You can pay up to </label>
|
||||
<%@can_paid = @can_paid + @rounding_adj%>
|
||||
<input type="text" name="validamount" id="validamount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%= @can_paid %>" data-member-value="">
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<% if @paid_amount != 0 %>
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label><%= "Recent #{@payment_method} paid amount" %></label>
|
||||
<input type="text" name="" id="" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@paid_amount %>" data-member-value="">
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label>Reference Number</label>
|
||||
<input type="text" name="reference_no" id="reference_no" class="form-control col-lg-7 col-md-7 col-sm-7" value="" data-value="<%=@sale_id %>" data-member-value="">
|
||||
<br><span id="reference_no_Err" style="color:red;"></span>
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label>Amount</label>
|
||||
<div id="amount" class="form-control col-lg-7 col-md-7 col-sm-7">0.0</div>
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6 col-md-6 col-sm-6" style="margin-top:;">
|
||||
<div class=" m-t-10 p-l-20">
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<div class="row bottom">
|
||||
<div class="col-md-4 cashier_number border-left" data-value="1" data-type="num">1</div>
|
||||
<div class="col-md-4 cashier_number border-left" data-value="2" data-type="num">2</div>
|
||||
<div class="col-md-4 cashier_number border-left" data-value="3" data-type="num">3</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class="col-md-4 cashier_number border-left" data-value="4" data-type="num">4</div>
|
||||
<div class="col-md-4 cashier_number border-left" data-value="5" data-type="num">5</div>
|
||||
<div class="col-md-4 cashier_number border-left" data-value="6" data-type="num">6</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class="col-md-4 cashier_number border-left" data-value="7" data-type="num">7</div>
|
||||
<div class="col-md-4 cashier_number border-left" data-value="8" data-type="num">8</div>
|
||||
<div class="col-md-4 cashier_number border-left" data-value="9" data-type="num">9</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class="col-md-4 cashier_number border-left" data-value="0" data-type="num">0</div>
|
||||
<div class="col-md-4 cashier_number border-left" data-value="." data-type="num">.</div>
|
||||
<div class="col-md-4 cashier_number border-left" data-value="00" data-type="num">00</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class="col-md-4 cashier_number border-left green" data-type="nett" >Nett</div>
|
||||
<div class="col-md-4 cashier_number red border-left" data-type="del">Del</div>
|
||||
<div class="col-md-4 cashier_number orange border-left" data-type="clr">Clr</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<div class="row bottom m-l-5">
|
||||
<div class="cashier_number long border-left" data-value="1000" data-type="add">1000</div>
|
||||
<div class="cashier_number long left" data-value="3000" data-type="add">3000</div>
|
||||
</div>
|
||||
<div class="row bottom m-l-5">
|
||||
<div class="cashier_number long border-left" data-value="5000" data-type="add">5000</div>
|
||||
<div class="cashier_number long left" data-value="10000" data-type="add">10000</div>
|
||||
</div>
|
||||
<div class="row bottom m-l-5">
|
||||
<div class="pay purple left" id="pay">Pay</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-1 col-lg-1 col-sm-1">
|
||||
<button type="button" class="btn bg-default btn-block" id="back"><i class="material-icons m-t--5">reply</i> Back </button>
|
||||
|
||||
</div>
|
||||
|
||||
<input type="hidden" id="sale_id" value="<%= @sale_id %>">
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var cashier_type = "<%= @cashier_type %>";
|
||||
$(document).ready(function() {
|
||||
setHeaderBreadCrumb('/ <%= "#{@payment_method} PAYMENT" %>');
|
||||
var sale_id = "<%= @sale_id %>";
|
||||
var bank_integration = "<%= @bank_integration %>";
|
||||
|
||||
if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){}
|
||||
else {
|
||||
$('#validamount').attr("value",parseFloat("<%= @can_paid %>") - parseFloat(localStorage.getItem("cash")));
|
||||
}
|
||||
|
||||
if(bank_integration == '1'){
|
||||
if(typeof code2lab != 'undefined'){
|
||||
code2lab.getCommPorts(); //get comportlists from jade
|
||||
}else{
|
||||
swal({
|
||||
title: 'Oops',
|
||||
text: '<%= "#{@payment_method} is not available in here!" %>',
|
||||
type: 'error',
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
var url_param = "payment";
|
||||
if(location.pathname.includes("credit_payment")){
|
||||
url_param = "credit_payment";
|
||||
}
|
||||
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type+ "/"+url_param+"/others_payment";
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('click', '.cashier_number', function(event){
|
||||
console.log("click");
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
if(event.handled !== true) {
|
||||
var original_value;
|
||||
original_value = $('#amount').text();
|
||||
|
||||
var input_value = $(this).attr("data-value");
|
||||
|
||||
var input_type = $(this).attr("data-type");
|
||||
switch (input_type) {
|
||||
case 'num':
|
||||
if (original_value == "0.0"){
|
||||
$('#amount').text(input_value);
|
||||
}else{
|
||||
$('#amount').append(input_value);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'add':
|
||||
var input_value = $(this).attr("data-value");
|
||||
amount = parseInt(input_value) + parseInt(original_value);
|
||||
$('#amount').html(amount);
|
||||
|
||||
break;
|
||||
case 'clr':
|
||||
$('#amount').html("0.0");
|
||||
break;
|
||||
case 'del' :
|
||||
var cash=$('#amount').text() > 0 ? $('#amount').text() : 0;
|
||||
$('#amount').text((cash > 0 && cash.substr(0,cash.length-1) > 0) ? cash.substr(0,cash.length-1) : 0);
|
||||
break;
|
||||
case 'nett':
|
||||
var remain_amount = $('#validamount').val();
|
||||
$('#amount').text(remain_amount);
|
||||
break;
|
||||
|
||||
}
|
||||
event.handled = true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$('#pay').on('click',function(){
|
||||
var amount = $('#amount').text();
|
||||
var reference_no = $('#reference_no').val();
|
||||
var sale_id = "<%= @sale_id %>";
|
||||
var receipt_no = "<%= @receipt_no %>";
|
||||
var bank_integration = "<%= @bank_integration %>";
|
||||
var cashier_type = "<%= @cashier_type %>";
|
||||
$("#reference_no_Err").html("");
|
||||
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
|
||||
$(this).off("click");
|
||||
//start member discount 5% by pay card
|
||||
// var sub_total = $('#sub-total').text();
|
||||
// var member_id = $('#membership_id').text();
|
||||
// var member_discount = $('#member_discount').text();
|
||||
// if (member_id && member_discount) {
|
||||
// $.ajax({
|
||||
// type: "POST",
|
||||
// url: "/origami/" + sale_id + "/member_discount",
|
||||
// data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':true },
|
||||
// success:function(result){
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//end member discount
|
||||
if(bank_integration == '1'){
|
||||
pay_withBank("SALE", "<%= @payment_method %>", amount, sale_id, receipt_no,cashier_type);
|
||||
}else{
|
||||
if(location.pathname.includes("credit_payment")){
|
||||
var url = "<%= origami_credit_payment_path(method: @payment_method.parameterize) %>";
|
||||
}else{
|
||||
var url = "<%= origami_payment_path(method: @payment_method.parameterize) %>";
|
||||
}
|
||||
$.ajax({type: "POST",
|
||||
url: url,
|
||||
data: "amount="+ amount + "&sale_id="+ sale_id,
|
||||
success:function(result){
|
||||
if(result){
|
||||
swal({
|
||||
title: "Information!",
|
||||
text: "Payment Successfully",
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
var url_param = "payment";
|
||||
if(location.pathname.includes("credit_payment")){
|
||||
url_param = "credit_payment";
|
||||
}
|
||||
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type+ "/"+url_param;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}else{
|
||||
if (amount>0) {
|
||||
swal ( "Oops" , "Paid Amount is over!" , "error" );
|
||||
}else{
|
||||
swal ( "Oops" , "Enter Amount!" , "error" );
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('#back').on('click',function(){
|
||||
var url_param = "payment";
|
||||
if(location.pathname.includes("credit_payment")){
|
||||
url_param = "credit_payment";
|
||||
}
|
||||
window.location.href = '/origami/sale/'+'<%= @sale_id %>'+'/<%= @cashier_type %>/'+url_param;
|
||||
// window.location.href = '/origami/sale/' + sale_id + "/cashier/payment";
|
||||
});
|
||||
</script>
|
||||
@@ -9,24 +9,24 @@
|
||||
<div class="card-header m-l-5 m-r-5">
|
||||
<div id="order-title">
|
||||
<div class="row p-l-5 p-r-5">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6"><strong>Receipt No :</strong> <span id="receipt_no"><%=@sale_data.receipt_no rescue ' '%></span></div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 text-left"><strong>Receipt Date :</strong> <span id="receipt_date"><%=@sale_data.receipt_date.utc.getlocal.strftime("%d/%m/%Y-%I:%M %p") rescue '-' %></span></div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6"><strong>Receipt No :</strong> <span id="receipt_no"><%=@sale.receipt_no rescue ' '%></span></div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 text-left"><strong>Receipt Date :</strong> <span id="receipt_date"><%=@sale.receipt_date.utc.getlocal.strftime("%d/%m/%Y-%I:%M %p") rescue '-' %></span></div>
|
||||
</div>
|
||||
<div class="row p-l-5 p-r-5">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6"><strong>Table No :</strong> <%=@table_no%></div>
|
||||
<span class="hidden" id="dining"><%if !@dining.nil?%><%= @dining.id%><%end%></span>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 text-left"><strong>Sale ID :</strong> <span id="sale_id"><% if @sale_data %><%=@sale_data.sale_id %><% end %></span></div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 text-left"><strong>Sale ID :</strong> <span id="sale_id"><% if @sale %><%=@sale.sale_id %><% end %></span></div>
|
||||
</div>
|
||||
|
||||
<div class="row p-l-5 p-r-5">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<strong>Customer :</strong>
|
||||
<% if @cashier_type == 'quick_service' || @cashier_type == 'food_court' %>
|
||||
<button type="button" class="btn bg-info waves-effect" id='customer_name'><%= @sale_data.customer.name%></button>
|
||||
<button type="button" class="btn bg-info waves-effect" id='customer_name'><%= @sale.customer.name%></button>
|
||||
<% else %>
|
||||
<span id="customer_name"><%= @sale_data.customer.name%></span>
|
||||
<span id="customer_name"><%= @sale.customer.name%></span>
|
||||
<% end %>
|
||||
<span class="hidden" id="membership_id"><%= @sale_data.customer.membership_id%></span>
|
||||
<span class="hidden" id="membership_id"><%= @sale.customer.membership_id%></span>
|
||||
<span class="hidden" id="member_discount"><%= @member_discount%></span></div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 text-left"><strong>Checkin Time : </strong> <%if !@checkin_time.nil?%><%= @checkin_time.utc.getlocal.strftime("%I:%M %p") %>
|
||||
<%end%></div>
|
||||
@@ -57,7 +57,7 @@
|
||||
<% sub_total = 0
|
||||
count = 0
|
||||
%>
|
||||
<% @sale_data.sale_items.each do |sale_item|
|
||||
<% @sale.sale_items.each do |sale_item|
|
||||
count += 1
|
||||
%>
|
||||
|
||||
@@ -82,12 +82,12 @@
|
||||
<td class="item-attr"><strong><span id="sub-total"><%=number_format(sub_total, precision: precision.to_i)%></span></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<%if @sale_data.discount_type == 'member_discount'%>
|
||||
<%if @sale.discount_type == 'member_discount'%>
|
||||
<td class="charges-name"><strong>Member Discount:</strong></td>
|
||||
<%else%>
|
||||
<td class="charges-name"><strong>(Discount)</strong></td>
|
||||
<%end%>
|
||||
<td class="item-attr"><strong><span>(<%= number_format(@sale_data.total_discount, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %>)</span></strong></td>
|
||||
<td class="item-attr"><strong><span>(<%= number_format(@sale.total_discount, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %>)</span></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name">
|
||||
@@ -104,23 +104,23 @@
|
||||
<% else %>
|
||||
No Tax
|
||||
<% end %></strong><br>
|
||||
<%if @sale_payment.nil? && @changable_tax %>
|
||||
<%if @sale_payment && @changable_tax %>
|
||||
<% if @current_user.role == 'cashier' %>
|
||||
<button class="btn btn-link waves-effect bg-info access_modal" data-type = 'change_tax' >Change Tax</button>
|
||||
<button class="btn btn-link waves-effect bg-info access_modal" data-type = 'change_tax' >Change Tax</button>
|
||||
<% else %>
|
||||
<button class="btn btn-link waves-effect bg-info change_tax">Change Tax</button>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="item-attr"><strong><span id="total_tax"><%= number_format(@sale_data.total_tax, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i )%></span></strong></td>
|
||||
<td class="item-attr"><strong><span id="total_tax"><%= number_format(@sale.total_tax, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i )%></span></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Rounding Adj:</strong></td>
|
||||
<td class="item-attr"><strong><%= number_format(@sale_data.rounding_adjustment, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i )%></strong></td>
|
||||
<td class="item-attr"><strong><%= number_format(@sale.rounding_adjustment, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i )%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Grand Total</strong></td>
|
||||
<td class="item-attr"><strong><span><%= number_format(@sale_data.grand_total, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i )%></span></strong></td>
|
||||
<td class="item-attr"><strong><span><%= number_format(@sale.grand_total, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i )%></span></strong></td>
|
||||
</tr>
|
||||
<%if @balance > 0%>
|
||||
<tr>
|
||||
@@ -156,22 +156,14 @@
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<div class="row m-l-5 m-r-5">
|
||||
<div class="col-md-8"><strong class='amount_balance'>Amount Due <% if !@sale_payment.nil? %>( Credit )<% end %></strong></div>
|
||||
<div class="col-md-8"><strong class='amount_balance'>Amount Due <% if !@sale_payment %>( Credit )<% end %></strong></div>
|
||||
<div class="col-md-4">
|
||||
<strong>
|
||||
<span id="grand_total" class="hidden">
|
||||
<% if @sale_payment.nil? %>
|
||||
<%= number_format(@sale_data.grand_total, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i)%>
|
||||
<% else %>
|
||||
<%= number_format(@sale_payment[0].payment_amount, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i)%>
|
||||
<% end %>
|
||||
<%= number_format(@amount_due, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i)%>
|
||||
</span>
|
||||
<span id="amount_due">
|
||||
<% if @sale_payment.nil? %>
|
||||
<%= number_format(@sale_data.grand_total, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %>
|
||||
<% else %>
|
||||
<%= number_format(@sale_payment[0].payment_amount, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i)%>
|
||||
<% end %>
|
||||
<%= number_format(@amount_due, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i)%>
|
||||
</span>
|
||||
</strong>
|
||||
</div>
|
||||
@@ -183,7 +175,7 @@
|
||||
<%= number_format(@cash, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %>
|
||||
</div>
|
||||
</div>
|
||||
<% if @sale_payment.nil? && @cashier_type != "food_court" %>
|
||||
<% if @sale_payment && @cashier_type != "food_court" %>
|
||||
<div class="row payment credit-color p-l-5 p-r-5" id="credit_payment" >
|
||||
<div class="col-md-8">Credit</div>
|
||||
<div class="col-md-4" id="credit"><%= number_format(@credit, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %></div>
|
||||
@@ -191,155 +183,25 @@
|
||||
<% else %>
|
||||
<div class="col-md-4 hidden" id="credit">0</div>
|
||||
<% end %>
|
||||
<% if @kbz_pay_amount > 0.0 %>
|
||||
<div class="row payment other-payment-color" id="card_payment" >
|
||||
<div class="col-md-8">Other Payments (KBZ Pay)</div>
|
||||
<div class="col-md-4" id="others">
|
||||
<%= number_format(@kbz_pay_amount, precision: precision.to_i) rescue number_format(0, precision: precision.to_i) %>
|
||||
<div class="row payment other-payment-color p-l-5 p-r-5" id="card_payment" >
|
||||
<div class="col-md-8">Other Payments</div>
|
||||
<div class="col-md-4" id="other_payment_amount">
|
||||
<%= number_format(@other_payment, precision: precision.to_i) rescue number_format(0, precision: precision.to_i) %>
|
||||
</div>
|
||||
</div>
|
||||
<% elsif @other == 0.0 && @ppamount == 0.0 && @visacount == 0.0 && @jcbcount == 0.0 && @mastercount == 0.0 && @unionpaycount == 0.0 && @alipaycount == 0.0 && @paymalcount == 0.0 && @junctionpaycount == 0.0 && @dingacount == 0.0 && @giftvouchercount == 0.0 %>
|
||||
<div class="row payment other-payment-color" id="card_payment" >
|
||||
<div class="col-md-8">Other Payments</div>
|
||||
<div class="col-md-4" id="others">
|
||||
<%= number_format(@other, precision: precision.to_i) rescue number_format(0, precision: precision.to_i) %>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="row payment other-payment-color" id="card_payment" >
|
||||
<div class="col-md-8">Other Payments</div>
|
||||
<div class="col-md-4" id="other_payment_amount">
|
||||
<%= number_format(@other_payment, precision: precision.to_i) rescue number_format(0, precision: precision.to_i) %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<div class="card-title m-l-5 m-r-5">
|
||||
<!-- mpu -->
|
||||
<div class="row <%= @other!=0.0 ? 'payment others-color' : 'hidden' %>">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">MPU</div>
|
||||
<% if @other != 0.0 %>
|
||||
<div class="col-md-4 mpu is_card" id="others"><%= number_format(@other, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %></div>
|
||||
<% else %>
|
||||
<div class="col-md-4" id="others"><%= number_format(0, precision: precision.to_i ) %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<!-- paypar -->
|
||||
<div class="row <%= @ppamount!=0.0 ? 'payment others-color' : 'hidden' %>">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">Redeem</div>
|
||||
<% if @ppamount != 0.0 %>
|
||||
<div class="col-md-4" id="ppamount"><%= number_format(@ppamount, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %></div>
|
||||
<% else %>
|
||||
<div class="col-md-4" id="ppamount"><%= number_format(0, precision: precision.to_i ) %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<!-- Visa -->
|
||||
<div class="row <%= @visacount!=0.0 ? 'payment others-color' : 'hidden' %>">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">VISA</div>
|
||||
<% if @visacount != 0.0 %>
|
||||
<div class="col-md-4 visa is_card" id="visacount"><%= number_format(@visacount, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %></div>
|
||||
<% else %>
|
||||
<div class="col-md-4" id="visacount"><%= number_format(0, precision: precision.to_i ) %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<!-- JCB -->
|
||||
<div class="row <%= @jcbcount!=0.0 ? 'payment others-color' : 'hidden' %>">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">JCB</div>
|
||||
<% if @jcbcount != 0.0 %>
|
||||
<div class="col-md-4 jcb is_card" id="jcbcount"><%= number_format(@jcbcount, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %></div>
|
||||
<% else %>
|
||||
<div class="col-md-4" id="jcbcount"><%= number_format(0, precision: precision.to_i ) %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<!-- Master -->
|
||||
<div class="row <%= @mastercount!=0.0 ? 'payment others-color' : 'hidden' %>">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">MASTER</div>
|
||||
<% if @mastercount != 0.0 %>
|
||||
<div class="col-md-4 master is_card" id="mastercount"><%= number_format(@mastercount, precision: precision.to_i) rescue number_format(0, precision: precision.to_i ) %></div>
|
||||
<% else %>
|
||||
<div class="col-md-4" id="mastercount"><%= number_format(0, precision: precision.to_i ) %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<!-- <br> -->
|
||||
|
||||
<!-- UNIONPAY -->
|
||||
<div class="row <%= @unionpaycount!=0.0 ? 'payment others-color' : 'hidden' %>">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">UNIONPAY</div>
|
||||
<% if @unionpaycount != 0.0 %>
|
||||
<div class="col-md-4 master is_card" id="unionpaycount"><%= number_format(@unionpaycount, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %></div>
|
||||
<% else %>
|
||||
<div class="col-md-4" id="unionpaycount"><%= number_format(0, precision: precision.to_i ) %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<!-- Alipay -->
|
||||
<div class="row <%= @alipaycount!=0.0 ? 'payment others-color' : 'hidden' %>">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">Alipay</div>
|
||||
<% if @alipaycount != 0.0 %>
|
||||
<div class="col-md-4 alipay is_card" id="alipaycount"><%= number_format(@alipaycount, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %></div>
|
||||
<% else %>
|
||||
<div class="col-md-4" id="alipaycount"><%= number_format(0, precision: precision.to_i ) %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<!-- PAYMAL -->
|
||||
<div class="row <%= @paymalcount!=0.0 ? 'payment others-color' : 'hidden'%>">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">PAYMAL</div>
|
||||
<% if @paymalcount != 0.0 %>
|
||||
<div class="col-md-4 master is_card" id="paymalcount"><%= number_format(@paymalcount, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %></div>
|
||||
<% else %>
|
||||
<div class="col-md-4" id="paymalcount"><%= number_format(0, precision: precision.to_i ) %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<!-- DINGA -->
|
||||
<div class="row <%= @dingacount!=0.0 ? 'payment others-color' : 'hidden'%>">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">DINGA</div>
|
||||
<% if @dingacount != 0.0 %>
|
||||
<div class="col-md-4 master is_card" id="dingacount"><%= number_format(@dingacount, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %></div>
|
||||
<% else %>
|
||||
<div class="col-md-4" id="dingacount"><%= number_format(0, precision: precision.to_i ) %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<!-- Junction Pay -->
|
||||
<div class="row <%= @junctionpaycount!=0.0 ? 'payment others-color' : 'hidden'%>">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">JUNCTION PAY</div>
|
||||
<% if @junctionpaycount != 0.0 %>
|
||||
<div class="col-md-4 master is_card" id="junctionpaycount"><%= number_format(@junctionpaycount, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %></div>
|
||||
<% else %>
|
||||
<div class="col-md-4" id="junctionpaycount"><%= number_format(0, precision: precision.to_i ) %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<!-- Gift Voucher -->
|
||||
<div class="row <%= @giftvouchercount!=0.0 ? 'payment others-color' : 'hidden'%>">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">GIFT VOUCHER</div>
|
||||
<% if @giftvouchercount != 0.0 %>
|
||||
<div class="col-md-4 master is_card" id="giftvouchercount"><%= number_format(@giftvouchercount, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %></div>
|
||||
<% else %>
|
||||
<div class="col-md-4" id="giftvouchercount"><%= number_format(0, precision: precision.to_i ) %></div>
|
||||
<% end %>
|
||||
<div class="card-title">
|
||||
<% @other_payments.each do |payment| %>
|
||||
<div class="row payment others-color p-l-5 p-r-5">
|
||||
<div class="col-md-8"><%= payment[0] %></div>
|
||||
<div class="col-md-4 <%= payment[0].parameterize %> is_card"><%= number_format(payment[1], precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %></div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="row m-l-5 m-r-5">
|
||||
<div class="col-md-8"><strong class='amount_balance'>Balance</strong></div>
|
||||
<div class="col-md-4"><strong><span id='balance'><%= number_format(@sale_data.grand_total, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %></span></strong></div>
|
||||
<div class="col-md-4"><strong><span id='balance'><%= number_format(@sale.grand_total, precision: precision.to_i ) rescue number_format(0, precision: precision.to_i ) %></span></strong></div>
|
||||
</div>
|
||||
<!-- <br> -->
|
||||
</div>
|
||||
@@ -404,30 +266,30 @@
|
||||
</button>
|
||||
<!-- -->
|
||||
<% if current_login_employee.role == "cashier" %>
|
||||
<% if @other_payment <= 0 && @sale_payment.nil? %>
|
||||
<%if @sale_data.total_discount == 0 %>
|
||||
<% if @other_payment <= 0 && @sale_payment %>
|
||||
<%if @sale.total_discount == 0 %>
|
||||
<a class="btn btn-block bg-deep-purple waves-effect access_modal" data-toggle="modal" data-type="foc"> FOC</a>
|
||||
<% end %>
|
||||
<%end %>
|
||||
<% if @sale_payment.nil? %>
|
||||
<% if @sale_payment %>
|
||||
<a class="btn btn-block bg-red waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
|
||||
<% if @other_payment <= 0 %>
|
||||
<%if @sale_data.total_discount == 0 %>
|
||||
<%if @sale.total_discount == 0 %>
|
||||
<a class="btn btn-block bg-deep-purple waves-effect access_modal" data-toggle="modal" data-type="waste"> Waste</a>
|
||||
<a class="btn btn-block bg-deep-purple waves-effect access_modal" data-toggle="modal" data-type="spoile"> Spoile</a>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% if @other_payment <= 0 && @sale_payment.nil?%>
|
||||
<%if @sale_data.total_discount == 0 %>
|
||||
<% if @other_payment <= 0 && @sale_payment%>
|
||||
<%if @sale.total_discount == 0 %>
|
||||
<button type="button" class="btn bg-deep-purple btn-block" data-toggle="modal" data-target="#focModal" <%= (can? :foc, :payment)? ' ': 'disabled=' %> active="true"> FOC </button>
|
||||
<%end %>
|
||||
<%end %>
|
||||
<% if @sale_payment.nil? %>
|
||||
<% if @sale_payment %>
|
||||
<button type="button" class="btn bg-red btn-block" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void </button>
|
||||
<% if @other_payment <= 0 %>
|
||||
<%if @sale_data.total_discount == 0 %>
|
||||
<%if @sale.total_discount == 0 %>
|
||||
<button type="button" class="btn btn-block bg-deep-purple waves-effect " data-status="waste" value="waste" id="btn_waste" onclick="waste_and_spoilage('waste')">Waste</button>
|
||||
<button type="button" class="btn btn-block bg-deep-purple waves-effect " data-status="spoile" value="spoile" id="btn_spoile" onclick="waste_and_spoilage('spoile')">Spoile</button>
|
||||
<% end %>
|
||||
@@ -435,7 +297,7 @@
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if (@cashier_type=="quick_service" || @cashier_type=="food_court") && @sale_payment.nil? %>
|
||||
<% if (@cashier_type=="quick_service" || @cashier_type=="food_court") && @sale_payment %>
|
||||
<hr>
|
||||
|
||||
<button type="button" id="survey" class="btn btn-block bg-blue waves-effect"><%= t("views.right_panel.detail.survey") %></button>
|
||||
@@ -709,10 +571,14 @@ var customer_id = "<%= @customer.id %>";
|
||||
var customer_name = "<%= @customer.name %>";
|
||||
var pdf_view = '<%=@pdf_view%>';
|
||||
var trans_flag = <%= @trans_flag %>;
|
||||
var paymalcount = <%= @paymalcount %>;
|
||||
var other_payments = <%= raw @other_payments %>;
|
||||
var payment_methods = <%= raw @payment_methods %>;
|
||||
|
||||
// console.log(pdf_view)
|
||||
$(document).ready(function(){
|
||||
$("#sxModal").hide();
|
||||
|
||||
var paymalcount = other_payments.some(x => x[0] == 'paymal') ? other_payments.find(x => x[0] == 'paymal')[1] : 0.0;
|
||||
if(cashier_type == "food_court" && paymalcount == 0.0){
|
||||
$("#is_paymemberModal").modal({show : true, backdrop : false, keyboard : false});
|
||||
}
|
||||
@@ -726,45 +592,35 @@ $(document).ready(function(){
|
||||
}
|
||||
/* replace url type*/
|
||||
/* start check first bill or not*/
|
||||
var member_id = $('#membership_id').text();
|
||||
var member_discount = $('#member_discount').text();
|
||||
var receipt_no = "";
|
||||
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
|
||||
receipt_no = ($("#receipt_no").html()).trim();
|
||||
}
|
||||
var member_id = $('#membership_id').text();
|
||||
var member_discount = $('#member_discount').text();
|
||||
var receipt_no = "";
|
||||
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
|
||||
receipt_no = ($("#receipt_no").html()).trim();
|
||||
}
|
||||
|
||||
payment_type = '';
|
||||
// if ($("#server_mode").val() != "cloud") { // first bill not used in cloud
|
||||
payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment");
|
||||
other_payment = payment_methods.find(x => payment_type.indexOf(x) >= 0)
|
||||
// console.log(payment_type)
|
||||
// console.log(parseInt(jQuery.inArray("MPU", payment_type)))
|
||||
if (member_id && member_discount) {
|
||||
if(parseInt(jQuery.inArray("Credit", payment_type)) == -1){
|
||||
$("#credit_payment").hide();
|
||||
} else{
|
||||
$("#credit_payment").show();
|
||||
}
|
||||
|
||||
// if ($("#server_mode").val() != "cloud") { // first bill not used in cloud
|
||||
payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment");
|
||||
// console.log(payment_type)
|
||||
// console.log(parseInt(jQuery.inArray("MPU", payment_type)))
|
||||
if (member_id && member_discount) {
|
||||
if(parseInt(jQuery.inArray("Credit", payment_type)) == -1){
|
||||
$("#credit_payment").hide();
|
||||
} else{
|
||||
$("#credit_payment").show();
|
||||
}
|
||||
if(parseInt(jQuery.inArray("MPU", payment_type)) != -1 ||
|
||||
parseInt(jQuery.inArray("VISA", payment_type)) != -1 ||
|
||||
parseInt(jQuery.inArray("JCB", payment_type)) != -1 ||
|
||||
parseInt(jQuery.inArray("Master", payment_type)) != -1 ||
|
||||
parseInt(jQuery.inArray("UNIONPAY", payment_type)) != -1 ||
|
||||
parseInt(jQuery.inArray("Redeem", payment_type)) != -1 ||
|
||||
parseInt(jQuery.inArray("PAYMAL", payment_type)) != -1 ||
|
||||
parseInt(jQuery.inArray("JUNCTIONPAY", payment_type)) != -1 ||
|
||||
parseInt(jQuery.inArray("Alipay", payment_type)) != -1 ||
|
||||
parseInt(jQuery.inArray("DINGA", payment_type)) != -1 ||
|
||||
parseInt(jQuery.inArray("GiftVoucher", payment_type)) != -1){
|
||||
$("#card_payment").show();
|
||||
} else{
|
||||
$("#card_payment").hide();
|
||||
}
|
||||
}
|
||||
// }
|
||||
/* end check first bill or not*/
|
||||
if(other_payment){
|
||||
$("#card_payment").show();
|
||||
} else{
|
||||
$("#card_payment").hide();
|
||||
}
|
||||
}
|
||||
// }
|
||||
/* end check first bill or not*/
|
||||
|
||||
var dining_id = "<%= @sale_data.bookings[0].dining_facility_id %>";
|
||||
var dining_id = "<%= @sale.bookings[0].dining_facility_id %>";
|
||||
|
||||
$("#back").on('click', function() {
|
||||
localStorage.removeItem('cash');
|
||||
@@ -787,12 +643,10 @@ $(document).ready(function(){
|
||||
window.location.reload();
|
||||
})
|
||||
|
||||
if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){
|
||||
|
||||
}
|
||||
else {
|
||||
if (localStorage.getItem("cash") && localStorage.getItem("cash") != 'null') {
|
||||
$('#cash').text(localStorage.getItem("cash"));
|
||||
}
|
||||
|
||||
update_balance();
|
||||
//checkChangableTax
|
||||
checkChangableTax();
|
||||
@@ -827,125 +681,96 @@ $(document).ready(function(){
|
||||
sub_total = $('#sub-total').text();
|
||||
member = $('#membership_id').text();
|
||||
// console.log(member)
|
||||
if (parseInt(jQuery.inArray("MPU", payment_type)) != -1 && $('.mpu').text() == 0 && sub_total != 0.0 && member) {
|
||||
swal("Oops","Please Pay with MPU Payment","warning");
|
||||
}else if(parseInt(jQuery.inArray("Redeem", payment_type)) != -1 && $('#ppamount').text()==0 && sub_total != 0.0 && member){
|
||||
swal("Oops","Please Pay with Redeem Payment","warning");
|
||||
}else if(parseInt(jQuery.inArray("VISA", payment_type)) != -1 && $('#visacount').text()== 0 && sub_total != 0.0 && member){
|
||||
swal("Oops","Please Pay with Visa Payment","warning");
|
||||
|
||||
}else if(parseInt(jQuery.inArray("JCB", payment_type)) != -1 && $('#jcbcount').text()== 0 && sub_total != 0.0 && member){
|
||||
swal("Oops","Please Pay with jcb Payment","warning");
|
||||
}
|
||||
else if(parseInt(jQuery.inArray("Master", payment_type)) != -1 && $('#mastercount').text()== 0 && sub_total != 0.0 && member){
|
||||
swal("Oops","Please Pay with Master Payment","warning");
|
||||
}
|
||||
else if(payment_type == "UNIONPAY" && $('#unionpaycount').text()== 0 && sub_total != 0.0 && member){
|
||||
swal("Oops","Please Pay with UNIONPAY Payment","warning");
|
||||
}
|
||||
else if(parseInt(jQuery.inArray("Alipay", payment_type)) != -1 && $('#alipaycount').text()== 0 && sub_total != 0.0 && member){
|
||||
swal("Oops","Please Pay with Alipay Payment","warning");
|
||||
}
|
||||
else if(parseInt(jQuery.inArray("JUNCTIONPAY", payment_type)) != -1 && $('#junctionpaycount').text()==0 && sub_total != 0.0 && member){
|
||||
swal("Oops","Please Pay with JUNCTIONPAY Payment","warning");
|
||||
}
|
||||
else if(payment_type == "Credit" && $('#credit').text()==0 && sub_total != 0.0 && member){
|
||||
swal("Oops","Please Pay with Credit Payment","warning");
|
||||
}else if(parseInt(jQuery.inArray("PAYMAL", payment_type)) != -1 && $('#paymalcount').text()== 0 && sub_total != 0.0 && member){
|
||||
swal("Oops","Please Pay with Paymal Payment","warning");
|
||||
}else if(parseInt(jQuery.inArray("DINGA", payment_type)) != -1 && $('#dingacount').text()== 0 && sub_total != 0.0 && member){
|
||||
swal("Oops","Please Pay with Dinga Payment","warning");
|
||||
}else if(parseInt(jQuery.inArray("GiftVoucher", payment_type)) != -1 && $('#giftvouchercount').text()== 0 && sub_total != 0.0 && member){
|
||||
swal("Oops","Please Pay with Gift Voucher","warning");
|
||||
if (other_payment && !other_payments.some(x => x[0] == other_payment && x[1] > 0 ) && sub_total != 0.0 && member) {
|
||||
swal("Oops","Please Pay with " + other_payment + " Payment","warning");
|
||||
} else {
|
||||
$( "#loading_wrapper").show();
|
||||
if($('#balance').text() > 0){
|
||||
swal ( "Oops", "Insufficient Amount!" , "error" );
|
||||
$("#loading_wrapper").hide();
|
||||
}else{
|
||||
$(this).off("click");
|
||||
var sale_id = $('#sale_id').text();
|
||||
// var item_row = $('.is_card');
|
||||
|
||||
$( "#loading_wrapper").show();
|
||||
if($('#balance').text() > 0){
|
||||
swal ( "Oops", "Insufficient Amount!" , "error" );
|
||||
$("#loading_wrapper").hide();
|
||||
}else{
|
||||
$(this).off("click");
|
||||
var sale_id = $('#sale_id').text();
|
||||
// var item_row = $('.is_card');
|
||||
// payment
|
||||
var cash = $('#cash').text();
|
||||
var credit = $('#credit').text();
|
||||
var card = $('#card').text();
|
||||
var kbz_amt = "<%= @kbz_pay_amount %>";
|
||||
var is_kbz = false;
|
||||
if (kbz_amt > 0) {
|
||||
is_kbz = true
|
||||
}
|
||||
|
||||
// payment
|
||||
var cash = $('#cash').text();
|
||||
var credit = $('#credit').text();
|
||||
var card = $('#card').text();
|
||||
var kbz_amt = "<%= @kbz_pay_amount %>";
|
||||
var is_kbz = false;
|
||||
if (kbz_amt > 0) {
|
||||
is_kbz = true
|
||||
}
|
||||
var tax_type = localStorage.getItem("tax_type") ? localStorage.getItem("tax_type") : 'all';
|
||||
if (credit <= 0 && (!location.pathname.includes("credit_payment"))) {
|
||||
calculate_member_discount(sale_id,tax_type);
|
||||
}
|
||||
|
||||
var tax_type = localStorage.getItem("tax_type") ? localStorage.getItem("tax_type") : 'all';
|
||||
if (credit <= 0 && (!location.pathname.includes("credit_payment"))) {
|
||||
calculate_member_discount(sale_id,tax_type);
|
||||
}
|
||||
// $("#pdfModal").on('shown.bs.modal', function () {
|
||||
// $('#pdfModal').focus() }).modal({show : true, backdrop : false, keyboard : false});
|
||||
/* check credit payment or not*/
|
||||
if(location.pathname.includes("credit_payment")){
|
||||
var url = "<%= origami_credit_payment_cash_path %>";
|
||||
}else{
|
||||
var url = "<%= origami_payment_cash_path %>";
|
||||
}
|
||||
|
||||
// $("#pdfModal").on('shown.bs.modal', function () {
|
||||
// $('#pdfModal').focus() }).modal({show : true, backdrop : false, keyboard : false});
|
||||
/* check credit payment or not*/
|
||||
if(location.pathname.includes("credit_payment")){
|
||||
var url = "<%= origami_credit_payment_cash_path %>";
|
||||
}else{
|
||||
var url = "<%= origami_payment_cash_path %>";
|
||||
}
|
||||
$.ajax({type: "POST",
|
||||
url: url,
|
||||
data: "cash="+ cash + "&sale_id=" + sale_id + "&type=" + cashier_type + "&tax_type=" + tax_type + "&is_kbz=" + is_kbz,
|
||||
success:function(result){
|
||||
/* start delete receipt no in first bill*/
|
||||
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
|
||||
var receipt_no = ($("#receipt_no").html()).trim();
|
||||
deleteReceiptNoInFirstBillData(receipt_no);
|
||||
}
|
||||
/* end delete receipt no in first bill*/
|
||||
|
||||
$.ajax({type: "POST",
|
||||
url: url,
|
||||
data: "cash="+ cash + "&sale_id=" + sale_id + "&type=" + cashier_type + "&tax_type=" + tax_type + "&is_kbz=" + is_kbz,
|
||||
success:function(result){
|
||||
/* start delete receipt no in first bill*/
|
||||
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
|
||||
var receipt_no = ($("#receipt_no").html()).trim();
|
||||
deleteReceiptNoInFirstBillData(receipt_no);
|
||||
}
|
||||
/* end delete receipt no in first bill*/
|
||||
localStorage.removeItem("cash");
|
||||
if (result.status) {
|
||||
var msg = result.message;
|
||||
}
|
||||
else{
|
||||
var msg = '';
|
||||
}
|
||||
|
||||
localStorage.removeItem("cash");
|
||||
if (result.status) {
|
||||
var msg = result.message;
|
||||
}
|
||||
else{
|
||||
var msg = '';
|
||||
$("#loading_wrapper" ).hide();
|
||||
if(location.pathname.includes("credit_payment")){
|
||||
payment_success_alert();
|
||||
}else{
|
||||
//PDF lightbox data
|
||||
var pdfPath = "/en/pdfjs/minimal?file=" + result.filename.substring(6);
|
||||
$("#sale_receipt_no").val(result.receipt_no);
|
||||
$("#filename").val(result.filename);
|
||||
$("#printer_name").val(result.printer_name);
|
||||
$("#receipt_pdf").attr("src", pdfPath);
|
||||
$("#changed_amount").text("");
|
||||
if($('#balance').text() < 0){
|
||||
<% if precision.to_i > 0 %>
|
||||
$("#changed_amount").text('Changed amount ' + parseFloat($('#balance').text() * (-1)).toFixed(<%= precision %>));
|
||||
<% else %>
|
||||
$("#changed_amount").text('Changed amount ' + parseFloat($('#balance').text() * (-1)));
|
||||
<% end %>
|
||||
}
|
||||
|
||||
$("#loading_wrapper" ).hide();
|
||||
if(location.pathname.includes("credit_payment")){
|
||||
payment_success_alert();
|
||||
if (pdf_view == 1) {
|
||||
$("#pdfModal").modal({show : true, backdrop : false, keyboard : false});
|
||||
$("#pdfModalLabel").text("Sale Completed");
|
||||
}else{
|
||||
//PDF lightbox data
|
||||
var pdfPath = "/en/pdfjs/minimal?file=" + result.filename.substring(6);
|
||||
$("#sale_receipt_no").val(result.receipt_no);
|
||||
$("#filename").val(result.filename);
|
||||
$("#printer_name").val(result.printer_name);
|
||||
$("#receipt_pdf").attr("src", pdfPath);
|
||||
$("#changed_amount").text("");
|
||||
if($('#balance').text() < 0){
|
||||
<% if precision.to_i > 0 %>
|
||||
$("#changed_amount").text('Changed amount ' + parseFloat($('#balance').text() * (-1)).toFixed(<%= precision %>));
|
||||
<% else %>
|
||||
$("#changed_amount").text('Changed amount ' + parseFloat($('#balance').text() * (-1)));
|
||||
<% end %>
|
||||
}
|
||||
|
||||
if (pdf_view == 1) {
|
||||
$("#pdfModal").modal({show : true, backdrop : false, keyboard : false});
|
||||
$("#pdfModalLabel").text("Sale Completed");
|
||||
}else{
|
||||
//PDF lightbox data
|
||||
print_receipt();
|
||||
}
|
||||
print_receipt();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
var second_display_lookup = $("#display_type").val();
|
||||
if ($('#server_mode').val() != "cloud" && second_display_lookup == 2){
|
||||
customer_display_view(null,"reload");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
var second_display_lookup = $("#display_type").val();
|
||||
if ($('#server_mode').val() != "cloud" && second_display_lookup == 2){
|
||||
customer_display_view(null,"reload");
|
||||
}
|
||||
});
|
||||
|
||||
function customer_display_view(data,status) {
|
||||
@@ -1098,18 +923,8 @@ $(document).ready(function(){
|
||||
break;
|
||||
case 'nett':
|
||||
var credit1 = $('#credit').text();
|
||||
var card1 = $('#others').text();
|
||||
var paypar1 = $('#ppamount').text();
|
||||
var visa1 = $('#visacount').text();
|
||||
var jcb1 = $('#jcbcount').text();
|
||||
var master1 = $('#mastercount').text();
|
||||
var unionpay1 = $('#unionpaycount').text();
|
||||
var paymal1 = $('#paymalcount').text();
|
||||
var alipay1 = $('#alipaycount').text();
|
||||
var junctionpay1 = $('#junctionpaycount').text();
|
||||
var dingapay1 = $('#dingacount').text();
|
||||
var giftvoucherpay1 = $('#giftvouchercount').text();
|
||||
var othertotal = parseFloat(credit1) + parseFloat(card1) + parseFloat(paypar1) + parseFloat(visa1) + parseFloat(jcb1) + parseFloat(master1) + parseFloat(unionpay1) + parseFloat(alipay1) + parseFloat(junctionpay1) + parseFloat(paymal1) + parseFloat(dingapay1) + parseFloat(giftvoucherpay1);
|
||||
var others = other_payments.map(x => x[1]).reduce((acc, v) => acc + v, 0);
|
||||
var othertotal = parseFloat(credit1) + parseFloat(others);
|
||||
var total = $('#amount_due').text();
|
||||
var amt = 0;
|
||||
<% if precision.to_i > 0 %>;
|
||||
@@ -1131,19 +946,10 @@ $(document).ready(function(){
|
||||
function update_balance(){
|
||||
var cash = $('#cash').text();
|
||||
var credit = $('#credit').text();
|
||||
var card = $('#others').text();
|
||||
var paypar = $('#ppamount').text();
|
||||
var visa = $('#visacount').text();
|
||||
var jcb = $('#jcbcount').text();
|
||||
var master = $('#mastercount').text();
|
||||
var unionpay = $('#unionpaycount').text();
|
||||
var paymal = $('#paymalcount').text();
|
||||
var alipay = $('#alipaycount').text();
|
||||
var junctionpay = $('#junctionpaycount').text();
|
||||
var dinga = $('#dingacount').text();
|
||||
var giftvoucher = $('#giftvouchercount').text();
|
||||
var others = other_payments.map(x => x[1]).reduce((acc, v) => acc + v, 0);
|
||||
|
||||
var amount_due = $('#amount_due').text();
|
||||
var total = parseFloat(cash) + parseFloat(credit) + parseFloat(card) + parseFloat(paypar) + parseFloat(visa) + parseFloat(jcb) + parseFloat(master) + parseFloat(unionpay) + parseFloat(alipay) + parseFloat(junctionpay) + parseFloat(paymal) + parseFloat(dinga) + parseFloat(giftvoucher);
|
||||
var total = parseFloat(cash) + parseFloat(credit) + parseFloat(others);
|
||||
|
||||
var result = parseFloat(amount_due) - parseFloat(total);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user