check order reservation
This commit is contained in:
@@ -34,6 +34,9 @@ App.check_new_order = App.cable.subscriptions.create('CheckNewOrderChannel', {
|
||||
swal.close();
|
||||
}
|
||||
});
|
||||
// $("#notify_new_orderLabel").text("You have new orders.");
|
||||
// $("#notify_new_orderBody").text("Are you accept or reject for these orders <b>"+order_lists+"</b>?");
|
||||
// $("#notify_new_order").modal({show: true, keyboard: false, backdrop: false});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -34,6 +34,10 @@ App.check_order_ready_to_delivery = App.cable.subscriptions.create('CheckOrderRe
|
||||
swal.close();
|
||||
}
|
||||
});
|
||||
|
||||
// $("#notify_order_ready_to_deliveryLabel").text("You have orders that are ready to deliver.");
|
||||
// $("#notify_order_ready_to_deliveryBody").text("Could you ready these orders <b>"+order_lists+"</b> to deliver?");
|
||||
// $("#notify_order_ready_to_delivery").modal({show: true, keyboard: false, backdrop: false});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -34,6 +34,9 @@ App.check_order_send_to_kitchen = App.cable.subscriptions.create('CheckOrderSend
|
||||
swal.close();
|
||||
}
|
||||
});
|
||||
// $("#notify_order_send_to_kitchenLabel").text("You have to send order to kitchen.");
|
||||
// $("#notify_order_send_to_kitchenBody").text("Could you send these orders <b>"+order_lists+"</b> to kitchen?");
|
||||
// $("#notify_order_send_to_kitchen").modal({show: true, keyboard: false, backdrop: false});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -294,6 +294,8 @@ function showNewOrder(order_reservation){
|
||||
var date = new Date(order_reservation.requested_time);
|
||||
var time = timeFormat(date);
|
||||
var requested_date = date.getFullYear() + '-' + (date.getMonth() > 10? date.getMonth() : '0' + (date.getMonth() + 1)) +'-'+ (date.getDate() > 10? date.getDate() : '0' + date.getDate()) +' '+time;
|
||||
var audio = new Audio('/beep-07.wav'); // define your audio
|
||||
audio.play();
|
||||
swal({
|
||||
html: true,
|
||||
title: 'Information',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class Reports::OrderReservationController < BaseReportController
|
||||
# authorize_resource :class => false
|
||||
def index
|
||||
@payments = [["All Payment",''], ["Cash Payment","cash"], ["Credit Payment","creditnote"], ["FOC Payment","foc"], ["Other Payment","card"]]
|
||||
@providers = [["All",''], ["food2u","food2u"], ["Self Pick-Up","pick_up"], ["Ygndoor2door","ygndoor2door"], ["Direct Delivery","direct_delivery"]]
|
||||
|
||||
from, to = get_date_range_from_params
|
||||
|
||||
@@ -17,8 +17,9 @@ class Reports::OrderReservationController < BaseReportController
|
||||
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at = ? ',shift_sale.shift_started_at, shift_sale.shift_closed_at)
|
||||
end
|
||||
end
|
||||
payment_type = params[:payment_type]
|
||||
@sale_data = Sale.get_sales_by_order_reservation(@shift_sale_range,@shift,from,to,payment_type)
|
||||
|
||||
provider = params[:provider]
|
||||
@sale_data = OrderReservation.get_order_reservation_by_shift(@shift_sale_range,@shift,from,to,provider)
|
||||
@from = from
|
||||
@to = to
|
||||
# get printer info
|
||||
@@ -40,7 +41,7 @@ class Reports::OrderReservationController < BaseReportController
|
||||
def show
|
||||
from, to = get_date_range_from_params
|
||||
|
||||
@sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED)
|
||||
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
|
||||
|
||||
date_arr = Array.new
|
||||
@sale_data.each do |sale|
|
||||
|
||||
@@ -237,6 +237,34 @@ class OrderReservation < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
def self.get_order_reservation_by_shift(shift_sale_range,shift,from,to,provider)
|
||||
## => left join -> show all sales although no orders
|
||||
if provider.blank?
|
||||
provider = ''
|
||||
else
|
||||
if provider.present?
|
||||
provider = " and deliveries.provider = '#{provider}'"
|
||||
end
|
||||
end
|
||||
|
||||
query = OrderReservation.joins(" JOIN deliveries on deliveries.order_reservation_id = order_reservations.order_reservation_id")
|
||||
.joins(" JOIN sales on sales.sale_id = order_reservations.sale_id")
|
||||
if shift.present?
|
||||
query = query.where("sales.shift_sale_id in (?) #{provider} and sales.sale_status= 'completed' and sale_payments.payment_amount != 0", shift.to_a)
|
||||
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
|
||||
.group("sales.sale_id")
|
||||
elsif shift_sale_range.present?
|
||||
query = query.where("sales.sale_status='completed' #{provider} and sale_payments.payment_amount != 0 and sales.shift_sale_id in (?)",shift_sale_range.to_a)
|
||||
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
|
||||
.group("sales.sale_id")
|
||||
else
|
||||
query = query.where("sales.sale_status='completed' and sales.receipt_date between ? and ? #{provider} and sale_payments.payment_amount != 0",from,to)
|
||||
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
|
||||
.group("sales.sale_id")
|
||||
end
|
||||
return query
|
||||
end
|
||||
|
||||
private
|
||||
def generate_custom_id
|
||||
self.order_reservation_id = SeedGenerator.generate_id(self.class.name, "ODRS")
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -409,6 +409,66 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <div class="modal fade hidden" 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" id="notify_new_orderLabel"></h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<span id="notify_new_orderBody"></span>
|
||||
</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 hidden" 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" id="notify_order_send_to_kitchenLabel"></h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<span id="notify_order_send_to_kitchenBody"></span>
|
||||
</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 hidden" 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" id="notify_order_ready_to_deliveryLabel"></h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<span id="notify_order_ready_to_deliveryBody"></span>
|
||||
</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 id="notify_new_order"></div>
|
||||
<div id="notify_order_send_to_kitchen"></div>
|
||||
<div id="notify_order_ready_to_delivery"></div>
|
||||
|
||||
@@ -18,10 +18,10 @@
|
||||
<option value="9">Last year</option>
|
||||
</select>
|
||||
</div>
|
||||
<% if defined? payments %>
|
||||
<% if defined? provider %>
|
||||
<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" %>
|
||||
<%= 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">
|
||||
@@ -58,26 +58,6 @@
|
||||
$('#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%>
|
||||
@@ -91,7 +71,6 @@
|
||||
$("#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');
|
||||
@@ -105,24 +84,4 @@
|
||||
$(".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>
|
||||
|
||||
@@ -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>
|
||||
@@ -42,102 +42,11 @@
|
||||
<% 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("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 %>
|
||||
|
||||
<% 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 %>
|
||||
|
||||
<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>
|
||||
</tr>
|
||||
|
||||
<% end %>
|
||||
<tr style="border-top:4px double #666;">
|
||||
<td colspan="2"> </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"> </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 +60,7 @@
|
||||
var check_arr = [];
|
||||
search_by_period();
|
||||
$('#sel_period').change(function(){
|
||||
|
||||
search_by_period();
|
||||
|
||||
});
|
||||
|
||||
function search_by_period(){
|
||||
@@ -216,7 +123,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){
|
||||
|
||||
|
||||
@@ -470,6 +470,7 @@ en:
|
||||
adult: "Adult"
|
||||
foreigner: "Foreigner"
|
||||
local: "Local"
|
||||
order_reservation_report: "Order Reservation"
|
||||
|
||||
code_txt: "code "
|
||||
charge_txt: "charge"
|
||||
|
||||
@@ -464,6 +464,7 @@ mm:
|
||||
adult: "လူကြီး"
|
||||
foreigner: "နိုင်ငံခြားသား"
|
||||
local: "နိုင်ငံသား"
|
||||
order_reservation_report: "ၾကိဳတင္ order မွာယူျခင္း"
|
||||
|
||||
code_txt: "ကုတ်ဒ် "
|
||||
charge_txt: "ကောက်ခံသည်"
|
||||
|
||||
@@ -445,6 +445,7 @@ scope "(:locale)", locale: /en|mm/ do
|
||||
resources :order_reservation, :only => [:index, :show]
|
||||
get "saleitem/get_shift_by_date", to: "saleitem#show", as: "get_shift_by_sale_item"
|
||||
get "receipt_no/get_shift_by_date", to: "receipt_no#get_shift_by_date", as: "get_shift_by_date"
|
||||
get "order_reservation/get_shift_by_date", to: "order_reservation#show", as: "get_shift_by_order_reservation"
|
||||
|
||||
end
|
||||
|
||||
|
||||
BIN
public/beep-07.wav
Normal file
BIN
public/beep-07.wav
Normal file
Binary file not shown.
Reference in New Issue
Block a user