Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into crm
This commit is contained in:
5
Gemfile
5
Gemfile
@@ -9,10 +9,13 @@ end
|
|||||||
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
||||||
gem 'rails', '~> 5.1.0'
|
gem 'rails', '~> 5.1.0'
|
||||||
# Use mysql as the database for Active Record
|
# Use mysql as the database for Active Record
|
||||||
|
|
||||||
|
#gem 'mysql2', '>= 0.3.18', '< 0.5'
|
||||||
|
gem 'pg'
|
||||||
gem 'mysql2', '>= 0.3.18', '< 0.5'
|
gem 'mysql2', '>= 0.3.18', '< 0.5'
|
||||||
|
|
||||||
#Use PosgreSQL
|
#Use PosgreSQL
|
||||||
gem 'pg'
|
|
||||||
|
|
||||||
# redis server for cable
|
# redis server for cable
|
||||||
# gem 'redis', '~> 3.0'
|
# gem 'redis', '~> 3.0'
|
||||||
|
|||||||
@@ -25,25 +25,30 @@ class Api::BillController < Api::ApiController
|
|||||||
@status, @sale_id = @sale.generate_invoice_from_order(params[:order_id], current_login_employee, get_cashier)
|
@status, @sale_id = @sale.generate_invoice_from_order(params[:order_id], current_login_employee, get_cashier)
|
||||||
end
|
end
|
||||||
|
|
||||||
@sale_data = Sale.find_by_sale_id(@sale_id)
|
# Not Use for these printed bill cannot give customer
|
||||||
@sale_items = SaleItem.where("sale_id=?",@sale_id)
|
# @sale_data = Sale.find_by_sale_id(@sale_id)
|
||||||
|
# @sale_items = SaleItem.where("sale_id=?",@sale_id)
|
||||||
|
|
||||||
unique_code = "ReceiptBillPdf"
|
# unique_code = "ReceiptBillPdf"
|
||||||
#shop detail
|
# #shop detail
|
||||||
shop_details = Shop.find(1)
|
# shop_details = Shop.find(1)
|
||||||
|
|
||||||
customer= Customer.find(@sale_data.customer_id)
|
# customer= Customer.find(@sale_data.customer_id)
|
||||||
# get member information
|
# # get member information
|
||||||
member_info = Customer.get_member_account(customer)
|
# member_info = Customer.get_member_account(customer)
|
||||||
|
|
||||||
# get printer info
|
|
||||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
|
||||||
|
|
||||||
# Calculate Price by accounts
|
# # get printer info
|
||||||
item_price_by_accounts = SaleItem.calculate_price_by_accounts(@sale_items)
|
# print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||||
|
|
||||||
|
# # Calculate Price by accounts
|
||||||
|
# item_price_by_accounts = SaleItem.calculate_price_by_accounts(@sale_items)
|
||||||
|
|
||||||
|
|
||||||
|
# printer = Printer::ReceiptPrinter.new(print_settings)
|
||||||
|
# printer.print_receipt_bill(print_settings,@sale_items,@sale_data,customer.name, item_price_by_accounts, member_info, shop_details)
|
||||||
|
|
||||||
|
|
||||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
|
||||||
printer.print_receipt_bill(print_settings,@sale_items,@sale_data,customer.name, item_price_by_accounts)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -68,8 +68,10 @@ class Api::OrdersController < Api::ApiController
|
|||||||
if booking.dining_facility_id.to_i == params[:table_id].to_i && booking.booking_status != 'moved'
|
if booking.dining_facility_id.to_i == params[:table_id].to_i && booking.booking_status != 'moved'
|
||||||
if !booking.sale_id.nil?
|
if !booking.sale_id.nil?
|
||||||
sale_status = check_order_with_booking(booking)
|
sale_status = check_order_with_booking(booking)
|
||||||
|
puts "WWwwWWWWWWww"
|
||||||
|
puts sale_status
|
||||||
if sale_status
|
if sale_status
|
||||||
return false
|
return false , @message = "bill requested"
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@order.new_booking = false
|
@order.new_booking = false
|
||||||
@@ -77,22 +79,38 @@ class Api::OrdersController < Api::ApiController
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
sale_status = check_order_with_table(params[:table_id])
|
sale_status = check_order_with_table(params[:table_id])
|
||||||
|
puts "OOOOOOOOO"
|
||||||
|
puts sale_status
|
||||||
if sale_status
|
if sale_status
|
||||||
return false
|
return false , @message = "bill requested"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end #booking exists
|
end #booking exists
|
||||||
else
|
else
|
||||||
check_order_with_table(params[:table_id])
|
sale_status = check_order_with_table(params[:table_id])
|
||||||
end
|
puts "MMMMMMMM"
|
||||||
|
puts sale_status
|
||||||
|
if sale_status
|
||||||
|
return false , @message = "bill requested"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
@status, @booking = @order.generate
|
@status, @booking = @order.generate
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# render json for http status code 202
|
||||||
|
def return_json_status_with_code(code, msg, booking_id)
|
||||||
|
render status: code, json: {
|
||||||
|
message: msg,
|
||||||
|
booking_id: booking_id
|
||||||
|
}.to_json
|
||||||
|
end
|
||||||
|
|
||||||
def check_order_with_table(table_id)
|
def check_order_with_table(table_id)
|
||||||
table = DiningFacility.find(table_id)
|
table = DiningFacility.find(table_id)
|
||||||
if table
|
if table
|
||||||
booking = table.get_current_booking
|
booking = table.get_current_booking
|
||||||
|
puts booking
|
||||||
if booking
|
if booking
|
||||||
if booking.sale.sale_status == "completed" || booking.sale.sale_status == "billed"
|
if booking.sale.sale_status == "completed" || booking.sale.sale_status == "billed"
|
||||||
@order.new_booking = true
|
@order.new_booking = true
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ class HomeController < ApplicationController
|
|||||||
skip_before_action :authenticate, only: [:index, :show, :create, :update, :destroy]
|
skip_before_action :authenticate, only: [:index, :show, :create, :update, :destroy]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@employees = Employee.all.order("name asc")
|
@employees = Employee.all_emp_except_waiter.order("name asc")
|
||||||
@login_form = LoginForm.new()
|
@login_form = LoginForm.new()
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -20,7 +20,6 @@ class HomeController < ApplicationController
|
|||||||
if @employee != nil
|
if @employee != nil
|
||||||
session[:session_token] = @employee.token_session
|
session[:session_token] = @employee.token_session
|
||||||
route_by_role(@employee)
|
route_by_role(@employee)
|
||||||
|
|
||||||
else
|
else
|
||||||
render :show, flash[:notice] => "Invalid PIN for Employee. Please try again!"
|
render :show, flash[:notice] => "Invalid PIN for Employee. Please try again!"
|
||||||
end
|
end
|
||||||
@@ -38,7 +37,7 @@ class HomeController < ApplicationController
|
|||||||
redirect_to dashboard_path
|
redirect_to dashboard_path
|
||||||
elsif @employee.role == "cashier"
|
elsif @employee.role == "cashier"
|
||||||
session[:session_token] = @employee.token_session
|
session[:session_token] = @employee.token_session
|
||||||
redirect_to origami_root_path
|
route_by_role(@employee)
|
||||||
elsif @employee.role == "manager"
|
elsif @employee.role == "manager"
|
||||||
session[:session_token] = @employee.token_session
|
session[:session_token] = @employee.token_session
|
||||||
redirect_to dashboard_path
|
redirect_to dashboard_path
|
||||||
@@ -81,13 +80,13 @@ class HomeController < ApplicationController
|
|||||||
redirect_to dashboard_path
|
redirect_to dashboard_path
|
||||||
elsif employee.role == "cashier"
|
elsif employee.role == "cashier"
|
||||||
#check if cashier has existing open cashier
|
#check if cashier has existing open cashier
|
||||||
|
shift = ShiftSale.current_open_shift(employee.id)
|
||||||
# if !ShiftSale.current_open_shift(employee).nil?
|
if !shift.nil?
|
||||||
# redirect_to origami_root_path
|
redirect_to origami_root_path
|
||||||
# else
|
else
|
||||||
redirect_to new_origami_shift_path
|
redirect_to new_origami_shift_path
|
||||||
# end
|
end
|
||||||
elsif employee.role == "checker"
|
elsif employee.role == "manager"
|
||||||
redirect_to oqs_root_path
|
redirect_to oqs_root_path
|
||||||
elsif employee.role == "waiter"
|
elsif employee.role == "waiter"
|
||||||
redirect_to oqs_root_path
|
redirect_to oqs_root_path
|
||||||
|
|||||||
15
app/controllers/origami/cash_ins_controller.rb
Normal file
15
app/controllers/origami/cash_ins_controller.rb
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
class Origami::CashInsController < BaseOrigamiController
|
||||||
|
|
||||||
|
def new
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
reference = params[:reference]
|
||||||
|
remark = params[:remark]
|
||||||
|
amount = params[:amount]
|
||||||
|
payment_method = params[:payment_method]
|
||||||
|
payment_method_reference = params[:payment_method_reference]
|
||||||
|
p_jour = PaymentJournal.new
|
||||||
|
p_jour.cash_in(reference, remark, amount, payment_method, payment_method_reference, current_user.id)
|
||||||
|
end
|
||||||
|
end
|
||||||
13
app/controllers/origami/cash_outs_controller.rb
Normal file
13
app/controllers/origami/cash_outs_controller.rb
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
class Origami::CashOutsController < BaseOrigamiController
|
||||||
|
|
||||||
|
def new
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
reference = params[:reference]
|
||||||
|
remark = params[:remark]
|
||||||
|
amount = params[:amount]
|
||||||
|
p_jour = PaymentJournal.new
|
||||||
|
p_jour.cash_out(reference, remark, amount, current_user.id)
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -6,6 +6,7 @@ class Origami::HomeController < BaseOrigamiController
|
|||||||
@rooms = Room.all.active.order('status desc')
|
@rooms = Room.all.active.order('status desc')
|
||||||
@complete = Sale.all
|
@complete = Sale.all
|
||||||
@orders = Order.all.order('date desc')
|
@orders = Order.all.order('date desc')
|
||||||
|
# @shift = ShiftSale.current_open_shift(current_user.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
# origami table detail
|
# origami table detail
|
||||||
|
|||||||
@@ -19,9 +19,9 @@ class Origami::HomeController < BaseOrigamiController
|
|||||||
@orders = Order.get_orders()
|
@orders = Order.get_orders()
|
||||||
end
|
end
|
||||||
|
|
||||||
def item_show
|
# def item_show
|
||||||
selection(params[:booking_id],1)
|
# selection(params[:booking_id],1)
|
||||||
end
|
# end
|
||||||
|
|
||||||
def selection(selected_id, is_ajax)
|
def selection(selected_id, is_ajax)
|
||||||
str = []
|
str = []
|
||||||
@@ -37,8 +37,8 @@ class Origami::HomeController < BaseOrigamiController
|
|||||||
@order_details = OrderItem.get_order_items_details(params[:booking_id])
|
@order_details = OrderItem.get_order_items_details(params[:booking_id])
|
||||||
@order_details.each do |ord_detail|
|
@order_details.each do |ord_detail|
|
||||||
str.push(ord_detail)
|
str.push(ord_detail)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if is_ajax == 1
|
if is_ajax == 1
|
||||||
render :json => str.to_json
|
render :json => str.to_json
|
||||||
|
|||||||
@@ -4,6 +4,34 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
def index
|
def index
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def first_bill
|
||||||
|
sale_id = params[:sale_id] # sale_id
|
||||||
|
sale_data = Sale.find_by_sale_id(sale_id)
|
||||||
|
sale_items = SaleItem.where("sale_id=?",sale_id)
|
||||||
|
|
||||||
|
# Print for First Bill to Customer
|
||||||
|
unique_code = "ReceiptBillPdf"
|
||||||
|
#shop detail
|
||||||
|
shop_details = Shop.find(1)
|
||||||
|
# customer= Customer.where('customer_id=' +.customer_id)
|
||||||
|
customer= Customer.find(sale_data.customer_id)
|
||||||
|
# get member information
|
||||||
|
member_info = Customer.get_member_account(customer)
|
||||||
|
# get printer info
|
||||||
|
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||||
|
|
||||||
|
# find order id by sale id
|
||||||
|
# sale_order = SaleOrder.find_by_sale_id(@sale_data.sale_id)
|
||||||
|
|
||||||
|
# Calculate price_by_accounts
|
||||||
|
item_price_by_accounts = SaleItem.calculate_price_by_accounts(sale_items)
|
||||||
|
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(sale_items)
|
||||||
|
|
||||||
|
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||||
|
|
||||||
|
printer.print_receipt_bill(print_settings,sale_items,sale_data,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, shop_details)
|
||||||
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
cash = params[:cash]
|
cash = params[:cash]
|
||||||
sale_id = params[:sale_id]
|
sale_id = params[:sale_id]
|
||||||
@@ -26,9 +54,10 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||||
# Calculate Food and Beverage Total
|
# Calculate Food and Beverage Total
|
||||||
item_price_by_accounts = SaleItem.calculate_price_by_accounts(saleObj.sale_items)
|
item_price_by_accounts = SaleItem.calculate_price_by_accounts(saleObj.sale_items)
|
||||||
|
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
|
||||||
|
|
||||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||||
printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, member_info,rebate_amount,shop_details)
|
printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -104,10 +133,9 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
|
|
||||||
# Calculate price_by_accounts
|
# Calculate price_by_accounts
|
||||||
item_price_by_accounts = SaleItem.calculate_price_by_accounts(saleObj.sale_items)
|
item_price_by_accounts = SaleItem.calculate_price_by_accounts(saleObj.sale_items)
|
||||||
|
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
|
||||||
|
|
||||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||||
printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, member_info,rebate_amount,shop_details)
|
printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ class Origami::RequestBillsController < BaseOrigamiController
|
|||||||
check_booking = Booking.find_by_booking_id(bk_order.booking_id)
|
check_booking = Booking.find_by_booking_id(bk_order.booking_id)
|
||||||
if check_booking.sale_id.nil?
|
if check_booking.sale_id.nil?
|
||||||
# Create Sale if it doesn't exist
|
# Create Sale if it doesn't exist
|
||||||
puts "current_login_employee"
|
# puts "current_login_employee"
|
||||||
puts current_login_employee.name
|
# puts current_login_employee.name
|
||||||
@status, @sale_id = @sale.generate_invoice_from_booking(check_booking.id,current_login_employee, cashier = nil)
|
@status, @sale_id = @sale.generate_invoice_from_booking(check_booking.id,current_login_employee, cashier = nil)
|
||||||
@sale_data = Sale.find_by_sale_id(@sale_id)
|
@sale_data = Sale.find_by_sale_id(@sale_id)
|
||||||
@sale_items = SaleItem.where("sale_id=?",@sale_id)
|
@sale_items = SaleItem.where("sale_id=?",@sale_id)
|
||||||
@@ -20,26 +20,26 @@ class Origami::RequestBillsController < BaseOrigamiController
|
|||||||
@sale_items = SaleItem.where("sale_id=?",@sale_data.sale_id)
|
@sale_items = SaleItem.where("sale_id=?",@sale_data.sale_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
unique_code = "ReceiptBillPdf"
|
# Not Use for these printed bill cannot give customer
|
||||||
#shop detail
|
# unique_code = "ReceiptBillPdf"
|
||||||
shop_details = Shop.find(1)
|
# #shop detail
|
||||||
# customer= Customer.where('customer_id=' +.customer_id)
|
# shop_details = Shop.find(1)
|
||||||
customer= Customer.find(@sale_data.customer_id)
|
# # customer= Customer.where('customer_id=' +.customer_id)
|
||||||
# get member information
|
# customer= Customer.find(@sale_data.customer_id)
|
||||||
member_info = Customer.get_member_account(customer)
|
# # get member information
|
||||||
# get printer info
|
# member_info = Customer.get_member_account(customer)
|
||||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
# # get printer info
|
||||||
|
# print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||||
|
|
||||||
# find order id by sale id
|
# # find order id by sale id
|
||||||
# sale_order = SaleOrder.find_by_sale_id(@sale_data.sale_id)
|
# # sale_order = SaleOrder.find_by_sale_id(@sale_data.sale_id)
|
||||||
|
|
||||||
# Calculate price_by_accounts
|
# # Calculate price_by_accounts
|
||||||
item_price_by_accounts = SaleItem.calculate_price_by_accounts(@sale_items)
|
# item_price_by_accounts = SaleItem.calculate_price_by_accounts(@sale_items)
|
||||||
|
|
||||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
# printer = Printer::ReceiptPrinter.new(print_settings)
|
||||||
|
|
||||||
printer.print_receipt_bill(print_settings,@sale_items,@sale_data,customer.name, item_price_by_accounts,member_info,shop_details)
|
|
||||||
# redirect_to origami_path(@sale_data.sale_id)
|
|
||||||
|
|
||||||
|
# printer.print_receipt_bill(print_settings,@sale_items,@sale_data,customer.name, item_price_by_accounts,member_info,shop_details)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ class Origami::SaleEditController < BaseOrigamiController
|
|||||||
@newsaleitem.save
|
@newsaleitem.save
|
||||||
@newsaleitem.qty = saleitemObj.qty * -1
|
@newsaleitem.qty = saleitemObj.qty * -1
|
||||||
@newsaleitem.price = saleitemObj.price * -1
|
@newsaleitem.price = saleitemObj.price * -1
|
||||||
|
@newsaleitem.is_taxable = 0
|
||||||
@newsaleitem.product_name = saleitemObj.product_name + " - void"
|
@newsaleitem.product_name = saleitemObj.product_name + " - void"
|
||||||
@newsaleitem.save
|
@newsaleitem.save
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,11 +1,28 @@
|
|||||||
class Origami::ShiftsController < ApplicationController
|
class Origami::ShiftsController < BaseOrigamiController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
@shift = ShiftSale.current_open_shift(current_user.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
|
@float = Lookup.where('lookup_type=?','float_value')
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
opening_balance = params[:opening_balance]
|
||||||
|
@shift = ShiftSale.new
|
||||||
|
@shift.create(opening_balance,current_user)
|
||||||
|
end
|
||||||
|
|
||||||
|
def update_shift
|
||||||
|
@shift = ShiftSale.current_open_shift(current_user.id)
|
||||||
|
if @shift
|
||||||
|
@shift.shift_closed_at = DateTime.now.utc
|
||||||
|
@shift.save
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
|
|||||||
@@ -1,11 +1,16 @@
|
|||||||
class Employee < ApplicationRecord
|
class Employee < ApplicationRecord
|
||||||
has_secure_password
|
has_secure_password
|
||||||
|
|
||||||
|
has_many :shit_sales
|
||||||
validates_presence_of :name, :role
|
validates_presence_of :name, :role
|
||||||
validates_presence_of :password, :on => [:create]
|
validates_presence_of :password, :on => [:create]
|
||||||
validates :emp_id, uniqueness: true, numericality: true, length: {in: 1..4}, allow_blank: true
|
validates :emp_id, uniqueness: true, numericality: true, length: {in: 1..4}, allow_blank: true
|
||||||
validates :password, numericality: true, length: {in: 3..9}, allow_blank: true
|
validates :password, numericality: true, length: {in: 3..9}, allow_blank: true
|
||||||
|
|
||||||
|
def self.all_emp_except_waiter
|
||||||
|
Employee.where('role!=?','waiter')
|
||||||
|
end
|
||||||
|
|
||||||
def self.collection
|
def self.collection
|
||||||
Employee.select("id, name").map { |e| [e.name, e.id] }
|
Employee.select("id, name").map { |e| [e.name, e.id] }
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -25,9 +25,8 @@ class Order < ApplicationRecord
|
|||||||
booking = nil
|
booking = nil
|
||||||
|
|
||||||
if self.new_booking
|
if self.new_booking
|
||||||
|
|
||||||
booking = Booking.create({:dining_facility_id => self.table_id,:type => "TableBooking",
|
booking = Booking.create({:dining_facility_id => self.table_id,:type => "TableBooking",
|
||||||
:checkin_at => Time.now.utc.getlocal, :checkin_by => self.employee_name,
|
:checkin_at => Time.now.utc, :checkin_by => self.employee_name,
|
||||||
:booking_status => "assign" })
|
:booking_status => "assign" })
|
||||||
table = DiningFacility.find(self.table_id)
|
table = DiningFacility.find(self.table_id)
|
||||||
table.status = "occupied"
|
table.status = "occupied"
|
||||||
@@ -55,7 +54,7 @@ class Order < ApplicationRecord
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return false
|
return false, @message = "booking fail"
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -301,7 +300,7 @@ class Order < ApplicationRecord
|
|||||||
.joins("left join dining_facilities on dining_facilities.id = bookings.dining_facility_id")
|
.joins("left join dining_facilities on dining_facilities.id = bookings.dining_facility_id")
|
||||||
.joins("left join orders on orders.order_id = booking_orders.order_id")
|
.joins("left join orders on orders.order_id = booking_orders.order_id")
|
||||||
.joins("left join sales on sales.sale_id = bookings.sale_id")
|
.joins("left join sales on sales.sale_id = bookings.sale_id")
|
||||||
.where("(orders.status = 'new' or orders.status = 'billed')")
|
.where("(orders.status = 'new' or orders.status = 'billed') AND orders.date between #{ from } and #{ to }")
|
||||||
|
|
||||||
# orders = Order.select("orders.order_id as order_id,sales.receipt_no,orders.status as order_status, sales.sale_status as sale_status,
|
# orders = Order.select("orders.order_id as order_id,sales.receipt_no,orders.status as order_status, sales.sale_status as sale_status,
|
||||||
# orders.order_id as order_id,sales.customer_id as sale_customer_id,orders.customer_id as order_customer_id
|
# orders.order_id as order_id,sales.customer_id as sale_customer_id,orders.customer_id as order_customer_id
|
||||||
|
|||||||
@@ -1,2 +1,22 @@
|
|||||||
class PaymentJournal < ApplicationRecord
|
class PaymentJournal < ApplicationRecord
|
||||||
|
|
||||||
|
def cash_in(reference, remark, amount, payment_method, payment_method_reference, current_user)
|
||||||
|
self.payment_references = reference
|
||||||
|
self.remark = remark
|
||||||
|
self.credit_amount = amount
|
||||||
|
self.payment_method = payment_method
|
||||||
|
self.payment_status = 'paid'
|
||||||
|
self.payment_method_references = payment_method_reference
|
||||||
|
self.created_by = current_user
|
||||||
|
self.save
|
||||||
|
end
|
||||||
|
|
||||||
|
def cash_out(payment_reference, remark, amount, current_user)
|
||||||
|
self.payment_references = payment_reference
|
||||||
|
self.remark = remark
|
||||||
|
self.debit_amount = amount
|
||||||
|
self.payment_status = 'paid'
|
||||||
|
self.created_by = current_user
|
||||||
|
self.save
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -65,11 +65,11 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
|||||||
end
|
end
|
||||||
|
|
||||||
#Bill Receipt Print
|
#Bill Receipt Print
|
||||||
def print_receipt_bill(printer_settings,sale_items,sale_data, customer_name, item_price_by_accounts, member_info = nil,rebate_amount=nil,shop_details)
|
def print_receipt_bill(printer_settings,sale_items,sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount=nil,shop_details)
|
||||||
#Use CUPS service
|
#Use CUPS service
|
||||||
#Generate PDF
|
#Generate PDF
|
||||||
#Print
|
#Print
|
||||||
pdf = ReceiptBillPdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, member_info,rebate_amount,shop_details)
|
pdf = ReceiptBillPdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details)
|
||||||
|
|
||||||
# print as print copies in printer setting
|
# print as print copies in printer setting
|
||||||
count = printer_settings.print_copies
|
count = printer_settings.print_copies
|
||||||
|
|||||||
@@ -270,7 +270,6 @@ class Sale < ApplicationRecord
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def product_get_unit_price(item_code)
|
def product_get_unit_price(item_code)
|
||||||
|
|||||||
@@ -30,15 +30,17 @@ class SaleItem < ApplicationRecord
|
|||||||
# end
|
# end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Get Prices for each accounts (eg: food, beverage)
|
||||||
def self.calculate_price_by_accounts(sale_items)
|
def self.calculate_price_by_accounts(sale_items)
|
||||||
price_accounts = []
|
price_accounts = []
|
||||||
Account.all.each do |a|
|
Account.all.each do |a|
|
||||||
account_price = {:name => a.title, :price => 0}
|
account_price = {:name => a.title, :price => 0}
|
||||||
|
|
||||||
|
# Check for actual sale items
|
||||||
sale_items.each do |si|
|
sale_items.each do |si|
|
||||||
if si.account_id == a.id
|
if si.account_id == a.id
|
||||||
account_price[:price] = account_price[:price] + si.price
|
account_price[:price] = account_price[:price] + si.price
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
price_accounts.push(account_price)
|
price_accounts.push(account_price)
|
||||||
end
|
end
|
||||||
@@ -46,6 +48,24 @@ class SaleItem < ApplicationRecord
|
|||||||
return price_accounts
|
return price_accounts
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Get discount Prices for each accounts (eg: food, beverage)
|
||||||
|
def self.get_discount_price_by_accounts(sale_items)
|
||||||
|
discount_accounts = []
|
||||||
|
Account.all.each do |a|
|
||||||
|
discount_account = {:name => a.title, :price => 0}
|
||||||
|
|
||||||
|
# Check for actual sale items
|
||||||
|
sale_items.where("is_taxable = false AND remark = 'Discount'").find_each do |si|
|
||||||
|
if si.account_id == a.id
|
||||||
|
discount_account[:price] = (discount_account[:price] + si.price) * -1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
discount_accounts.push(discount_account)
|
||||||
|
end
|
||||||
|
|
||||||
|
return discount_accounts
|
||||||
|
end
|
||||||
|
|
||||||
# Calculate rebate_by_account
|
# Calculate rebate_by_account
|
||||||
def self.calculate_rebate_by_account(sale_items)
|
def self.calculate_rebate_by_account(sale_items)
|
||||||
rebateacc = Account.where("rebate=?",true)
|
rebateacc = Account.where("rebate=?",true)
|
||||||
|
|||||||
@@ -249,6 +249,12 @@ class SalePayment < ApplicationRecord
|
|||||||
self.sale.save!
|
self.sale.save!
|
||||||
table_update_status(sObj)
|
table_update_status(sObj)
|
||||||
rebat(sObj)
|
rebat(sObj)
|
||||||
|
shift = ShiftSale.current_open_shift(self.sale.cashier_id)
|
||||||
|
puts shift
|
||||||
|
if !shift.nil?
|
||||||
|
puts ">>>> shift >>>>>>"
|
||||||
|
shift.update(self.sale)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -14,12 +14,39 @@
|
|||||||
|
|
||||||
class ShiftSale < ApplicationRecord
|
class ShiftSale < ApplicationRecord
|
||||||
belongs_to :cashier_terminal
|
belongs_to :cashier_terminal
|
||||||
belongs_to :employee
|
belongs_to :employee, :foreign_key => 'employee_id'
|
||||||
|
|
||||||
def self.current_open_shift(current_user)
|
def self.current_open_shift(current_user)
|
||||||
#if current_user
|
#if current_user
|
||||||
#find open shift where is open today and is not closed and login by current cashier
|
#find open shift where is open today and is not closed and login by current cashier
|
||||||
@shift = ShiftSale.where("cast(shift_started_at as date) = #{DateTime.now.to_date} and shift_started_at is null and employee_id = #{current_user.id}").limit(1)
|
today_date = DateTime.now.strftime("%Y-%m-%d")
|
||||||
|
puts today_date
|
||||||
|
shift = ShiftSale.where("DATE(shift_started_at)= #{ today_date } and shift_started_at is not null and shift_closed_at is null and employee_id = #{current_user}").take
|
||||||
|
|
||||||
|
return shift
|
||||||
#end
|
#end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def create(opening_balance,current_user)
|
||||||
|
self.cashier_terminal_id = CashierTerminal.first.id
|
||||||
|
self.shift_started_at = DateTime.now
|
||||||
|
self.employee_id = current_user.id
|
||||||
|
self.opening_balance = opening_balance
|
||||||
|
self.save
|
||||||
|
end
|
||||||
|
|
||||||
|
def update(sale)
|
||||||
|
saleobj = Sale.find_by_sale_id(sale)
|
||||||
|
self.total_revenue = self.total_revenue + saleobj.total_amount
|
||||||
|
self.total_discounts = self.total_discounts + saleobj.total_discount
|
||||||
|
self.total_taxes = self.total_taxes + saleobj.total_tax
|
||||||
|
self.grand_total = self.grand_total + saleobj.grand_total
|
||||||
|
# self.nett_sales =
|
||||||
|
# self.cash_sales =
|
||||||
|
# self.credit_sales =
|
||||||
|
# self.other_sales =
|
||||||
|
# self.commercial_taxes =
|
||||||
|
self.save
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
class ReceiptBillPdf < Prawn::Document
|
class ReceiptBillPdf < Prawn::Document
|
||||||
include ActionView::Helpers::NumberHelper
|
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
|
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, sale_items, sale_data, customer_name, item_price_by_accounts, member_info = nil,rebate_amount = nil,shop_details)
|
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)
|
||||||
self.page_width = 210
|
self.page_width = 210
|
||||||
self.page_height = 7000
|
self.page_height = 7000
|
||||||
self.margin = 5
|
self.margin = 5
|
||||||
@@ -46,7 +46,12 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
|
|
||||||
customer(customer_name)
|
customer(customer_name)
|
||||||
|
|
||||||
|
if discount_price_by_accounts.length > 0
|
||||||
|
discount_account(discount_price_by_accounts,printer_settings.precision,delimiter)
|
||||||
|
end
|
||||||
|
|
||||||
items_account(item_price_by_accounts,printer_settings.precision,delimiter)
|
items_account(item_price_by_accounts,printer_settings.precision,delimiter)
|
||||||
|
|
||||||
|
|
||||||
footer
|
footer
|
||||||
end
|
end
|
||||||
@@ -165,7 +170,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
y_position = cursor
|
y_position = cursor
|
||||||
|
|
||||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||||
text "Discount", :size => self.item_font_size,:align => :left
|
text "Overall Discount", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||||
text "( #{number_with_precision(sale_data.total_discount, :precision => precision.to_i, :delimiter => delimiter)} )" , :size => self.item_font_size,:align => :right
|
text "( #{number_with_precision(sale_data.total_discount, :precision => precision.to_i, :delimiter => delimiter)} )" , :size => self.item_font_size,:align => :right
|
||||||
@@ -308,6 +313,21 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
text "#{ customer_name }" , :size => self.item_font_size,:align => :right
|
text "#{ customer_name }" , :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
def discount_account(discount_price_by_accounts,precision,delimiter)
|
||||||
|
move_down 5
|
||||||
|
stroke_horizontal_rule
|
||||||
|
move_down 5
|
||||||
|
y_position = cursor
|
||||||
|
discount_price_by_accounts.each do |ipa|
|
||||||
|
y_position = cursor
|
||||||
|
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||||
|
text "#{ 'Total ' + ipa[:name] + ' Discounts' }", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||||
|
text "(" + "#{ number_with_precision(ipa[:price], :precision => precision.to_i, :delimiter => delimiter) }" + ")" , :size => self.item_font_size,:align => :right
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def items_account(item_price_by_accounts,precision,delimiter)
|
def items_account(item_price_by_accounts,precision,delimiter)
|
||||||
move_down 5
|
move_down 5
|
||||||
|
|||||||
@@ -1,14 +1,24 @@
|
|||||||
<style>
|
<style>
|
||||||
.pin_pad {
|
.pin_pad {
|
||||||
width:10rem;
|
width: 30%;
|
||||||
height:10rem;
|
height:70px;
|
||||||
text-align: center;
|
line-height:70px;
|
||||||
vertical-align: middle;
|
text-align:center;
|
||||||
line-height: 10rem;
|
background:#54A5AF;
|
||||||
margin:2px;
|
font-size:20px;
|
||||||
margin-top:4px;
|
color:white;
|
||||||
margin-bottom:4px;
|
}
|
||||||
font-size:3rem;
|
.bottom{
|
||||||
|
margin-bottom: 1px;
|
||||||
|
}
|
||||||
|
.left{
|
||||||
|
margin-left:1px;
|
||||||
|
}
|
||||||
|
.orange{
|
||||||
|
background-color:#FF7F50;
|
||||||
|
}
|
||||||
|
.purple {
|
||||||
|
background-color:#7a62d3;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
@@ -23,21 +33,29 @@
|
|||||||
<%= f.input :password, label: "Access PIN", required: false, class: "form-control" %>
|
<%= f.input :password, label: "Access PIN", required: false, class: "form-control" %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="content" style="margin:10px; margin-top:0px; text-align:center">
|
<div class="content row" style="padding-left:10px;margin-left:10px; margin-top:0px; text-align:center">
|
||||||
<button class="pin_pad" data-value="1">1</button>
|
<div class='col-md-12'>
|
||||||
<button class="pin_pad" data-value="2">2</button>
|
<div class='row bottom'>
|
||||||
<button class="pin_pad" data-value="3">3</button>
|
<div class="pin_pad " data-value="1">1</div>
|
||||||
<button class="pin_pad" data-value="4">4</button>
|
<div class="pin_pad left" data-value="2">2</div>
|
||||||
<button class="pin_pad" data-value="5">5</button>
|
<div class="pin_pad left" data-value="3">3</div>
|
||||||
<button class="pin_pad" data-value="6">6</button>
|
</div>
|
||||||
<button class="pin_pad" data-value="7">7</button>
|
<div class='row bottom'>
|
||||||
<button class="pin_pad" data-value="8">8</button>
|
<div class="pin_pad" data-value="4">4</div>
|
||||||
<button class="pin_pad" data-value="9">9</button>
|
<div class="pin_pad left" data-value="5">5</div>
|
||||||
<button class="pin_pad" data-value="CLR">CLR</button>
|
<div class="pin_pad left" data-value="6">6</div>
|
||||||
<button class="pin_pad" data-value="8">0</button>
|
</div>
|
||||||
<button class="pin_pad btn-warning" data-value="ENT">ENT</button>
|
<div class='row bottom'>
|
||||||
|
<div class="pin_pad" data-value="7">7</div>
|
||||||
|
<div class="pin_pad left" data-value="8">8</div>
|
||||||
|
<div class="pin_pad left" data-value="9">9</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class='row bottom'>
|
||||||
|
<div class="pin_pad orange" data-value="CLR">CLR</div>
|
||||||
|
<div class="pin_pad left" data-value="8">0</div>
|
||||||
|
<div class="pin_pad left purple" data-value="ENT">ENT</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="footer text-center" style="margin:10px">
|
<div class="footer text-center" style="margin:10px">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
79
app/views/origami/cash_ins/new.html.erb
Normal file
79
app/views/origami/cash_ins/new.html.erb
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
|
||||||
|
<div class='row'>
|
||||||
|
<div class="col-lg-11 col-md-11 col-sm-11">
|
||||||
|
<h2> Payment Credit </h2>
|
||||||
|
<br>
|
||||||
|
<table class='table table-striped'>
|
||||||
|
<tr>
|
||||||
|
<td> Payment Reference
|
||||||
|
</td>
|
||||||
|
<td><input type='text' id='reference'/></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td> Remark
|
||||||
|
</td>
|
||||||
|
<td><input type="text" id='remark'/></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td> Payment Method
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<button class='btn btn-primary payment-type' data-id='cash' id='cash'>CASH</button>
|
||||||
|
<button class='btn btn-primary payment-type' data-id='mpu' id='mpu'>MPU</button>
|
||||||
|
<button class='btn btn-primary payment-type' data-id='visa' id='visa'>VISA</button>
|
||||||
|
<button class='btn btn-primary payment-type' data-id='jcb' id='jcb'>JCB</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<div class='row'>
|
||||||
|
<div class='col-md-2'></div>
|
||||||
|
<div class='col-md-2'>Reference Number </div>
|
||||||
|
<div class='col-md-4'><input type='text' id='payment_method_reference'/> </div>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<div class='row'>
|
||||||
|
<div class='col-md-2'></div>
|
||||||
|
<div class='col-md-2'>Amount</div>
|
||||||
|
<div class='col-md-4'><input type='text' id='amount'/></div>
|
||||||
|
</div>
|
||||||
|
<br><br>
|
||||||
|
<div class='row'>
|
||||||
|
<div class='col-md-3'></div>
|
||||||
|
<div class='col-md-4'><button class='btn btn-primary btn-lg' id='cash_in' style='width:200px;'> Cash In</button></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||||
|
<button class='btn btn-primary ' id='cash_in' style='width:100px;'> Back </button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
var payment_method = "";
|
||||||
|
$('.payment-type').on('click',function(){
|
||||||
|
$('.payment-type').css("background-color","#7a62d3")
|
||||||
|
$(this).css("background-color","green");
|
||||||
|
var type = $(this).attr('data-id')
|
||||||
|
if(type == 'cash'){
|
||||||
|
payment_method = 'cash';
|
||||||
|
}else if(type == 'mpu'){
|
||||||
|
payment_method = "mpu";
|
||||||
|
}else if(type == 'visa'){
|
||||||
|
payment_method = "visa";
|
||||||
|
}else if(type == 'jcb'){
|
||||||
|
payment_method = "jcb";
|
||||||
|
}
|
||||||
|
})
|
||||||
|
$('#cash_in').on('click',function(){
|
||||||
|
var reference = $('#reference').val();
|
||||||
|
var remark = $('#remark').val();
|
||||||
|
var amount = $('#amount').val();
|
||||||
|
var payment_method_reference = $('#payment_method_reference').val();
|
||||||
|
$.ajax({type: "POST",
|
||||||
|
url: "<%= origami_cash_ins_path %>",
|
||||||
|
data: "reference="+ reference + "&remark=" + remark + "&amount="+ amount + "&payment_method="+payment_method + "&payment_method_reference="+ payment_method_reference,
|
||||||
|
success:function(result){
|
||||||
|
window.location.href = '/origami';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
</script>
|
||||||
44
app/views/origami/cash_outs/new.html.erb
Normal file
44
app/views/origami/cash_outs/new.html.erb
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
<h2>Payment Debit</h2>
|
||||||
|
<div class='row'>
|
||||||
|
<div class='col-md-9'>
|
||||||
|
<table class='table table-striped'>
|
||||||
|
<tr>
|
||||||
|
<td> Payment Reference
|
||||||
|
</td>
|
||||||
|
<td><input id='reference' type='text' value=''/></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td> Remark
|
||||||
|
</td>
|
||||||
|
<td><input id='remark' type="text" value=''/></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td> Amount
|
||||||
|
</td>
|
||||||
|
<td><input id='amount' type="text" value=''/></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<br><br>
|
||||||
|
<div class='row'>
|
||||||
|
<div class='col-md-3'></div>
|
||||||
|
<div class='col-md-4'><button class='btn btn-primary btn-lg' id='cash_out'> Cash Out</button></div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
$('#cash_out').on('click',function(){
|
||||||
|
var reference = $('#reference').val();
|
||||||
|
var remark = $('#remark').val();
|
||||||
|
var amount = $('#amount').val();
|
||||||
|
$.ajax({type: "POST",
|
||||||
|
url: "<%= origami_cash_outs_path %>",
|
||||||
|
data: "reference="+ reference + "&remark=" + remark + "&amount="+ amount,
|
||||||
|
success:function(result){
|
||||||
|
window.location.href = '/origami';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
</script>
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<!-- Column One -->
|
<!-- Column One -->
|
||||||
<div class="col-lg-11 col-md-11 col-sm-11">
|
<div class="col-lg-10 col-md-10 col-sm-10">
|
||||||
|
|
||||||
<!-- Nav tabs -->
|
<!-- Nav tabs -->
|
||||||
<ul class="nav nav-tabs" role="tablist">
|
<ul class="nav nav-tabs" role="tablist">
|
||||||
@@ -103,8 +103,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<!-- tabs - End -->
|
<!-- tabs - End -->
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||||
<button id="refreshbutton" type="button" class="btn btn-block" style="border-radius:5px;color:#fff;background-color:red;"> Refresh off </button>
|
<button id="refreshbutton" type="button" class="btn btn-block" style="border-radius:5px;color:#fff;background-color:red;"> Refresh off </button>
|
||||||
|
<button id="cash_in" type="button" class="btn btn-block btn-primary" style="border-radius:5px;color:#fff;"> Cash In </button>
|
||||||
|
<button id="cash_out" type="button" class="btn btn-block btn-primary" style="border-radius:5px;color:#fff;"> Cash Out </button>
|
||||||
|
<button id="close_cashier" type="button" class="btn btn-block btn-primary" style="border-radius:5px;color:#fff;"> Close Cashier </button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- Column One -->
|
<!-- Column One -->
|
||||||
@@ -193,4 +196,16 @@ $(function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#cash_in').on('click',function(){
|
||||||
|
window.location.href = '/origami/cash_ins/new';
|
||||||
|
})
|
||||||
|
|
||||||
|
$('#cash_out').on('click',function(){
|
||||||
|
window.location.href = '/origami/cash_outs/new';
|
||||||
|
})
|
||||||
|
|
||||||
|
$('#close_cashier').on('click',function(){
|
||||||
|
window.location.href = '/origami/shift/close';
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -3,9 +3,11 @@
|
|||||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||||
|
|
||||||
<!-- Nav tabs -->
|
<!-- Nav tabs -->
|
||||||
<ul class="nav nav-tabs" role="tablist" id="mytab">
|
|
||||||
|
<ul class="nav nav-tabs" role="tablist">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" data-toggle="tab" href="#completed" role="tab">Completed</a>
|
<a class="nav-link" data-toggle="tab" href="#Completed" role="tab">Completed</a>
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link active" data-toggle="tab" href="#tables" role="tab">Tables</a>
|
<a class="nav-link active" data-toggle="tab" href="#tables" role="tab">Tables</a>
|
||||||
@@ -21,6 +23,7 @@
|
|||||||
|
|
||||||
<div class="tab-content" style="max-height:670px; overflow:auto">
|
<div class="tab-content" style="max-height:670px; overflow:auto">
|
||||||
<!--- Panel 0 - Completed Orders -->
|
<!--- Panel 0 - Completed Orders -->
|
||||||
|
|
||||||
<div class="tab-pane" id="completed" role="tabpanel">
|
<div class="tab-pane" id="completed" role="tabpanel">
|
||||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||||
<% @complete.each do |sale| %>
|
<% @complete.each do |sale| %>
|
||||||
@@ -39,6 +42,7 @@
|
|||||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||||
<% @tables.each do |table| %>
|
<% @tables.each do |table| %>
|
||||||
<% if table.status == 'occupied' %>
|
<% if table.status == 'occupied' %>
|
||||||
|
|
||||||
<% if table.get_booking.nil? %>
|
<% if table.get_booking.nil? %>
|
||||||
<div class="card tables red text-white" data-id="<%= table.id %>">
|
<div class="card tables red text-white" data-id="<%= table.id %>">
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
@@ -71,6 +75,7 @@
|
|||||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||||
<% @rooms.each do |room| %>
|
<% @rooms.each do |room| %>
|
||||||
<% if room.status == 'occupied' %>
|
<% if room.status == 'occupied' %>
|
||||||
|
|
||||||
<div class="card rooms red text-white" data-id="<%= room.id %>">
|
<div class="card rooms red text-white" data-id="<%= room.id %>">
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<%= room.name %>
|
<%= room.name %>
|
||||||
@@ -95,6 +100,7 @@
|
|||||||
<!--- Panel 3 - Orders -->
|
<!--- Panel 3 - Orders -->
|
||||||
<div class="tab-pane" id="orders" role="tabpanel">
|
<div class="tab-pane" id="orders" role="tabpanel">
|
||||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||||
|
|
||||||
<% @orders.each do |order| %>
|
<% @orders.each do |order| %>
|
||||||
<div class="card orders red text-white" data-id = "<%= order.order_id %>">
|
<div class="card orders red text-white" data-id = "<%= order.order_id %>">
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
@@ -104,7 +110,6 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<!-- tabs - End -->
|
<!-- tabs - End -->
|
||||||
</div>
|
</div>
|
||||||
@@ -114,6 +119,7 @@
|
|||||||
<div class="col-lg-5 col-md-5 col-sm-5">
|
<div class="col-lg-5 col-md-5 col-sm-5">
|
||||||
<div class="card" >
|
<div class="card" >
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
|
|
||||||
<% if @status_order == 'order' && @status_sale != 'sale' %>
|
<% if @status_order == 'order' && @status_sale != 'sale' %>
|
||||||
<div id="save_order_id" data-order="<%= @obj_order.order_id %>"><strong id="order-title">ORDER DETAILS </strong> | Table <%= @dining.name rescue "" %></div>
|
<div id="save_order_id" data-order="<%= @obj_order.order_id %>"><strong id="order-title">ORDER DETAILS </strong> | Table <%= @dining.name rescue "" %></div>
|
||||||
<% elsif @status_sale == 'sale' %>
|
<% elsif @status_sale == 'sale' %>
|
||||||
@@ -124,12 +130,14 @@
|
|||||||
<div class="card-title row">
|
<div class="card-title row">
|
||||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||||
<p> Receipt No: <span id="receipt_no">
|
<p> Receipt No: <span id="receipt_no">
|
||||||
|
|
||||||
<% if @status_sale == 'sale' %>
|
<% if @status_sale == 'sale' %>
|
||||||
<%= @sale_array[0].receipt_no rescue '' %>
|
<%= @sale_array[0].receipt_no rescue '' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</span></p>
|
</span></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
||||||
|
|
||||||
<p>Date: <span id="receipt_date"><%= @date.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
|
<p>Date: <span id="receipt_date"><%= @date.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -146,6 +154,7 @@
|
|||||||
<table class="table table-striped" id="order-items-table">
|
<table class="table table-striped" id="order-items-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
||||||
<th>#</th>
|
<th>#</th>
|
||||||
<th class="item-name">Items</th>
|
<th class="item-name">Items</th>
|
||||||
<th class="item-attr">QTY</td>
|
<th class="item-attr">QTY</td>
|
||||||
@@ -154,6 +163,7 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<%
|
<%
|
||||||
|
|
||||||
count = 0
|
count = 0
|
||||||
sub_total = 0
|
sub_total = 0
|
||||||
if @status_sale == "sale"
|
if @status_sale == "sale"
|
||||||
@@ -173,6 +183,7 @@
|
|||||||
<td class='item-attr'><%= sale_item.price %></td>
|
<td class='item-attr'><%= sale_item.price %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<%
|
<%
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -192,6 +203,7 @@
|
|||||||
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
|
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<%
|
<%
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -208,6 +220,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="charges-name"><strong>Discount:</strong></td>
|
<td class="charges-name"><strong>Discount:</strong></td>
|
||||||
|
|
||||||
<td class="item-attr"><strong id="order-discount">(<%= @obj_sale.total_discount rescue 0%>)</strong></td>
|
<td class="item-attr"><strong id="order-discount">(<%= @obj_sale.total_discount rescue 0%>)</strong></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% if @status_sale == "sale" %>
|
<% if @status_sale == "sale" %>
|
||||||
@@ -215,6 +228,10 @@
|
|||||||
<td class="charges-name"><strong>Tax:</strong></td>
|
<td class="charges-name"><strong>Tax:</strong></td>
|
||||||
<td class="item-attr"><strong id="order-Tax"><%= @obj_sale.total_tax rescue 0%></strong></td>
|
<td class="item-attr"><strong id="order-Tax"><%= @obj_sale.total_tax rescue 0%></strong></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="charges-name"><strong>Rounding Adj:</strong></td>
|
||||||
|
<td class="item-attr"><strong id="order-round-adj"><%= @obj_sale.rounding_adjustment rescue 0%></strong></td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="charges-name"><strong>Grand Total:</strong></td>
|
<td class="charges-name"><strong>Grand Total:</strong></td>
|
||||||
<td class="item-attr"><strong id="order-grand-total"><%= @obj_sale.grand_total rescue 0%></strong></td>
|
<td class="item-attr"><strong id="order-grand-total"><%= @obj_sale.grand_total rescue 0%></strong></td>
|
||||||
@@ -271,7 +288,6 @@
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
%>
|
%>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -279,6 +295,7 @@
|
|||||||
<!-- Column Three -->
|
<!-- Column Three -->
|
||||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||||
<!-- Waiter Buttons -->
|
<!-- Waiter Buttons -->
|
||||||
|
|
||||||
<button type="button" class="btn btn-primary btn-block" id='back' >Back</button>
|
<button type="button" class="btn btn-primary btn-block" id='back' >Back</button>
|
||||||
<% if @dining.bookings.length >= 1 %>
|
<% if @dining.bookings.length >= 1 %>
|
||||||
<button type="button" id="customer" class="btn btn-primary btn-block" >Customer</button>
|
<button type="button" id="customer" class="btn btn-primary btn-block" >Customer</button>
|
||||||
@@ -289,6 +306,7 @@
|
|||||||
<button type="button" id="discount" class="btn btn-primary btn-block" disabled >Discount</button>
|
<button type="button" id="discount" class="btn btn-primary btn-block" disabled >Discount</button>
|
||||||
<button type="button" class="btn btn-primary btn-block" id='move'>Move</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="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" id="pay" class="btn btn-primary btn-block" disabled>Pay</button>
|
||||||
<button type="button" class="btn btn-primary btn-block" disabled> Void </button>
|
<button type="button" class="btn btn-primary btn-block" disabled> Void </button>
|
||||||
<% else %>
|
<% else %>
|
||||||
@@ -297,6 +315,7 @@
|
|||||||
<button type="button" id="discount" class="btn btn-primary btn-block" >Discount</button>
|
<button type="button" id="discount" class="btn btn-primary btn-block" >Discount</button>
|
||||||
<button type="button" class="btn btn-primary btn-block" id='move' disabled="">Move</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="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="pay" class="btn btn-primary btn-block">Pay</button>
|
||||||
<button type="button" id="void" class="btn btn-primary btn-block" > Void </button>
|
<button type="button" id="void" class="btn btn-primary btn-block" > Void </button>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -308,6 +327,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
|
||||||
$('.invoicedetails').on('click',function(){
|
$('.invoicedetails').on('click',function(){
|
||||||
var dining_id = "<%= @dining.id %>";
|
var dining_id = "<%= @dining.id %>";
|
||||||
var sale_id = this.id;
|
var sale_id = this.id;
|
||||||
@@ -391,7 +411,19 @@ $(document).ready(function(){
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Print for first bill
|
||||||
|
$("#first_bill").on('click', function(){
|
||||||
|
var sale_id = $('#sale_id').val();
|
||||||
|
var ajax_url = "/origami/sale/"+ sale_id + "/first_bill";
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: "GET",
|
||||||
|
url: ajax_url,
|
||||||
|
success:function(result){
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
$('#pay').on('click',function() {
|
$('#pay').on('click',function() {
|
||||||
var sale_id = $('#sale_id').val();
|
var sale_id = $('#sale_id').val();
|
||||||
@@ -403,9 +435,9 @@ $('#request_bills').click(function() {
|
|||||||
var order_id = $('#save_order_id').attr('data-order');
|
var order_id = $('#save_order_id').attr('data-order');
|
||||||
var ajax_url = "/origami/" + order_id + "/request_bills";
|
var ajax_url = "/origami/" + order_id + "/request_bills";
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "GET",
|
||||||
url: ajax_url,
|
url: ajax_url,
|
||||||
data: 'order_id='+ order_id,
|
// data: 'order_id='+ order_id,
|
||||||
success:function(result){
|
success:function(result){
|
||||||
|
|
||||||
location.reload();
|
location.reload();
|
||||||
@@ -469,31 +501,28 @@ function show_customer_details(customer_id){
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
//End Ajax
|
//End Ajax
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#edit').on('click',function(){
|
$('#edit').on('click',function(){
|
||||||
var dining_id = "<%= @dining.id %>"
|
var dining_id = "<%= @dining.id %>"
|
||||||
var sale_id = "<%= @obj_sale.sale_id rescue "" %>"
|
var sale_id = "<%= @obj_sale.sale_id rescue "" %>"
|
||||||
window.location.href = '/origami/table/'+ dining_id + "/sale/"+ sale_id + "/edit";
|
window.location.href = '/origami/table/'+ dining_id + "/sale/"+ sale_id + "/edit";
|
||||||
})
|
});
|
||||||
|
|
||||||
$('#void').on('click',function () {
|
|
||||||
var sure = confirm("Are you sure want to Void");
|
|
||||||
if (sure == true) {
|
|
||||||
var sale_id = $('#sale_id').val();
|
|
||||||
var ajax_url = "/origami/sale/" + sale_id + '/void';
|
|
||||||
$.ajax({
|
|
||||||
type: 'POST',
|
|
||||||
url: ajax_url,
|
|
||||||
success: function () {
|
|
||||||
window.location.href = '/origami/';
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
|
$('#void').on('click',function () {
|
||||||
|
var sure = confirm("Are you sure want to Void");
|
||||||
|
if (sure == true) {
|
||||||
|
var sale_id = $('#sale_id').val();
|
||||||
|
var ajax_url = "/origami/sale/" + sale_id + '/void';
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: ajax_url,
|
||||||
|
success: function () {
|
||||||
|
window.location.href = '/origami/';
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -268,61 +268,128 @@
|
|||||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||||
<!-- Waiter Buttons -->
|
<!-- Waiter Buttons -->
|
||||||
<button type="button" class="btn btn-primary btn-block" id='back' >Back</button>
|
<button type="button" class="btn btn-primary btn-block" id='back' >Back</button>
|
||||||
<button type="button" class="btn btn-primary btn-block" disabled>Add Order</button>
|
<% if @dining.bookings.length >= 1 %>
|
||||||
<button type="button" class="btn btn-primary btn-block" disabled>Edit</button>
|
<button type="button" id="customer" class="btn btn-primary btn-block" >Customer</button>
|
||||||
<button type="button" class="btn btn-primary btn-block" id="move">Move</button>
|
|
||||||
<button type="button" id="customer" class="btn btn-primary btn-block">Customer</button>
|
<% if @status_order == 'order' && @status_sale != 'sale' %>
|
||||||
<button type="button" id="request_bills" class="btn btn-primary btn-block">Req.Bill</button>
|
<button type="button" class="btn btn-primary btn-block" >Add Order</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" 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" disabled>Add Order</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" 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 -->
|
<!-- Cashier Buttons -->
|
||||||
<button type="button" id="discount" class="btn btn-primary btn-block">Discount</button>
|
|
||||||
<!-- <button type="button" class="btn btn-primary btn-lg btn-block" disabled>Tax</button> -->
|
<!-- <button type="button" id="re-print" class="btn btn-primary btn-block" >Re.Print</button> -->
|
||||||
<button type="button" id="pay" class="btn btn-primary btn-block">Pay</button>
|
<% end %>
|
||||||
<!-- <button type="button" id="re-print" class="btn btn-primary btn-block">Re.Print</button> -->
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
// $(".tables").on('click', function(){
|
||||||
|
// var customer_id=$(".customer-id").text();
|
||||||
|
// show_customer_details(customer_id);
|
||||||
|
|
||||||
|
// var dining_id = $(this).attr("data-id");
|
||||||
|
// window.location.href = '/origami/table/' + dining_id;
|
||||||
|
// })
|
||||||
|
// $(".sales").on('click',function(){
|
||||||
|
// var customer_id=$(".customer-id").text();
|
||||||
|
// show_customer_details(customer_id);
|
||||||
|
|
||||||
|
// var sale_id = $(this).attr("data-id");
|
||||||
|
// window.location.href = '/origami/sale/' + sale_id;
|
||||||
|
// })
|
||||||
|
// $(".rooms").on('click', function(){
|
||||||
|
// var customer_id=$(".customer-id").text();
|
||||||
|
// show_customer_details(customer_id);
|
||||||
|
|
||||||
|
// var dining_id = $(this).attr("data-id");
|
||||||
|
// window.location.href = '/origami/room/' + dining_id;
|
||||||
|
// })
|
||||||
|
// $(".orders").on('click',function(){
|
||||||
|
// var customer_id=$(".customer-id").text();
|
||||||
|
// show_customer_details(customer_id);
|
||||||
|
|
||||||
|
// var order_id = $(this).attr("data-id");
|
||||||
|
// window.location.href = '/origami/order/' + order_id;
|
||||||
|
// })
|
||||||
|
|
||||||
|
$('.invoicedetails').on('click',function(){
|
||||||
|
var dining_id = "<%= @dining.id %>";
|
||||||
|
var sale_id = this.id;
|
||||||
|
window.location.href = '/origami/table/'+ dining_id + "/table_invoice/"+sale_id;
|
||||||
|
})
|
||||||
$(".tables").on('click', function(){
|
$(".tables").on('click', function(){
|
||||||
|
|
||||||
var customer_id=$(".customer-id").text();
|
var customer_id=$(".customer-id").text();
|
||||||
show_customer_details(customer_id);
|
show_customer_details(customer_id);
|
||||||
|
|
||||||
var dining_id = $(this).attr("data-id");
|
var dining_id = $(this).attr("data-id");
|
||||||
window.location.href = '/origami/table/' + dining_id;
|
window.location.href = '/origami/table/' + dining_id;
|
||||||
})
|
});
|
||||||
|
|
||||||
$(".sales").on('click',function(){
|
$(".sales").on('click',function(){
|
||||||
|
|
||||||
var customer_id=$(".customer-id").text();
|
var customer_id=$(".customer-id").text();
|
||||||
show_customer_details(customer_id);
|
show_customer_details(customer_id);
|
||||||
|
|
||||||
var sale_id = $(this).attr("data-id");
|
var sale_id = $(this).attr("data-id");
|
||||||
window.location.href = '/origami/sale/' + sale_id;
|
window.location.href = '/origami/sale/' + sale_id;
|
||||||
})
|
});
|
||||||
|
|
||||||
$(".rooms").on('click', function(){
|
$(".rooms").on('click', function(){
|
||||||
|
|
||||||
var customer_id=$(".customer-id").text();
|
var customer_id=$(".customer-id").text();
|
||||||
show_customer_details(customer_id);
|
show_customer_details(customer_id);
|
||||||
|
|
||||||
var dining_id = $(this).attr("data-id");
|
var dining_id = $(this).attr("data-id");
|
||||||
window.location.href = '/origami/room/' + dining_id;
|
window.location.href = '/origami/room/' + dining_id;
|
||||||
})
|
});
|
||||||
|
|
||||||
$(".orders").on('click',function(){
|
$(".orders").on('click',function(){
|
||||||
|
|
||||||
var customer_id=$(".customer-id").text();
|
var customer_id=$(".customer-id").text();
|
||||||
show_customer_details(customer_id);
|
show_customer_details(customer_id);
|
||||||
|
|
||||||
var order_id = $(this).attr("data-id");
|
var order_id = $(this).attr("data-id");
|
||||||
window.location.href = '/origami/order/' + order_id;
|
window.location.href = '/origami/order/' + order_id;
|
||||||
})
|
});
|
||||||
|
|
||||||
// bind customer to order or sale
|
// bind customer to order or sale
|
||||||
$("#customer").on('click', function(){
|
$("#customer").on('click', function(){
|
||||||
var sale = $('#sale_id').val();
|
var sale = $('#sale_id').val();
|
||||||
if (sale) {
|
if (sale) {
|
||||||
var sale_id = sale
|
var sale_id = sale
|
||||||
}else{
|
}else{
|
||||||
var sale_id = $('#save_order_id').attr('data-order');
|
var sale_id = $('#save_order_id').attr('data-order');
|
||||||
}
|
}
|
||||||
|
var table_id = $('.tables').attr("data-id");
|
||||||
|
|
||||||
window.location.href = '/origami/'+ sale_id + "/customers"
|
window.location.href = '/origami/'+ sale_id + "/customers"
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#re-print').click(function() {
|
||||||
|
var sale_id = $('#sale_id').val();
|
||||||
|
window.location.href = '/origami/'+ sale_id + "/reprint"
|
||||||
|
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
// Discount for Payment
|
// Discount for Payment
|
||||||
$('#discount').click(function() {
|
$('#discount').click(function() {
|
||||||
var sale = $('#sale_id').val();
|
var sale = $('#sale_id').val();
|
||||||
@@ -341,6 +408,20 @@ $("#customer").on('click', function(){
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
// Print for first bill
|
||||||
|
$("#first_bill").on('click', function(){
|
||||||
|
var sale_id = $('#sale_id').val();
|
||||||
|
var ajax_url = "/origami/sale/"+ sale_id + "/first_bill";
|
||||||
|
$.ajax({
|
||||||
|
type: "GET",
|
||||||
|
url: ajax_url,
|
||||||
|
success:function(result){
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@@ -354,9 +435,9 @@ $('#request_bills').click(function() {
|
|||||||
var order_id = $('#save_order_id').attr('data-order');
|
var order_id = $('#save_order_id').attr('data-order');
|
||||||
var ajax_url = "/origami/" + order_id + "/request_bills";
|
var ajax_url = "/origami/" + order_id + "/request_bills";
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "GET",
|
||||||
url: ajax_url,
|
url: ajax_url,
|
||||||
data: 'order_id='+ order_id,
|
// data: 'order_id='+ order_id,
|
||||||
success:function(result){
|
success:function(result){
|
||||||
|
|
||||||
location.reload();
|
location.reload();
|
||||||
@@ -373,39 +454,109 @@ $('#back').on('click',function(){
|
|||||||
window.location.href = '/origami/';
|
window.location.href = '/origami/';
|
||||||
})
|
})
|
||||||
|
|
||||||
//show cusotmer rebate amount
|
$('#add_invoice').on('click',function(){
|
||||||
function show_customer_details(customer_id){
|
var dining_id = "<%= @dining.id %>"
|
||||||
|
var sale_id = "<%= @obj_sale.sale_id rescue "" %>"
|
||||||
|
var ajax_url = "/origami/sale/append_order";
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: ajax_url,
|
||||||
|
data: 'dining_id='+ dining_id + "&sale_id=" + sale_id,
|
||||||
|
success:function(result){
|
||||||
|
alert("Invoice updated")
|
||||||
|
window.location.reload();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// //show cusotmer rebate amount
|
||||||
|
// function show_customer_details(customer_id){
|
||||||
|
// var url = '<%= @show_customer_details_path %>'
|
||||||
|
// //Start Ajax
|
||||||
|
// $.ajax({
|
||||||
|
// type: "GET",
|
||||||
|
// url: url,
|
||||||
|
// data: {},
|
||||||
|
// dataType: "json",
|
||||||
|
// success: function(data) {
|
||||||
|
// $("#customer_name").text(data["customer"].name);
|
||||||
|
// if (data["response_data"]["data"].length) {
|
||||||
|
// $.each(data["response_data"]["data"], function (i) {
|
||||||
|
// if(data["response_data"]["data"][i]["accountable_type"] == "RebateAccount"){
|
||||||
|
// var balance = data["response_data"]["data"][i]["balance"];
|
||||||
|
// if (data["response_data"]["status"]==true) {
|
||||||
|
// $('.rebate_amount').removeClass('hide');
|
||||||
|
// row =
|
||||||
|
// '<td class="charges-name">' + "Rebate Balance" +'</td>'
|
||||||
|
// +'<td class="item-attr">' + balance + '</td>';
|
||||||
|
|
||||||
|
// $(".rebate_amount").html(row);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }else{
|
||||||
|
// $('.rebate_amount').addClass('hide');
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// //End Ajax
|
||||||
|
// }
|
||||||
|
|
||||||
|
//show cusotmer rebate amount
|
||||||
|
function show_customer_details(customer_id){
|
||||||
var url = '<%= @show_customer_details_path %>'
|
var url = '<%= @show_customer_details_path %>'
|
||||||
|
//Start Ajax
|
||||||
|
$.ajax({
|
||||||
|
type: "GET",
|
||||||
|
url: url,
|
||||||
|
data: {},
|
||||||
|
dataType: "json",
|
||||||
|
success: function(data) {
|
||||||
|
$("#customer_name").text(data["customer"].name);
|
||||||
|
if (data["response_data"]["data"].length) {
|
||||||
|
$.each(data["response_data"]["data"], function (i) {
|
||||||
|
if(data["response_data"]["data"][i]["accountable_type"] == "RebateAccount"){
|
||||||
|
var balance = data["response_data"]["data"][i]["balance"];
|
||||||
|
if (data["response_data"]["status"]==true) {
|
||||||
|
$('.rebate_amount').removeClass('hide');
|
||||||
|
row =
|
||||||
|
'<td class="charges-name">' + "Rebate Balance" +'</td>'
|
||||||
|
+'<td class="item-attr">' + balance + '</td>';
|
||||||
|
|
||||||
//Start Ajax
|
$(".rebate_amount").html(row);
|
||||||
$.ajax({
|
|
||||||
type: "GET",
|
|
||||||
url: url,
|
|
||||||
data: {},
|
|
||||||
dataType: "json",
|
|
||||||
success: function(data) {
|
|
||||||
$("#customer_name").text(data["customer"].name);
|
|
||||||
if (data["response_data"]["data"].length) {
|
|
||||||
$.each(data["response_data"]["data"], function (i) {
|
|
||||||
if(data["response_data"]["data"][i]["accountable_type"] == "RebateAccount"){
|
|
||||||
var balance = data["response_data"]["data"][i]["balance"];
|
|
||||||
if (data["response_data"]["status"]==true) {
|
|
||||||
$('.rebate_amount').removeClass('hide');
|
|
||||||
row =
|
|
||||||
'<td class="charges-name">' + "Rebate Balance" +'</td>'
|
|
||||||
+'<td class="item-attr">' + balance + '</td>';
|
|
||||||
|
|
||||||
$(".rebate_amount").html(row);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}else{
|
|
||||||
$('.rebate_amount').addClass('hide');
|
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
}else{
|
||||||
//End Ajax
|
$('.rebate_amount').addClass('hide');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//End Ajax
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$('#edit').on('click',function(){
|
||||||
|
var dining_id = "<%= @dining.id %>"
|
||||||
|
var sale_id = "<%= @obj_sale.sale_id rescue "" %>"
|
||||||
|
window.location.href = '/origami/table/'+ dining_id + "/sale/"+ sale_id + "/edit";
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#void').on('click',function () {
|
||||||
|
var sure = confirm("Are you sure want to Void");
|
||||||
|
if (sure == true) {
|
||||||
|
var sale_id = $('#sale_id').val();
|
||||||
|
var ajax_url = "/origami/sale/" + sale_id + '/void';
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: ajax_url,
|
||||||
|
success: function () {
|
||||||
|
window.location.href = '/origami/';
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
1
app/views/origami/shifts/create.json.jbuilder
Normal file
1
app/views/origami/shifts/create.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
|||||||
|
json.status true
|
||||||
@@ -1,2 +1 @@
|
|||||||
<h1>Origami::Shifts#edit</h1>
|
<h1> Close Cashier </h1>
|
||||||
<p>Find me in app/views/origami/shifts/edit.html.erb</p>
|
|
||||||
|
|||||||
@@ -1,2 +1,46 @@
|
|||||||
<h1>Origami::Shifts#new</h1>
|
<h1>Open Cashier</h1>
|
||||||
<p>Find me in app/views/origami/shifts/new.html.erb</p>
|
<br>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<table class='table table-striped'>
|
||||||
|
<% @float.each do |float| %>
|
||||||
|
<tr>
|
||||||
|
<th><%= float.name %></th>
|
||||||
|
<th><input class='float-value' type='text' data-value ="<%= float.value %>" value='' /></th>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
<tr>
|
||||||
|
<th>Total</th>
|
||||||
|
<th><div id='total'></div></th>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<div class="row">
|
||||||
|
<div class='col-md-4'></div>
|
||||||
|
<div class='col-md-2'>
|
||||||
|
<button class='btn btn-primary' id='open_cashier'>Open Cashier</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
var total = 0
|
||||||
|
$(document).on('focusout', '.float-value', function(event){
|
||||||
|
var input_type = $(this).attr("data-value");
|
||||||
|
var count = $(this).val();
|
||||||
|
total += input_type * count
|
||||||
|
$('#total').text(total)
|
||||||
|
|
||||||
|
})
|
||||||
|
$('#open_cashier').on('click',function(){
|
||||||
|
var amount = $('#total').text();
|
||||||
|
$.ajax({type: "POST",
|
||||||
|
url: "<%= origami_shifts_path %>",
|
||||||
|
data: "opening_balance=" + amount,
|
||||||
|
success:function(result){
|
||||||
|
if(result){
|
||||||
|
window.location.href = '/origami';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|||||||
@@ -1,2 +1,92 @@
|
|||||||
<h1>Origami::Shifts#show</h1>
|
|
||||||
<p>Find me in app/views/origami/shifts/show.html.erb</p>
|
<div class='row'>
|
||||||
|
<div class='col-md-10'>
|
||||||
|
<h1>Close Cashier</h1>
|
||||||
|
<br>
|
||||||
|
<table class='table table-striped'>
|
||||||
|
<tr>
|
||||||
|
<td>Shift Started At</td>
|
||||||
|
<td><%= @shift.shift_started_at.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-' %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Cashier Name</td>
|
||||||
|
<td><%= @shift.employee.name rescue ''%></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Opening Balance</td>
|
||||||
|
<td><%= @shift.opening_balance rescue ''%></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Total Revenue</td>
|
||||||
|
<td><%= @shift.total_revenue rescue ''%></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Total Discount</td>
|
||||||
|
<td><%= @shift.total_discounts rescue ''%></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Total Tax</td>
|
||||||
|
<td><%= @shift.total_taxes rescue ''%></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Grand Total</td>
|
||||||
|
<td><%= @shift.grand_total rescue ''%></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Nett Sale</td>
|
||||||
|
<td><%= @shift.nett_sales rescue ''%></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Cash Sale</td>
|
||||||
|
<td><%= @shift.cash_sales rescue ''%></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Credit Sale</td>
|
||||||
|
<td><%= @shift.credit_sales rescue ''%></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Other Sale</td>
|
||||||
|
<td><%= @shift.other_sales rescue ''%></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Commercial Tax</td>
|
||||||
|
<td><%= @shift.commercial_taxes rescue ''%></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Cash In</td>
|
||||||
|
<td><%= @shift.cash_in rescue ''%></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Cash Out</td>
|
||||||
|
<td><%= @shift.cash_out rescue ''%></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<hr>
|
||||||
|
<div class='row'>
|
||||||
|
<div class='col-md-5'>
|
||||||
|
<span style='font-size:20px;'><b>Closing Balance</b></span>
|
||||||
|
</div>
|
||||||
|
<div class='col-md-6'>
|
||||||
|
<span style='font-size:20px;padding-left:18px;'><b><%= @shift.closing_balance rescue ''%></b></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||||
|
<button type="button" class="btn btn-primary btn-block" id='back'> Back </button>
|
||||||
|
<button type="button" class="btn btn-primary btn-block green" id='close_cashier'> Close Cashier </button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
$('#close_cashier').on('click',function(){
|
||||||
|
$.ajax({type: "POST",
|
||||||
|
url: "<%= origami_close_shift_path %>",
|
||||||
|
success:function(result){
|
||||||
|
console.log(result)
|
||||||
|
window.location.href = '/';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
$('#back').on('click',function(){
|
||||||
|
window.location.href = '/origami';
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|||||||
1
app/views/origami/shifts/update_shift.json.jbuilder
Normal file
1
app/views/origami/shifts/update_shift.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
|||||||
|
json.status true
|
||||||
@@ -13,8 +13,6 @@ module SXRestaurants
|
|||||||
# -- all .rb files in that directory are automatically loaded.
|
# -- all .rb files in that directory are automatically loaded.
|
||||||
config.active_record.time_zone_aware_types = [:datetime, :time]
|
config.active_record.time_zone_aware_types = [:datetime, :time]
|
||||||
config.active_job.queue_adapter = :sidekiq
|
config.active_job.queue_adapter = :sidekiq
|
||||||
config.time_zone = 'Asia/Rangoon'
|
config.time_zone = 'Asia/Rangoon'
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -70,6 +70,8 @@ Rails.application.routes.draw do
|
|||||||
|
|
||||||
#--------- Cashier ------------#
|
#--------- Cashier ------------#
|
||||||
namespace :origami do
|
namespace :origami do
|
||||||
|
resources :cash_ins, only:[:new, :create]
|
||||||
|
resources :cash_outs, only:[:new, :create]
|
||||||
root "home#index"
|
root "home#index"
|
||||||
get "table/:dining_id" => "home#show" do #origami/:booking_id will show
|
get "table/:dining_id" => "home#show" do #origami/:booking_id will show
|
||||||
# resources :discounts, only: [:index,:new, :create ] #add discount type
|
# resources :discounts, only: [:index,:new, :create ] #add discount type
|
||||||
@@ -89,16 +91,32 @@ Rails.application.routes.draw do
|
|||||||
get 'room/:room_id' => 'rooms#show'
|
get 'room/:room_id' => 'rooms#show'
|
||||||
get 'order/:order_id' => "orders#show"
|
get 'order/:order_id' => "orders#show"
|
||||||
|
|
||||||
post '/:booking_id' => 'home#item_show'
|
# post '/:booking_id' => 'home#item_show'
|
||||||
|
|
||||||
get "/:id/discount" => "discounts#index"
|
get "/:id/discount" => "discounts#index"
|
||||||
post "/:id/discount" => "discounts#create"
|
post "/:id/discount" => "discounts#create"
|
||||||
get "/:id/remove_all_discount" => "discounts#remove_all_discount"
|
get "/:id/remove_all_discount" => "discounts#remove_all_discount"
|
||||||
post "/:id/remove_discount_items" => "discounts#remove_discount_items"
|
post "/:id/remove_discount_items" => "discounts#remove_discount_items"
|
||||||
|
|
||||||
post "/:id/request_bills" => "request_bills#print",:as => "request_bill" ,:defaults => { :format => 'json' }
|
get "/:id/request_bills" => "request_bills#print",:as => "request_bill"
|
||||||
get '/:sale_id/reprint' => 'payments#reprint' ,:defaults => { :format => 'json' }
|
get '/:sale_id/reprint' => 'payments#reprint' ,:defaults => { :format => 'json' }
|
||||||
|
|
||||||
|
#---------Shift ---------------#
|
||||||
|
resources :shifts, only: [:index, :new, :create, :edit]
|
||||||
|
post 'close_shift' => 'shifts#update_shift'
|
||||||
|
get 'shift/close' => 'shifts#show'
|
||||||
|
#shift - index (open/close shift landing page)
|
||||||
|
#shift - show (sales summary display)
|
||||||
|
#shift - new (open shift)
|
||||||
|
#shift - edit (close shift)
|
||||||
|
|
||||||
|
resources :cash_mgmt, only: [:new, :create]
|
||||||
|
#payment - accepting or expending money from cashier - [Cash Journal]
|
||||||
|
#payment - Incoming payments - [accept all payment types (cash, other payments (except rebate))
|
||||||
|
#payment - Outing payments - Cash only [ *Misc expeness tracking]
|
||||||
|
|
||||||
#--------- Payment ------------#
|
#--------- Payment ------------#
|
||||||
|
get 'sale/:sale_id/first_bill' => 'payments#first_bill', :defaults => { :format => 'json' }
|
||||||
get 'sale/:sale_id/payment' => 'payments#show'
|
get 'sale/:sale_id/payment' => 'payments#show'
|
||||||
|
|
||||||
post 'payment/cash' => 'payments#create'
|
post 'payment/cash' => 'payments#create'
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ class CreatePaymentJournals < ActiveRecord::Migration[5.1]
|
|||||||
t.string :payment_method,:null => false, :default => "CASH"
|
t.string :payment_method,:null => false, :default => "CASH"
|
||||||
t.string :payment_status,:null => false, :default => "NEW"
|
t.string :payment_status,:null => false, :default => "NEW"
|
||||||
t.string :payment_method_references
|
t.string :payment_method_references
|
||||||
|
t.integer :created_by, :null => false
|
||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -83,6 +83,12 @@ void_reason = Lookup.create([{lookup_type:'void_reason', name: 'Approve By Manag
|
|||||||
{lookup_type:'void_reason', name: 'Cashier Mistake', value: 'Cashier Mistake'},
|
{lookup_type:'void_reason', name: 'Cashier Mistake', value: 'Cashier Mistake'},
|
||||||
{lookup_type:'void_reason', name: 'Waiter Mistake', value: 'Waiter Mistake'}])
|
{lookup_type:'void_reason', name: 'Waiter Mistake', value: 'Waiter Mistake'}])
|
||||||
|
|
||||||
|
# sale void reason
|
||||||
|
float_value = Lookup.create([{lookup_type:'float_value', name: '500', value: '500'},
|
||||||
|
{lookup_type:'float_value', name: '1000', value: '1000'},
|
||||||
|
{lookup_type:'float_value', name: '5000', value: '5000'},
|
||||||
|
{lookup_type:'float_value', name: '10000', value: '10000'}])
|
||||||
|
|
||||||
#WALK CUSTOMER - Default CUSTOMER (take key 1)
|
#WALK CUSTOMER - Default CUSTOMER (take key 1)
|
||||||
customer = Customer.create({name:"WALK-IN", email: "cus1@customer.com", contact_no:"000000000",card_no:"000"})
|
customer = Customer.create({name:"WALK-IN", email: "cus1@customer.com", contact_no:"000000000",card_no:"000"})
|
||||||
customer2 = Customer.create({name:"TAKEAWAY", email: "cus2@customer.com", contact_no:"111111111",card_no:"111"})
|
customer2 = Customer.create({name:"TAKEAWAY", email: "cus2@customer.com", contact_no:"111111111",card_no:"111"})
|
||||||
@@ -174,4 +180,5 @@ payment_methods = PaymentMethodSetting.create({payment_method:"JCB",gateway_url:
|
|||||||
payment_methods = PaymentMethodSetting.create({payment_method:"Master",gateway_url: "http://192.168.1.47:3006"})
|
payment_methods = PaymentMethodSetting.create({payment_method:"Master",gateway_url: "http://192.168.1.47:3006"})
|
||||||
payment_methods = PaymentMethodSetting.create({payment_method:"Redeem",gateway_url: "http://192.168.1.47:3006",merchant_account_id:"vWSsseoZCzxd6xcNf_uS"})
|
payment_methods = PaymentMethodSetting.create({payment_method:"Redeem",gateway_url: "http://192.168.1.47:3006",merchant_account_id:"vWSsseoZCzxd6xcNf_uS"})
|
||||||
|
|
||||||
|
cashier_terminal = CashierTerminal.create({name:"Terminal 1"})
|
||||||
puts " Finished System Default Set Up Data "
|
puts " Finished System Default Set Up Data "
|
||||||
|
|||||||
@@ -11,7 +11,9 @@ namespace :clear do
|
|||||||
Sale.delete_all
|
Sale.delete_all
|
||||||
SaleAudit.delete_all
|
SaleAudit.delete_all
|
||||||
SalePayment.delete_all
|
SalePayment.delete_all
|
||||||
DiningFacility.update_all(status:'available')
|
ShiftSale.delete_all
|
||||||
|
PaymentJournal.delete_all
|
||||||
|
DiningFacility.update_all(status:'available')
|
||||||
puts "Clear Data Done."
|
puts "Clear Data Done."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user