Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant
This commit is contained in:
@@ -759,30 +759,41 @@
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
||||
// Print for first bill
|
||||
$("#first_bill").on('click', function () {
|
||||
var sale_id = $('#sale_id').val();
|
||||
var ajax_url = "/origami/sale/" + sale_id + "/first_bill";
|
||||
var server_mode =
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: ajax_url,
|
||||
success: function (result) {
|
||||
receipt_no = ($("#receipt_no").html()).trim();
|
||||
if((receipt_no!=undefined) && (receipt_no!=""))
|
||||
createReceiptNoInFirstBillData(receipt_no,"");
|
||||
swal({
|
||||
title: "Alert",
|
||||
text: "Are you sure want to print First Bill?",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#DD6B55",
|
||||
confirmButtonText: "Yes, print it!",
|
||||
closeOnConfirm: false
|
||||
}, function (isConfirm) {
|
||||
if (isConfirm) {
|
||||
var sale_id = $('#sale_id').val();
|
||||
var ajax_url = "/origami/sale/" + sale_id + "/first_bill";
|
||||
var server_mode =
|
||||
|
||||
// For Server Print - from jade
|
||||
if ($("#server_mode").val() == "cloud") {
|
||||
code2lab.printFile(result.filepath.substr(6), result.printer_url);
|
||||
}
|
||||
|
||||
// console.log(result);
|
||||
// code2lab.printBill(result.filepath, result.printer_model, result.printer_url);
|
||||
location.reload();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: ajax_url,
|
||||
success: function (result) {
|
||||
receipt_no = ($("#receipt_no").html()).trim();
|
||||
if((receipt_no!=undefined) && (receipt_no!=""))
|
||||
createReceiptNoInFirstBillData(receipt_no,"");
|
||||
|
||||
// For Server Print - from jade
|
||||
if ($("#server_mode").val() == "cloud") {
|
||||
code2lab.printFile(result.filepath.substr(6), result.printer_url);
|
||||
}
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// click select option icon for add
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
<th><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %></th>
|
||||
<th><%= t("views.right_panel.detail.discount") %> <%= t("views.right_panel.detail.amount") %> </th>
|
||||
<% @tax_profiles.each do |tax| %>
|
||||
<th><%= tax.name %></th>
|
||||
<th><%= tax.name %></th>
|
||||
<% end %>
|
||||
<!-- <th>Other Amount</th> -->
|
||||
<th><%= t("views.right_panel.detail.grand_total") %></th>
|
||||
@@ -89,20 +89,39 @@
|
||||
<% total_sum += result.total_amount.to_f %>
|
||||
<% discount_amt += result.total_discount.to_f %>
|
||||
<% rounding_adj += result.rounding_adjustment.to_f %>
|
||||
|
||||
|
||||
|
||||
|
||||
<% tax_profile_count = @tax_profiles.length %>
|
||||
<% sale_tax_count = result.sale_taxes.length %>
|
||||
<% tax_count = tax_profile_count - sale_tax_count %>
|
||||
<tr>
|
||||
|
||||
<td><%= result.receipt_no rescue '-' %> </td>
|
||||
<td><%= result.cashier_name rescue '-' %></td>
|
||||
<td><%= number_with_precision(result.total_amount, precision: precision.to_i ,delimiter: delimiter) %></td>
|
||||
<td><%= number_with_precision(result.total_discount, precision: precision.to_i ,delimiter: delimiter) %></td>
|
||||
<%if result.customer.customer_type == "Takeaway"%>
|
||||
<td><%= number_with_precision(0, precision: precision.to_i ,delimiter: delimiter) %></td>
|
||||
<%end%>
|
||||
<% result.sale_taxes.each do |tax| %>
|
||||
<td><%= number_with_precision(tax.tax_payable_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<td><%= number_with_precision(result.total_discount, precision: precision.to_i ,delimiter: delimiter) rescue '0' %>
|
||||
</td>
|
||||
<!-- <%if result.customer.customer_type == "Takeaway"%>
|
||||
<td><%= number_with_precision(0, precision: precision.to_i ,delimiter: delimiter) %></td>
|
||||
<%end%> -->
|
||||
<% if !result.sale_taxes.empty? %>
|
||||
<% num = 1
|
||||
if tax_count > 0 %>
|
||||
<% while num <= tax_count %>
|
||||
<td>
|
||||
<%= number_with_precision(0, precision: precision.to_i ,delimiter: delimiter) %>
|
||||
</td>
|
||||
<% num += 1
|
||||
end %>
|
||||
<% end %>
|
||||
<% result.sale_taxes.each do |tax| %>
|
||||
<td>
|
||||
<%= number_with_precision(tax.tax_payable_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-' %>
|
||||
</td>
|
||||
<%end%>
|
||||
<% else %>
|
||||
<% @tax_profiles.each do |tax| %>
|
||||
<td><%= number_with_precision(0, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<% end %>
|
||||
<%end%>
|
||||
<td><%= number_with_precision(result.grand_total_after_rounding(), precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
|
||||
|
||||
@@ -59,17 +59,35 @@
|
||||
<% discount_amt += result.total_discount.to_f %>
|
||||
<% rounding_adj += result.rounding_adjustment.to_f %>
|
||||
|
||||
<% tax_profile_count = @tax_profiles.length %>
|
||||
<% sale_tax_count = result.sale_taxes.length %>
|
||||
<% tax_count = tax_profile_count - sale_tax_count %>
|
||||
<tr>
|
||||
|
||||
<td><%= result.receipt_no rescue '-' %> </td>
|
||||
<td><%= result.cashier_name rescue '-' %></td>
|
||||
<td><%= result.total_amount rescue '-' %></td>
|
||||
<td><%= result.total_discount rescue '-' %></td>
|
||||
<%if result.customer.customer_type == "Takeaway"%>
|
||||
<!-- <%if result.customer.customer_type == "Takeaway"%>
|
||||
<td>0.0</td>
|
||||
<%end%>
|
||||
<% result.sale_taxes.each do |tax| %>
|
||||
<td><%= tax.tax_payable_amount rescue '-' %></td>
|
||||
<%end%> -->
|
||||
<% if !result.sale_taxes.empty? %>
|
||||
<% num = 1
|
||||
if tax_count > 0 %>
|
||||
<% while num <= tax_count %>
|
||||
<td>0</td>
|
||||
<% num += 1
|
||||
end %>
|
||||
<% end %>
|
||||
<% result.sale_taxes.each do |tax| %>
|
||||
<td>
|
||||
<%= tax.tax_payable_amount rescue '-' %>
|
||||
</td>
|
||||
<%end%>
|
||||
<% else %>
|
||||
<% @tax_profiles.each do |tax| %>
|
||||
<td>0</td>
|
||||
<% end %>
|
||||
<%end%>
|
||||
|
||||
<td><%= result.grand_total %></td>
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
<div class="page-header">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li>
|
||||
@@ -10,253 +9,299 @@
|
||||
</ol>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-12 col-md-12 col-sm-12">
|
||||
<!-- Column One -->
|
||||
<div class="col-lg-12 col-md-12 col-sm-12">
|
||||
<!-- Column One -->
|
||||
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="tab" href="#queue" role="tab"><%= t :sale_details %> </a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link " data-toggle="tab" href="#booking" role="tab"><%= t :order_details %></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#customer" role="tab"><%= t :customer_details %></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#sale_audit" role="tab"><%= t :sale_audits %></a>
|
||||
</li>
|
||||
</ul>
|
||||
<!-- Nav tabs - End -->
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="tab" href="#queue" role="tab"><%= t :sale_details %> </a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link " data-toggle="tab" href="#booking" role="tab"><%= t :order_details %></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#customer" role="tab"><%= t :customer_details %></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#sale_audit" role="tab"><%= t :sale_audits %></a>
|
||||
</li>
|
||||
</ul>
|
||||
<!-- Nav tabs - End -->
|
||||
|
||||
<div class="tab-content" style="min-height:670px; max-height:670px;">
|
||||
|
||||
<div class="tab-pane active" id="queue" role="tabpanel" style="min-height:670px; max-height:670px; overflow-y:">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
|
||||
<tr>
|
||||
<th><%= t("views.right_panel.detail.receipt_date") %></th>
|
||||
<th><%= t("views.right_panel.detail.receipt_no") %></th>
|
||||
<th><%= t :cashier %></th>
|
||||
<th><%= t("views.right_panel.detail.sales_status") %></th>
|
||||
<th><%= t("views.right_panel.detail.receipt_generated_at") %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><%= @sale.receipt_date.strftime("%d-%M-%Y") %></td>
|
||||
<td><%= @sale.receipt_no %></td>
|
||||
<td><%= @sale.cashier_name rescue '-' %></td>
|
||||
<td> <%= @sale.sale_status %> </td>
|
||||
<td colspan="2"> <%= @sale.requested_at.strftime("%m-%d-%Y %H:%M %p") %> </td>
|
||||
</tr>
|
||||
<tr style="border-top:2px solid #000">
|
||||
<th><%= t :sale %> <%= t("views.right_panel.detail.item_txt") %> <%= t("views.right_panel.detail.name_txt2") %></th>
|
||||
<th><%= t("views.right_panel.detail.qty") %></th>
|
||||
<th><%= t("views.right_panel.detail.unit_price") %></th>
|
||||
<th><%= t("views.right_panel.detail.total_price") %></th>
|
||||
<th><%= t("views.right_panel.detail.created_at") %></th>
|
||||
<th><%= t("views.right_panel.detail.remark") %></th>
|
||||
</tr>
|
||||
<% @sale.sale_items.each do |s| %>
|
||||
|
||||
<tr>
|
||||
<td><%=s.product_name rescue ' '%></td>
|
||||
<td><%=s.qty rescue ' '%></td>
|
||||
<td><%= number_with_precision(s.unit_price, :precision => 2, :delimiter => ',') rescue ' '%></td>
|
||||
<td><%= number_with_precision(s.price, :precision => 2, :delimiter => ',') rescue ' '%></td>
|
||||
<td><%=l s.created_at.utc.getlocal , :format => :short rescue ' ' %></td>
|
||||
<td><%=s.remark rescue ' '%></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<tr style="border-top:2px solid #000">
|
||||
<td colspan=2 style="text-align:center"></td>
|
||||
<td><%= t("views.right_panel.detail.total") %></td>
|
||||
<td colspan="3"><%= number_with_precision(@sale.total_amount, :precision => 2, :delimiter => ',') rescue ' '%></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan=2 style="text-align:center"></td>
|
||||
<td><%= t("views.right_panel.detail.discount") %></td>
|
||||
<td colspan="3"><%= number_with_precision(@sale.total_discount, :precision => 2, :delimiter => ',') rescue ' '%></td>
|
||||
</tr>
|
||||
<% @sale.sale_taxes.each do |r|%>
|
||||
<tr>
|
||||
<td colspan=2 style="text-align:center"></td>
|
||||
<td><%= r.tax_name %> </td>
|
||||
<td colspan="3"><%= number_with_precision(r.tax_payable_amount, :precision => 2, :delimiter => ',') rescue ' '%></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<tr>
|
||||
<td colspan=2 style="text-align:center"></td>
|
||||
<td><%= t("views.right_panel.detail.grand_total") %></td>
|
||||
<td colspan="3"><%= number_with_precision(@sale.grand_total, :precision => 2, :delimiter => ',') rescue ' '%></td>
|
||||
</tr>
|
||||
<tr><td colspan="5"> <td></tr>
|
||||
<tr>
|
||||
<td colspan=2 style="text-align:center"></td>
|
||||
<td><%= t("views.right_panel.detail.total_pay_amount") %></td>
|
||||
<td colspan="3"><%= number_with_precision(@sale.amount_received, :precision => 2, :delimiter => ',') rescue ' '%></td>
|
||||
</tr>
|
||||
|
||||
<% @sale_receivables.each do |r|%>
|
||||
<tr>
|
||||
<td colspan=2 style="text-align:center"></td>
|
||||
<td> <%= r.payment_method.capitalize rescue ' '%> Payment</td>
|
||||
<td colspan="3"><%= number_with_precision(r.payment_amount, :precision => 2, :delimiter => ',') rescue ' '%>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<% end %>
|
||||
|
||||
|
||||
<tr>
|
||||
<td colspan=2 style="text-align:center"></td>
|
||||
<td><%= t("views.right_panel.detail.change") %></td>
|
||||
<td colspan="3"><%= number_with_precision(@sale.amount_changed, :precision => 2, :delimiter => ',') rescue ' '%></td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane" id="booking" role="tabpanel">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= t("views.right_panel.detail.order_id") %></th>
|
||||
<th><%= t("views.right_panel.header.menu_item") %></th>
|
||||
<th><%= t("views.right_panel.detail.qty") %></th>
|
||||
<th><%= t("views.right_panel.detail.unit_price") %></th>
|
||||
<th><%= t("views.right_panel.detail.option") %></th>
|
||||
<th><%= t("views.right_panel.detail.status") %></th>
|
||||
<th><%= t("views.right_panel.detail.waiter") %></th>
|
||||
<th><%= t("views.right_panel.detail.created_at") %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% @order_items.each do |order_item| %>
|
||||
<tr>
|
||||
<td><%= link_to order_item.order_id, transactions_order_path(order_item.order_id) %><%= %></td>
|
||||
<td><%= order_item.item_name %></td>
|
||||
<td><%= order_item.qty %></td>
|
||||
<td><%= order_item.price %></td>
|
||||
<td><%= order_item.options %></td>
|
||||
<td><%= order_item.order_item_status %></td>
|
||||
<td><%= order_item.item_order_by %> </td>
|
||||
<td><%= order_item.created_at.strftime("%d-%m-%y %I:%M %p") %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane" id="customer" role="tabpanel">
|
||||
<br>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= t("views.right_panel.detail.card_no") %></th>
|
||||
<th><%= t("views.right_panel.detail.name") %></th>
|
||||
<th><%= t("views.right_panel.detail.company") %></th>
|
||||
<th><%= t("views.right_panel.detail.contact_no") %></th>
|
||||
<th><%= t("views.right_panel.detail.email") %></th>
|
||||
<th><%= t("views.right_panel.detail.nrc_passport_no") %></th>
|
||||
<th><%= t("views.right_panel.detail.address") %></th>
|
||||
<th><%= t("views.right_panel.detail.dob") %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><%= @customer.card_no rescue '-'%></td>
|
||||
<td><%= @customer.name %></td>
|
||||
<td><%= @customer.company rescue '-' %></td>
|
||||
<td><%= @customer.contact_no %></td>
|
||||
<td><%= @customer.email %></td>
|
||||
<td><%= @customer.nrc_no %></td>
|
||||
<td><%= @customer.address%></td>
|
||||
<td><%= @customer.date_of_birth %></td>
|
||||
</tr>
|
||||
<tr><td></td></tr>
|
||||
<% if @customer.membership_id %>
|
||||
<tr>
|
||||
<th colspan="8"><%= t("views.right_panel.detail.membership_transactions") %></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><%= t("views.right_panel.detail.date") %></th>
|
||||
<th><%= t("views.right_panel.detail.redeem") %></th>
|
||||
<th><%= t("views.right_panel.detail.rebate") %></th>
|
||||
<th><%= t("views.right_panel.detail.balance") %></th>
|
||||
<th><%= t("views.right_panel.detail.from_account") %></th>
|
||||
<th><%= t("views.right_panel.detail.status") %></th>
|
||||
<th><%= t("views.right_panel.detail.receipt_no") %></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
|
||||
<%
|
||||
if @response["status"] == true %>
|
||||
<% @response["data"].each do |transaction| %>
|
||||
<tr>
|
||||
<td><%= transaction["date"]%></td>
|
||||
<td><%= transaction["redeem"]%></td>
|
||||
<td><%= transaction["rebate"] %></td>
|
||||
<td><%= transaction["balance"] %></td>
|
||||
<td><%= transaction["account_status"] %></td>
|
||||
<td><%= transaction["status"] %></td>
|
||||
<td><%= transaction["receipt_no"] %></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane" id="sale_audit" role="tabpanel">
|
||||
<br>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= t("views.right_panel.detail.action") %></th>
|
||||
<th><%= t("views.right_panel.detail.action_at") %></th>
|
||||
<th><%= t("views.right_panel.detail.approved_at") %></th>
|
||||
<th><%= t("views.right_panel.detail.remark") %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
|
||||
<% @sale_audits.each do |audit| %>
|
||||
<tr>
|
||||
<td><%= audit.action%></td>
|
||||
<td><%= audit.action_at.strftime("%m-%d-%Y %H:%M %p")%></td>
|
||||
<td><%= audit.approved_by%></td>
|
||||
<td><%= audit.remark%></td>
|
||||
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-content" style="min-height:670px; max-height:670px;">
|
||||
|
||||
<div class="tab-pane active" id="queue" role="tabpanel" style="min-height:670px; max-height:670px; overflow-y:">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= t("views.right_panel.detail.receipt_date") %></th>
|
||||
<th><%= t("views.right_panel.detail.receipt_no") %></th>
|
||||
<th><%= t :cashier %></th>
|
||||
<th><%= t("views.right_panel.detail.sales_status") %></th>
|
||||
<th><%= t("views.right_panel.detail.receipt_generated_at") %></th>
|
||||
<% if @sale["sale_status"] == "completed" %>
|
||||
<th>
|
||||
<button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void</button>
|
||||
</th>
|
||||
<% end %>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><%= @sale.receipt_date.strftime("%d-%M-%Y") %></td>
|
||||
<td><%= @sale.receipt_no %></td>
|
||||
<td><%= @sale.cashier_name rescue '-' %></td>
|
||||
<td><%= @sale.sale_status %> </td>
|
||||
<td colspan="2"> <%= @sale.requested_at.strftime("%m-%d-%Y %H:%M %p") %> </td>
|
||||
</tr>
|
||||
<tr style="border-top:2px solid #000">
|
||||
<th><%= t :sale %> <%= t("views.right_panel.detail.item_txt") %> <%= t("views.right_panel.detail.name_txt2") %></th>
|
||||
<th><%= t("views.right_panel.detail.qty") %></th>
|
||||
<th><%= t("views.right_panel.detail.unit_price") %></th>
|
||||
<th><%= t("views.right_panel.detail.total_price") %></th>
|
||||
<th><%= t("views.right_panel.detail.created_at") %></th>
|
||||
<th><%= t("views.right_panel.detail.remark") %></th>
|
||||
</tr>
|
||||
<% @sale.sale_items.each do |s| %>
|
||||
<tr>
|
||||
<td><%=s.product_name rescue ' '%></td>
|
||||
<td><%=s.qty rescue ' '%></td>
|
||||
<td><%= number_with_precision(s.unit_price, :precision => 2, :delimiter => ',') rescue ' '%></td>
|
||||
<td><%= number_with_precision(s.price, :precision => 2, :delimiter => ',') rescue ' '%></td>
|
||||
<td><%=l s.created_at.utc.getlocal , :format => :short rescue ' ' %></td>
|
||||
<td><%=s.remark rescue ' '%></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<tr style="border-top:2px solid #000">
|
||||
<td colspan=2 style="text-align:center"></td>
|
||||
<td><%= t("views.right_panel.detail.total") %></td>
|
||||
<td colspan="3"><%= number_with_precision(@sale.total_amount, :precision => 2, :delimiter => ',') rescue ' '%></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan=2 style="text-align:center"></td>
|
||||
<td><%= t("views.right_panel.detail.discount") %></td>
|
||||
<td colspan="3"><%= number_with_precision(@sale.total_discount, :precision => 2, :delimiter => ',') rescue ' '%></td>
|
||||
</tr>
|
||||
<% @sale.sale_taxes.each do |r|%>
|
||||
<tr>
|
||||
<td colspan=2 style="text-align:center"></td>
|
||||
<td><%= r.tax_name %> </td>
|
||||
<td colspan="3"><%= number_with_precision(r.tax_payable_amount, :precision => 2, :delimiter => ',') rescue ' '%></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<tr>
|
||||
<td colspan=2 style="text-align:center"></td>
|
||||
<td><%= t("views.right_panel.detail.grand_total") %></td>
|
||||
<td colspan="3"><%= number_with_precision(@sale.grand_total, :precision => 2, :delimiter => ',') rescue ' '%></td>
|
||||
</tr>
|
||||
<tr><td colspan="5"> <td></tr>
|
||||
<tr>
|
||||
<td colspan=2 style="text-align:center"></td>
|
||||
<td><%= t("views.right_panel.detail.total_pay_amount") %></td>
|
||||
<td colspan="3"><%= number_with_precision(@sale.amount_received, :precision => 2, :delimiter => ',') rescue ' '%></td>
|
||||
</tr>
|
||||
<% @sale_receivables.each do |r|%>
|
||||
<tr>
|
||||
<td colspan=2 style="text-align:center"></td>
|
||||
<td> <%= r.payment_method.capitalize rescue ' '%> Payment</td>
|
||||
<td colspan="3"><%= number_with_precision(r.payment_amount, :precision => 2, :delimiter => ',') rescue ' '%></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<tr>
|
||||
<td colspan=2 style="text-align:center"></td>
|
||||
<td><%= t("views.right_panel.detail.change") %></td>
|
||||
<td colspan="3"><%= number_with_precision(@sale.amount_changed, :precision => 2, :delimiter => ',') rescue ' '%></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane" id="booking" role="tabpanel">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= t("views.right_panel.detail.order_id") %></th>
|
||||
<th><%= t("views.right_panel.header.menu_item") %></th>
|
||||
<th><%= t("views.right_panel.detail.qty") %></th>
|
||||
<th><%= t("views.right_panel.detail.unit_price") %></th>
|
||||
<th><%= t("views.right_panel.detail.option") %></th>
|
||||
<th><%= t("views.right_panel.detail.status") %></th>
|
||||
<th><%= t("views.right_panel.detail.waiter") %></th>
|
||||
<th><%= t("views.right_panel.detail.created_at") %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @order_items.each do |order_item| %>
|
||||
<tr>
|
||||
<td><%= link_to order_item.order_id, transactions_order_path(order_item.order_id) %><%= %></td>
|
||||
<td><%= order_item.item_name %></td>
|
||||
<td><%= order_item.qty %></td>
|
||||
<td><%= order_item.price %></td>
|
||||
<td><%= order_item.options %></td>
|
||||
<td><%= order_item.order_item_status %></td>
|
||||
<td><%= order_item.item_order_by %> </td>
|
||||
<td><%= order_item.created_at.strftime("%d-%m-%y %I:%M %p") %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane" id="customer" role="tabpanel">
|
||||
<br>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= t("views.right_panel.detail.card_no") %></th>
|
||||
<th><%= t("views.right_panel.detail.name") %></th>
|
||||
<th><%= t("views.right_panel.detail.company") %></th>
|
||||
<th><%= t("views.right_panel.detail.contact_no") %></th>
|
||||
<th><%= t("views.right_panel.detail.email") %></th>
|
||||
<th><%= t("views.right_panel.detail.nrc_passport_no") %></th>
|
||||
<th><%= t("views.right_panel.detail.address") %></th>
|
||||
<th><%= t("views.right_panel.detail.dob") %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><%= @customer.card_no rescue '-'%></td>
|
||||
<td><%= @customer.name %></td>
|
||||
<td><%= @customer.company rescue '-' %></td>
|
||||
<td><%= @customer.contact_no %></td>
|
||||
<td><%= @customer.email %></td>
|
||||
<td><%= @customer.nrc_no %></td>
|
||||
<td><%= @customer.address%></td>
|
||||
<td><%= @customer.date_of_birth %></td>
|
||||
</tr>
|
||||
<tr><td></td></tr>
|
||||
<% if @customer.membership_id %>
|
||||
<tr>
|
||||
<th colspan="8"><%= t("views.right_panel.detail.membership_transactions") %></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><%= t("views.right_panel.detail.date") %></th>
|
||||
<th><%= t("views.right_panel.detail.redeem") %></th>
|
||||
<th><%= t("views.right_panel.detail.rebate") %></th>
|
||||
<th><%= t("views.right_panel.detail.balance") %></th>
|
||||
<th><%= t("views.right_panel.detail.from_account") %></th>
|
||||
<th><%= t("views.right_panel.detail.status") %></th>
|
||||
<th><%= t("views.right_panel.detail.receipt_no") %></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
|
||||
<% if @response["status"] == true %>
|
||||
<% @response["data"].each do |transaction| %>
|
||||
<tr>
|
||||
<td><%= transaction["date"]%></td>
|
||||
<td><%= transaction["redeem"]%></td>
|
||||
<td><%= transaction["rebate"] %></td>
|
||||
<td><%= transaction["balance"] %></td>
|
||||
<td><%= transaction["account_status"] %></td>
|
||||
<td><%= transaction["status"] %></td>
|
||||
<td><%= transaction["receipt_no"] %></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane" id="sale_audit" role="tabpanel">
|
||||
<br>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= t("views.right_panel.detail.action") %></th>
|
||||
<th><%= t("views.right_panel.detail.action_at") %></th>
|
||||
<th><%= t("views.right_panel.detail.approved_at") %></th>
|
||||
<th><%= t("views.right_panel.detail.remark") %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @sale_audits.each do |audit| %>
|
||||
<tr>
|
||||
<td><%= audit.action%></td>
|
||||
<td><%= audit.action_at.strftime("%m-%d-%Y %H:%M %p")%></td>
|
||||
<td><%= audit.approved_by%></td>
|
||||
<td><%= audit.remark%></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="voidModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="voidModalLabel">Please Enter Reason for Void</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<input type="textarea" name="remark" class="form-control col-md-12 remark" id="remark">
|
||||
</div>
|
||||
<div class="modal-footer ">
|
||||
<div class="row p-r-20">
|
||||
<div class="col-md-5">
|
||||
<button type="button" class="btn btn-link bg-red waves-effect " id="void" active="true">VOID</button>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<button type="button" class="btn btn-link bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$('#void').on('click', function () {
|
||||
var access_code = localStorage.getItem("access_code");
|
||||
if ($(this).attr('active')=== "true") {
|
||||
swal({
|
||||
title: "Alert",
|
||||
text: "Are you sure want to Void?",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#DD6B55",
|
||||
confirmButtonText: "Yes, void it!",
|
||||
closeOnConfirm: false
|
||||
}, function (isConfirm) {
|
||||
if (isConfirm) {
|
||||
var sale_id = "<%= @sale.sale_id %>"
|
||||
console.log(sale_id)
|
||||
var ajax_url = "/transactions/sales/" + sale_id + '/cashier/void';
|
||||
var remark = $("#remark").val();
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: ajax_url,
|
||||
data: "remark="+ remark + "&sale_id=" + sale_id+ "&access_code=" + access_code,
|
||||
success: function (result) {
|
||||
// For Server Print - from jade
|
||||
if ($("#server_mode").val() == "cloud") {
|
||||
code2lab.printFile(result.filepath.substr(6), result.printer_url);
|
||||
}
|
||||
window.location.href = '/transactions/sales/';
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}else{
|
||||
swal("Opps","You are not authorized for void","warning")
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
<%= form_tag transactions_surveys_path, :method => :get, :id=>"frm_report", :class => "form" do %>
|
||||
<div class="row clearfix">
|
||||
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
|
||||
<label class="form-control-label"><%= t("views.right_panel.button.search_keyboard") %></label>
|
||||
<input type="text" id="dining_name" name="filter" placeholder="Dining Name" class="form-control input-md" >
|
||||
</div>
|
||||
|
||||
<div class="col-lg-2 col-md-2 col-sm-2 col-xs-2">
|
||||
<label class="form-control-label"><%= t("views.right_panel.detail.from") %></label>
|
||||
<input class="form-control datepicker" name="from" id="from" type="text" placeholder="From date">
|
||||
</div>
|
||||
|
||||
<div class="col-lg-2 col-md-2 col-sm-2 col-xs-2">
|
||||
<label class="form-control-label"><%= t("views.right_panel.detail.to") %></label>
|
||||
<input class="form-control datepicker" name="to" id="to" type="text" placeholder="To date">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-lg-1 col-md-1 col-sm-1 col-xs-1">
|
||||
<label > </label>
|
||||
<br> <input type="submit" value="Search" class='btn btn-primary btn-md'>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$('#custom_excel').hide();
|
||||
|
||||
$('#custom_excel').click(function(){
|
||||
var url = $('#custom_excel').attr('data-url');
|
||||
$('#frm_report').attr('action',url)
|
||||
$('#frm_report').submit();
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$("#dining_name").val("<%=params[:filter]%>");
|
||||
$("#from").val("<%=params[:from]%>");
|
||||
$("#to").val("<%=params[:to]%>");
|
||||
|
||||
</script>
|
||||
@@ -10,29 +10,15 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
|
||||
<div class="main-box-body clearfix p-l-15 p-r-15">
|
||||
<%= form_tag transactions_surveys_path, :method => :get do %>
|
||||
<div class="row clearfix">
|
||||
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
|
||||
<label class="form-control-label"><%= t("views.right_panel.button.search_keyboard") %></label>
|
||||
<input type="text" id="dining_name" name="filter" placeholder="Dining Name" class="form-control input-md" >
|
||||
</div>
|
||||
<%= render :partial=>'survey_report_filter',
|
||||
:locals=>{ :period_type => true, :shift_name => true, :report_path =>transactions_surveys_path} %>
|
||||
|
||||
<div class="col-lg-2 col-md-2 col-sm-2 col-xs-2">
|
||||
<label class="form-control-label"><%= t("views.right_panel.detail.from") %></label>
|
||||
<input class="form-control datepicker" name="from" id="from" type="text" placeholder="From date">
|
||||
</div>
|
||||
<hr/>
|
||||
|
||||
<div class="text-right">
|
||||
<a href="javascript:export_to('<%=transactions_surveys_path%>.xls')" class = "btn btn-info wave-effects "><%= t("views.btn.exp_to_excel") %></a>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-2 col-md-2 col-sm-2 col-xs-2">
|
||||
<label class="form-control-label"><%= t("views.right_panel.detail.to") %></label>
|
||||
<input class="form-control datepicker" name="to" id="to" type="text" placeholder="To date">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-lg-1 col-md-1 col-sm-1 col-xs-1">
|
||||
<label > </label>
|
||||
<br> <input type="submit" value="Search" class='btn btn-primary btn-md'>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="card">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered table-striped table-hover">
|
||||
@@ -107,12 +93,15 @@
|
||||
</tbody>
|
||||
</table>
|
||||
<br>
|
||||
<%if !@orders.nil?%>
|
||||
<%= paginate @surveys %>
|
||||
<%end%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$("#from").val("<%=params[:from] rescue '-'%>");
|
||||
$("#to").val("<%=params[:to] rescue '-'%>");
|
||||
});
|
||||
</script>
|
||||
86
app/views/transactions/surveys/index.xls.erb
Normal file
86
app/views/transactions/surveys/index.xls.erb
Normal file
@@ -0,0 +1,86 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
|
||||
<div class="main-box-body clearfix p-l-15 p-r-15">
|
||||
<div class="card">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered table-striped table-hover">
|
||||
<thead>
|
||||
<th><%= t("views.right_panel.detail.dining") %></th>
|
||||
<th><%= t("views.right_panel.detail.receipt_no") %></th>
|
||||
<th><%= t("views.right_panel.detail.created_by") %></th>
|
||||
<th><%= t("views.right_panel.detail.child") %></th>
|
||||
<th><%= t("views.right_panel.detail.adult") %></th>
|
||||
<th><%= t("views.right_panel.detail.male") %></th>
|
||||
<th><%= t("views.right_panel.detail.female") %></th>
|
||||
<th><%= t("views.right_panel.detail.total") %> <%= t :customer %>
|
||||
<th><%= t("views.right_panel.detail.local") %></th>
|
||||
</th>
|
||||
<th><%= t("views.right_panel.detail.foreigner") %></th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% total_child = 0 %>
|
||||
<% total_adult = 0 %>
|
||||
<% total_male = 0 %>
|
||||
<% total_female = 0 %>
|
||||
<% total_local = 0 %>
|
||||
<% total_customer = 0 %>
|
||||
<% total_foreigner = 0 %>
|
||||
<% if !@surveys.nil? %>
|
||||
<% @surveys.each do |survey| %>
|
||||
<% total_child = total_child.to_i + survey.child.to_i %>
|
||||
<% total_adult = total_adult.to_i + survey.adult.to_i %>
|
||||
<% total_male = total_male.to_i + survey.male.to_i %>
|
||||
<% total_female = total_female.to_i + survey.female.to_i %>
|
||||
<% total_local = total_local.to_i + survey.local.to_i %>
|
||||
<% total_customer = total_customer.to_i + survey.total_customer.to_i %>
|
||||
<tr>
|
||||
<td><%= survey.dining_name rescue ' '%></td>
|
||||
<td><%= survey.receipt_no rescue '-'%></td>
|
||||
<td><%= survey.created_by rescue ' '%></td>
|
||||
<td><%= survey.child rescue ' '%></td>
|
||||
<td><%= survey.adult rescue ' '%></td>
|
||||
<td><%= survey.male rescue ' '%></td>
|
||||
<td><%= survey.female rescue ' '%></td>
|
||||
<td><%= survey.total_customer rescue ' '%></td>
|
||||
<td><%= survey.local rescue ' '%></td>
|
||||
<td>
|
||||
<% if !survey.foreigner.nil? %>
|
||||
<% JSON.parse(survey.foreigner).each do |foreign| %>
|
||||
<% foreigner_lists = foreign.split(",") %>
|
||||
<% if !foreigner_lists.empty? %>
|
||||
<% foreigner_lists.each do |fgn| %>
|
||||
<% unless fgn.match(/[^[:digit:]]+/)
|
||||
total_foreigner = total_foreigner.to_i + fgn.to_i
|
||||
end %>
|
||||
<% if !fgn.scan(/\D/).empty? %>
|
||||
<%= fgn %> :<% end %> <%= fgn.to_i unless fgn.match(/[^[:digit:]]+/) %><br>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<tr>
|
||||
<td colspan="3"><strong><%= t("views.right_panel.detail.total") %></strong></td>
|
||||
<td><strong><%= total_child %></strong></td>
|
||||
<td><strong><%= total_adult %></strong></td>
|
||||
<td><strong><%= total_male %></strong></td>
|
||||
<td><strong><%= total_female %></strong></td>
|
||||
<td><strong><%= total_customer %></strong></td>
|
||||
<td><strong><%= total_local %></strong></td>
|
||||
<td><strong><%= total_foreigner %></strong></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<br>
|
||||
<%if !@orders.nil?%>
|
||||
<%= paginate @surveys %>
|
||||
<%end%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user