Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant
This commit is contained in:
@@ -19,21 +19,7 @@ App.check_new_order = App.cable.subscriptions.create('CheckNewOrderChannel', {
|
||||
});
|
||||
|
||||
// alert(order_lists);
|
||||
// swal({
|
||||
// title: 'Information',
|
||||
// target: document.getElementById(shop_code+"_notify_new_order"),
|
||||
// text: "You have new orders <br/>"+
|
||||
// "Are you accept or reject for these orders <b>"+order_lists+"</b>?",
|
||||
// type: 'success',
|
||||
// html: true,
|
||||
// closeOnConfirm: false,
|
||||
// closeOnCancel: false,
|
||||
// allowOutsideClick: false
|
||||
// }, function (isConfirm) {
|
||||
// if(isConfirm){
|
||||
// swal.close();
|
||||
// }
|
||||
// });
|
||||
checkNewOrderAlert(shop_code, order_lists);
|
||||
// $("#notify_new_order_lists").text(order_lists);
|
||||
// if($("#"+shop_code+"_notify_new_order").hasClass("hidden")){
|
||||
// $("#"+shop_code+"_notify_new_order").removeClass("hidden");
|
||||
|
||||
@@ -19,21 +19,7 @@ App.check_order_ready_to_delivery = App.cable.subscriptions.create('CheckOrderRe
|
||||
});
|
||||
|
||||
// alert(order_lists);
|
||||
// swal({
|
||||
// title: 'Information',
|
||||
// target: document.getElementById(shop_code+"_notify_order_ready_to_delivery"),
|
||||
// text: "You have orders that are ready to deliver <br/>"+
|
||||
// "Could you ready these orders <b>"+order_lists+"</b> to deliver?",
|
||||
// type: 'success',
|
||||
// html: true,
|
||||
// closeOnConfirm: false,
|
||||
// closeOnCancel: false,
|
||||
// allowOutsideClick: false
|
||||
// }, function (isConfirm) {
|
||||
// if(isConfirm){
|
||||
// swal.close();
|
||||
// }
|
||||
// });
|
||||
checkOrderReadyToKitchenAlert(shop_code, order_lists);
|
||||
// $("#notify_order_ready_to_delivery_lists").text(order_lists);
|
||||
// if($("#notify_order_ready_to_delivery").hasClass("hidden")){
|
||||
// $("#"+shop_code+"_notify_order_ready_to_delivery").removeClass("hidden");
|
||||
|
||||
@@ -19,21 +19,7 @@ App.check_order_send_to_kitchen = App.cable.subscriptions.create('CheckOrderSend
|
||||
});
|
||||
|
||||
// alert(order_lists);
|
||||
// swal({
|
||||
// title: 'Information',
|
||||
// target: document.getElementById(shop_code+"_notify_order_send_to_kitchen"),
|
||||
// text: "You have to send order to kitchen <br/>"+
|
||||
// "Could you send these orders <b>"+order_lists+"</b> to kitchen?",
|
||||
// type: 'success',
|
||||
// html: true,
|
||||
// closeOnConfirm: false,
|
||||
// closeOnCancel: false,
|
||||
// allowOutsideClick: false
|
||||
// }, function (isConfirm) {
|
||||
// if(isConfirm){
|
||||
// swal.close();
|
||||
// }
|
||||
// });
|
||||
checkOrderSendToKitchen(shop_code, order_lists);
|
||||
// $("#notify_order_send_to_kitchen_lists").text(order_lists);
|
||||
// if($("#notify_order_send_to_kitchen").hasClass("hidden")){
|
||||
// $("#"+shop_code+"_notify_order_send_to_kitchen").removeClass("hidden");
|
||||
|
||||
@@ -42,6 +42,15 @@ $(document).ready(function() {
|
||||
railBorderRadius: '0',
|
||||
touchScrollStep : 50
|
||||
});
|
||||
$('#menu1-slimscroll').slimScroll({
|
||||
height: height-$('#menu1-slimscroll').attr('data-height'),
|
||||
size: '5px',
|
||||
color: 'rgba(0,0,0,0.5)',
|
||||
alwaysVisible: false,
|
||||
borderRadius: '0',
|
||||
railBorderRadius: '0',
|
||||
touchScrollStep : 50
|
||||
});
|
||||
|
||||
$('#modal-slimscroll').slimScroll({
|
||||
height: height-$('#modal-slimscroll').attr('data-height'),
|
||||
@@ -148,3 +157,12 @@ $(document).ready(function() {
|
||||
}
|
||||
//end Notificaiotn message
|
||||
});
|
||||
|
||||
function audioPlayBackground(shop_code){
|
||||
//audio play
|
||||
var audio = new Audio('/'+shop_code+'-beep.mp3'); // define your audio
|
||||
// setTimeout(function(){
|
||||
// audio.loop = true;
|
||||
audio.play();
|
||||
// },10000);
|
||||
}
|
||||
|
||||
@@ -265,6 +265,7 @@ function show_order_detail(url,sr_no){
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
// console.log(data);
|
||||
$("#order_remark").text("");
|
||||
$(".tbl_customer").show();
|
||||
if(data.status != "delivered"){
|
||||
$('#accepted').show();
|
||||
@@ -482,46 +483,81 @@ function showNewOrder(order_reservation,shop_code){
|
||||
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;
|
||||
//audio play
|
||||
var audio = new Audio('/'+shop_code+'-beep.mp3'); // define your audio
|
||||
// setTimeout(function(){
|
||||
// audio.loop = true;
|
||||
audio.play();
|
||||
// },10000);
|
||||
$('.first-1').click();
|
||||
audioPlayBackground(shop_code);
|
||||
|
||||
// $("#new_order").text(order_reservation.order_reservation_id);
|
||||
// $("#new_order_date").text(requested_date);
|
||||
// if($("#"+shop_code+"_doemal_new_order").hasClass("hidden")){
|
||||
// $("#"+shop_code+"_doemal_new_order").removeClass("hidden");
|
||||
// }
|
||||
// $("#"+shop_code+"_doemal_new_order").on('shown.bs.modal', function(e){
|
||||
// // $(document).off('focusin.modal');
|
||||
// $("#"+shop_code+"_doemal_new_order").focus();
|
||||
// $("#"+shop_code+"_notify_new_order").addClass("hidden");
|
||||
// $("#"+shop_code+"_notify_order_send_to_kitchen").addClass("hidden");
|
||||
// $("#"+shop_code+"_notify_order_ready_to_delivery").addClass("hidden");
|
||||
// }).on('hide.bs.modal', function (e) {
|
||||
// $("#"+shop_code+"_doemal_new_order").addClass("hidden");
|
||||
// }).modal({show: true, keyboard: false, backdrop: false});
|
||||
// swal({
|
||||
// title: 'Information',
|
||||
// target: document.getElementById(shop_code+"_notify_new_order"),
|
||||
// text: "You have new order "+
|
||||
// "<b>"+order_reservation.order_reservation_id+"</b> requested for "+requested_date+"?",
|
||||
// type: 'success',
|
||||
// html: true,
|
||||
// closeOnConfirm: false,
|
||||
// closeOnCancel: false,
|
||||
// allowOutsideClick: false
|
||||
// }, function (isConfirm) {
|
||||
// if(isConfirm){
|
||||
// audio.pause();
|
||||
// swal.close();
|
||||
// }
|
||||
// });
|
||||
swal({
|
||||
title: 'Information',
|
||||
target: document.getElementById(shop_code+"_notify_new_order"),
|
||||
text: "You have new order "+
|
||||
"<b>"+order_reservation.order_reservation_id+"</b> requested for "+requested_date+"?",
|
||||
type: 'success',
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function (isConfirm) {
|
||||
if(isConfirm){
|
||||
swal.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function checkNewOrderAlert(shop_code, order_lists){
|
||||
swal({
|
||||
title: 'Information',
|
||||
target: document.getElementById(shop_code+"_notify_new_order"),
|
||||
text: "You have new orders <br/>"+
|
||||
"Are you accept or reject for these orders <b>"+order_lists+"</b>?",
|
||||
type: 'success',
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function (isConfirm) {
|
||||
if(isConfirm){
|
||||
swal.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function checkOrderSendToKitchen(shop_code, order_lists){
|
||||
swal({
|
||||
title: 'Information',
|
||||
target: document.getElementById(shop_code+"_notify_order_send_to_kitchen"),
|
||||
text: "You have to send order to kitchen <br/>"+
|
||||
"Could you send these orders <b>"+order_lists+"</b> to kitchen?",
|
||||
type: 'success',
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function (isConfirm) {
|
||||
if(isConfirm){
|
||||
swal.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function checkOrderReadyToKitchenAlert(shop_code, order_lists){
|
||||
swal({
|
||||
title: 'Information',
|
||||
target: document.getElementById(shop_code+"_notify_order_ready_to_delivery"),
|
||||
text: "You have orders that are ready to deliver <br/>"+
|
||||
"Could you ready these orders <b>"+order_lists+"</b> to deliver?",
|
||||
type: 'success',
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function (isConfirm) {
|
||||
if(isConfirm){
|
||||
swal.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getOrderMonth(month){
|
||||
var MONTHS = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sept","Oct","Nov","Dec"];
|
||||
return MONTHS[month];
|
||||
|
||||
@@ -18,7 +18,7 @@ class Api::OrderReserve::OrderReservationController < Api::ApiController
|
||||
end
|
||||
|
||||
if status
|
||||
check_customer = Customer.find_by_email_and_membership_id(params[:email],params[:membership_id])
|
||||
check_customer = Customer.find_by_email_and_membership_id_and_customer_type(params[:email],params[:membership_id],'Doemal')
|
||||
if !check_customer.nil?
|
||||
customer_id = check_customer.customer_id
|
||||
else
|
||||
|
||||
@@ -18,8 +18,8 @@ class Api::SurveyController < Api::ApiController
|
||||
cashier_zone = CashierTerminalByZone.find_by_zone_id(dining_facility.zone_id)
|
||||
shift_by_terminal = ShiftSale.find_by_cashier_terminal_id_and_shift_closed_at(cashier_zone.cashier_terminal_id,nil)
|
||||
|
||||
if params[:survey_id]
|
||||
survey = Survey.find(params[:survey_id])
|
||||
if params[:id]
|
||||
survey = Survey.find(params[:id])
|
||||
else
|
||||
survey = Survey.new
|
||||
end
|
||||
|
||||
@@ -39,8 +39,10 @@ class Oqs::EditController < BaseOqsController
|
||||
if ENV["SERVER_MODE"] != "cloud" && order.source == 'cashier' #no print in cloud server
|
||||
# print
|
||||
assigned_item = AssignedOrderItem.find_by_instance_code(order_item.item_instance_code)
|
||||
assigned_items = AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'")
|
||||
|
||||
assigned_items = nil
|
||||
if !assigned_item.nil?
|
||||
assigned_items = AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'")
|
||||
end
|
||||
if !assigned_items.nil?
|
||||
assigned_items.each do |assign_item|
|
||||
# order queue stations
|
||||
|
||||
@@ -8,10 +8,34 @@ class Origami::CashInsController < BaseOrigamiController
|
||||
amount = params[:amount]
|
||||
payment_method = params[:payment_method]
|
||||
payment_method_reference = params[:payment_method_reference]
|
||||
type = params[:type]
|
||||
p_jour = PaymentJournal.new
|
||||
p_jour.cash_in(reference, remark, amount, payment_method, payment_method_reference, current_user.id)
|
||||
shift = ShiftSale.current_open_shift(current_user.id)
|
||||
shift.cash_in = shift.cash_in + amount.to_i
|
||||
|
||||
current_shift = ShiftSale.current_shift
|
||||
|
||||
# set cashier
|
||||
if shift != nil
|
||||
shift = shift
|
||||
else
|
||||
open_cashier = Employee.where("role = 'cashier' AND token_session <> ''")
|
||||
if open_cashier.count>0
|
||||
|
||||
shift = ShiftSale.current_open_shift(open_cashier[0].id)
|
||||
|
||||
if shift
|
||||
shift = ShiftSale.current_open_shift(shift.id)
|
||||
else
|
||||
shift = ShiftSale.current_open_shift(current_shift.id)
|
||||
end
|
||||
else
|
||||
shift = Employee.find(current_shift.employee_id).name
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
shift.cash_in = shift.cash_in + amount.to_f
|
||||
shift.save
|
||||
end
|
||||
|
||||
|
||||
@@ -9,6 +9,28 @@ class Origami::CashOutsController < BaseOrigamiController
|
||||
p_jour = PaymentJournal.new
|
||||
p_jour.cash_out(reference, remark, amount, current_user.id)
|
||||
shift = ShiftSale.current_open_shift(current_user.id)
|
||||
|
||||
current_shift = ShiftSale.current_shift
|
||||
|
||||
# set cashier
|
||||
if shift != nil
|
||||
shift = shift
|
||||
else
|
||||
open_cashier = Employee.where("role = 'cashier' AND token_session <> ''")
|
||||
if open_cashier.count>0
|
||||
|
||||
shift = ShiftSale.current_open_shift(open_cashier[0].id)
|
||||
|
||||
if shift
|
||||
shift = ShiftSale.current_open_shift(shift.id)
|
||||
else
|
||||
shift = ShiftSale.current_open_shift(current_shift.id)
|
||||
end
|
||||
else
|
||||
shift = Employee.find(current_shift.employee_id).name
|
||||
|
||||
end
|
||||
end
|
||||
shift.cash_out = shift.cash_out + amount.to_i
|
||||
shift.save
|
||||
end
|
||||
|
||||
@@ -6,7 +6,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
def first_bill
|
||||
sale_id = params[:sale_id] # sale_id
|
||||
sale_data = Sale.find_by_sale_id(sale_id)
|
||||
sale_items = SaleItem.unscoped.select("sale_id,product_code,item_instance_code,product_name,product_alt_name,account_id,status,remark,SUM(qty) as qty,SUM(unit_price) as unit_price,SUM(taxable_price) as taxable_price,SUM(price) as price,is_taxable").where("sale_id=?",sale_id).group("item_instance_code,unit_price")
|
||||
sale_items = SaleItem.get_all_sale_items(sale_id)
|
||||
member_info = nil
|
||||
|
||||
# For Cashier by Zone
|
||||
@@ -99,7 +99,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
|
||||
if(Sale.exists?(sale_id))
|
||||
saleObj = Sale.find(sale_id)
|
||||
sale_items = SaleItem.unscoped.select("sale_id,product_code,item_instance_code,product_name,product_alt_name,account_id,status,remark,SUM(qty) as qty,SUM(unit_price) as unit_price,SUM(taxable_price) as taxable_price,SUM(price) as price,is_taxable").where("sale_id=?",sale_id).group("item_instance_code,unit_price")
|
||||
sale_items = SaleItem.get_all_sale_items(sale_id)
|
||||
shop_details = Shop.first
|
||||
# rounding adjustment
|
||||
if shop_details.is_rounding_adj
|
||||
@@ -335,10 +335,13 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
end
|
||||
|
||||
@sale_data.sale_payments.each do |spay|
|
||||
if spay.payment_method == "cash"
|
||||
if spay.payment_method == "cash"
|
||||
@cash = spay.payment_amount
|
||||
end
|
||||
@other_payment += spay.payment_amount
|
||||
if spay.payment_method !="creditnote"
|
||||
@other_payment += spay.payment_amount
|
||||
end
|
||||
|
||||
if spay.payment_method == "mpu"
|
||||
@other += spay.payment_amount
|
||||
elsif spay.payment_method == "paypar"
|
||||
|
||||
@@ -62,7 +62,13 @@ class Origami::PendingOrderController < BaseOrigamiController
|
||||
@table_id = nil
|
||||
@dining = nil
|
||||
end
|
||||
end
|
||||
|
||||
def cash_ins
|
||||
render "origami/cash_ins/new"
|
||||
end
|
||||
def cash_outs
|
||||
render "origami/cash_outs/new"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -41,7 +41,7 @@ class Origami::SalesController < BaseOrigamiController
|
||||
end
|
||||
|
||||
# Re-compute for add
|
||||
saleobj.compute
|
||||
saleobj.compute(order.source)
|
||||
saleobj.save
|
||||
order.save
|
||||
booking.save
|
||||
|
||||
@@ -29,6 +29,7 @@ class Origami::VoidController < BaseOrigamiController
|
||||
end
|
||||
end
|
||||
|
||||
sale.rounding_adjustment = 0.0
|
||||
sale.payment_status = 'void'
|
||||
sale.sale_status = 'void'
|
||||
sale.save
|
||||
@@ -114,7 +115,8 @@ class Origami::VoidController < BaseOrigamiController
|
||||
if customer.membership_id != nil && rebate
|
||||
member_info = Customer.get_member_account(customer)
|
||||
rebate_amount = Customer.get_membership_transactions(customer,sale.receipt_no)
|
||||
current_balance = SaleAudit.paymal_search(sale_id)
|
||||
# current_balance = SaleAudit.paymal_search(sale_id)
|
||||
current_balance = 0
|
||||
end
|
||||
|
||||
# get printer info
|
||||
|
||||
@@ -5,18 +5,25 @@ authorize_resource :class => false
|
||||
|
||||
from, to = get_date_range_from_params
|
||||
|
||||
@shift_sale_range = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED)
|
||||
@shift_sale_range = ''
|
||||
|
||||
@shift = ''
|
||||
if params[:shift_name].to_i != 0
|
||||
shift_sale = ShiftSale.find(params[:shift_name])
|
||||
if to.blank?
|
||||
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL ',shift_sale.shift_started_at)
|
||||
else
|
||||
|
||||
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at = ? ',shift_sale.shift_started_at, shift_sale.shift_closed_at)
|
||||
@shift_sale_range = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
|
||||
|
||||
@shift_sale = ShiftSale.find(params[:shift_name])
|
||||
if to.blank?
|
||||
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL ',@shift_sale.shift_started_at)
|
||||
else
|
||||
if @shift_sale.shift_closed_at.blank?
|
||||
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL',@shift_sale.shift_started_at)
|
||||
else
|
||||
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at = ? ',@shift_sale.shift_started_at, @shift_sale.shift_closed_at)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
payment_type = params[:payment_type]
|
||||
@sale_data = Sale.get_shift_sales_by_receipt_no(@shift_sale_range,@shift,from,to,payment_type)
|
||||
@sale_taxes = Sale.get_separate_tax(@shift_sale_range,@shift,from,to,payment_type)
|
||||
@@ -42,18 +49,18 @@ authorize_resource :class => false
|
||||
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|
|
||||
local_opening_date = sale.opening_date.nil? ? '-' : sale.opening_date.utc.getlocal.strftime("%e %b %I:%M%p")
|
||||
local_closing_date = sale.closing_date.nil? ? '-' : sale.closing_date.utc.getlocal.strftime("%e %b %I:%M%p")
|
||||
opening_date = sale.opening_date.nil? ? '-' : sale.opening_date.utc
|
||||
closing_date = sale.closing_date.nil? ? '-' : sale.closing_date.utc
|
||||
shift_id = sale.id.nil? ? '-' : sale.id
|
||||
str = {:shift_id => shift_id, :local_opening_date => local_opening_date, :local_closing_date => local_closing_date, :opening_date => opening_date, :closing_date => closing_date}
|
||||
date_arr.push(str)
|
||||
end
|
||||
date_arr = Array.new
|
||||
@sale_data.each do |sale|
|
||||
local_opening_date = sale.opening_date.nil? ? '-' : sale.opening_date.utc.getlocal.strftime("%e %b %I:%M%p")
|
||||
local_closing_date = sale.closing_date.nil? ? '-' : sale.closing_date.utc.getlocal.strftime("%e %b %I:%M%p")
|
||||
opening_date = sale.opening_date.nil? ? '-' : sale.opening_date.utc
|
||||
closing_date = sale.closing_date.nil? ? '-' : sale.closing_date.utc
|
||||
shift_id = sale.id.nil? ? '-' : sale.id
|
||||
str = {:shift_id => shift_id, :local_opening_date => local_opening_date, :local_closing_date => local_closing_date, :opening_date => opening_date, :closing_date => closing_date}
|
||||
date_arr.push(str)
|
||||
end
|
||||
|
||||
out = {:status => 'ok', :message => date_arr}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ class Reports::ShiftsaleController < 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|
|
||||
|
||||
@@ -285,13 +285,18 @@ class Order < ApplicationRecord
|
||||
|
||||
#Process order items and send to order queue
|
||||
def process_order_queue
|
||||
if ENV["SERVER_MODE"] != 'cloud'
|
||||
print_status = nil
|
||||
cup_status = nil
|
||||
|
||||
#Send to background job for processing
|
||||
order = Order.find(self.id)
|
||||
cup_status = `#{"sudo service cups status"}`
|
||||
print_status = check_cup_status(cup_status)
|
||||
sidekiq = Lookup.find_by_lookup_type("sidekiq")
|
||||
|
||||
|
||||
if ENV["SERVER_MODE"] != 'cloud'
|
||||
cup_status = `#{"sudo service cups status"}`
|
||||
print_status = check_cup_status(cup_status)
|
||||
end
|
||||
|
||||
if print_status
|
||||
if !sidekiq.nil?
|
||||
OrderQueueProcessorJob.perform_later(self.id, self.table_id)
|
||||
@@ -304,9 +309,11 @@ class Order < ApplicationRecord
|
||||
# ActionCable.server.broadcast "order_queue_station_channel",order: assign_order
|
||||
end
|
||||
else
|
||||
cup_start = `#{"sudo service cups start"}`
|
||||
cup_status = `#{"sudo service cups status"}`
|
||||
print_status = check_cup_status(cup_status)
|
||||
if ENV["SERVER_MODE"] != 'cloud'
|
||||
cup_start = `#{"sudo service cups start"}`
|
||||
cup_status = `#{"sudo service cups status"}`
|
||||
print_status = check_cup_status(cup_status)
|
||||
end
|
||||
|
||||
if print_status
|
||||
if !sidekiq.nil?
|
||||
@@ -320,33 +327,28 @@ class Order < ApplicationRecord
|
||||
# ActionCable.server.broadcast "order_queue_station_channel",order: assign_order
|
||||
end
|
||||
else
|
||||
msg = ' Print Error ! Please contact to service'
|
||||
#if ENV["SERVER_MODE"] != 'cloud'
|
||||
if ENV["SERVER_MODE"] != 'cloud'
|
||||
|
||||
msg = ' Print Error ! Please contact to service'
|
||||
ActionCable.server.broadcast "call_waiter_channel",table: msg,time:'print_error'
|
||||
#end
|
||||
if !sidekiq.nil?
|
||||
end
|
||||
if !sidekiq.nil?
|
||||
OrderQueueProcessorJob.perform_later(self.id, self.table_id)
|
||||
else
|
||||
if order
|
||||
oqs = OrderQueueStation.new
|
||||
oqs.process_order(order, self.table_id, self.source)
|
||||
end
|
||||
# assign_order = AssignedOrderItem.assigned_order_item_by_job(self.id)
|
||||
# ActionCable.server.broadcast "order_queue_station_channel",order: assign_order
|
||||
end
|
||||
else
|
||||
if order
|
||||
oqs = OrderQueueStation.new
|
||||
oqs.process_order(order, self.table_id, self.source)
|
||||
end
|
||||
assign_order = AssignedOrderItem.assigned_order_item_by_job(self.id)
|
||||
ActionCable.server.broadcast "order_queue_station_channel",order: assign_order
|
||||
end
|
||||
end
|
||||
end
|
||||
assign_order = AssignedOrderItem.assigned_order_item_by_job(self.id)
|
||||
#if ENV["SERVER_MODE"] != 'cloud'
|
||||
ActionCable.server.broadcast "order_queue_station_channel",order: assign_order
|
||||
#end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
#Process order items and send to order queue
|
||||
def self.pay_process_order_queue(id,table_id)
|
||||
if ENV["SERVER_MODE"] != 'cloud'
|
||||
# if ENV["SERVER_MODE"] != 'cloud'
|
||||
sidekiq = Lookup.find_by_lookup_type("sidekiq")
|
||||
if !sidekiq.nil?
|
||||
OrderQueueProcessorJob.perform_later(id, table_id)
|
||||
@@ -359,7 +361,7 @@ class Order < ApplicationRecord
|
||||
assign_order = AssignedOrderItem.assigned_order_item_by_job(id)
|
||||
ActionCable.server.broadcast "order_queue_station_channel",order: assign_order
|
||||
end
|
||||
end
|
||||
# end
|
||||
end
|
||||
|
||||
def check_cup_status(status)
|
||||
|
||||
@@ -30,10 +30,19 @@ class OrderReservation < ApplicationRecord
|
||||
customer.address = params[:address] ? params[:address] : ''
|
||||
customer.date_of_birth = params[:date_of_birth] ? Time.parse(params[:date_of_birth]).strftime("%Y-%m-%d") : ''
|
||||
customer.membership_id = params[:membership_id]
|
||||
customer.customer_type = "Takeaway"
|
||||
customer.customer_type = "Doemal"
|
||||
customer.tax_profiles = ["2"]
|
||||
customer.save
|
||||
|
||||
# unless customer.valid?
|
||||
# render json: {
|
||||
# status: 422,
|
||||
# message: "Validation error",
|
||||
# errors: customer.errors
|
||||
# }.to_json
|
||||
# return
|
||||
# end
|
||||
|
||||
return customer
|
||||
end
|
||||
|
||||
@@ -62,7 +71,7 @@ class OrderReservation < ApplicationRecord
|
||||
end
|
||||
if order_reserve[:reservation_info]
|
||||
order_reservation.total_customer = order_reserve[:reservation_info][:total_user]
|
||||
order_reservation.order_remark = order_reserve[:reservation_info][:reservation_note]
|
||||
# order_reservation.order_remark = order_reserve[:reservation_info][:reservation_note]
|
||||
end
|
||||
order_reservation.save!
|
||||
if order_reserve[:order_info][:items]
|
||||
|
||||
@@ -752,7 +752,7 @@ def self.daily_sales_list(from,to)
|
||||
SUM(case when (sale_payments.payment_method='cash') then sale_payments.payment_amount else 0 end) as cash_amount,
|
||||
SUM(case when (sale_payments.payment_method='creditnote') then sale_payments.payment_amount else 0 end) as credit_amount,
|
||||
SUM(case when (sale_payments.payment_method='foc') then sale_payments.payment_amount else 0 end) as foc_amount")
|
||||
.joins("join (select * from sale_payments group by sale_payments.sale_id, sale_payments.payment_method) sale_payments on sale_payments.sale_id = sales.sale_id")
|
||||
.joins(" left join sale_payments on sale_payments.sale_id = sales.sale_id")
|
||||
.where("sale_status = ? AND sales.receipt_date between ? and ? ", 'completed', from, to)
|
||||
.group("DATE_FORMAT((CONVERT_TZ(sales.receipt_date,'+00:00','+06:30')),'%Y-%m-%d')")
|
||||
|
||||
@@ -2692,6 +2692,7 @@ end
|
||||
query = query.joins("join sale_orders as sale_orders on sale_orders.sale_id = sales.sale_id")
|
||||
.joins("join orders as orders on orders.order_id = sale_orders.order_id")
|
||||
query = query.where("sales.sale_status != 'new' AND orders.status = 'billed' AND orders.source =? ","quick_service")
|
||||
query = query.where("DATE_FORMAT(sales.created_at,'%Y-%m-%d') = ? ",DateTime.now.strftime('%Y-%m-%d'))
|
||||
.group("sales.sale_id")
|
||||
end
|
||||
|
||||
|
||||
@@ -161,6 +161,20 @@ class SaleItem < ApplicationRecord
|
||||
# return price
|
||||
# end
|
||||
|
||||
def self.get_all_sale_items(sale_id)
|
||||
sale_items = SaleItem.select("sale_id,product_code,item_instance_code,
|
||||
product_name,product_alt_name,account_id,status,remark,
|
||||
(CASE WHEN qty > 0 AND remark IS NULL THEN SUM(qty) ELSE qty END) as qty,
|
||||
unit_price,
|
||||
taxable_price,
|
||||
(CASE WHEN price > 0 AND remark IS NULL THEN SUM(price) ELSE price END) as price,
|
||||
is_taxable")
|
||||
.where("sale_id = ?",sale_id)
|
||||
.order("product_name asc")
|
||||
.group("status,product_name,item_instance_code,unit_price")
|
||||
return sale_items
|
||||
end
|
||||
|
||||
private
|
||||
def generate_custom_id
|
||||
self.sale_item_id = SeedGenerator.generate_id(self.class.name, "SLI")
|
||||
|
||||
@@ -207,7 +207,9 @@ class ReceiptBillA5Pdf < Prawn::Document
|
||||
# check for item not to show
|
||||
if item.price != 0
|
||||
sub_total += item.price #(item.qty*item.unit_price) - comment for room charges
|
||||
total_qty += item.qty
|
||||
if item.status != 'Discount' && item.qty > 0
|
||||
total_qty += item.qty
|
||||
end
|
||||
qty = item.qty
|
||||
total_price = item.price #item.qty*item.unit_price - comment for room charges
|
||||
price = item.unit_price
|
||||
|
||||
@@ -201,7 +201,9 @@ class ReceiptBillPdf < Prawn::Document
|
||||
# check for item not to show
|
||||
if item.price != 0
|
||||
sub_total += item.price #(item.qty*item.unit_price) - comment for room charges
|
||||
total_qty += item.qty
|
||||
if item.status != 'Discount' && item.qty > 0
|
||||
total_qty += item.qty
|
||||
end
|
||||
qty = item.qty
|
||||
total_price = item.price #item.qty*item.unit_price - comment for room charges
|
||||
price = item.unit_price
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
<%end%>
|
||||
</ul>
|
||||
</li>
|
||||
<div id="menu-slimscroll" data-height="0">
|
||||
<div id="menu1-slimscroll" data-height="0">
|
||||
<ul class="nav nav-tabs flex-column category_list" role="tablist" id="ul-navbar">
|
||||
<li class="nav-item product" data-ref="<%= origami_get_all_product_path %>">
|
||||
<a class="nav-link" data-toggle="tab" href="" role="tab">Products</a>
|
||||
@@ -499,30 +499,54 @@
|
||||
<div class="card-columns" style="column-count: 7;">
|
||||
<%zone.tables.each do |table| %>
|
||||
<% if table.status == 'occupied' %>
|
||||
<% if table.get_booking.nil? %>
|
||||
<% if table.get_checkout_booking.nil? %>
|
||||
<% color="red"%>
|
||||
<% else %>
|
||||
<% color="orange"%>
|
||||
<% end %>
|
||||
<% if table.get_booking.nil? %>
|
||||
<% if table.get_checkout_booking.nil? %>
|
||||
<% color="red"%>
|
||||
<% else %>
|
||||
<% color="orange"%>
|
||||
<% end %>
|
||||
|
||||
<% else %>
|
||||
<% if table.get_checkout_booking.nil? %>
|
||||
<% color="blue"%>
|
||||
<% else %>
|
||||
<% color="orange"%>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% if table.get_checkout_booking.nil? %>
|
||||
<% color="blue"%>
|
||||
<% else %>
|
||||
<% color="orange"%>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% color="green"%>
|
||||
<% color="green"%>
|
||||
<% end %>
|
||||
<div class="card tables <%=color%> text-white table_<%= table.id %>" data-id="<%= table.id %>" data-type="<%= table.type %>" data-name="<%= table.name %>">
|
||||
<div class="card-block">
|
||||
<%= table.name %>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<%end%>
|
||||
|
||||
<%zone.rooms.each do |table| %>
|
||||
<% if table.status == 'occupied' %>
|
||||
<% if table.get_booking.nil? %>
|
||||
<% if table.get_checkout_booking.nil? %>
|
||||
<% color="red"%>
|
||||
<% else %>
|
||||
<% color="orange"%>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% if table.get_checkout_booking.nil? %>
|
||||
<% color="blue"%>
|
||||
<% else %>
|
||||
<% color="orange"%>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% color="green"%>
|
||||
<% end %>
|
||||
<div class="card tables <%=color%> text-white table_<%= table.id %>" data-id="<%= table.id %>" data-type="<%= table.type %>" data-name="<%= table.name %>">
|
||||
<div class="card-block">
|
||||
<%= table.name %>
|
||||
</div>
|
||||
</div>
|
||||
<%end%>
|
||||
</div>
|
||||
<%end%>
|
||||
<div class="modal-footer p-r-30">
|
||||
|
||||
@@ -56,6 +56,9 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
cashier_type = window.location.href.indexOf("quick_service");
|
||||
console.log(cashier_type)
|
||||
|
||||
var payment_method = "";
|
||||
$('.payment-type').on('click',function(){
|
||||
$('.payment-type').css("background-color","#7a62d3")
|
||||
@@ -80,11 +83,19 @@
|
||||
url: "<%= origami_cash_ins_path %>",
|
||||
data: "reference="+ reference + "&remark=" + remark + "&amount="+ amount + "&payment_method="+payment_method + "&payment_method_reference="+ payment_method_reference,
|
||||
success:function(result){
|
||||
window.location.href = '/origami';
|
||||
if (cashier_type == -1) {
|
||||
window.location.href = '/origami';
|
||||
}else{
|
||||
window.location.href = '/origami/quick_service/pending_order';
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
$('#back').on('click',function(){
|
||||
window.location.href = '/origami';
|
||||
if (cashier_type == -1) {
|
||||
window.location.href = '/origami';
|
||||
}else{
|
||||
window.location.href = '/origami/quick_service/pending_order';
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
cashier_type = window.location.href.indexOf("quick_service");
|
||||
$('#cash_out').on('click',function(){
|
||||
var reference = $('#reference').val();
|
||||
var remark = $('#remark').val();
|
||||
@@ -33,12 +34,22 @@
|
||||
url: "<%= origami_cash_outs_path %>",
|
||||
data: "reference="+ reference + "&remark=" + remark + "&amount="+ amount,
|
||||
success:function(result){
|
||||
window.location.href = '/origami';
|
||||
|
||||
if (cashier_type == -1) {
|
||||
window.location.href = '/origami';
|
||||
}else{
|
||||
window.location.href = '/origami/quick_service/pending_order';
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
$('#back').on('click',function(){
|
||||
window.location.href = '/origami';
|
||||
cashier_type = window.location.href.indexOf("quick_service");
|
||||
if (cashier_type == -1) {
|
||||
window.location.href = '/origami';
|
||||
}else{
|
||||
window.location.href = '/origami/quick_service/pending_order';
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -122,6 +122,10 @@
|
||||
<input type="hidden" id="table_id" name="table_id" value="<%= @dining_facility.id %>" />
|
||||
<input type="hidden" id="type" name="type" value="<%= @dining_facility.type %>" />
|
||||
<input type="hidden" id="table_type" name="table_type" value="<%= @dining_facility.type %>" />
|
||||
<% elsif @cashier_type == 'quick_service' %>
|
||||
<input type="hidden" id="sale_id" name="sale_id" value="<%= @sale_id %>" />
|
||||
<input type="hidden" id="type" name="type" value="<%= @cashier_type %>" />
|
||||
<input type="hidden" id="page" name="page" value="<%= @page %>" />
|
||||
<%else%>
|
||||
<input type="hidden" id="table_id" name="table_id" value="" />
|
||||
<input type="hidden" id="type" name="type" value="" />
|
||||
|
||||
@@ -29,7 +29,9 @@ if (menu.menu_categories)
|
||||
|
||||
if category.menu_items
|
||||
json.items category.menu_items do |item|
|
||||
json.partial! 'origami/addorders/menu_item', item: item
|
||||
if item.is_available
|
||||
json.partial! 'origami/addorders/menu_item', item: item
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -463,10 +463,10 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div id="<%= @shop.shop_code ? @shop.shop_code : '' %>_doemal_new_order"></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 id="<%= @shop.shop_code ? @shop.shop_code : '' %>_notify_order_ready_to_delivery"></div>
|
||||
</div>
|
||||
|
||||
<p id="ref_no" class="hidden"></p>
|
||||
@@ -582,92 +582,3 @@
|
||||
</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 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="<%= @shop.shop_code ? @shop.shop_code : '' %>_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 notify_new_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="<%= @shop.shop_code ? @shop.shop_code : '' %>_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 notify_order_send_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="<%= @shop.shop_code ? @shop.shop_code : '' %>_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 notify_order_ready_close" data-value="<%= @shop.shop_code ? @shop.shop_code : '' %>" data-dismiss="modal">CLOSE</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<div class="container-fluid">
|
||||
`<div class="container-fluid">
|
||||
<div id="loading_wrapper" style="display:none;">
|
||||
<div id="loading"></div>
|
||||
</div>
|
||||
@@ -447,9 +447,9 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="mr-2 btn btn-link bg-red waves-effect print_receipt"> Print
|
||||
<button type="button" class="mr-2 m-t-5 btn-lg btn-block bg-red waves-effect print_receipt"> Print
|
||||
</button>
|
||||
<button type="button" class="btn btn-link bg-blue waves-effect btn_pdf_close" data-dismiss="modal">
|
||||
<button type="button" class="btn-lg btn-block bg-blue waves-effect btn_pdf_close" data-dismiss="modal">
|
||||
CLOSE
|
||||
</button>
|
||||
</div>
|
||||
@@ -571,6 +571,7 @@ var customer_name = "<%= @customer.name %>";
|
||||
if ($("#server_mode").val() != "cloud") { // first bill not used in cloud
|
||||
payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment");
|
||||
console.log(payment_type)
|
||||
console.log(parseInt(jQuery.inArray("MPU", payment_type)))
|
||||
if (member_id && member_discount) {
|
||||
if(parseInt(jQuery.inArray("Credit", payment_type)) == -1){
|
||||
$("#credit_payment").hide();
|
||||
@@ -654,7 +655,7 @@ var customer_name = "<%= @customer.name %>";
|
||||
else if(parseInt(jQuery.inArray("Alipay", payment_type)) != -1 && $('#alipaycount').text()== 0 && sub_total != 0.0 && member){
|
||||
swal("Oops","Please Pay with Alipay Payment","warning");
|
||||
}
|
||||
else if(parseInt(jQuery.inArray("JUNCTIONPAY", payment_type)) != -1 != -1 && $('#junctionpaycount').text()==0 && sub_total != 0.0 && member){
|
||||
else if(parseInt(jQuery.inArray("JUNCTIONPAY", payment_type)) != -1 && $('#junctionpaycount').text()==0 && sub_total != 0.0 && member){
|
||||
swal("Oops","Please Pay with JUNCTIONPAY Payment","warning");
|
||||
}
|
||||
else if(payment_type == "Credit" && $('#credit').text()==0 && sub_total != 0.0 && member){
|
||||
@@ -987,7 +988,8 @@ var customer_name = "<%= @customer.name %>";
|
||||
}
|
||||
|
||||
//print pdf function
|
||||
$(".print_receipt").on('click',function(){
|
||||
// $(".print_receipt").on('click',function(){
|
||||
$(document).on('touchstart click', '.print_receipt', function(event){
|
||||
var sale_id = $('#sale_id').text();
|
||||
var filename = $("#filename").val();
|
||||
var printer_name = $("#printer_name").val();
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<% @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>
|
||||
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;"><%= sale.sale_status %></span>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -172,6 +172,8 @@
|
||||
<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>
|
||||
<button id="cash_in" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.cash_in") %> </button>
|
||||
<button id="cash_out" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.cash_out") %> </button>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
@@ -201,7 +203,13 @@ $(document).ready(function(){
|
||||
var linkURL = '/origami/shift/quick_service/close';
|
||||
warnBeforeRedirect(linkURL);
|
||||
});
|
||||
$('#cash_in').on('click',function(){
|
||||
window.location.href = '/origami/quick_service/cash_ins';
|
||||
})
|
||||
|
||||
$('#cash_out').on('click',function(){
|
||||
window.location.href = '/origami/quick_service/cash_outs';
|
||||
})
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<% @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>
|
||||
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;"><%= sale.sale_status %></span>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -55,7 +55,9 @@
|
||||
</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 %>
|
||||
<button id="cash_in" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.cash_in") %> </button>
|
||||
<button id="cash_out" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.cash_out") %> </button>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -83,6 +85,14 @@
|
||||
warnBeforeRedirect(linkURL);
|
||||
});
|
||||
|
||||
$('#cash_in').on('click',function(){
|
||||
window.location.href = '/origami/quick_service/cash_ins';
|
||||
})
|
||||
|
||||
$('#cash_out').on('click',function(){
|
||||
window.location.href = '/origami/quick_service/cash_outs';
|
||||
})
|
||||
|
||||
function warnBeforeRedirect(linkURL) {
|
||||
swal({
|
||||
title: "Alert!",
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<% @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>
|
||||
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;"><%= sale.sale_status %></span>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -188,6 +188,8 @@
|
||||
<%end%>
|
||||
<% 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>
|
||||
<!-- <button id="cash_in" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.cash_in") %> </button>
|
||||
<button id="cash_out" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.cash_out") %> </button> -->
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
@@ -321,5 +323,13 @@ $(document).ready(function(){
|
||||
window.location.href = '/oqs/'+ assigned_order_item_id + "/edit/pending";
|
||||
}
|
||||
});
|
||||
|
||||
$('#cash_in').on('click',function(){
|
||||
window.location.href = '/origami/quick_service/cash_ins';
|
||||
})
|
||||
|
||||
$('#cash_out').on('click',function(){
|
||||
window.location.href = '/origami/quick_service/cash_outs';
|
||||
})
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -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 ">
|
||||
|
||||
@@ -44,9 +44,10 @@
|
||||
<th style='text-align:center;'><%= t("views.right_panel.detail.credit_sales") %></th>
|
||||
<th style='text-align:center;'><%= t("views.right_panel.detail.foc_sales") %></th>
|
||||
<th style='text-align:center;'>(<%= t("views.right_panel.detail.discount") %>)</th>
|
||||
<th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %> + <br/> <%= t("views.right_panel.detail.rnd_adj_sh") %></th>
|
||||
<!-- <th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %> + <br/> <%= t("views.right_panel.detail.rnd_adj_sh") %></th> -->
|
||||
<th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %></th>
|
||||
<th style='text-align:center;'><%= t("views.right_panel.detail.rnd_adj_sh") %></th>
|
||||
<th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %></th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<% if @print_settings.precision.to_i > 0
|
||||
@@ -121,9 +122,10 @@
|
||||
<td style='text-align:right;'><%= number_with_precision(sale[:credit_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_precision(sale[:foc_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;'>(<%= number_with_precision(sale[:total_discount], precision:precision,delimiter:delimiter) rescue '-'%>)</td>
|
||||
<td style='text-align:right;'><%= number_with_precision(sale[:grand_total].to_f + sale[:rounding_adj].to_f , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<!-- <td style='text-align:right;'><%= number_with_precision(sale[:grand_total].to_f + sale[:rounding_adj].to_f , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td> -->
|
||||
<td style='text-align:right;'><%= number_with_precision(sale[:grand_total], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_precision(sale[:rounding_adj].to_f, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_precision(sale[:grand_total], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
|
||||
</tr>
|
||||
<% count = count + 1 %>
|
||||
<% end %>
|
||||
@@ -144,15 +146,16 @@
|
||||
<td style='text-align:right;'><%= number_with_precision(credit, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_precision(foc, precision:precision,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;'>(<%= number_with_precision(discount, precision:precision.to_i,delimiter:delimiter) rescue '-'%>)</td>
|
||||
<td style='text-align:right;'><%= number_with_precision(total, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<!-- <td style='text-align:right;'><%= number_with_precision(total, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td> -->
|
||||
<td style='text-align:right;'><%= number_with_precision(grand_total, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_precision(rounding_adj, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_precision(grand_total, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
|
||||
</tr>
|
||||
|
||||
<% total_tax = 0 %>
|
||||
<% net = 0 %>
|
||||
<% unless @tax.empty? %>
|
||||
<% @tax.each do |tax| %>
|
||||
<% total_tax += tax.tax_amount.to_f %>
|
||||
<% @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>
|
||||
@@ -160,8 +163,10 @@
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% net = total - total_tax %>
|
||||
|
||||
<% net = grand_total %>
|
||||
<% net = net - rounding_adj%>
|
||||
<% net = net - 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>
|
||||
|
||||
@@ -118,6 +118,7 @@
|
||||
</tr>
|
||||
|
||||
<% total_tax = 0 %>
|
||||
<% net = 0 %>
|
||||
<% unless @tax.empty? %>
|
||||
<% @tax.each do |tax| %>
|
||||
<% total_tax += tax.tax_amount.to_f %>
|
||||
@@ -128,7 +129,9 @@
|
||||
</tr>
|
||||
|
||||
<% end %>
|
||||
<% net = total - total_tax %>
|
||||
<% net = grand_total %>
|
||||
<% net = net - rounding_adj%>
|
||||
<% net = net - total_tax %>
|
||||
<tr style="font-weight:600;">
|
||||
<td colspan="12" style='text-align:right;'><%= t("views.right_panel.detail.net_amount") %></td>
|
||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",net), :delimiter => ',') rescue '-'%></td>
|
||||
|
||||
@@ -72,6 +72,7 @@
|
||||
|
||||
<% grand_total = 0 %>
|
||||
<% old_grand_total = 0 %>
|
||||
<% after_rounding = 0 %>
|
||||
<% total_tax = 0 %>
|
||||
<% guest_count = 0 %>
|
||||
<% total_sum = 0 %>
|
||||
@@ -82,13 +83,15 @@
|
||||
<%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 %>
|
||||
<% grand_total +=result.grand_total.to_f %>
|
||||
<% old_grand_total += result.grand_total_after_rounding() %>
|
||||
<% 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>
|
||||
@@ -101,12 +104,11 @@
|
||||
<% 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><%= result.rounding_adjustment.to_f rescue '-' %></td>
|
||||
<td><%= number_with_precision(result.grand_total, precision: precision.to_i ,delimiter: delimiter) %></td>
|
||||
</tr>
|
||||
|
||||
<% end %>
|
||||
<tr style="border-top:4px double #666;">
|
||||
<td colspan="2"> </td>
|
||||
@@ -114,16 +116,19 @@
|
||||
<td><b><%= number_with_precision(discount_amt, 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>
|
||||
<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><%= number_with_precision(old_grand_total.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '0' %></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) rescue '0' %></b></td>
|
||||
<td><b><%= number_with_precision(grand_total.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"> </td>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<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="9"> <%= t("views.right_panel.detail.from_date") %> : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - <%= t("views.right_panel.detail.to_date") %> : <%= @to ? @to.utc.getlocal.strftime("%Y-%b-%d") : '-'%></th>
|
||||
</tr>
|
||||
<% if @shift_from %>
|
||||
<tr>
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
//Reset the form to pervious values
|
||||
<% if params[:shift_name].to_i > 0%>
|
||||
shift_id = '<%= params[:shift_name] %>'
|
||||
local_date = '<%= @shift.shift_started_at.utc.getlocal.strftime("%e %b %I:%M%p")%> -<%= @shift.shift_closed_at.utc.getlocal.strftime("%e %b %I:%M%p") %>'
|
||||
local_date = '<%= @shift.shift_started_at.utc.getlocal.strftime("%e %b %I:%M%p")%> -<%= @shift.shift_closed_at ? @shift.shift_closed_at.utc.getlocal.strftime("%e %b %I:%M%p") : "-" %>'
|
||||
var shift = $('#shift_name');
|
||||
str = '<option value="'+ shift_id +'" '+ 'selected = "selected"' +'>' + local_date + '</option>';
|
||||
shift.append(str);
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
<%= result[:employee_name] rescue '-'%>
|
||||
</td>
|
||||
<td><%= result[:shift_started_at].strftime("%e %b %I:%M%p") rescue '-' %> -
|
||||
<%= result[:shift_closed_at].strftime("%e %b %I:%M%p") rescue '-' %>
|
||||
<%= result[:shift_closed_at] ? result[:shift_closed_at].strftime("%e %b %I:%M%p") : '-' %>
|
||||
</td>
|
||||
<!-- <td style='color:red;'>(<%= sprintf "%.2f",result.void_amount.to_f.to_d rescue '-'%>)</td> -->
|
||||
<td><%= number_with_precision(result[:cash_sales].to_f, precision:precision.to_i,delimiter:delimiter) %></td>
|
||||
|
||||
@@ -67,8 +67,8 @@
|
||||
<tr>
|
||||
<td><%=s.product_name rescue ' '%></td>
|
||||
<td><%=s.qty rescue ' '%></td>
|
||||
<td><%= number_with_precision(s.price, :precision => 2, :delimiter => ',') rescue ' '%></td>
|
||||
<td><%= number_with_precision(s.qty * s.price, :precision => 2, :delimiter => ',') rescue ' '%></td>
|
||||
<td><%= number_with_precision(s.unit_price, :precision => 2, :delimiter => ',') rescue ' '%></td>
|
||||
<td><%= number_with_precision(s.price, :precision => 2, :delimiter => ',') rescue ' '%></td>
|
||||
<td><%=l s.created_at.utc.getlocal , :format => :short rescue ' ' %></td>
|
||||
<td><%=s.remark rescue ' '%></td>
|
||||
</tr>
|
||||
|
||||
@@ -110,6 +110,8 @@ scope "(:locale)", locale: /en|mm/ do
|
||||
get "quick_service/modify_order/:sale_id" => "quick_service#modify_order"
|
||||
post 'quick_service/update_modify_order' => "quick_service#update_modify_order", :defaults => { :format => 'json' }
|
||||
|
||||
get "quick_service/cash_ins" => "pending_order#cash_ins"
|
||||
get "quick_service/cash_outs" => "pending_order#cash_outs"
|
||||
|
||||
resources :cash_ins, only: [:new, :create]
|
||||
resources :cash_outs, only: [:new, :create]
|
||||
|
||||
@@ -3,6 +3,7 @@ class CreateMenus < ActiveRecord::Migration[5.1]
|
||||
create_table :menus do |t|
|
||||
t.string :name
|
||||
t.boolean :is_active, :null => false, :deafult => true
|
||||
t.boolean :is_checksum, :default => false
|
||||
t.string :valid_days, :null => false, :default => "1,2,3,4,5,6,7"
|
||||
t.time :valid_time_from, :null => false, :default => "00:00:00"
|
||||
t.time :valid_time_to, :null => false, :default => "23:59:59"
|
||||
|
||||
Reference in New Issue
Block a user