Pull from master

This commit is contained in:
San Wai Lwin
2018-03-29 18:17:10 +06:30
122 changed files with 4008 additions and 1115 deletions

View File

@@ -68,16 +68,48 @@
<!-- Date range for dashboard -->
<div class="row clearfix">
<div class="col-lg-4 col-md-4 col-sm-4">
<%
if !@from.nil?
from_date = DateTime.parse(@from).utc.getlocal.strftime("%d-%m-%Y")
else
from_date = Time.now.utc.getlocal.strftime('%d-%m-%Y')
end
if !@to.nil?
to_date = DateTime.parse(@to).utc.getlocal.strftime("%d-%m-%Y")
else
to_date = Time.now.utc.getlocal.strftime('%d-%m-%Y')
end
if !@from_time.nil?
from_time = @from_time
else
from_time = ''
end
if !@to_time.nil?
to_time = @to_time
else
to_time = ''
end
%>
<div class="col-lg-3 col-md-3 col-sm-3">
<label class="font-14"><%= t("views.right_panel.detail.from") %></label>
<input data-behaviour='datepicker' class="form-control datepicker" name="from" id="from" type="text" value="<%= Time.now.utc.strftime('%d-%m-%Y') %>" placeholder="From date" style="height: 35px;">
<input data-behaviour='datepicker' class="form-control datepicker" name="from" id="from" type="text" value="<%= from_date %>" placeholder="From date" style="height: 35px;">
<span id="fromErr" style="color:red;"></span>
</div>
<div class="col-lg-4 col-md-4 col-sm-4">
<div class="col-lg-3 col-md-3 col-sm-3">
<label class="font-14"><%= t("views.right_panel.detail.to") %></label>
<input data-behaviour='datepicker' class="form-control datepicker" name="to" id="to" type="text" value="<%= Time.now.utc.strftime('%d-%m-%Y') %>" placeholder="To date" style="height: 35px;">
<input data-behaviour='datepicker' class="form-control datepicker" name="to" id="to" type="text" value="<%= to_date %>" placeholder="To date" style="height: 35px;">
<span id="toErr" style="color:red;"></span>
</div>
<div class="col-lg-2 col-md-2 col-sm-2">
<label class="font-14"><%= t("views.right_panel.detail.from_time") %></label>
<input data-behaviour='timepicker' class="form-control timepicker" name="from_time" id="from_time" type="text" value="<%= from_time %>" placeholder="From Time" style="height: 35px;">
<span id="from_timeErr" style="color:red;"></span>
</div>
<div class="col-lg-2 col-md-2 col-sm-2">
<label class="font-14"><%= t("views.right_panel.detail.to_time") %></label>
<input data-behaviour='timepicker' class="form-control timepicker" name="to_time" id="to_time" type="text" value="<%= to_time %>" placeholder="To time" style="height: 35px;">
<span id="to_timeErr" style="color:red;"></span>
</div>
<div class="col-lg-2 col-md-2 col-sm-2">
<label></label><br>
<input type="button" value="Generate" class='btn btn-primary btn_generate'>
@@ -340,21 +372,53 @@
$('.btn_generate').on('click',function(){
var from = $("#from").val();
var to = $("#to").val();
var from_time = $("#from_time").val();
var to_time = $("#to_time").val();
if(check(from,to,from_time,to_time)){
var params = '?';
if((from!='' && to!='') && (from_time!='' && to_time!='')){
params += 'from='+from+'&to='+to+'&from_time='+from_time+'&to_time='+to_time;
}else{
params += 'from='+from+'&to='+to;
}
window.location.href = '/dashboard'+params;
}
});
function check(from,to,from_time,to_time){
var status = true;
if((from=='') && (to=='')){
status = false;
$('#fromErr').html("can't be blank");
$('#toErr').html("can't be blank");
}else if((from!='') && (to=='')){
status = false;
$('#fromErr').html("");
$('#toErr').html("can't be blank");
}else if((from=='') && (to!='')){
status = false;
$('#fromErr').html("can't be blank");
$('#toErr').html("");
}else{
status = true;
$('#fromErr').html("");
$('#toErr').html("");
}
if((from!='') && (to!='')){
window.location.href = '/dashboard?from='+from+'&to='+to;
if(((from_time=='') && (to_time=='')) || ((from_time!='') && (to_time!=''))){
status = true;
$('#from_timeErr').html("");
$('#to_timeErr').html("");
}else if((from_time!='') && (to_time=='')){
status = false;
$('#from_timeErr').html("");
$('#to_timeErr').html("can't be blank");
}else if((from_time=='') && (to_time!='')){
status = false;
$('#from_timeErr').html("can't be blank");
$('#to_timeErr').html("");
}
});
return status;
}
</script>

5
app/views/layouts/_left_sidebar.html.erb Executable file → Normal file
View File

@@ -109,6 +109,11 @@
<a href="<%= transactions_shift_sales_path %>"><%= (t :shiftsale) %></a>
</li>
<% end %>
<% if can? :menage, Survey %>
<li>
<a href="<%= transactions_surveys_path %>"><%= t("views.right_panel.detail.survey") %></a>
</li>
<% end %>
</ul>
</li>
<% if can? :index, :dailysale %>

13
app/views/oqs/edit/index.html.erb Executable file → Normal file
View File

@@ -112,6 +112,11 @@ $(document).ready(function(){
var remarks = $("textarea[name='remarks']").val();
var order_items_id = $(this).attr('data-id');
var params = { 'order_items_id': order_items_id, 'qty_weight': qty_weight, 'remarks': remarks }
var booking_id = '';
<% if !@booking.nil? %>
booking_id = '<%= @booking.booking_id %>';
<% end %>
$.ajax({
type: 'POST',
url: '/oqs/' + order_items_id,
@@ -121,6 +126,8 @@ $(document).ready(function(){
<% if !@link_type.nil? %>
<% if @link_type == 'oqs' %>
window.location.href = '/oqs';
<% elsif @link_type == 'pending' %>
window.location.href = '/origami/quick_service/pending_order/'+booking_id;
<% else %>
<% if !@dining_type.nil? %>
<% if @dining_type == 'Table' %>
@@ -140,9 +147,15 @@ $(document).ready(function(){
});
$('#back').on('click', function () {
var booking_id = '';
<% if !@booking.nil? %>
booking_id = '<%= @booking.booking_id %>';
<% end %>
<% if !@link_type.nil? %>
<% if @link_type == 'oqs' %>
window.location.href = '/oqs';
<% elsif @link_type == 'pending' %>
window.location.href = '/origami/quick_service/pending_order/'+booking_id;
<% else %>
<% if !@dining_type.nil? %>
<% if @dining_type == 'Table' %>

View File

@@ -35,6 +35,7 @@
<%end%>
</ul>
</li>
<div id="menu-slimscroll" data-height="0">
<ul class="nav nav-tabs flex-column category_list" role="tablist" id="ul-navbar">
<li class="nav-item product" data-ref="<%= origami_get_all_product_path %>">
<a class="nav-link" data-toggle="tab" href="" role="tab">Products</a>
@@ -80,14 +81,15 @@
<% end %>
<%end %>
</ul>
</div>
</div>
<div class="col-md-7 col-lg-7 col-sm-7 m-t-10" >
<div class="card">
<div class="card-block">
<div id="custom-slimscroll">
<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;">
<!-- append data -->
<% @menu.each do |menu| %>
@@ -199,7 +201,7 @@
</div>
<div class="card-block">
<div class="card-text" id="order-detail-slimscroll" data-height="180">
<div class="card-text" id="order-detail-slimscroll" data-height="140">
<table class="table table-striped summary-items" id="order-items-table" >
<thead>
<tr>
@@ -375,7 +377,7 @@
<div class="modal-body">
<div class="row set-item">
<div class="col-md-4">
<p style="text-align: center;"> <%= image_tag "logo.png" ,width: '', height: '', :id => 'logo' %></p>
<p class="set_default_option" style="text-align: center;"> <%= image_tag "logo.png" ,width: '', height: '', :id => 'logo' %></p>
<!-- <div class="form-group">
<label class="col-md-6" style="margin-top:5px">Quantity</label>
<input type="number" name="qty" class="form-control col-md-5 input-number change_qty" id="set_change_qty" value="" min="1" max="100">

View File

@@ -23,7 +23,7 @@
<div class="icon" >
<i class="material-icons">arrow_forward</i>
</div>
<div class="text font-20 m-l-5" style="line-height: 80px;">Quick Service</div>
<div class="text font-20 m-l-5" style="line-height: 80px;"><%= t :quick_service %></div>
</div>
</div>
<div class="col-lg-3 col-md-3 col-sm-4 col-xs-12 cashier_view">
@@ -31,7 +31,7 @@
<div class="icon" >
<i class="material-icons">arrow_forward</i>
</div>
<div class="text font-20 m-l-5" style="line-height: 80px;">Cashier</div>
<div class="text font-20 m-l-5" style="line-height: 80px;"><%= t :dine_in_order %></div>
</div>
</div>
</div>

View File

@@ -436,7 +436,7 @@ var cashier_type = "<%= @cashier_type %>";
var sub_total = $('#order-sub-total').text();
var ajax_url = "/origami/" + sale_id + "/discount";
var params = { 'sale_id': sale_id, 'sub_total': sub_total, 'discount_items': discount_items, 'overall_discount': overall_discount };
var params = { 'cashier_type' : cashier_type,'sale_id': sale_id, 'sub_total': sub_total, 'discount_items': discount_items, 'overall_discount': overall_discount };
$.ajax({
type: "POST",
@@ -487,7 +487,7 @@ var cashier_type = "<%= @cashier_type %>";
}
}
var params = { 'sale_id': sale_id, 'discount_items': JSON.stringify(discount_items) };
var params = { 'cashier_type': cashier_type,'sale_id': sale_id, 'discount_items': JSON.stringify(discount_items) };
$.ajax({
type: "POST",
url: "/origami/" + sale_id + "/remove_discount_items",
@@ -518,7 +518,7 @@ var cashier_type = "<%= @cashier_type %>";
var sale_id = $('#sale-id').text();
$.ajax({
type: "GET",
url: "/origami/" + sale_id + "/remove_all_discount",
url: "/origami/" + sale_id + "/" + cashier_type + "/remove_all_discount",
success: function(result){
swal({
title: "Information!",
@@ -554,7 +554,7 @@ var cashier_type = "<%= @cashier_type %>";
// var params = {'sale_id':sale_id, 'sub_total':sub_total, 'account_types':account_types };
var params = {'sale_id':sale_id, 'sub_total':sub_total };
var params = {'cashier_type': cashier_type,'sale_id':sale_id, 'sub_total':sub_total };
$.ajax({
type: "POST",

View File

@@ -498,15 +498,13 @@
<% end %>
<% if current_login_employee.role != "waiter" %>
<!-- first bill not used in cloud -->
<% if ENV["SERVER_MODE"] == "cloud" %>
<button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect">First Bill</button>
<% else %>
<%if @membership.discount && @obj_sale.customer.membership_id %>
<button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#paymentModal">First Bill</button>
<%else%>
<button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect">First Bill</button>
<%end%>
<% end %>
<button type="button" id="pay" class="btn btn-block bg-blue waves-effect">Pay</button>
<% end %>
<% end %>
@@ -522,30 +520,31 @@
<span class="hidden" id="member_discount"><%= @membership.discount%></span>
<span class="hidden" id="membership_id"><%= @obj_sale.customer.membership_id rescue 0%></span>
<div class="modal fade" id="paymentModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="paymentModalLabel">Choose Payment Method</h4>
</div>
<div class="modal-body">
<select class="form-control show-tick payment_method" multiple="true" id="payment_method" >
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="paymentModalLabel">Choose Payment Method</h4>
</div>
<div class="modal-body">
<!-- <select class="form-control show-tick payment_method" multiple="true" id="payment_method" > -->
<!-- <option value="Cash">Cash</option> -->
<option value="Credit">Credit</option>
<% @payment_methods.each do |pay| %>
<option value="<%= pay.payment_method %>">
<%= pay.payment_method %>
</option>
<%end %>
<button class='btn waves-effect payment_btn green' data-type='Credit' data-value='Credit'>Credit</button>
<% @payment_methods.each do |pay| %>
<!-- <option value="<%= pay.payment_method %>">
<%= pay.payment_method %>
</option> -->
<button class='btn btn-lg waves-effect payment_btn green' data-type='<%= pay.payment_method %>' data-value='<%= pay.payment_method %>'><%= pay.payment_method %></button>
<%end %>
</select>
</div>
<div class="modal-footer p-r-30">
<button type="button" class="btn btn-link btn-danger waves-effect" data-dismiss="modal">CLOSE</button>
<!-- </select> -->
</div>
<div class="modal-footer p-r-30">
<button type="button" class="btn btn-link btn-danger waves-effect" data-dismiss="modal">CLOSE</button>
&nbsp; &nbsp;
<button type="button" class="btn btn-link bg-blue waves-effect choose_payment">SAVE</button>
</div>
</div>
<button type="button" class="btn btn-link bg-blue waves-effect choose_payment">SAVE</button>
</div>
</div>
</div>
</div>
</div>
</div>
@@ -715,6 +714,7 @@
$("#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",
@@ -723,17 +723,40 @@
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);
}
// console.log(result);
// code2lab.printBill(result.filepath, result.printer_model, result.printer_url);
location.reload();
}
});
});
});
// click select option icon for add
$(document).on('click', '.payment_btn', function(event){
active = $(this).hasClass('selected-payment');
value = $(this).data('value');
type = $(this).data('type');
group = $(this).data('group');
payments = $(".payment_btn");
if (active) {
$(this).removeClass('selected-payment');
}else{
$(this).addClass('selected-payment');
}
}); //End selecct attribute buttom
$(".choose_payment").on('click', function () {
$( "#loading_wrapper").show();
var sale_id = $('#sale_id').val();
type = $('.payment_method').val();
// type = $('.payment_method').val();
type = get_selected_attributes('selected-payment');
if(parseInt(jQuery.inArray("Credit", type)) == -1){
if (parseInt(jQuery.inArray("MPU", type)) != -1 || parseInt(jQuery.inArray("VISA", type)) != -1 || parseInt(jQuery.inArray("JCB", type)) != -1 || parseInt(jQuery.inArray("Master", type)) != -1 || parseInt(jQuery.inArray("UNIONPAY", type)) != -1 || parseInt(jQuery.inArray("Redeem", type)) != -1) {
calculate_member_discount(sale_id,"Card");
@@ -751,7 +774,11 @@
receipt_no = ($("#receipt_no").html()).trim();
if((receipt_no!=undefined) && (receipt_no!=""))
createReceiptNoInFirstBillData(receipt_no,type);
location.reload();
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
location.reload();
}
});
});
@@ -801,7 +828,7 @@
//split bill process
$('#split_bills').click(function(){
var dining_id = "<%= @dining.id %>";
window.location.href = '/origami/table/' + dining_id + "/split_bills";
window.location.href = '/origami/table/' + dining_id + "/" + cashier_type +"/split_bills";
});
$('#move').on('click', function () {
@@ -905,15 +932,19 @@
}, function (isConfirm) {
if (isConfirm) {
var sale_id = "<%= @obj_sale.sale_id rescue "" %>"
var ajax_url = "/origami/sale/" + sale_id + '/void';
var ajax_url = "/origami/sale/" + sale_id + '/cashier/void';
var remark = $("#remark").val();
$.ajax({
type: 'POST',
url: ajax_url,
data: "remark="+ remark + "&sale_id=" + sale_id,
success: function () {
window.location.href = '/origami/';
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 = '/origami/';
}
});
}
@@ -971,4 +1002,16 @@
window.location.href = '/oqs/'+ assigned_order_item_id + "/edit/"+dining_id;
}
});
// Get Selected Class
function get_selected_attributes(selected_class) {
var item_row = $('.'+selected_class);
var attribute_arr = [];
$(item_row).each(function(i){
value = $(item_row[i]).attr('data-value');
str = value;
attribute_arr.push(str);
});
return attribute_arr;
}
</script>

View File

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

View File

@@ -0,0 +1,300 @@
<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.jcb") %></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-3">
<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 m-l-10 m-t-10" style="padding:0px 20px;">
<div class="rebate-form">
<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>
<div class="row">
<div class="form-group col-lg-12 col-md-12 col-sm-12">
<label>You can pay up to </label>
<%@can_junction_pay = @can_junction_pay +@rounding_adj%>
<input type="text" name="validamount" id="validamount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@can_junction_pay %>" data-member-value="">
</div>
<hr>
</div>
<% if @jcbcount != 0 %>
<div class="row">
<div class="form-group col-lg-12 col-md-12 col-sm-12">
<label>Recent junction pay paid amount </label>
<input type="text" name="" id="" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@junction_pay_count %>" 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 class="col-lg-6 col-md-6 col-sm-6">
<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 green border-left" 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="junction_pay">Pay</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-1 col-md-1 col-sm-1">
<button type="button" class="btn btn-default btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/<%= @cashier_type %>/payment/others_payment';"> <i class="material-icons m-t--5">reply</i>Back </button>
</div>
</div>
</div>
<script>
var cashier_type = "<%= @cashier_type %>";
$(document).ready(function() {
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_junction_pay %>") - parseFloat(localStorage.getItem("cash")));
}
code2lab.getCommPorts(); //get comportlists from jade
});
// number key pad
$(document).on('click', '.cashier_number', function(event){
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();
$('#amount').text(cash.substr(0,cash.length-1));
break;
case 'nett':
var remain_amount = $('#validamount').val();
$('#amount').text(remain_amount);
break;
}
event.handled = true;
} else {
return false;
}
});
$('#junction_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 cashier_id = "<%= @cashier_id %>";
$("#reference_no_Err").html("");
if(reference_no.length > 0){
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
$("#loading_wrapper").show();
var com_port = '/dev/' + $("#com_port_name").val();
var is_rebate=false;
//alert(cashier_id + amount + com_port);
code2lab.reqJunctionPay(true, cashier_id, parseFloat(amount), receipt_no, com_port);
resJunctionPayUpdate = function(totalBillAmount , finalBillAmt,giftCardAmount, voucherAmount,voucherNumber,receiptNumber){
$("#loading_wrapper").hide();
var voucher_no = voucherNumber;
if (voucher_no == ''){
voucher_no = reference_no;
}
$.ajax({
type: "POST",
url: "<%= origami_payment_junctionpay_path %>",
data: "gift_amount="+ giftCardAmount + "&voucher_amount=" + voucherAmount +
"&voucher_no=" + voucher_no + "&sale_id="+ sale_id,
success:function(result){
if(result){
var desc = 'Payment Successfully';
// is_rebate get from resJunctionPay and if member
if(is_rebate){ desc = desc + ". And You get Rebate!"}
swal({
title: "Information!",
text: desc,
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type+"/payment";
});
}
}
});
};
resJunctionPay = function(memberno,transactionNo,finalBillingAmt){
if(memberno != ''){ is_rebate = true; }
};
// $("#loading_wrapper").hide();
// $.ajax({type: "POST",
// url: "/origami/payment/"+payment_type,
// data: "amount="+ finalBillingAmt + "&sale_id="+ sale_id,
// success:function(result){
// if(result){
// swal({
// title: "Information!",
// text: "Payment Successfully",
// html: true,
// closeOnConfirm: false,
// closeOnCancel: false,
// allowOutsideClick: false
// }, function () {
// window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type+"/payment";
// });
// }
// }
// });
// });
// var resError = function(message){
// console.log(message);
// $("#loading_wrapper").hide();
// swal ( "Oops" , message , "error" );
// };
}
}
});
// var resJunctionPayUpdate = function(totalBillAmount , finalBillAmt,giftCardAmount,voucherAmount, voucherNumber,receiptNumber){
// $("#loading_wrapper").hide();
// // alert(voucherNumber + ' ' + totalBillAmount + ' ' + receiptNumber + ' ' + giftCardAmount);
// $.ajax({
// type: "POST",
// url: "<%= origami_payment_junctionpay_path %>",
// data: "amount="+ totalBillAmount + "&sale_id="+ sale_id,
// success:function(result){
// if(result){
// swal({
// title: "Information!",
// text: "Payment Successfully",
// html: true,
// closeOnConfirm: false,
// closeOnCancel: false,
// allowOutsideClick: false
// }, function () {
// window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type+"/payment";
// });
// }
// }
// });
// };
</script>

View File

@@ -309,7 +309,7 @@ var cashier_type = "<%= @cashier_type %>";
var other_charges_items = JSON.stringify(get_other_item_rows());
var ajax_url = "/origami/" + sale_id + "/other_charges";
var params = { 'sale_id': sale_id, 'sub_total': sub_total, 'other_charges_items': other_charges_items };
var params = { 'cashier_type' : cashier_type,'sale_id': sale_id, 'sub_total': sub_total, 'other_charges_items': other_charges_items };
$.ajax({
type: "POST",

View File

@@ -100,10 +100,10 @@
<td class="charges-name"><strong>Tax
(<% @i = 0
@account_arr.each do |ct| %>
<%=ct.name%>
<% if @account_arr.count != @i+1%>
+ <% @i =+1 %>
<%end%>
<%=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>
@@ -265,6 +265,20 @@
<div class="col-md-4" id="unionpaycount"><%= number_with_precision(0, precision: precision.to_i ) %></div>
</div>
<% end %>
<!-- Junction Pay -->
<% if @junctionpaycount != 0.0 %>
<div class="row payment others-color">
<div class="col-md-5"></div>
<div class="col-md-3">JUNCTION PAY</div>
<div class="col-md-4 master is_card" id="junctionpaycount"><%= number_with_precision(@junctionpaycount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
</div>
<% else %>
<div class="row hidden">
<div class="col-md-5"></div>
<div class="col-md-3">JUNCTION PAY</div>
<div class="col-md-4" id="junctionpaycount"><%= number_with_precision(0, precision: precision.to_i ) %></div>
</div>
<% end %>
<div class="row m-l-5 m-r-5">
<div class="col-md-8"><strong>Balance</strong></div>
<div class="col-md-4"><strong><span id='balance'><%= number_with_precision(@sale_data.grand_total, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></span></strong></div>
@@ -406,11 +420,11 @@
</div>
<div class="modal-footer ">
<div class="row m-b-10 m-r-30">
<% if ENV["SERVER_MODE"] != 'cloud' %>
<div class="col-md-5 m-r-20">
<button type="button" class="btn btn-link bg-red waves-effect print_receipt">Print</button>
</div>
<% end %>
<div class="col-md-5">
<button type="button" class="btn btn-link bg-blue waves-effect btn_pdf_close" data-dismiss="modal">CLOSE</button>
</div>
@@ -431,6 +445,17 @@
<div class="modal-body">
<input type="hidden" name="paypar_account_no" id="paypar_account_no" />
<input type="hidden" name="qr_code" id="qr_code" />
<div class="row text-center m-t-20">
<% if !@customer_lists.nil? %>
<% @customer_lists.each do |cus| %>
<% if cus.customer_id != @customer.id %>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
<button type="button" class="btn btn-lg btn-link bg-primary waves-effect btn_customer_assign" data-id='<%= cus.customer_id %>'><%= cus.name %></button>
</div>
<% end %>
<% end %>
<% end %>
</div>
<div class="row text-center m-t-20">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
<button type="button" class="btn btn-lg btn-link bg-primary waves-effect btn_member">Card Member</button>
@@ -473,9 +498,9 @@ var customer_name = "<%= @customer.name %>";
setHeaderBreadCrumb(_PAYMENTS_);
//start customer modal popup
if((cashier_type=='quick_service') && (customer_id!=undefined) && (customer_id!=null) && (customer_id!="")){
if((customer_id == 'CUS-000000000001') && (customer_name == 'WALK-IN')){
// if((customer_id == 'CUS-000000000001') && (customer_name == 'WALK-IN')){
$("#is_memberModal").modal({show : true, backdrop: false, keyboard : false});
}
// }
}
/* start check first bill or not*/
@@ -489,10 +514,7 @@ var customer_name = "<%= @customer.name %>";
payment_type = '';
if ($("#server_mode").val() != "cloud") { // first bill not used in cloud
console.log("ssssssssssss")
payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment");
console.log(member_id);
console.log(member_discount);
if (member_id && member_discount) {
if(parseInt(jQuery.inArray("Credit", payment_type)) == -1){
$("#credit_payment").hide();
@@ -500,7 +522,7 @@ var customer_name = "<%= @customer.name %>";
$("#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){
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("JUNCTIONPAY", payment_type)) !=-1){
$("#card_payment").show();
} else{
$("#card_payment").hide();
@@ -563,6 +585,9 @@ var customer_name = "<%= @customer.name %>";
else if(payment_type == "UNIONPAY" && $('#unionpaycount').text()==0 && sub_total != 0.0){
swal("Oops","Please Pay with UNIONPAY Payment","warning");
}
else if(payment_type == "JUNCTIONPAY" && $('#junctionpaycount').text()==0 && sub_total != 0.0){
swal("Oops","Please Pay with JUNCTIONPAY Payment","warning");
}
else if(payment_type == "Credit" && $('#credit').text()==0 && sub_total != 0.0){
swal("Oops","Please Pay with Credit Payment","warning");
}else{
@@ -610,7 +635,7 @@ var customer_name = "<%= @customer.name %>";
$("#sale_receipt_no").val(result.receipt_no);
$("#filename").val(result.filename);
$("#printer_name").val(result.printer_name);
$("#receipt_pdf").attr("src", result.filename);
$("#receipt_pdf").attr("src", result.filename.substring(6));
$("#pdfModal").modal({show : true, backdrop : false, keyboard : false});
$("#pdfModalLabel").text("Sale Completed");
$("#changed_amount").text("");
@@ -692,13 +717,17 @@ var customer_name = "<%= @customer.name %>";
if (isConfirm) {
var sale_id = $('#sale_id').text();
var remark = $("#remark").val();
var ajax_url = "/origami/sale/" + sale_id + '/void';
var ajax_url = "/origami/sale/" + sale_id +'/'+cashier_type+ '/void';
$.ajax({
type: 'POST',
url: ajax_url,
data: "remark="+ remark + "&sale_id=" + sale_id,
success: function () {
success: function (result) {result
customer_display_view(null,"reload");
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
if (cashier_type=="cashier") {
window.location.href = '/origami';
}else{
@@ -838,7 +867,8 @@ var customer_name = "<%= @customer.name %>";
var jcb1 = $('#jcbcount').text();
var master1 = $('#mastercount').text();
var unionpay1 = $('#unionpaycount').text();
var othertotal = parseFloat(credit1) + parseFloat(card1) + parseFloat(paypar1) + parseFloat(visa1) + parseFloat(jcb1) + parseFloat(master1) + parseFloat(unionpay1);
var junctionpay1 = $('#junctionpaycount').text();
var othertotal = parseFloat(credit1) + parseFloat(card1) + parseFloat(paypar1) + parseFloat(visa1) + parseFloat(jcb1) + parseFloat(master1) + parseFloat(unionpay1) + parseFloat(junctionpay1);
var total = $('#amount_due').text();
var amt = 0;
<% if precision.to_i > 0 %>;
@@ -866,8 +896,9 @@ var customer_name = "<%= @customer.name %>";
var jcb = $('#jcbcount').text();
var master = $('#mastercount').text();
var unionpay = $('#unionpaycount').text();
var junctionpay = $('#junctionpaycount').text();
var amount_due = $('#amount_due').text();
var total = parseFloat(cash) + parseFloat(credit) + parseFloat(card) + parseFloat(paypar) + parseFloat(visa) + parseFloat(jcb) + parseFloat(master) + parseFloat(unionpay)
var total = parseFloat(cash) + parseFloat(credit) + parseFloat(card) + parseFloat(paypar) + parseFloat(visa) + parseFloat(jcb) + parseFloat(master) + parseFloat(unionpay) + parseFloat(junctionpay)
var result = parseFloat(amount_due) - parseFloat(total);
<% if precision.to_i > 0 %>
$('#balance').text(parseFloat(result).toFixed(<%= precision %>));
@@ -898,7 +929,7 @@ var customer_name = "<%= @customer.name %>";
if (isConfirm) {
$.ajax({
type: "POST",
url: "<%= origami_payment_foc_path %>",
url: "/origami/payment/"+cashier_type+"/foc",
data: params,
success:function(result){
customer_display_view(null,"reload");
@@ -907,6 +938,10 @@ var customer_name = "<%= @customer.name %>";
title: "Information!",
text: 'Thank You !',
}, function () {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
if (cashier_type=="cashier") {
window.location.href = '/origami';
}else{
@@ -982,6 +1017,10 @@ var customer_name = "<%= @customer.name %>";
data: params,
success:function(result){
console.log(result);
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
if (cashier_type=="cashier") {
window.location.href = '/origami';
}else{
@@ -1115,4 +1154,11 @@ var customer_name = "<%= @customer.name %>";
$("#sxModal .btn_cancel").on('click',function(){
$("#sxModal").hide();
});
$(".btn_customer_assign").on('click', function(){
var customer_id = $(this).attr('data-id');
var customer_name = $(this).text();
var sale_id = $("#sale_id").text() || 0;
update_sale("", customer_id, customer_name, sale_id);
});
</script>

0
app/views/origami/pending_order/index.html.erb Executable file → Normal file
View File

18
app/views/origami/pending_order/show.html.erb Executable file → Normal file
View File

@@ -97,13 +97,15 @@
<% end%>
<% else%>
<% sub_total = 0
total = 0
@order_items.each do |order_item|
sub_total = sub_total + order_item.price %>
total = order_item.qty * order_item.price
sub_total = sub_total + total %>
<input type="hidden" id="sale_id" value="<%= @bookings.booking_id %>">
<tr>
<tr class="edit_order" data-id='<%= order_item.order_items_id %>'>
<td class='item-name'><%= order_item.item_name %></td>
<td class='item-attr'><%= order_item.qty %></td>
<td class='item-attr'><%= order_item.price %></td>
<td class='item-attr'><%= total %></td>
</tr>
<% end%>
<% end%>
@@ -211,7 +213,7 @@ $(document).ready(function(){
swal("Information!", result.error_message);
}
else {
window.location.href = '../pending_order/'+ result.data;
window.location.href = '/origami/quick_service/pending_order';
}
}
});
@@ -290,5 +292,13 @@ $(document).ready(function(){
window.location.href = linkURL;
});
}
/*edit order in oqs*/
$('.edit_order').on('click',function(){
var assigned_order_item_id = $(this).attr('data-id');
if((assigned_order_item_id!=undefined) && (assigned_order_item_id!='')){
window.location.href = '/oqs/'+ assigned_order_item_id + "/edit/pending";
}
});
});
</script>

View File

@@ -465,15 +465,15 @@
<% end %>
<% if current_login_employee.role != "waiter" %>
<!-- first bill not used in cloud -->
<% if ENV["SERVER_MODE"] == "cloud" %>
<!--<% if ENV["SERVER_MODE"] == "cloud" %>
<button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect">First Bill</button>
<% else %>
<% else %>-->
<%if @membership.discount && @obj_sale.customer.membership_id %>
<button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#paymentModal">First Bill</button>
<%else%>
<button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect">First Bill</button>
<%end%>
<%end%>
<!-- <%end%>-->
<button type="button" id="pay" class="btn bg-blue btn-block">Pay</button>
<% end %>
<!-- <button type="button" id="void" class="btn bg-blue btn-block" > Void </button> -->
@@ -489,16 +489,13 @@
<h4 class="modal-title" id="paymentModalLabel">Choose Payment</h4>
</div>
<div class="modal-body">
<select class="form-control show-tick payment_method" multiple="true" id="payment_method" >
<option value="Cash">Cash</option>
<option value="Credit">Credit</option>
<button class='btn waves-effect payment_btn green' data-type='Credit' data-value='Credit'>Credit</button>
<% @payment_methods.each do |pay| %>
<option value="<%= pay.payment_method %>">
<%= pay.payment_method %>
</option>
<%end %>
</select>
<!-- <option value="<%= pay.payment_method %>">
<%= pay.payment_method %>
</option> -->
<button class='btn btn-lg waves-effect payment_btn green' data-type='<%= pay.payment_method %>' data-value='<%= pay.payment_method %>'><%= pay.payment_method %></button>
<%end %>
</div>
<div class="modal-footer p-r-30">
<button type="button" class="btn btn-link btn-danger waves-effect" data-dismiss="modal">CLOSE</button>
@@ -680,6 +677,21 @@ $(document).ready(function(){
});
// click select option icon for add
$(document).on('click', '.payment_btn', function(event){
active = $(this).hasClass('selected-payment');
value = $(this).data('value');
type = $(this).data('type');
group = $(this).data('group');
payments = $(".payment_btn");
if (active) {
$(this).removeClass('selected-payment');
}else{
$(this).addClass('selected-payment');
}
}); //End selecct attribute buttom
// Print for first bill
$("#first_bill").on('click', function(){
var sale_id = $('#sale_id').val();
@@ -691,7 +703,10 @@ $("#first_bill").on('click', function(){
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();
}
});
@@ -701,7 +716,9 @@ $(".choose_payment").on('click', function () {
$( "#loading_wrapper").show();
var sale_id = $('#sale_id').val();
type = $('.payment_method').val();
type = get_selected_attributes('selected-payment');
// type = $('.payment_method').val();
if(parseInt(jQuery.inArray("Credit", type)) == -1){
if (parseInt(jQuery.inArray("MPU", type)) != -1 || parseInt(jQuery.inArray("VISA", type)) != -1 || parseInt(jQuery.inArray("JCB", type)) != -1 || parseInt(jQuery.inArray("Master", type)) != -1 || parseInt(jQuery.inArray("UNIONPAY", type)) != -1 || parseInt(jQuery.inArray("Redeem", type)) != -1) {
calculate_member_discount(sale_id,"Card");
@@ -719,6 +736,12 @@ $(".choose_payment").on('click', function () {
receipt_no = ($("#receipt_no").html()).trim();
if((receipt_no!=undefined) && (receipt_no!=""))
createReceiptNoInFirstBillData(receipt_no,type);
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
location.reload();
}
});
@@ -776,7 +799,7 @@ $('#request_bills').click(function() {
//split bill process
$('#split_bills').click(function(){
var dining_id = "<%= @room.id %>";
window.location.href = '/origami/room/' + dining_id + "/split_bills";
window.location.href = '/origami/room/' + dining_id + "/" + cashier_type + "/split_bills";
});
$('#move').on('click',function(){
@@ -889,7 +912,7 @@ $('#add_invoice').on('click',function(){
var sure = confirm("Are you sure want to Void");
if (sure == true) {
var sale_id = $('#sale_id').val();
var ajax_url = "/origami/sale/" + sale_id + '/void';
var ajax_url = "/origami/sale/" + sale_id + '/cashier/void';
$.ajax({
type: 'POST',
url: ajax_url,
@@ -945,4 +968,15 @@ $('#add_invoice').on('click',function(){
window.location.href = '/oqs/'+ assigned_order_item_id + "/edit/"+dining_id;
}
});
// Get Selected Class
function get_selected_attributes(selected_class) {
var item_row = $('.'+selected_class);
var attribute_arr = [];
$(item_row).each(function(i){
value = $(item_row[i]).attr('data-value');
str = value;
attribute_arr.push(str);
});
return attribute_arr;
}
</script>

View File

@@ -333,7 +333,7 @@ var cashier_type = "<%= @cashier_type %>";
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_id=' + sale_id,
data: 'sale_id=' + sale_id +'&type='+cashier_type,
success: function (result) {
location.reload();
}
@@ -347,7 +347,7 @@ var cashier_type = "<%= @cashier_type %>";
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_id=' + sale_id,
data: 'sale_id=' + sale_id+'&type='+cashier_type,
success: function (result) {
if (cashier_type=="quick_service") {
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';

View File

@@ -58,7 +58,7 @@
</div>
</div>
<script>
var type = '<%= @type %>';
var cashier_type = '<%= @cashier_type %>';
$('#close_cashier').on('click',function(){
var amount = $('#closing_balance_amount').val();
var shift_id = "<%= @shift.id rescue ""%>"
@@ -73,7 +73,7 @@
});
$('#back').on('click',function(){
if(type!='quick_service'){
if(cashier_type!='quick_service'){
window.location.href = '/origami';
}else{
window.location.href = '/origami/quick_service';
@@ -95,7 +95,7 @@
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/shift/'+type+'/close';
window.location.href = '/origami/shift/'+cashier_type+'/close';
});
}
});
@@ -120,7 +120,7 @@
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/shift/'+type+'/close';
window.location.href = '/origami/shift/'+cashier_type+'/close';
});
}
}
@@ -184,7 +184,7 @@
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/shift/close';
window.location.href = '/origami/shift/'+cashier_type+'/close';
});
// reqCBBankAlipaySettlement();
}

14
app/views/origami/split_bill/index.html.erb Executable file → Normal file
View File

@@ -53,12 +53,14 @@
</tr>
</thead>
<tbody>
<% order_item_count = 0 %>
<% if !@order_items.nil? %>
<% sub_total = 0 %>
<% @order_items.each do |order_item| %>
<% if order_item.include? ('all_order') %>
<% order_item['all_order'].each do |odr_item| %>
<%
order_item_count = order_item_count.to_i + 1
sub_total += odr_item['qty'].to_f * odr_item['price'].to_f
%>
<tr class="item-row" id=<%= odr_item['order_items_id'] %> >
@@ -331,6 +333,7 @@
<script type="text/javascript">
var split_sale_id = "";
var split_receipt_no = "";
var cashier_type = '<%= @cashier_type %>';
$(document).ready(function(){
setHeaderBreadCrumb(_SPLIT_BILL_);
$('#back').on('click',function(){
@@ -386,10 +389,9 @@
//order_item_split
$('#order_item_split').on('click',function () {
var cnt_order_item = "<%= @order_items.count %>";
var cnt_order_item = "<%= order_item_count %>";
var order_items = get_selected_order_items();// Selected Order Items
var cnt_items = parseInt(cnt_order_item - 1) - parseInt(order_items.length);
var cnt_items = parseInt(cnt_order_item) - parseInt(order_items.length);
if (order_items.length > 0){
// if(cnt_items > 0){
swal({
@@ -424,6 +426,7 @@
$.each(orders, function(key,value){
if($("a[href$='#"+value.order_id+"']").parent().hasClass('selected-split-item')){
$("a[href$='#"+value.order_id+"']").parent().removeClass('selected-split-item');
$(".item-row").removeClass('selected-split-item');
}
});
}
@@ -622,6 +625,7 @@ function orderItemSplitBillProcess(cnt_items){
if(cnt_items == 0){
booking_id = json_booking.booking_id;
}
console.log(booking_id);
var order_ids = [];
var arr_order_ids = [];
@@ -656,7 +660,7 @@ function orderItemSplitBillProcess(cnt_items){
type: "POST",
url: ajax_url,
dataType: 'JSON',
data: {'dining_id' : dining_id, 'type': type, 'customer_id' : customer_id, 'booking_id' : booking_id, 'order_ids' : order_ids, 'arr_order_ids': JSON.stringify(arr_order_ids), 'order_items' : JSON.stringify(order_items), 'orders' : ''},
data: {'cashier_type':cashier_type,'dining_id' : dining_id, 'type': type, 'customer_id' : customer_id, 'booking_id' : booking_id, 'order_ids' : order_ids, 'arr_order_ids': JSON.stringify(arr_order_ids), 'order_items' : JSON.stringify(order_items), 'orders' : ''},
success: function (result) {
if (!result.status) {
swal("Information!", result.error_message);
@@ -689,7 +693,7 @@ function orderSplitBillProcess(cnt_orders){
type: "POST",
url: ajax_url,
dataType: 'JSON',
data: {'dining_id' : dining_id, 'type': type, 'customer_id' : customer_id, 'booking_id' : booking_id, 'order_ids' : [], 'order_items' : '', 'orders' : JSON.stringify(orders), 'arr_order_ids': []},
data: {'cashier_type':cashier_type,'dining_id' : dining_id, 'type': type, 'customer_id' : customer_id, 'booking_id' : booking_id, 'order_ids' : [], 'order_items' : '', 'orders' : JSON.stringify(orders), 'arr_order_ids': []},
success: function (result) {
if (!result.status) {
swal("Information!", result.error_message);

View File

@@ -156,6 +156,15 @@
<!-- Column Three -->
<div class="col-lg-1 col-md-1 col-sm-1">
<button id="back" type="button" class="btn btn-block btn-lg bg-default"> <i class="material-icons">reply</i> <%= t("views.btn.back") %>
<% if ENV["SERVER_MODE"] == "cloud" %>
<button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect">First Bill</button>
<% else %>
<%if @membership.discount && @sale.customer.membership_id %>
<button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#paymentModal">First Bill</button>
<%else%>
<button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect">First Bill</button>
<%end%>
<% end %>
<button type="button" id="pay" class="btn bg-blue btn-block">Pay</button>
<button type="button" class="btn bg-deep-purple btn-block" data-toggle="modal" data-target="#focModal" <%= (can? :foc, :payment)? ' ': 'disabled=' %> active="true"> FOC </button>
<button type="button" data-toggle="modal" data-target="#voidModal" class="btn bg-danger btn-block" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void </button>
@@ -163,6 +172,38 @@
</div>
</div>
<!-- membership paymentmodal -->
<input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>">
<span class="hidden" id="member_discount"><%= @membership.discount%></span>
<span class="hidden" id="membership_id"><%= @sale.customer.membership_id rescue 0%></span>
<div class="modal fade" id="paymentModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="paymentModalLabel">Choose Payment</h4>
</div>
<div class="modal-body">
<select class="form-control show-tick payment_method" multiple="true" id="payment_method" >
<option value="Cash">Cash</option>
<option value="Credit">Credit</option>
<% @payment_methods.each do |pay| %>
<option value="<%= pay.payment_method %>">
<%= pay.payment_method %>
</option>
<%end %>
</select>
</div>
<div class="modal-footer p-r-30">
<button type="button" class="btn btn-link btn-danger waves-effect" data-dismiss="modal">CLOSE</button>
&nbsp; &nbsp;
<button type="button" class="btn btn-link bg-blue waves-effect choose_payment">SAVE</button>
</div>
</div>
</div>
</div>
<!-- membership paymentmodal -->
<div class="modal fade" id="voidModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
@@ -212,6 +253,24 @@
</div>
<script>
$(document).ready(function(){
/* start check first bill or not*/
var receipt_no = "";
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
receipt_no = ($("#receipt_no").html()).trim();
}
discount="<%= @membership.discount%>"
if ($("#server_mode").val() != "cloud") { // first bill not used in cloud
if (discount) {
if(checkReceiptNoInFirstBillData(receipt_no,"")){
$("#pay").show();
}else{
$("#pay").hide();
}
}
}
/* end check first bill or not*/
$(".tables").on('click', function(){
var dining_id = $(this).attr("data-id");
window.location.href = '/origami/table/<%= @table.id %>/table_invoice/' + dining_id;
@@ -222,6 +281,68 @@ $(document).ready(function(){
// window.location.href = '/origami/sale/<%= @sale.id %>/payment';
// });
// Print for first bill
$("#first_bill").on('click', function () {
var sale_id = '<%= @sale.id %>';
var ajax_url = "/origami/sale/" + sale_id + "/first_bill";
$.ajax({
type: "GET",
url: ajax_url,
success: function (result) {
receipt_no = ($("#receipt_no").html()).trim();
if((receipt_no!=undefined) && (receipt_no!=""))
createReceiptNoInFirstBillData(receipt_no,"");
location.reload();
}
});
});
$(".choose_payment").on('click', function () {
$( "#loading_wrapper").show();
var sale_id = '<%= @sale.id %>';
type = $('.payment_method').val();
if(parseInt(jQuery.inArray("Credit", type)) == -1){
if (parseInt(jQuery.inArray("MPU", type)) != -1 || parseInt(jQuery.inArray("VISA", type)) != -1 || parseInt(jQuery.inArray("JCB", type)) != -1 || parseInt(jQuery.inArray("Master", type)) != -1 || parseInt(jQuery.inArray("UNIONPAY", type)) != -1 || parseInt(jQuery.inArray("Redeem", type)) != -1) {
calculate_member_discount(sale_id,"Card");
}else{
calculate_member_discount(sale_id,"Cash");
}
}
var ajax_url = "/origami/sale/" + sale_id + "/first_bill";
$.ajax({
type: "GET",
url: ajax_url,
success: function (result) {
$( "#loading_wrapper" ).hide();
receipt_no = ($("#receipt_no").html()).trim();
if((receipt_no!=undefined) && (receipt_no!=""))
createReceiptNoInFirstBillData(receipt_no,type);
location.reload();
}
});
});
function calculate_member_discount(sale_id,type) {
var sub_total = $('#sub-total').text();
if (type == "Cash") {
is_card = false
}else{
is_card = true
}
$.ajax({
type: "POST",
url: "/origami/" + sale_id + "/member_discount",
data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':is_card },
async: false,
success:function(result){
}
});
}
$('#pay').on('click',function() {
var sale_id = '<%= @sale.id %>';
@@ -261,7 +382,7 @@ $('#void').on('click',function () {
if (isConfirm) {
var sale_id = $('#sale_id').val();
var remark = $("#remark").val();
var ajax_url = "/origami/sale/" + sale_id + '/void';
var ajax_url = "/origami/sale/" + sale_id + '/cashier/void';
$.ajax({
type: 'POST',
url: ajax_url,
@@ -291,7 +412,7 @@ $('#foc').click(function() {
if ($(this).attr('active')=== "true") {
$.ajax({
type: "POST",
url: "<%= origami_payment_foc_path %>",
url: "/origami/payment/cashier/foc",
data: params,
success:function(result){
if (cash >= 0) {

View File

@@ -12,6 +12,8 @@
<%= f.input :template %>
<%= f.input :font %>
<%= f.input :printer_name, :as => :select, :collection => Printer::PrinterWorker.printers, include_blank: false %>
<%= f.input :brand_name %>
<%= f.input :printer_type %>
<%= f.input :api_settings %>
<%= f.input :page_width %>
<%= f.input :page_height %>
@@ -61,6 +63,22 @@
</div>
<script type="text/javascript">
$(document).ready(function(){
// if selected printer change call and bind
$("#print_setting_printer_name").on("change", function(){
var printer_name = $(this).val();
$.ajax({
type: "GET",
url: "/get_printer_options/"+printer_name,
success:function(result){
$("#print_setting_brand_name").val(result.model);
$("#print_setting_api_settings").val(result.url);
}
});
});
});
function isNumberKey(evt) {
var charCode = (evt.which) ? evt.which : event.keyCode;
if (charCode != 46 && charCode > 31 && (charCode < 48 || charCode > 57)) {

View File

@@ -1,2 +1,2 @@
json.extract! print_setting, :id, :name, :unique_code, :template, :printer_name, :font, :api_settings, :page_width, :page_height, :print_copies, :created_at, :updated_at
json.extract! print_setting, :id, :name, :unique_code, :template, :printer_name, :brand_name, :printer_type, :font, :api_settings, :page_width, :page_height, :print_copies, :created_at, :updated_at
json.url print_setting_url(print_setting, format: :json)

View File

@@ -30,6 +30,14 @@
<th><%= t("views.right_panel.detail.printer_name") %></th>
<td><%= @print_setting.printer_name %></td>
</tr>
<tr>
<th><%= t("views.right_panel.detail.brand_name") %></th>
<td><%= @print_setting.brand_name %></td>
</tr>
<tr>
<th><%= t("views.right_panel.detail.printer_type") %></th>
<td><%= @print_setting.printer_type %></td>
</tr>
<tr>
<th><%= t("views.right_panel.detail.font") %></th>
<td><%= @print_setting.font rescue '-' %></td>

View File

@@ -58,14 +58,14 @@
<% total_qty = 0 %>
<% @sale_data.each do |sale| %>
<% grand_total += sale.grand_total %>
<% if sale.status_type != "Discount" && sale.status_type != "foc"
total_qty += sale.total_item
end %>
<% if sale.status_type == "foc" && sale.price > 0
total_qty += sale.total_item
end %>
<% grand_total += sale.grand_total %>
<% if sale.status_type != "Discount" && sale.status_type != "foc"
total_qty += sale.total_item
end %>
<% if sale.status_type == "foc" && sale.price > 0
total_qty += sale.total_item
end %>
<% if !sale.status_type %>
<tr>
<td>&nbsp;</td>
<% if !cate_arr.include?(sale.menu_category_id) %>
@@ -81,8 +81,9 @@
<td><%= number_with_precision(sale.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td><%= number_with_precision(sale.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-' %></td>
</tr>
<!-- sub total -->
<!-- end sub total -->
<!-- sub total -->
<!-- end sub total -->
<% end %>
<% end %>
<tr>
<td colspan="3"></td>

View File

@@ -23,31 +23,40 @@
<% total_qty = 0 %>
<% @sale_data.each do |sale| %>
<% grand_total += sale.grand_total %>
<% if sale.status_type != "Discount" && sale.status_type != "foc"
total_qty += sale.total_item
grand_total += sale.grand_total
end %>
<% if sale.status_type == "foc" && sale.price > 0
total_qty += sale.total_item
grand_total += sale.grand_total
end %>
<tr>
<td>&nbsp;</td>
<td><%= sale.menu_category_name %></td>
<td><%= sale.item_code rescue '-' %></td>
<td><%= sale.product_name rescue '-' %></td>
<td><%= sale.total_item rescue '-' %></td>
<td><%= sale.unit_price rescue '-' %></td>
<td><%= sale.grand_total rescue '-' %></td>
</tr>
<% if !sale.status_type %>
<tr>
<td>&nbsp;</td>
<% if !cate_arr.include?(sale.menu_category_id) %>
<td><%= sale.menu_category_name %></td>
<% cate_arr.push(sale.menu_category_id) %>
<% else %>
<% cate_arr = Array.new %>
<td>&nbsp;</td>
<% end %>
<td><%= sale.item_code rescue '-' %></td>
<td><%= sale.product_name rescue '-' %></td>
<td><%= sale.total_item rescue ' ' %></td>
<td><%= sale.unit_price rescue ' ' %></td>
<td><%= sale.grand_total rescue ' ' %></td>
</tr>
<!-- sub total -->
<!-- end sub total -->
<% end %>
<% end %>
<tr>
<td colspan="3"></td>
<td><strong>Total</strong></td>
<td><strong><%= total_qty %></strong></td>
<td><strong><%= total_qty rescue ' ' %></strong></td>
<td></td>
<td><strong><%= grand_total rescue '-' %></strong></td>
<td><strong><%= grand_total rescue ' ' %></strong></td>
</tr>
<% end %>
</tbody>

View File

@@ -18,13 +18,25 @@
<option value="9">Last year</option>
</select>
</div>
<!-- <input type="hidden" name="report_type" value="sale_item" id="sel_sale_type"> -->
<div class="col-lg-3 col-md-3 col-sm-3">
<!-- <input type="hidden" name="report_type" value="sale_item" id="sel_sale_type"> -->
<div class="col-lg-2 col-md-2 col-sm-2">
<label class="font-14">Select Type</label>
<select name="sale_type" id="sel_sale_type" class="form-control">
<option value="">Select Type</option>
<option value="revenue" selected>Revenue Only</option>
<option value="all">All Type</option>
<option value="discount">Discount Only</option>
<option value="void">Void Only</option>
<option value="foc">Foc Only</option>
<option value="other">Other Amount Only</option>
</select>
</div>
<div class="col-lg-2 col-md-2 col-sm-2">
<!-- <label class="">Select Shift Period</label> -->
<label class="font-14"><%= t("views.right_panel.detail.from") %></label>
<input data-behaviour='datepicker' class="form-control m-t-3 datepicker" name="from" id="from" type="text" placeholder="From date" style="height: 32px;">
</div>
<div class="col-lg-3 col-md-3 col-sm-3">
<div class="col-lg-2 col-md-2 col-sm-2">
<label class="font-14"><%= t("views.right_panel.detail.to") %></label>
<input data-behaviour='datepicker' class="form-control m-t-3 datepicker" name="to" id="to" type="text" placeholder="To date" style="height: 32px;">
</div>
@@ -52,7 +64,7 @@
$('#frm_report').attr('action',url)
$('#frm_report').submit();
// window.location = url;
});
});
var item = $('#item').val();
var payment_type = $('#payment_type');
@@ -76,17 +88,18 @@
});
<% if params[:shift_name].to_i > 0%>
shift_id = '<%= params[:shift_name] %>'
local_date = '<%= @shift_from %> - <%= @shift_to %> '
var shift = $('#shift_name');
str = '<option value="'+ shift_id +'" '+ 'selected = "selected"' +'>' + local_date + '</option>';
shift.append(str);
shift_id = '<%= params[:shift_name] %>'
local_date = '<%= @shift_from %> - <%= @shift_to %> '
var shift = $('#shift_name');
str = '<option value="'+ shift_id +'" '+ 'selected = "selected"' +'>' + local_date + '</option>';
shift.append(str);
<% end %>
$("#from").val("<%=params[:from] rescue '-'%>");
$("#to").val("<%=params[:to] rescue '-'%>");
$("#sel_period").val(<%=params[:period] rescue '-'%>);
$("#sel_sale_type").val(<%=params[:sale_type] rescue '-'%>);
var sale_type = "<%=params[:sale_type]%>";
$("#sel_sale_type").val(sale_type);
<% if params[:period_type] == 1 || params[:period_type] == "1" %>

View File

@@ -57,8 +57,7 @@
delimiter = ""
end
%>
<% unless @sale_data.blank? %>
<% acc_arr = Array.new %>
<% acc_arr = Array.new %>
<% cate_arr = Array.new %>
<% sub_qty = 0 %>
@@ -75,24 +74,29 @@
<% total_item_foc = 0 %>
<% total_item_dis = 0.0 %>
<% total_tax = 0 %>
<% unless @sale_data.blank? %>
<% @sale_data.each do |sale| %>
<!-- all total qty sum -->
<% if sale.status_type != "Discount" && sale.status_type != "foc"
total_qty += sale.total_item
end %>
<% if sale.status_type == "foc" && sale.price > 0
total_qty += sale.total_item
end %>
<% if sale.status_type == "Discount"
total_qty += sale.total_item*(-1)
end %>
<!-- end all total qty -->
<% if sale.status_type == "foc" && sale.grand_total < 0
<% if sale.status_type == "foc" && sale.grand_total < 0
total_item_foc += sale.grand_total*(-1)
end %>
<% if sale.status_type == "Discount" && sale.grand_total < 0
total_item_dis += sale.grand_total*(-1)
end %>
<% if !acc_arr.include?(sale.account_id) %>
<tr>
<td><b><%= sale.account_name %></b></td>
@@ -119,7 +123,12 @@
<% end %>
<td><%= sale.item_code rescue '-' %></td>
<td><%= sale.product_name rescue '-' %></td>
<td><%= sale.total_item rescue '-' %></td>
<% if sale.status_type != "Discount" %>
<td><%= sale.total_item rescue '-' %></td>
<%else%>
<td><%= sale.total_item*(-1) rescue '-' %></td>
<% end %>
<td><%= number_with_precision(sale.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td><%= number_with_precision(sale.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
</tr>
@@ -130,10 +139,12 @@
<% count = count + 1 %>
<% sub_total += sale.grand_total %>
<% #sub_qty += sale.total_item %>
<% if sale.status_type!="Discount" && (!sale.product_name.include? "FOC")
<% if sale.status_type !="Discount" && (!sale.product_name.include? "FOC")
sub_qty += sale.total_item
end %>
<% if sale.status_type =="Discount"
sub_qty += sale.total_item*(-1)
end %>
<% if count == value %>
<tr>
<td colspan="3">&nbsp;</td>
@@ -151,7 +162,8 @@
<!-- end sub total -->
<% end %>
<!--Other Charges -->
<% if @other_charges.present? %>
<% if @type == "other"%>
<tr>
<td><b>Other Charges</b></td>
<td colspan="4">&nbsp;</td>
@@ -191,55 +203,38 @@
<td style="border-bottom:2px solid grey;"><span><%= number_with_precision(grand_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
</tr>
<% end %>
<tr>
<td colspan="5">&nbsp;</td>
<td><%= t("views.right_panel.detail.foc_item") %> <%= t("views.right_panel.detail.amount") %></td>
<td><span><%= number_with_precision(total_item_foc , precision:precision.to_i,delimiter:delimiter) %></span></td>
</tr>
<tr>
<td colspan="5">&nbsp;</td>
<td style="border-bottom:2px solid grey;"><%= t("views.right_panel.detail.item_discount") %> <%= t("views.right_panel.detail.amount") %></td>
<td style="border-bottom:2px solid grey;"><span><%= number_with_precision(total_item_dis , precision:precision.to_i,delimiter:delimiter) %></span></td>
</tr>
<tr>
<td colspan="5">&nbsp;</td>
<td><%= t("views.right_panel.detail.foc_sales") %></td>
<td>
<span><%= number_with_precision(@foc_data, precision:precision.to_i, delimiter:delimiter) %></span>
</td>
</tr>
<tr>
<td colspan="5">&nbsp;</td>
<td style="border-bottom:2px solid grey;"><%= t("views.right_panel.detail.discount") %> <%= t("views.right_panel.detail.amount") %></td>
<td style="border-bottom:2px solid grey;">
<span>
<%= number_with_precision(@discount_data , precision: precision.to_i,delimiter: delimiter) %>
</span>
</td>
</tr>
<% if @type == "other"%>
<% @sale_taxes.each do |tax| %>
<!-- <tr>
<td colspan="5">&nbsp;</td>
<td><%= tax.tax_name %></td>
<td><%= tax.st_amount.round(2) %>
<%total_tax += tax.st_amount%>
</td>
</tr> -->
<% end %>
<tr>
<td colspan="5">&nbsp;</td>
<td style="border-top:2px solid grey;">Net Amount</td>
<!-- <td><span class="double_underline"><%= grand_total.to_f - @discount_data.to_f%></span></td> -->
<td style="border-top:2px solid grey;"><%= number_with_precision(grand_total.to_f - @discount_data.to_f , precision:precision.to_i,delimiter:delimiter)%></td>
</tr>
<!-- <tr>
<td colspan="5">&nbsp;</td>
<td>Grand Total</td>
<td><span class="double_underline"><%= @grand_total - @change_amount%></span></td>
</tr> -->
<tr>
<td><b>Other Charges</b></td>
<td colspan="4">&nbsp;</td>
<td></td>
</tr>
<% @other_charges.each do |other| %>
<% if other.total_item > 0
total_qty += other.total_item
end %>
<% grand_total +=other.grand_total%>
<tr>
<td>&nbsp;</td>
<td>Other Charges</td>
<td><%= other.item_code rescue '-' %></td>
<td><%= other.product_name rescue '-' %></td>
<td><%= other.total_item rescue '-' %></td>
<td> <%= number_with_precision(other.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td> <%= number_with_precision(other.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
</tr>
<!-- sub total -->
<% other_sub_total += other.grand_total %>
<!-- end sub total -->
<% end %>
<tr>
<td colspan="5">&nbsp;</td>
<td><%= t("views.right_panel.detail.sub_total") %></td>
<td ><span><%= number_with_precision(other_sub_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
</tr>
<%end%>
</tbody>
</table>
</div>

View File

@@ -27,10 +27,22 @@
</tr>
</thead>
<tbody>
<% unless @sale_data.blank? %>
<% acc_arr = Array.new %>
<% 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
%>
<% acc_arr = Array.new %>
<% cate_arr = Array.new %>
<% sub_qty = 0 %>
<% sub_total = 0 %>
<% other_sub_total = 0 %>
<% count = 0 %>
@@ -42,14 +54,29 @@
<% total_amount = 0 %>
<% discount = 0 %>
<% total_item_foc = 0 %>
<% total_item_dis = 0 %>
<% total_item_dis = 0.0 %>
<% total_tax = 0 %>
<% unless @sale_data.blank? %>
<% @sale_data.each do |sale| %>
<% if sale.total_item > 0
<!-- all total qty sum -->
<!--
<% if sale.status_type != "Discount" && sale.status_type != "foc"
total_qty += sale.total_item
end %>
<% if sale.status_type == "foc" && sale.price > 0
total_qty += sale.total_item
end %>
-->
<!-- end all total qty -->
<!--
<% if sale.status_type == "foc" && sale.grand_total < 0
total_item_foc += sale.grand_total*(-1)
end %>
<% if sale.status_type == "Discount" && sale.grand_total < 0
total_item_dis += sale.grand_total*(-1)
end %>
-->
<% if !acc_arr.include?(sale.account_id) %>
<tr>
<td><b><%= sale.account_name %></b></td>
@@ -58,7 +85,7 @@
<td>
<% @totalByAccount.each do |account, total| %>
<% if sale.account_id == account %>
<b><%= total %></b>
<b><%= number_with_precision(total, precision:precision.to_i,delimiter:delimiter) %></b>
<% grand_total += total %>
<% end %>
<% end %>
@@ -77,95 +104,110 @@
<td><%= sale.item_code rescue '-' %></td>
<td><%= sale.product_name rescue '-' %></td>
<td><%= sale.total_item rescue '-' %></td>
<td><%= sale.unit_price rescue '-' %></td>
<td><%= sale.grand_total rescue '-' %></td>
<td><%= number_with_precision(sale.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td><%= number_with_precision(sale.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
</tr>
<!-- sub total -->
<% @menu_cate_count.each do |key,value| %>
<% if sale.menu_category_id == key %>
<% @menu_cate_count.each do |key,value| %>
<% if sale.account_id == key %>
<% count = count + 1 %>
<% sub_total += sale.grand_total %>
<% #sub_qty += sale.total_item %>
<% if sale.status_type!="Discount" && (!sale.product_name.include? "FOC")
sub_qty += sale.total_item
end %>
<% if count == value %>
<tr>
<td colspan="5">&nbsp;</td>
<td colspan="3">&nbsp;</td>
<td><b>Total <%= sale.account_name %> Qty </b> </td>
<td><b><%= sub_qty %></b></td>
<td><%= t("views.right_panel.detail.sub_total") %></td>
<td ><span class="underline"><%= sub_total %></span></td>
<td ><span class="underline"><%= number_with_precision(sub_total , precision:precision.to_i,delimiter:delimiter)%> </span></td>
</tr>
<% if sale.status_type === "foc"
total_item_foc += sale.grand_total
end %>
<% if sale.status_type === "Discount"
total_item_dis += sale.grand_total
end %>
<% sub_total = 0.0%>
<% sub_qty = 0 %>
<% count = 0%>
<% end %>
<% end %>
<% end %>
<% end %>
<!-- end sub total -->
<% end %>
<% end %>
<!--Other Charges -->
<tr>
<td><b>Other Charges</b></td>
<td colspan="4">&nbsp;</td>
<td></td>
</tr>
<% @other_charges.each do |other| %>
<% if other.total_item > 0
total_qty += other.total_item
end %>
<% grand_total +=other.grand_total%>
<tr>
<td>&nbsp;</td>
<td>Other Charges</td>
<td><%= other.item_code rescue '-' %></td>
<td><%= other.product_name rescue '-' %></td>
<td><%= other.total_item rescue '-' %></td>
<td><%= other.unit_price rescue '-' %></td>
<td><%= other.grand_total rescue '-' %></td>
<% if @type == "other"%>
<tr>
<td><b>Other Charges</b></td>
<td colspan="4">&nbsp;</td>
<td></td>
</tr>
<!-- sub total -->
<% other_sub_total += other.grand_total %>
<!-- end sub total -->
<% end %>
<tr>
<td colspan="5">&nbsp;</td>
<td><%= t("views.right_panel.detail.sub_total") %></td>
<td ><span class="underline"><%= other_sub_total %></span></td>
</tr>
<% @other_charges.each do |other| %>
<% if other.total_item > 0
total_qty += other.total_item
end %>
<% grand_total +=other.grand_total%>
<tr>
<td>&nbsp;</td>
<td>Other Charges</td>
<td><%= other.item_code rescue '-' %></td>
<td><%= other.product_name rescue '-' %></td>
<td><%= other.total_item rescue '-' %></td>
<td> <%= number_with_precision(other.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td> <%= number_with_precision(other.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
</tr>
<!-- sub total -->
<% other_sub_total += other.grand_total %>
<!-- end sub total -->
<% end %>
<tr>
<td colspan="5">&nbsp;</td>
<td><%= t("views.right_panel.detail.sub_total") %></td>
<td ><span><%= number_with_precision(other_sub_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
</tr>
<%end%>
<!-- End Other Charges -->
<tr style="border-top:2px solid grey;">
<td colspan="3">&nbsp;</td>
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.item") %></td>
<td><span><%= total_qty%></span></td>
<td><%= t("views.right_panel.detail.net_amount") %></td>
<td><span><%= grand_total%></span></td>
<td style="border-bottom:2px solid grey;"><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %></td>
<td style="border-bottom:2px solid grey;"><span><%= number_with_precision(grand_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
</tr>
<% end %>
<tr>
<td colspan="5">&nbsp;</td>
<td><%= t("views.right_panel.detail.foc_item") %> <%= t("views.right_panel.detail.amount") %></td>
<td><span><%= total_item_foc %></span></td>
</tr>
<tr>
<td colspan="5">&nbsp;</td>
<td><%= t("views.right_panel.detail.item_discount") %> <%= t("views.right_panel.detail.amount") %></td>
<td><span><%= total_item_dis %></span></td>
</tr>
<tr>
<td colspan="5">&nbsp;</td>
<td><%= t("views.right_panel.detail.foc_sales") %></td>
<td><span><%= @foc_data %></span></td>
</tr>
<tr>
<td colspan="5">&nbsp;</td>
<td><%= t("views.right_panel.detail.discount") %> <%= t("views.right_panel.detail.amount") %></td>
<td><span><%= @discount_data %></span></td>
</tr>
<% if @type == "other"%>
<tr>
<td><b>Other Charges</b></td>
<td colspan="4">&nbsp;</td>
<td></td>
</tr>
<% @other_charges.each do |other| %>
<% if other.total_item > 0
total_qty += other.total_item
end %>
<% grand_total +=other.grand_total%>
<tr>
<td>&nbsp;</td>
<td>Other Charges</td>
<td><%= other.item_code rescue '-' %></td>
<td><%= other.product_name rescue '-' %></td>
<td><%= other.total_item rescue '-' %></td>
<td> <%= number_with_precision(other.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td> <%= number_with_precision(other.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
</tr>
<!-- sub total -->
<% other_sub_total += other.grand_total %>
<!-- end sub total -->
<% end %>
<tr>
<td colspan="5">&nbsp;</td>
<td><%= t("views.right_panel.detail.sub_total") %></td>
<td ><span><%= number_with_precision(other_sub_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
</tr>
<%end%>
</tbody>
</table>
</div>

View File

@@ -0,0 +1,366 @@
<div class="page-header">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item active"><%= t("views.right_panel.detail.sale_item_report") %></li>
<span class="float-right">
<%= link_to 'Back', dashboard_path %>
</span>
</ol>
</div>
<div class="row">
<div class="col-md-12">
<%= render :partial=>'shift_sale_report_filter',
:locals=>{ :period_type => true, :shift_name => true, :report_path =>reports_saleitem_index_path} %>
<hr />
<div class="text-right">
<a href="javascript:export_to('<%=reports_saleitem_index_path%>.xls')" class = "btn btn-info wave-effects "><%= t("views.btn.exp_to_excel") %></a>
</div>
<div class="margin-top-20">
<div class="card">
<div class="table-responsive">
<table class="table table-striped" id="items_table" border="0">
<thead>
<tr>
<th colspan="7"> <%= 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>
<% if @shift_from %>
<tr>
<% if @shift_data.employee %>
<% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %>
<% end %>
<th colspan="7"> <%= t("views.right_panel.detail.shift_name") %> = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )</th>
</tr>
<% end %>
<tr>
<th>&nbsp;</th>
<th><%= t("views.right_panel.header.menu_category") %></th>
<th><%= t("views.right_panel.detail.code") %></th>
<th><%= t("views.right_panel.detail.product") %></th>
<th><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.item") %></th>
<th><%= t("views.right_panel.detail.unit_price") %></th>
<th><%= t("views.right_panel.detail.revenue") %></th>
</tr>
</thead>
<tbody>
<% 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.blank? %>
<% acc_arr = Array.new %>
<% cate_arr = Array.new %>
<% sub_qty = 0 %>
<% sub_total = 0 %>
<% other_sub_total = 0 %>
<% count = 0 %>
<% total_price = 0 %>
<% cate_count = 0 %>
<% acc_count = 0 %>
<% grand_total = 0 %>
<% total_qty = 0 %>
<% total_amount = 0 %>
<% discount = 0 %>
<% total_item_foc = 0 %>
<% total_item_dis = 0.0 %>
<% total_tax = 0 %>
<% @sale_data.each do |sale| %>
<!-- all total qty sum -->
<% if sale.status_type != "Discount" && sale.status_type != "foc"
total_qty += sale.total_item
end %>
<% if sale.status_type == "foc" && sale.price > 0
total_qty += sale.total_item
end %>
<!-- end all total qty -->
<% if sale.status_type == "foc" && sale.grand_total < 0
total_item_foc += sale.grand_total*(-1)
end %>
<% if sale.status_type == "Discount" && sale.grand_total < 0
total_item_dis += sale.grand_total*(-1)
end %>
<% if !acc_arr.include?(sale.account_id) %>
<tr>
<td><b><%= sale.account_name %></b></td>
<td colspan="4">&nbsp;</td>
<td><%= t("views.right_panel.detail.total_price_by") %> <%= sale.account_name %></td>
<td>
<% @totalByAccount.each do |account, total| %>
<% if sale.account_id == account %>
<b><%= number_with_precision(total, precision:precision.to_i,delimiter:delimiter) %></b>
<% grand_total += total %>
<% end %>
<% end %>
</td>
</tr>
<% acc_arr.push(sale.account_id) %>
<% end %>
<tr>
<td>&nbsp;</td>
<% if !cate_arr.include?(sale.menu_category_id) %>
<td><%= sale.menu_category_name %></td>
<% cate_arr.push(sale.menu_category_id) %>
<% else %>
<td>&nbsp;</td>
<% end %>
<td><%= sale.item_code rescue '-' %></td>
<td><%= sale.product_name rescue '-' %></td>
<td><%= sale.total_item rescue '-' %></td>
<td><%= number_with_precision(sale.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td><%= number_with_precision(sale.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
</tr>
<!-- sub total -->
<% @menu_cate_count.each do |key,value| %>
<% if sale.account_id == key %>
<% count = count + 1 %>
<% sub_total += sale.grand_total %>
<% #sub_qty += sale.total_item %>
<% if sale.status_type!="Discount" && (!sale.product_name.include? "FOC")
sub_qty += sale.total_item
end %>
<% if count == value %>
<tr>
<td colspan="3">&nbsp;</td>
<td><b>Total <%= sale.account_name %> Qty </b> </td>
<td><b><%= sub_qty %></b></td>
<td><%= t("views.right_panel.detail.sub_total") %></td>
<td ><span class="underline"><%= number_with_precision(sub_total , precision:precision.to_i,delimiter:delimiter)%> </span></td>
</tr>
<% sub_total = 0.0%>
<% sub_qty = 0 %>
<% count = 0%>
<% end %>
<% end %>
<% end %>
<!-- end sub total -->
<% end %>
<!--Other Charges -->
<% if @other_charges.present? %>
<tr>
<td><b>Other Charges</b></td>
<td colspan="4">&nbsp;</td>
<td></td>
</tr>
<% @other_charges.each do |other| %>
<% if other.total_item > 0
total_qty += other.total_item
end %>
<% grand_total +=other.grand_total%>
<tr>
<td>&nbsp;</td>
<td>Other Charges</td>
<td><%= other.item_code rescue '-' %></td>
<td><%= other.product_name rescue '-' %></td>
<td><%= other.total_item rescue '-' %></td>
<td> <%= number_with_precision(other.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td> <%= number_with_precision(other.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
</tr>
<!-- sub total -->
<% other_sub_total += other.grand_total %>
<!-- end sub total -->
<% end %>
<tr>
<td colspan="5">&nbsp;</td>
<td><%= t("views.right_panel.detail.sub_total") %></td>
<td ><span><%= number_with_precision(other_sub_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
</tr>
<%end%>
<!-- End Other Charges -->
<tr style="border-top:2px solid grey;">
<td colspan="3">&nbsp;</td>
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.item") %></td>
<td><span><%= total_qty%></span></td>
<td style="border-bottom:2px solid grey;"><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %></td>
<td style="border-bottom:2px solid grey;"><span><%= number_with_precision(grand_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
</tr>
<% end %>
<tr>
<td colspan="5">&nbsp;</td>
<td><%= t("views.right_panel.detail.foc_item") %> <%= t("views.right_panel.detail.amount") %></td>
<td><span><%= number_with_precision(total_item_foc , precision:precision.to_i,delimiter:delimiter) %></span></td>
</tr>
<tr>
<td colspan="5">&nbsp;</td>
<td style="border-bottom:2px solid grey;"><%= t("views.right_panel.detail.item_discount") %> <%= t("views.right_panel.detail.amount") %></td>
<td style="border-bottom:2px solid grey;"><span><%= number_with_precision(total_item_dis , precision:precision.to_i,delimiter:delimiter) %></span></td>
</tr>
<tr>
<td colspan="5">&nbsp;</td>
<td><%= t("views.right_panel.detail.foc_sales") %></td>
<td>
<span><%= number_with_precision(@foc_data, precision:precision.to_i, delimiter:delimiter) %></span>
</td>
</tr>
<tr>
<td colspan="5">&nbsp;</td>
<td style="border-bottom:2px solid grey;"><%= t("views.right_panel.detail.discount") %> <%= t("views.right_panel.detail.amount") %></td>
<td style="border-bottom:2px solid grey;">
<span>
<%= number_with_precision(@discount_data , precision: precision.to_i,delimiter: delimiter) %>
</span>
</td>
</tr>
<% @sale_taxes.each do |tax| %>
<!-- <tr>
<td colspan="5">&nbsp;</td>
<td><%= tax.tax_name %></td>
<td><%= tax.st_amount.round(2) %>
<%total_tax += tax.st_amount%>
</td>
</tr> -->
<% end %>
<tr>
<td colspan="5">&nbsp;</td>
<td style="border-top:2px solid grey;">Net Amount</td>
<!-- <td><span class="double_underline"><%= grand_total.to_f - @discount_data.to_f%></span></td> -->
<td style="border-top:2px solid grey;"><%= number_with_precision(grand_total.to_f - @discount_data.to_f , precision:precision.to_i,delimiter:delimiter)%></td>
</tr>
<!-- <tr>
<td colspan="5">&nbsp;</td>
<td>Grand Total</td>
<td><span class="double_underline"><%= @grand_total - @change_amount%></span></td>
</tr> -->
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<script>
$(function(){
var check_arr = [];
var search = '<%= params[:period_type] %>';
if(search){
if(parseInt(search) == 0){
search_by_period();
}
else{
search_by_date();
}
}else{
search_by_period();
}
$('#sel_period').change(function(){
search_by_period();
});
function search_by_period(){
var period = $('#sel_period').val();
var period_type = 0;
var from = "";
var to = "";
show_shift_name(period,period_type,from,to,'shift_item');
}
// OK button is clicked
$('#from').bootstrapMaterialDatePicker().on('beforeChange', function(e, date){
new_date = new Date(date) ;
month = parseInt(new_date.getMonth()+1)
from = new_date.getDate() + "-" + month + "-" + new_date.getFullYear();
$('#from').val(from)
search_by_date();
});
$('#to').bootstrapMaterialDatePicker().on('beforeChange', function(e, date){
new_date = new Date(date) ;
month = parseInt(new_date.getMonth()+1)
to = new_date.getDate() + "-" + month + "-" + new_date.getFullYear();
$('#to').val(to)
search_by_date();
});
function search_by_date(){
from = $("#from").val();
to = $("#to").val();
var period = 0;
var period_type = 1;
if(to != '' && from != ''){
shift_name = from + ',' + to;
check_arr.push(to);
console.log(check_arr.length)
if(check_arr.length == 1){
show_shift_name(period,period_type,from,to,'shift_item');
}
if(check_arr.length == 3){
check_arr = [];
}
}
}
function show_shift_name(period,period_type,from,to,shift_item){
var shift = $('#shift_name');
if (from == '' && to == '') {
from = $("#from").val();
to = $("#to").val();
}
shift.empty();
var selected = '';
var str = '';
var param_shift = '<%= params[:shift_name]%>';
url = '<%= reports_get_shift_by_date_path %>';
$.get(url, {period :period, period_type :period_type, from :from, to :to, report_type :shift_item} , function(data){
console.log(data)
str = '<option value="0">--- All Shift ---</option>';
$(data.message).each(function(index){
var local_date = data.message[index].local_opening_date + ' - ' + data.message[index].local_closing_date;
var sh_date = data.message[index].opening_date + ' - ' + data.message[index].closing_date;
var shift_id = data.message[index].shift_id ;
if(param_shift != ''){
if(shift_id == param_shift){
selected = 'selected = "selected"';
}
else{
selected = '';
}
}
else{
selected = '';
}
str += '<option value="'+ shift_id +'" '+ selected +'>' + local_date + '</option>';
// console.log(sh_date)
})
shift.append(str);
});
}
});
</script>

View File

@@ -24,7 +24,16 @@
</div>
<div class="col-xs-12 col-sm-12 col-md-7 col-lg-7">
<div class="m-b-10 clearfix">
<div class="float-left">
<%= form_tag import_settings_menus_path,class:"col-md-", multipart:true do%>
<%=file_field_tag :file, :class => "img-thumbnail col-md-7" %>
<%=submit_tag "Import",:class => 'btn btn-primary btn-lg waves-effect' %>
<%end%>
</div>
<%= link_to t("views.btn.new"),new_settings_menu_path,:class => 'btn btn-primary btn-lg float-right waves-effect"' %>
<%= link_to "Export", settings_menus_path(format: "xlsx"),:class => 'btn btn-info btn-lg waves-effect float-right m-r-10' %>
</div>
<div class="card">
<table class="table table-striped">

View File

@@ -0,0 +1,86 @@
wb = xlsx_package.workbook
wb.styles do |s|
time_format = wb.styles.add_style :format_code => 'hh:mm:ss'
wrap_text = s.add_style :sz => 11,
:alignment => { :horizontal => :left,:vertical => :center ,
:wrap_text => true}
header_text = s.add_style :fg_color=> "FFFFFF",
:b => true,
:bg_color => "004586",
:sz => 12,
:border => { :style => :thin, :color => "00" },
:alignment => { :horizontal => :left,
:vertical => :center ,
:header_text => true}
wb.add_worksheet(name: "Account") do |sheet|
sheet.add_row %w(id title account_type discount point bonus rebate), :style=>header_text
Account.all.each do |acc|
sheet.add_row [acc.id, acc.title,acc.account_type,acc.discount,acc.point,acc.bonus,acc.rebate], :style=>wrap_text
end
end
wb.add_worksheet(name: "Item Set") do |sheet|
sheet.add_row %w(id name alt_name min_selectable_qty max_selectable_qty), :style=>header_text
ItemSet.all.each do |set|
sheet.add_row [set.id,set.name, set.alt_name, set.min_selectable_qty, set.max_selectable_qty], :style=>wrap_text
end
end
wb.add_worksheet(name: "Menu Item Options") do |sheet|
sheet.add_row %w(id option_type name value), :style=>header_text
MenuItemOption.all.each do |option|
sheet.add_row [option.id, option.option_type, option.name, option.value], :style=>wrap_text
end
end
wb.add_worksheet(name: "Menu Item Attributes") do |sheet|
sheet.add_row %w(id attribute_type name value), :style=>header_text
MenuItemAttribute.all.each do |attr|
sheet.add_row [attr.id, attr.attribute_type,attr.name,attr.value], :style=>wrap_text
end
end
wb.add_worksheet(name: "Menu") do |sheet|
sheet.add_row %w( id name is_active valid_days valid_time_from valid_time_to created_by ), :style=>header_text
@settings_menus.each do |menu|
sheet.add_row [ menu.id, menu.name, menu.is_active, menu.valid_days, menu.valid_time_from,menu.valid_time_to, menu.created_by], :style=>[wrap_text,time_format]
end
end
wb.add_worksheet(name: "Menu Category") do |sheet|
sheet.add_row %w(id menu_id code name alt_name order_by created_by menu_category_id is_available), :style=>header_text
MenuCategory.all.each do |mc|
sheet.add_row [mc.id, mc.menu_id, mc.code, mc.name, mc.alt_name, mc.order_by, mc.created_by, mc.menu_category_id, mc.is_available], :style=>wrap_text
end
end
wb.add_worksheet(name: "Menu Item") do |sheet|
sheet.add_row %w(id item_code name alt_name image_path description information unit type menu_category_id item_attributes item_options account_id min_qty taxable is_sub_item is_available created_by), :style=>header_text
MenuItem.all.each do |mi|
sheet.add_row [mi.id,mi.item_code, mi.name, mi.alt_name, mi.image_path, mi.description, mi.information, mi.unit, mi.type, mi.menu_category_id, mi.item_attributes, mi.item_options, mi.account_id, mi.min_qty, mi.taxable, mi.is_sub_item, mi.is_available, mi.created_by], :style=>wrap_text
end
end
wb.add_worksheet(name: "Menu Item Instance") do |sheet|
sheet.add_row %w(id menu_item_id item_instance_code item_instance_name item_attributes price is_on_promotion promotion_price is_available is_default), :style=>header_text
MenuItemInstance.all.each do |mii|
sheet.add_row [mii.id, mii.menu_item_id, mii.item_instance_code, mii.item_instance_name, mii.item_attributes, mii.price, mii.is_on_promotion, mii.promotion_price, mii.is_available, mii.is_default], :style=>wrap_text
end
end
wb.add_worksheet(name: "Menu Instance Item Set") do |sheet|
sheet.add_row %w(id item_set_id menu_item_instance_id), :style=>header_text
MenuInstanceItemSet.all.each do |miis|
sheet.add_row [miis.id ,miis.item_set_id, miis.menu_item_instance_id], :style=>wrap_text
end
end
wb.add_worksheet(name: "Menu Item Set") do |sheet|
sheet.add_row %w(id item_set_id menu_item_id), :style=>header_text
MenuItemSet.all.each do |mis|
sheet.add_row [mis.id,mis.item_set_id, mis.menu_item_id], :style=>wrap_text
end
end
end

View File

@@ -8,14 +8,16 @@
<%= f.error_notification %>
<div class="form-inputs p-l-15">
<%= f.input :name %>
<%= f.input :group_type, :collection => Lookup.collection_of("tax_profiles"),:input_html=>{:class=>"col-md-10"},:required=>true %>
<%= f.input :name, :input_html=>{:onchange=>"checkDuplicate(this.value);"} %>
<span id="tax_profile_nameErr" style="color:red;"></span>
<%= f.input :rate %>
<%= f.input :inclusive %>
<%= f.input :order_by %>
</div>
<div class="form-actions p-l-15">
<%= f.submit "Submit",:class => 'btn btn-primary btn-lg waves-effect' %>
<%= f.submit "Submit",:class => 'btn btn-primary btn-lg waves-effect btn_submit' %>
</div>
<% end %>
</div>
@@ -45,5 +47,25 @@
</div>
</div>
<script type="text/javascript">
function checkDuplicate(obj){
// $("#tax_profile_nameErr").html("");
var name = '<%= @name %>';
var tax_profiles = JSON.parse('<%= @tax_profiles.to_json.html_safe %>');
var group_type = $("#tax_profile_group_type").val();
if(tax_profiles!=undefined && tax_profiles!=null && tax_profiles!=""){
$.each(tax_profiles,function(key,value){
if(value.group_type == group_type){
if(name.trim().toLowerCase()!=value.name.trim().toLowerCase()){
if(value.name.trim().toLowerCase() == obj.trim().toLowerCase()){
$("#tax_profile_name").val("");
$("#tax_profile_nameErr").html("duplicate group type and name");
}
}
return;
}
});
}
}
</script>

View File

@@ -17,6 +17,7 @@
<table class="table">
<thead>
<tr>
<th><%= t("views.right_panel.detail.group_type") %></th>
<th><%= t("views.right_panel.detail.name") %></th>
<th><%= t("views.right_panel.detail.rate") %></th>
<th><%= t("views.right_panel.detail.inclusive") %></th>
@@ -29,6 +30,7 @@
<tbody>
<% @settings_tax_profiles.each do |settings_tax_profile| %>
<tr>
<td><%= settings_tax_profile.group_type %></td>
<td><%= settings_tax_profile.name %></td>
<td><%= settings_tax_profile.rate %></td>
<td><%= settings_tax_profile.inclusive %></td>

View File

@@ -15,6 +15,11 @@
<div class="card-block">
<h4 class="card-title"><%= t("en.tax_profile") %></h4>
<table class="table">
<tr>
<td><strong><%= t("views.right_panel.detail.group_type") %>:</strong></td>
<td><%= @settings_tax_profile.group_type %></td>
</tr>
<tr>
<td><strong><%= t("views.right_panel.detail.name") %>:</strong></td>
<td><%= @settings_tax_profile.name %></td>

165
app/views/transactions/sales/index.html.erb Executable file → Normal file
View File

@@ -17,17 +17,41 @@
<td colspan="8">
<%= form_tag transactions_sales_path, :method => :get do %>
<div class="row clearfix">
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-4">
<div class="col-lg-2 col-md-2 col-sm-2 col-xs-2">
<label><%= t("views.right_panel.detail.enter_keyboards") %></label>
<input type="text" id="receipt_no" name="receipt_no" class="form-control" placeholder="Receipt No/Cashier Name/Status" style="margin-right: 10px">
<input type="text" id="receipt_no" name="receipt_no" class="form-control" placeholder="Receipt No/Cashier Name/Status" style="margin-right: 10px;height: 34px;">
</div>
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
<label class=""><%= t("views.right_panel.detail.from") %></label>
<input class="form-control datepicker" name="from" id="from" type="text" placeholder="From date">
<div class="col-lg-2 col-md-2 col-sm-2">
<label class="font-14"><%= t("views.right_panel.detail.select_period") %></label>
<select name="period" id="sel_period" class="form-control">
<option value=""><%= t("views.right_panel.detail.select_period") %></option>
<option value="0">Today</option>
<option value="1">Yesterday</option>
<option value="2">This week</option>
<option value="3">Last week</option>
<option value="4">Last 7 days</option>
<option value="5">This month</option>
<option value="6">Last month</option>
<option value="7">Last 30 days</option>
<option value="8">This year</option>
<option value="9">Last year</option>
</select>
</div>
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
<div class="col-lg-2 col-md-2 col-sm-2 col-xs-2">
<label class=""><%= t("views.right_panel.detail.from") %></label>
<input class="form-control datepicker" name="from" id="from" type="text" placeholder="From date" style="height: 34px;">
</div>
<div class="col-lg-2 col-md-2 col-sm-2 col-xs-2">
<label class=""><%= t("views.right_panel.detail.to") %></label>
<input class="form-control datepicker" name="to" id="to" type="text" placeholder="To date">
<input class="form-control datepicker" name="to" id="to" type="text" placeholder="To date" style="height: 34px;">
</div>
<div class="col-lg-2 col-md-2 col-sm-2">
<label class="font-14"><%= t("views.right_panel.detail.all_shift") %></label>
<select class="form-control select" name="shift_name" id="shift_name" >
</select>
</div>
<div class="col-lg-1 col-md-1 col-sm-1 col-xs-1">
@@ -59,6 +83,7 @@
<th><%= t("views.right_panel.detail.grand_total") %></th>
<th><%= t :cashier %></th>
<th><%= t("views.right_panel.detail.sales_status") %></th>
<th><%= t("views.right_panel.detail.remark") %></th>
<th><%= t("views.right_panel.detail.receipt_date") %></th>
</tr>
</thead>
@@ -67,7 +92,16 @@
<% if @sales != 0 %>
<% @sales.each do |sale| %>
<tr>
<td><%= link_to sale.sale_id, transactions_sale_path(sale) %></td>
<td>
<% if !@sale_item_audits.nil? %>
<% @sale_item_audits.each do |audit| %>
<%if audit.include?(sale.sale_id) %>
<span style="color:#2196f3;">*</span>
<% end %>
<% end %>
<% end %>
<%= link_to sale.sale_id, transactions_sale_path(sale) %>
</td>
<td><%= sale.receipt_no %></td>
<td><%= sale.total_discount %></td>
<td><%= sale.total_tax %></td>
@@ -75,11 +109,20 @@
<td><%= sale.grand_total rescue '-' %></td>
<td><%= sale.cashier_name rescue '-' %></td>
<td> <%= sale.sale_status %> </td>
<td>
<% if !@sale_audits.nil? %>
<% @sale_audits.each do |audit| %>
<%if audit.include?(sale.sale_id) %>
<%= audit[sale.sale_id] %>
<% end %>
<% end %>
<% end %>
</td>
<td> <%= sale.receipt_date.utc.getlocal.strftime("%d-%m-%Y %I:%M %p") %> </td>
</tr>
<% end %>
<% else %>
<tr><td colspan="8"><strong><p style="text-align: center">There is no data for search....</p></strong></td></tr>
<tr><td colspan="10"><strong><p style="text-align: center">There is no data for search....</p></strong></td></tr>
<% end %>
</tbody>
</table>
@@ -97,9 +140,107 @@
<script type="text/javascript">
$(function(){
$("#receipt_no").val("<%=params[:receipt_no]%>");
$("#from").val("<%=params[:from]%>");
$("#to").val("<%=params[:to]%>");
$('#receipt_no').val("<%= params[:receipt_no] %>");
$('#from').val("<%= params[:from] %>");
$('#to').val("<%= params[:to] %>");
$('#sel_period').val("<%= params[:period] %>");
var check_arr = [];
search_by_period();
$('#sel_period').change(function(){
search_by_period();
});
function search_by_period(){
var period = $('#sel_period').val();
var period_type = 0;
var from = "";
var to = "";
show_shift_name(period,period_type,from,to,'shift_item');
}
// OK button is clicked
$('#from').bootstrapMaterialDatePicker().on('beforeChange', function(e, date){
new_date = new Date(date) ;
month = parseInt(new_date.getMonth()+1)
from = new_date.getDate() + "-" + month + "-" + new_date.getFullYear();
$('#from').val(from);
search_by_date();
});
$('#to').bootstrapMaterialDatePicker().on('beforeChange', function(e, date){
new_date = new Date(date) ;
month = parseInt(new_date.getMonth()+1)
to = new_date.getDate() + "-" + month + "-" + new_date.getFullYear();
$('#to').val(to);
search_by_date();
});
function search_by_date(){
from = $("#from").val();
to = $("#to").val();
var period = 0;
var period_type = 1;
if(to != '' && from != ''){
shift_name = from + ',' + to;
check_arr.push(to);
console.log(check_arr.length)
if(check_arr.length == 1){
show_shift_name(period,period_type,from,to,'shift_item');
}
if(check_arr.length == 3){
check_arr = [];
}
}
}
function show_shift_name(period,period_type,from,to,shift_item){
var shift = $('#shift_name');
if (from == '' && to == '') {
from = $("#from").val();
to = $("#to").val();
}
shift.empty();
var str = '';
var param_shift = '';
var param_shift = '<%= params[:shift_name] rescue '-'%>';
url = '<%= reports_get_shift_by_date_path %>';
$.get(url, {period :period, period_type :period_type, from :from, to :to, report_type :shift_item} , function(data){
str = '<option value="0">--- All Shift ---</option>';
$(data.message).each(function(index){
var local_date = data.message[index].local_opening_date + ' - ' + data.message[index].local_closing_date;
var sh_date = data.message[index].opening_date + ' - ' + data.message[index].closing_date;
var shift_id = data.message[index].shift_id ;
if(param_shift != ''){
if(shift_id == param_shift){
selected = 'selected = "selected"';
}
else{
selected = '';
}
}else{
selected = '';
}
str += '<option value="'+ shift_id +'" '+ selected +'>' + local_date + '</option>';
// console.log(sh_date)
})
shift.append(str);
});
}
});
</script>

View File

@@ -52,7 +52,7 @@
<td><%= @sale.receipt_no %></td>
<td><%= @sale.cashier_name rescue '-' %></td>
<td> <%= @sale.sale_status %> </td>
<td> <%= @sale.requested_at.strftime("%m-%d-%Y %H:%M %p") %> </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>
@@ -60,6 +60,7 @@
<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| %>
@@ -69,42 +70,43 @@
<td><%= number_with_precision(s.price, :precision => 2, :delimiter => ',') rescue ' '%></td>
<td><%= number_with_precision(s.qty * 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="2"><%= number_with_precision(@sale.total_amount, :precision => 2, :delimiter => ',') rescue ' '%></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="2"><%= number_with_precision(@sale.total_discount, :precision => 2, :delimiter => ',') rescue ' '%></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="2"><%= number_with_precision(r.tax_payable_amount, :precision => 2, :delimiter => ',') rescue ' '%></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="2"><%= number_with_precision(@sale.grand_total, :precision => 2, :delimiter => ',') rescue ' '%></td>
<td colspan="3"><%= number_with_precision(@sale.grand_total, :precision => 2, :delimiter => ',') rescue ' '%></td>
</tr>
<tr><td colspan="5">&nbsp;<td></tr>
<tr>
<td colspan=2 style="text-align:center"></td>
<td><%= t("views.right_panel.detail.total_pay_amount") %></td>
<td colspan="2"><%= number_with_precision(@sale.amount_received, :precision => 2, :delimiter => ',') rescue ' '%></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="2"><%= number_with_precision(r.payment_amount, :precision => 2, :delimiter => ',') rescue ' '%>
<td colspan="3"><%= number_with_precision(r.payment_amount, :precision => 2, :delimiter => ',') rescue ' '%>
</td>
</tr>
@@ -114,7 +116,7 @@
<tr>
<td colspan=2 style="text-align:center"></td>
<td><%= t("views.right_panel.detail.change") %></td>
<td colspan="2"><%= number_with_precision(@sale.amount_changed, :precision => 2, :delimiter => ',') rescue ' '%></td>
<td colspan="3"><%= number_with_precision(@sale.amount_changed, :precision => 2, :delimiter => ',') rescue ' '%></td>
</tr>
</tbody>
@@ -258,9 +260,3 @@
</div>

View File

@@ -0,0 +1,113 @@
<div class="page-header">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item active"><%= t("views.right_panel.detail.survey") %></li>
<span class="float-right">
<%= link_to 'Back', dashboard_path %>
</span>
</ol>
</div>
<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>
<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 > &nbsp;</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">
<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 %>
<% 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| %>
<% 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 colspan="2"><strong><%= total_local %></strong></td>
</tr>
</tbody>
</table>
<br>
<%if !@orders.nil?%>
<%= paginate @surveys %>
<%end%>
</div>
</div>
</div>
</div>
</div>