remove con္ူငခအဓ

This commit is contained in:
phyusin
2018-07-13 14:45:32 +06:30
5 changed files with 312 additions and 250 deletions

View File

@@ -51,38 +51,28 @@
<% else %>
<div class="card tables orange text-white table_<%= table.id %>" data-id="<%= table.id %>">
<% end %>
<div class="card-block">
<%= table.name %>
<!-- <% if !@order_items_count.nil? %>
<% if @order_items_count.key?(table.id) %>
(Orders : <%= @order_items_count[table.id] %>)
<% end %>
<% end %> -->
<span class="float-right font-12 new_text_<%= table.id %>"> billed</span>
<div style="font-size:12px;"></div>
<div class="card-block">
<%= table.name %>
<span class="float-right font-12 new_text_<%= table.id %>"> billed</span>
<div style="font-size:12px;"></div>
</div>
</div>
</div>
<% else %>
<% if table.get_checkout_booking.nil? %>
<div class="card tables blue text-white table_<%= table.id %>" data-id="<%= table.id %>">
<% else %>
<div class="card tables orange text-white table_<%= table.id %>" data-id="<%= table.id %>">
<% end %>
<div class="card-block">
<%= table.name %>
<!-- <% if !@order_items_count.nil? %>
<% if @order_items_count.key?(table.id) %>
(Orders : <%= @order_items_count[table.id] %>)
<% end %>
<% end %> -->
<span class="float-right font-12 new_text_<%= table.id %>"> new</span>
<div class="card-block">
<%= table.name %>
<span class="float-right font-12 new_text_<%= table.id %>"> new</span>
</div>
</div>
</div>
<% end %>
<% else %>
<div class="card tables green text-white table_<%= table.id %>" data-id="<%= table.id %>">
<div class="card-block">
<%= table.name %>
<div class="card-block">
<%= table.name %>
<span class="float-right font-12 new_text_<%= table.id %> hide"> new</span>
</div>
</div>
@@ -98,33 +88,23 @@
<% if room.status == 'occupied' %>
<% if room.get_booking.nil? %>
<% if room.get_checkout_booking.nil? %>
<div class="card rooms red text-white table_<%= room.id %>" data-id="<%= room.id %>">
<div class="card rooms red text-white table_<%= room.id %>" data-id="<%= room.id %>">
<% else %>
<div class="card rooms orange text-white table_<%= room.id %>" data-id="<%= room.id %>">
<div class="card rooms orange text-white table_<%= room.id %>" data-id="<%= room.id %>">
<% end %>
<div class="card-block">
<%= room.name %>
<!-- <% if !@order_items_count.nil? %>
<% if @order_items_count.key?(room.id) %>
(Orders : <%= @order_items_count[room.id] %>)
<% end %>
<% end %> -->
<span class="float-right font-12 new_text_<%= room.id %>"> billed</span>
<div class="card-block">
<%= room.name %>
<span class="float-right font-12 new_text_<%= room.id %>"> billed</span>
</div>
</div>
</div>
<% else %>
<% if room.get_checkout_booking.nil? %>
<div class="card rooms blue text-white table_<%= room.id %>" data-id="<%= room.id %>">
<div class="card rooms blue text-white table_<%= room.id %>" data-id="<%= room.id %>">
<% else %>
<div class="card rooms orange text-white table_<%= room.id %>" data-id="<%= room.id %>">
<div class="card rooms orange text-white table_<%= room.id %>" data-id="<%= room.id %>">
<% end %>
<div class="card-block">
<div class="card-block">
<%= room.name %>
<!-- <% if !@order_items_count.nil? %>
<% if @order_items_count.key?(room.id) %>
(Orders : <%= @order_items_count[room.id] %>)
<% end %>
<% end %> -->
<span class="float-right font-12 new_text_<%= room.id %>"> new</span>
</div>
</div>
@@ -147,22 +127,22 @@
<% @orders.each do |order| %>
<div class="card orders <%=(order.status=="new") ? 'blue' : 'red'%> text-white" data-id="<%= order.order_id %>">
<div class="card-block">
<%
order_status = ""
sale_order = order.sale_orders.first
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 %>
<% order_status = "" %>
<% sale_order = order.sale_orders.first %>
<% 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 %>
@@ -211,7 +191,13 @@
<!-- Column Two -->
<div class="col-lg-5 col-md-5 col-sm-5">
<div class="card">
<div class="card-header">
<% existing_class = "" %><% existing_order = false %>
<% if @status_sale == 'sale' && (!@order_items.nil?) %>
<% existing_class = "existing_invoice"%>
<% existing_order = true %>
<% tooltip = ' data-toggle=modal title=Add_To_Existing data-target=#invoiceModal'%>
<%end%>
<div class="card-header <%= existing_class %>" <%= tooltip %>>
<% if @status_order == 'order' && @status_sale != 'sale' %>
<% if !@obj_order.nil? %>
<div id="save_order_id" data-order="<%= @obj_order.order_id %>">
@@ -259,7 +245,6 @@
&nbsp; Order No: <span id="order_no">
<% if @status_order == 'order' %>
<%= @obj_order.order_id rescue '' %>
<% end %>
</span>
<br>
@@ -271,109 +256,84 @@
<% end %>
</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' %>
<p class="hidden customer-id"><%= @sale_array[0].customer_id rescue '' %></p>
&nbsp; Customer : <%= @sale_array[0].customer.name rescue '' %>
<% elsif @status_order == 'order'
%>
<p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p>
&nbsp; Customer : <%= @customer.name rescue "" %>
<% end %>
</div>
<div class="col-lg-6 col-md-6 col-sm-6">
<% if @status_sale == 'sale' %>
<p class="hidden customer-id"><%= @sale_array[0].customer_id rescue '' %></p>
&nbsp; Customer : <%= @sale_array[0].customer.name rescue '' %>
<% elsif @status_order == 'order'
%>
<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="<%= @status_sale=="sale" ? 200 : 160%>">
<div class="card-text" >
<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>
<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
<% count = 0
sub_total = 0
if @status_sale == "sale"
@sale_array[0].sale_items.each do |sale_item|
sub_total = sub_total + sale_item.price
%>
sub_total = sub_total + sale_item.price%>
<input type="hidden" id="sale_id" value="<%= @sale_array[0].sale_id %>">
<%
# Can't check for discount
# unless sale_item.price == 0
count += 1
%>
<%count += 1 %>
<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 %>
<% if @status_order == 'order' && @status_sale != 'sale'
unless @order_items.nil? || @order_items.empty?
count = 0
@order_items.each do |order_item|
set_item_prices = 0
count += 1
sub_total = sub_total + (order_item.price * order_item.qty)
# unless order_item.price == 0 %>
<tr class="<%= @edit_order_origami==true ? 'edit_order' : '' %>" data-id='<%= order_item.order_items_id %>'>
<td><%= count %></td>
<td class='item-name'><%= order_item.item_name %>
<% if !order_item.options.nil? && !order_item.options.empty? && order_item.options != "undefined" %>
<% JSON.parse(order_item.options).each do |option| %>
<br><span class="font-13"><%= option %></span>
<% end %>
<% end %>
<%
end
end
if @status_order == 'order' && @status_sale != 'sale'
puts
unless @order_items.nil? || @order_items.empty?
count = 0
@order_items.each do |order_item|
set_item_prices = 0
count += 1
sub_total = sub_total + (order_item.price * order_item.qty)
# unless order_item.price == 0 %>
<tr class="<%= @edit_order_origami==true ? 'edit_order' : '' %>" data-id='<%= order_item.order_items_id %>'>
<td><%= count %></td>
<td class='item-name'>
<%= order_item.item_name %>
<% if !order_item.options.nil? && !order_item.options.empty? && order_item.options != "undefined" %>
<% JSON.parse(order_item.options).each do |option| %>
<br><span class="font-13">
<%= option %>
</span>
<% if !order_item.set_menu_items.nil? && order_item.set_menu_items != '[]'
JSON.parse(order_item.set_menu_items).each do |item_instance|
set_item_prices += (item_instance["quantity"].to_f * item_instance["price"].to_f).to_f %>
<br>
<span class="font-13">
<%= item_instance["item_instance_name"] %>
<% if !item_instance["options"].nil? && !item_instance["options"].empty? %>
<% (item_instance["options"]).each do |set_item_option| %>
<br><span class="font-13"> <%= set_item_option %></span>
<% end %>
<% end %>
<% if !order_item.set_menu_items.nil? && order_item.set_menu_items != '[]'
JSON.parse(order_item.set_menu_items).each do |item_instance|
set_item_prices += (item_instance["quantity"].to_f * item_instance["price"].to_f).to_f %>
<br><span class="font-13">
<%= item_instance["item_instance_name"] %>
<% if !item_instance["options"].nil? && !item_instance["options"].empty? %>
<% (item_instance["options"]).each do |set_item_option| %>
<br><span class="font-13">
<%= set_item_option %>
</span>
<% end %>
<% end %>
</span>
<% end
sub_total += set_item_prices
end %>
</td>
<td class='item-attr'><%= order_item.qty %></td>
<td class='item-attr'><%= (order_item.qty*order_item.price).to_f + set_item_prices %></td>
</tr>
<%
# end
end
end
end
%>
<% end %>
</span>
<% end
sub_total += set_item_prices
end %>
</td>
<td class='item-attr'><%= order_item.qty %></td>
<td class='item-attr'><%= (order_item.qty*order_item.price).to_f + set_item_prices %></td>
</tr>
<% end %>
<% end %>
<% end %>
</tbody>
</table>
</div>
@@ -385,64 +345,60 @@
<td class="item-attr"><strong id="sub-total"><%= sub_total %></strong></td>
</tr>
<tr>
<%if @obj_sale != nil && @obj_sale.discount_type == 'member_discount'%>
<td class="charges-name"><strong>Member Discount:</strong></td>
<%else%>
<td class="charges-name"><strong>Discount:</strong></td>
<%end%>
<%if @obj_sale != nil && @obj_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">(<%= @obj_sale.total_discount rescue 0%>)</strong></td>
</tr>
<td class="item-attr"><strong id="order-discount">(<%= @obj_sale.total_discount rescue 0%>)</strong></td>
</tr>
<% if @status_sale == "sale" %>
<tr>
<td class="charges-name"><strong>
<% if !@sale_taxes.empty? %>
Tax:
(<% @i = 0
@sale_taxes.each do |ct| %>
<%=ct.tax_name%>
<% if @sale_taxes.count != @i+1%>
+ <% @i =+1 %>
<%end%>
<%end %>)
<% else %>
No Tax
<% end %></strong><br>
<%if !@webview %>
<button class="btn btn-link waves-effect bg-info change_tax">Change Tax</button>
<% end %>
</td>
<td class="item-attr"><strong id="order-Tax"><%= @obj_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"><%= @obj_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"><%= @obj_sale.grand_total rescue 0%></strong></td>
</tr>
<% end %>
<td class="charges-name"><strong>
<% if !@sale_taxes.empty? %>
Tax:
(<% @i = 0
@sale_taxes.each do |ct| %>
<%=ct.tax_name%>
<% if @sale_taxes.count != @i+1%>
+ <% @i =+1 %>
<%end%>
<%end %>)
<% else %>
No Tax
<% end %></strong><br>
<%if !@webview %>
<button class="btn btn-link waves-effect bg-info change_tax">Change Tax</button>
<% end %>
</td>
<td class="item-attr"><strong id="order-Tax"><%= @obj_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"><%= @obj_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"><%= @obj_sale.grand_total rescue 0%></strong></td>
</tr>
<% end %>
<tr class="rebate_amount"></tr>
</table>
</div>
</table>
</div>
<%
if @status_sale == 'sale'
unless @order_items.nil? || @order_items.empty?
%>
Pending New Order
<table class="table table-striped">
<%
count = 0
@order_items.each do |order_item|
set_item_prices = 0
count += 1
%>
<tr class="<%= @edit_order_origami==true ? 'edit_order' : '' %>" data-id='<%= order_item.order_items_id %>'>
<td><%= count %>
<td class='item-name'>
<%= order_item.item_name %>
<% if @status_sale == 'sale'
unless @order_items.nil? || @order_items.empty?%>
<!-- Pending New Order
<table class="table table-striped">
<% count = 0
@order_items.each do |order_item|
set_item_prices = 0
count += 1 %>
<tr class="<%= @edit_order_origami==true ? 'edit_order' : '' %>" data-id='<%= order_item.order_items_id %>'>
<td><%= count %>
<td class='item-name'>
<%= order_item.item_name %>
<% if !order_item.options.nil? && !order_item.options.empty? && order_item.options != "undefined" %>
<% JSON.parse(order_item.options).each do |option| %>
<br><span class="font-13">
@@ -475,9 +431,9 @@
<%
end
%>
</table>
</table> -->
<button class='btn btn-primary btn-block waves-effect' id='add_invoice'> Add to existing invoice</button>
<!-- <button class='btn btn-primary btn-block waves-effect' id='add_invoice'> Add to existing invoice</button> -->
<% end %>
<% if @sale_array.size > 1 %>
<br><br>
@@ -486,24 +442,21 @@
<% @sale_array.each do |sale|
if @sale_array.size > 1
unless sale.receipt_no == @sale_array[0].receipt_no
%>
<table class="table table-striped">
<tr>
<td>Receipt No - <%= sale.receipt_no %></td>
<td>
<button class='btn btn-sm btn-primary invoicedetails' id="<%= sale.sale_id %>">Show
%>
<table class="table table-striped">
<tr>
<td>Receipt No - <%= sale.receipt_no %></td>
<td>
<button class='btn btn-sm btn-primary invoicedetails' id="<%= sale.sale_id %>">Show
Detail
</button>
</td>
</tr>
</table>
<%
end
end
end
end
%>
</button>
</td>
</tr>
</table>
<%end%>
<% end%>
<% end%>
<%end %>
</div>
</div>
</div>
@@ -568,12 +521,12 @@
<!-- first bill not used in cloud -->
<%if @membership.discount && @obj_sale.customer.membership_id %>
<button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#paymentModal">First Bill</button>
<button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#paymentModal" data-order="<%= existing_order %>">First Bill</button>
<%else%>
<button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect">First Bill</button>
<button type="button" id="first_bill" data-order="<%= existing_order %>" class="btn btn-block bg-blue waves-effect">First Bill</button>
<%end%>
<button type="button" id="pay" class="btn btn-block bg-blue waves-effect">Pay</button>
<button type="button" id="pay" data-order="<%= existing_order %>" class="btn btn-block bg-blue waves-effect">Pay</button>
<!--<% if current_login_employee.role != "waiter" %>
<button type="button" class="btn action-btn bg-blue waves-effect" data-toggle="modal" data-target="#waste_spoileModal" > Waste & Spoile</button>
@@ -679,6 +632,84 @@
</div>
</div>
<% if @status_sale == 'sale' && (!@order_items.nil?) %>
<div class="modal fade" id="invoiceModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="invoiceModalLabel">Pending New Order</h4>
</div>
<div class="modal-body">
<div class="card">
<div id="pending-order-slimscroll" data-height="160">
<table class="table table-striped">
<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
@order_items.each do |order_item|
set_item_prices = 0
count += 1 %>
<tr class="<%= @edit_order_origami==true ? 'edit_order' : '' %>" data-id='<%= order_item.order_items_id %>'>
<td><%= count %></td>
<td class='item-name'>
<%= order_item.item_name %>
<% if !order_item.options.nil? && !order_item.options.empty? && order_item.options != "undefined" %>
<% JSON.parse(order_item.options).each do |option| %>
<br><span class="font-13">
<%= option %>
</span>
<% end %>
<% end %>
<% if !order_item.set_menu_items.nil?
JSON.parse(order_item.set_menu_items).each do |item_instance|
set_item_prices += (item_instance["quantity"].to_f * item_instance["price"].to_f).to_f
%>
<br><span class="font-13">
<%= item_instance["item_instance_name"] %>
<% if !item_instance["options"].nil? && item_instance["options"] != "undefined" %>
<% (item_instance["options"]).each do |set_item_option| %>
<br><span class="font-13">
<%= set_item_option %>
</span>
<% end %>
<% end %>
</span>
<% end
sub_total += set_item_prices
end %>
</td>
<td class='item-attr'><%= order_item.qty %></td>
<td class='item-attr'><%= (order_item.qty*order_item.price).to_f + set_item_prices %></td>
</tr>
<%end %>
</tbody>
</table>
</div>
</div>
</div>
<div class="modal-footer ">
<div class="row p-r-20">
<div class="col-md-9">
<button class='btn btn-link bg-blue waves-effect' data-dismiss="modal" id='add_invoice'> Add to existing invoice</button>
</div>
<div class="col-md-3">
<button type="button" class="btn btn-link bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
</div>
</div>
</div>
</div>
</div>
</div>
<%end%>
<!-- change tax modal -->
<div class="modal fade" id="change_taxModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-md" role="document">
@@ -993,7 +1024,24 @@
$('#pay').on('click', function () {
var sale_id = $('#sale_id').val();
window.location.href = '/origami/sale/' + sale_id + "/cashier/payment";
var data_order = $(this).data("order");
if (data_order) {
swal({
title: "Alert! This Receipt has another item",
text: "Are you sure want to pay this receipt !",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, Pay it !",
closeOnConfirm: false
}, function (isConfirm) {
if (isConfirm) {
window.location.href = '/origami/sale/' + sale_id + "/cashier/payment";
}
});
}else{
window.location.href = '/origami/sale/' + sale_id + "/cashier/payment";
}
});
// Bill Request