Pull from master
This commit is contained in:
@@ -53,7 +53,7 @@ json.id item.id
|
||||
json.code item.item_code
|
||||
json.name item.name
|
||||
json.alt_name item.alt_name
|
||||
if !request_url.nil? && request_url != ''
|
||||
if !request_url.nil? && request_url != '' && !item.image_path.url.nil?
|
||||
json.image request_url + item.image_path.url.to_s
|
||||
else
|
||||
json.image item.image_path.url
|
||||
|
||||
@@ -101,7 +101,7 @@
|
||||
<div class="card">
|
||||
<div class="card-block" style="">
|
||||
<div class="card-text" id="custom-slimscroll">
|
||||
<div class="card-columns custom-card-columns menu_items_list" style="column-gap: 0.5rem;">
|
||||
<div class="row menu_items_list" style="margin:0px 1px 0px 1px ;">
|
||||
<!-- append data -->
|
||||
<% @menu.each do |menu| %>
|
||||
<% if !menu.valid_time.nil? %>
|
||||
@@ -255,9 +255,9 @@
|
||||
|
||||
<table class="table" id="order-charges-table" border="0">
|
||||
<tr>
|
||||
<td style="padding:2px;" width="5%"></td>
|
||||
<td style="padding:2px;" width="15%"></td>
|
||||
<td style="padding:2px; text-align:" class="charges-name" width="25%"><strong>Total:</strong></td>
|
||||
<td colspan="2" style="padding:2px; text-align:" class="charges-name" width="25%"><strong>Total:</strong></td>
|
||||
<td style="padding:2px;" width="15%"><strong id="total_qty">0</strong></td>
|
||||
|
||||
<td style="padding:2px; text-align:" width="25%" class="item-attr"><strong id="sub_total">0.00</strong></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -6,11 +6,12 @@ json.valid_time_to menu.valid_time_to.strftime("%H:%M")
|
||||
|
||||
if (menu.menu_categories)
|
||||
order_by = Lookup.find_by_lookup_type("order_by")
|
||||
if !order_by.nil? && order_by.value == "name"
|
||||
categories = MenuCategory.unscoped.where("menu_id ='#{menu.id}'").order("name asc")
|
||||
else
|
||||
categories = menu.menu_categories
|
||||
end
|
||||
# if !order_by.nil? && order_by.value == "name"
|
||||
# categories = MenuCategory.unscoped.where("menu_id ='#{menu.id}'").order("name asc")
|
||||
# else
|
||||
# categories = menu.menu_categories
|
||||
# end
|
||||
categories = menu.menu_categories
|
||||
json.categories categories do |category|
|
||||
|
||||
menu_category = MenuCategory.find_by_menu_category_id(category.id)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
`<div class="container-fluid">
|
||||
<div class="container-fluid">
|
||||
<div id="loading_wrapper" style="display:none;">
|
||||
<div id="loading"></div>
|
||||
</div>
|
||||
@@ -97,16 +97,23 @@
|
||||
<td class="item-attr"><strong><span>(<%= number_with_precision(@sale_data.total_discount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %>)</span></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Tax
|
||||
(<% @i = 0
|
||||
@account_arr.each do |ct| %>
|
||||
<%=ct.name%>
|
||||
<% if @account_arr.count != @i+1%>
|
||||
+ <% @i =+1 %>
|
||||
<%end%>
|
||||
<%end %>)
|
||||
</strong></td>
|
||||
<td class="item-attr"><strong><span><%= number_with_precision(@sale_data.total_tax, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i )%></span></strong></td>
|
||||
<td class="charges-name">
|
||||
<strong>
|
||||
<% if !@account_arr.empty? %>
|
||||
Tax
|
||||
(<% @i = 0
|
||||
@account_arr.each do |ct| %>
|
||||
<%=ct.tax_name%>
|
||||
<% if @account_arr.count != @i+1%>
|
||||
+ <% @i =+1 %>
|
||||
<%end%>
|
||||
<%end %>)
|
||||
<% else %>
|
||||
No Tax
|
||||
<% end %></strong><br>
|
||||
<button class="btn btn-link waves-effect bg-info change_tax">Change Tax</button>
|
||||
</td>
|
||||
<td class="item-attr"><strong><span id="total_tax"><%= number_with_precision(@sale_data.total_tax, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i )%></span></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Rounding Adj:</strong></td>
|
||||
@@ -536,6 +543,61 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- change tax modal -->
|
||||
<div class="modal fade" id="change_taxModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog modal-md" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h1 class="modal-title" id="change_taxModalLabel">TAX</h1>
|
||||
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#111;">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<% if !@tax_arr.empty? %>
|
||||
<% if @tax_arr.count > 1 %>
|
||||
<div class="row text-center">
|
||||
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
|
||||
<button type="button" class="btn btn-lg tax-btn-box btn-link bg-primary waves-effect" name="tax_type" data-value="all">
|
||||
<% @i = 0
|
||||
@tax_arr.each do |tax| %>
|
||||
<%= tax %>
|
||||
<% if @tax_arr.count != @i+1%>
|
||||
+ <% @i =+1 %><br>
|
||||
<%end%>
|
||||
<% end %>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<% @tax_arr.each_with_index do |tax, tax_index| %>
|
||||
<% if (tax_index+1)%2 == 0 %>
|
||||
<div class="row clearfix"></div>
|
||||
<% end %>
|
||||
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
|
||||
<button type="button" class="btn btn-lg tax-btn-box btn-link bg-primary waves-effect" name="tax_type" data-value="<%= tax %>">
|
||||
<%= tax %>
|
||||
</button>
|
||||
</div>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<div class="row clearfix"></div>
|
||||
<div class="row text-center">
|
||||
<% @tax_arr.each do |tax| %>
|
||||
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
|
||||
<button type="button" class="btn btn-lg tax-btn-box btn-link bg-primary waves-effect" name="tax_type" data-value="<%= tax %>"><%= tax %></button>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
|
||||
<button type="button" class="btn btn-lg tax-btn-box btn-link bg-primary waves-effect" name="tax_type" data-value="no_tax">No Tax</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="sxModal">
|
||||
<div id="sxModal-Content">
|
||||
<h3>Card Tap</h3>
|
||||
@@ -681,6 +743,8 @@ var customer_name = "<%= @customer.name %>";
|
||||
var credit = $('#credit').text();
|
||||
var card = $('#card').text();
|
||||
|
||||
var tax_type = $("input:radio[name=tax_type]:checked").val();
|
||||
|
||||
if (credit <= 0) {
|
||||
calculate_member_discount(sale_id);
|
||||
}
|
||||
@@ -689,7 +753,7 @@ var customer_name = "<%= @customer.name %>";
|
||||
$('#pdfModal').focus() }).modal({show : true, backdrop : false, keyboard : false});
|
||||
$.ajax({type: "POST",
|
||||
url: "<%= origami_payment_cash_path %>",
|
||||
data: "cash="+ cash + "&sale_id=" + sale_id + "&type=" + cashier_type,
|
||||
data: "cash="+ cash + "&sale_id=" + sale_id + "&type=" + cashier_type + "&tax_type=" + tax_type,
|
||||
success:function(result){
|
||||
/* start delete receipt no in first bill*/
|
||||
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
|
||||
@@ -1346,4 +1410,41 @@ var customer_name = "<%= @customer.name %>";
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/* Start function for tax changable */
|
||||
$(".change_tax").on("click",function(){
|
||||
$("#change_taxModal").modal({show: true, backdrop: false, keyboard: false});
|
||||
});
|
||||
|
||||
$("button[name=tax_type]").on("click", function(){
|
||||
var type = $(this).attr("data-value");
|
||||
var cashier_type = '<%= @cashier_type %>';
|
||||
var sale_id = $('#sale_id').text();
|
||||
console.log(type);
|
||||
swal({
|
||||
title: "Alert",
|
||||
text: "Are you sure want to change tax?",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#DD6B55",
|
||||
confirmButtonText: "Yes, change it!",
|
||||
closeOnConfirm: false
|
||||
}, function (isConfirm) {
|
||||
if (isConfirm) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/origami/payment/"+cashier_type+"/change_tax",
|
||||
data: {sale_id: sale_id, cashier_type: cashier_type, tax_type: type},
|
||||
success:function(data){
|
||||
if(data.status){
|
||||
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment';
|
||||
}
|
||||
}
|
||||
});
|
||||
}else{
|
||||
swal.close();
|
||||
}
|
||||
});
|
||||
});
|
||||
/* End function for tax changable */
|
||||
</script>
|
||||
|
||||
@@ -126,7 +126,9 @@
|
||||
|
||||
$('.sale_item').on('click', function () {
|
||||
$('#order-items-table tr').siblings().css( "background-color", "white" );
|
||||
this.style.backgroundColor = 'lightgray';
|
||||
$('#order-items-table tr').siblings().css( "color", "black" );
|
||||
this.style.backgroundColor = 'blue';
|
||||
this.style.color = 'white';
|
||||
var sale_item_id = this.getAttribute('data-sale-item');
|
||||
var ajax_url = "/origami/select_sale_item";
|
||||
selected_sale_item = sale_item_id;
|
||||
@@ -179,11 +181,17 @@
|
||||
url: ajax_url,
|
||||
data: param_data,
|
||||
success: function (result) {
|
||||
console.log(selected_sale_item + "," +commissioner_id);
|
||||
console.log(result);
|
||||
if(result.deselect == true){
|
||||
$(commissioner).removeClass("blue").addClass("green");
|
||||
$("tr[data-sale-item=" + selected_sale_item + "] td.commissioner").text('-');
|
||||
}
|
||||
if(result.status == true){
|
||||
swal("Information",result.message,"success");
|
||||
}else{
|
||||
$("tr[data-sale-item=" + selected_sale_item + "] td.commissioner").text('-');
|
||||
swal("Opps",result.message,"warning");
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
<td><%= result.sale_id rescue '-' %></td>
|
||||
<td><%= result.sale_item_id rescue '-' %></td>
|
||||
<td><%= result.commissioner.name rescue '-' %></td>
|
||||
<td><%= result.commission.menu_item.name rescue '-' %></td>
|
||||
<td><%= result.porduct_name rescue '-' %></td>
|
||||
<td><%= number_with_precision(result.qty.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_with_precision(result.price.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_with_precision(result.amount.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
|
||||
@@ -1,158 +1,173 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="Content-type" content="application/vnd.ms-excel; charset=UTF-8">
|
||||
</head>
|
||||
<body>
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-lg-12 col-sm-12 ">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-lg-12">
|
||||
<div class="card" >
|
||||
<div class="body table-responsive">
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="15"> <%= t("views.right_panel.detail.from_date") %> : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - <%= t("views.right_panel.detail.to_date") %> : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%></th>
|
||||
</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.right_panel.detail.void_amount") %></th>
|
||||
<th style='text-align:center;'><%= t("views.right_panel.detail.mpu_sales") %></th>
|
||||
<th style='text-align:center;'><%= t("views.right_panel.detail.master_sales") %></th>
|
||||
<th style='text-align:center;'><%= t("views.right_panel.detail.visa_sales") %></th>
|
||||
<th style='text-align:center;'><%= t("views.right_panel.detail.jcb_sales") %></th>
|
||||
<th style='text-align:center;'><%= t("views.right_panel.detail.unionpay_sales") %></th>
|
||||
<th style='text-align:center;'><%= t("views.right_panel.detail.alipay_sales") %></th>
|
||||
<th style='text-align:center;'><%= t("views.right_panel.detail.paymal_sales") %></th>
|
||||
<th style='text-align:center;'><%= t("views.right_panel.detail.dinga_sales") %></th>
|
||||
<th style='text-align:center;'><%= t("views.right_panel.detail.junctionpay_sales") %></th>
|
||||
<th style='text-align:center;'><%= t("views.right_panel.detail.redeem_sales") %></th>
|
||||
<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.foc_sales") %></th>
|
||||
<th style='text-align:center;'>(<%= t("views.right_panel.detail.discount") %>)</th>
|
||||
<th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %> + <br/> <%= t("views.right_panel.detail.rnd_adj_sh") %></th>
|
||||
<th style='text-align:center;'><%= t("views.right_panel.detail.rnd_adj_sh") %></th>
|
||||
<th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<% unless @sale_data.empty? %>
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-lg-12">
|
||||
<div class="card" style="width:129%;">
|
||||
<div class="body table-responsive">
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="15"> <%= t("views.right_panel.detail.from_date") %> : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - <%= t("views.right_panel.detail.to_date") %> : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%></th>
|
||||
</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.right_panel.detail.void_amount") %></th>
|
||||
<th style='text-align:center;'><%= t("views.right_panel.detail.mpu_sales") %></th>
|
||||
<th style='text-align:center;'><%= t("views.right_panel.detail.master_sales") %></th>
|
||||
<th style='text-align:center;'><%= t("views.right_panel.detail.visa_sales") %></th>
|
||||
<th style='text-align:center;'><%= t("views.right_panel.detail.jcb_sales") %></th>
|
||||
<th style='text-align:center;'><%= t("views.right_panel.detail.unionpay_sales") %></th>
|
||||
<th style='text-align:center;'><%= t("views.right_panel.detail.alipay_sales") %></th>
|
||||
<th style='text-align:center;'><%= t("views.right_panel.detail.paymal_sales") %></th>
|
||||
<th style='text-align:center;'><%= t("views.right_panel.detail.dinga_sales") %></th>
|
||||
<th style='text-align:center;'><%= t("views.right_panel.detail.junctionpay_sales") %></th>
|
||||
<th style='text-align:center;'><%= t("views.right_panel.detail.redeem_sales") %></th>
|
||||
<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.foc_sales") %></th>
|
||||
<th style='text-align:center;'>(<%= t("views.right_panel.detail.discount") %>)</th>
|
||||
<!-- <th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %> + <br/> <%= t("views.right_panel.detail.rnd_adj_sh") %></th> -->
|
||||
<th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %></th>
|
||||
<th style='text-align:center;'><%= t("views.right_panel.detail.rnd_adj_sh") %></th>
|
||||
|
||||
<tbody>
|
||||
<% void = 0 %>
|
||||
<% mpu = 0 %>
|
||||
<% master = 0 %>
|
||||
<% visa = 0 %>
|
||||
<% jcb = 0 %>
|
||||
<% unionpay = 0 %>
|
||||
<% alipay = 0 %>
|
||||
<% paymal = 0 %>
|
||||
<% dinga = 0 %>
|
||||
<% junctionpay = 0 %>
|
||||
<% paypar = 0 %>
|
||||
<% cash = 0 %>
|
||||
<% credit = 0 %>
|
||||
<% foc = 0 %>
|
||||
<% discount = 0 %>
|
||||
<% total = 0 %>
|
||||
<% grand_total = 0 %>
|
||||
<% old_grand_total = 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] %>
|
||||
<% paypar += sale[:paypar_amount] %>
|
||||
<% cash += sale[:cash_amount]-sale[:total_change_amount] %>
|
||||
<% credit += sale[:credit_amount] %>
|
||||
<% foc += sale[:foc_amount] %>
|
||||
<% discount += sale[:total_discount] %>
|
||||
<% 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 %>
|
||||
<% rounding_adj += sale[:rounding_adj].to_f %>
|
||||
<tr>
|
||||
<td style='text-align:right;'><%= count %></td>
|
||||
<td><%= sale[:sale_date].strftime("#{sale[:sale_date].day.ordinalize} %b") rescue '-' %></td>
|
||||
<td style='color:red;text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:void_amount]), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:mpu_amount]), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:master_amount]), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:visa_amount]), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:jcb_amount]), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:unionpay_amount]), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:alipay_amount]), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:paymal_amount]), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:dinga_amount]), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:junctionpay_amount]), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:paypar_amount]), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:cash_amount]-sale[:total_change_amount]), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:credit_amount]), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:foc_amount]), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'>(<%= number_with_delimiter(sprintf("%.2f",sale[:total_discount]), :delimiter => ',') rescue '-'%>)</td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:grand_total].to_f + sale[:rounding_adj].to_f ), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:rounding_adj].to_f), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:grand_total]), :delimiter => ',') rescue '-'%></td>
|
||||
</tr>
|
||||
<% count = count + 1 %>
|
||||
<% end %>
|
||||
</tr>
|
||||
</thead>
|
||||
<% if @print_settings.precision.to_i > 0
|
||||
precision = @print_settings.precision
|
||||
else
|
||||
precision = 0
|
||||
end
|
||||
#check delimiter
|
||||
if @print_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end
|
||||
%>
|
||||
<% unless @sale_data.empty? %>
|
||||
|
||||
<tr style="font-weight:600;">
|
||||
<td colspan="3" style='text-align:center;'>Total</td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",mpu), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",master), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",visa), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",jcb), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",paypar), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",cash), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",credit), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",foc), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'>(<%= number_with_delimiter(sprintf("%.2f",discount), :delimiter => ',') rescue '-'%>)</td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",total), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",rounding_adj), :delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",grand_total), :delimiter => ',') rescue '-'%></td>
|
||||
</tr>
|
||||
<tbody>
|
||||
<% void = 0 %>
|
||||
<% mpu = 0 %>
|
||||
<% master = 0 %>
|
||||
<% visa = 0 %>
|
||||
<% jcb = 0 %>
|
||||
<% unionpay = 0 %>
|
||||
<% alipay = 0 %>
|
||||
<% paymal = 0 %>
|
||||
<% dinga = 0 %>
|
||||
<% junctionpay = 0 %>
|
||||
<% paypar = 0 %>
|
||||
<% cash = 0 %>
|
||||
<% credit = 0 %>
|
||||
<% foc = 0 %>
|
||||
<% discount = 0 %>
|
||||
<% total = 0 %>
|
||||
<% grand_total = 0 %>
|
||||
<% old_grand_total = 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] %>
|
||||
<% paypar += sale[:paypar_amount] %>
|
||||
<% cash += sale[:cash_amount]-sale[:total_change_amount] %>
|
||||
<% credit += sale[:credit_amount] %>
|
||||
<% foc += sale[:foc_amount] %>
|
||||
<% discount += sale[:total_discount] %>
|
||||
<% 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 %>
|
||||
<% rounding_adj += sale[:rounding_adj].to_f %>
|
||||
<tr>
|
||||
<td style='text-align:right;'><%= count %></td>
|
||||
<td><%= sale[:sale_date].strftime("#{sale[:sale_date].day.ordinalize} %b") rescue '-' %></td>
|
||||
<td style='color:red;text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:void_amount]), delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:mpu_amount]),delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:master_amount]),delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:visa_amount]),delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:jcb_amount]),delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:unionpay_amount]),delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:alipay_amount]),delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:paymal_amount]),delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:dinga_amount]),delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:junctionpay_amount]),delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:paypar_amount]),delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:cash_amount]-sale[:total_change_amount]), delimiter: delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:credit_amount]),delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:foc_amount]),delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'>(<%= number_with_delimiter(sprintf("%.2f",sale[:total_discount]), delimiter => ',') rescue '-'%>)</td>
|
||||
<!-- <td style='text-align:right;'><%= number_with_delimiter(sale[:grand_total].to_f + sale[:rounding_adj].to_f ,delimiter => ',') rescue '-'%></td> -->
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:grand_total]),delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:rounding_adj].to_f),delimiter => ',') rescue '-'%></td>
|
||||
|
||||
<% total_tax = 0 %>
|
||||
<% net = 0 %>
|
||||
<% unless @tax.empty? %>
|
||||
<% @tax.each do |tax| %>
|
||||
<% total_tax += tax.tax_amount.to_f %>
|
||||
<tr style="font-weight:600;">
|
||||
<td colspan="12" style='text-align:right;'><%= tax.tax_name rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",tax.tax_amount), :delimiter => ',') rescue '-'%></td>
|
||||
<td colspan="2"> </td>
|
||||
</tr>
|
||||
</tr>
|
||||
<% count = count + 1 %>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
<% net = grand_total %>
|
||||
<% net = net - rounding_adj%>
|
||||
<% net = net - total_tax %>
|
||||
<tr style="font-weight:600;">
|
||||
<td colspan="12" style='text-align:right;'><%= t("views.right_panel.detail.net_amount") %></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",net), :delimiter => ',') rescue '-'%></td>
|
||||
<td colspan="2"> </td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
<% end %>
|
||||
</table>
|
||||
<tr style="font-weight:600;">
|
||||
<td colspan="3" style='text-align:center;'>Total</td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",mpu),delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",master),delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",visa), delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",jcb),delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",unionpay),delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",alipay),delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",paymal),delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",dinga),delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",junctionpay),delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",paypar),delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",cash),delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",credit),delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",foc), delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'>(<%= number_with_delimiter(discount,delimiter => ',') rescue '-'%>)</td>
|
||||
<!-- <td style='text-align:right;'><%= number_with_delimiter(total,delimiter => ',') rescue '-'%></td> -->
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",grand_total),delimiter => ',') rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",rounding_adj),delimiter => ',') rescue '-'%></td>
|
||||
|
||||
</tr>
|
||||
<% total_tax = 0 %>
|
||||
<% net = 0 %>
|
||||
<% unless @tax.empty? %>
|
||||
<% @tax.each do |tax|
|
||||
total_tax += tax.tax_amount.to_f %>
|
||||
<tr style="font-weight:600;">
|
||||
<td colspan="17" style='text-align:right;'><%= tax.tax_name rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",tax.tax_amount),delimiter => ',') rescue '-'%></td>
|
||||
<td colspan="2"> </td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% net = grand_total %>
|
||||
<% net = net - rounding_adj%>
|
||||
<% net = net - total_tax %>
|
||||
<tr style="font-weight:600;">
|
||||
<td colspan="17" style='text-align:right;'><%= t("views.right_panel.detail.net_amount") %></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",net),delimiter => ',') rescue '-'%></td>
|
||||
<td colspan="2"> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<% end %>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user