Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into sqa-1804-001
This commit is contained in:
@@ -34,19 +34,19 @@ App.check_new_order = App.cable.subscriptions.create('CheckNewOrderChannel', {
|
||||
// swal.close();
|
||||
// }
|
||||
// });
|
||||
$("#notify_new_order_lists").text(order_lists);
|
||||
// $("#notify_new_order_lists").text(order_lists);
|
||||
// if($("#"+shop_code+"_notify_new_order").hasClass("hidden")){
|
||||
$("#"+shop_code+"_notify_new_order").removeClass("hidden");
|
||||
// $("#"+shop_code+"_notify_new_order").removeClass("hidden");
|
||||
// }
|
||||
$("#"+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});
|
||||
// $("#"+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});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -34,19 +34,19 @@ App.check_order_ready_to_delivery = App.cable.subscriptions.create('CheckOrderRe
|
||||
// swal.close();
|
||||
// }
|
||||
// });
|
||||
$("#notify_order_ready_to_delivery_lists").text(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");
|
||||
// $("#"+shop_code+"_notify_order_ready_to_delivery").removeClass("hidden");
|
||||
// }
|
||||
$("#"+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});
|
||||
// $("#"+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});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -34,19 +34,19 @@ App.check_order_send_to_kitchen = App.cable.subscriptions.create('CheckOrderSend
|
||||
// swal.close();
|
||||
// }
|
||||
// });
|
||||
$("#notify_order_send_to_kitchen_lists").text(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");
|
||||
// $("#"+shop_code+"_notify_order_send_to_kitchen").removeClass("hidden");
|
||||
// }
|
||||
$("#"+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});
|
||||
// $("#"+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});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -489,20 +489,20 @@ function showNewOrder(order_reservation,shop_code){
|
||||
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('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});
|
||||
// $("#"+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"),
|
||||
|
||||
@@ -5,18 +5,25 @@ authorize_resource :class => false
|
||||
|
||||
from, to = get_date_range_from_params
|
||||
|
||||
@shift_sale_range = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED)
|
||||
@shift_sale_range = ''
|
||||
|
||||
@shift = ''
|
||||
if params[:shift_name].to_i != 0
|
||||
shift_sale = ShiftSale.find(params[:shift_name])
|
||||
if to.blank?
|
||||
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL ',shift_sale.shift_started_at)
|
||||
else
|
||||
|
||||
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at = ? ',shift_sale.shift_started_at, shift_sale.shift_closed_at)
|
||||
@shift_sale_range = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
|
||||
|
||||
@shift_sale = ShiftSale.find(params[:shift_name])
|
||||
if to.blank?
|
||||
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL ',@shift_sale.shift_started_at)
|
||||
else
|
||||
if @shift_sale.shift_closed_at.blank?
|
||||
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL',@shift_sale.shift_started_at)
|
||||
else
|
||||
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at = ? ',@shift_sale.shift_started_at, @shift_sale.shift_closed_at)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
payment_type = params[:payment_type]
|
||||
@sale_data = Sale.get_shift_sales_by_receipt_no(@shift_sale_range,@shift,from,to,payment_type)
|
||||
@sale_taxes = Sale.get_separate_tax(@shift_sale_range,@shift,from,to,payment_type)
|
||||
@@ -42,18 +49,18 @@ authorize_resource :class => false
|
||||
def show
|
||||
from, to = get_date_range_from_params
|
||||
|
||||
@sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED)
|
||||
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
|
||||
|
||||
date_arr = Array.new
|
||||
@sale_data.each do |sale|
|
||||
local_opening_date = sale.opening_date.nil? ? '-' : sale.opening_date.utc.getlocal.strftime("%e %b %I:%M%p")
|
||||
local_closing_date = sale.closing_date.nil? ? '-' : sale.closing_date.utc.getlocal.strftime("%e %b %I:%M%p")
|
||||
opening_date = sale.opening_date.nil? ? '-' : sale.opening_date.utc
|
||||
closing_date = sale.closing_date.nil? ? '-' : sale.closing_date.utc
|
||||
shift_id = sale.id.nil? ? '-' : sale.id
|
||||
str = {:shift_id => shift_id, :local_opening_date => local_opening_date, :local_closing_date => local_closing_date, :opening_date => opening_date, :closing_date => closing_date}
|
||||
date_arr.push(str)
|
||||
end
|
||||
date_arr = Array.new
|
||||
@sale_data.each do |sale|
|
||||
local_opening_date = sale.opening_date.nil? ? '-' : sale.opening_date.utc.getlocal.strftime("%e %b %I:%M%p")
|
||||
local_closing_date = sale.closing_date.nil? ? '-' : sale.closing_date.utc.getlocal.strftime("%e %b %I:%M%p")
|
||||
opening_date = sale.opening_date.nil? ? '-' : sale.opening_date.utc
|
||||
closing_date = sale.closing_date.nil? ? '-' : sale.closing_date.utc
|
||||
shift_id = sale.id.nil? ? '-' : sale.id
|
||||
str = {:shift_id => shift_id, :local_opening_date => local_opening_date, :local_closing_date => local_closing_date, :opening_date => opening_date, :closing_date => closing_date}
|
||||
date_arr.push(str)
|
||||
end
|
||||
|
||||
out = {:status => 'ok', :message => date_arr}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -28,7 +28,7 @@ class Reports::ShiftsaleController < BaseReportController
|
||||
def show
|
||||
from, to = get_date_range_from_params
|
||||
|
||||
@sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED)
|
||||
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
|
||||
|
||||
date_arr = Array.new
|
||||
@sale_data.each do |sale|
|
||||
|
||||
@@ -99,10 +99,10 @@ class Settings::MenusController < ApplicationController
|
||||
sheet.add_row ["Name",menu.name], :style=>title
|
||||
sheet.add_row
|
||||
|
||||
sheet.add_row ["Category Code", "Category Name", "Item Code", "Item Name", "Account", "Item AltName", "Taxable", "Attributes", "Options", "Instance Code", "Instance Name", "Price", "Is Default"], :style=>header_text
|
||||
sheet.add_row ["Category Code", "Category Name", "Item Code", "Item Name", "Account", "Item AltName", "Taxable", "Attributes", "Options", "Instance Code", "Instance Name", "Instance Attribute", "Price", "Is Default"], :style=>header_text
|
||||
menu.menu_categories.each do |mc|
|
||||
mc.menu_items.each do |mi|
|
||||
attributes = ""
|
||||
mc.menu_items.each do |mi|
|
||||
attributes = ""
|
||||
i=0
|
||||
if mi.item_attributes.length > 0
|
||||
mi.item_attributes.each do |mia|
|
||||
@@ -119,8 +119,8 @@ class Settings::MenusController < ApplicationController
|
||||
options = ""
|
||||
i=0
|
||||
if mi.item_options.length > 0
|
||||
mi.item_options.each do |mia|
|
||||
option = MenuItemOption.find(mia)
|
||||
mi.item_options.each do |mio|
|
||||
option = MenuItemOption.find(mio)
|
||||
if i == mi.item_options.length - 1
|
||||
options = options + option.name
|
||||
else
|
||||
@@ -131,68 +131,15 @@ class Settings::MenusController < ApplicationController
|
||||
end
|
||||
|
||||
mi.menu_item_instances.each do |mii|
|
||||
sheet.add_row [ mc.code, mc.name, mi.item_code, mi.name, mi.account.title, mi.alt_name, mi.taxable, attributes, options, mii.item_instance_code, mii.item_instance_name, mii.price, mii.is_default], :style=>wrap_text
|
||||
attribute = ""
|
||||
if mii.item_attributes.length > 0
|
||||
attribute = MenuItemAttribute.find(mii.item_attributes[0]).name
|
||||
end
|
||||
sheet.add_row [ mc.code, mc.name, mi.item_code, mi.name, mi.account.title, mi.alt_name, mi.taxable, attributes, options, mii.item_instance_code, mii.item_instance_name, attribute, mii.price, mii.is_default], :style=>wrap_text
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# # Category
|
||||
# menu.menu_categories.each do |mc|
|
||||
# sheet.add_row ["Category"], :style=>wrap_text
|
||||
# sheet.add_row %w(id menu_id code name alt_name order_by created_by menu_category_id is_available), :style=>header_text
|
||||
# sheet.add_row [mc.id, mc.menu_id, mc.code, mc.name, mc.alt_name, mc.order_by, mc.created_by, mc.menu_category_id, mc.is_available], :style=>wrap_text
|
||||
# sheet.add_row
|
||||
|
||||
# # Menu Item
|
||||
# mc.menu_items.each do |mi|
|
||||
# sheet.add_row ["Menu Item"], :style=>wrap_text
|
||||
# sheet.add_row %w(id item_code name alt_name image_path description information unit type menu_category_id item_attributes item_options account_id min_qty taxable is_sub_item is_available created_by), :style=>header_text
|
||||
# sheet.add_row [mi.id,mi.item_code, mi.name, mi.alt_name, mi.image_path, mi.description, mi.information, mi.unit, mi.type, mi.menu_category_id, mi.item_attributes, mi.item_options, mi.account_id, mi.min_qty, mi.taxable, mi.is_sub_item, mi.is_available, mi.created_by], :style=>wrap_text
|
||||
# sheet.add_row
|
||||
|
||||
# # Menu Item Instance
|
||||
# sheet.add_row ["Menu Item Instance"], :style=>wrap_text
|
||||
# sheet.add_row %w(id menu_item_id item_instance_code item_instance_name item_attributes price is_on_promotion promotion_price is_available is_default), :style=>header_text
|
||||
# mi.menu_item_instances.each do |mii|
|
||||
# sheet.add_row [mii.id, mii.menu_item_id, mii.item_instance_code, mii.item_instance_name, mii.item_attributes, mii.price, mii.is_on_promotion, mii.promotion_price, mii.is_available, mii.is_default], :style=>wrap_text
|
||||
# end
|
||||
# sheet.add_row
|
||||
# end
|
||||
# end
|
||||
end
|
||||
|
||||
# # Account
|
||||
# wb.add_worksheet(name: "Account") do |sheet|
|
||||
# sheet.add_row %w(id title account_type discount point bonus rebate), :style=>header_text
|
||||
# Account.all.each do |acc|
|
||||
# sheet.add_row [acc.id, acc.title,acc.account_type,acc.discount,acc.point,acc.bonus,acc.rebate], :style=>wrap_text
|
||||
# end
|
||||
# end
|
||||
|
||||
# # Item set
|
||||
# wb.add_worksheet(name: "Item Set") do |sheet|
|
||||
# sheet.add_row %w(id name alt_name min_selectable_qty max_selectable_qty), :style=>header_text
|
||||
# ItemSet.all.each do |set|
|
||||
# sheet.add_row [set.id,set.name, set.alt_name, set.min_selectable_qty, set.max_selectable_qty], :style=>wrap_text
|
||||
# end
|
||||
# end
|
||||
|
||||
# # Item Options
|
||||
# wb.add_worksheet(name: "Menu Item Options") do |sheet|
|
||||
# sheet.add_row %w(id option_type name value), :style=>header_text
|
||||
# MenuItemOption.all.each do |option|
|
||||
# sheet.add_row [option.id, option.option_type, option.name, option.value], :style=>wrap_text
|
||||
# end
|
||||
# end
|
||||
|
||||
# # Item Attributes
|
||||
# wb.add_worksheet(name: "Menu Item Attributes") do |sheet|
|
||||
# sheet.add_row %w(id attribute_type name value), :style=>header_text
|
||||
# MenuItemAttribute.all.each do |attr|
|
||||
# sheet.add_row [attr.id, attr.attribute_type,attr.name,attr.value], :style=>wrap_text
|
||||
# end
|
||||
# end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
directory_name = "public/menus"
|
||||
|
||||
@@ -148,9 +148,7 @@ class Menu < ApplicationRecord
|
||||
row = Hash[[sheet.row(3),sheet.row(ii)].transpose]
|
||||
menu_cat = MenuCategory.find_by_code(row["Category Code"])
|
||||
if !menu_cat
|
||||
menu_cat = MenuCategory.create({menu_id: imported_menu.id, code: row["Category Code"], name: row["Category Name"], alt_name: '', order_by: (ii - 3), created_by: created_by, menu_category_id: nil, is_available: 1})
|
||||
# else
|
||||
# status = status + "Category Code already exists."
|
||||
menu_cat = MenuCategory.create({menu_id: imported_menu.id, code: row["Category Code"], name: row["Category Name"], alt_name: '', order_by: (ii - 3), created_by: created_by, menu_category_id: nil, is_available: 1})
|
||||
end
|
||||
|
||||
# Menu Item Attributes
|
||||
@@ -191,20 +189,37 @@ class Menu < ApplicationRecord
|
||||
# status = status + "Item Code already exists for " + row["Item Name"] + "."
|
||||
end
|
||||
|
||||
instance_attr = []
|
||||
menu_inst = MenuItemInstance.find_by_item_instance_code(row["Instance Code"])
|
||||
if !menu_inst
|
||||
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"] + "."
|
||||
|
||||
if !row["Attributes"].nil?
|
||||
if !row["Instance Attribute"].nil?
|
||||
attributes = row["Attributes"].split(',')
|
||||
instance_attributes = row["Instance Attribute"].split(',')
|
||||
attributes.each do |attr|
|
||||
if attr == instance_attributes[0]
|
||||
ins_attr = MenuItemAttribute.find_by_name(attr)
|
||||
instance_attr.push(ins_attr.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
is_default = 0
|
||||
if !row["Is Default"].nil?
|
||||
is_default = row["Is Default"]
|
||||
end
|
||||
imported_instance = MenuItemInstance.create(menu_item_id: menu_itm.id, item_instance_code: row["Instance Code"], item_instance_name: instance_name, item_attributes: instance_attr, price: row["Price"], is_on_promotion: false, promotion_price: 0, is_available: true, is_default: is_default)
|
||||
end
|
||||
end
|
||||
end
|
||||
# if status == ''
|
||||
status="Menu Imported!"
|
||||
status="Menu Imported!"
|
||||
# end
|
||||
|
||||
return status
|
||||
|
||||
@@ -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 != ""
|
||||
|
||||
@@ -905,7 +905,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")
|
||||
@@ -941,10 +941,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,
|
||||
@@ -965,6 +967,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,
|
||||
@@ -985,6 +988,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,
|
||||
@@ -1003,7 +1007,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
|
||||
|
||||
@@ -122,6 +122,10 @@
|
||||
<input type="hidden" id="table_id" name="table_id" value="<%= @dining_facility.id %>" />
|
||||
<input type="hidden" id="type" name="type" value="<%= @dining_facility.type %>" />
|
||||
<input type="hidden" id="table_type" name="table_type" value="<%= @dining_facility.type %>" />
|
||||
<% elsif @cashier_type == 'quick_service' %>
|
||||
<input type="hidden" id="sale_id" name="sale_id" value="<%= @sale_id %>" />
|
||||
<input type="hidden" id="type" name="type" value="<%= @cashier_type %>" />
|
||||
<input type="hidden" id="page" name="page" value="<%= @page %>" />
|
||||
<%else%>
|
||||
<input type="hidden" id="table_id" name="table_id" value="" />
|
||||
<input type="hidden" id="type" name="type" value="" />
|
||||
|
||||
@@ -44,9 +44,10 @@
|
||||
<th style='text-align:center;'><%= t("views.right_panel.detail.credit_sales") %></th>
|
||||
<th style='text-align:center;'><%= t("views.right_panel.detail.foc_sales") %></th>
|
||||
<th style='text-align:center;'>(<%= t("views.right_panel.detail.discount") %>)</th>
|
||||
<th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %> + <br/> <%= t("views.right_panel.detail.rnd_adj_sh") %></th>
|
||||
<!-- <th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %> + <br/> <%= t("views.right_panel.detail.rnd_adj_sh") %></th> -->
|
||||
<th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %></th>
|
||||
<th style='text-align:center;'><%= t("views.right_panel.detail.rnd_adj_sh") %></th>
|
||||
<th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %></th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<% if @print_settings.precision.to_i > 0
|
||||
@@ -121,9 +122,10 @@
|
||||
<td style='text-align:right;'><%= number_with_precision(sale[:credit_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_precision(sale[:foc_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;'>(<%= number_with_precision(sale[:total_discount], precision:precision,delimiter:delimiter) rescue '-'%>)</td>
|
||||
<td style='text-align:right;'><%= number_with_precision(sale[:grand_total].to_f + sale[:rounding_adj].to_f , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<!-- <td style='text-align:right;'><%= number_with_precision(sale[:grand_total].to_f + sale[:rounding_adj].to_f , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td> -->
|
||||
<td style='text-align:right;'><%= number_with_precision(sale[:grand_total], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_precision(sale[:rounding_adj].to_f, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_precision(sale[:grand_total], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
|
||||
</tr>
|
||||
<% count = count + 1 %>
|
||||
<% end %>
|
||||
@@ -144,12 +146,13 @@
|
||||
<td style='text-align:right;'><%= number_with_precision(credit, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_precision(foc, precision:precision,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;'>(<%= number_with_precision(discount, precision:precision.to_i,delimiter:delimiter) rescue '-'%>)</td>
|
||||
<td style='text-align:right;'><%= number_with_precision(total, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<!-- <td style='text-align:right;'><%= number_with_precision(total, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td> -->
|
||||
<td style='text-align:right;'><%= number_with_precision(grand_total, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_precision(rounding_adj, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_precision(grand_total, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
|
||||
</tr>
|
||||
|
||||
<% total_tax = 0 %>
|
||||
<% net = 0 %>
|
||||
<% unless @tax.empty? %>
|
||||
<% @tax.each do |tax| %>
|
||||
<% total_tax += tax.tax_amount.to_f %>
|
||||
@@ -161,7 +164,16 @@
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% net = total - total_tax %>
|
||||
<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"> </td>
|
||||
</tr>
|
||||
|
||||
<% net = grand_total%>
|
||||
<% net = grand_total- discount%>
|
||||
<% net = net - rounding_adj%>
|
||||
<% net = net - total_tax %>
|
||||
<tr style="font-weight:600;">
|
||||
<td colspan="17" style='text-align:right;'><%= t("views.right_panel.detail.net_amount") %></td>
|
||||
<td style='text-align:right;'><%= number_with_precision(net, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
|
||||
@@ -72,6 +72,7 @@
|
||||
|
||||
<% grand_total = 0 %>
|
||||
<% old_grand_total = 0 %>
|
||||
<% after_rounding = 0 %>
|
||||
<% total_tax = 0 %>
|
||||
<% guest_count = 0 %>
|
||||
<% total_sum = 0 %>
|
||||
@@ -82,13 +83,15 @@
|
||||
<%if @sale_data %>
|
||||
<% @sale_data.each do |result| %>
|
||||
|
||||
<% grand_total = grand_total.to_f + result.grand_total.to_f %>
|
||||
<% old_grand_total = old_grand_total.to_f + result.old_grand_total.to_f %>
|
||||
<% grand_total +=result.grand_total.to_f %>
|
||||
<% old_grand_total += result.grand_total_after_rounding() %>
|
||||
<% total_tax += result.total_tax.to_f %>
|
||||
<% total_sum += result.total_amount.to_f %>
|
||||
<% discount_amt += result.total_discount.to_f %>
|
||||
<% rounding_adj += result.rounding_adjustment.to_f %>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
<td><%= result.receipt_no rescue '-' %> </td>
|
||||
@@ -101,12 +104,11 @@
|
||||
<% result.sale_taxes.each do |tax| %>
|
||||
<td><%= number_with_precision(tax.tax_payable_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
<%end%>
|
||||
|
||||
<td><%= number_with_precision(result.grand_total, precision: precision.to_i ,delimiter: delimiter) %></td>
|
||||
<td><%= result.rounding_adjustment.to_f rescue '-' %></td>
|
||||
<td><%= number_with_precision(result.grand_total_after_rounding(), precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||
|
||||
<td><%= result.rounding_adjustment.to_f rescue '-' %></td>
|
||||
<td><%= number_with_precision(result.grand_total, precision: precision.to_i ,delimiter: delimiter) %></td>
|
||||
</tr>
|
||||
|
||||
<% end %>
|
||||
<tr style="border-top:4px double #666;">
|
||||
<td colspan="2"> </td>
|
||||
@@ -121,9 +123,10 @@
|
||||
<td><b>0</b></td>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<td><b><%= number_with_precision(grand_total.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
|
||||
<td><b><%= number_with_precision(old_grand_total.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '0' %></b></td>
|
||||
|
||||
<td><b><%= rounding_adj.to_f rescue '-' %></b></td>
|
||||
<td><b><%= number_with_precision(grand_total.to_f.round + rounding_adj, precision: precision.to_i ,delimiter: delimiter) rescue '0' %></b></td>
|
||||
<td><b><%= number_with_precision(grand_total.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"> </td>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<table class="table table-striped" border="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="9"> <%= t("views.right_panel.detail.from_date") %> : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - <%= t("views.right_panel.detail.to_date") %> : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%></th>
|
||||
<th colspan="9"> <%= t("views.right_panel.detail.from_date") %> : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - <%= t("views.right_panel.detail.to_date") %> : <%= @to ? @to.utc.getlocal.strftime("%Y-%b-%d") : '-'%></th>
|
||||
</tr>
|
||||
<% if @shift_from %>
|
||||
<tr>
|
||||
|
||||
@@ -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"> </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> </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"> </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> </td>
|
||||
<td> </td>
|
||||
<td>Other Charges</td>
|
||||
<td><%= other.item_code rescue '-' %></td>
|
||||
<td><%= other.product_name rescue '-' %></td>
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
//Reset the form to pervious values
|
||||
<% if params[:shift_name].to_i > 0%>
|
||||
shift_id = '<%= params[:shift_name] %>'
|
||||
local_date = '<%= @shift.shift_started_at.utc.getlocal.strftime("%e %b %I:%M%p")%> -<%= @shift.shift_closed_at.utc.getlocal.strftime("%e %b %I:%M%p") %>'
|
||||
local_date = '<%= @shift.shift_started_at.utc.getlocal.strftime("%e %b %I:%M%p")%> -<%= @shift.shift_closed_at ? @shift.shift_closed_at.utc.getlocal.strftime("%e %b %I:%M%p") : "-" %>'
|
||||
var shift = $('#shift_name');
|
||||
str = '<option value="'+ shift_id +'" '+ 'selected = "selected"' +'>' + local_date + '</option>';
|
||||
shift.append(str);
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
<%= result[:employee_name] rescue '-'%>
|
||||
</td>
|
||||
<td><%= result[:shift_started_at].strftime("%e %b %I:%M%p") rescue '-' %> -
|
||||
<%= result[:shift_closed_at].strftime("%e %b %I:%M%p") rescue '-' %>
|
||||
<%= result[:shift_closed_at] ? result[:shift_closed_at].strftime("%e %b %I:%M%p") : '-' %>
|
||||
</td>
|
||||
<!-- <td style='color:red;'>(<%= sprintf "%.2f",result.void_amount.to_f.to_d rescue '-'%>)</td> -->
|
||||
<td><%= number_with_precision(result[:cash_sales].to_f, precision:precision.to_i,delimiter:delimiter) %></td>
|
||||
|
||||
@@ -3,6 +3,7 @@ class CreateMenus < ActiveRecord::Migration[5.1]
|
||||
create_table :menus do |t|
|
||||
t.string :name
|
||||
t.boolean :is_active, :null => false, :deafult => true
|
||||
t.boolean :is_checksum, :default => false
|
||||
t.string :valid_days, :null => false, :default => "1,2,3,4,5,6,7"
|
||||
t.time :valid_time_from, :null => false, :default => "00:00:00"
|
||||
t.time :valid_time_to, :null => false, :default => "23:59:59"
|
||||
|
||||
Reference in New Issue
Block a user