Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant

This commit is contained in:
Yan
2018-05-15 13:19:52 +06:30
24 changed files with 289 additions and 145 deletions

View File

@@ -1373,7 +1373,7 @@ $(function() {
if (JSON.stringify(menu_items[field].item_sets)!='[]') {
fa_plus = '';
add = '';
menu_item_box = 'add_icon';
menu_item_box = 'set_add_icon';
data_target = 'sx_item_set_detailModal';
data_modal = 'modal'
add_icon = "set_item_box"

View File

@@ -19,32 +19,33 @@ 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();
}
});
// 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();
// }
// });
// $("#notify_new_order_lists").text(order_lists);
// if($("#notify_new_order").hasClass("hidden")){
// $("#notify_new_order").removeClass("hidden");
// if($("#"+shop_code+"_notify_new_order").hasClass("hidden")){
// $("#"+shop_code+"_notify_new_order").removeClass("hidden");
// }
// $("#notify_new_order").on('show.bs.modal', function(e){
// $("#notify_order_send_to_kitchen").addClass("hidden");
// $("#notify_order_ready_to_delivery").addClass("hidden");
// }).on('shown.bs.modal', function(e){
// $("#notify_new_order").focus();
// $("#"+shop_code+"_notify_new_order").on('shown.bs.modal', function(e){
// // $(document).off('focusin.modal');
// $("#"+shop_code+"_notify_new_order").focus();
// $("#"+shop_code+"_doemal_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) {
// $("#notify_new_order").addClass("hidden");
// $("#"+shop_code+"_notify_new_order").addClass("hidden");
// }).modal({show: true, keyboard: false, backdrop: false});
}
}

View File

@@ -19,32 +19,33 @@ 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();
}
});
// 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();
// }
// });
// $("#notify_order_ready_to_delivery_lists").text(order_lists);
// if($("#notify_order_ready_to_delivery").hasClass("hidden")){
// $("#notify_order_ready_to_delivery").removeClass("hidden");
// $("#"+shop_code+"_notify_order_ready_to_delivery").removeClass("hidden");
// }
// $("#notify_order_ready_to_delivery").on('shown.bs.modal', function(e){
// $("#notify_new_order").addClass("hidden");
// $("#notify_order_send_to_kitchen").addClass("hidden");
// }).on('shown.bs.modal', function(e){
// $("#notify_order_ready_to_delivery").focus();
// $("#"+shop_code+"_notify_order_ready_to_delivery").on('shown.bs.modal', function(e){
// // $(document).off('focusin.modal');
// $("#"+shop_code+"_notify_order_ready_to_delivery").focus();
// $("#"+shop_code+"_doemal_new_order").addClass("hidden");
// $("#"+shop_code+"_notify_new_order").addClass("hidden");
// $("#"+shop_code+"_notify_order_send_to_kitchen").addClass("hidden");
// }).on('hide.bs.modal', function (e) {
// $("#notify_order_ready_to_delivery").addClass("hidden");
// $("#"+shop_code+"_notify_order_ready_to_delivery").addClass("hidden");
// }).modal({show: true, keyboard: false, backdrop: false});
}
}

View File

@@ -19,32 +19,33 @@ 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();
}
});
// 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();
// }
// });
// $("#notify_order_send_to_kitchen_lists").text(order_lists);
// if($("#notify_order_send_to_kitchen").hasClass("hidden")){
// $("#notify_order_send_to_kitchen").removeClass("hidden");
// $("#"+shop_code+"_notify_order_send_to_kitchen").removeClass("hidden");
// }
// $("#notify_order_send_to_kitchen").on('show.bs.modal', function(e){
// $("#notify_new_order").addClass("hidden");
// $("#notify_order_ready_to_delivery").addClass("hidden");
// }).on('shown.bs.modal', function(e){
// $("#notify_order_send_to_kitchen").focus();
// $("#"+shop_code+"_notify_order_send_to_kitchen").on('shown.bs.modal', function(e){
// // $(document).off('focusin.modal');
// $("#"+shop_code+"_notify_order_send_to_kitchen").focus();
// $("#"+shop_code+"_doemal_new_order").addClass("hidden");
// $("#"+shop_code+"_notify_new_order").addClass("hidden");
// $("#"+shop_code+"_notify_order_ready_to_delivery").addClass("hidden");
// }).on('hide.bs.modal', function (e) {
// $("#notify_order_send_to_kitchen").addClass("hidden");
// $("#"+shop_code+"_notify_order_send_to_kitchen").addClass("hidden");
// }).modal({show: true, keyboard: false, backdrop: false});
}
}

View File

@@ -157,12 +157,28 @@ $(function() {
}
});
// $('button[data-dismiss="modal"]').on('click', function(){ $(this).parent().parent().parent().parent().modal('hide'); });
// $(".new_order_close").on("click",function(){
// var code = $(this).attr("data-value");
// $("#"+code+"_doemal_new_order").modal("hide");
// });
$(".new_order_close").on("click",function(){
var code = $(this).attr("data-value");
$("#"+code+"_doemal_new_order").modal("hide");
});
$(".notify_new_close").on("click",function(){
var code = $(this).attr("data-value");
$("#"+code+"_notify_new_order").modal("hide");
});
$(".notify_order_send_close").on("click",function(){
var code = $(this).attr("data-value");
$("#"+code+"_notify_order_send_to_kitchen").modal("hide");
});
$(".notify_order_ready_close").on("click",function(){
var code = $(this).attr("data-value");
$("#"+code+"_notify_order_ready_to_delivery").modal("hide");
});
// $("[data-dismiss='modal']").on('click', function() {
// $('body').addClass('modal-open-fix');
@@ -476,33 +492,33 @@ function showNewOrder(order_reservation,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").removeClass("hidden");
// }
// $("#"+shop_code+"_doemal_new_order").on('show.bs.modal', function(e){
// $("#notify_new_order").addClass("hidden");
// $("#notify_order_send_to_kitchen").addClass("hidden");
// $("#notify_order_ready_to_delivery").addClass("hidden");
// }).on('shown.bs.modal', function(e){
// $("#"+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){
// audio.pause();
// swal.close();
// }
// });
}
}

View File

@@ -270,4 +270,8 @@ i.logout_icon{
.border-left{
border-left:1px solid #fff;
}
.set_add_icon{
display:none;
}

View File

@@ -89,7 +89,6 @@ class Oqs::HomeController < BaseOqsController
# Query for OQS with delivery status
def queue_items_query(status)
byebug
AssignedOrderItem.select("assigned_order_items.assigned_order_item_id, oqs.id as station_id, oqs.station_name, oqs.is_active, oqpz.zone_id, df.name as zone, df.type as type, odt.order_id, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, odt.options, cus.name as customer_name, odt.created_at")
.joins(" left join order_queue_stations as oqs on oqs.id = assigned_order_items.order_queue_station_id
left join order_queue_process_by_zones as oqpz on oqpz.order_queue_station_id = oqs.id

View File

@@ -81,6 +81,8 @@ class Origami::ShiftsController < BaseOrigamiController
#get tax
shift_obj = ShiftSale.where('id =?',@shift.id)
@sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='')
@total_waste = Sale.get_total_waste(shift_id).sum(:grand_total)
@total_spoile = Sale.get_total_spoile(shift_id).sum(:grand_total)
#other payment details for mpu or visa like card
@other_payment = ShiftSale.get_by_shift_other_payment(@shift)
@@ -94,10 +96,9 @@ class Origami::ShiftsController < BaseOrigamiController
# get printer info
print_settings = PrintSetting.find_by_unique_code(unique_code)
#byebug
printer = Printer::CashierStationPrinter.new(print_settings)
printer.print_close_cashier(print_settings,cashier_terminal,@shift,shop_details,@sale_taxes,@other_payment,@total_amount_by_account,@total_discount_by_account,@total_member_discount,@total_dinein,@total_takeway,@total_other_charges)
printer.print_close_cashier(print_settings,cashier_terminal,@shift,shop_details,@sale_taxes,@other_payment,@total_amount_by_account,@total_discount_by_account,@total_member_discount,@total_dinein,@total_takeway,@total_other_charges,@total_waste,@total_spoile)
end
end
Employee.logout(session[:session_token])

View File

@@ -24,7 +24,7 @@ class Reports::SaleitemController < BaseReportController
end
@type = params[:sale_type]
@sale_data, @other_charges,@discount_data , @cash_data , @card_data , @credit_data , @foc_data , @grand_total , @change_amount = Sale.get_by_shift_items(shift_sale_range,shift, from, to, Sale::SALE_STATUS_COMPLETED,@type)
@sale_data, @other_charges,@product, @discount_data , @cash_data , @card_data , @credit_data , @foc_data , @grand_total , @change_amount = Sale.get_by_shift_items(shift_sale_range,shift, from, to, Sale::SALE_STATUS_COMPLETED,@type)
@sale_taxes = Sale.get_separate_tax(shift_sale_range,shift,from,to,nil)
@@ -62,7 +62,6 @@ class Reports::SaleitemController < BaseReportController
def show
from, to, report_type = get_date_range_from_params
puts "aaaaaaaaaaaaaaaaaaaaaaaaaa"
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
date_arr = Array.new

View File

@@ -89,7 +89,7 @@ class OrderReservation < ApplicationRecord
count = 1
order.order_reservation_items.each { |i|
i.item_instance_code = i.item_instance_code.downcase.to_s
items = {"order_item_id": count,"item_instance_code": i.item_instance_code,"quantity": i.qty,"options": []}
items = {"order_item_id": count,"item_instance_code": i.item_instance_code,"quantity": i.qty,"options": i.options}
count += 1
items_arr.push(items)
}
@@ -178,6 +178,17 @@ class OrderReservation < ApplicationRecord
end
Rails.logger.debug "Doemal URL" + base_url
post_url = base_url + url
if status == 'processed'
status = 'send_to_kitchen'
elsif status == 'delivered'
status = 'ready_to_deliver'
elsif status == 'completed'
status = 'delivered'
else
status = status
end
if waiting_time != ""
send_params = {id: ref_no,type: min_type, waiting_time: waiting_time, status: status}
elsif reason != ""

View File

@@ -38,7 +38,7 @@ class Printer::CashierStationPrinter < Printer::PrinterWorker
# self.print(filename, cashier_terminal.printer_name)
# end
def print_close_cashier(printer_settings,cashier_terminal,shift_sale,shop_details,sale_taxes,other_payment,amount,discount,member_discount,total_dinein,total_takeway,total_other_charges)
def print_close_cashier(printer_settings,cashier_terminal,shift_sale,shop_details,sale_taxes,other_payment,amount,discount,member_discount,total_dinein,total_takeway,total_other_charges,total_waste,total_spoile)
#Use CUPS service
#Generate PDF
@@ -46,7 +46,7 @@ class Printer::CashierStationPrinter < Printer::PrinterWorker
cashier = shift_sale.employee.name
shift_name = shift_sale.shift_started_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p") + "_" + shift_sale.shift_closed_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p")
filename = "tmp/close_cashier_#{cashier}_#{shift_name}.pdf"
pdf = CloseCashierPdf.new(printer_settings,shift_sale,shop_details,sale_taxes,other_payment,amount,discount,member_discount)
pdf = CloseCashierPdf.new(printer_settings,shift_sale,shop_details,sale_taxes,other_payment,amount,discount,member_discount,total_waste,total_spoile)
close_cashier_pdf = Lookup.collection_of("print_settings") #print_settings with name:CloseCashierPdf
if !close_cashier_pdf.empty?
@@ -55,7 +55,7 @@ class Printer::CashierStationPrinter < Printer::PrinterWorker
if close_cashier[1] == '1'
pdf = CloseCashierCustomisePdf.new(printer_settings,shift_sale,shop_details,sale_taxes,other_payment,amount,discount,member_discount,total_dinein,total_takeway,total_other_charges)
else
pdf = CloseCashierPdf.new(printer_settings,shift_sale,shop_details,sale_taxes,other_payment,amount,discount,member_discount)
pdf = CloseCashierPdf.new(printer_settings,shift_sale,shop_details,sale_taxes,other_payment,amount,discount,member_discount,total_waste,total_spoile)
end
end
end

View File

@@ -906,7 +906,7 @@ def self.get_item_query(type)
query = query.joins("JOIN sale_items i ON i.sale_id = sales.sale_id" +
" JOIN menu_item_instances mii ON i.item_instance_code = mii.item_instance_code" +
" JOIN menu_items mi ON mi.id = mii.menu_item_id" +
" JOIN shift_sales sh ON sh.`id` = sales.shift_sale_id" +
" JOIN shift_sales sh ON sh.`id` = sales.shift_sale_id" +
" JOIN menu_categories mc ON mc.id = mi.menu_category_id ")
# "JOIN employee_accesses ea ON ea.`employee_id` = sales.cashier_id ")
query = query.joins(" JOIN accounts acc ON acc.id = mi.account_id")
@@ -942,10 +942,12 @@ def self.get_by_shift_items(shift_sale_range, shift, from, to, status,type)
total_grand_total = 0
other_charges = self.get_other_charges()
product = self.get_product_sale()
if shift.present?
query = query.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift.to_a)
other_charges = other_charges.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift.to_a)
product = product.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift.to_a)
discount_query = Sale.where("sales.shift_sale_id in (?) and sale_status= 'completed' ", shift.to_a).sum(:total_discount)
change_amount = Sale.where("sales.shift_sale_id in (?) and sale_status= 'completed' ", shift.to_a).sum(:amount_changed)
sale_cash = Sale.select("SUM(case when (sale_payments.payment_method ='mpu' or sale_payments.payment_method = 'visa' or sale_payments.payment_method = 'master' or sale_payments.payment_method = 'jcb' or sale_payments.payment_method = 'paypar' or sale_payments.payment_method = 'unionpay' or sale_payments.payment_method = 'alipay' or sale_payments.payment_method = 'paymal' or sale_payments.payment_method = 'dinga' or sale_payments.payment_method = 'JunctionPay') then (sale_payments.payment_amount) else 0 end) as card_amount,
@@ -966,6 +968,7 @@ def self.get_by_shift_items(shift_sale_range, shift, from, to, status,type)
elsif shift_sale_range.present?
query = query.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift_sale_range.to_a)
other_charges = other_charges.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift_sale_range.to_a)
product = product.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift_sale_range.to_a)
discount_query = Sale.where("sales.shift_sale_id IN (?) and sale_status ='completed'", shift_sale_range.to_a).sum(:total_discount)
change_amount = Sale.where("sales.shift_sale_id IN (?) and sale_status ='completed'", shift_sale_range.to_a).sum(:amount_changed)
sale_cash = Sale.select("SUM(case when (sale_payments.payment_method = 'mpu' or sale_payments.payment_method = 'visa' or sale_payments.payment_method = 'master' or sale_payments.payment_method = 'jcb' or sale_payments.payment_method = 'paypar' or sale_payments.payment_method = 'unionpay' or sale_payments.payment_method = 'alipay' sale_payments.payment_method = 'paymal' or sale_payments.payment_method = 'dinga' or sale_payments.payment_method = 'JunctionPay') then (sale_payments.payment_amount) else 0 end) as card_amount,
@@ -986,6 +989,7 @@ def self.get_by_shift_items(shift_sale_range, shift, from, to, status,type)
else
query = query.where("sales.receipt_date between ? and ? and sale_status='completed'",from,to)
other_charges = other_charges.where("sales.receipt_date between ? and ? and sale_status='completed'",from,to)
product = product.where("sales.receipt_date between ? and ? and sale_status='completed'",from,to)
discount_query = Sale.where("sales.receipt_date between ? and ? and sale_status ='completed'", from,to).sum(:total_discount)
change_amount = Sale.where("sales.receipt_date between ? and ? and sale_status ='completed'", from,to).sum(:amount_changed)
sale_cash = Sale.select("SUM(case when (sale_payments.payment_method = 'mpu' or sale_payments.payment_method = 'visa' or sale_payments.payment_method = 'master' or sale_payments.payment_method = 'jcb' or sale_payments.payment_method = 'paypar' or sale_payments.payment_method = 'unionpay' or sale_payments.payment_method = 'alipay' or sale_payments.payment_method = 'paymal' or sale_payments.payment_method = 'dinga' or sale_payments.payment_method = 'JunctionPay') then (sale_payments.payment_amount) else 0 end) as card_amount,
@@ -1004,7 +1008,17 @@ def self.get_by_shift_items(shift_sale_range, shift, from, to, status,type)
end
return query,other_charges, discount_query , total_cash_amount , total_card_amount , total_credit_amount , total_foc_amount , total_grand_total , change_amount
return query,other_charges, product, discount_query , total_cash_amount , total_card_amount , total_credit_amount , total_foc_amount , total_grand_total , change_amount
end
def self.get_product_sale()
query = Sale.select("i.account_id as account_id, " +
"SUM(i.qty * i.unit_price) as grand_total,SUM(i.qty) as total_item," +
"i.status as status_type,"+
" i.unit_price as unit_price,i.product_name as product_name,i.product_code as product_code")
query = query.joins("JOIN sale_items i ON i.sale_id = sales.sale_id")
query = query.joins("JOIN products p ON p.`item_code` = i.product_code")
query = query.group("i.product_code")
end
#product sale report query
@@ -1092,6 +1106,14 @@ end
return sale_arr
end
def self.get_total_waste(shift_id)
query = Sale.where("sale_status = 'waste' and shift_sale_id = ?", shift_id)
end
def self.get_total_spoile(shift_id)
query = Sale.where("sale_status = 'spoile' and shift_sale_id = ?", shift_id)
end
def self.get_separate_tax(shift_sale_range=nil,shift,from,to,payment_type)
# wrong amount tax for service and commercial tax

View File

@@ -70,7 +70,7 @@ class CloseCashierCustomisePdf < Prawn::Document
stroke_horizontal_rule
end
def shift_detail(shift_sale,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount,precision,delimiter,total_dinein,total_takeway,total_other_charges)
def shift_detail(shift_sale,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount,precision,delimiter,total_dinein,total_takeway,total_other_charges,total_spoile)
move_down 7
y_position = cursor
bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do

View File

@@ -2,7 +2,7 @@ class CloseCashierPdf < Prawn::Document
include ActionView::Helpers::NumberHelper
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width,:text_width
def initialize(printer_settings, shift_sale,shop_details,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount)
def initialize(printer_settings, shift_sale,shop_details,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount,total_waste,total_spoile)
self.page_width = printer_settings.page_width #PrintSetting.where("name = ?","Close Cashier").first.page_width
self.page_height = printer_settings.page_height
self.header_font_size = printer_settings.header_font_size.to_i
@@ -54,7 +54,7 @@ class CloseCashierPdf < Prawn::Document
stroke_horizontal_rule
shift_detail(shift_sale,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount,printer_settings.precision,delimiter)
shift_detail(shift_sale,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount,printer_settings.precision,delimiter,total_waste,total_spoile)
end
def header (shop_details)
@@ -70,7 +70,7 @@ class CloseCashierPdf < Prawn::Document
stroke_horizontal_rule
end
def shift_detail(shift_sale,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount,precision,delimiter)
def shift_detail(shift_sale,sale_taxes,other_payment,total_amount_by_account,total_discount_by_account,total_member_discount,precision,delimiter,total_waste,total_spoile)
move_down 7
y_position = cursor
bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do
@@ -333,7 +333,7 @@ class CloseCashierPdf < Prawn::Document
text "(#{ number_with_precision(@total_foc, :precision => precision.to_i, :delimiter => delimiter)})", :size => self.item_font_size, :align => :right
end
y_position = cursor
y_position = cursor
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
text "Total Void :", :size => self.item_font_size, :align => :right
end
@@ -341,6 +341,22 @@ class CloseCashierPdf < Prawn::Document
text "(#{shift_sale.total_void})", :size => self.item_font_size, :align => :right
end
y_position = cursor
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
text "Total Waste :", :size => self.item_font_size, :align => :right
end
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
text "(#{ number_with_precision(total_waste, :precision => precision.to_i, :delimiter => delimiter)})", :size => self.item_font_size, :align => :right
end
y_position = cursor
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
text "Total Spoile :", :size => self.item_font_size, :align => :right
end
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
text "(#{ number_with_precision(total_spoile, :precision => precision.to_i, :delimiter => delimiter)})", :size => self.item_font_size, :align => :right
end
# y_position = cursor
# bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
# text "Grand Total :", :size => self.item_font_size, :align => :right

View File

@@ -17,7 +17,7 @@
<span class="main_menu" id="main_menu menu_name" >
<%if @menu.present? %>
<%=menu[0].name%>
<%=@menus[0].name%>
<% end%>
</span>
</a>

View File

@@ -1,4 +1,7 @@
<div class="container-fluid">
<div id="loading_wrapper" style="display:none;">
<div id="loading"></div>
</div>
<div class="block-header">
<!-- <h2><%= t :dashboard %></h2> -->
<h2><%= t :date_time %> : <%= Time.zone.now.utc.getlocal.strftime("%Y-%m-%d %I:%M %p") %></h2>
@@ -208,23 +211,32 @@
<input type="hidden" name="server_mode" value="<%=ENV["SERVER_MODE"]%>" id="server_mode">
<script>
$(function() {
$( "#loading_wrapper").show();
$.ajax({
type: "GET",
url: 'get_all_menu',
data: {},
success:function(result){
localStorage.setItem("menus", JSON.stringify(result));
var menu = localStorage.getItem("menus");
if (menu != null ) {
$( "#loading_wrapper").hide();
}
}
});
$(".cashier_view").on('click', function() {
window.location.href = '/origami';
});
$(".qs_view").on('click', function() {
if ($('#server_mode').val() != "cloud") {
if ($('#server_mode').val() != "cloud") {
document.getElementById('second_view').click();
}
}
window.location.href = '/origami/quick_service';
});

View File

@@ -1010,7 +1010,13 @@
$('#add_order').on('click', function () {
var dining_id = "<%= @dining.id %>";
var menus = JSON.parse(localStorage.getItem("menus"));
// if (menus != null) {
// console.log("menu");
// menu_cache_append(menus);
// }else{
// $("#menu_data").removeClass("hidden");
// }
window.location.href = '/origami/addorders/' + dining_id;
});

View File

@@ -463,11 +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>
@@ -584,7 +583,7 @@
</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 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">
@@ -598,7 +597,7 @@
<div class="modal-footer ">
<div class="row p-r-20">
<div class="col-md-5">
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-blue waves-effect new_order_close" data-value="<%= @shop.shop_code ? @shop.shop_code : '' %>" data-dismiss="modal">CLOSE</button>
<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>
@@ -606,7 +605,7 @@
</div>
</div>
<div class="modal fade text-center" id="notify_new_order" tabindex="-1" role="dialog">
<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">
@@ -620,7 +619,7 @@
<div class="modal-footer ">
<div class="row p-r-20">
<div class="col-md-5">
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
<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>
@@ -628,7 +627,7 @@
</div>
</div>
<div class="modal fade text-center" id="notify_order_send_to_kitchen" tabindex="-1" role="dialog">
<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">
@@ -642,7 +641,7 @@
<div class="modal-footer ">
<div class="row p-r-20">
<div class="col-md-5">
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
<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>
@@ -650,7 +649,7 @@
</div>
</div>
<div class="modal fade text-center" id="notify_order_ready_to_delivery" tabindex="-1" role="dialog">
<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">
@@ -664,11 +663,11 @@
<div class="modal-footer ">
<div class="row p-r-20">
<div class="col-md-5">
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
<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> -->
</div>

View File

@@ -633,33 +633,35 @@ var customer_name = "<%= @customer.name %>";
$('#pay').click(function() {
sub_total = $('#sub-total').text();
if (payment_type == 'MPU' && $('.mpu').text() == 0 && sub_total != 0.0) {
member = $('#membership_id').text();
console.log(member)
if (parseInt(jQuery.inArray("MPU", payment_type)) != -1 && $('.mpu').text() == 0 && sub_total != 0.0 && member) {
swal("Oops","Please Pay with MPU Payment","warning");
}else if(payment_type == "Redeem" && $('#ppamount').text()==0 && sub_total != 0.0){
}else if(parseInt(jQuery.inArray("Redeem", payment_type)) != -1 && $('#ppamount').text()==0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with Redeem Payment","warning");
}else if(payment_type == "VISA" && $('#visacount').text()==0 && sub_total != 0.0){
}else if(parseInt(jQuery.inArray("VISA", payment_type)) != -1 && $('#visacount').text()== 0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with Visa Payment","warning");
}else if(payment_type == "JCB" && $('#jcbcount').text()==0 && sub_total != 0.0){
}else if(parseInt(jQuery.inArray("JCB", payment_type)) != -1 && $('#jcbcount').text()== 0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with jcb Payment","warning");
}
else if(payment_type == "Master" && $('#mastercount').text()==0 && sub_total != 0.0){
else if(parseInt(jQuery.inArray("Master", payment_type)) != -1 && $('#mastercount').text()== 0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with Master Payment","warning");
}
else if(payment_type == "UNIONPAY" && $('#unionpaycount').text()==0 && sub_total != 0.0){
else if(payment_type == "UNIONPAY" && $('#unionpaycount').text()== 0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with UNIONPAY Payment","warning");
}
else if(payment_type == "Alipay" && $('#alipaycount').text()==0 && sub_total != 0.0){
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(payment_type == "JUNCTIONPAY" && $('#junctionpaycount').text()==0 && sub_total != 0.0){
else if(parseInt(jQuery.inArray("JUNCTIONPAY", payment_type)) != -1 != -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){
else if(payment_type == "Credit" && $('#credit').text()==0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with Credit Payment","warning");
}else if(payment_type == "PAYMAL" && $('#paymalcount').text()==0 && sub_total != 0.0){
}else if(parseInt(jQuery.inArray("PAYMAL", payment_type)) != -1 && $('#paymalcount').text()== 0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with Paymal Payment","warning");
}else if(payment_type == "DINGA" && $('#dingacount').text()==0 && sub_total != 0.0){
}else if(parseInt(jQuery.inArray("DINGA", payment_type)) != -1 && $('#dingacount').text()== 0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with Dinga Payment","warning");
}else{

View File

@@ -24,7 +24,7 @@
<span style='font-size:20px;'><b><%= t :closing_balance %></b></span>
</div>
<div class='col-md-6'>
<span style='font-size:20px;'><b><input type='text' class="form-control" id='closing_balance_amount' value=''></b></span>
<span style='font-size:20px;'><b><input type='number' class="form-control" id='closing_balance_amount' value='' onkeypress="return isNumberKey(event);" onkeyup="notNegative(this.value);"></b></span>
</div>
</div>
</div>
@@ -58,6 +58,20 @@
</div>
</div>
<script>
function isNumberKey(evt) {
var charCode = (evt.which) ? evt.which : event.keyCode;
if (charCode != 46 && charCode > 31 && (charCode < 48 || charCode > 57)) {
return false;
} else {
return true;
}
}
function greaterThanOne(val){
if(parseInt(val)==0) $("#closing_balance_amount").val(1);
}
var cashier_type = '<%= @cashier_type %>';
$('#close_cashier').on('click',function(){
var amount = $('#closing_balance_amount').val();

View File

@@ -59,10 +59,11 @@
%>
<% acc_arr = Array.new %>
<% cate_arr = Array.new %>
<% p_qty = 0 %>
<% sub_qty = 0 %>
<% sub_total = 0 %>
<% other_sub_total = 0 %>
<% product_sub_total = 0 %>
<% count = 0 %>
<% total_price = 0 %>
<% cate_count = 0 %>
@@ -161,8 +162,47 @@
<% end %>
<!-- end sub total -->
<% end %>
<!--Product Sale -->
<% if @product.present?%>
<tr>
<td><b>Product</b></td>
<td colspan="4">&nbsp;</td>
<td></td>
</tr>
<% @product.each do |product| %>
<% if product.total_item > 0
total_qty += product.total_item
end %>
<% grand_total +=product.grand_total
p_qty += product.total_item%>
<tr>
<td>&nbsp;</td>
<td>Product</td>
<td><%= product.product_code rescue '-' %></td>
<td><%= product.product_name rescue '-' %></td>
<td><%= product.total_item rescue '-' %></td>
<td> <%= number_with_precision(product.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
<td> <%= number_with_precision(product.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
</tr>
<!-- sub total -->
<% product_sub_total += product.grand_total %>
<!-- end sub total -->
<% end %>
<tr>
<td colspan="3">&nbsp;</td>
<td><b>Total Product Qty </b> </td>
<td><b><%= p_qty %></b></td>
<td><%= t("views.right_panel.detail.sub_total") %></td>
<td ><span><%= number_with_precision(product_sub_total , precision:precision.to_i,delimiter:delimiter)%></span></td>
</tr>
<%end%>
<!-- End Product Sale -->
<!--Other Charges -->
<% if @type == "other"%>
<% if @type == "other" || @other_charges.present?%>
<tr>
<td><b>Other Charges</b></td>
@@ -216,7 +256,7 @@
end %>
<% grand_total +=other.grand_total%>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>Other Charges</td>
<td><%= other.item_code rescue '-' %></td>
<td><%= other.product_name rescue '-' %></td>

View File

@@ -150,13 +150,13 @@
<th></th>
<td style="text-align: right;">JCB Payment </td>
<td><%=other.master_amount.round(2) rescue 0.0 %></td>
<% @total_amount = @total_amount+other.master_amount rescue 0.0 %>
<% @total_amount = @total_amount+other.jcb_amount rescue 0.0 %>
</tr>
<tr>
<th></th>
<td style="text-align: right;">Master Payment </td>
<td><%=other.jcb_amount.round(2) rescue 0.0 %></td>
<% @total_amount = @total_amount+other.jcb_amount rescue 0.0 %>
<% @total_amount = @total_amount+other.master_amount rescue 0.0 %>
</tr>
<tr>
<th></th>

View File

@@ -55,5 +55,5 @@ Rails.application.configure do
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
# Set Cable URL
config.action_cable.url = "ws://192.168.1.196:3002/cable"
# config.action_cable.url = "ws://192.168.1.196:3002/cable"
end

BIN
public/AC-beep.mp3 Normal file

Binary file not shown.