Merge branch 'r-1902001-01' of gitlab.com:code2lab/SXRestaurant into r-1902001-01

This commit is contained in:
yarzar_code
2020-06-08 15:48:13 +06:30
65 changed files with 2049 additions and 1842 deletions

View File

@@ -189,7 +189,7 @@
<td align="right"><%= @summ_sale.total_receipt %></td>
</tr>
<tr>
<% revenue = @summ_sale.total_amount - @summ_sale.total_discount%>
<% revenue = @summ_sale.grand_total - @summ_sale.total_discount - @summ_sale.total_tax %>
<td><%= t("views.right_panel.detail.sale") %> <%= t :revenue %> : </td>
<td align="right"><%= number_format( revenue, precision: precision.to_i ,delimiter: delimiter) %></td>
</tr>

View File

@@ -172,11 +172,31 @@
});
$(document).ready(function () {
var menus = JSON.parse(localStorage.getItem("menus"));;
if (menus != null) {
menu_cache_append(menus);
}else{
$("#menu_data").removeClass("hidden");
// var menus = JSON.parse(localStorage.getItem("menus"));;
// if (menus != null) {
// menu_cache_append(menus);
// }else{
// getAllMenu();
// $("#menu_data").removeClass("hidden");
// }
getAllMenu();
function getAllMenu(){
$.ajax({
type: "GET",
url: '/origami/get_all_menu',
data: {},
success:function(result){
var menus = JSON.stringify(result);
localStorage.setItem("menus", menus);
if (result != null ) {
menu_cache_append(result);
$("#loading_wrapper").hide();
$("#oqs_loading_wrapper").css("display", "none");
$(".page-loader-wrapper").css("display", "none");
}
}
});
}
function menu_cache_append(menus){
@@ -328,6 +348,66 @@
});
//End menu category Click
//show menu item list when click menu category
function show_sub_category_list(url,sub_category,menu_id){
var sub_category_list = $('.sub_category_list');
sub_category_list.empty();
menus = JSON.parse(localStorage.getItem("menus"));
if (menus != null) {
for(var j in menus) {
var categories = menus[j]["categories"];
for(var ii in categories) {
if (menu_id == categories[ii]["parent_id"]) {
$(sub_category).removeClass('hidden');
row = '<li class="menu_sub_category fadeInTop" data-id="'+categories[ii].id+'">'
+'<a class="nav-link" data-toggle="tab" href="" role="tab">'+ categories[ii].name+'</a>'
+'</li>' ;
$(sub_category).append(row);
}
}
}
}else{
if (type != -1 && modify_order != -1) {
var url = "../../../addorders/"+url;
}if(modify_order== -1 && type != -1){
var url = 'addorders/'+url;
}
if (type ==-1 && modify_order == -1){
var url = url;
}
//Start Ajax
$.ajax({
type: "GET",
url: url,
data: {},
dataType: "json",
success: function(data) {
var sub_category_list = $('.sub_category_list');
sub_category_list.empty();
data = data.sub_category;
if (data.length > 0) {
// if ((sub_category.hasClass('hidden'))) {
$(sub_category).removeClass('hidden');
// }else{
// $(sub_category).addClass('hidden');
// }
for(var i in data) {
row = '<li class="menu_sub_category fadeInTop" data-id="'+data[i].id+'">'
+'<a class="nav-link" data-toggle="tab" href="" role="tab">'+ data[i].name+'</a>'
+'</li>' ;
$(sub_category).append(row);
//end is_sub_item false
}
}
}
});
//end Ajax
}
}
//click menu sidebar menu category
$(document).on('click', '.menu_sub_category', function(event){
// event.preventDefault();

View File

@@ -31,6 +31,7 @@
<p>Please wait...</p>
</div>
</div>
<%= render 'shared/license_expire_warning' %>
<!-- #END# Page Loader -->
<!-- Overlay For Sidebars -->
<div class="overlay"></div>
@@ -59,7 +60,7 @@
</p>
<% end %>
<% end %>
<% end %>
<% end %>
<%= yield %>
</section>
</body>

View File

@@ -35,6 +35,7 @@
<p>Please wait...</p>
</div>
</div>
<%= render 'shared/license_expire_warning' %>
<!-- #END# Page Loader -->
<!-- Overlay For Sidebars -->
<div class="overlay"></div>

View File

@@ -32,6 +32,7 @@
<p>Please wait...</p>
</div>
</div>
<%= render 'shared/license_expire_warning' %>
<!-- #END# Page Loader -->
<!-- Overlay For Sidebars -->
<div class="overlay"></div>
@@ -56,7 +57,7 @@
<p id="notify_message" class="hidden" data-placement-from="top" data-message="<%=message%>" data-placement-align="center"
data-animate-enter="" data-animate-exit="" data-color-name="<%=color%>" >
</p>
<% end %>
<% end %>
<%= yield %>
</section>
</body>

View File

@@ -31,6 +31,7 @@
<p>Please wait...</p>
</div>
</div>
<%= render 'shared/license_expire_warning' %>
<!-- #END# Page Loader -->
<!-- Overlay For Sidebars -->
<div class="overlay"></div>
@@ -51,7 +52,7 @@
</div>
<% end %>
<% end %>
<% end %>
<%= yield %>
</section>
</body>

View File

@@ -31,6 +31,7 @@
<p>Please wait...</p>
</div>
</div>
<%= render 'shared/license_expire_warning' %>
<!-- #END# Page Loader -->
<!-- Overlay For Sidebars -->
<div class="overlay"></div>
@@ -60,7 +61,7 @@
data-animate-enter="" data-animate-exit="" data-color-name="<%=color%>" >
</p>
<% end %>
<%= yield %>
<%= yield %>
</section>
</body>

View File

@@ -14,6 +14,7 @@
</head>
<body>
<%= render 'shared/license_expire_warning' %>
<%= render 'layouts/header' %>
<div class="container-fluid">
<% flash.each do |type, message| %>

View File

@@ -1,5 +1,5 @@
<!-- Column One -->
<div class="row clearfix" style="">
<div class="row clearfix m-top-100" style="">
<div class="col-lg-7 col-md-7 col-sm-7">
<p class="hidden filter"><%= @filter %></p>
<div class="card">

View File

@@ -4,7 +4,7 @@
<% type = request.path_info.include?('quick_service') || request.path_info.include?('food_court')%>
<% modify_order = request.path_info.include?('modify_order')%>
<div class="container-fluid " style="padding:0px 3px 0px 3px;">
<div class="container-fluid addorder-pages" style="padding:0px 3px 0px 3px;">
<div id="oqs_loading_wrapper" style="display:none;">
<div id="oqs_loading"></div>
</div>

View File

@@ -1,4 +1,4 @@
<div class="container-fluid">
<div class="container-fluid m-top-100">
<div class='row'>
<div class="col-lg-10 col-md-10 col-sm-10">
<h2> <%= t :cash_in %> </h2>

View File

@@ -1,4 +1,4 @@
<div class="container-fluid">
<div class="container-fluid m-top-100">
<div class='row'>
<div class="col-lg-10 col-md-10 col-sm-10">
<h2><%= t :cash_out %></h2>

View File

@@ -96,36 +96,35 @@
</table>
<table class="table">
<% if !(@total_payment_methods.nil?) %>
<% @total_payment_methods.each do |payment| %>
<% if !@sale_data[0].empty? %>
<% if payment.payment_method != 'mpu' && payment.payment_method != 'visa' && payment.payment_method != 'master' && payment.payment_method != 'jcb' %>
<tr>
<% if payment.payment_method == 'paypar' %>
<td>Redeem Sale : </td>
<% else %>
<td><%= payment.payment_method.to_s.capitalize %> Sale : </td>
<% end %>
<td align="right">
<% @sale_data.each do |data| %>
<% pay_mth = payment.payment_method %>
<%= data[""+pay_mth+""] %>
<% @total_payment_methods.each do |payment| %>
<% if !@sale_data[0].empty? %>
<% if payment.payment_method != 'mpu' && payment.payment_method != 'visa' && payment.payment_method != 'master' && payment.payment_method != 'jcb' %>
<tr>
<% if payment.payment_method == 'paypar' %>
<td>Redeem Sale : </td>
<% else %>
<td><%= payment.payment_method.to_s.capitalize %> Sale : </td>
<% end %>
<td align="right">
<% @sale_data.each do |data| %>
<% pay_mth = payment.payment_method %>
<%= data[""+pay_mth+""] %>
<% end %>
</td>
</tr>
<% end %>
<% end %>
</td>
</tr>
<% end %>
<% end %>
<% end %>
<% total_card = @sale_data.select { |hash| hash["card"]!=nil }.first %>
<% if !total_card.nil? %>
<tr>
<td><%= t("views.right_panel.detail.other_payment") %> : </td>
<td align="right">
<%= total_card["card"].to_f %>
</td>
</tr>
<% end %>
<% end %>
<% total_card = @sale_data.select { |hash| hash["card"]!=nil }.first %>
<% if !total_card.nil? %>
<tr>
<td><%= t("views.right_panel.detail.other_payment") %> : </td>
<td align="right">
<%= total_card["card"].to_f %>
</td>
</tr>
<% end %>
<% end %>
</table>
</div>

View File

@@ -1,4 +1,4 @@
<div class="container-fluid">
<div class="container-fluid m-top-100">
<div id="loading_wrapper" style="display:none;">
<div id="loading"></div>
</div>

View File

@@ -1,4 +1,4 @@
<div class="container-fluid">
<div class="container-fluid m-top-100">
<div id="loading_wrapper" style="display:none;">
<div id="loading"></div>
</div>

View File

@@ -1,4 +1,4 @@
<div class="container-fluid">
<div class="container-fluid m-top-100">
<div id="loading_wrapper" style="display:none;">
<div id="loading"></div>
</div>

View File

@@ -1,6 +1,6 @@
<%= stylesheet_link_tag 'order_reservation', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'order_reservation', 'data-turbolinks-track': 'reload' %>
<div class="container-fluid">
<div class="container-fluid m-top-100">
<!-- start count function -->
<%
pending_count = 0

View File

@@ -1,4 +1,4 @@
<div class="container-fluid">
<div class="container-fluid m-top-100">
<div class="row">
<!-- Column One -->
<div class="col-lg-6 col-md-6 col-sm-6">
@@ -202,7 +202,7 @@
<%else%>
<button type="button" class="btn bg-default btn-block" onclick="window.location.href = '/origami/sale/<%=@sale_data.sale_id%>/<%=@cashier_type%>/payment'"><i class="material-icons">reply</i> Back </button>
<%end%>
<button id="charge_other" class="btn bg-primary btn-block action-btn">Enter</button>
<button id="charge_other" class="btn bg-primary btn-block action-btn" style="height: 35px">Enter</button>
</div>
</div>
</div>

View File

@@ -0,0 +1,5 @@
if(@status)
json.status @status
else
json.status false
end

View File

@@ -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();
});
}

View 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('/&nbsp;&nbsp;&nbsp;<%= "#{@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>

View File

@@ -1,4 +1,4 @@
<div class="container-fluid">
<div class="container-fluid m-top-100">
<div id="loading_wrapper" style="display:none;">
<div id="loading"></div>
</div>
@@ -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")
// 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*/
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();
}
var dining_id = "<%= @sale_data.bookings[0].dining_facility_id %>";
if(payment_type && payment_methods.some(x => payment_type.indexOf(x) >= 0)){
$("#card_payment").show();
} else{
$("#card_payment").hide();
}
}
// }
/* end check first bill or not*/
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();
@@ -826,126 +680,96 @@ $(document).ready(function(){
$('#pay').click(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 (payment_type && !other_payments.some(x => payment_type.indexOf(x[0]) >= 0 && x[1] > 0 ) && sub_total != 0.0 && member) {
swal("Oops","Please Pay with " + payment_methods.find(x => payment_type.indexOf(x) >= 0) + " 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 +922,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 +945,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);

View File

@@ -1,4 +1,4 @@
<div class="container-fluid">
<div class="container-fluid m-top-100">
<div class="row clearfix">
<!-- Column One -->
<div class="col-lg-10 col-md-10 col-sm-10">

View File

@@ -1,4 +1,4 @@
<div class="container-fluid">
<div class="container-fluid m-top-100">
<div class="row">
<!-- Column One -->
<div class="col-lg-5 col-md-5 col-sm-5">

View File

@@ -1,4 +1,4 @@
<div class="container-fluid">
<div class="container-fluid m-top-100">
<div id="loading_wrapper" style="display:none;">
<div id="loading"></div>
</div>

View File

@@ -1,4 +1,4 @@
<div class="container-fluid">
<div class="container-fluid m-top-100">
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-7 col-lg-7">
<div class="card">

View File

@@ -0,0 +1,82 @@
<% renewable_date = current_license.read_license("renewable_date") %>
<% date_count = (renewable_date.to_date - Date.today).to_i %>
<% day = pluralize( date_count, 'day' )%>
<% if @license_status == 0
text = 'Your license has been expired.'
elsif @license_status == 2
text = "Your license will expire in #{day}."
end
%>
<style>
.centered {
position: fixed;
/*width: 850px;*/
padding: 10px;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
</style>
<div class="container-fluid">
<div class="row">
<div class="col-sm-2"></div>
<div class="card col-sm-8 centered">
<div class="card-block">
<h3 class="pt-2 d-inline">Review Your License</h3>
<%= link_to origami_dashboard_url do %>
<img src="/image/logo.png" style="margin-left: 25pc; width: 150px">
<% end %>
<% if params[:message].present?
if params[:status].to_i == 1
color = 'text-success'
else
color = 'text-danger'
end
%>
<p class="<%= color %> m-t--30" style="font-weight: bold; font-size: 18px;"><%= params[:message] %></p><br>
<% end %>
<% if text %>
<h6 class="mb-2 "><%= text %></h6><br>
<% end %>
<h6 class="mb-2">Call Center Phone No: <a href="tel:+6494461709">+959 445 665 311</a></h6>
<br>
<h6>License Info:</h6>
<br>
<div class="container">
<div class="form-group row">
<label class="card-subtitle mb-2 col-md-4">Business Name:</label>
<label class="card-subtitle mb-2 "><strong><%= @bis_name %></strong></label>
</div>
<div class="form-group row">
<label class="card-subtitle mb-2 col-md-4">Plan:</label>
<label class="card-subtitle mb-2 "><strong><%= @plan %></strong></label>
</div>
</div>
<div class="form-group row">
<label class="card-subtitle mb-2 col-md-4 pl-4">Expired At: </label>
<label class="card-subtitle mb-2 "><strong><%= @expired_at.to_date.strftime('%B %d, %Y') %></strong></label>
</div>
</div>
<br>
<div class="col-md-12" style="padding-bottom: 20px;">
<%= link_to 'Review License', renew_url, class: 'btn btn-primary btn-lg float-right m-l-10 m-r-5' %>
<%= link_to 'Go To Home', origami_dashboard_url, class: 'btn btn-default btn-lg float-right' %>
</div>
</div>
<div class="col-sm-2"></div>
</div>
</div>
<script>
$(document).ready(function() {
$('.alert-danger, .navbar').hide()
$('html, section').css('background-color', '#61B8C9')
// $('html').css('overflow-x', 'hidden')
$('section.content').css('margin', '70px 0 0 0')
})
</script>

View File

@@ -82,44 +82,11 @@
</tr>
<tr>
<th style='text-align:center;'><%= t("views.right_panel.detail.sr") %></th>
<th style='text-align:center;'><%= t("views.right_panel.detail.date") %></th>
<th style='text-align:center;'><%= t("views.righ_panel.detail.date") %></th>
<% @payment_methods.each do |method| %>
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.#{method}") %></th>
<% end %>
<% if @payment_methods.include? ("MPU") %>
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.mpu_sales") %></th>
<% end %>
<% if @payment_methods.include? ("Master") %>
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.master_sales") %></th>
<% end %>
<% if @payment_methods.include? ("VISA") %>
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.visa_sales") %></th>
<% end %>
<% if @payment_methods.include? ("JCB") %>
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.jcb_sales") %></th>
<% end %>
<% if @payment_methods.include? ("UNIONPAY") %>
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.unionpay_sales") %></th>
<% end %>
<% if @payment_methods.include? ("KBZPay") %>
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.kbzpay_sales") %></th>
<% end %>
<% if @payment_methods.include? ("Alipay") %>
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.alipay_sales") %></th>
<% end %>
<% if @payment_methods.include? ("PAYMAL") %>
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.paymal_sales") %></th>
<% end %>
<% if @payment_methods.include? ("DINGA") %>
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.dinga_sales") %></th>
<% end %>
<% if @payment_methods.include? ("JunctionPay") %>
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.junctionpay_sales") %></th>
<% end %>
<% if @payment_methods.include? ("Redeem") %>
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.redeem_sales") %></th>
<% end %>
<% if @payment_methods.include? ("GiftVoucher") %>
<th style='text-align:center;'><%= t("views.right_panel.detail.giftvoucher_sales") %></th>
<% end %>
<th style='text-align:center;'><%= t("views.right_panel.detail.cash_sales") %></th>
<th style='text-align:center;'><%= t("views.right_panel.detail.credit_sales") %></th>
<th style='text-align:center;'><%= t("views.right_panel.detail.void_amount") %></th>
@@ -140,22 +107,10 @@
<% unless @sale_data.blank? %>
<tbody>
<% void = 0 %>
<% mpu = 0 %>
<% master = 0 %>
<% visa = 0 %>
<% jcb = 0 %>
<% unionpay = 0 %>
<% alipay = 0 %>
<% paymal = 0 %>
<% dinga = 0 %>
<% junctionpay = 0 %>
<% giftvoucher = 0 %>
<% paypar = 0 %>
<% cash = 0 %>
<% credit = 0 %>
<% foc = 0 %>
<% discount = 0 %>
<% kbzpay = 0 %>
<% total = 0 %>
<% grand_total = 0 %>
<% old_grand_total = 0 %>
@@ -164,24 +119,13 @@
<% tax = 0 %>
<% net_sale = 0 %>
<% count = 1 %> <% rounding_adj = 0 %>
<% @sale_data.each do |sale| %>
<% void += sale[:void_amount] %>
<% mpu += sale[:mpu_amount] %>
<% master += sale[:master_amount] %>
<% visa += sale[:visa_amount] %>
<% jcb += sale[:jcb_amount] %>
<% unionpay += sale[:unionpay_amount] %>
<% alipay += sale[:alipay_amount] %>
<% paymal += sale[:paymal_amount] %>
<% dinga += sale[:dinga_amount] %>
<% junctionpay += sale[:junctionpay_amount] %>
<% giftvoucher += sale[:giftvoucher_amount] %>
<% paypar += sale[:paypar_amount] %>
<% cash += sale[:cash_amount]-sale[:total_change_amount] %>
<% credit += sale[:credit_amount] %>
<% foc += sale[:foc_amount] %>
<% discount += sale[:total_discount] %>
<% kbzpay += sale[:kbzpay_amount] %>
<% total += sale[:grand_total].to_f + sale[:rounding_adj].to_f %>
<% grand_total += sale[:grand_total].to_f %>
<% old_grand_total += sale[:old_grand_total].to_f %>
@@ -193,41 +137,8 @@
<tr>
<td style='text-align:right;'><%= count %></td>
<td><%= sale[:sale_date].strftime("#{sale[:sale_date].day.ordinalize} %b") rescue '-' %></td>
<% if @payment_methods.include? ("MPU") %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:mpu_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("Master") %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:master_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("VISA") %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:visa_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("JCB") %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:jcb_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("UNIONPAY") %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:unionpay_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("Alipay") %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:alipay_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("KBZPay") %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:kbzpay_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("PAYMAL") %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:paymal_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("DINGA") %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:dinga_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("JunctionPay") %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:junctionpay_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("Redeem") %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:paypar_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("GiftVoucher") %>
<td style='text-align:right;'><%= number_format(sale[:giftvoucher_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% @payment_methods.each do |method| %>
<td style='text-align:right;'><%= number_format(sale[method.parameterize.to_sym], precision:precision.to_i, delimiter: delimiter) rescue 0 %></td>
<% end %>
<td style='text-align:right;'><%= number_format(sale[:cash_amount]-sale[:total_change_amount], precision:precision.to_i, delimiter: delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_format(sale[:credit_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
@@ -236,7 +147,7 @@
<td style='text-align:right;'>(<%= number_format(sale[:total_discount], precision:precision,delimiter:delimiter) rescue '-'%>)</td>
<!-- <td style='text-align:right;'><%= number_format(sale[:grand_total].to_f + sale[:rounding_adj].to_f , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td> -->
<td style='text-align:right;'><%= number_format(sale[:rounding_adj].to_f, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_format(sale[:rounding_adj], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_format(sale[:gross_sale], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_format(sale[:total_sale], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% if @tax.blank? %>
@@ -250,75 +161,9 @@
<% colspan = 7 %>
<tr style="font-weight:600;">
<td colspan="2" style='text-align:center;'>Total</td>
<% if @payment_methods.include? ("MPU") %>
<% if !request.user_agent.include? "Mobile" %>
<% colspan += 1 %>
<% end %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(mpu , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end%>
<% if @payment_methods.include? ("Master") %>
<% if !request.user_agent.include? "Mobile" %>
<% colspan += 1 %>
<% end %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(master, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end%>
<% if @payment_methods.include? ("VISA") %>
<% if !request.user_agent.include? "Mobile" %>
<% colspan += 1 %>
<% end %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(visa, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end%>
<% if @payment_methods.include? ("JCB") %>
<% if !request.user_agent.include? "Mobile" %>
<% colspan += 1 %>
<% end %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(jcb, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end%>
<% if @payment_methods.include? ("UNIONPAY") %>
<% if !request.user_agent.include? "Mobile" %>
<% colspan += 1 %>
<% end %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(unionpay, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("Alipay") %>
<% if !request.user_agent.include? "Mobile" %>
<% colspan += 1 %>
<% end %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(alipay, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("KBZPay") %>
<% if !request.user_agent.include? "Mobile" %>
<% colspan += 1 %>
<% end %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(kbzpay, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("PAYMAL") %>
<% if !request.user_agent.include? "Mobile" %>
<% colspan += 1 %>
<% end %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(paymal, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("DINGA") %>
<% if !request.user_agent.include? "Mobile" %>
<% colspan += 1 %>
<% end %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(dinga, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("JunctionPay") %>
<% if !request.user_agent.include? "Mobile" %>
<% colspan += 1 %>
<% end %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(junctionpay, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("Redeem") %>
<% if !request.user_agent.include? "Mobile" %>
<% colspan += 1 %>
<% end %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(paypar, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("GiftVoucher") %>
<% colspan += 1 %>
<td style='text-align:right;'><%= number_format(giftvoucher, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% @payment_methods.each do |method| %>
<% colspan += 1 %>
<td style='text-align:right;'><%= number_format(@sale_data.inject(0.0.to_d) { |sum, sale| sum + sale[method.parameterize.to_sym] }, precision:precision.to_i,delimiter:delimiter) rescue 0 %></td>
<% end %>
<td style='text-align:right;'><%= number_format(cash, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_format(credit, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>

View File

@@ -27,41 +27,8 @@
<th style='text-align:center;'><%= t("views.right_panel.detail.sr") %></th>
<th style='text-align:center;'><%= t("views.right_panel.detail.date") %></th>
<% if @payment_methods.include? ("MPU") %>
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.mpu_sales") %></th>
<% end %>
<% if @payment_methods.include? ("Master") %>
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.master_sales") %></th>
<% end %>
<% if @payment_methods.include? ("VISA") %>
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.visa_sales") %></th>
<% end %>
<% if @payment_methods.include? ("JCB") %>
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.jcb_sales") %></th>
<% end %>
<% if @payment_methods.include? ("UNIONPAY") %>
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.unionpay_sales") %></th>
<% end %>
<% if @payment_methods.include? ("KBZPay") %>
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.kbzpay_sales") %></th>
<% end %>
<% if @payment_methods.include? ("Alipay") %>
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.alipay_sales") %></th>
<% end %>
<% if @payment_methods.include? ("PAYMAL") %>
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.paymal_sales") %></th>
<% end %>
<% if @payment_methods.include? ("DINGA") %>
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.dinga_sales") %></th>
<% end %>
<% if @payment_methods.include? ("JunctionPay") %>
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.junctionpay_sales") %></th>
<% end %>
<% if @payment_methods.include? ("Redeem") %>
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.redeem_sales") %></th>
<% end %>
<% if @payment_methods.include? ("GiftVoucher") %>
<th style='text-align:center;'><%= t("views.right_panel.detail.giftvoucher_sales") %></th>
<% @payment_methods.each do |method| %>
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.#{method}") %></th>
<% end %>
<th style='text-align:center;'><%= t("views.right_panel.detail.cash_sales") %></th>
<th style='text-align:center;'><%= t("views.right_panel.detail.credit_sales") %></th>
@@ -108,22 +75,10 @@
<% count = 1 %> <% rounding_adj = 0 %>
<% @sale_data.each do |sale| %>
<% void += sale[:void_amount] %>
<% mpu += sale[:mpu_amount] %>
<% master += sale[:master_amount] %>
<% visa += sale[:visa_amount] %>
<% jcb += sale[:jcb_amount] %>
<% unionpay += sale[:unionpay_amount] %>
<% alipay += sale[:alipay_amount] %>
<% paymal += sale[:paymal_amount] %>
<% dinga += sale[:dinga_amount] %>
<% junctionpay += sale[:junctionpay_amount] %>
<% giftvoucher += sale[:giftvoucher_amount] %>
<% paypar += sale[:paypar_amount] %>
<% cash += sale[:cash_amount]-sale[:total_change_amount] %>
<% credit += sale[:credit_amount] %>
<% foc += sale[:foc_amount] %>
<% discount += sale[:total_discount] %>
<% kbzpay += sale[:kbzpay_amount] %>
<% total += sale[:grand_total].to_f + sale[:rounding_adj].to_f %>
<% grand_total += sale[:grand_total].to_f %>
<% old_grand_total += sale[:old_grand_total].to_f %>
@@ -135,41 +90,8 @@
<tr>
<td style='text-align:right;'><%= count %></td>
<td><%= sale[:sale_date].strftime("#{sale[:sale_date].day.ordinalize} %b") rescue '-' %></td>
<% if @payment_methods.include? ("MPU") %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:mpu_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("Master") %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:master_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("VISA") %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:visa_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("JCB") %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:jcb_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("UNIONPAY") %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:unionpay_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("Alipay") %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:alipay_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("KBZPay") %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:kbzpay_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("PAYMAL") %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:paymal_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("DINGA") %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:dinga_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("JunctionPay") %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:junctionpay_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("Redeem") %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(sale[:paypar_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("GiftVoucher") %>
<td style='text-align:right;'><%= number_format(sale[:giftvoucher_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% @payment_methods.each do |method| %>
<td style='text-align:right;'><%= number_format(sale[method.parameterize.to_sym], precision:precision.to_i, delimiter: delimiter) rescue 0 %></td>
<% end %>
<td style='text-align:right;'><%= number_format(sale[:cash_amount]-sale[:total_change_amount], precision:precision.to_i, delimiter: delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_format(sale[:credit_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
@@ -192,75 +114,9 @@
<% colspan = 7 %>
<tr style="font-weight:600;">
<td colspan="2" style='text-align:center;'>Total</td>
<% if @payment_methods.include? ("MPU") %>
<% if !request.user_agent.include? "Mobile" %>
<% colspan += 1 %>
<% end %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(mpu , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end%>
<% if @payment_methods.include? ("Master") %>
<% if !request.user_agent.include? "Mobile" %>
<% colspan += 1 %>
<% end %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(master, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end%>
<% if @payment_methods.include? ("VISA") %>
<% if !request.user_agent.include? "Mobile" %>
<% colspan += 1 %>
<% end %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(visa, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end%>
<% if @payment_methods.include? ("JCB") %>
<% if !request.user_agent.include? "Mobile" %>
<% colspan += 1 %>
<% end %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(jcb, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end%>
<% if @payment_methods.include? ("UNIONPAY") %>
<% if !request.user_agent.include? "Mobile" %>
<% colspan += 1 %>
<% end %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(unionpay, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("Alipay") %>
<% if !request.user_agent.include? "Mobile" %>
<% colspan += 1 %>
<% end %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(alipay, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("KBZPay") %>
<% if !request.user_agent.include? "Mobile" %>
<% colspan += 1 %>
<% end %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(kbzpay, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("PAYMAL") %>
<% if !request.user_agent.include? "Mobile" %>
<% colspan += 1 %>
<% end %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(paymal, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("DINGA") %>
<% if !request.user_agent.include? "Mobile" %>
<% colspan += 1 %>
<% end %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(dinga, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("JunctionPay") %>
<% if !request.user_agent.include? "Mobile" %>
<% colspan += 1 %>
<% end %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(junctionpay, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("Redeem") %>
<% if !request.user_agent.include? "Mobile" %>
<% colspan += 1 %>
<% end %>
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_format(paypar, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% end %>
<% if @payment_methods.include? ("GiftVoucher") %>
<% colspan += 1 %>
<td style='text-align:right;'><%= number_format(giftvoucher, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<% @payment_methods.each do |method| %>
<% colspan += 1 %>
<td style='text-align:right;'><%= number_format(@sale_data.inject(0.0.to_d) { |sum, sale| sum + sale[method.parameterize.to_sym] }, precision:precision.to_i,delimiter:delimiter) rescue 0 %></td>
<% end %>
<td style='text-align:right;'><%= number_format(cash, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td style='text-align:right;'><%= number_format(credit, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
@@ -293,12 +149,12 @@
<% net = net - total_tax %>
<tr style="font-weight:600;">
<td colspan="<%= colspan %>" style='text-align:right;'><%= t("views.right_panel.detail.net_amount") %></td>
<td colspan="5" style='text-align:right;'><%= number_format(net, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td colspan="2" style='text-align:right;'><%= number_format(net, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
</tr>
<% else %>
<tr style="font-weight:600;">
<td colspan="<%= colspan %>" style='text-align:right;'><%= t("views.right_panel.detail.net_amount") %></td>
<td colspan="5" style='text-align:right;'><%= number_format(net_sale, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td colspan="2" style='text-align:right;'><%= number_format(net_sale, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
</tr>
<% end %>
</tbody>

View File

@@ -40,42 +40,25 @@
</tr>
<% end %>
<tr>
<th><%= t("views.right_panel.detail.mpu_sales") %></th>
<th><%= t("views.right_panel.detail.master_sales") %></th>
<th><%= t("views.right_panel.detail.visa_sales") %></th>
<th><%= t("views.right_panel.detail.jcb_sales") %></th>
<th><%= t("views.right_panel.detail.unionpay_sales") %></th>
<th><%= t("views.right_panel.detail.alipay_sales") %></th>
<th><%= t("views.right_panel.detail.kbzpay_sales") %></th>
<!-- <th><%= t("views.right_panel.detail.paymal_sales") %></th> -->
<th><%= t("views.right_panel.detail.dinga_sales") %></th>
<th><%= t("views.right_panel.detail.junctionpay_sales") %></th>
<th><%= t("views.right_panel.detail.redeem_sales") %></th>
<% @payment_methods.each do |method| %>
<th><%= t("views.right_panel.detail.#{method} Sales") %></th>
<% end %>
<th><%= t("views.right_panel.detail.cash_sales") %></th>
<th><%= t("views.right_panel.detail.credit_sales") %></th>
<th><%= t("views.right_panel.detail.foc_sales") %></th>
<th><%= t("views.right_panel.detail.giftvoucher_sales") %></th>
</tr>
</thead>
<% unless @sale_data.empty? %>
<tbody>
<% @sale_data.each do |sale| %>
<tr>
<td><%= number_format(sale[:mpu_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
<td><%= number_format(sale[:master_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
<td><%= number_format(sale[:visa_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
<td><%= number_format(sale[:jcb_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
<td><%= number_format(sale[:unionpay_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
<td><%= number_format(sale[:alipay_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
<td><%= number_format(sale[:kbzpay_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
<!-- <td><%= number_format(sale[:paymal_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td> -->
<td><%= number_format(sale[:dinga_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
<td><%= number_format(sale[:junctionpay_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
<td><%= number_format(sale[:paypar_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
<% @payment_methods.each do |method| %>
<td><%= number_format(sale[method.parameterize.to_sym] , precision: precision.to_i ,delimiter: delimiter) rescue 0 %></td>
<% end %>
<td><%= number_format(sale[:cash_amount]-sale[:total_change_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
<td><%= number_format(sale[:credit_amount] , precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
<td><%= number_format(sale[:foc_amount] , precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
<td><%= number_format(sale[:giftvoucher_amount] , precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
<!-- <td><%= number_format(sale[:giftvoucher_amount] , precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td> -->
</tr>
<% end %>

View File

@@ -27,42 +27,24 @@
</tr>
<% end %>
<tr>
<th><%= t("views.right_panel.detail.mpu_sales") %></th>
<th><%= t("views.right_panel.detail.master_sales") %></th>
<th><%= t("views.right_panel.detail.visa_sales") %></th>
<th><%= t("views.right_panel.detail.jcb_sales") %></th>
<th><%= t("views.right_panel.detail.unionpay_sales") %></th>
<th><%= t("views.right_panel.detail.alipay_sales") %></th>
<th><%= t("views.right_panel.detail.kbzpay_sales") %></th>
<!-- <th><%= t("views.right_panel.detail.paymal_sales") %></th> -->
<th><%= t("views.right_panel.detail.dinga_sales") %></th>
<th><%= t("views.right_panel.detail.junctionpay_sales") %></th>
<th><%= t("views.right_panel.detail.redeem_sales") %></th>
<% @payment_methods.each do |method| %>
<th><%= t("views.right_panel.detail.#{method} Sales") %></th>
<% end %>
<th><%= t("views.right_panel.detail.cash_sales") %></th>
<th><%= t("views.right_panel.detail.credit_sales") %></th>
<th><%= t("views.right_panel.detail.foc_sales") %></th>
<th><%= t("views.right_panel.detail.giftvoucher_sales") %></th>
</tr>
</thead>
<% unless @sale_data.empty? %>
<tbody>
<% @sale_data.each do |sale| %>
<tr>
<td><%= number_format(sale[:mpu_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
<td><%= number_format(sale[:master_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
<td><%= number_format(sale[:visa_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
<td><%= number_format(sale[:jcb_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
<td><%= number_format(sale[:unionpay_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
<td><%= number_format(sale[:alipay_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
<td><%= number_format(sale[:kbzpay_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
<!-- <td><%= number_format(sale[:paymal_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td> -->
<td><%= number_format(sale[:dinga_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
<td><%= number_format(sale[:junctionpay_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
<td><%= number_format(sale[:paypar_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
<% @payment_methods.each do |method| %>
<td><%= number_format(sale[method.parameterize.to_sym] , precision: precision.to_i ,delimiter: delimiter) rescue 0 %></td>
<% end %>
<td><%= number_format(sale[:cash_amount]-sale[:total_change_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
<td><%= number_format(sale[:credit_amount] , precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
<td><%= number_format(sale[:foc_amount] , precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
<td><%= number_format(sale[:giftvoucher_amount] , precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
</tr>
<% end %>

View File

@@ -0,0 +1,47 @@
<% license_status = current_license.detail_with_local_file %>
<% renewable_date = current_license.read_license("renewable_date") %>
<% date_count = (renewable_date.to_date - Date.today).to_i %>
<% day = pluralize( date_count, 'day' )%>
<% if license_status == 0
text = 'Your license has expired.'
elsif license_status == 2
text = "Your license will expire in #{day}."
end
%>
<% if license_status == 0 || license_status == 2 %>
<div class="alert alert-danger fade show text-center" role="alert">
<strong style="margin-left: 40px !important"><%= text %></strong>
<%= link_to 'Review License', expire_url, class: 'btn btn-sm btn-primary', style: "margin-left: 20px !important"%>
<button type="button" class="close btn-close" data-dismiss="alert" aria-label="Close" style="padding-top: 5px;">
<span aria-hidden="true" class="text-white">&times;</span>
</button>
</div>
<% end %>
<script>
$(document).ready(function() {
if (<%= license_status %> == 1) {
$('.navbar').css("top", 0)
$('section.content').css('margin-top', '0 !important')
}
else {
$('.navbar').css("top", '45px')
$('.block-header, .addorder-pages').css('margin-top', '115px')
$('.page-header, .m-top-100').css('margin-top', '100px')
$('.alert-danger').css({
'top': 0,
'position': 'fixed',
'z-index': 999,
'width': '100%'
})
}
$('.btn-close').on ('click', function() {
$('.navbar').css("top", '0')
$('.block-header, .addorder-pages').css('margin-top', '')
$('.page-header, .m-top-100').css('margin-top', '')
})
})
</script>