add split bill for order item in room
This commit is contained in:
@@ -3,7 +3,7 @@ class Origami::OrdersController < BaseOrigamiController
|
|||||||
@tables = Table.all.active.order('status desc')
|
@tables = Table.all.active.order('status desc')
|
||||||
@rooms = Room.all.active.order('status desc')
|
@rooms = Room.all.active.order('status desc')
|
||||||
@complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
|
@complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
|
||||||
@orders = Order.all.order('status desc')
|
@orders = Order.where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
|
||||||
@order = Order.find(params[:order_id])
|
@order = Order.find(params[:order_id])
|
||||||
sale_order = SaleOrder.find_by_order_id(@order.order_id)
|
sale_order = SaleOrder.find_by_order_id(@order.order_id)
|
||||||
if sale_order
|
if sale_order
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class Origami::RoomsController < BaseOrigamiController
|
|||||||
@tables = Table.all.active.order('status desc')
|
@tables = Table.all.active.order('status desc')
|
||||||
@rooms = Room.all.active.order('status desc')
|
@rooms = Room.all.active.order('status desc')
|
||||||
@complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
|
@complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
|
||||||
@orders = Order.all.order('date desc')
|
@orders = Order.where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
|
||||||
|
|
||||||
@room = DiningFacility.find(params[:room_id])
|
@room = DiningFacility.find(params[:room_id])
|
||||||
|
|
||||||
@@ -90,6 +90,12 @@ class Origami::RoomsController < BaseOrigamiController
|
|||||||
# end
|
# end
|
||||||
# end
|
# end
|
||||||
# end
|
# end
|
||||||
|
|
||||||
|
lookup_spit_bill = Lookup.collection_of('split_bill')
|
||||||
|
@spit_bill = 0
|
||||||
|
if !lookup_spit_bill[0].nil?
|
||||||
|
@spit_bill = lookup_spit_bill[0][1]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -116,7 +116,22 @@
|
|||||||
<% @orders.each do |order| %>
|
<% @orders.each do |order| %>
|
||||||
<div class="card orders red text-white" data-id="<%= order.order_id %>">
|
<div class="card orders red text-white" data-id="<%= order.order_id %>">
|
||||||
<div class="card-block">
|
<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>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -678,7 +693,7 @@
|
|||||||
if(lookup_split_bill == '1'){
|
if(lookup_split_bill == '1'){
|
||||||
swal({
|
swal({
|
||||||
title: "Alert",
|
title: "Alert",
|
||||||
text: "Do you want to Split bill?",
|
text: "Are you sure, you want to Split bill?",
|
||||||
type: "warning",
|
type: "warning",
|
||||||
showCancelButton: true,
|
showCancelButton: true,
|
||||||
confirmButtonColor: "#DD6B55",
|
confirmButtonColor: "#DD6B55",
|
||||||
|
|||||||
@@ -128,7 +128,7 @@
|
|||||||
order_status = order.status
|
order_status = order.status
|
||||||
end
|
end
|
||||||
%>
|
%>
|
||||||
<%= order.order_id %> | <%= order_status %>
|
<%= order.order_id %> <% if !order_status.empty? %>| <%= order_status %> <% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -150,7 +150,7 @@
|
|||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<div class="card-title row p-l-5 p-r-5">
|
<div class="card-title row p-l-5 p-r-5">
|
||||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||||
Receipt No: <span id="receipt_no">
|
Order No: <span id="receipt_no"> <%= @order.order_id %>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
||||||
|
|||||||
@@ -117,7 +117,22 @@
|
|||||||
<% @orders.each do |order| %>
|
<% @orders.each do |order| %>
|
||||||
<div class="card orders red text-white" data-id = "<%= order.order_id %>">
|
<div class="card orders red text-white" data-id = "<%= order.order_id %>">
|
||||||
<div class="card-block">
|
<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>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -676,34 +691,46 @@ $('#pay').on('click',function() {
|
|||||||
});
|
});
|
||||||
// Bill Request
|
// Bill Request
|
||||||
$('#request_bills').click(function() {
|
$('#request_bills').click(function() {
|
||||||
var order_id = $('#save_order_id').attr('data-order');
|
var lookup_split_bill = '<%= @spit_bill %>';
|
||||||
var ajax_url = "/origami/" + order_id + "/request_bills";
|
if(lookup_split_bill == '1'){
|
||||||
$.ajax({
|
swal({
|
||||||
|
title: "Alert",
|
||||||
|
text: "Are you sure, you want to Split bill?",
|
||||||
|
type: "warning",
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: "#DD6B55",
|
||||||
|
confirmButtonText: "Yes, split it!",
|
||||||
|
closeOnConfirm: false
|
||||||
|
}, function (isConfirm) {
|
||||||
|
if (isConfirm) {
|
||||||
|
var dining_id = "<%= @room.id %>";
|
||||||
|
window.location.href = '/origami/room/' + dining_id + "/split_bills";
|
||||||
|
}else{
|
||||||
|
requestBillProcess();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
requestBillProcess();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
function requestBillProcess(){
|
||||||
|
var order_id = $('#save_order_id').attr('data-order');
|
||||||
|
var ajax_url = "/origami/" + order_id + "/request_bills";
|
||||||
|
$.ajax({
|
||||||
type: "GET",
|
type: "GET",
|
||||||
url: ajax_url,
|
url: ajax_url,
|
||||||
// data: 'order_id='+ order_id,
|
// data: 'order_id='+ order_id,
|
||||||
success:function(result){
|
success: function (result) {
|
||||||
if(!result.status){
|
if (!result.status) {
|
||||||
$.confirm({
|
swal("Information!", result.error_message);
|
||||||
title: 'Information!',
|
|
||||||
content: result.error_message,
|
|
||||||
buttons: {
|
|
||||||
confirm: {
|
|
||||||
text: 'Ok',
|
|
||||||
btnClass: 'btn-green',
|
|
||||||
action: function(){
|
|
||||||
window.location.href = '/origami';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
location.reload();
|
location.reload();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
|
|
||||||
$('#move').on('click',function(){
|
$('#move').on('click',function(){
|
||||||
var dining_id = "<%= @room.id %>"
|
var dining_id = "<%= @room.id %>"
|
||||||
|
|||||||
@@ -221,7 +221,8 @@ scope "(:locale)", locale: /en|mm/ do
|
|||||||
post "bank_integration/sale_trans", to: "bank_integration#sale_trans", as:"sale_trans"
|
post "bank_integration/sale_trans", to: "bank_integration#sale_trans", as:"sale_trans"
|
||||||
|
|
||||||
#split bill
|
#split bill
|
||||||
get '/table/:dining_id/split_bills' => 'split_bill#index', as:'split_bill_index'
|
get '/table/:dining_id/split_bills' => 'split_bill#index'
|
||||||
|
get '/room/:dining_id/split_bills' => 'split_bill#index'
|
||||||
post '/split_bills', to: 'split_bill#create', as:"order_item_split_bills"
|
post '/split_bills', to: 'split_bill#create', as:"order_item_split_bills"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user