Pull from master

This commit is contained in:
San Wai Lwin
2018-05-18 09:49:47 +06:30
34 changed files with 316 additions and 271 deletions

View File

@@ -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");

View File

@@ -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");

View File

@@ -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");

View File

@@ -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);
}

View File

@@ -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];

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -8,31 +8,32 @@ 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)
current_shift = ShiftSale.current_shift
# set cashier
# 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
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

View File

@@ -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"

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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)

View File

@@ -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

View File

@@ -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

View File

@@ -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")

View File

@@ -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

View File

@@ -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

View File

@@ -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">

View File

@@ -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>

View File

@@ -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>

View File

@@ -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

View File

@@ -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>

View File

@@ -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();

View File

@@ -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>

View File

@@ -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!",

View File

@@ -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>

View File

@@ -9,7 +9,7 @@
<div class="row clearfix">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 ">
<div class="form-group p-l-10 p-r-10">
<%= f.input :child, input_html: { value: @survey_data.child, class: 'col-md-10', :onChange => "total_customer();" }%>
</div>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 ">

View File

@@ -154,8 +154,8 @@
<% 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>
@@ -163,15 +163,8 @@
</tr>
<% end %>
<% end %>
<tr style="font-weight:600;">
<td colspan="17" style='text-align:right;'>Discount </td>
<td style='text-align:right;'><%= number_with_precision(discount, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td colspan="2">&nbsp;</td>
</tr>
<% net = grand_total%>
<% net = grand_total- discount%>
<% net = grand_total %>
<% net = net - rounding_adj%>
<% net = net - total_tax %>
<tr style="font-weight:600;">

View File

@@ -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>

View File

@@ -116,7 +116,9 @@
<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| %>

View File

@@ -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>

View File

@@ -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]