remove confilct data

This commit is contained in:
phyusin
2018-05-14 10:17:26 +06:30
115 changed files with 5075 additions and 2409 deletions

View File

@@ -1,4 +1,4 @@
json.extract! @crm_customer, :id, :name, :company, :contact_no, :email, :date_of_birth,
:membership_id, :membership_type, :membership_authentication_code,
:salutation, :gender,:nrc_no,:address,:card_no, :paypar_account_no, :customer_type, :tax_profiles
:salutation, :gender,:nrc_no,:address,:card_no, :paypar_account_no, :customer_type, :image_path, :tax_profiles
json.url crm_customer_url(@crm_customer, format: :json)

View File

@@ -185,7 +185,7 @@ $(document).on('click',".customer_tr",function(){
url: url,
data: {},
dataType: "json",
success: function(data) {
success: function(data) {
// Selected for Taxes
var taxes = JSON.stringify(data.tax_profiles);
var parse_taxes = JSON.parse(taxes);
@@ -193,7 +193,7 @@ $(document).on('click',".customer_tr",function(){
$("#customer_tax_profiles option[value='" + value + "']").attr("selected","selected").css({'color':'#fff','background':'#215d9c'});
});
$('#customer_id').val(data.id);
$('#customer_id').val(data.id);
$('#customer_name').val(data.name);
$('#customer_company').val(data.company);
$('#customer_contact_no').val(data.contact_no);
@@ -205,6 +205,9 @@ $(document).on('click',".customer_tr",function(){
$('#paypar_account_no').val(data.paypar_account_no);
$('#customer_address').val(data.address);
$('#customer_date_of_birth').val(data.date_of_birth);
if(data.image_path.url!=undefined && data.image_path.url!=null){
$('.menu-item-img .img-thumbnail').attr('src',data.image_path.url);
}
$('#customer_membership_type').val(data.membership_type);
$('.selectpicker > option[value="'+data.membership_type+'"]').attr('selected','selected');
if (data.gender == 'Male') {

View File

@@ -1,4 +1,4 @@
json.extract! @crm_customer, :id, :name, :company, :contact_no, :email, :date_of_birth,
:membership_id, :membership_type, :membership_authentication_code,
:salutation, :gender,:nrc_no,:address,:card_no, :paypar_account_no, :customer_type, :tax_profiles
:salutation, :gender,:nrc_no,:address,:card_no, :paypar_account_no, :customer_type, :image_path, :tax_profiles
json.url crm_customer_url(@crm_customer, format: :json)

View File

@@ -11,8 +11,8 @@
<%= f.input :queue_no , :class => "dining",:id => "dining", :readonly => true%>
<%= f.hidden_field :customer_id %>
<%= f.input :name %>
<%= f.input :contact_no %>
<%= f.input :seater %>
<%= f.input :contact_no , input_html: { min: 1, :onkeypress => "return isNumberKey(event);", :onkeyup => "notChar(this.value);" } %>
<%= f.input :seater , input_html: { min: 1, :onkeypress => "return isNumberKey(event);", :onkeyup => "notNegative(this.value);" } %>
<%= f.input :remark %>
</div>
<br>
@@ -111,11 +111,29 @@
<script type="text/javascript">
function isNumberKey(evt) {
var charCode = (evt.which) ? evt.which : event.keyCode;
if (charCode != 46 && charCode > 31 && (charCode < 48 || charCode > 57)) {
return false;
} else {
return true;
}
}
function notNegative(val){
if(parseInt(val)< 1) $("#dining_queue_seater").val(0);
}
function notNegative(val){
if(typeof val == "string") $("#dining_queue_seater").val(0);
}
$(document).ready(function(){
if($('form').attr('id') == "new_dining_queue"){
var queue_no = $('.generate_no').text();
$('#dining_queue_queue_no').val(queue_no);
var queue_no = $('.generate_no').text();
$('#dining_queue_queue_no').val(queue_no);
}
$( "input" ).focusin(function() {

View File

@@ -132,6 +132,9 @@
<li>
<a href="<%= reports_product_sale_index_path %>">Product Sale</a>
</li>
<li>
<a href="<%= reports_order_reservation_index_path %>">Order Reservation</a>
</li>
<li>
<a href="<%= reports_receipt_no_index_path %>">Receipt</a>
</li>

View File

@@ -123,25 +123,29 @@ $(document).ready(function(){
data: params,
success: function(result){
// alert("Updated!");
<% 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' %>
if(result.status){
<% 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' %>
window.location.href = '/origami/table/'+<%=@link_type%>;
<% else %>
window.location.href = '/origami/room/'+<%=@link_type%>;
<% end %>
<% else %>
window.location.href = '/origami/table/'+<%=@link_type%>;
<% else %>
window.location.href = '/origami/room/'+<%=@link_type%>;
<% end %>
<% else %>
window.location.href = '/origami/table/'+<%=@link_type%>;
<% end %>
<% end %>
<% end %>
<% else %>
window.location.href = '/oqs';
<% end %>
<% else %>
window.location.href = '/oqs';
<% end %>
}else{
swal("Alert!", result.message, "warning");
}
}
});
});

View File

@@ -1,9 +1,10 @@
<!-- Column One -->
<div class="row clearfix" style="">
<div class="col-lg-11 col-md-11 col-sm-11">
<div class="col-lg-8 col-md-8 col-sm-8">
<div class="body p-l-10">
<div class="row clearfix">
<div class="col-lg-5 col-md-5 col-sm-5 col-xs-12">
<div class="form-group col-lg-2 col-md-2 col-sm-2">
<label class="label-align">Select Station</label>
<span class="hidden" id="oqs_active"></span>
<select class="form-control select oqs_click" name="oqs_id" id="oqs_id">
<option value="0" data-id="0">Processed</option>
@@ -15,16 +16,6 @@
<% end %>
</select>
</div>
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-12">
<span class="hidden" id="table_id"></span>
<select class="form-control select tables" name="table_id" id="tables">
<option value="">Select Table</option>
<% @tables.each do |table| %>
<option value="<%= table.id %>" data-id="<%= table.id %>"> <%= table.name %></option>
<% end %>
</select>
</div>
<!--
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-12">
<span class="hidden" id="room_id"></span>
@@ -44,67 +35,64 @@
<div class="card">
<div class="card-block">
<div class="tab-content" id="custom-slimscroll" style="">
<div class="tab-pane in active" id="completed" role="tabpanel">
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;column-count: ;">
<%
@queue_completed_item.each do |qid|
%>
<div class="card queue_station" data-order-no="<%= qid.order_id %>">
<div class="card-block">
<div class="row">
<%if qid.type.present?%>
<span class="col-md-4 order-zone-type font-13"><%= qid.type %>-<%= qid.zone %></span>
<%else%>
<span class="col-md-4 order-zone-type font-13"></span>
<%end%>
<div class="tab-pane in active" id="completed" role="tabpanel">
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;column-count: ;">
<%
@queue_completed_item.each do |qid|
%>
<div class="card queue_station" data-order-no="<%= qid.order_id %>">
<div class="card-block">
<div class="row">
<%if qid.type.present?%>
<span class="col-md-4 order-zone-type font-13"><%= qid.type %>-<%= qid.zone %></span>
<%else%>
<span class="col-md-4 order-zone-type font-13"></span>
<%end%>
<span class="order-zone hidden font-13"><%= qid.zone %></span>
<span class="col-md-8"><small class="float-right font-13"><%= qid.order_id %></small></span>
</div>
<p class="m-b--10">
<span class="order-item font-16">
<%= qid.item_name %>
</span> [x
<span class="order-qty">
<%= qid.qty %>
</span> ]
<% if !qid.set_menu_items.nil? %>
<% qid.set_menu_items.each do |item_instance|%>
<br><span class="font-12">
<%= item_instance %>
<span class="order-zone hidden font-13"><%= qid.zone %></span>
<span class="col-md-8"><small class="float-right font-13"><%= qid.order_id %></small></span>
</div>
<p class="m-b--10">
<span class="order-item font-16">
<%= qid.item_name %>
</span> [x
<span class="order-qty">
<%= qid.qty %>
</span> ]
<% if !qid.set_menu_items.nil? %>
<% qid.set_menu_items.each do |item_instance|%>
<br><span class="font-12">
<%= item_instance %>
</span>
<% end %>
<% end %>
</p>
<br/><p class="card-text item-options"><%= qid.options == "[]"? "" : qid.options %></p>
<span class="card-text">
<span class="text-muted">Order at -
<span class="order-at font-13">
<%= qid.created_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p") %>
</span> <br>
Order By - <span class="order-by font-13">
<%= qid.item_order_by %>
</span>
</span>
<% end %>
<% end %>
</p>
<br/><p class="card-text item-options"><%= qid.options == "[]"? "" : qid.options %></p>
<span class="card-text">
<span class="text-muted">Order at -
<span class="order-at font-13">
<%= qid.created_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p") %>
</span> <br>
Order By - <span class="order-by font-13">
<%= qid.item_order_by %>
</span>
</span>
</span>
<p class="hidden order-status">completed</p>
<p class="hidden order-customer"><%= qid.customer_name %></p>
<p class="hidden assigned-order-item"><%= qid.assigned_order_item_id %></p>
</div>
</div>
<% end %>
</div>
</div>
<div class="card-columns oqs_append" id="oqs_container" style="padding-top:10px; column-gap: 1.2rem;">
</span>
<p class="hidden order-status">completed</p>
<p class="hidden order-customer"><%= qid.customer_name %></p>
<p class="hidden assigned-order-item"><%= qid.assigned_order_item_id %></p>
</div>
</div>
<% end %>
</div>
</div>
<div class="card-columns oqs_append" id="oqs_container" style="padding-top:10px; column-gap: 1.2rem;">
</div>
</div>
</div>
</div>
</div>
<!-- Column Two -->
@@ -151,6 +139,35 @@
</div>
-->
<!-- Column Three -->
<div class="col-lg-3 col-md-3 col-sm-3 table-block">
<p class="hidden filter"><%= @filter %></p>
<div class="card">
<div class="card-block">
<div class="tab-content" id="table-slimscroll" style="">
<ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#table" id="defaultOpen">Table</a></li>
<li><a data-toggle="tab" href="#room">Room</a></li>
</ul>
<div class="tab-content">
<div id="table" class="tab-pane fade">
<% @tables.each do |table| %>
<div class="col-lg-4 col-md-4 col-sm-4 table-float">
<button class='btn btn-lg waves-effect green tables table-width' value="<%= table.id %>" data-id="<%= table.id %>"> <%= table.name %></button>
</div>
<% end %>
</div>
<div id="room" class="tab-pane fade">
<% @rooms.each do |room| %>
<div class="col-lg-4 col-md-4 col-sm-4 table-float">
<button class='btn btn-lg waves-effect green tables table-width' value="<%= room.id %>" data-id="<%= room.id %>"> <%= room.name %></button>
</div>
<% end %>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-1 col-md-1 col-sm-1">
<!-- OQS Buttons -->
<br>
@@ -168,4 +185,6 @@
window.location.href = '/dashboard';
});
});
document.getElementById("defaultOpen").click();
</script>

965
app/views/origami/addorders/detail.html.erb Executable file → Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
if(@id)
menu_item = MenuItem.find(@id.menu_item_id)
if(@instance)
menu_item = MenuItem.find(@instance.menu_item_id)
# Format for option json
opt_format = []
# Format for attributes json
@@ -24,14 +24,14 @@ if(@id)
end
json.success true
json.id @id.id
json.name @id.item_instance_name
json.code @id.item_instance_code
json.id @instance.id
json.name @instance.item_instance_name
json.code @instance.item_instance_code
json.item_id @id.menu_item_id
json.attributes @id.item_attributes
json.price @id.price
json.is_default @id.is_default
json.item_id @instance.menu_item_id
json.attributes @instance.item_attributes
json.price @instance.price
json.is_default @instance.is_default
json.options opt_format
else

View File

@@ -204,8 +204,7 @@
var bank_integration = "<%= @bank_integration %>";
var cashier_type = "<%= @cashier_type %>";
$("#reference_no_Err").html("");
if(reference_no.length > 0){
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 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();
@@ -244,15 +243,12 @@
});
}
}else{
if (amount>0) {
swal ( "Oops" , "Paid Amount is over!" , "error" );
}else{
swal ( "Oops" , "Enter Amount!" , "error" );
}
}
}else{
$("#reference_no_Err").html("can't be blank");
}else{
if (amount>0) {
swal ( "Oops" , "Paid Amount is over!" , "error" );
}else{
swal ( "Oops" , "Enter Amount!" , "error" );
}
}
})
</script>

View File

@@ -207,6 +207,21 @@
<%= f.text_field :date_of_birth,:value=>"01-01-1990",:class=>"form-control datepicker"%>
</div>
<div class="form-group">
<label><%= t("views.right_panel.detail.customer_photo") %></label>
<div class="panel padding-10">
<div class="menu-item-img">
<% if f.object.image_path? %>
<p><%= f.object.name %></p>
<%= image_tag f.object.image_path.url, :class => "img-thumbnail" %>
<% else %>
<%= image_tag "/image/menu_images/default.png", :class => "img-thumbnail" %>
<% end %>
</div>
<%= f.file_field :image_path, :class => "img-thumbnail" %>
</div>
</div>
<div class="form-group">
<label><%= t("views.right_panel.detail.select_customer_type") %></label>
<select class="form-control col-md-12" id="customer_type" name="customer[customer_type]" style="height: 40px" >

View File

@@ -0,0 +1,36 @@
json.id menu.id
json.name menu.name
json.is_active menu.is_active
json.valid_time_from menu.valid_time_from.strftime("%H:%M")
json.valid_time_to menu.valid_time_to.strftime("%H:%M")
if (menu.menu_categories)
json.categories menu.menu_categories do |category|
menu_category = MenuCategory.find_by_menu_category_id(category.id)
if !menu_category.nil?
json.sub_category "true"
else
json.sub_category "false"
end
valid_time = category.valid_time
json.valid_time valid_time
json.id category.id
json.code category.code
json.order_by category.order_by
json.name category.name
json.alt_name category.alt_name
json.order_by category.order_by
json.parent_id category.menu_category_id
json.is_available category.is_available
if category.menu_items
json.items category.menu_items do |item|
json.partial! 'origami/addorders/menu_item', item: item
end
end
end
end

View File

@@ -0,0 +1,15 @@
menu_json = json.array! @menus do |menu|
json.id menu.id
json.name menu.name
json.valid_days menu.valid_days
json.valid_time_from menu.valid_time_from.strftime("%H:%M")
json.valid_time_to menu.valid_time_to.strftime("%H:%M")
json.partial! 'origami/dashboard/menu', menu: menu
# if (@current_menu)
# json.current_menu do
# json.partial! 'api/restaurant/menu/menu', menu: @current_menu
# end
# end
end

View File

@@ -28,6 +28,7 @@
</div>
</div>
<% end %>
<% if @dinein_cashier == '1' %>
<div class="col-lg-3 col-md-3 col-sm-4 col-xs-12 cashier_view">
<div class="info-box bg-green">
<div class="icon" >
@@ -36,6 +37,7 @@
<div class="text font-20 m-l-5" style="line-height: 80px;"><%= t :dine_in_cashier %></div>
</div>
</div>
<% end %>
<% if @order_reservation == '1' %>
<div class="col-lg-3 col-md-3 col-sm-4 col-xs-12 order_reservation">
<div class="info-box bg-blue">
@@ -205,6 +207,15 @@
<button type="button" data-href="<%=origami_second_display_index_path%>" target="_blank" id="second_view" class="btn action-btn bg-blue waves-effect second_view hidden" style="height: 45px">Customer View</button>
<input type="hidden" name="server_mode" value="<%=ENV["SERVER_MODE"]%>" id="server_mode">
<script>
$(function() {
$.ajax({
type: "GET",
url: 'get_all_menu',
data: {},
success:function(result){
localStorage.setItem("menus", JSON.stringify(result));
}
});
$(".cashier_view").on('click', function() {
window.location.href = '/origami';
@@ -221,9 +232,9 @@
window.location.href = '/origami/order_reservation';
});
$("#second_view").on('click', function () {
$("#second_view").on('click', function () {
var url = $(this).attr("data-href");
window.open(url,'_blank');
});
});
</script>

View File

@@ -142,7 +142,6 @@ $(document).ready(function(){
var webview = <%= @webview %>;
showHideNavbar(webview,"index");
$(".tables").on('click', function(){
var dining_id = $(this).attr("data-id");
window.location.href = '/origami/table/' + dining_id;

View File

@@ -485,8 +485,15 @@
<% end %>
<button type="button" id="customer" class="btn btn-block bg-blue waves-effect">Customer</button>
<% if current_login_employee.role != "waiter" %>
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
<button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void</button>
<!-- <button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
<button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void</button> -->
<% if current_login_employee.role == "cashier" %>
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="edit">Edit</a>
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
<% else %>
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
<button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void</button>
<% end %>
<% end %>
<% if current_login_employee.role != "waiter" %>
<button type="button" id="discount" class="btn btn-block bg-blue waves-effect" <%= (can? :index, :discount)? ' ': 'disabled=' %> active="true">Discount</button>
@@ -579,26 +586,35 @@
</div>
</div>
</div>
<div class="modal fade" id="waste_spoileModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal fade" id="AccessCodeModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-sm" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="waste_spoileModalLabel">Are you sure Waste or Spoile ?</h4>
<h4 class="modal-title" id="AccessCodeModalLabel">Enter Access Code</h4>
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#111;">&times;</button>
</div>
<div class="modal-body">
<div class="row p-r-20">
<div class="col-md-3">
<button type="button" class="btn btn-lg bg-red waves-effect " data-status="waste" value="waste" id="btn_waste" onclick="waste_and_spoilage('waste')"><strong>Waste</strong></button>
</div>
<div class="col-md-3">
<button type="button" class="btn btn-lg bg-red waves-effect " data-status="spoile" value="spoile" id="btn_spoile" onclick="waste_and_spoilage('spoile')"><strong>Spoile</strong></button>
</div>
<div class="col-md-3">
<button type="button" class="btn btn-lg bg-blue waves-effect" data-dismiss="modal"><strong>CLOSE</strong></button>
</div>
</div>
</div>
<div class="modal-footer ">
<div class="modal-body" style="padding: 0px 25px 15px 25px !important">
<input type="text" id="access_code" class="access_code form-control col-md-12 ">
<div class="row bottom p-l-15 p-r-15 m-t-10">
<div class="col-md-3 access_number border-top border-left" data-value="1" data-type="num">1</div>
<div class="col-md-3 access_number border-top border-left" data-value="2" data-type="num">2</div>
<div class="col-md-3 access_number border-top border-left" data-value="3" data-type="num">3</div>
<div class="col-md-3 access_number border-top border-left" data-value="4" data-type="num">4</div>
</div>
<div class="row bottom p-l-15 p-r-15">
<div class="col-md-3 access_number border-top border-left" data-value="5" data-type="num">5</div>
<div class="col-md-3 access_number border-top border-left" data-value="6" data-type="num">6</div>
<div class="col-md-3 access_number border-top border-left" data-value="7" data-type="num">7</div>
<div class="col-md-3 access_number border-top border-left" data-value="8" data-type="num">8</div>
</div>
<div class="row bottom p-l-15 p-r-15">
<div class="col-md-3 access_number border-top border-left" data-value="9" data-type="num">9</div>
<div class="col-md-3 access_number border-top border-left" data-value="0" data-type="num">0</div>
<div class="col-md-3 access_number border-top border-left orange" data-type="clr">Clr</div>
<div class="col-md-3 access_number ok border-top border-left blue" data-type="ok" data-action="">OK</div>
</div>
</div>
</div>
</div>
@@ -957,6 +973,7 @@
});
$('#void').on('click', function () {
var access_code = localStorage.getItem("access_code");
if ($(this).attr('active')=== "true") {
swal({
title: "Alert",
@@ -975,7 +992,7 @@
$.ajax({
type: 'POST',
url: ajax_url,
data: "remark="+ remark + "&sale_id=" + sale_id,
data: "remark="+ remark + "&sale_id=" + sale_id+ "&access_code=" + access_code,
success: function (result) {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
@@ -993,6 +1010,7 @@
$('#add_order').on('click', function () {
var dining_id = "<%= @dining.id %>";
window.location.href = '/origami/addorders/' + dining_id;
});
@@ -1052,6 +1070,12 @@
return attribute_arr;
}
$(document).on('click', '.access_modal', function(event){
type = $(this).data("type");
$(".ok").attr("data-action",type)
$('#AccessCodeModal').modal('show');
});
function waste_and_spoilage(remark) {
swal({
title: "Alert",
@@ -1081,4 +1105,34 @@
}
});
}
function check_emp_access_code(access_code,type) {
var url = "/origami/check_emp_access_code/" + access_code ;
$.ajax({
type: 'POST',
url: url,
data: {},
success: function (result) {
console.log(result);
if (result.status == true) {
createAccessCode(code);
if (type == "edit") {
var dining_id = "<%= @dining.id rescue "" %> ";
var sale_id = "<%= @obj_sale.sale_id rescue "" %>";
window.location.href = '/origami/table/' + dining_id + "/sale/" + sale_id + "/"+cashier_type +"/edit";
}else if(type == "void"){
$('#AccessCodeModal').modal('hide');
$('#voidModal').modal('show');
// overall_void();
}else if(type == "waste_and_spoilage"){
}
}else{
swal("Opps",result.message,"warning")
}
}
});
}
</script>

View File

@@ -200,8 +200,7 @@ $('#jcb_pay').on('click',function(){
var receipt_no = "<%= @receipt_no %>";
var bank_integration = "<%= @bank_integration %>";
$("#reference_no_Err").html("");
if(reference_no.length > 0){
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 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();
@@ -247,8 +246,5 @@ $('#jcb_pay').on('click',function(){
swal ( "Oops" , "Enter Amount!" , "error" );
}
}
}else{
$("#reference_no_Err").html("can't be blank");
}
})
</script>

View File

@@ -198,7 +198,6 @@
var receipt_no = "<%= @receipt_no %>";
var bank_integration = "<%= @bank_integration %>";
$("#reference_no_Err").html("");
if(reference_no.length > 0){
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
$(this).off("click");
@@ -245,8 +244,5 @@
swal ( "Oops" , "Enter Amount!" , "error" );
}
}
}else{
$("#reference_no_Err").html("can't be blank");
}
})
</script>

View File

@@ -1,211 +1,376 @@
<div class="container-fluid">
<div class="row">
<!-- Column One -->
<div class="col-lg-6 col-md-6 col-sm-6">
<div class="row">
<!-- Column One -->
<div class="col-lg-6 col-md-6 col-sm-6">
<!-- Nav tabs -->
<ul class="nav nav-tabs tab-col-teal" role="tablist" id="mytab">
<!-- Nav tabs -->
<ul class="nav nav-tabs tab-col-teal" role="tablist" id="mytab">
<li class="nav-item">
<a class="nav-link " data-toggle="tab" href="#tables" role="tab">Tables</a>
</li>
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#rooms" role="tab">Rooms</a>
</li>
<li class="nav-item">
<a class="nav-link " data-toggle="tab" href="#tables" role="tab">Tables</a>
</li>
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#rooms" role="tab">Rooms</a>
</li>
</ul>
<!-- Nav tabs - End -->
<div id="order-detail-slimscroll" data-height="130">
<div class="tab-content" style="">
<!--- Panel 0 - Completed Orders -->
<!--- Panel 1 - Table Orders -->
<div class="tab-pane " id="tables" role="tabpanel">
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
<% @tables.each do |table| %>
<% if table.status == 'occupied' %>
<div class="card tables red text-white" data-id="<%= table.id %>" data-name="<%= table.name %>">
<div class="card-block">
<%= table.name %>
</div>
</div>
<% else %>
<div class="card tables green text-white" data-id="<%= table.id %>" data-name="<%= table.name %>">
<div class="card-block">
<%= table.name %>
</div>
</div>
<% end %>
<% end %>
</div>
</div>
</ul>
<!-- Nav tabs - End -->
<div id="custom-slimscroll">
<div class="tab-content" style="">
<!--- Panel 0 - Completed Orders -->
<!--- Panel 1 - Table Orders -->
<div class="tab-pane" id="tables" role="tabpanel">
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
<% @tables.each do |table| %>
<% if table.status == 'occupied' %>
<% if table.get_booking.nil? %>
<% if table.get_checkout_booking.nil? %>
<div class="card tables red text-white" data-id="<%= table.id %>" data-name="<%= table.name %>">
<% else %>
<div class="card tables orange text-white" data-id="<%= table.id %>">
<% end %>
<div class="card-block">
<%= table.name %>
</div>
</div>
<% else %>
<% if table.get_checkout_booking.nil? %>
<div class="card tables blue text-white" data-id="<%= table.id %>">
<% else %>
<div class="card tables orange text-white" data-id="<%= table.id %>">
<% end %>
<div class="card-block">
<%= table.name %>
</div>
</div>
<% end %>
<% else %>
<div class="card tables green text-white" data-id="<%= table.id %>" data-name="<%= table.name %>">
<div class="card-block">
<%= table.name %>
</div>
</div>
<% end %>
<% end %>
</div>
</div>
<!--- Panel 2 - Room Orders -->
<div class="tab-pane active" id="rooms" role="tabpanel">
<!--- Panel 2 - Room Orders -->
<div class="tab-pane active" id="rooms" role="tabpanel">
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;" >
<% @rooms.each do |room| %>
<% if room.status == 'occupied' %>
<% if room.get_booking.nil? %>
<div class="card rooms red text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
<% if room.get_booking.nil? %>
<div class="card rooms red text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
<% else %>
<div class="card rooms blue text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
<% end %>
<div class="card-block">
<%= room.name %>
</div>
</div>
<% else %>
<div class="card rooms green text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
<div class="card-block">
<div class="card rooms blue text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
<% end %>
<div class="card-block">
<%= room.name %>
</div>
</div>
<% end %>
<% end %>
</div>
</div>
<!--- Panel 3 - s -->
</div>
</div>
<!-- tabs - End -->
</div>
<!-- Column One -->
<!-- Column Two -->
<div class="col-lg-5 col-md-5 col-sm-5">
<div class="card" >
<div class="card-header">
<div><strong id="order-title"> MOVE --> <span style='color:red'>' <%= @dining.name %>' </span> to <span style='color:blue' id="moved"> </span></strong></div>
<input type='hidden' id="change_table_value" value="" />
</div>
<div class="card-block">
<div class="card-title row">
<div class="col-lg-6 col-md-6 col-sm-6">
<p class="m-l-10"> Receipt No: <span id="receipt_no">
<% if @status_sale == 'sale' %>
<%= @obj_sale.receipt_no rescue '' %>
<% end %>
</span></p>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
<p class="m-r-10">Date: <span id="receipt_date"><%= @date.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
</div>
</div>
<div class="card-title row customer_detail hide">
<div class="col-lg-6 col-md-6 col-sm-6">
<p>Customer : <span id="customer_name"></span></p>
</div>
</div>
<div id="order-detail-slimscroll" data-height="130">
<div class="card-text" style="" >
<table class="table table-striped" id="order-items-table">
<thead>
<tr>
<th class="item-name">Items</th>
<th class="item-attr">QTY</th>
<th class="item-attr">Price</th>
</tr>
</thead>
<tbody>
<%
sub_total = 0
if @status_sale == "sale"
@obj_sale.sale_items.each do |sale_item|
sub_total = sub_total + sale_item.price
%>
<input type="hidden" id="sale_id" value="<%= @obj_sale.sale_id %>">
<% unless sale_item.price <= 0 %>
<tr>
<td class='item-name'><%= sale_item.product_name %></td>
<td class='item-attr'><%= sale_item.qty %></td>
<td class='item-attr'><%= sale_item.price %></td>
</tr>
<%
end
end
end
if @status_order == 'order'
unless @order_items.nil?
@order_items.each do |order_item |
sub_total = sub_total + order_item.price
unless order_item.price <= 0 %>
<tr>
<td class='item-name'><%= order_item.item_name %></td>
<td class='item-attr'><%= order_item.qty %></td>
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
</tr>
<%
end
end
end
end
%>
</tbody>
</table>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="move_table purple" id="move_table">MOVE TABLE</div>
</div>
</div>
</div>
</div>
</div>
</div>
<% else %>
<div class="card rooms green text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
<div class="card-block">
<%= room.name %>
</div>
</div>
<% end %>
<% end %>
</div>
</div>
<!--- Panel 3 - s -->
</div>
</div>
<!-- tabs - End -->
</div>
<!-- Column One -->
<!-- Column Three -->
<div class="col-lg-1 col-md-1 col-sm-1">
<!-- Waiter Buttons -->
<button type="button" class="btn bg-default btn-block" id='back'> <i class="material-icons">reply</i>Back</button>
<!-- Column Two -->
<div class="col-lg-5 col-md-5 col-sm-5">
<div class="card" >
<div class="card-header">
<div><strong id="order-title"> MOVE --> <span style='color:red'> ' <%= @dining.name %> ' </span> to <span style='color:blue' id="moved"> </span></strong></div>
<input type='hidden' id="change_table_value" value="" />
<% if @status_order == 'order' && @status_sale != 'sale' %>
<% if !@obj_order.nil? %>
<div id="save_order_id" data-order="<%= @obj_order.order_id %>">
<% else %>
<div id="save_order_id" data-order="">
<% end %>
<% if !@booking.nil? %>
<strong id="order-title">ORDER DETAILS </strong> | Table <%= @dining.name rescue "" %>
<% if @booking.checkout_by.nil? && !@booking.reserved_by.nil? %>
<span class="float-right"><%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> - <%= @booking.checkout_at.utc.getlocal.strftime("%I:%M %p") %></span>
<% else %>
<span class="float-right">Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span>
<% end %>
<% end %>
</div>
<% elsif @status_sale == 'sale' %>
<div><strong id="order-title">INVOICE DETAILS </strong> | Table <%= @dining.name rescue "" %>
<% if !@booking.reserved_by.nil? && %>
<span class="float-right"><%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> - <%= @booking.checkout_at.utc.getlocal.strftime("%I:%M %p") %></span>
<% else %>
<span class="float-right">Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span>
<% end %>
</div>
<% else %>
<strong id="order-title">ORDER DETAILS </strong> | Table <%= @dining.name rescue "" %>
<% end %>
</div>
<div class="card-block">
<div class="card-title">
<div class="row p-l-5 p-r-5">
<% if (!@sale_array.empty?) && (!@date.nil?) %>
<div class="col-lg-6 col-md-6 col-sm-6">
&nbsp; Receipt No: <span id="receipt_no">
<% if @status_sale == 'sale' %>
<%= @sale_array[0].receipt_no rescue '' %>
<% end %>
</span>
<br>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
Date: <span id="receipt_date"><%= @date.utc.getlocal.strftime("%d/%m/%Y-%I:%M %p") rescue '-' %></span>
<br>
</div>
<% elsif !@date.nil? %>
<div class="col-lg-7 col-md-7 col-sm-7">
&nbsp; Order No: <span id="order_no">
<% if @status_order == 'order' %>
<%= @obj_order.order_id rescue '' %>
<% end %>
</span>
<br>
</div>
<div class="col-lg-5 col-md-5 col-sm-5 text-right">
Date: <span id="receipt_date"><%= @date.utc.getlocal.strftime("%d/%m/%Y") rescue '-' %></span>
<br>
</div>
<% end %>
</div>
</div>
<div class="row p-l-5 p-r-5">
<div class="col-lg-6 col-md-6 col-sm-6">
<% if @status_sale == 'sale' && !@sale_array.empty? %>
<p class="hidden customer-id"><%= @sale_array[0].customer_id rescue '' %></p>
&nbsp; Customer : <%= @sale_array[0].customer.name rescue '' %>
<% elsif @status_order == 'order' && !@customer.nil?
%>
<p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p>
&nbsp; Customer : <%= @customer.name rescue "" %>
<% end %>
</div>
</div>
<div id="order-detail-slimscroll" data-height="130">
<div class="card-text" style="" >
<table class="table table-striped" id="order-items-table">
<thead>
<tr>
<th>#</th>
<th class="item-name">Items</th>
<th class="item-attr">QTY</th>
<th class="item-attr">Price</th>
</tr>
</thead>
<tbody>
<%
count = 0
sub_total = 0
if @status_sale == "sale"
@sale_array[0].sale_items.each do |sale_item|
count += 1
sub_total = sub_total + sale_item.price
%>
<input type="hidden" id="sale_id" value="<%= @sale_array[0].sale_id %>">
<% unless sale_item.price <= 0 %>
<tr>
<td><%= count %></td>
<td class='item-name'><%= sale_item.product_name %></td>
<td class='item-attr'><%= sale_item.qty %></td>
<td class='item-attr'><%= sale_item.price %></td>
</tr>
<%
end
end
end
if @status_order == 'order' && @status_sale != 'sale'
unless @order_items.nil? || @order_items.empty?
count = 0
@order_items.each do |order_item |
count += 1
sub_total = sub_total + (order_item.price * order_item.qty)
#unless order_item.price <= 0 %>
<tr>
<td><%= count %></td>
<td class='item-name'><%= order_item.item_name %></td>
<td class='item-attr'><%= order_item.qty %></td>
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
</tr>
<%
#end
end
end
end
%>
</tbody>
</table>
</div>
</div>
<%
if @status_sale == 'sale'
unless @order_items.nil?
%>
Pending New Order
<table class="table table-striped">
<%
@order_items.each do |order_item |
%>
<tr>
<td class='item-name'><%= order_item.item_name %></td>
<td class='item-attr'><%= order_item.qty %></td>
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
</tr>
<%
end
%>
</table>
<button class='btn btn-primary btn-block waves-effect' id='add_invoice'> Add to existing invoice </button>
<%
else
@sale_array.each do |sale|
if @sale_array.size > 1
unless sale.receipt_no == @sale_array[0].receipt_no
%>
Pending Payment
<table class="table table-striped">
<tr>
<td>Receipt No - <%= sale.receipt_no %></td>
<td><button class='btn btn-lg btn-blue '>Show Detail </button></td>
</tr>
</table>
<%
end
end
end
end
end
%>
<div class="row">
<div class="col-md-12">
<div class="move_table purple" id="move_table">MOVE ROOM</div>
</div>
</div>
</div>
</div>
</div>
<!-- Column Three -->
<div class="col-lg-1 col-md-1 col-sm-1">
<!-- Waiter Buttons -->
<button type="button" class="btn bg-default btn-block" id='back'> <i class="material-icons">reply</i>Back</button>
</div>
</div>
</div>
<script>
$(document).ready(function(){
$(".tables").on('click', function(){
$(document).ready(function(){
/* check webview loaded*/
var webview = <%= @webview %>;
showHideNavbar(webview);
$(".tables").on('click', function(){
$('.tables').removeClass('selected-item');
$(this).addClass('selected-item');
$(this).addClass('selected-item');
var dining_name = $(this).attr("data-name");
var dining_id = $(this).attr("data-id");
var change_from = "<%= @dining.id %>";
if ((dining_id == change_from) || (dining_name==undefined)) {
swal({
title: "Alert!!",
text: 'Please select another table !',
type: 'warning',
});
}else{
$('#moved').text(" ' " + dining_name + " ' ")
$('#change_table_value').val(dining_id);
}
})
$(".rooms").on('click', function(){
$(this).addClass('selected-item');
var dining_name = $(this).attr("data-name");
var dining_id = $(this).attr("data-id");
$('#moved').text(" ' " + dining_name + " ' ")
$('#change_table_value').val(dining_id);
})
var change_from = "<%= @dining.id %>";
if (dining_id == change_from) {
swal({
title: "Alert!!",
text: 'Please select another room !',
type: 'warning',
});
}else{
$('#moved').text(dining_name)
$('#change_table_value').val(dining_id);
}
})
$(".rooms").on('click', function(){
$('.rooms').removeClass('selected-item');
$(this).addClass('selected-item');
var dining_name = $(this).attr("data-name");
var dining_id = $(this).attr("data-id");
$('#moved').text(dining_name)
$('#change_table_value').val(dining_id);
})
$('#move_table').on('click',function(){
change_to = $('#change_table_value').val();
change_from = "<%= @dining.id %>";
if (change_to == ""){
alert("Please Select Room")
}else{
$.ajax({type: "POST",
url: "<%= origami_moving_path %>",
data: "change_from="+ change_from + "&change_to=" + change_to,
success:function(result){
alert("Moving Success")
if (result.get_type == 'Table'){
window.location.href = '/origami/table/' + change_to;
}else{
window.location.href = '/origami/room/' + change_to;
}
$('#move_table').on('click',function(){
change_to = $('#change_table_value').val();
change_from = "<%= @dining.id %>";
if (change_to == ""){
alert("Please Select Room")
}else{
$.ajax({type: "POST",
url: "<%= origami_moving_path %>",
data: "change_from="+ change_from + "&change_to=" + change_to,
success:function(result){
alert("Moving Success")
if (result.get_type == 'Table'){
window.location.href = '/origami/table/' + change_to;
}else{
window.location.href = '/origami/room/' + change_to;
}
}
});
}
});
}
$('#add_invoice').on('click', function () {
var dining_id = "<%= @dining.id %>";
var sale_id = $("#sale_id").val();
var ajax_url = "/origami/sale/append_order";
$.ajax({
type: "POST",
url: ajax_url,
data: 'dining_id=' + dining_id + "&sale_id=" + sale_id,
success: function (result) {
swal({
title: "Information!",
text: "Invoice updated",
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
$("#first_bill").removeAttr('disabled');
$("#pay").removeAttr('disabled');
window.location.reload();
});
}
});
});
});
$('#back').on('click',function(){
window.location.href = '/origami/room/'+ "<%= @dining.id %>";
})
});
$('#back').on('click',function(){
window.location.href = '/origami/room/'+ "<%= @dining.id %>";
})
</script>

View File

@@ -22,27 +22,27 @@
<div class="card-columns" style="padding-top:10px;" >
<% @tables.each do |table| %>
<% if table.status == 'occupied' %>
<% if table.get_booking.nil? %>
<% if table.get_checkout_booking.nil? %>
<div class="card tables red text-white" data-id="<%= table.id %>" data-name="<%= table.name %>">
<% else %>
<div class="card tables orange text-white" data-id="<%= table.id %>">
<% end %>
<div class="card-block">
<%= table.name %>
</div>
</div>
<% else %>
<% if table.get_checkout_booking.nil? %>
<div class="card tables blue text-white" data-id="<%= table.id %>">
<% else %>
<div class="card tables orange text-white" data-id="<%= table.id %>">
<% end %>
<div class="card-block">
<%= table.name %>
<% if table.get_booking.nil? %>
<% if table.get_checkout_booking.nil? %>
<div class="card tables red text-white" data-id="<%= table.id %>" data-name="<%= table.name %>">
<% else %>
<div class="card tables orange text-white" data-id="<%= table.id %>">
<% end %>
<div class="card-block">
<%= table.name %>
</div>
</div>
</div>
<% end %>
<% else %>
<% if table.get_checkout_booking.nil? %>
<div class="card tables blue text-white" data-id="<%= table.id %>">
<% else %>
<div class="card tables orange text-white" data-id="<%= table.id %>">
<% end %>
<div class="card-block">
<%= table.name %>
</div>
</div>
<% end %>
<% else %>
<div class="card tables green text-white" data-id="<%= table.id %>" data-name="<%= table.name %>">
<div class="card-block">
@@ -54,119 +54,120 @@
</div>
</div>
<!--- Panel 2 - Room Orders -->
<div class="tab-pane" id="rooms" role="tabpanel">
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;" >
<% @rooms.each do |room| %>
<% if room.status == 'occupied' %>
<% if room.get_booking.nil? %>
<div class="card rooms red text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
<% if room.get_booking.nil? %>
<div class="card rooms red text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
<% else %>
<div class="card rooms blue text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
<% end %>
<div class="card-block">
<%= room.name %>
</div>
<div class="card rooms blue text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
<% end %>
<div class="card-block">
<%= room.name %>
</div>
<% else %>
<div class="card rooms green text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
<div class="card-block">
<%= room.name %>
</div>
<% else %>
<div class="card rooms green text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
<div class="card-block">
<%= room.name %>
</div>
</div>
<% end %>
<% end %>
</div>
<% end %>
<% end %>
</div>
<!--- Panel 3 - s -->
</div>
</div>
<!--- Panel 3 - s -->
<!-- tabs - End -->
</div>
</div>
<!-- tabs - End -->
</div>
<!-- Column One -->
<!-- Column One -->
<!-- Column Two -->
<div class="col-lg-5 col-md-5 col-sm-5">
<div class="card" >
<div class="card-header">
<div><strong id="order-title"> MOVE --> <span style='color:red'> ' <%= @dining.name %> ' </span> to <span style='color:blue' id="moved"> </span></strong></div>
<input type='hidden' id="change_table_value" value="" />
<% if @status_order == 'order' && @status_sale != 'sale' %>
<% if !@obj_order.nil? %>
<div id="save_order_id" data-order="<%= @obj_order.order_id %>">
<% else %>
<div id="save_order_id" data-order="">
<% end %>
<% if !@booking.nil? %>
<strong id="order-title">ORDER DETAILS </strong> | Table <%= @dining.name rescue "" %>
<% if @booking.checkout_by.nil? && !@booking.reserved_by.nil? %>
<span class="float-right"><%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> - <%= @booking.checkout_at.utc.getlocal.strftime("%I:%M %p") %></span>
<% else %>
<span class="float-right">Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span>
<% end %>
<% end %>
</div>
<% elsif @status_sale == 'sale' %>
<div><strong id="order-title">INVOICE DETAILS </strong> | Table <%= @dining.name rescue "" %>
<% if !@booking.reserved_by.nil? && %>
<span class="float-right"><%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> - <%= @booking.checkout_at.utc.getlocal.strftime("%I:%M %p") %></span>
<% else %>
<span class="float-right">Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span>
<% end %>
</div>
<% else %>
<strong id="order-title">ORDER DETAILS </strong> | Table <%= @dining.name rescue "" %>
<% end %>
</div>
<div class="card-block">
<div class="card-title">
<div class="row p-l-5 p-r-5">
<% if (!@sale_array.empty?) && (!@date.nil?) %>
<div class="col-lg-6 col-md-6 col-sm-6">
&nbsp; Receipt No: <span id="receipt_no">
<% if @status_sale == 'sale' %>
<!-- Column Two -->
<div class="col-lg-5 col-md-5 col-sm-5">
<div class="card" >
<div class="card-header">
<div><strong id="order-title"> MOVE --> <span style='color:red'> ' <%= @dining.name %> ' </span> to <span style='color:blue' id="moved"> </span></strong></div>
<input type='hidden' id="change_table_value" value="" />
<% if @status_order == 'order' && @status_sale != 'sale' %>
<% if !@obj_order.nil? %>
<div id="save_order_id" data-order="<%= @obj_order.order_id %>">
<% else %>
<div id="save_order_id" data-order="">
<% end %>
<% if !@booking.nil? %>
<strong id="order-title">ORDER DETAILS </strong> | Table <%= @dining.name rescue "" %>
<% if @booking.checkout_by.nil? && !@booking.reserved_by.nil? %>
<span class="float-right"><%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> - <%= @booking.checkout_at.utc.getlocal.strftime("%I:%M %p") %></span>
<% else %>
<span class="float-right">Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span>
<% end %>
<% end %>
</div>
<% elsif @status_sale == 'sale' %>
<div><strong id="order-title">INVOICE DETAILS </strong> | Table <%= @dining.name rescue "" %>
<% if !@booking.reserved_by.nil? && %>
<span class="float-right"><%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> - <%= @booking.checkout_at.utc.getlocal.strftime("%I:%M %p") %></span>
<% else %>
<span class="float-right">Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span>
<% end %>
</div>
<% else %>
<strong id="order-title">ORDER DETAILS </strong> | Table <%= @dining.name rescue "" %>
<% end %>
</div>
<div class="card-block">
<div class="card-title">
<div class="row p-l-5 p-r-5">
<% if (!@sale_array.empty?) && (!@date.nil?) %>
<div class="col-lg-6 col-md-6 col-sm-6">
&nbsp; Receipt No: <span id="receipt_no">
<% if @status_sale == 'sale' %>
<%= @sale_array[0].receipt_no rescue '' %>
<% end %>
</span>
<br>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
Date: <span id="receipt_date"><%= @date.utc.getlocal.strftime("%d/%m/%Y-%I:%M %p") rescue '-' %></span>
<br>
</div>
<% elsif !@date.nil? %>
<div class="col-lg-7 col-md-7 col-sm-7">
&nbsp; Order No: <span id="order_no">
<% if @status_order == 'order' %>
<%= @obj_order.order_id rescue '' %>
<% end %>
</span>
<br>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
Date: <span id="receipt_date"><%= @date.utc.getlocal.strftime("%d/%m/%Y-%I:%M %p") rescue '-' %></span>
<br>
</div>
<% elsif !@date.nil? %>
<div class="col-lg-7 col-md-7 col-sm-7">
&nbsp; Order No: <span id="order_no">
<% if @status_order == 'order' %>
<%= @obj_order.order_id rescue '' %>
<% end %>
</span>
<br>
<% end %>
</span>
<br>
</div>
<div class="col-lg-5 col-md-5 col-sm-5 text-right">
Date: <span id="receipt_date"><%= @date.utc.getlocal.strftime("%d/%m/%Y") rescue '-' %></span>
<br>
</div>
<% end %>
<% end %>
</div>
</div>
</div>
<div class="row p-l-5 p-r-5">
<div class="col-lg-6 col-md-6 col-sm-6">
<% if @status_sale == 'sale' && !@sale_array.empty? %>
<p class="hidden customer-id"><%= @sale_array[0].customer_id rescue '' %></p>
&nbsp; Customer : <%= @sale_array[0].customer.name rescue '' %>
<% elsif @status_order == 'order' && !@customer.nil?
%>
<p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p>
&nbsp; Customer : <%= @customer.name rescue "" %>
<% end %>
<div class="row p-l-5 p-r-5">
<div class="col-lg-6 col-md-6 col-sm-6">
<% if @status_sale == 'sale' && !@sale_array.empty? %>
<p class="hidden customer-id"><%= @sale_array[0].customer_id rescue '' %></p>
&nbsp; Customer : <%= @sale_array[0].customer.name rescue '' %>
<% elsif @status_order == 'order' && !@customer.nil?
%>
<p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p>
&nbsp; Customer : <%= @customer.name rescue "" %>
<% end %>
</div>
</div>
</div>
<div id="order-detail-slimscroll" data-height="130">
<div id="order-detail-slimscroll" data-height="130">
<div class="card-text" style="" >
<table class="table table-striped" id="order-items-table">
<thead>
@@ -243,7 +244,7 @@ if @status_sale == 'sale'
end
%>
</table>
<button class='btn btn-blue'> Add to existing invoice </button>
<button class='btn btn-primary btn-block waves-effect' id='add_invoice'> Add to existing invoice </button>
<%
else
@sale_array.each do |sale|
@@ -284,31 +285,27 @@ end
</div>
<script>
$(document).ready(function(){
$(".tables").on('click', function(){
$('.tables').removeClass('selected-item');
$(this).addClass('selected-item');
var dining_name = $(this).attr("data-name");
var dining_id = $(this).attr("data-id");
var change_from = "<%= @dining.id %>";
if (dining_id == change_from) {
/*$.alert({
title: 'Alert!',
content: 'Please Select Another Table',
type: 'red',
typeAnimated: true,
btnClass: 'btn-danger',
});*/
swal({
title: "Alert!!",
text: 'Please Select Another Table !',
type: 'warning',
});
}else{
$('#moved').text(" ' " + dining_name + " ' ")
$('#change_table_value').val(dining_id);
}
/* check webview loaded*/
var webview = <%= @webview %>;
showHideNavbar(webview);
})
$(".tables").on('click', function(){
$('.tables').removeClass('selected-item');
$(this).addClass('selected-item');
var dining_name = $(this).attr("data-name");
var dining_id = $(this).attr("data-id");
var change_from = "<%= @dining.id %>";
if ((dining_id == change_from) || (dining_name==undefined)) {
swal({
title: "Alert!!",
text: 'Please select another table !',
type: 'warning',
});
}else{
$('#moved').text(" ' " + dining_name + " ' ")
$('#change_table_value').val(dining_id);
}
});
$(".rooms").on('click', function(){
$('.rooms').removeClass('selected-item');
@@ -319,14 +316,14 @@ end
if (dining_id == change_from) {
swal({
title: "Alert!!",
text: 'Please Select Another Table !',
text: 'Please select another room !',
type: 'warning',
});
}else{
$('#moved').text(dining_name)
$('#change_table_value').val(dining_id);
}
})
});
$('#move_table').on('click',function(){
change_to = $('#change_table_value').val();
@@ -358,7 +355,32 @@ end
}
});
}
})
});
$('#add_invoice').on('click', function () {
var dining_id = "<%= @dining.id %>";
var sale_id = $("#sale_id").val();
var ajax_url = "/origami/sale/append_order";
$.ajax({
type: "POST",
url: ajax_url,
data: 'dining_id=' + dining_id + "&sale_id=" + sale_id,
success: function (result) {
swal({
title: "Information!",
text: "Invoice updated",
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
$("#first_bill").removeAttr('disabled');
$("#pay").removeAttr('disabled');
window.location.reload();
});
}
});
});
});
$('#back').on('click',function(){
window.location.href = '/origami/table/'+ "<%= @dining.id %>";

View File

@@ -204,9 +204,8 @@
var bank_integration = "<%= @bank_integration %>";
var cashier_type = "<%= @cashier_type %>";
$("#reference_no_Err").html("");
if(reference_no.length > 0){
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
$(this).off("click");
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();
@@ -244,15 +243,12 @@
});
}
}else{
if (amount>0) {
swal ( "Oops" , "Paid Amount is over!" , "error" );
}else{
swal ( "Oops" , "Enter Amount!" , "error" );
}
}
}else{
$("#reference_no_Err").html("can't be blank");
}else{
if (amount>0) {
swal ( "Oops" , "Paid Amount is over!" , "error" );
}else{
swal ( "Oops" , "Enter Amount!" , "error" );
}
}
})
</script>

View File

@@ -4,7 +4,7 @@ if @order
:requested_time,:expected_waiting_time,:callback_url,:transaction_ref,:item_count,:total_customer,:payment_type,
:payment_status,:payment_ref,:taxes,:total_amount,:total_tax,
:discount_amount,:convenience_charge,:grand_total,:status,:order_remark,
:reservation_remark,:sale_id)
:remark,:sale_id)
@delivery = Delivery.find_by_order_reservation_id(@order.order_reservation_id)
if @delivery
json.delivery do |json|

View File

@@ -1,48 +1,65 @@
<%= stylesheet_link_tag 'order_reservation', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'order_reservation', 'data-turbolinks-track': 'reload' %>
<div class="container-fluid">
<!-- start count function -->
<%
pending_count = 0
accepted_count = 0
delivered_count = 0
completed_count = 0
processed_count = 0
%>
<% if !@count_on_order.nil?
@count_on_order.each do |count_order|
if count_order.status == "new"
pending_count = count_order.count
elsif count_order.status == "accepted"
accepted_count = count_order.count
elsif count_order.status == "send_to_kitchen"
delivered_count = count_order.count
elsif count_order.status == "ready_to_delivery"
completed_count = count_order.count
end
end
end
if !@count_on_completed.nil?
processed_count = @count_on_completed.count
end
%>
<!-- end count function -->
<div class="row m-t--10">
<div class="col-lg-4 col-md-4 col-sm-4 div_order_margin">
<ul class="nav nav-tabs tab-col-teal" role="tablist">
<li class="nav-item red m-b-10" data-color="#F44336" data-type="pending">
<a class="nav-link" data-toggle="tab" href="#pending" role="tab"><p class="num p-t-15 p-b-5">
<% if !@count_on_order.nil? %>
<% @count_on_order.each do |count_order|
if count_order.status == "new" %>
<%= count_order.count %>
<% end
end %>
<% end %></p> <%= t :pending %></a>
<div class="col-lg-5 col-md-5 col-sm-5 div_order_margin">
<ul class="nav nav-tabs tab-col-teal <%= @shop.shop_code ? @shop.shop_code : '' %>" role="tablist">
<li class="nav-item red m-b-5" data-color="#F44336" data-type="pending">
<a class="nav-link" data-toggle="tab" href="#pending" role="tab">
<p class="num p-t-5">
<%= pending_count %>
</p> <%= t :pending %></a>
</li>
<li class="nav-item purple m-b-10" data-color="#673AB7" data-type="processing">
<a class="nav-link" data-toggle="tab" href="#processing" role="tab"><p class="num p-t-15 p-b-5">
<% if !@count_on_order.nil? %>
<% @count_on_order.each do |count_order|
if count_order.status == "accepted" %>
<%= count_order.count %>
<% end
end %>
<% end %></p> <%= t :processing %></a>
<li class="nav-item purple m-b-5" data-color="#673AB7" data-type="processing">
<a class="nav-link" data-toggle="tab" href="#processing" role="tab">
<p class="num p-t-5">
<%= accepted_count %>
</p> <%= t :processing %></a>
</li>
<li class="nav-item m-b-10" data-color="#009688" data-type="delivery" style="background-color: #009688;">
<a class="nav-link" data-toggle="tab" href="#delivery" role="tab"><p class="num p-t-15 p-b-5">
<% if !@count_on_order.nil? %>
<% @count_on_order.each do |count_order|
if count_order.status == "send_to_kitchen" %>
<%= count_order.count %>
<% end
end %>
<% end %></p> <%= t :delivering %></a>
<li class="nav-item m-b-5" data-color="#009688" data-type="delivery" style="background-color: #009688;">
<a class="nav-link" data-toggle="tab" href="#delivery" role="tab">
<p class="num p-t-5">
<%= delivered_count %>
</p> <%= t :delivering %></a>
</li>
<li class="nav-item m-b-10" data-color="#03A9F4" data-type="completed" style="background-color: #03A9F4;">
<a class="nav-link" data-toggle="tab" href="#completed" role="tab"><p class="num p-t-15 p-b-5">
<% if !@count_on_order.nil? %>
<% @count_on_order.each do |count_order|
if count_order.status == "ready_to_delivery" %>
<%= count_order.count %>
<% end
end %>
<% end %></p> <%= t :completed %></a>
<li class="nav-item m-b-5" data-color="#03A9F4" data-type="completed" style="background-color: #03A9F4;">
<a class="nav-link" data-toggle="tab" href="#completed" role="tab">
<p class="num p-t-5">
<%= completed_count %>
</p> <%= t :completed %></a>
</li>
<li class="nav-item m-b-5" data-color="#5bc0de" data-type="processed" style="background-color: #5bc0de;">
<a class="nav-link" data-toggle="tab" href="#processed" role="tab">
<p class="num p-t-5">
<%= processed_count %>
</p> <%= t :processed %></a>
</li>
</ul>
@@ -50,7 +67,7 @@
<div class="tab-pane active" id="pending" role="tabpanel">
<div class="card-block font-13">
<div id="menu-slimscroll" data-height="50">
<table class="table table-stripe custom-table order_reserve_cable">
<table class="table table-stripe custom-table <%= @shop.shop_code ? @shop.shop_code : '' %>_order_reserve_cable">
<tbody>
<% i=1
@order.each do |order| %>
@@ -60,7 +77,7 @@
<%=i%>
</td>
<td width ="20%" class="align-center">
<%= order.created_at.utc.getlocal.strftime("%d-%m-%Y") %>
<%= order.created_at.utc.getlocal.strftime("%Y-%m-%d") %>
</td>
<td width ="20%" class="align-center">
<%= order.created_at.utc.getlocal.strftime("%I:%M %p") %>
@@ -197,7 +214,48 @@
</td>
<td width ="30%" class="align-center">
<span class="font-10 col-blue">
<%= order.delivery.to_json %>
<% if order.delivery.delivery_type == 'service' %>
DELIVERY
<% elsif order.delivery.delivery_type == 'pick_up' %>
PICK-UP
<% else %>
DIRECT DELIVERY
<% end %>
</span>
</td>
</tr>
<%i+=1%>
<%end%>
<%end%>
</tbody>
</table>
</div>
</div>
</div>
<!--- Panel 5 - processed -->
<div class="tab-pane dining" id="processed" role="tabpanel">
<div class="card-block font-13">
<div id="menu-slimscroll" data-height="50">
<table class="table table-stripe custom-table">
<tbody>
<% i=1
@order.each do |order| %>
<% if order.status == 'delivered' && (order.created_at.utc.getlocal.strftime("%Y-%m-%d") == DateTime.now.strftime("%Y-%m-%d")) %>
<tr class="custom-tr fifth-<%=i%>" style="" data-id="<%=order.order_reservation_id%>" data-sr-no="<%= i %>">
<td width ="5%" class="align-left">
<%=i%>
</td>
<td width ="20%" class="align-center">
<%= order.created_at.utc.getlocal.strftime("%Y-%m-%d") %>
</td>
<td width ="20%" class="align-center">
<%= order.created_at.utc.getlocal.strftime("%I:%M %p") %>
</td>
<td width ="20%" class="align-center">
<%=order.grand_total%>
</td>
<td width ="30%" class="align-center">
<span class="font-10 col-blue">
<% if order.delivery.delivery_type == 'service' %>
DELIVERY
<% elsif order.delivery.delivery_type == 'pick_up' %>
@@ -221,7 +279,7 @@
</div>
<div class="col-lg-4 col-md-4 col-sm-4 div_card_order">
<div class="card">
<div class="card m-b-5 p-t-5">
<div class="card-header custom-card-header" style="color:">
<table class="table">
<tr>
@@ -231,7 +289,11 @@
<td width="40%" class="header-td align-left">
<b><span class="font-15" id="requested_date_time"></span></b>
</td>
<td width ="50%" class="header-td font- align-right"><b><span id="contact_info"></span></b></td>
<td width ="50%" class="header-td align-right">
<b><span id="invoice_no"></span></b>
<span id="order_status" class="hidden"></span>
<span id="approved_code" class="hidden"></span>
</td>
</tr>
</table>
</div>
@@ -297,8 +359,8 @@
</tr>
<tr>
<td width ="50%" class="footer-td align-left col-blue">
<button type="button" class="btn btn-lg bg-red waves-effect" id="cancel" data-value="cancel">
<strong>DECLINE</strong>
<button type="button" class="btn btn-lg bg-red waves-effect" id="cancel" data-value="rejected">
<strong>REJECT</strong>
</button>
</td>
<td width ="50%" class="footer-td align-right col-blue">
@@ -322,47 +384,55 @@
</div>
</div>
<div class="'col-lg-4 col-md-4 col-sm-4'" style="margin:0px -5px 0px -2px !important ">
<div class="card" style="background-color: #E8EAF6">
<div class="col-lg-3 col-md-3 col-sm-3">
<div class="card m-b-5 p-t-5" style="background-color: #E8EAF6">
<div class="card-header custom-card-header" style="background-color: #E8EAF6">
<table class="table">
<tr>
<td width ="" class="header-td align-left col-blue">CUSTOMER & DELIVERY INFORMATION
<td class="header-td align-left col-blue">CUSTOMER & DELIVERY INFORMATION
</td>
</tr>
</table>
</div>
<div class="card-block">
<table class="table">
<div class="card-block" id="customer-info-slimscroll" data-height="95">
<table class="table tbl_customer">
<tbody>
<tr>
<td class="body-td align-left">
<span class="font-13">NAME</span><br>
<b id="customer_name"></b>
<td colspan="2" class="body-td align-left">
<span class="font-13">REF.</span><br>
<b id="trans_ref"></b>
</td>
<td class="body-td align-right">
</tr>
<tr>
<td class="body-td align-left">
<span class="font-13">REQUESTED TIME</span><br>
<b id="requested_time"></b>
</td>
<td class="body-td align-right expected_time">
<span class="font-13">COOKING TIME</span><br>
<b><span id="expected_time"></span> MINS</b>
</td>
</tr>
<tr>
<td class="body-td align-left">
<td colspan="2" class="body-td align-left">
<span class="font-13">NAME</span><br>
<b id="customer_name"></b>
</td>
</tr>
<tr>
<td colspan="2" class="body-td align-left">
<span class="font-13">PHONE</span><br>
<b id="phone"></b>
</td>
<td class="body-td align-right expected_time">
<span class="font-13">EXPECTED WAITING TIME</span><br>
<b id="expected_time"></b>
</td>
</tr>
<tr>
<td class="body-td align-left">
<td colspan="2" class="body-td align-left">
<span class="font-13">ADDRESS</span><br>
<b id="address"></b>
</td>
</tr>
<tr>
<td class="body-td align-left">
<td colspan="2" class="body-td align-left">
<span class="font-13">DELEVERY</span><br>
<b id="delivery_to"></b>
</td>
@@ -373,13 +443,33 @@
<b id="order_remark"></b>
</td>
</tr>
<tr>
<td colspan="2" class="body-td align-left">
<b><i><span id="remark"></span></i></b>
</td>
</tr>
</tbody>
</table>
</div>
<div class="card-footer order_close_cashier">
<% if current_user.role != "waiter" %>
<div class="row">
<div class="col-sm-7 col-xs-7 col-md-7 col-lg-7"></div>
<div class="col-sm-4 col-xs-4 col-md-4 col-lg-4">
<button id="order_close_cashier" class="align-right text-center btn btn-md btn-link btn-primary waves-effect"><%= t("views.btn.close_cashier") %></button>
</div>
</div>
<% end %>
</div>
</div>
</div>
<div id="<%= @shop.shop_code ? @shop.shop_code : '' %>_doemal_new_order"></div>
<div id="<%= @shop.shop_code ? @shop.shop_code : '' %>_notify_new_order"></div>
<div id="<%= @shop.shop_code ? @shop.shop_code : '' %>_notify_order_send_to_kitchen"></div>
<div id="<%= @shop.shop_code ? @shop.shop_code : '' %>_notify_order_ready_to_delivery"></div>
</div>
</div>
<p id="ref_no" class="hidden"></p>
<p id="callback_url" class="hidden"></p>
<p id="order_id" class="hidden"></p>
@@ -392,29 +482,193 @@
<h4 class="modal-title" id="waiting_timeModalLabel">Expected Waiting Time for <span id="requested_order_time"></span></h4>
</div>
<div class="modal-body">
<input type="text" id="waiting_time" name="waiting_time" value="" class="timepicker form-control" placeholder="Expected Waiting Time">
<span id="waiting_timeErr" style="color:red;"></span>
<div class="row text-center m-t-20">
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3"></div>
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
<button type="button" class="btn btn-lg btn-link bg-info timer_type" data-value="after">After</button>
</div>
</div>
<div class="row text-center m-t-20">
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
<button type="button" class="btn btn-lg btn-link bg-info time_interval" data-value="15">15 Mins.</button>
</div>
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
<button type="button" class="btn btn-lg btn-link bg-info time_interval" data-value="30">30 Mins.</button>
</div>
</div>
<div class="row text-center m-t-20">
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
<button type="button" class="btn btn-lg btn-link bg-info time_interval" data-value="45">45 Mins.</button>
</div>
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
<button type="button" class="btn btn-lg btn-link bg-info time_interval" data-value="60">60 Mins.</button>
</div>
</div>
<div class="row text-center m-t-20">
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
<button type="button" class="btn btn-lg btn-link bg-info time_interval" data-value="75">75 Mins.</button>
</div>
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
<button type="button" class="btn btn-lg btn-link bg-info time_interval" data-value="90">90 Mins.</button>
</div>
</div>
</div>
<div class="modal-footer ">
<div class="row p-r-20">
<div class="col-md-5">
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-red waves-effect " id="save" active="true">SAVE</button>
</div>
<div class="col-md-5">
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-red waves-effect" data-dismiss="modal">CLOSE</button>
</div>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(function(){
$("#discount").hide();
$(".expected_time").hide();
$('.first-1').click();
});
<div class="modal fade" id="rejected_reasonModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-md" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="rejected_reasonLabel">Reason</h4>
</div>
<div class="modal-body">
<div class="form-group">
<textarea id="reject_reason" name="reject_reason" class="form-control" rows="3" cols="30"></textarea>
<span id="reject_reasonErr" style="color:red"></span>
</div>
</div>
<div class="modal-footer ">
<div class="row p-r-20">
<div class="col-md-5">
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-blue waves-effect send_status">SEND</button>
</div>
<div class="col-md-5">
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-red waves-effect" data-dismiss="modal">CLOSE</button>
</div>
</div>
</div>
</div>
</div>
</div>
</script>
<div class="modal fade" id="AccessCodeModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-sm" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="AccessCodeModalLabel">Enter Access Code</h4>
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#111;">&times;</button>
</div>
<div class="modal-body" style="padding: 0px 25px 15px 25px !important">
<input type="text" id="access_code" class="access_code form-control col-md-12 ">
<div class="row bottom p-l-15 p-r-15 m-t-10">
<div class="col-md-3 access_number border-top border-left" data-value="1" data-type="num">1</div>
<div class="col-md-3 access_number border-top border-left" data-value="2" data-type="num">2</div>
<div class="col-md-3 access_number border-top border-left" data-value="3" data-type="num">3</div>
<div class="col-md-3 access_number border-top border-left" data-value="4" data-type="num">4</div>
</div>
<div class="row bottom p-l-15 p-r-15">
<div class="col-md-3 access_number border-top border-left" data-value="5" data-type="num">5</div>
<div class="col-md-3 access_number border-top border-left" data-value="6" data-type="num">6</div>
<div class="col-md-3 access_number border-top border-left" data-value="7" data-type="num">7</div>
<div class="col-md-3 access_number border-top border-left" data-value="8" data-type="num">8</div>
</div>
<div class="row bottom p-l-15 p-r-15">
<div class="col-md-3 access_number border-top border-left" data-value="9" data-type="num">9</div>
<div class="col-md-3 access_number border-top border-left" data-value="0" data-type="num">0</div>
<div class="col-md-3 access_number border-top border-left orange" data-type="clr">Clr</div>
<div class="col-md-3 access_number ok border-top border-left blue" data-type="ok" data-action="void">OK</div>
</div>
</div>
</div>
</div>
</div>
<!-- <div class="modal fade text-center" id="<%= @shop.shop_code ? @shop.shop_code : '' %>_doemal_new_order" tabindex="-1" role="dialog">
<div class="modal-dialog modal-md" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title text-center" id="doemal_new_orderLabel">New Order</h4><hr>
</div>
<div class="modal-body doemal_new_orderBody">
<div class="form-group text-center">
You have new order <b><span id="new_order"></span></b> requested for <b><span id="new_order_date"></span></b>
</div>
</div>
<div class="modal-footer ">
<div class="row p-r-20">
<div class="col-md-5">
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-blue waves-effect new_order_close" data-value="<%= @shop.shop_code ? @shop.shop_code : '' %>" data-dismiss="modal">CLOSE</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade text-center" id="notify_new_order" tabindex="-1" role="dialog">
<div class="modal-dialog modal-md" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title text-center" id="notify_new_orderLabel">You have new orders</h4><hr>
</div>
<div class="modal-body notify_new_orderBody">
<div class="form-group text-center">
Are you accept or reject for these orders <b><span id="notify_new_order_lists"></span></b>?
</div>
</div>
<div class="modal-footer ">
<div class="row p-r-20">
<div class="col-md-5">
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade text-center" id="notify_order_send_to_kitchen" tabindex="-1" role="dialog">
<div class="modal-dialog modal-md" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title text-center" id="notify_order_send_to_kitchenLabel">You have to send order to kitchen</h4><hr>
</div>
<div class="modal-body notify_order_send_to_kitchenBody">
<div class="form-group text-center">
Could you send these orders <b><span id="notify_order_send_to_kitchen_lists"></span></b> to kitchen?
</div>
</div>
<div class="modal-footer ">
<div class="row p-r-20">
<div class="col-md-5">
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade text-center" id="notify_order_ready_to_delivery" tabindex="-1" role="dialog">
<div class="modal-dialog modal-md" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title text-center" id="notify_order_ready_to_deliveryLabel">You have orders that are ready to deliver</h4><hr>
</div>
<div class="modal-body notify_order_ready_to_deliveryBody">
<div class="form-group text-center">
Could you ready these orders <b><span id="notify_order_ready_to_delivery_lists"></span></b> to deliver?
</div>
</div>
<div class="modal-footer ">
<div class="row p-r-20">
<div class="col-md-5">
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div> -->

View File

@@ -350,16 +350,30 @@
<i class="material-icons">reply</i>
Back
</button>
<!-- -->
<% if current_login_employee.role == "cashier" %>
<a class="btn btn-block bg-deep-purple waves-effect access_modal" data-toggle="modal" data-type="foc"> FOC</a>
<a class="btn btn-block bg-red waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
<a class="btn btn-block bg-deep-purple waves-effect access_modal" data-toggle="modal" data-type="waste"> Waste</a>
<a class="btn btn-block bg-deep-purple waves-effect access_modal" data-toggle="modal" data-type="spoile"> Spoile</a>
<% else %>
<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" class="btn bg-red btn-block" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void </button>
<button type="button" class="btn btn-block bg-deep-purple waves-effect " data-status="waste" value="waste" id="btn_waste" onclick="waste_and_spoilage('waste')">Waste</button>
<button type="button" class="btn btn-block bg-deep-purple waves-effect " data-status="spoile" value="spoile" id="btn_spoile" onclick="waste_and_spoilage('spoile')">Spoile</button>
<% if @cashier_type=="quick_service" %>
<button type="button" class="btn btn-block bg-deep-purple waves-effect " data-status="spoile" value="spoile" id="btn_spoile" onclick="waste_and_spoilage('spoile')">Spoile</button>
<% end %>
<% if @cashier_type=="quick_service" %>
<hr>
<button type="button" id="survey" class="btn btn-block bg-blue waves-effect"><%= t("views.right_panel.detail.survey") %></button>
<button type="button" id="customer" class="btn btn-block bg-blue waves-effect" >Customer</button>
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
<% if current_login_employee.role == "cashier" %>
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="edit">Edit</a>
<% else %>
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
<% end %>
<button type="button" id="discount" class="btn btn-block bg-blue waves-effect" <%= (can? :index, :discount)? ' ': 'disabled=' %> active="true">Discount</button>
<button type="button" id="other-charges" class="btn btn-block bg-blue waves-effect">Charges</button>
<!-- Waiter Buttons -->
@@ -415,16 +429,16 @@
</div>
<!-- pdf light box -->
<div class="modal fade" id="pdfModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-md" role="document">
<div class="modal fade" id="pdfModal" tabindex="-1" role="dialog" >
<div class="modal-dialog modal-md " role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">
<h6 class="modal-title">
<span id="pdfModalLabel"></span>
<span id="changed_amount" class="p-l-120"></span>
</h4>
</h6>
</div>
<div class="modal-body">
<div class="modal-body" style="height: 400px;">
<input type="hidden" name="sale_receipt_no" id="sale_receipt_no">
<input type="hidden" name="filename" id="filename">
<input type="hidden" name="printer_name" id="printer_name">
@@ -487,7 +501,40 @@
<div class="modal-footer"></div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="AccessCodeModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-sm" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="AccessCodeModalLabel">Enter Access Code</h4>
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#111;">&times;</button>
</div>
<div class="modal-body" style="padding: 0px 25px 15px 25px !important">
<input type="text" id="access_code" class="access_code form-control col-md-12 ">
<div class="row bottom p-l-15 p-r-15 m-t-10">
<div class="col-md-3 access_number border-top border-left" data-value="1" data-type="num">1</div>
<div class="col-md-3 access_number border-top border-left" data-value="2" data-type="num">2</div>
<div class="col-md-3 access_number border-top border-left" data-value="3" data-type="num">3</div>
<div class="col-md-3 access_number border-top border-left" data-value="4" data-type="num">4</div>
</div>
<div class="row bottom p-l-15 p-r-15">
<div class="col-md-3 access_number border-top border-left" data-value="5" data-type="num">5</div>
<div class="col-md-3 access_number border-top border-left" data-value="6" data-type="num">6</div>
<div class="col-md-3 access_number border-top border-left" data-value="7" data-type="num">7</div>
<div class="col-md-3 access_number border-top border-left" data-value="8" data-type="num">8</div>
</div>
<div class="row bottom p-l-15 p-r-15">
<div class="col-md-3 access_number border-top border-left" data-value="9" data-type="num">9</div>
<div class="col-md-3 access_number border-top border-left" data-value="0" data-type="num">0</div>
<div class="col-md-3 access_number border-top border-left orange" data-type="clr">Clr</div>
<div class="col-md-3 access_number ok border-top border-left blue" data-type="ok" data-action="">OK</div>
</div>
</div>
</div>
</div>
</div>
<div id="sxModal">
<div id="sxModal-Content">
@@ -634,8 +681,8 @@ var customer_name = "<%= @customer.name %>";
calculate_member_discount(sale_id);
}
$("#pdfModal").modal({show : true, backdrop : false, keyboard : false});
$("#pdfModal").on('shown.bs.modal', function () {
$('#pdfModal').focus() }).modal({show : true, backdrop : false, keyboard : false});
$.ajax({type: "POST",
url: "<%= origami_payment_cash_path %>",
data: "cash="+ cash + "&sale_id=" + sale_id + "&type=" + cashier_type,
@@ -730,44 +777,7 @@ var customer_name = "<%= @customer.name %>";
// swal("Opps","You are not authorized for void","warning")
// }
// });
$('#void').on('click', function () {
if ($(this).attr('active')=== "true") {
swal({
title: "Alert",
text: "Are you sure want to Void?",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, void it!",
closeOnConfirm: false
}, function (isConfirm) {
if (isConfirm) {
var sale_id = $('#sale_id').text();
var remark = $("#remark").val();
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 (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{
window.location.href = '/origami/quick_service';
}
}
})
}
});
}else{
swal("Oops","You are not authorized for void","warning")
}
});
});
// bind survey to order or sale
@@ -940,59 +950,6 @@ var customer_name = "<%= @customer.name %>";
$('#balance').text(parseFloat(result));
<% end %>
}
$('#foc').click(function() {
//$( "#loading_wrapper" ).show();
// payment
var remark = $("#foc_remark").val();
var cash = $('#grand_total').text();
var sub_total = $('#sub-total').text();
var sale_id = $('#sale_id').text();
var params = { 'cash':cash,'sale_id':sale_id,'sub_total':sub_total,'remark':remark,'type':cashier_type };
if ($(this).attr('active')=== "true") {
swal({
title: "Alert",
text: "Are you sure want to FOC This Receipt?",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, FOC it!",
closeOnConfirm: false
}, function (isConfirm) {
if (isConfirm) {
$.ajax({
type: "POST",
url: "/origami/payment/"+cashier_type+"/foc",
data: params,
success:function(result){
customer_display_view(null,"reload");
if (cash >= 0) {
swal({
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{
window.location.href = '/origami/quick_service';
}
});
}
}
});
}
});
}else{
swal("Oops","You are not authorized for foc","warning")
}
});
function customer_display_view(data,status) {
$.ajax({
type: "POST",
@@ -1220,28 +1177,157 @@ var customer_name = "<%= @customer.name %>";
update_sale("", customer_id, customer_name, sale_id);
});
function waste_and_spoilage(remark) {
$(document).on('click', '.access_modal', function(event){
type = $(this).data("type");
$(".ok").attr("data-action",type)
$('#AccessCodeModal').modal('show');
});
function check_emp_access_code(access_code,type) {
var url = "/origami/check_emp_access_code/" + access_code ;
$.ajax({
type: 'POST',
url: url,
data: {},
success: function (result) {
console.log(result)
if (result.status == true) {
createAccessCode(code);
if (type == "edit") {
var dining_id = $('#dining').text();
var sale_id = $('#sale_id').text();
if (dining_id) {
window.location.href = '/origami/table/' + dining_id + "/sale/" + sale_id + "/"+cashier_type+"/edit";
}else{
window.location.href = "/origami/table/sale/" + sale_id + "/"+cashier_type+"/edit";
}
}else if(type == "void"){
$('#AccessCodeModal').modal('hide');
$('#voidModal').modal('show');
// overall_void();
}else if(type == "waste") {
// $('#AccessCodeModal').modal('hide');
// $('#focModal').modal('show');
waste_and_spoilage("waste")
}else if(type == "spoile") {
// $('#AccessCodeModal').modal('hide');
// $('#voidModal').modal('show');
waste_and_spoilage("spoile")
}else if(type == "foc"){
$('#AccessCodeModal').modal('hide');
$('#focModal').modal('show');
// overall_foc();
}
}else{
swal("Opps",result.message,"warning")
}
}
});
}
$('#foc').on('click', function () {
var access_code = localStorage.getItem("access_code");
var remark = $("#foc_remark").val();
var cash = $('#grand_total').text();
var sub_total = $('#sub-total').text();
var sale_id = $('#sale_id').text();
var params = { 'cash':cash,'sale_id':sale_id,'sub_total':sub_total,'remark':remark,'type':cashier_type,'access_code':access_code };
swal({
title: "Alert",
text: "Are you sure want to FOC This Receipt?",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, FOC it!",
closeOnConfirm: false
}, function (isConfirm) {
if (isConfirm) {
$.ajax({
type: "POST",
url: "/origami/payment/"+cashier_type+"/foc",
data: params,
success:function(result){
customer_display_view(null,"reload");
if (cash >= 0) {
swal({
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{
window.location.href = '/origami/quick_service';
}
});
}
}
});
}
});
});
$('#void').on('click', function () {
var access_code = localStorage.getItem("access_code");
swal({
title: "Alert",
text: "Are you sure want to Void?",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, void it!",
closeOnConfirm: false
}, function (isConfirm) {
if (isConfirm) {
var sale_id = $('#sale_id').text();
console.log(sale_id)
swal({
title: "Alert",
text: "Are you sure want to " + remark +" ?",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, " +remark+ " it!",
closeOnConfirm: false
}, function (isConfirm) {
if (isConfirm) {
var url = "/origami/sale/" + sale_id +'/'+cashier_type+'/waste_and_spoilage';
$.ajax({
type: 'POST',
url: url,
data: "remark="+ remark + "&sale_id=" + sale_id,
success: function (result) {
console.log(result)
var remark = $("#remark").val();
var ajax_url = "/origami/sale/" + sale_id +'/'+cashier_type+ '/void';
$.ajax({
type: 'POST',
url: ajax_url,
data: "remark="+ remark + "&sale_id=" + sale_id+ "&access_code=" + access_code,
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{
window.location.href = '/origami/quick_service';
}
}
})
}
});
});
function waste_and_spoilage(remark) {
var access_code = localStorage.getItem("access_code");
var sale_id = $('#sale_id').text();
swal({
title: "Alert",
text: "Are you sure want to " + remark +" ?",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, " +remark+ " it!",
closeOnConfirm: false
}, function (isConfirm) {
if (isConfirm) {
var url = "/origami/sale/" + sale_id +'/'+cashier_type+'/waste_and_spoilage';
$.ajax({
type: 'POST',
url: url,
data: "remark="+ remark + "&sale_id=" + sale_id+ "&access_code=" + access_code,
success: function (result) {
console.log(result)
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
if (cashier_type=="cashier") {
@@ -1251,8 +1337,8 @@ var customer_name = "<%= @customer.name %>";
customer_display_view(null,"reload");
}
}
});
}
});
}
</script>
});
}
});
}
</script>

View File

@@ -0,0 +1,207 @@
<div class="container-fluid">
<div class="row">
<!-- Column One -->
<div class="col-lg-5 col-md-5 col-sm-5">
<ul class="nav nav-tabs tab-col-teal" role="tablist">
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#completed" role="tab"><%= t :competed %></a>
</li>
<li class="nav-item">
<a class="nav-link " data-toggle="tab" href="#pending_order" role="tab">Pending</a>
</li>
</ul>
<div id="custom-slimscroll">
<div class="tab-content m-t-15">
<div class="tab-pane active" id="completed" role="tabpanel">
<div class="card-columns">
<% @completed.each do |sale| %>
<div class="card completed bg-red text-white" data-id = "<%= sale.sale_id %>">
<div class="card-block">
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;">Billed</span>
</div>
</div>
<% end %>
</div>
</div>
<div class="tab-pane " id="pending_order" role="tabpanel">
<div class="card-columns">
<% @sales.each do |sale| %>
<div class="card sales bg-red text-white" data-id = "<%= sale.sale_id %>">
<div class="card-block">
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;">Billed</span>
</div>
</div>
<% end %>
<% @orders.each do |order| %>
<div class="card sales blue text-white" data-id = "<%= order.booking_id %>">
<div class="card-block">
<%= order.booking_id %><span style="font-size:12px;float:right;line-height:inherit;">new</span>
</div>
</div>
<% end %>
</div>
</div>
</div>
</div>
</div>
<!-- Column One -->
<!-- Column Two -->
<div class="col-lg-5 col-md-5 col-sm-5">
<div class="card" >
<div class="card-header">
<div><strong id="order-title">INVOICE DETAILS </strong>| Table <%= @dining.name rescue "" %></div>
</div>
<div class="card-block">
<div class="card-title row p-l-5 p-r-5">
<% if @status == 'sale' %>
<div class="col-lg-6 col-md-6 col-sm-6">
&nbsp; Receipt No: <span id="receipt_no">
<%= @sale.receipt_no rescue '' %></span>
</div>
<% else%>
<input type="hidden" id="save_order_id" value="<%=@bookings.booking_orders[0].order_id%>">
<div class="col-lg-8 col-md-8 col-sm-8">
&nbsp; Order No: <span id="receipt_no">
<%= @bookings.booking_orders[0].order_id rescue '' %></span>
</div>
<% end%>
<% if @status == 'sale' %>
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
Date: <span id="receipt_date"><%= @sale.created_at.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%> &nbsp; </span>
</div>
<% else%>
<div class="col-lg-4 col-md-4 col-sm-4 text-right">
Date: <span id="receipt_date"><%= @order.created_at.strftime("%I:%M %p") rescue '-'%> &nbsp; </span>
</div>
<% end%>
</div>
<div class="card-title row customer_detail p-l-5 p-r-5">
<div class="col-lg-6 col-md-6 col-sm-6">
<% if @status == 'sale' %>
&nbsp; Customer : <%= @sale.customer.name rescue "-" %>
<% else%>
&nbsp; Customer : <%= @order.customer.name rescue "-" %>
<% end%>
</div>
</div>
<div id="order-detail-slimscroll" data-height="160">
<div class="card-text" style="">
<table class="table table-striped" id="order-items-table">
<thead>
<tr>
<th class="item-name">Items</th>
<th class="item-attr">QTY</th>
<th class="item-attr">Price</th>
</tr>
</thead>
<tbody>
<% if @status == 'sale' %>
<% sub_total = 0
@sale.sale_items.each do |sale_item|
sub_total = sub_total + sale_item.price %>
<input type="hidden" id="sale_id" value="<%= @sale.sale_id %>">
<tr>
<td class='item-name'><%= sale_item.product_name %></td>
<td class='item-attr'><%= sale_item.qty %></td>
<td class='item-attr'><%= sale_item.price %></td>
</tr>
<% end%>
<% else%>
<% sub_total = 0
total = 0
@order_items.each do |order_item|
total = order_item.qty * order_item.price
sub_total = sub_total + total %>
<input type="hidden" id="sale_id" value="<%= @bookings.booking_id %>">
<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'><%= total %></td>
</tr>
<% end%>
<% end%>
</tbody>
</table>
</div>
</div>
<div class="card-footer">
<table class="table" id="order-charges-table" border="0">
<% if @status == 'sale' %>
<tr>
<%if @sale.discount_type == 'member_discount'%>
<td class="charges-name"><strong>Member Discount:</strong></td>
<%else%>
<td class="charges-name"><strong>Discount:</strong></td>
<%end%>
<td class="item-attr"><strong id="order-discount">(<%= @sale.total_discount rescue 0%>)</strong></td>
</tr>
<tr>
<td class="charges-name"><strong>Tax:</strong></td>
<td class="item-attr"><strong id="order-Tax"><%= @sale.total_tax rescue 0%></strong></td>
</tr>
<tr>
<td class="charges-name"><strong>Rounding Adj:</strong></td>
<td class="item-attr"><strong id="order-round-adj"><%= @sale.rounding_adjustment rescue 0%></strong></td>
</tr>
<tr>
<td class="charges-name"><strong>Grand Total:</strong></td>
<td class="item-attr"><strong id="order-grand-total"><%= @sale.grand_total rescue 0%></strong></td>
</tr>
<tr class="rebate_amount"></tr>
<% else%>
<tr>
<td class="charges-name"><strong>Sub Total:</strong></td>
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
</tr>
<% end%>
</table>
</div>
</div>
</div>
</div>
<!-- Column Three -->
<div class="col-lg-2 col-md-2 col-sm-2">
<button type="button" class="btn btn-default btn-block" id='back'><i class="material-icons">reply</i>Back</button>
<button type="button" id="reprint" class="btn bg-blue btn-block">Reprint</button>
<% if current_user.role != "waiter" %>
<button id="close_cashier" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.close_cashier") %></button>
<% end %>
</div>
</div>
</div>
<script>
var cashier_type = "quick_service";
$(document).ready(function(){
$(".sales").on('click',function(){
var sale_id = $(this).attr("data-id");
window.location.href = '/origami/quick_service/pending_order/' + sale_id;
})
$(".completed").on('click',function(){
var sale_id = $(this).attr("data-id");
window.location.href = '/origami/quick_service/completed_sale/' + sale_id;
})
$('#reprint').on('click', function () {
var sale_id = $('#sale_id').val();
window.location.href = '/origami/'+ sale_id + "/reprint"
});
$('#back').on('click', function () {
window.location.href = '/origami/quick_service/pending_order';
});
$('#close_cashier').on('click',function(e){
e.preventDefault(); // Prevent the href from redirecting directly
var linkURL = '/origami/shift/quick_service/close';
warnBeforeRedirect(linkURL);
});
});
</script>

View File

@@ -2,31 +2,50 @@
<div class="row clearfix">
<!-- Column One -->
<div class="col-lg-10 col-md-10 col-sm-10">
<div class="card">
<div class="card-header">
<strong id="order-title"> PENDING ORDER </strong>
</div>
<div class="card-block">
<!-- Nav tabs -->
<ul class="nav nav-tabs tab-col-teal" role="tablist">
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#completed" role="tab"><%= t :competed %></a>
</li>
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#pending_order" role="tab">Pending</a>
</li>
</ul>
<!-- Nav tabs - End -->
<div id="custom-slimscroll">
<div class="card-columns">
<% @sale.each do |sale| %>
<div class="card sales bg-red text-white" data-id = "<%= sale.sale_id %>">
<div class="card-block">
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;">Billed</span>
</div>
</div>
<% end %>
<% @order.each do |order| %>
<div class="card sales blue text-white" data-id = "<%= order.booking_id %>">
<div class="card-block">
<%= order.booking_id %><span style="font-size:12px;float:right;line-height:inherit;">new</span>
</div>
<div class="tab-content m-t-15">
<div class="tab-pane" id="completed" role="tabpanel">
<div class="card-columns">
<% @completed.each do |sale| %>
<div class="card completed bg-red text-white" data-id = "<%= sale.sale_id %>">
<div class="card-block">
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;">Billed</span>
</div>
</div>
<% end %>
</div>
</div>
<div class="tab-pane active" id="pending_order" role="tabpanel">
<div class="card-columns">
<% @sale.each do |sale| %>
<div class="card sales bg-red text-white" data-id = "<%= sale.sale_id %>">
<div class="card-block">
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;">Billed</span>
</div>
<% end %>
</div>
</div>
<% end %>
<% @order.each do |order| %>
<div class="card sales blue text-white" data-id = "<%= order.booking_id %>">
<div class="card-block">
<%= order.booking_id %><span style="font-size:12px;float:right;line-height:inherit;">new</span>
</div>
</div>
<% end %>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Column Three -->
<div class="col-lg-2 col-md-2 col-sm-2">
@@ -46,6 +65,10 @@
var sale_id = $(this).attr("data-id");
window.location.href = '/origami/quick_service/pending_order/' + sale_id;
})
$(".completed").on('click',function(){
var sale_id = $(this).attr("data-id");
window.location.href = '/origami/quick_service/completed_sale/' + sale_id;
})
$('#pay').on('click', function () {
var sale_id = $('#sale_id').val();
window.location.href = '/origami/sale/' + sale_id + "/quick_service/payment";

View File

@@ -1,154 +1,171 @@
<div class="container-fluid">
<div class="row">
<!-- Column One -->
<div class="col-lg-5 col-md-5 col-sm-5">
<div class="card">
<div class="card-header">
<strong id="order-title"> PENDING ORDER </strong>
</div>
<div class="card-block">
<div id="custom-slimscroll">
<div class="card-columns">
<% @sales.each do |sale| %>
<div class="card sales bg-red text-white" data-id = "<%= sale.sale_id %>">
<div class="card-block">
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;">Billed</span>
</div>
<div class="row">
<!-- Column One -->
<div class="col-lg-5 col-md-5 col-sm-5">
<ul class="nav nav-tabs tab-col-teal" role="tablist">
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#completed" role="tab"><%= t :competed %></a>
</li>
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#pending_order" role="tab">Pending</a>
</li>
</ul>
<div id="custom-slimscroll">
<div class="tab-content m-t-15">
<div class="tab-pane" id="completed" role="tabpanel">
<div class="card-columns">
<% @completed.each do |sale| %>
<div class="card completed bg-red text-white" data-id = "<%= sale.sale_id %>">
<div class="card-block">
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;">Billed</span>
</div>
</div>
<% end %>
</div>
<% end %>
<% @orders.each do |order| %>
<div class="card sales blue text-white" data-id = "<%= order.booking_id %>">
<div class="card-block">
<%= order.booking_id %><span style="font-size:12px;float:right;line-height:inherit;">new</span>
</div>
</div>
<div class="tab-pane active" id="pending_order" role="tabpanel">
<div class="card-columns">
<% @sales.each do |sale| %>
<div class="card sales bg-red text-white" data-id = "<%= sale.sale_id %>">
<div class="card-block">
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;">Billed</span>
</div>
</div>
<% end %>
<% @orders.each do |order| %>
<div class="card sales blue text-white" data-id = "<%= order.booking_id %>">
<div class="card-block">
<%= order.booking_id %><span style="font-size:12px;float:right;line-height:inherit;">new</span>
</div>
</div>
<% end %>
</div>
<% end %>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Column One -->
<!-- Column One -->
<!-- Column Two -->
<div class="col-lg-5 col-md-5 col-sm-5">
<div class="card" >
<div class="card-header">
<div><strong id="order-title">INVOICE DETAILS </strong>| Table <%= @dining.name rescue "" %></div>
</div>
<div class="card-block">
<div class="card-title row p-l-5 p-r-5">
<% if @status == 'sale' %>
<div class="col-lg-6 col-md-6 col-sm-6">
&nbsp; Receipt No: <span id="receipt_no">
<%= @sale.receipt_no rescue '' %></span>
</div>
<% else%>
<input type="hidden" id="save_order_id" value="<%=@bookings.booking_orders[0].order_id%>">
<div class="col-lg-8 col-md-8 col-sm-8">
&nbsp; Order No: <span id="receipt_no">
<%= @bookings.booking_orders[0].order_id rescue '' %></span>
</div>
<% end%>
<% if @status == 'sale' %>
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
Date: <span id="receipt_date"><%= @sale.created_at.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%> &nbsp; </span>
</div>
<% else%>
<div class="col-lg-4 col-md-4 col-sm-4 text-right">
Date: <span id="receipt_date"><%= @order.created_at.strftime("%I:%M %p") rescue '-'%> &nbsp; </span>
</div>
<% end%>
<!-- Column Two -->
<div class="col-lg-5 col-md-5 col-sm-5">
<div class="card" >
<div class="card-header">
<div><strong id="order-title">INVOICE DETAILS </strong>| Table <%= @dining.name rescue "" %></div>
</div>
<div class="card-title row customer_detail p-l-5 p-r-5">
<div class="col-lg-6 col-md-6 col-sm-6">
<% if @status == 'sale' %>
&nbsp; Customer : <%= @sale.customer.name rescue "-" %>
<% else%>
&nbsp; Customer : <%= @order.customer.name rescue "-" %>
<% end%>
</div>
</div>
<div id="order-detail-slimscroll" data-height="160">
<div class="card-text" style="">
<table class="table table-striped" id="order-items-table">
<thead>
<tr>
<th class="item-name">Items</th>
<th class="item-attr">QTY</th>
<th class="item-attr">Price</th>
</tr>
</thead>
<tbody>
<% if @status == 'sale' %>
<% sub_total = 0
@sale.sale_items.each do |sale_item|
sub_total = sub_total + sale_item.price %>
<input type="hidden" id="sale_id" value="<%= @sale.sale_id %>">
<tr>
<td class='item-name'><%= sale_item.product_name %></td>
<td class='item-attr'><%= sale_item.qty %></td>
<td class='item-attr'><%= sale_item.price %></td>
</tr>
<% end%>
<% else%>
<% sub_total = 0
total = 0
@order_items.each do |order_item|
total = order_item.qty * order_item.price
sub_total = sub_total + total %>
<input type="hidden" id="sale_id" value="<%= @bookings.booking_id %>">
<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'><%= total %></td>
</tr>
<% end%>
<% end%>
</tbody>
</table>
</div>
</div>
<div class="card-footer">
<table class="table" id="order-charges-table" border="0">
<div class="card-block">
<div class="card-title row p-l-5 p-r-5">
<% if @status == 'sale' %>
<div class="col-lg-6 col-md-6 col-sm-6">
&nbsp; Receipt No: <span id="receipt_no">
<%= @sale.receipt_no rescue '' %></span>
</div>
<% else%>
<input type="hidden" id="save_order_id" value="<%=@bookings.booking_orders[0].order_id%>">
<div class="col-lg-8 col-md-8 col-sm-8">
&nbsp; Order No: <span id="receipt_no">
<%= @bookings.booking_orders[0].order_id rescue '' %></span>
</div>
<% end%>
<% if @status == 'sale' %>
<tr>
<%if @sale.discount_type == 'member_discount'%>
<td class="charges-name"><strong>Member Discount:</strong></td>
<%else%>
<td class="charges-name"><strong>Discount:</strong></td>
<%end%>
<td class="item-attr"><strong id="order-discount">(<%= @sale.total_discount rescue 0%>)</strong></td>
</tr>
<tr>
<td class="charges-name"><strong>Tax:</strong></td>
<td class="item-attr"><strong id="order-Tax"><%= @sale.total_tax rescue 0%></strong></td>
</tr>
<tr>
<td class="charges-name"><strong>Rounding Adj:</strong></td>
<td class="item-attr"><strong id="order-round-adj"><%= @sale.rounding_adjustment rescue 0%></strong></td>
</tr>
<tr>
<td class="charges-name"><strong>Grand Total:</strong></td>
<td class="item-attr"><strong id="order-grand-total"><%= @sale.grand_total rescue 0%></strong></td>
</tr>
<tr class="rebate_amount"></tr>
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
Date: <span id="receipt_date"><%= @sale.created_at.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%> &nbsp; </span>
</div>
<% else%>
<tr>
<td class="charges-name"><strong>Sub Total:</strong></td>
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
</tr>
<div class="col-lg-4 col-md-4 col-sm-4 text-right">
Date: <span id="receipt_date"><%= @order.created_at.strftime("%I:%M %p") rescue '-'%> &nbsp; </span>
</div>
<% end%>
</table>
</div>
<div class="card-title row customer_detail p-l-5 p-r-5">
<div class="col-lg-6 col-md-6 col-sm-6">
<% if @status == 'sale' %>
&nbsp; Customer : <%= @sale.customer.name rescue "-" %>
<% else%>
&nbsp; Customer : <%= @order.customer.name rescue "-" %>
<% end%>
</div>
</div>
<div id="order-detail-slimscroll" data-height="160">
<div class="card-text" style="">
<table class="table table-striped" id="order-items-table">
<thead>
<tr>
<th class="item-name">Items</th>
<th class="item-attr">QTY</th>
<th class="item-attr">Price</th>
</tr>
</thead>
<tbody>
<% if @status == 'sale' %>
<% sub_total = 0
@sale.sale_items.each do |sale_item|
sub_total = sub_total + sale_item.price %>
<input type="hidden" id="sale_id" value="<%= @sale.sale_id %>">
<tr>
<td class='item-name'><%= sale_item.product_name %></td>
<td class='item-attr'><%= sale_item.qty %></td>
<td class='item-attr'><%= sale_item.price %></td>
</tr>
<% end%>
<% else%>
<% sub_total = 0
total = 0
@order_items.each do |order_item|
total = order_item.qty * order_item.price
sub_total = sub_total + total %>
<input type="hidden" id="sale_id" value="<%= @bookings.booking_id %>">
<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'><%= total %></td>
</tr>
<% end%>
<% end%>
</tbody>
</table>
</div>
</div>
<div class="card-footer">
<table class="table" id="order-charges-table" border="0">
<% if @status == 'sale' %>
<tr>
<%if @sale.discount_type == 'member_discount'%>
<td class="charges-name"><strong>Member Discount:</strong></td>
<%else%>
<td class="charges-name"><strong>Discount:</strong></td>
<%end%>
<td class="item-attr"><strong id="order-discount">(<%= @sale.total_discount rescue 0%>)</strong></td>
</tr>
<tr>
<td class="charges-name"><strong>Tax:</strong></td>
<td class="item-attr"><strong id="order-Tax"><%= @sale.total_tax rescue 0%></strong></td>
</tr>
<tr>
<td class="charges-name"><strong>Rounding Adj:</strong></td>
<td class="item-attr"><strong id="order-round-adj"><%= @sale.rounding_adjustment rescue 0%></strong></td>
</tr>
<tr>
<td class="charges-name"><strong>Grand Total:</strong></td>
<td class="item-attr"><strong id="order-grand-total"><%= @sale.grand_total rescue 0%></strong></td>
</tr>
<tr class="rebate_amount"></tr>
<% else%>
<tr>
<td class="charges-name"><strong>Sub Total:</strong></td>
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
</tr>
<% end%>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Column Three -->
<div class="col-lg-2 col-md-2 col-sm-2">
<button type="button" class="btn btn-default btn-block" id='back'><i class="material-icons">reply</i>Back</button>
@@ -182,6 +199,10 @@ $(document).ready(function(){
var sale_id = $(this).attr("data-id");
window.location.href = '/origami/quick_service/pending_order/' + sale_id;
})
$(".completed").on('click',function(){
var sale_id = $(this).attr("data-id");
window.location.href = '/origami/quick_service/completed_sale/' + sale_id;
})
$('#pay').on('click', function () {
var sale_id = $('#sale_id').val();
window.location.href = '/origami/sale/' + sale_id + "/quick_service/payment";

View File

@@ -30,7 +30,7 @@
<% @complete.each do |sale| %>
<div class="card sales red text-white" data-id = "<%= sale.sale_id %>">
<div class="card-block">
<%= sale.receipt_no %><span class="pull-right font-12"><%= sale.sale_status %></span>
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;"><%= sale.sale_status %></span>
</div>
</div>
<% end %>
@@ -135,7 +135,7 @@
<div class="tab-pane dining" id="orders" role="tabpanel">
<div class="card-columns">
<% @orders.each do |order| %>
<div class="card orders red text-white" data-id = "<%= order.order_id %>">
<div class="card orders <%=(order.status=="new") ? 'blue' : 'red'%> text-white" data-id="<%= order.order_id %>">
<div class="card-block">
<%
order_status = ""
@@ -452,8 +452,13 @@
<% if current_login_employee.role != "waiter" %>
<button type="button" id="commissions" class="btn btn-block bg-blue waves-effect">Commissions</button>
<button type="button" id="in_duties" class="btn btn-block bg-blue waves-effect">In Duties</button>
<% if current_login_employee.role == "cashier" %>
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="edit">Edit</a>
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
<% else %>
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
<button type="button" id="void" class="btn btn-block bg-blue waves-effect" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> active="true"> Void</button>
<button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void</button>
<% end %>
<!-- <button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#waste_spoileModal" > Waste & Spoile</button> -->
<% end %>
<button type="button" id="discount" class="btn btn-block bg-blue waves-effect" <%= (can? :index, :discount)? ' ': 'disabled=' %> active="true">Discount</button>
@@ -514,6 +519,29 @@
</div>
</div>
<div class="modal fade" id="voidModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="voidModalLabel">Please Enter Reason for Void</h4>
</div>
<div class="modal-body">
<input type="textarea" name="remark" class="form-control col-md-12 remark" id="remark">
</div>
<div class="modal-footer ">
<div class="row p-r-20">
<div class="col-md-5">
<button type="button" class="btn btn-link bg-red waves-effect " id="void" active="true">VOID</button>
</div>
<div class="col-md-5">
<button type="button" class="btn btn-link bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="waste_spoileModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
@@ -539,6 +567,39 @@
</div>
</div>
<div class="modal fade" id="AccessCodeModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-sm" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="AccessCodeModalLabel">Enter Access Code</h4>
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#111;">&times;</button>
</div>
<div class="modal-body" style="padding: 0px 25px 15px 25px !important">
<input type="text" id="access_code" class="access_code form-control col-md-12 ">
<div class="row bottom p-l-15 p-r-15 m-t-10">
<div class="col-md-3 access_number border-top border-left" data-value="1" data-type="num">1</div>
<div class="col-md-3 access_number border-top border-left" data-value="2" data-type="num">2</div>
<div class="col-md-3 access_number border-top border-left" data-value="3" data-type="num">3</div>
<div class="col-md-3 access_number border-top border-left" data-value="4" data-type="num">4</div>
</div>
<div class="row bottom p-l-15 p-r-15">
<div class="col-md-3 access_number border-top border-left" data-value="5" data-type="num">5</div>
<div class="col-md-3 access_number border-top border-left" data-value="6" data-type="num">6</div>
<div class="col-md-3 access_number border-top border-left" data-value="7" data-type="num">7</div>
<div class="col-md-3 access_number border-top border-left" data-value="8" data-type="num">8</div>
</div>
<div class="row bottom p-l-15 p-r-15">
<div class="col-md-3 access_number border-top border-left" data-value="9" data-type="num">9</div>
<div class="col-md-3 access_number border-top border-left" data-value="0" data-type="num">0</div>
<div class="col-md-3 access_number border-top border-left orange" data-type="clr">Clr</div>
<div class="col-md-3 access_number ok border-top border-left blue" data-type="ok" data-action="">OK</div>
</div>
</div>
</div>
</div>
</div>
<script>
var cashier_type = "cashier";
$(document).ready(function(){
@@ -938,25 +999,61 @@ $('#add_invoice').on('click',function(){
$('#edit').on('click',function(){
var dining_id = "<%= @room.id %>"
var sale_id = "<%= @obj_sale.sale_id rescue "" %>"
window.location.href = '/origami/table/'+ dining_id + "/sale/"+ sale_id + "/edit";
window.location.href = '/origami/table/'+ dining_id + "/sale/"+ sale_id + "/cashier/edit";
});
$('#void').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 + '/cashier/void';
$.ajax({
type: 'POST',
url: ajax_url,
success: function () {
window.location.href = '/origami/';
}
})
} else {
// $('#void').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 + '/cashier/void';
// $.ajax({
// type: 'POST',
// url: ajax_url,
// success: function () {
// window.location.href = '/origami/';
// }
// })
// } else {
// }
// });
$('#void').on('click', function () {
var access_code = localStorage.getItem("access_code");
if ($(this).attr('active')=== "true") {
swal({
title: "Alert",
text: "Are you sure want to Void?",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, void it!",
closeOnConfirm: false
}, function (isConfirm) {
if (isConfirm) {
var sale_id = $('#sale_id').val();
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+ "&access_code=" + access_code,
success: function (result) {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
window.location.href = '/origami/';
}
});
}
});
}else{
swal("Opps","You are not authorized for void","warning")
}
});
});
$('#commissions').on('click', function () {
var dining_id = "<%= @room.id %>"
@@ -1042,4 +1139,40 @@ $('#add_invoice').on('click',function(){
}
});
}
$(document).on('click', '.access_modal', function(event){
type = $(this).data("type");
$(".ok").attr("data-action",type)
$('#AccessCodeModal').modal('show');
});
function check_emp_access_code(access_code,type) {
var url = "/origami/check_emp_access_code/" + access_code ;
$.ajax({
type: 'POST',
url: url,
data: {},
success: function (result) {
console.log(result);
if (result.status == true) {
createAccessCode(code);
if (type == "edit") {
var dining_id = "<%= @room.id rescue ""%>";
var sale_id = "<%= @obj_sale.sale_id rescue "" %>";
window.location.href = '/origami/table/' + dining_id + "/sale/" + sale_id + "/cashier/edit";
}else if(type == "void"){
$('#AccessCodeModal').modal('hide');
$('#voidModal').modal('show');
// overall_void();
}else if(type == "waste_and_spoilage"){
}
}else{
swal("Opps",result.message,"warning")
}
}
});
}
</script>

View File

@@ -187,6 +187,7 @@
</div>
<script>
var cashier_type = "<%= @cashier_type %>";
var access_code = localStorage.getItem("access_code");
// Bill Request
$(document).ready(function () {
@@ -201,7 +202,6 @@ var cashier_type = "<%= @cashier_type %>";
var sale_item_id = $(this).attr('data-id');
var qty = $('#' + sale_item_id + "_qty").val();
var price = $('#' + sale_item_id + "_price").val();
console.log(qty + "|" + price);
var qty_status = true;
var price_status = true;
if((qty > 0) && (price > 0)){
@@ -240,7 +240,7 @@ var cashier_type = "<%= @cashier_type %>";
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_item_id=' + sale_item_id + "&update_qty=" + qty + "&update_price=" + price,
data: 'sale_item_id=' + sale_item_id + "&update_qty=" + qty + "&update_price=" + price+ "&access_code=" + access_code,
success: function (result) {
swal({
title: "Information!",
@@ -281,6 +281,7 @@ var cashier_type = "<%= @cashier_type %>";
})*/
$('#action').on('click', function () {
var access_code = localStorage.getItem("access_code");
var sale_item_id = $(this).attr('data-id');
var type = $(this).attr('data-type');
var remark = $("#remark").val();
@@ -293,7 +294,7 @@ var cashier_type = "<%= @cashier_type %>";
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_item_id=' + sale_item_id + "&remark=" + remark,
data: 'sale_item_id=' + sale_item_id + "&remark=" + remark+ "&access_code=" + access_code,
success: function (result) {
location.reload();
}
@@ -306,7 +307,7 @@ var cashier_type = "<%= @cashier_type %>";
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_item_id=' + sale_item_id,
data: 'sale_item_id=' + sale_item_id + '&access_code=' + access_code,
success: function (result) {
location.reload();
}

View File

@@ -90,9 +90,24 @@
<div class="tab-pane" id="orders" role="tabpanel" style="">
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
<% @orders.each do |order| %>
<div class="card orders bg-red text-white" data-id = "<%= order.order_id %>">
<div class="card orders <%=(order.status=="new") ? 'blue' : 'red'%> text-white" data-id="<%= order.order_id %>">
<div class="card-block">
<%= order.order_id %>
<%
order_status = ""
sale_order = SaleOrder.find_by_order_id(order)
if sale_order
unless sale_order.sale_id.nil?
sale = Sale.find(sale_order.sale_id)
order_status = sale.sale_status
if order_status == 'new'
order_status = order.status
end
end
else
order_status = order.status
end
%>
<%= order.order_id %> <% if !order_status.empty? %>| <%= order_status %> <% end %>
</div>
</div>
<% end %>
@@ -198,9 +213,13 @@
<!-- Column Three -->
<div class="col-lg-1 col-md-1 col-sm-1">
<button type="button" class="btn btn-default btn-block" id='back'><i class="material-icons">reply</i>Back</button>
<% if @sale.sale_status != 'void' %>
<button type="button" class="btn btn-block bg-red waves-effect" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void</button>
<% end %>
<% if @sale.sale_status != 'void' && @sale.sale_status != 'waste' && @sale.sale_status != 'spoile' %>
<% if current_login_employee.role == "cashier" %>
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
<% else %>
<button type="button" id="void" class="btn bg-danger btn-block">VOID</button>
<% end %>
<% end %>
<button type="button" id="re-print" class="btn bg-blue btn-block">Re.Print</button>
</div>
</div>
@@ -229,6 +248,63 @@
</div>
</div>
</div>
<div class="modal fade" id="AccessCodeModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-sm" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="AccessCodeModalLabel">Enter Access Code</h4>
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#111;">&times;</button>
</div>
<div class="modal-body" style="padding: 0px 25px 15px 25px !important">
<input type="text" id="access_code" class="access_code form-control col-md-12 ">
<div class="row bottom p-l-15 p-r-15 m-t-10">
<div class="col-md-3 access_number border-top border-left" data-value="1" data-type="num">1</div>
<div class="col-md-3 access_number border-top border-left" data-value="2" data-type="num">2</div>
<div class="col-md-3 access_number border-top border-left" data-value="3" data-type="num">3</div>
<div class="col-md-3 access_number border-top border-left" data-value="4" data-type="num">4</div>
</div>
<div class="row bottom p-l-15 p-r-15">
<div class="col-md-3 access_number border-top border-left" data-value="5" data-type="num">5</div>
<div class="col-md-3 access_number border-top border-left" data-value="6" data-type="num">6</div>
<div class="col-md-3 access_number border-top border-left" data-value="7" data-type="num">7</div>
<div class="col-md-3 access_number border-top border-left" data-value="8" data-type="num">8</div>
</div>
<div class="row bottom p-l-15 p-r-15">
<div class="col-md-3 access_number border-top border-left" data-value="9" data-type="num">9</div>
<div class="col-md-3 access_number border-top border-left" data-value="0" data-type="num">0</div>
<div class="col-md-3 access_number border-top border-left orange" data-type="clr">Clr</div>
<div class="col-md-3 access_number ok border-top border-left blue" data-type="ok" data-action="">OK</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="voidModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="voidModalLabel">Please Enter Reason for Void</h4>
</div>
<div class="modal-body">
<input type="textarea" name="remark" class="form-control col-md-12 remark" id="remark">
</div>
<div class="modal-footer ">
<div class="row p-r-20">
<div class="col-md-5">
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-red waves-effect " id="void" active="true">VOID</button>
</div>
<div class="col-md-5">
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function(){
$(".tables").on('click', function(){
@@ -271,7 +347,14 @@ $('#back').on('click',function(){
// // });
// }
// });
$(document).on('click', '.access_modal', function(event){
type = $(this).data("type");
$(".ok").attr("data-action",type)
$('#AccessCodeModal').modal('show');
});
$('#void').on('click', function () {
var access_code = localStorage.getItem("access_code");
swal({
title: "Alert",
text: "Are you sure want to Void?",
@@ -283,10 +366,11 @@ $('#back').on('click',function(){
}, function (isConfirm) {
if (isConfirm) {
var sale_id = $('#sale_id').val();
var ajax_url = "/origami/sale/" + sale_id + '/cashier/void';
var ajax_url = "/origami/sale/" + sale_id +'/'+'cashier'+ '/void';
$.ajax({
type: 'POST',
url: ajax_url,
data: {'access_code':access_code},
success: function () {
window.location.href = '/origami/sale/'+sale_id;
}
@@ -295,10 +379,52 @@ $('#back').on('click',function(){
});
});
function check_emp_access_code(access_code,type) {
var url = "/origami/check_emp_access_code/" + access_code ;
$.ajax({
type: 'POST',
url: url,
data: {},
success: function (result) {
console.log(result)
if (result.status == true) {
createAccessCode(code);
if (type == "edit") {
var dining_id = $('#dining').text();
var sale_id = $('#sale_id').text();
if (dining_id) {
window.location.href = '/origami/table/' + dining_id + "/sale/" + sale_id + "/"+cashier_type+"/edit";
}else{
window.location.href = "/origami/table/sale/" + sale_id + "/"+cashier_type+"/edit";
}
}else if(type == "void"){
$('#AccessCodeModal').modal('hide');
$('#voidModal').modal('show');
// overall_void();
}else if(type == "waste") {
// $('#AccessCodeModal').modal('hide');
// $('#focModal').modal('show');
waste_and_spoilage("waste")
}else if(type == "spoile") {
// $('#AccessCodeModal').modal('hide');
// $('#voidModal').modal('show');
waste_and_spoilage("spoile")
}else if(type == "foc"){
$('#AccessCodeModal').modal('hide');
$('#focModal').modal('show');
// overall_foc();
}
}else{
swal("Opps",result.message,"warning")
}
}
});
}
$('#re-print').click(function() {
var sale_id = $('#sale_id').val();
window.location.href = '/origami/'+ sale_id + "/reprint"
return false;
// return false;
});
</script>

View File

@@ -31,7 +31,7 @@
<div class="col-lg-2 col-md-2 col-sm-2">
<button type="button" class="btn bg-default btn-block" id='back'><i class="material-icons">reply</i> <%= t("views.btn.back") %> </button>
<button type="button" class="btn bg-blue btn-block green" id='close_cashier'> <%= t("views.btn.close_cashier") %> </button>
<% if @bank_integration == '1' %>
<% if @bank_integration == '1' && @cashier_type!="ordering" %>
<button type="button" class="btn bg-blue btn-block green" id="card_settlement"> <%= t("views.btn.card_settle") %> </button>
<% end %>
</div>
@@ -73,10 +73,12 @@
});
$('#back').on('click',function(){
if(cashier_type!='quick_service'){
if(cashier_type=='cashier'){
window.location.href = '/origami';
}else{
}else if(cashier_type=='quick_service'){
window.location.href = '/origami/quick_service';
}else{
window.location.href = '/origami/order_reservation';
}
});

View File

@@ -9,7 +9,7 @@
<div class="row clearfix">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 ">
<div class="form-group p-l-10 p-r-10">
<%= f.input :child, input_html: { value: @survey_data.child, class: 'col-md-10', :onChange => "total_customer();" }%>
</div>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 ">
@@ -67,29 +67,29 @@
<div class="row clearfix">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 ">
<div class="form-group p-l-10 p-r-10">
<%= f.input :child , input_html: { class: 'col-md-10' , :onChange => "total_customer();"}%>
<%= f.input :child , input_html: { class: 'col-md-10' ,min:'1', :onChange => "total_customer();"}%>
</div>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 ">
<div class="form-group p-l-10 p-r-10">
<%= f.input :adult , input_html: { class: 'col-md-10' , :onChange => "total_customer();"}%>
<%= f.input :adult , input_html: { class: 'col-md-10' ,min:'1', :onChange => "total_customer();"}%>
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 ">
<div class="form-group p-l-10 p-r-10">
<%= f.input :male , input_html: { class: 'col-md-10' }%>
<%= f.input :male , input_html: { min:'1',class: 'col-md-10' }%>
</div>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 ">
<div class="form-group p-l-10 p-r-10">
<%= f.input :female , input_html: { class: 'col-md-10' }%>
<%= f.input :female , input_html: { min:'1',class: 'col-md-10' }%>
</div>
</div>
</div>
<%= f.input :total_customer, input_html: { :readonly => true, class: 'col-md-11'} %>
<%= f.input :local , input_html: { class: 'col-md-11' }%>
<%= f.input :total_customer, input_html: { :readonly => true,min:'1', class: 'col-md-11'} %>
<%= f.input :local , input_html: { min:'1',class: 'col-md-11' }%>
<fieldset style="border: 1px solid #BDBDBD;padding: 20px; width: 92%;margin: 20px 0 20px 0;">
<legend style="font-size: 1.2em !important;font-weight: bold !important;text-align: left !important;border:none;width:100px;">Foreigner</legend>

View File

@@ -166,8 +166,14 @@
<%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>
<% if current_login_employee.role == "cashier" %>
<a class="btn btn-block bg-deep-purple waves-effect access_modal" data-toggle="modal" data-type="foc"> FOC</a>
<a class="btn btn-block bg-red waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
<% else %>
<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>
<% end %>
</div>
</div>
</div>
@@ -251,6 +257,39 @@
</div>
</div>
</div>
<div class="modal fade" id="AccessCodeModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-sm" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="AccessCodeModalLabel">Enter Access Code</h4>
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#111;">&times;</button>
</div>
<div class="modal-body" style="padding: 0px 25px 15px 25px !important">
<input type="text" id="access_code" class="access_code form-control col-md-12 ">
<div class="row bottom p-l-15 p-r-15 m-t-10">
<div class="col-md-3 access_number border-top border-left" data-value="1" data-type="num">1</div>
<div class="col-md-3 access_number border-top border-left" data-value="2" data-type="num">2</div>
<div class="col-md-3 access_number border-top border-left" data-value="3" data-type="num">3</div>
<div class="col-md-3 access_number border-top border-left" data-value="4" data-type="num">4</div>
</div>
<div class="row bottom p-l-15 p-r-15">
<div class="col-md-3 access_number border-top border-left" data-value="5" data-type="num">5</div>
<div class="col-md-3 access_number border-top border-left" data-value="6" data-type="num">6</div>
<div class="col-md-3 access_number border-top border-left" data-value="7" data-type="num">7</div>
<div class="col-md-3 access_number border-top border-left" data-value="8" data-type="num">8</div>
</div>
<div class="row bottom p-l-15 p-r-15">
<div class="col-md-3 access_number border-top border-left" data-value="9" data-type="num">9</div>
<div class="col-md-3 access_number border-top border-left" data-value="0" data-type="num">0</div>
<div class="col-md-3 access_number border-top border-left orange" data-type="clr">Clr</div>
<div class="col-md-3 access_number ok border-top border-left blue" data-type="ok" data-action="">OK</div>
</div>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function(){
/* start check first bill or not*/
@@ -369,6 +408,7 @@ $('#back').on('click',function(){
});
$('#void').on('click',function () {
var access_code = localStorage.getItem("access_code");
if ($(this).attr('active')=== "true") {
swal({
title: "Alert",
@@ -386,7 +426,7 @@ $('#void').on('click',function () {
$.ajax({
type: 'POST',
url: ajax_url,
data: "remark="+ remark + "&sale_id=" + sale_id,
data: "remark="+ remark + "&sale_id=" + sale_id + "&access_code=" + access_code ,
success: function () {
window.location.href = '/origami';
}
@@ -399,6 +439,7 @@ $('#void').on('click',function () {
});
$('#foc').click(function() {
var access_code = localStorage.getItem("access_code");
var remark = $("#foc_remark").val();
var cash = $('#grand_total').text();
var sub_total = $('#sub_total').text();
@@ -406,7 +447,7 @@ $('#foc').click(function() {
if($('.receipt_block > div').hasClass('selected-item')){
sale_id = $('.receipt_block > div.selected-item').parent().attr('data-id');
}
var params = { 'cash':cash,'sale_id':sale_id,'sub_total':sub_total,'remark':remark,'type':'cashier' };
var params = { 'cash':cash,'sale_id':sale_id,'sub_total':sub_total,'remark':remark,'type':'cashier','access_code':access_code };
// console.log(sale_id);
if(sale_id != ''){
if ($(this).attr('active')=== "true") {
@@ -430,4 +471,45 @@ $('#foc').click(function() {
}
}
});
$(document).on('click', '.access_modal', function(event){
type = $(this).data("type");
$(".ok").attr("data-action",type)
$('#AccessCodeModal').modal('show');
});
function check_emp_access_code(access_code,type) {
var url = "/origami/check_emp_access_code/" + access_code ;
$.ajax({
type: 'POST',
url: url,
data: {},
success: function (result) {
console.log(result)
if (result.status == true) {
createAccessCode(code);
if (type == "edit") {
}else if(type == "void"){
$('#AccessCodeModal').modal('hide');
$('#voidModal').modal('show');
// overall_void();
}else if(type == "waste") {
// $('#AccessCodeModal').modal('hide');
// $('#focModal').modal('show');
waste_and_spoilage("waste")
}else if(type == "spoile") {
// $('#AccessCodeModal').modal('hide');
// $('#voidModal').modal('show');
waste_and_spoilage("spoile")
}else if(type == "foc"){
$('#AccessCodeModal').modal('hide');
$('#focModal').modal('show');
// overall_foc();
}
}else{
swal("Opps",result.message,"warning")
}
}
});
}
</script>

View File

@@ -202,7 +202,6 @@
var receipt_no = "<%= @receipt_no %>";
$("#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
@@ -250,8 +249,5 @@
swal ( "Oops" , "Enter Amount!" , "error" );
}
}
}else{
$("#reference_no_Err").html("can't be blank");
}
})
</script>

View File

@@ -201,9 +201,8 @@
var receipt_no = "<%= @receipt_no %>";
console.log(amount);
console.log($("#validamount").attr("value"));
$("#reference_no_Err").html("");
if(reference_no.length > 0){
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
$("#reference_no_Err").html("");
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
$(this).off("click");
//start member discount 5% by pay card
// var sub_total = $('#sub-total').text();
@@ -244,14 +243,11 @@
});
}
}else{
if (amount>0) {
swal ( "Oops" , "Paid Amount is over!" , "error" );
}else{
swal ( "Oops" , "Enter Amount!" , "error" );
}
if (amount>0) {
swal ( "Oops" , "Paid Amount is over!" , "error" );
}else{
swal ( "Oops" , "Enter Amount!" , "error" );
}
}else{
$("#reference_no_Err").html("can't be blank");
}
});
</script>

View File

@@ -16,7 +16,7 @@
<% if(@server_mode != 'cloud') %>
<%= f.input :printer_name, :as => :select, :collection => Printer::PrinterWorker.printers, include_blank: false %>
<% else %>
<%= f.input :printer_name %>
<%= f.input :printer_name, :as => :select, :collection => [], include_blank: false %>
<% end %>
<%= f.input :brand_name %>
<%= f.input :printer_type %>

View File

@@ -151,23 +151,23 @@
<% total_tax = 0 %>
<% unless @tax.empty? %>
<% @tax.each do |tax| %>
<% total_tax += tax.tax_amount.to_f %>
<tr style="font-weight:600;">
<td colspan="17" style='text-align:right;'><%= tax.tax_name rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(tax.tax_amount, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td colspan="2">&nbsp;</td>
</tr>
<% @tax.each do |tax| %>
<% total_tax += tax.tax_amount.to_f %>
<tr style="font-weight:600;">
<td colspan="17" style='text-align:right;'><%= tax.tax_name rescue '-'%></td>
<td style='text-align:right;'><%= number_with_precision(tax.tax_amount, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td colspan="2">&nbsp;</td>
</tr>
<% end %>
<% end %>
<% net = total - total_tax %>
<tr style="font-weight:600;">
<td colspan="17" style='text-align:right;'><%= t("views.right_panel.detail.net_amount") %></td>
<td style='text-align:right;'><%= number_with_precision(net, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td colspan="2">&nbsp;</td>
</tr>
<% end %>
</tbody>
</tbody>
<% end %>
</table>
</div>

View File

@@ -18,10 +18,10 @@
<option value="9">Last year</option>
</select>
</div>
<% if defined? payments %>
<% if defined? providers %>
<div class="col-lg-2 col-md-2 col-sm-2">
<label class="font-14"><%= t("views.right_panel.detail.select_payments") %></label>
<%= select_tag "payment_type", options_for_select(@payments, :selected => params[:payment_type]), :class => "form-control" %>
<label class="font-14"><%= t("views.right_panel.detail.select_providers") %></label>
<%= select_tag "provider", options_for_select(@providers, :selected => params[:provider]), :class => "form-control" %>
</div>
<% end %>
<div class="col-lg-2 col-md-2 col-sm-2">
@@ -49,37 +49,6 @@
</div>
<script type="text/javascript">
$(function(){
$('#custom_excel').hide();
$('#custom_excel').click(function(){
var url = $('#custom_excel').attr('data-url');
$('#frm_report').attr('action',url)
$('#frm_report').submit();
// window.location = url;
});
var item = $('#item').val();
var payment_type = $('#payment_type');
if(item == 'order'){
$('#cashier').hide();
$('#waiter').show();
if(payment_type){
$('#payment_type').hide();
}
}
else if(item == 'sale'){
$('#waiter').hide();
$('#cashier').show();
}
else{
$('#waiter').hide();
$('#cashier').show();
$("#item").val('sale');
}
});
<% if params[:shift_name].to_i > 0%>
shift_id = '<%= params[:shift_name] %>'
local_date = '<%= @shift_from %> - <%= @shift_to %> '
@@ -91,38 +60,4 @@
$("#from").val("<%=params[:from] rescue '-'%>");
$("#to").val("<%=params[:to] rescue '-'%>");
$("#sel_period").val(<%=params[:period] rescue '-'%>);
$("#sel_sale_type").val(<%=params[:sale_type] rescue '-'%>);
// shift = $(".shift-id").text()
// if (shift.length>0) {
// $('.shift_name > option[value="'+shift+'"]').attr('selected','selected');
// }
<% if params[:period_type] == 1 || params[:period_type] == "1" %>
$("#rd_period_type_1").attr("checked","checked");
<% else %>
$("#rd_period_type_0").attr("checked","checked");
<% end %>
$(".btn-group button").removeClass("active");
<% report_type = params[:report_type].blank? ? "0" : params[:report_type] %>
$("#btn_report_type_<%= report_type %>").addClass("active");
$('#item').change(function(){
var item = $('#item').val();
var payment_type = $('#payment_type');
if(item == 'sale'){
$('#waiter').hide();
$('#cashier').show();
if(payment_type){
$('#payment_type').show();
}
}
else{
$('#cashier').hide();
$('#waiter').show();
if(payment_type){
$('#payment_type').hide();
}
}
});
</script>

View File

@@ -1,7 +1,7 @@
<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.receipt_no_report") %></li>
<li class="breadcrumb-item active"><%= t("views.right_panel.detail.order_reservation_report") %></li>
<span class="float-right">
<%= link_to 'Back', dashboard_path %>
</span>
@@ -12,14 +12,14 @@
<!-- <div class="container"> -->
<%= render :partial=>'shift_sale_report_filter',
:locals=>{ :period_type => true, :shift_name => true,:payments => true, :report_path =>reports_receipt_no_index_path} %>
:locals=>{ :period_type => true, :shift_name => true,:providers => true, :report_path =>reports_order_reservation_index_path} %>
<hr />
<!-- </div> -->
<!-- <div class="container"> -->
<!-- <div class="row"> -->
<div class="text-right">
<a href="javascript:export_to('<%=reports_receipt_no_index_path%>.xls')" class = "btn btn-info wave-effects"><%= t("views.btn.exp_to_excel") %></a>
<a href="javascript:export_to('<%=reports_order_reservation_index_path%>.xls')" class = "btn btn-info wave-effects"><%= t("views.btn.exp_to_excel") %></a>
</div>
<!-- </div> -->
<!-- </div> -->
@@ -28,116 +28,133 @@
<div class="card">
<table class="table table-striped" border="0">
<thead>
<tr>
<th colspan="9"> <%= 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>
<th colspan="15"> <%= t("views.right_panel.detail.from_date") %> : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - <%= t("views.right_panel.detail.to_date") %> : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%></th>
</tr>
<% if @shift_from %>
<tr>
<% if @shift_data.employee %>
<% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %>
<% end %>
<th colspan="9"><%= t("views.right_panel.detail.shift_name") %> = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )</th>
<th colspan="15"><%= t("views.right_panel.detail.shift_name") %> = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )</th>
</tr>
<% end %>
<tr>
<th><%= t("views.right_panel.detail.receipt_no") %></th>
<th><%= t :cashier %> <%= t("views.right_panel.detail.name") %></th>
<th><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %></th>
<th><%= t("views.right_panel.detail.discount") %> <%= t("views.right_panel.detail.amount") %> </th>
<% @tax_profiles.each do |tax| %>
<th><%= tax.name %></th>
<% end %>
<!-- <th>Other Amount</th> -->
<th><%= t :customer %></th>
<th><%= t("views.right_panel.detail.type") %></th>
<th><%= t("views.right_panel.detail.requested_time") %></th>
<th><%= t("views.right_panel.detail.provider") %></th>
<th><%= t :payment_method %></th>
<th><%= t :payment %> <%= t("views.right_panel.detail.status")%></th>
<th><%= t("views.right_panel.detail.sub_total") %></th>
<th><%= t("views.right_panel.detail.discount_amount") %></th>
<th><%= t("views.right_panel.detail.delivery_fee") %></th>
<th><%= t("views.right_panel.detail.convenience_charge") %></th>
<th><%= t("views.right_panel.detail.delivery_tax") %></th>
<th><%= t("views.right_panel.detail.convenience_tax") %></th>
<th><%= t("views.right_panel.detail.commercial_tax") %></th>
<th><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.tax") %></th>
<th><%= t("views.right_panel.detail.grand_total") %></th>
<th><%= t("views.right_panel.detail.rnd_adj_sh") %></th>
<th><%= t("views.right_panel.detail.grand_total") %> +<br/>
<%= t("views.right_panel.detail.rnd_adj_sh") %>
</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
puts precision
puts "predelidm"
puts delimiter %>
<% 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 %>
<%
discount_amount = 0.0
delivery_fee = 0.0
convenience_charge = 0.0
delivery_tax = 0.0
convenience_tax = 0.0
commercial_tax = 0.0
<% grand_total = 0 %>
<% old_grand_total = 0 %>
<% total_tax = 0 %>
<% guest_count = 0 %>
<% total_sum = 0 %>
<% discount_amt = 0 %>
<% other_amt = 0 %>
<% total_nett = 0 %>
<% rounding_adj = 0%> <% gov_tax = 0 %> <% service_charge = 0 %>
<%if @sale_data %>
<% @sale_data.each do |result| %>
<% grand_total = grand_total.to_f + result.grand_total.to_f %>
<% old_grand_total = old_grand_total.to_f + result.old_grand_total.to_f %>
<% total_tax += result.total_tax.to_f %>
<% total_sum += result.total_amount.to_f %>
<% discount_amt += result.total_discount.to_f %>
<% rounding_adj += result.rounding_adjustment.to_f %>
total_discount_amount = 0
total_delivery_fee = 0
total_convenience_charge = 0
total_delivery_tax = 0
total_convenience_tax = 0
total_commercial_tax = 0
total_tax = 0.0
total_amount = 0.0
grand_total = 0.0
%>
<% unless @order_reservation_data.blank? %>
<% @order_reservation_data.each do |order_reservation| %>
<%
provider = ""
discount_amount = order_reservation.discount_amount
delivery_fee = order_reservation.delivery_fee ? order_reservation.delivery_fee : 0.0
convenience_charge = order_reservation.convenience_charge
JSON.parse(order_reservation.taxes).each do |tax_data|
if tax_data[0] == "delivery_tax"
delivery_tax = tax_data[1]
elsif tax_data[0] == "convenience_tax"
convenience_tax = tax_data[1]
elsif tax_data[0] == "commercial_tax"
commercial_tax = tax_data[1]
end
end
total_discount_amount += discount_amount.to_f
total_delivery_fee += delivery_fee.to_f
total_convenience_charge += convenience_charge.to_f
total_delivery_tax += delivery_tax.to_f
total_convenience_tax += convenience_tax.to_f
total_commercial_tax += commercial_tax.to_f
total_tax += order_reservation.total_tax.to_f
total_amount += order_reservation.total_amount.to_f
grand_total += order_reservation.grand_total.to_f
%>
<%
if order_reservation.provider == 'pick_up'
provider = "Pick-Up"
elsif order_reservation.provider == 'direct_delivery'
provider = "Direct Delivery"
else
provider = order_reservation.provider
end
%>
<tr>
<td><%= order_reservation.email %></td>
<td><%= order_reservation.order_reservation_type %></td>
<td><%= order_reservation.requested_time.utc.getlocal.strftime("%Y-%m-%d %I:%M %p") %></td>
<td><%= provider%></td>
<td><%= order_reservation.payment_type%></td>
<td><%= order_reservation.payment_status%></td>
<td><%= number_with_precision(order_reservation.total_amount, precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
<td><%= number_with_precision(discount_amount , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
<td><%= number_with_precision(delivery_fee , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
<td><%= number_with_precision(convenience_charge , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
<td><%= number_with_precision(delivery_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
<td><%= number_with_precision(convenience_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
<td><%= number_with_precision(commercial_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
<td><%= number_with_precision(order_reservation.total_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
<td><%= number_with_precision(order_reservation.grand_total , precision:precision.to_i, delimiter:delimiter) rescue '0.0' %></td>
</tr>
<% end
end %>
<tr>
<td><%= result.receipt_no rescue '-' %> </td>
<td><%= result.cashier_name rescue '-' %></td>
<td><%= number_with_precision(result.total_amount, precision: precision.to_i ,delimiter: delimiter) %></td>
<td><%= number_with_precision(result.total_discount, precision: precision.to_i ,delimiter: delimiter) %></td>
<%if result.customer.customer_type == "Takeaway"%>
<td><%= number_with_precision(0, precision: precision.to_i ,delimiter: delimiter) %></td>
<%end%>
<% result.sale_taxes.each do |tax| %>
<td><%= number_with_precision(tax.tax_payable_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
<%end%>
<td><%= number_with_precision(result.grand_total, precision: precision.to_i ,delimiter: delimiter) %></td>
<td><%= result.rounding_adjustment.to_f rescue '-' %></td>
<td><%= number_with_precision(result.grand_total_after_rounding(), precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
<td colspan="6"></td>
<td><b><%= number_with_precision(total_amount , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></b></td>
<td><b><%= number_with_precision(total_discount_amount , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></b></td>
<td><b><%= number_with_precision(total_delivery_fee , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></b></td>
<td><b><%= number_with_precision(total_convenience_charge , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></b></td>
<td><b><%= number_with_precision(total_delivery_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></b></td>
<td><b><%= number_with_precision(total_convenience_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></b></td>
<td><b><%= number_with_precision(total_commercial_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></b></td>
<td><b><%= number_with_precision(total_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></b></td>
<td><b><%= number_with_precision(grand_total , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></b></td>
</tr>
<% end %>
<tr style="border-top:4px double #666;">
<td colspan="2">&nbsp;</td>
<td><b><%= number_with_precision(total_sum, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
<td><b><%= number_with_precision(discount_amt, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
<% @sale_taxes.each do |tax| %>
<td><b><%= number_with_precision(tax.st_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
<% end %>
<td><b><%= number_with_precision(grand_total.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
<td><b><%= rounding_adj.to_f rescue '-' %></b></td>
<td><b><%= number_with_precision(grand_total.to_f.round + rounding_adj, precision: precision.to_i ,delimiter: delimiter) %></b></td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %></td>
<td><%= t("views.right_panel.detail.discount") %> <%= t("views.right_panel.detail.amount") %></td>
<% @tax_profiles.each do |tax| %>
<td><%= tax.name %></td>
<% end %>
<td><%= t("views.right_panel.detail.grand_total") %></td>
<td><%= t("views.right_panel.detail.rnd_adj_sh") %></td>
<td><%= t("views.right_panel.detail.grand_total") %> +<br/>
<%= t("views.right_panel.detail.rnd_adj_sh") %>
</td>
</tr>
<%end%>
</tbody>
</table>
</div>
@@ -151,9 +168,7 @@
var check_arr = [];
search_by_period();
$('#sel_period').change(function(){
search_by_period();
});
function search_by_period(){
@@ -216,7 +231,7 @@
from = $("#from").val();
to = $("#to").val();
}
url = '<%= reports_get_shift_by_date_path %>';
url = '<%= reports_get_shift_by_order_reservation_path %>';
$.get(url, {period :period, period_type :period_type, from :from, to :to, report_type :shift_item} , function(data){

View File

@@ -6,98 +6,124 @@
<table class="table table-striped" border="0">
<thead>
<tr>
<th colspan="9"> <%= 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>
<th colspan="15"> <%= t("views.right_panel.detail.from_date") %> : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - <%= t("views.right_panel.detail.to_date") %> : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%></th>
</tr>
<% if @shift_from %>
<tr>
<% if @shift_data.employee %>
<% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %>
<% end %>
<th colspan="9"><%= t("views.right_panel.detail.shift_name") %> = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )</th>
<th colspan="15"><%= t("views.right_panel.detail.shift_name") %> = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )</th>
</tr>
<% end %>
<tr>
<th><%= t("views.right_panel.detail.receipt_no") %></th>
<th><%= t :cashier %> <%= t("views.right_panel.detail.name") %></th>
<th><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %></th>
<th><%= t("views.right_panel.detail.discount") %> <%= t("views.right_panel.detail.amount") %> </th>
<% @tax_profiles.each do |tax| %>
<th><%= tax.name %></th>
<% end %>
<!-- <th>Other Amount</th> -->
<th><%= t :customer %></th>
<th><%= t("views.right_panel.detail.type") %></th>
<th><%= t("views.right_panel.detail.requested_time") %></th>
<th><%= t("views.right_panel.detail.provider") %></th>
<th><%= t :payment_method %></th>
<th><%= t :payment %> <%= t("views.right_panel.detail.status")%></th>
<th><%= t("views.right_panel.detail.sub_total") %></th>
<th><%= t("views.right_panel.detail.discount_amount") %></th>
<th><%= t("views.right_panel.detail.delivery_fee") %></th>
<th><%= t("views.right_panel.detail.convenience_charge") %></th>
<th><%= t("views.right_panel.detail.delivery_tax") %></th>
<th><%= t("views.right_panel.detail.convenience_tax") %></th>
<th><%= t("views.right_panel.detail.commercial_tax") %></th>
<th><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.tax") %></th>
<th><%= t("views.right_panel.detail.grand_total") %></th>
<th><%= t("views.right_panel.detail.rnd_adj_sh") %></th>
<th><%= t("views.right_panel.detail.grand_total") %> +<br/>
<%= t("views.right_panel.detail.rnd_adj_sh") %>
</th>
</tr>
</thead>
<tbody>
<% grand_total = 0 %>
<% old_grand_total = 0 %>
<% total_tax = 0 %>
<% guest_count = 0 %>
<% total_sum = 0 %>
<% discount_amt = 0 %>
<% other_amt = 0 %>
<% total_nett = 0 %>
<% rounding_adj = 0%> <% gov_tax = 0 %> <% service_charge = 0 %>
<%if @sale_data %>
<% @sale_data.each do |result| %>
<%
discount_amount = 0.0
delivery_fee = 0.0
convenience_charge = 0.0
delivery_tax = 0.0
convenience_tax = 0.0
commercial_tax = 0.0
<% grand_total = grand_total.to_f + result.grand_total.to_f %>
<% old_grand_total = old_grand_total.to_f + result.old_grand_total.to_f %>
<% total_tax += result.total_tax.to_f %>
<% total_sum += result.total_amount.to_f %>
<% discount_amt += result.total_discount.to_f %>
<% rounding_adj += result.rounding_adjustment.to_f %>
total_discount_amount = 0
total_delivery_fee = 0
total_convenience_charge = 0
total_delivery_tax = 0
total_convenience_tax = 0
total_commercial_tax = 0
total_tax = 0.0
total_amount = 0.0
grand_total = 0.0
%>
<% unless @order_reservation_data.blank? %>
<% @order_reservation_data.each do |order_reservation| %>
<%
provider = ""
discount_amount = order_reservation.discount_amount
delivery_fee = order_reservation.delivery_fee ? order_reservation.delivery_fee : 0.0
convenience_charge = order_reservation.convenience_charge
JSON.parse(order_reservation.taxes).each do |tax_data|
if tax_data[0] == "delivery_tax"
delivery_tax = tax_data[1]
elsif tax_data[0] == "convenience_tax"
convenience_tax = tax_data[1]
elsif tax_data[0] == "commercial_tax"
commercial_tax = tax_data[1]
end
end
total_discount_amount += discount_amount.to_f
total_delivery_fee += delivery_fee.to_f
total_convenience_charge += convenience_charge.to_f
total_delivery_tax += delivery_tax.to_f
total_convenience_tax += convenience_tax.to_f
total_commercial_tax += commercial_tax.to_f
total_tax += order_reservation.total_tax.to_f
total_amount += order_reservation.total_amount.to_f
grand_total += order_reservation.grand_total.to_f
%>
<%
if order_reservation.provider == 'pick_up'
provider = "Pick-Up"
elsif order_reservation.provider == 'direct_delivery'
provider = "Direct Delivery"
else
provider = order_reservation.provider
end
%>
<tr>
<td><%= order_reservation.email %></td>
<td><%= order_reservation.order_reservation_type %></td>
<td><%= order_reservation.requested_time.utc.getlocal.strftime("%Y-%m-%d %I:%M %p") %></td>
<td><%= provider%></td>
<td><%= order_reservation.payment_type%></td>
<td><%= order_reservation.payment_status%></td>
<td><%= order_reservation.total_amount rescue '0.0'%></td>
<td><%= discount_amount rescue '0.0'%></td>
<td><%= delivery_fee rescue '0.0'%></td>
<td><%= convenience_charge rescue '0.0'%></td>
<td><%= delivery_tax rescue '0.0'%></td>
<td><%= convenience_tax rescue '0.0'%></td>
<td><%= commercial_tax rescue '0.0'%></td>
<td><%= order_reservation.total_tax rescue '0.0'%></td>
<td><%= order_reservation.grand_total rescue '0.0' %></td>
</tr>
<% end
end %>
<tr>
<td><%= result.receipt_no rescue '-' %> </td>
<td><%= result.cashier_name rescue '-' %></td>
<td><%= result.total_amount rescue '-' %></td>
<td><%= result.total_discount rescue '-' %></td>
<%if result.customer.customer_type == "Takeaway"%>
<td>0.0</td>
<%end%>
<% result.sale_taxes.each do |tax| %>
<td><%= tax.tax_payable_amount rescue '-' %></td>
<%end%>
<td><%= result.grand_total %></td>
<td><%= result.rounding_adjustment.to_f rescue '-' %></td>
<td><%= result.grand_total_after_rounding() rescue '-'%></td>
<td colspan="6"></td>
<td><b><%= total_amount rescue '0.0'%></b></td>
<td><b><%= total_discount_amount rescue '0.0'%></b></td>
<td><b><%= total_delivery_fee rescue '0.0'%></b></td>
<td><b><%= total_convenience_charge rescue '0.0'%></b></td>
<td><b><%= total_delivery_tax rescue '0.0'%></b></td>
<td><b><%= total_convenience_tax rescue '0.0'%></b></td>
<td><b><%= total_commercial_tax rescue '0.0'%></b></td>
<td><b><%= total_tax rescue '0.0'%></b></td>
<td><b><%= grand_total rescue '0.0'%></b></td>
</tr>
<% end %>
<tr style="border-top:4px double #666;">
<td colspan="2">&nbsp;</td>
<td><b><%= total_sum rescue '-'%></b></td>
<td><b><%= discount_amt rescue '-'%></b></td>
<% @sale_taxes.each do |tax| %>
<td><b><%= tax.st_amount.round(2) %></b></td>
<% end %>
<td><b><%= grand_total.to_f.round(2) rescue '-'%></b></td>
<td><b><%= rounding_adj rescue '-'%></b></td>
<td><b><%= grand_total.to_f.round + rounding_adj %></b></td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %></td>
<td><%= t("views.right_panel.detail.discount") %> <%= t("views.right_panel.detail.amount") %></td>
<% @tax_profiles.each do |tax| %>
<td><%= tax.name %></td>
<% end %>
<td><%= t("views.right_panel.detail.grand_total") %></td>
<td><%= t("views.right_panel.detail.rnd_adj_sh") %></td>
<td><%= t("views.right_panel.detail.grand_total") %> +<br/>
<%= t("views.right_panel.detail.rnd_adj_sh") %>
</td>
</tr>
<%end%>
</tbody>
</table>
</div>

View File

@@ -59,20 +59,16 @@
</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
puts precision
puts "predelidm"
puts delimiter %>
precision = @print_settings.precision
else
precision = 0
end
#check delimiter
if @print_settings.delimiter
delimiter = ","
else
delimiter = ""
end %>
<% grand_total = 0 %>
<% old_grand_total = 0 %>
@@ -116,12 +112,18 @@
<td colspan="2">&nbsp;</td>
<td><b><%= number_with_precision(total_sum, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
<td><b><%= number_with_precision(discount_amt, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
<% @sale_taxes.each do |tax| %>
<td><b><%= number_with_precision(tax.st_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
<% if !@sale_taxes.empty?
@sale_taxes.each do |tax| %>
<td><b><%= number_with_precision(tax.st_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
<% end %>
<% else %>
<% @tax_profiles.each do |tax| %>
<td><b>0</b></td>
<% end %>
<% end %>
<td><b><%= number_with_precision(grand_total.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
<td><b><%= rounding_adj.to_f rescue '-' %></b></td>
<td><b><%= number_with_precision(grand_total.to_f.round + rounding_adj, precision: precision.to_i ,delimiter: delimiter) %></b></td>
<td><b><%= number_with_precision(grand_total.to_f.round + rounding_adj, precision: precision.to_i ,delimiter: delimiter) rescue '0' %></b></td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>

View File

@@ -1,12 +1,12 @@
<div class="container-fluid">
<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.waste_spoilage_report") %></li>
<span class="float-right">
<%= link_to 'Back', dashboard_path %>
</span>
</ol>
<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.waste_spoilage_report") %></li>
<span class="float-right">
<%= link_to 'Back', dashboard_path %>
</span>
</ol>
</div>
<div class="row">
<div class="col-md-12">
@@ -20,52 +20,77 @@
<div class="card">
<table class="table table-striped" border="0">
<h5 class="p-l-10 p-t-10">Report For <%= @sale_type? @sale_type : 'Waste' %></h5>
<h5 class="p-l-10 p-t-10">Report For <%= @sale_type? @sale_type : 'Waste' %></h5>
<% receipt_arr = Array.new %>
<% menu_cat_arr = Array.new %>
<% footer_arr = Array.new %>
<% count = 0 %>
<% waste_and_spoil_item_count = 0%>
<% @sale_data.each do |sale| %>
<% waste_and_spoil_item_count = 0%>
<thead>
<tr>
<td >
<strong>Receipt No :<%= sale.receipt_no %></strong>
</td>
<td></td>
<td colspan="3" style="text-align:right"><strong>Date : <%= sale.created_at.utc.getlocal.strftime("%e,%b %Y %I:%M %p") %></strong></td>
</tr>
</thead>
<tbody>
<tr>
<td ><strong>Item Name</strong></td>
<td ><strong>Item Code</strong></td>
<td><strong>Qty</strong></td>
<td><strong>Price</strong></td>
<td><strong>Total Price</strong></td>
</tr>
<% sale.sale_items.each do |item| %>
<% if !item.item_instance_code.nil?%>
<% waste_and_spoil_item_count += item.qty.to_i%>
<tr>
<td><%= item.product_name %></td>
<td><%= item.product_code %></td>
<td><%= item.qty %></td>
<td><%= item.price %></td>
<td><%= item.price %></td>
</tr>
<% end %>
<% if !receipt_arr.include?(sale.receipt_no) %>
<thead>
<td>&nbsp;</td>
<tr>
<td >
<strong>Receipt No :<%= sale.receipt_no %></strong>
</td>
<td></td>
<td></td>
<td colspan="3" style="text-align:right"><strong>Date : <%= sale.created_at.utc.getlocal.strftime("%e,%b %Y %I:%M %p") %></strong></td>
</tr>
<tr>
<td><strong>Menu Category</strong></td>
<td><strong>Item Name</strong></td>
<td><strong>Item Code</strong></td>
<td><strong>Qty</strong></td>
<td><strong>Price</strong></td>
<td><strong>Total Price</strong></td>
</tr>
</thead>
<% receipt_arr.push(sale.receipt_no) %>
<% menu_cat_arr.clear %>
<% count = 0 %>
<% end %>
<tbody>
<% if !sale.item_instance_code.nil?%>
<% waste_and_spoil_item_count += sale.qty.to_i %>
<tr>
<% if !menu_cat_arr.include?(sale.name) %>
<td><%= sale.name %></td>
<% menu_cat_arr.push(sale.name) %>
<% else %>
<td>&nbsp;</td>
<% end %>
<td><%= sale.product_name %></td>
<td><%= sale.product_code %></td>
<td><%= sale.qty.to_i %></td>
<td><%= sale.unit_price %></td>
<td><%= sale.price %></td>
</tr>
<% end %>
<tr>
<td colspan="2" style="text-align:right"> <strong>Total Qty: </strong></td>
<td><span class="underline" style="text-align:right">
<strong><%= waste_and_spoil_item_count %></strong>
</span></td>
<td style="text-align:right"> <strong>Grand Total: </strong></td>
<td >
<span class="underline" style="text-align:right">
<strong><%= sale.grand_total %></strong>
</span>
</td>
</tr>
</tbody>
<% count = count + 1 %>
<% if sale.sale_items.count == count %>
<tr>
<td></td>
<td colspan="2" style="text-align:right"> <strong>Total Qty: </strong></td>
<td>
<span class="underline" style="text-align:right">
<strong><%= waste_and_spoil_item_count %></strong>
<% waste_and_spoil_item_count = 0%>
</span></td>
<td style="text-align:right"> <strong>Grand Total: </strong></td>
<td >
<span class="underline" style="text-align:right">
<strong><%= sale.grand_total %></strong>
</span>
</td>
</tr>
<% footer_arr.push(sale.sale_id) %>
<% end %>
</tbody>
<% end %>
</table>
</div>

View File

@@ -5,52 +5,77 @@
<table class="table table-striped" border="0">
<h5 class="p-l-10 p-t-10">Report For <%= @sale_type? @sale_type : 'Waste' %></h5>
<% @sale_data.each do |sale| %>
<% receipt_arr = Array.new %>
<% menu_cat_arr = Array.new %>
<% footer_arr = Array.new %>
<% count = 0 %>
<% waste_and_spoil_item_count = 0%>
<thead>
<tr>
<td >
<strong>Receipt No :<%= sale.receipt_no %></strong>
</td>
<td></td>
<td colspan="3" style="text-align:right"><strong>Date : <%= sale.created_at.utc.getlocal.strftime("%e,%b %Y %I:%M %p") %></strong></td>
</tr>
</thead>
<tbody>
<tr>
<td ><strong>Item Name</strong></td>
<td ><strong>Item Code</strong></td>
<td><strong>Qty</strong></td>
<td><strong>Price</strong></td>
<td><strong>Total Price</strong></td>
</tr>
<% @sale_data.each do |sale| %>
<% if !receipt_arr.include?(sale.receipt_no) %>
<thead>
<td>&nbsp;</td>
<tr>
<td >
<strong>Receipt No :<%= sale.receipt_no %></strong>
</td>
<td></td>
<td></td>
<td colspan="3" style="text-align:right"><strong>Date : <%= sale.created_at.utc.getlocal.strftime("%e,%b %Y %I:%M %p") %></strong></td>
</tr>
<tr>
<td><strong>Menu Category</strong></td>
<td><strong>Item Name</strong></td>
<td><strong>Item Code</strong></td>
<td><strong>Qty</strong></td>
<td><strong>Price</strong></td>
<td><strong>Total Price</strong></td>
</tr>
</thead>
<% receipt_arr.push(sale.receipt_no) %>
<% menu_cat_arr.clear %>
<% count = 0 %>
<% end %>
<% sale.sale_items.each do |item| %>
<% if !item.item_instance_code.nil?%>
<% waste_and_spoil_item_count += item.qty.to_i%>
<tr>
<td><%= item.product_name %></td>
<td><%= item.product_code %></td>
<td><%= item.qty %></td>
<td><%= item.price %></td>
<td><%= item.price %></td>
</tr>
<% end %>
<% end %>
<tr>
<td colspan="2" style="text-align:right"> <strong>Total Qty: </strong></td>
<td><span class="underline" style="text-align:right">
<strong><%= waste_and_spoil_item_count %></strong>
</span></td>
<td style="text-align:right"> <strong>Grand Total: </strong></td>
<td >
<span class="underline" style="text-align:right">
<strong><%= sale.grand_total %></strong>
</span>
</td>
</tr>
</tbody>
<% end %>
<tbody>
<% if !sale.item_instance_code.nil?%>
<% waste_and_spoil_item_count += sale.qty.to_i %>
<tr>
<% if !menu_cat_arr.include?(sale.name) %>
<td><%= sale.name %></td>
<% menu_cat_arr.push(sale.name) %>
<% else %>
<td>&nbsp;</td>
<% end %>
<td><%= sale.product_name %></td>
<td><%= sale.product_code %></td>
<td><%= sale.qty.to_i %></td>
<td><%= sale.unit_price %></td>
<td><%= sale.price %></td>
</tr>
<% end %>
<% count = count + 1 %>
<% if sale.sale_items.count == count %>
<tr>
<td></td>
<td colspan="2" style="text-align:right"> <strong>Total Qty: </strong></td>
<td>
<span class="underline" style="text-align:right">
<strong><%= waste_and_spoil_item_count %></strong>
<% waste_and_spoil_item_count = 0%>
</span></td>
<td style="text-align:right"> <strong>Grand Total: </strong></td>
<td >
<span class="underline" style="text-align:right">
<strong><%= sale.grand_total %></strong>
</span>
</td>
</tr>
<% footer_arr.push(sale.sale_id) %>
<% end %>
</tbody>
<% end %>
</table>
</div>
</div>

View File

@@ -12,7 +12,11 @@
<%= f.input :auto_print_receipt %>
<%= f.label "Select Zones", :class => 'control-label' %>
<%= f.collection_check_boxes :zone_ids , Zone.all, :id, :name , :class => 'checkbox form-group'%>
<%= f.input :printer_name, :as => :select, :collection => Printer::PrinterWorker.printers, include_blank: false %>
<% if(@server_mode != 'cloud') %>
<%= f.input :printer_name, :as => :select, :collection => Printer::PrinterWorker.printers, include_blank: false %>
<% else %>
<%= f.input :printer_name, :as => :select, :collection => [], include_blank: false %>
<% end %>
<%= f.input :font %>
<%= f.input :font_size %>
<%= f.input :show_tax %>
@@ -58,4 +62,20 @@
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
var serverMode = "<%= @server_mode %>";
if(serverMode == 'cloud'){
var printers = code2lab.getPrinters();
var printerInfo = JSON.parse([printers]);
var select = $("#cashier_terminal_printer_name");
$.each(printerInfo, function(key, value) {
$('#cashier_terminal_printer_name')
.append($("<option></option>")
.attr("value",value.target)
.text(value.deviceName));
});
}
});
</script>

View File

@@ -15,8 +15,11 @@ div.form-inputs span{
<div class="form-inputs p-l-15">
<%= f.input :station_name %>
<%= f.input :is_active %>
<%= f.input :printer_name, :as => :select, :collection => Printer::PrinterWorker.printers, include_blank: false %>
<% if(@server_mode != 'cloud') %>
<%= f.input :printer_name, :as => :select, :collection => Printer::PrinterWorker.printers, include_blank: false %>
<% else %>
<%= f.input :printer_name, :as => :select, :collection => [], include_blank: false %>
<% end %>
<!-- <%= f.input :font_size %> -->
<%= f.input :print_copy %>
<%= f.hidden_field :processing_items %>
@@ -63,4 +66,20 @@ div.form-inputs span{
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
var serverMode = "<%= @server_mode %>";
if(serverMode == 'cloud'){
var printers = code2lab.getPrinters();
var printerInfo = JSON.parse([printers]);
var select = $("#order_queue_station_printer_name");
$.each(printerInfo, function(key, value) {
$('#order_queue_station_printer_name')
.append($("<option></option>")
.attr("value",value.target)
.text(value.deviceName));
});
}
});
</script>