Merge branch 'august_spring' of bitbucket.org:code2lab/sxrestaurant into august_spring
This commit is contained in:
@@ -24,6 +24,7 @@ class Api::BillController < Api::ApiController
|
||||
@sale = Sale.new
|
||||
@status, @sale_id = @sale.generate_invoice_from_order(params[:order_id], current_login_employee, get_cashier)
|
||||
end
|
||||
Promotion.promo_activate(@sale)
|
||||
else
|
||||
@status = false
|
||||
@error_message = "No Current Open Shift"
|
||||
|
||||
@@ -55,7 +55,7 @@ class Settings::MenuItemInstancesController < ApplicationController
|
||||
sets = ItemSet.find(params[:menu_item_instance][:item_sets])
|
||||
|
||||
if sets.count > 0
|
||||
@settings_menu_item.item_sets = sets
|
||||
@settings_menu_item_instances.item_sets = sets
|
||||
end
|
||||
end
|
||||
|
||||
@@ -92,7 +92,7 @@ class Settings::MenuItemInstancesController < ApplicationController
|
||||
sets = ItemSet.find(params[:menu_item_instance][:item_sets])
|
||||
|
||||
if sets.count > 0
|
||||
@settings_menu_item.item_sets = sets
|
||||
@settings_menu_item_instances.item_sets = sets
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -132,6 +132,6 @@ class Settings::SetMenuItemsController < ApplicationController
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def settings_menu_item_params
|
||||
params.require(:set_menu_item).permit(:item_code, :name, :alt_name, :type, :image_path, :menu_category_id,:account_id , :item_attributes, :item_options, :min_qty, :is_sub_item, :is_available, :created_by, :item_sets)
|
||||
params.require(:set_menu_item).permit(:item_code, :name, :alt_name, :type, :image_path, :menu_category_id,:account_id , :item_attributes, :item_options, :min_qty, :is_sub_item, :is_available, :created_by, :item_sets, :unit)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -154,6 +154,6 @@ class Settings::SimpleMenuItemsController < ApplicationController
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def settings_menu_item_params
|
||||
params.require(:simple_menu_item).permit(:item_code, :name, :alt_name, :type, :image_path, :menu_category_id, :account_id, :item_attributes, :item_options, :min_qty, :is_sub_item, :is_available, :created_by, :item_sets)
|
||||
params.require(:simple_menu_item).permit(:item_code, :name, :alt_name, :type, :image_path, :menu_category_id, :account_id, :item_attributes, :item_options, :min_qty, :is_sub_item, :is_available, :created_by, :item_sets, :unit)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -6,7 +6,204 @@ class Promotion < ApplicationRecord
|
||||
accepts_nested_attributes_for :promotion_products , :allow_destroy => true
|
||||
|
||||
PROMO_TYPE1 = "Quantity"
|
||||
PROMO_TYPE2 = "Net_off"
|
||||
PROMO_TYPE3 = "Net_price"
|
||||
PROMO_TYPE2 = "Net_off" # 3000 => - 500 => 2500 [total]
|
||||
PROMO_TYPE3 = "Net_price" # 1800 => 1000 => 1000
|
||||
PROMO_TYPE4 = "Percentage"
|
||||
|
||||
def self.promo_activate(saleObj)
|
||||
current_day = Time.now.strftime("%Y-%m-%d")
|
||||
current_time = Time.now.strftime('%H:%M:%S')
|
||||
day = Date.today.wday
|
||||
promoList = is_between_promo_datetime(current_day,current_time)
|
||||
puts "promoList - " + promoList.size.to_s
|
||||
if promoList.size > 0
|
||||
itemList = combine_item(saleObj)
|
||||
is_promo_day(promoList,day, itemList, saleObj.sale_id)
|
||||
end
|
||||
end
|
||||
|
||||
def self.is_between_promo_datetime(current_day,current_time) #database is not local time
|
||||
promoList = Promotion.where("(TO_CHAR(promo_start_date, 'YYYY-MM-DD') <=? AND TO_CHAR(promo_end_date, 'YYYY-MM-DD') >=?) AND (promo_start_hour < ? AND promo_end_hour > ?)", current_day, current_day, current_time, current_time)
|
||||
return promoList
|
||||
end
|
||||
|
||||
def self.combine_item(saleObj)
|
||||
itemList = saleObj.sale_items.group(:product_code).sum(:qty)
|
||||
end
|
||||
|
||||
def self.is_promo_day(promoList, day, orderitemList, sale_id)
|
||||
puts "Today date - " + day.to_s
|
||||
promoList.each do |promo|
|
||||
dayresult = promo.promo_day.include?(day.to_s)
|
||||
if dayresult
|
||||
orderitemList.each do |item|
|
||||
find_promo_item(promo, item, sale_id)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def self.find_promo_item(promo, orderitem, sale_id)
|
||||
if promo.original_product.to_s == orderitem[0].to_s
|
||||
if promo.min_qty.to_i > orderitem[1].to_i
|
||||
return false
|
||||
else
|
||||
check_promo_type(promo,orderitem, sale_id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def self.check_promo_type(promo, orderitem, sale_id)
|
||||
same, promo_product = check_giveaway_product(promo, orderitem[0])
|
||||
if promo.promo_type == Promotion::PROMO_TYPE1
|
||||
if same
|
||||
give_promotion_same_product(orderitem[1], promo.min_qty, promo_product.min_qty, orderitem, sale_id)
|
||||
else
|
||||
give_promotion_second_product(orderitem[1], promo.min_qty, promo_product.item_code, orderitem, sale_id)
|
||||
end
|
||||
|
||||
elsif promo.promo_type == Promotion::PROMO_TYPE2
|
||||
give_promotion_nett_off(same,promo_product,promo.min_qty, orderitem, sale_id)
|
||||
|
||||
elsif promo.promo_type == Promotion::PROMO_TYPE3
|
||||
give_promotion_nett_price(same,promo_product,promo.min_qty, orderitem, sale_id)
|
||||
|
||||
elsif promo.promo_type == Promotion::PROMO_TYPE4
|
||||
give_promotion_nett_price(same,promo_product,promo.min_qty, orderitem, sale_id)
|
||||
end
|
||||
end
|
||||
|
||||
def self.check_giveaway_product(promo, orderitem)
|
||||
promo.promotion_products.each do |promo_product|
|
||||
if promo_product.item_code == orderitem
|
||||
return true, promo_product
|
||||
else
|
||||
return false, promo_product
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def self.give_promotion_same_product(qty, promoqty, foc_min_qty, orderitem, sale_id)
|
||||
puts " Order qty: " + qty.to_s + " / promoqty: " + promoqty.to_s + " / giveaway: " + foc_min_qty.to_s
|
||||
multiple = qty.to_i / promoqty.to_i # loop count
|
||||
charge_qty = 0
|
||||
foc_qty = 0
|
||||
if multiple > 0
|
||||
multiple.times.each do |key|
|
||||
if qty > promoqty
|
||||
charge_qty += promoqty
|
||||
different = qty - promoqty
|
||||
qty = different
|
||||
if different == 0
|
||||
foc_qty += foc_min_qty
|
||||
else
|
||||
foc_qty += foc_min_qty
|
||||
qty = qty - foc_min_qty
|
||||
end
|
||||
else
|
||||
charge_qty += qty
|
||||
end
|
||||
end
|
||||
if multiple == foc_qty
|
||||
charge_qty += qty
|
||||
end
|
||||
else
|
||||
charge_qty += qty
|
||||
end
|
||||
item = OrderItem.find_by_item_code(orderitem[0])
|
||||
update_existing_item(foc_qty, item, sale_id, "promotion", item.price)
|
||||
|
||||
puts "Charged - " + charge_qty.to_s
|
||||
puts "FOC - " + foc_qty.to_s
|
||||
end
|
||||
# AA - 10 # 3 # BB # orderList, #S34345
|
||||
def self.give_promotion_second_product(orderitem_count, foc_min_qty, promo_product, orderitem, sale_id)
|
||||
puts "..... orderitem_count: " + orderitem_count.to_s + " / foc_min_qty: " + foc_min_qty.to_s + " /promo_product: " + promo_product + " orderitem: " + orderitem.to_s
|
||||
promotion_qty = orderitem_count.to_i / foc_min_qty.to_i # get foc item qty
|
||||
item = OrderItem.find_by_item_code(promo_product)
|
||||
update_existing_item(promotion_qty, item, sale_id, "promotion", item.price)
|
||||
end
|
||||
|
||||
def self.update_existing_item(foc_qty, item, sale_id, type, item_price)
|
||||
|
||||
sale_item = SaleItem.new
|
||||
sale_item.product_code = item.item_code
|
||||
sale_item.product_name = item.item_name + "(promotion)"
|
||||
sale_item.product_alt_name = item.alt_name
|
||||
sale_item.account_id = item.account_id
|
||||
sale_item.remark = type
|
||||
sale_item.qty = foc_qty * (-1)
|
||||
|
||||
sale_item.unit_price = item_price * (-1)
|
||||
sale_item.taxable_price = item_price
|
||||
sale_item.price = foc_qty * item_price * (-1)
|
||||
|
||||
sale_item.is_taxable = item.taxable
|
||||
sale_item.sale_id = sale_id
|
||||
|
||||
sale_item.save
|
||||
end
|
||||
|
||||
|
||||
def self.give_promotion_nett_off(same, promo_product, foc_min_qty, orderitem, sale_id)
|
||||
puts " same: " + same.to_s + " promo_product: " + promo_product.item_code.to_s + " foc_min_qty: " + foc_min_qty.to_s + " orderitem: " + orderitem.to_s
|
||||
|
||||
if same
|
||||
foc_qty = orderitem[1].to_i / foc_min_qty
|
||||
item = OrderItem.find_by_item_code(orderitem[0])
|
||||
update_existing_item(foc_qty, item, sale_id, "promotion nett off", promo_product.net_off)
|
||||
else
|
||||
foc_qty = find_second_item_qty(sale_id, promo_product.item_code)
|
||||
item = OrderItem.find_by_item_code(promo_product.item_code)
|
||||
update_existing_item(foc_qty, item, sale_id, "promotion nett off", promo_product.net_off)
|
||||
end
|
||||
end
|
||||
|
||||
def self.give_promotion_nett_price(same, promo_product, foc_min_qty, orderitem, sale_id)
|
||||
puts " same: " + same.to_s + " promo_product: " + promo_product.item_code.to_s + " foc_min_qty: " + foc_min_qty.to_s + " orderitem: " + orderitem.to_s
|
||||
|
||||
if same
|
||||
foc_qty = orderitem[1].to_i / foc_min_qty
|
||||
item = OrderItem.find_by_item_code(orderitem[0])
|
||||
price = item.price - promo_product.net_price
|
||||
update_existing_item(foc_qty, item, sale_id, "promotion nett price", price)
|
||||
else
|
||||
foc_qty = find_second_item_qty(sale_id, promo_product.item_code)
|
||||
item = OrderItem.find_by_item_code(promo_product.item_code)
|
||||
price = item.price - promo_product.net_price
|
||||
update_existing_item(foc_qty, item, sale_id, "promotion nett price", price)
|
||||
end
|
||||
end
|
||||
|
||||
def self.give_promotion_discount(same, promo_product, foc_min_qty, orderitem, sale_id)
|
||||
puts " same: " + same.to_s + " promo_product: " + promo_product.item_code.to_s + " foc_min_qty: " + foc_min_qty.to_s + " orderitem: " + orderitem.to_s
|
||||
|
||||
if same
|
||||
foc_qty = orderitem[1].to_i / foc_min_qty
|
||||
item = OrderItem.find_by_item_code(orderitem[0])
|
||||
total = orderitem[1].to_i * item.price
|
||||
price = calculate_discount(total, promo_product.percentage)
|
||||
update_existing_item(foc_qty, item, sale_id, "promotion discount", price)
|
||||
else
|
||||
foc_qty = find_second_item_qty(sale_id, promo_product.item_code)
|
||||
item = OrderItem.find_by_item_code(promo_product.item_code)
|
||||
total = item.price * foc_qty
|
||||
price = calculate_discount(total, promo_product.percentage)
|
||||
update_existing_item(foc_qty, item, sale_id, "promotion discount", price)
|
||||
end
|
||||
end
|
||||
|
||||
def self.find_second_item_qty(sale_id, promo_item)
|
||||
saleObj = Sale.find_by_sale_id(sale_id)
|
||||
itemList = combine_item(saleObj)
|
||||
itemList.each do |item|
|
||||
if item[0] == promo_item
|
||||
return item[1]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def self.calculate_discount(total, discount)
|
||||
self (total.to_i * discount.to_i) / 100
|
||||
end
|
||||
end
|
||||
|
||||
@@ -298,8 +298,8 @@ class Sale < ApplicationRecord
|
||||
customer = Customer.find(sale.customer_id)
|
||||
# #Creat new tax records
|
||||
tax_profiles.each do |tax|
|
||||
customer.tax_profiles.each do |cus_tax|
|
||||
if cus_tax.to_i == tax.id
|
||||
customer.tax_profiles.each do |cus_tax|
|
||||
if cus_tax.to_i == tax.id
|
||||
sale_tax = SaleTax.new(:sale => sale)
|
||||
sale_tax.tax_name = tax.name
|
||||
sale_tax.tax_rate = tax.rate
|
||||
@@ -311,7 +311,7 @@ class Sale < ApplicationRecord
|
||||
rate = tax.rate
|
||||
divided_value = (100 + rate)/rate
|
||||
sale_tax.tax_payable_amount = total_tax / divided_value
|
||||
else
|
||||
else
|
||||
sale_tax.tax_payable_amount = total_tax * tax.rate / 100
|
||||
total_tax_amount = total_tax_amount + sale_tax.tax_payable_amount
|
||||
end
|
||||
@@ -319,7 +319,7 @@ class Sale < ApplicationRecord
|
||||
# total_taxable = total_taxable + sale_tax.tax_payable_amount
|
||||
|
||||
sale_tax.inclusive = tax.inclusive
|
||||
sale_tax.save
|
||||
sale_tax.save
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -338,13 +338,13 @@ class Sale < ApplicationRecord
|
||||
total_tax_amount = 0
|
||||
#tax_profile - list by order_by
|
||||
tax_profiles = TaxProfile.all.order("order_by asc")
|
||||
|
||||
customer = Customer.find(self.customer_id)
|
||||
|
||||
customer = Customer.find(self.customer_id)
|
||||
puts customer
|
||||
#Create new tax records
|
||||
tax_profiles.each do |tax|
|
||||
customer.tax_profiles.each do |cus_tax|
|
||||
if cus_tax.to_i == tax.id
|
||||
customer.tax_profiles.each do |cus_tax|
|
||||
if cus_tax.to_i == tax.id
|
||||
sale_tax = SaleTax.new(:sale => self)
|
||||
sale_tax.tax_name = tax.name
|
||||
sale_tax.tax_rate = tax.rate
|
||||
@@ -356,16 +356,16 @@ class Sale < ApplicationRecord
|
||||
rate = tax.rate
|
||||
divided_value = (100 + rate)/rate
|
||||
sale_tax.tax_payable_amount = total_tax / divided_value
|
||||
else
|
||||
else
|
||||
sale_tax.tax_payable_amount = total_tax * tax.rate / 100
|
||||
total_tax_amount = total_tax_amount + sale_tax.tax_payable_amount
|
||||
end
|
||||
|
||||
|
||||
#new taxable amount is standard rule for step by step
|
||||
# total_taxable = total_taxable + sale_tax.tax_payable_amount
|
||||
|
||||
sale_tax.inclusive = tax.inclusive
|
||||
sale_tax.save
|
||||
sale_tax.save
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -596,7 +596,7 @@ def self.get_item_query()
|
||||
|
||||
query = query.joins(" JOIN accounts acc ON acc.id = mi.account_id")
|
||||
query = query.group('i.product_code ').order("mi.account_id, mi.menu_category_id")
|
||||
end
|
||||
end
|
||||
|
||||
def self.get_by_shift_items(shift_sale_range, shift, from, to, status)
|
||||
# date_type_selection = get_sql_function_for_report_type(report_type)
|
||||
|
||||
@@ -1,116 +1,4 @@
|
||||
class Shop < ApplicationRecord
|
||||
|
||||
def promo_activate
|
||||
current_day = Time.now.strftime("%Y-%d-%m")
|
||||
current_time = Time.now.strftime('%H:%M')
|
||||
day = Date.today.wday
|
||||
promoList = is_between_promo_datetime(current_day,current_time)
|
||||
if promoList.size > 0
|
||||
itemList = combine_item(saleObj)
|
||||
is_promo_day(promoList,day, itemList)
|
||||
end
|
||||
end
|
||||
|
||||
def is_between_promo_datetime(current_day,current_time)
|
||||
promoList = Promotion.where('( promo_start_date < ? AND promo_end_date > ?) AND (promo_start_time < ? AND promo_end_time > ?)', current_day, current_day, current_time, current_time)
|
||||
return promoList
|
||||
end
|
||||
|
||||
def combine_item(saleObj)
|
||||
itemList = saleObj.sale_items.group(:product_code).sum(:qty)
|
||||
end
|
||||
|
||||
def is_promo_day(promoList, day, orderitemList)
|
||||
promoList.each do |promo|
|
||||
dayresult = promo.promo_day.include?(day)
|
||||
if dayresult
|
||||
orderitemList.each do |item|
|
||||
find_promo_item(promo, item)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def find_promo_item(promo, orderitem)
|
||||
if promo.prouduct_item == orderitem
|
||||
if promo.minmum_qty < orderitem.qty
|
||||
return false
|
||||
else
|
||||
same, promo_item_code = check_giveaway_product(promo, orderitem)
|
||||
if same
|
||||
give_promotion_same_product
|
||||
else
|
||||
find_promo_item_in_orderlist
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def check_giveaway_product(promo, orderitem)
|
||||
promo.promotion_products.each do |promo_product|
|
||||
if promo_product.item_code == orderitem.item_code
|
||||
return true, promo_product.item_code
|
||||
else
|
||||
return false, promo_product.item_code
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def self.give_promotion_same_product(qty, promoqty, foc_min_qty)
|
||||
multiple = qty / promoqty # loop count
|
||||
charge_qty = 0
|
||||
foc_qty = 0
|
||||
if multiple > 0
|
||||
multiple.times.each do |key|
|
||||
if qty >= promoqty
|
||||
charge_qty += promoqty
|
||||
different = qty - promoqty
|
||||
qty = different
|
||||
if different == 0
|
||||
Shop.add_promotion_item
|
||||
foc_qty += foc_min_qty
|
||||
else
|
||||
foc_qty += foc_min_qty
|
||||
qty = qty - foc_min_qty
|
||||
end
|
||||
else
|
||||
if multiple == foc_qty
|
||||
charge_qty += qty
|
||||
else
|
||||
charge_qty += qty
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
charge_qty = qty
|
||||
end
|
||||
puts "Charged - " + charge_qty.to_s
|
||||
puts "FOC - " + foc_qty.to_s
|
||||
end
|
||||
|
||||
def find_promo_item_in_orderlist(promo_item_code, orderitemList)
|
||||
orderitemList.each do |item|
|
||||
if item.item_code == promo_item_code
|
||||
give_promotion_second_product(item)
|
||||
else
|
||||
add_promotion_second_item
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def give_promotion_second_product(item, foc_min_qty)
|
||||
if item.qty > foc_min_qty
|
||||
|
||||
else
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def self.add_promotion_item
|
||||
|
||||
end
|
||||
|
||||
def self.add_promotion_second_item
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
class CrmOrderPdf < Prawn::Document
|
||||
attr_accessor :receipt_width,:price_column_width,:p_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_column_width,:item_description_width
|
||||
def initialize(booking,order_items,printer_settings)
|
||||
self.page_width = PrintSetting.where("name = ?","CRM Order").first.page_width
|
||||
self.page_height = PrintSetting.where("name = ?","CRM Order").first.page_height
|
||||
self.page_width = printer_settings.page_width
|
||||
self.page_height = printer_settings.page_height
|
||||
self.margin = 10
|
||||
# self.price_width = self.p_width / 2
|
||||
self.price_width=80
|
||||
|
||||
@@ -2,8 +2,8 @@ class OrderItemPdf < 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
|
||||
def initialize(print_settings,order_item, print_status, options, alt_name)
|
||||
self.page_width = PrintSetting.where("name = ?","OrderItemPdf").first.page_width
|
||||
self.page_height = PrintSetting.where("name = ?","OrderItemPdf").first.page_height
|
||||
self.page_width = print_settings.page_width
|
||||
self.page_height = print_settings.page_height
|
||||
self.margin = 0
|
||||
self.price_width = 40 # No Need for item
|
||||
self.qty_width = 40
|
||||
|
||||
@@ -2,8 +2,8 @@ class OrderSummaryPdf < 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
|
||||
def initialize(print_settings,order, print_status, order_items = nil,alt_name)
|
||||
self.page_width = PrintSetting.where("name = ?","Order Summary").first.page_width
|
||||
self.page_height = PrintSetting.where("name = ?","Order Summary").first.page_height
|
||||
self.page_width = print_settings.page_width
|
||||
self.page_height = print_settings.page_height
|
||||
self.margin = 0
|
||||
self.price_width = 40 # No Need for item
|
||||
self.qty_width = 40
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
class QueueNoPdf < Prawn::Document
|
||||
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
|
||||
def initialize(printer_settings, queue)
|
||||
self.page_width = PrintSetting.where("name = ?","Queue No").first.page_width
|
||||
self.page_height = PrintSetting.where("name = ?","Queue No").first.page_height
|
||||
self.page_width = printer_settings.page_width
|
||||
self.page_height = printer_settings.page_height
|
||||
self.margin = 5
|
||||
self.price_width = 35
|
||||
self.qty_width = 20
|
||||
|
||||
@@ -2,8 +2,8 @@ class ReceiptBillPdf < 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, :description_width, :price_num_width
|
||||
def initialize(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount = nil,shop_details, printed_status)
|
||||
self.page_width = PrintSetting.where("name = ?","Receipt Bill").first.page_width
|
||||
self.page_height = PrintSetting.where("name = ?","Receipt Bill").first.page_height
|
||||
self.page_width = printer_settings.page_width
|
||||
self.page_height = printer_settings.page_height
|
||||
self.margin = 5
|
||||
self.price_width = 40
|
||||
self.qty_width = 20
|
||||
|
||||
@@ -35,6 +35,7 @@ json.account_id item.account_id
|
||||
json.min_qty item.min_qty
|
||||
json.is_available item.is_available
|
||||
json.is_sub_item item.is_sub_item
|
||||
json.unit item.unit
|
||||
json.item_sets item.item_sets
|
||||
json.attributes attr_format
|
||||
json.options item.item_options
|
||||
|
||||
@@ -251,7 +251,7 @@
|
||||
font-weight: 400;
|
||||
text-transform: uppercase;
|
||||
transition: color 0.3s ease;
|
||||
line-height: 48px;
|
||||
/*line-height: 48px;*/
|
||||
}
|
||||
|
||||
.card .card-content {
|
||||
@@ -259,7 +259,7 @@
|
||||
border-radius: 0 0 2px 2px;
|
||||
background-clip: padding-box;
|
||||
box-sizing: border-box;
|
||||
height: 120px;
|
||||
/*height: 120px;*/
|
||||
transition: color 0.3s ease;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
@@ -108,17 +108,15 @@
|
||||
<button id="cash_in" type="button" class="btn btn-block btn-primary"> Cash In </button>
|
||||
<button id="cash_out" type="button" class="btn btn-block btn-primary"> Cash Out </button>
|
||||
<!-- Temporary Disabled -->
|
||||
<%if current_login_employee.role == "cashier" && @shop.quick_sale_summary == true%>
|
||||
<button id="sale_summary" type="button" class="btn btn-block btn-primary">Sale Summary</button>
|
||||
<%end%>
|
||||
|
||||
<button id="close_cashier" type="button" class="btn btn-block btn-primary"> Close Cashier </button>
|
||||
|
||||
|
||||
<%if current_login_employee.role == "administrator" || current_login_employee.role == "manager" %>
|
||||
<button id="back" type="button" class="btn btn-block btn-primary"><i class="fa fa-home fa-lg"></i> Back
|
||||
|
||||
|
||||
<%if current_login_employee.role == "administrator" || current_login_employee.role == "manager" %>
|
||||
<button id="back" type="button" class="btn btn-block btn-primary"><i class="fa fa-home fa-lg"></i> Back
|
||||
</button>
|
||||
<%end%>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- Column One -->
|
||||
|
||||
@@ -310,39 +310,39 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Column Three -->
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<!-- Waiter Buttons -->
|
||||
<!-- Column Three -->
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<!-- Waiter Buttons -->
|
||||
|
||||
<button type="button" class="btn btn-primary btn-block" id='back'>Back</button>
|
||||
<button type="button" id="add_order" class="btn btn-primary btn-block">Add Order</button>
|
||||
<% if @dining.bookings.length >= 1 %>
|
||||
<button type="button" id="customer" class="btn btn-primary btn-block">Customer</button>
|
||||
<% if @status_order == 'order' && @status_sale != 'sale' %>
|
||||
<button type="button" class="btn btn-primary btn-block" disabled>Edit</button>
|
||||
<button type="button" id="discount" class="btn btn-primary btn-block" disabled>Discount</button>
|
||||
<button type="button" id="other-charges" class="btn btn-primary btn-block" disabled>Charges</button>
|
||||
<button type="button" class="btn btn-primary btn-block" id='move'>Move</button>
|
||||
<button type="button" id="request_bills" class="btn btn-primary btn-block">Req.Bill</button>
|
||||
<button type="button" id="first_bill" class="btn btn-primary btn-block" disabled>First Bill</button>
|
||||
<button type="button" id="pay" class="btn btn-primary btn-block" disabled>Pay</button>
|
||||
<button type="button" class="btn btn-primary btn-block" disabled> Void</button>
|
||||
<% else %>
|
||||
<button type="button" class="btn btn-primary btn-block" id='edit'>Edit</button>
|
||||
<button type="button" id="discount" class="btn btn-primary btn-block">Discount</button>
|
||||
<button type="button" id="other-charges" class="btn btn-primary btn-block">Charges</button>
|
||||
<button type="button" id="commissions" class="btn btn-primary btn-block">Commissions</button>
|
||||
<button type="button" class="btn btn-primary btn-block" id='move' disabled="">Move</button>
|
||||
<button type="button" id="request_bills" class="btn btn-primary btn-block" disabled> Req.Bill</button>
|
||||
<button type="button" id="first_bill" class="btn btn-primary btn-block">First Bill</button>
|
||||
<button type="button" id="pay" class="btn btn-primary btn-block">Pay</button>
|
||||
<button type="button" id="void" class="btn btn-primary btn-block"> Void</button>
|
||||
<% end %>
|
||||
<!-- Cashier Buttons -->
|
||||
<button type="button" class="btn btn-primary btn-block" id='back' >Back</button>
|
||||
<button type="button" id="add_order" class="btn btn-primary btn-block" >Add Order</button>
|
||||
<% if @dining.bookings.length >= 1 %>
|
||||
<% if @status_order == 'order' && @status_sale != 'sale' %>
|
||||
<button type="button" id="customer" class="btn btn-primary btn-block" disabled>Customer</button>
|
||||
<button type="button" class="btn btn-primary btn-block" disabled >Edit</button>
|
||||
<button type="button" id="discount" class="btn btn-primary btn-block" disabled>Discount</button>
|
||||
<button type="button" id="other-charges" class="btn btn-primary btn-block" disabled>Charges</button>
|
||||
<button type="button" class="btn btn-primary btn-block" id='move'>Move</button>
|
||||
<button type="button" id="request_bills" class="btn btn-primary btn-block">Req.Bill</button>
|
||||
<button type="button" id="first_bill" class="btn btn-primary btn-block" disabled>First Bill</button>
|
||||
<button type="button" id="pay" class="btn btn-primary btn-block" disabled>Pay</button>
|
||||
<button type="button" class="btn btn-primary btn-block" disabled> Void </button>
|
||||
<% else %>
|
||||
<button type="button" id="customer" class="btn btn-primary btn-block" >Customer</button>
|
||||
<button type="button" class="btn btn-primary btn-block" id='edit'>Edit</button>
|
||||
<button type="button" id="discount" class="btn btn-primary btn-block" >Discount</button>
|
||||
<button type="button" id="other-charges" class="btn btn-primary btn-block" >Charges</button>
|
||||
<button type="button" class="btn btn-primary btn-block" id='move' disabled="">Move</button>
|
||||
<button type="button" id="request_bills" class="btn btn-primary btn-block" disabled> Req.Bill</button>
|
||||
<button type="button" id="first_bill" class="btn btn-primary btn-block">First Bill</button>
|
||||
<button type="button" id="pay" class="btn btn-primary btn-block">Pay</button>
|
||||
<button type="button" id="void" class="btn btn-primary btn-block" > Void </button>
|
||||
<% end %>
|
||||
<!-- Cashier Buttons -->
|
||||
|
||||
<!-- <button type="button" id="re-print" class="btn btn-primary btn-block" >Re.Print</button> -->
|
||||
<% end %>
|
||||
</div>
|
||||
<!-- <button type="button" id="re-print" class="btn btn-primary btn-block" >Re.Print</button> -->
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
|
||||
@@ -303,7 +303,6 @@
|
||||
<!-- Waiter Buttons -->
|
||||
<button type="button" class="btn btn-primary btn-block" id='back' >Back</button>
|
||||
<% if @room.bookings.length >= 1 %>
|
||||
|
||||
<% if @status_order == 'order' && @status_sale != 'sale' %>
|
||||
<!-- <button type="button" class="btn btn-primary btn-block" >Add Order</button> -->
|
||||
<button type="button" id="customer" class="btn btn-primary btn-block" disabled>Customer</button>
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
<%= f.input :is_sub_item, :class => "form-control" %>
|
||||
|
||||
<%= f.input :unit, :collection => Lookup.collection_of("unit") ,:class => "form-control" %>
|
||||
|
||||
<%= f.input :item_attributes, :collection => @item_attributes, :input_html => { :multiple => true }, :class => "form-control item_attributes" %>
|
||||
|
||||
<%= f.input :item_options, :collection => @item_options, :input_html => { :multiple => true }, :class => "form-control item_options" %>
|
||||
|
||||
@@ -16,13 +16,13 @@ $(function(){
|
||||
<%
|
||||
@settings_menu_item.item_sets.each do |set|
|
||||
%>
|
||||
$("#simple_menu_item_item_sets option[value='" + <%= set.id %> + "']").attr("selected","selected").css({'color':'#fff','background':'#215d9c'});
|
||||
$("#set_menu_item_item_sets option[value='" + <%= set.id %> + "']").attr("selected","selected").css({'color':'#fff','background':'#215d9c'});
|
||||
<%
|
||||
end
|
||||
%>
|
||||
|
||||
// After loaded
|
||||
$("#simple_menu_item_item_sets").on('click', 'option', function(e){
|
||||
$("#set_menu_item_item_sets").on('click', 'option', function(e){
|
||||
if($(this).attr("selected")){
|
||||
$(this).removeAttr("selected");
|
||||
$(this).css({'color':'#000','background':'#fff'});
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
<%= f.input :is_sub_item, :class => "form-control" %>
|
||||
|
||||
<%= f.input :unit, :collection => Lookup.collection_of("unit") ,:class => "form-control" %>
|
||||
|
||||
<%= f.input :item_attributes, :collection => @item_attributes, :input_html => { :multiple => true }, :class => "form-control item_attributes" %>
|
||||
|
||||
<%= f.input :item_options, :collection => @item_options, :input_html => { :multiple => true }, :class => "form-control item_options" %>
|
||||
|
||||
@@ -7,6 +7,7 @@ class CreateMenuItems < ActiveRecord::Migration[5.1]
|
||||
t.string :image_path
|
||||
t.text :description
|
||||
t.string :information
|
||||
t.string :unit
|
||||
t.string :type, :null => false, :default => "SimpleMenuItem"
|
||||
t.references :menu_category, foreign_key: true
|
||||
t.json :item_attributes
|
||||
|
||||
@@ -95,8 +95,12 @@ float_value = Lookup.create([{lookup_type:'float_value', name: '500', value: '50
|
||||
|
||||
# customer type
|
||||
customer_type = Lookup.create([{lookup_type:'customer_type', name: 'Dinein', value: 'Dinein'},
|
||||
{lookup_type:'customer_type', name: 'Takeaway', value: 'Takeaway'},
|
||||
{lookup_type:'customer_type', name: 'Delivery', value: 'Delivery'}])
|
||||
{lookup_type:'customer_type', name: 'Takeaway', value: 'Takeaway'},
|
||||
{lookup_type:'customer_type', name: 'Delivery', value: 'Delivery'}])
|
||||
|
||||
#unit
|
||||
units = Lookup.create([{lookup_type:'unit', name: 'PCS', value: 'pcs'},
|
||||
{lookup_type:'unit', name: 'KG', value: 'kg'}])
|
||||
|
||||
# Default CUSTOMER
|
||||
customer = Customer.create({name:"WALK-IN", email: "cus1@customer.com", contact_no:"000000000",card_no:"000", customer_type:"Dinein", tax_profiles:["2", "1"]})
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 4.9 KiB |
Reference in New Issue
Block a user