diff --git a/app/assets/javascripts/addorder.js b/app/assets/javascripts/addorder.js
index 344e663b..8b9c4e01 100755
--- a/app/assets/javascripts/addorder.js
+++ b/app/assets/javascripts/addorder.js
@@ -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"
diff --git a/app/assets/javascripts/channels/check_new_order.js b/app/assets/javascripts/channels/check_new_order.js
index a6317af6..5e13ffe2 100644
--- a/app/assets/javascripts/channels/check_new_order.js
+++ b/app/assets/javascripts/channels/check_new_order.js
@@ -19,33 +19,34 @@ 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
"+
- "Are you accept or reject for these orders "+order_lists+"?",
- 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");
+ // swal({
+ // title: 'Information',
+ // target: document.getElementById(shop_code+"_notify_new_order"),
+ // text: "You have new orders
"+
+ // "Are you accept or reject for these orders "+order_lists+"?",
+ // type: 'success',
+ // html: true,
+ // closeOnConfirm: false,
+ // closeOnCancel: false,
+ // allowOutsideClick: false
+ // }, function (isConfirm) {
+ // if(isConfirm){
+ // swal.close();
+ // }
+ // });
+ $("#notify_new_order_lists").text(order_lists);
+ // 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();
- // }).on('hide.bs.modal', function (e) {
- // $("#notify_new_order").addClass("hidden");
- // }).modal({show: true, keyboard: false, backdrop: false});
+ $("#"+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) {
+ $("#"+shop_code+"_notify_new_order").addClass("hidden");
+ }).modal({show: true, keyboard: false, backdrop: false});
}
}
});
diff --git a/app/assets/javascripts/channels/check_order_ready_to_delivery.js b/app/assets/javascripts/channels/check_order_ready_to_delivery.js
index 319f7781..96863c1c 100644
--- a/app/assets/javascripts/channels/check_order_ready_to_delivery.js
+++ b/app/assets/javascripts/channels/check_order_ready_to_delivery.js
@@ -19,33 +19,34 @@ 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
"+
- "Could you ready these orders "+order_lists+" 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);
+ // swal({
+ // title: 'Information',
+ // target: document.getElementById(shop_code+"_notify_order_ready_to_delivery"),
+ // text: "You have orders that are ready to deliver
"+
+ // "Could you ready these orders "+order_lists+" 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();
- // }).on('hide.bs.modal', function (e) {
- // $("#notify_order_ready_to_delivery").addClass("hidden");
- // }).modal({show: true, keyboard: false, backdrop: false});
+ $("#"+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) {
+ $("#"+shop_code+"_notify_order_ready_to_delivery").addClass("hidden");
+ }).modal({show: true, keyboard: false, backdrop: false});
}
}
});
diff --git a/app/assets/javascripts/channels/check_order_send_to_kitchen.js b/app/assets/javascripts/channels/check_order_send_to_kitchen.js
index df9eb324..a65c1fc8 100644
--- a/app/assets/javascripts/channels/check_order_send_to_kitchen.js
+++ b/app/assets/javascripts/channels/check_order_send_to_kitchen.js
@@ -19,33 +19,34 @@ 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
"+
- "Could you send these orders "+order_lists+" 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);
+ // swal({
+ // title: 'Information',
+ // target: document.getElementById(shop_code+"_notify_order_send_to_kitchen"),
+ // text: "You have to send order to kitchen
"+
+ // "Could you send these orders "+order_lists+" 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();
- // }).on('hide.bs.modal', function (e) {
- // $("#notify_order_send_to_kitchen").addClass("hidden");
- // }).modal({show: true, keyboard: false, backdrop: false});
+ $("#"+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) {
+ $("#"+shop_code+"_notify_order_send_to_kitchen").addClass("hidden");
+ }).modal({show: true, keyboard: false, backdrop: false});
}
}
});
diff --git a/app/assets/javascripts/order_reservation.js b/app/assets/javascripts/order_reservation.js
index 081aef7e..a564411f 100644
--- a/app/assets/javascripts/order_reservation.js
+++ b/app/assets/javascripts/order_reservation.js
@@ -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');
@@ -467,42 +483,42 @@ function showNewOrder(order_reservation,shop_code){
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('/beep.mp3'); // define your audio
+ var audio = new Audio('/'+shop_code+'-beep.mp3'); // define your audio
// setTimeout(function(){
// audio.loop = true;
audio.play();
// },10000);
- // $("#new_order").text(order_reservation.order_reservation_id);
- // $("#new_order_date").text(requested_date);
+ $("#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").focus();
- // }).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 "+
- ""+order_reservation.order_reservation_id+" requested for "+requested_date+"?",
- type: 'success',
- html: true,
- closeOnConfirm: false,
- closeOnCancel: false,
- allowOutsideClick: false
- }, function (isConfirm) {
- if(isConfirm){
- audio.pause();
- swal.close();
- }
- });
+ $("#"+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 "+
+ // ""+order_reservation.order_reservation_id+" requested for "+requested_date+"?",
+ // type: 'success',
+ // html: true,
+ // closeOnConfirm: false,
+ // closeOnCancel: false,
+ // allowOutsideClick: false
+ // }, function (isConfirm) {
+ // if(isConfirm){
+ // audio.pause();
+ // swal.close();
+ // }
+ // });
}
}
diff --git a/app/assets/stylesheets/addorder.scss b/app/assets/stylesheets/addorder.scss
index ba1089d2..d9b62131 100755
--- a/app/assets/stylesheets/addorder.scss
+++ b/app/assets/stylesheets/addorder.scss
@@ -270,4 +270,8 @@ i.logout_icon{
.border-left{
border-left:1px solid #fff;
+}
+
+.set_add_icon{
+ display:none;
}
\ No newline at end of file
diff --git a/app/controllers/oqs/backhome_controller.rb b/app/controllers/oqs/backhome_controller.rb
index f809ef9f..4ac5f0a2 100755
--- a/app/controllers/oqs/backhome_controller.rb
+++ b/app/controllers/oqs/backhome_controller.rb
@@ -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
diff --git a/app/controllers/origami/addorders_controller.rb b/app/controllers/origami/addorders_controller.rb
index b7c9b1b6..63cb8736 100755
--- a/app/controllers/origami/addorders_controller.rb
+++ b/app/controllers/origami/addorders_controller.rb
@@ -67,6 +67,8 @@ class Origami::AddordersController < BaseOrigamiController
end
def get_menu()
+ puts "sssssssssssssss"
+puts params[:id]
if (params[:id])
#Pull this menu
@menu = Menu.find_by_id(params[:id])
diff --git a/app/controllers/origami/shifts_controller.rb b/app/controllers/origami/shifts_controller.rb
index acce6c65..3b2fe081 100755
--- a/app/controllers/origami/shifts_controller.rb
+++ b/app/controllers/origami/shifts_controller.rb
@@ -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])
diff --git a/app/models/menu.rb b/app/models/menu.rb
index 60200aeb..a9b88a85 100755
--- a/app/models/menu.rb
+++ b/app/models/menu.rb
@@ -155,24 +155,28 @@ class Menu < ApplicationRecord
# Menu Item Attributes
item_attrs = []
- attributes = row["Attributes"].split(',')
- attributes.each do |attr|
- attribute = MenuItemAttribute.find_by_name(attr)
- if attribute.nil?
- attribute = MenuItemAttribute.create({ attribute_type:"any", name: attr.capitalize, value: attr.downcase })
+ if !row["Attributes"].nil?
+ attributes = row["Attributes"].split(',')
+ attributes.each do |attr|
+ attribute = MenuItemAttribute.find_by_name(attr)
+ if attribute.nil?
+ attribute = MenuItemAttribute.create({ attribute_type:"any", name: attr.capitalize, value: attr.downcase })
+ end
+ item_attrs.push(attribute.id)
end
- item_attrs.push(attribute.id)
end
# Menu Item Options
item_opts = []
+ if !row["Options"].nil?
options = row["Options"].split(',')
- options.each do |opt|
- option = MenuItemOption.find_by_name(opt)
- if option.nil?
- option = MenuItemOption.create({ option_type:"any", name: opt.capitalize, value: opt.downcase })
+ options.each do |opt|
+ option = MenuItemOption.find_by_name(opt)
+ if option.nil?
+ option = MenuItemOption.create({ option_type:"any", name: opt.capitalize, value: opt.downcase })
+ end
+ item_opts.push(option.id)
end
- item_opts.push(option.id)
end
menu_itm = MenuItem.find_by_item_code(row["Item Code"])
@@ -189,7 +193,11 @@ class Menu < ApplicationRecord
menu_inst = MenuItemInstance.find_by_item_instance_code(row["Instance Code"])
if !menu_inst
- imported_instance = MenuItemInstance.create(menu_item_id: menu_itm.id, item_instance_code: row["Instance Code"], item_instance_name: row["Instance Name"], item_attributes: [], price: row["Price"], is_on_promotion: false, promotion_price: 0, is_available: true, is_default: row["Is Default"])
+ instance_name = ''
+ if !row["Instance Name"].nil?
+ instance_name = row["Instance Name"]
+ end
+ imported_instance = MenuItemInstance.create(menu_item_id: menu_itm.id, item_instance_code: row["Instance Code"], item_instance_name: instance_name, item_attributes: [], price: row["Price"], is_on_promotion: false, promotion_price: 0, is_available: true, is_default: row["Is Default"])
# else
# status = status + "Instance Code already exists for " + row["Instance Name"] + "."
end
diff --git a/app/models/printer/cashier_station_printer.rb b/app/models/printer/cashier_station_printer.rb
index 63239cdc..73813d1a 100755
--- a/app/models/printer/cashier_station_printer.rb
+++ b/app/models/printer/cashier_station_printer.rb
@@ -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
diff --git a/app/models/sale.rb b/app/models/sale.rb
index af7e7a58..a8ddf0ee 100644
--- a/app/models/sale.rb
+++ b/app/models/sale.rb
@@ -1091,6 +1091,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
diff --git a/app/pdf/close_cashier_customise_pdf.rb b/app/pdf/close_cashier_customise_pdf.rb
index 84311caa..5a094a7b 100644
--- a/app/pdf/close_cashier_customise_pdf.rb
+++ b/app/pdf/close_cashier_customise_pdf.rb
@@ -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
diff --git a/app/pdf/close_cashier_pdf.rb b/app/pdf/close_cashier_pdf.rb
index a1c92637..82203fb8 100755
--- a/app/pdf/close_cashier_pdf.rb
+++ b/app/pdf/close_cashier_pdf.rb
@@ -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
diff --git a/app/views/origami/addorders/detail.html.erb b/app/views/origami/addorders/detail.html.erb
index 62bbf3a4..65ea665b 100644
--- a/app/views/origami/addorders/detail.html.erb
+++ b/app/views/origami/addorders/detail.html.erb
@@ -17,7 +17,7 @@
@@ -650,11 +650,58 @@
$(document).on('click', '.menu_click', function(event){
var menu_id = $(this).attr("data-id");
var name = $(this).attr("data-name");
- var url = "get_menu/"+menu_id;
- show_menu_cat_list(name, url);
+ var menus = JSON.parse(localStorage.getItem("menus"));
+ if (menus != null) {
+ menu_click_cache_append(name,menus,menu_id);
+ }else{
+ var url = "get_menu/"+menu_id;
+ show_menu_cat_list(name, url);
+ }
});
//End menu category Click
+ function menu_click_cache_append(name,menus,menu_id) {
+ var menu_list = $('.menu_items_list');
+ menu_list.empty();
+
+ var menu_cat = $('.category_list');
+ menu_cat.empty();
+
+ $(".main_menu").text(name);
+ for(var i in menus) {
+ console.log(menus)
+ console.log(menus[i]["id"]);
+ console.log(menus[i]["is_active"]);
+ console.log(menu_id);
+ if (menu_id == menus[i]["id"] && menus[i]["is_active"] == true) {
+ // menu_list_template(menus[i]);
+ var category = menus[i]["categories"];
+
+ for(var ii in category) {
+ if (category[ii]["is_available"]== true){
+ if (category[ii]["valid_time"]== true){
+ if (category[ii]["parent_id"] == null ){
+ if(type){
+ if (category[ii]["code"].includes("SPL") != true) {
+ category_list_template(category[ii]);
+ }
+ }else{
+ if ($("#table_get_current").text()) {
+ if (category[ii]["code"].includes("SPL") != true) {
+ category_list_template(category[ii]);
+ }else {
+ category_list_template(category[ii]);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
//show menu item list when click menu category
function show_menu_cat_list(name, url_item){
var menu_list = $('.menu_items_list');
@@ -663,15 +710,18 @@
var menu_cat = $('.category_list');
menu_cat.empty();
- $(".main_menu").text(name)
- if (modify_order=="true" && type =="true") {
+ $(".main_menu").text(name);
+ cashier_type = window.location.href.indexOf("quick_service");
+ modify_order = window.location.href.indexOf("modify_order");
+ if (cashier_type != -1 && modify_order != -1) {
url_item = '../../../addorders/'+url_item;
- }if(modify_order=="false" && type =="true"){
- url_item = 'addorders/'+url_item
- }else{
- url_item = url_item;
}
-
+ if(modify_order == -1 && cashier_type != -1){
+ url_item = 'addorders/'+url_item
+ }
+ if (cashier_type ==-1 && modify_order == -1){
+ url_item = url_item;
+ }
//Start Ajax
$.ajax({
type: "GET",
@@ -679,10 +729,8 @@
data: {},
dataType: "json",
success: function(data) {
-
for(var i in data) {
if (data[i].is_available == true) {
-
row = '