Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant
This commit is contained in:
@@ -3,16 +3,17 @@ class ApplicationController < ActionController::Base
|
||||
#before_action :check_installation
|
||||
protect_from_forgery with: :exception
|
||||
|
||||
helper_method :current_company,:current_login_employee
|
||||
|
||||
helper_method :current_company,:current_login_employee,:current_user
|
||||
# alias_method :current_user, :current_login_employee,:current_user
|
||||
#this is base api base controller to need to inherit.
|
||||
#all token authentication must be done here
|
||||
#response format must be set to JSON
|
||||
|
||||
# rescue_from CanCan::AccessDenied do |exception|
|
||||
# flash[:warning] = exception.message
|
||||
# redirect_to root_path
|
||||
# end
|
||||
|
||||
rescue_from CanCan::AccessDenied do |exception|
|
||||
flash[:warning] = exception.message
|
||||
redirect_to root_path
|
||||
end
|
||||
|
||||
|
||||
def current_user
|
||||
|
||||
@@ -1,9 +1,17 @@
|
||||
class BaseCrmController < ActionController::Base
|
||||
include LoginVerification
|
||||
layout "CRM"
|
||||
include LoginVerification
|
||||
layout "CRM"
|
||||
|
||||
#before_action :check_installation
|
||||
protect_from_forgery with: :exception
|
||||
|
||||
rescue_from CanCan::AccessDenied do |exception|
|
||||
flash[:warning] = exception.message
|
||||
redirect_to root_path
|
||||
end
|
||||
|
||||
def current_user
|
||||
@current_user ||= Employee.find_by_token_session(session[:session_token]) if session[:session_token]
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -5,5 +5,13 @@ class BaseOqsController < ActionController::Base
|
||||
#before_action :check_installation
|
||||
protect_from_forgery with: :exception
|
||||
|
||||
rescue_from CanCan::AccessDenied do |exception|
|
||||
flash[:warning] = exception.message
|
||||
redirect_to root_path
|
||||
end
|
||||
|
||||
def current_user
|
||||
@current_user ||= Employee.find_by_token_session(session[:session_token]) if session[:session_token]
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -5,5 +5,14 @@ class BaseOrigamiController < ActionController::Base
|
||||
#before_action :check_installation
|
||||
protect_from_forgery with: :exception
|
||||
|
||||
rescue_from CanCan::AccessDenied do |exception|
|
||||
flash[:warning] = exception.message
|
||||
redirect_to root_path
|
||||
end
|
||||
|
||||
def current_user
|
||||
@current_user ||= Employee.find_by_token_session(session[:session_token]) if session[:session_token]
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
@@ -5,6 +5,15 @@ class BaseReportController < ActionController::Base
|
||||
#before_action :check_installation
|
||||
protect_from_forgery with: :exception
|
||||
|
||||
rescue_from CanCan::AccessDenied do |exception|
|
||||
flash[:warning] = exception.message
|
||||
redirect_to root_path
|
||||
end
|
||||
|
||||
def current_user
|
||||
@current_user ||= Employee.find_by_token_session(session[:session_token]) if session[:session_token]
|
||||
end
|
||||
|
||||
PERIOD = {
|
||||
"today" => 0,
|
||||
"yesterday" => 1,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class Crm::BookingsController < BaseCrmController
|
||||
|
||||
load_and_authorize_resource
|
||||
def update_booking
|
||||
booking = Booking.find(params[:booking_id])
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class Crm::CustomersController < BaseCrmController
|
||||
load_and_authorize_resource except: [:create]
|
||||
before_action :set_crm_customer, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /crm/customers
|
||||
@@ -47,7 +48,8 @@ class Crm::CustomersController < BaseCrmController
|
||||
|
||||
#get customer amount
|
||||
@customer = Customer.find(params[:id])
|
||||
@response = Customer.get_membership_transactions(@customer)
|
||||
@response = Customer.get_membership_transactions(@customer)
|
||||
# @response = ""
|
||||
#end customer amount
|
||||
|
||||
end
|
||||
@@ -68,7 +70,7 @@ class Crm::CustomersController < BaseCrmController
|
||||
def create
|
||||
|
||||
@crm_customers = Customer.new(customer_params)
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
if @crm_customers.save
|
||||
name = customer_params[:name]
|
||||
@@ -77,6 +79,7 @@ class Crm::CustomersController < BaseCrmController
|
||||
dob = customer_params[:date_of_birth]
|
||||
address = customer_params[:address]
|
||||
nrc = customer_params[:nrc_no]
|
||||
card_no = customer_params[:card_no]
|
||||
member_group_id = params[:member_group_id]
|
||||
|
||||
if !member_group_id.nil?
|
||||
@@ -87,16 +90,17 @@ class Crm::CustomersController < BaseCrmController
|
||||
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
||||
|
||||
begin
|
||||
response = HTTParty.post(url, :body => { name: name,phone: phone,email: email,
|
||||
dob: dob,address: address,nrc:nrc,
|
||||
member_group_id: member_group_id,
|
||||
merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
response = HTTParty.post(url,
|
||||
:body => {name: name,phone: phone,email: email,
|
||||
dob: dob,address: address,nrc:nrc,card_no:card_no,
|
||||
member_group_id: member_group_id,
|
||||
merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
},
|
||||
:timeout => 10
|
||||
)
|
||||
:timeout => 10
|
||||
)
|
||||
rescue Net::OpenTimeout
|
||||
response = { status: false }
|
||||
end
|
||||
@@ -149,10 +153,12 @@ end
|
||||
dob = customer_params[:date_of_birth]
|
||||
address = customer_params[:address]
|
||||
nrc = customer_params[:nrc_no]
|
||||
card_no = customer_params[:card_no]
|
||||
id = @crm_customer.membership_id
|
||||
member_group_id = params[:member_group_id]
|
||||
|
||||
if id.nil? && !member_group_id.nil?
|
||||
|
||||
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
||||
memberaction = MembershipAction.find_by_membership_type("create_membership_customer")
|
||||
merchant_uid = memberaction.merchant_account_id.to_s
|
||||
@@ -160,16 +166,17 @@ end
|
||||
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
||||
|
||||
begin
|
||||
response = HTTParty.post(url, :body => { name: name,phone: phone,email: email,
|
||||
dob: dob,address: address,nrc:nrc,
|
||||
member_group_id: member_group_id,
|
||||
merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
response = HTTParty.post(url,
|
||||
:body => { name: name,phone: phone,email: email,
|
||||
dob: dob,address: address,nrc:nrc,
|
||||
card_no:card_no,member_group_id: member_group_id,
|
||||
merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
},
|
||||
:timeout => 10
|
||||
)
|
||||
:timeout => 10
|
||||
)
|
||||
rescue Net::OpenTimeout
|
||||
response = { status: false }
|
||||
end
|
||||
@@ -185,20 +192,22 @@ end
|
||||
end
|
||||
|
||||
else
|
||||
|
||||
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
||||
memberaction = MembershipAction.find_by_membership_type("update_membership_customer")
|
||||
merchant_uid = memberaction.merchant_account_id.to_s
|
||||
auth_token = memberaction.auth_token.to_s
|
||||
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
||||
begin
|
||||
response = HTTParty.post(url, :body => { name: name,phone: phone,email: email,
|
||||
dob: dob,address: address,nrc:nrc,
|
||||
id: id,member_group_id:member_group_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
response = HTTParty.post(url,
|
||||
:body => {name: name,phone: phone,email: email,
|
||||
dob: dob,address: address,nrc:nrc,card_no:card_no,
|
||||
id: id,member_group_id:member_group_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
},
|
||||
:timeout => 10
|
||||
:timeout => 10
|
||||
)
|
||||
rescue Net::OpenTimeout
|
||||
response = { status: false }
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class Crm::DiningQueuesController < BaseCrmController
|
||||
load_and_authorize_resource
|
||||
before_action :set_dining_queue, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /crm/dining_queues
|
||||
|
||||
@@ -18,6 +18,12 @@ class HomeController < ApplicationController
|
||||
elsif @employee.role == "cashier"
|
||||
session[:session_token] = @employee.token_session
|
||||
redirect_to origami_root_path
|
||||
elsif @employee.role == "manager"
|
||||
session[:session_token] = @employee.token_session
|
||||
redirect_to dashboard_path
|
||||
elsif @employee.role == "accountant"
|
||||
session[:session_token] = @employee.token_session
|
||||
redirect_to dashboard_path
|
||||
else
|
||||
render :index
|
||||
end
|
||||
|
||||
18
app/controllers/oqs/edit_controller.rb
Normal file
18
app/controllers/oqs/edit_controller.rb
Normal file
@@ -0,0 +1,18 @@
|
||||
class Oqs::EditController < BaseOqsController
|
||||
def index
|
||||
assigned_item_id = params[:id]
|
||||
assigned_item = AssignedOrderItem.find(assigned_item_id)
|
||||
@order_item = OrderItem.where("order_id='#{ assigned_item.order_id }' AND item_code='#{ assigned_item.item_code }'");
|
||||
end
|
||||
|
||||
def update
|
||||
order_items_id = params[:order_items_id]
|
||||
qty_weight = params[:qty_weight]
|
||||
remarks = params[:remarks]
|
||||
|
||||
order_item = OrderItem.find(order_items_id);
|
||||
order_item.qty = qty_weight
|
||||
order_item.remark = remarks
|
||||
order_item.save
|
||||
end
|
||||
end
|
||||
@@ -109,7 +109,7 @@ class Oqs::HomeController < BaseOqsController
|
||||
# queue_items.push(queue_item)
|
||||
# end
|
||||
# return queue_items
|
||||
AssignedOrderItem.select("assigned_order_items.assigned_order_item_id, oqs.station_name, oqs.is_active, df.name as zone, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, odt.options, cus.name as customer_name, odt.created_at")
|
||||
AssignedOrderItem.select("assigned_order_items.assigned_order_item_id, oqs.station_name, oqs.is_active, df.name as zone, df.type, odt.order_id, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, odt.options, cus.name as customer_name, odt.created_at")
|
||||
.joins(" left join order_queue_stations as oqs on oqs.id = assigned_order_items.order_queue_station_id
|
||||
left join orders as od ON od.order_id = assigned_order_items.order_id
|
||||
left join order_items as odt ON odt.item_code = assigned_order_items.item_code AND odt.order_id = assigned_order_items.order_id
|
||||
@@ -118,6 +118,6 @@ class Oqs::HomeController < BaseOqsController
|
||||
left join bookings as bk on bk.booking_id = bo.booking_id
|
||||
left join dining_facilities as df on df.id = bk.dining_facility_id")
|
||||
.where("assigned_order_items.delivery_status = #{status}")
|
||||
.group("odt.order_items_id")
|
||||
.group("assigned_order_items.assigned_order_item_id")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,9 +2,31 @@ class Origami::CreditPaymentsController < BaseOrigamiController
|
||||
|
||||
|
||||
def index
|
||||
@sale_id = params[:sale_id]
|
||||
|
||||
# limit visa_amount
|
||||
sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
total = sale_data.grand_total
|
||||
@creditcount = 0
|
||||
others = 0
|
||||
sale_data.sale_payments.each do |sale_payment|
|
||||
if sale_payment.payment_method == "visa"
|
||||
@creditcount = @creditcount + sale_payment.payment_amount
|
||||
else
|
||||
others = others + sale_payment.payment_amount
|
||||
end
|
||||
end
|
||||
@can_credit = total - @creditcount - others
|
||||
end
|
||||
|
||||
def create
|
||||
cash = params[:amount]
|
||||
sale_id = params[:sale_id]
|
||||
if(Sale.exists?(sale_id))
|
||||
saleObj = Sale.find(sale_id)
|
||||
sale_payment = SalePayment.new
|
||||
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "creditnote")
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
class Origami::CustomersController < BaseOrigamiController
|
||||
#Form to add customer -
|
||||
load_and_authorize_resource
|
||||
def index
|
||||
|
||||
|
||||
end
|
||||
|
||||
# GET /crm/customers/1
|
||||
@@ -54,6 +52,10 @@ class Origami::CustomersController < BaseOrigamiController
|
||||
if(id == "SAL")
|
||||
sale = Sale.find(params[:sale_id])
|
||||
status = sale.update_attributes(customer_id: params[:customer_id])
|
||||
sale.sale_orders.each do |sale_order|
|
||||
order = Order.find(sale_order.order_id)
|
||||
status = order.update_attributes(customer_id: params[:customer_id])
|
||||
end
|
||||
else
|
||||
@booking = BookingOrder.find_by_order_id(params[:sale_id])
|
||||
@orders = BookingOrder.where("booking_id = ? ", @booking.booking_id)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class Origami::DiscountsController < BaseOrigamiController
|
||||
authorize_resource :class => false
|
||||
|
||||
#discount page show from origami index with selected order
|
||||
def index
|
||||
|
||||
@@ -35,7 +35,7 @@ class Origami::HomeController < BaseOrigamiController
|
||||
@status_order = 'order'
|
||||
else
|
||||
sale = Sale.find(booking.sale_id)
|
||||
if sale.sale_status != "completed"
|
||||
if sale.sale_status != "completed" && sale.sale_status != 'void'
|
||||
puts "enter"
|
||||
@sale_array.push(sale)
|
||||
if @status_order == 'order'
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
class Origami::MoveroomController < BaseOrigamiController
|
||||
|
||||
|
||||
authorize_resource :class => false
|
||||
|
||||
def move_dining
|
||||
@tables = Table.all.active.order('status desc')
|
||||
@rooms = Room.all.active.order('status desc')
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
class Origami::MovetableController < BaseOrigamiController
|
||||
|
||||
authorize_resource :class => false
|
||||
|
||||
def move_dining
|
||||
@tables = Table.all.active.order('status desc')
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class Origami::PaymentsController < BaseOrigamiController
|
||||
|
||||
|
||||
authorize_resource :class => false
|
||||
def index
|
||||
end
|
||||
|
||||
@@ -17,6 +17,8 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
unique_code = "ReceiptBillPdf"
|
||||
customer= Customer.find(saleObj.customer_id)
|
||||
rebate_amount = Customer.get_membership_transactions(customer)
|
||||
#shop detail
|
||||
shop_details = Shop.find(1)
|
||||
# get member information
|
||||
member_info = Customer.get_member_account(customer)
|
||||
|
||||
@@ -26,7 +28,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
item_price_by_accounts = SaleItem.calculate_price_by_accounts(saleObj.sale_items)
|
||||
|
||||
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)
|
||||
printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, member_info,rebate_amount,shop_details)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -39,6 +41,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
@visacount= 0.0
|
||||
@jcbcount= 0.0
|
||||
@mastercount = 0.0
|
||||
@credit = 0.0
|
||||
@sale_data = Sale.find_by_sale_id(sale_id)
|
||||
|
||||
#get customer amount
|
||||
@@ -51,8 +54,8 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
@accountable_type = ''
|
||||
if response["status"]==true
|
||||
response["data"].each do |res|
|
||||
if res["accountable_type"] == "RebateAccount"
|
||||
@balance = res["balance"]
|
||||
if res["accountable_type"] == "RebateAccount" || res["accountable_type"] == "RebatebonusAccount"
|
||||
@balance += res["balance"]
|
||||
# @accountable_type = res["accountable_type"]
|
||||
@accountable_type = "Rebate Balance"
|
||||
end
|
||||
@@ -75,6 +78,8 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
@jcbcount += spay.payment_amount
|
||||
elsif spay.payment_method == "master"
|
||||
@mastercount += spay.payment_amount
|
||||
elsif spay.payment_method == "creditnote"
|
||||
@credit += spay.payment_amount
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -89,6 +94,8 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
unique_code = "ReceiptBillPdf"
|
||||
customer= Customer.find(saleObj.customer_id)
|
||||
|
||||
#shop detail
|
||||
shop_details = Shop.find(1)
|
||||
# get member information
|
||||
member_info = Customer.get_member_account(customer)
|
||||
rebate_amount = Customer.get_membership_transactions(customer)
|
||||
@@ -99,7 +106,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
item_price_by_accounts = SaleItem.calculate_price_by_accounts(saleObj.sale_items)
|
||||
|
||||
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)
|
||||
printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, member_info,rebate_amount,shop_details)
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class Origami::RequestBillsController < BaseOrigamiController
|
||||
|
||||
# Print Request Bill and add to sale tables
|
||||
def print
|
||||
@sale = Sale.new
|
||||
@@ -20,8 +21,9 @@ class Origami::RequestBillsController < BaseOrigamiController
|
||||
end
|
||||
|
||||
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)
|
||||
@@ -36,7 +38,7 @@ class Origami::RequestBillsController < BaseOrigamiController
|
||||
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
|
||||
printer.print_receipt_bill(print_settings,@sale_items,@sale_data,customer.name, item_price_by_accounts,member_info)
|
||||
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)
|
||||
|
||||
end
|
||||
|
||||
40
app/controllers/origami/room_invoices_controller.rb
Normal file
40
app/controllers/origami/room_invoices_controller.rb
Normal file
@@ -0,0 +1,40 @@
|
||||
class Origami::RoomInvoicesController < BaseOrigamiController
|
||||
def index
|
||||
@room = DiningFacility.find(params[:room_id])
|
||||
puts "room bookig lenght"
|
||||
@sale_array = Array.new
|
||||
@room.bookings.each do |booking|
|
||||
puts booking.sale_id
|
||||
|
||||
if booking.sale_id.nil?
|
||||
else
|
||||
sale = Sale.find(booking.sale_id)
|
||||
|
||||
if sale.sale_status != "completed"
|
||||
@sale_array.push(sale)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
@room = DiningFacility.find(params[:room_id])
|
||||
@sale_array = Array.new
|
||||
@room.bookings.each do |booking|
|
||||
if booking.sale_id.nil?
|
||||
else
|
||||
sale = Sale.find(booking.sale_id)
|
||||
|
||||
if sale.sale_status != "completed"
|
||||
@sale_array.push(sale)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@sale = Sale.find(params[:invoice_id])
|
||||
@date = @sale.created_at
|
||||
@status_sale = 'sale'
|
||||
@customer = @sale.customer
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,11 +1,13 @@
|
||||
class Origami::SaleEditController < BaseOrigamiController
|
||||
|
||||
# Index for sale item void OR edit
|
||||
def edit
|
||||
sale_id = params[:sale_id]
|
||||
@table_id = params[:table_id]
|
||||
@saleobj = Sale.find(sale_id)
|
||||
end
|
||||
|
||||
# create item void. make duplicate old record and update qty and price
|
||||
def item_void
|
||||
saleitemId = params[:sale_item_id]
|
||||
saleitemObj = SaleItem.find(saleitemId)
|
||||
@@ -19,4 +21,38 @@ class Origami::SaleEditController < BaseOrigamiController
|
||||
@newsaleitem.product_name = saleitemObj.product_name + " - void"
|
||||
@newsaleitem.save
|
||||
end
|
||||
|
||||
# make cancel void item
|
||||
def item_void_cancel
|
||||
saleitemId = params[:sale_item_id]
|
||||
saleitemObj = SaleItem.find(saleitemId)
|
||||
both = SaleItem.where('product_code=?',saleitemObj.product_code)
|
||||
both.each do |item|
|
||||
if item.qty.to_i > 0
|
||||
item.remark = nil
|
||||
item.save
|
||||
end
|
||||
end
|
||||
saleitemObj.destroy
|
||||
end
|
||||
|
||||
# remove all void items
|
||||
def cancel_all_void
|
||||
sale_id = params[:sale_id]
|
||||
saleobj = Sale.find(sale_id)
|
||||
saleobj.sale_items.each do |item|
|
||||
if item.qty.to_i < 0
|
||||
item.destroy
|
||||
else
|
||||
item.remark = nil
|
||||
end
|
||||
item.save
|
||||
end
|
||||
end
|
||||
|
||||
def apply_void
|
||||
sale_id = params[:sale_id]
|
||||
saleObj = Sale.find(sale_id)
|
||||
saleObj.compute_without_void
|
||||
end
|
||||
end
|
||||
|
||||
40
app/controllers/origami/table_invoices_controller.rb
Normal file
40
app/controllers/origami/table_invoices_controller.rb
Normal file
@@ -0,0 +1,40 @@
|
||||
class Origami::TableInvoicesController < BaseOrigamiController
|
||||
def index
|
||||
@table = DiningFacility.find(params[:table_id])
|
||||
puts "table bookig lenght"
|
||||
@sale_array = Array.new
|
||||
@table.bookings.each do |booking|
|
||||
puts booking.sale_id
|
||||
|
||||
if booking.sale_id.nil?
|
||||
else
|
||||
sale = Sale.find(booking.sale_id)
|
||||
|
||||
if sale.sale_status != "completed"
|
||||
@sale_array.push(sale)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
@table = DiningFacility.find(params[:table_id])
|
||||
@sale_array = Array.new
|
||||
@table.bookings.each do |booking|
|
||||
if booking.sale_id.nil?
|
||||
else
|
||||
sale = Sale.find(booking.sale_id)
|
||||
|
||||
if sale.sale_status != "completed"
|
||||
@sale_array.push(sale)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@sale = Sale.find(params[:invoice_id])
|
||||
@date = @sale.created_at
|
||||
@status_sale = 'sale'
|
||||
@customer = @sale.customer
|
||||
end
|
||||
|
||||
end
|
||||
28
app/controllers/origami/void_controller.rb
Normal file
28
app/controllers/origami/void_controller.rb
Normal file
@@ -0,0 +1,28 @@
|
||||
class Origami::VoidController < BaseOrigamiController
|
||||
|
||||
def overall_void
|
||||
|
||||
sale_id = params[:sale_id]
|
||||
if Sale.exists?(sale_id)
|
||||
sale = Sale.find_by_sale_id(sale_id)
|
||||
sale.payment_status = 'void'
|
||||
sale.sale_status = 'void'
|
||||
sale.save
|
||||
|
||||
table_avaliable = true
|
||||
table = sale.bookings[0].dining_facility
|
||||
table.bookings.each do |booking|
|
||||
if booking.sale.sale_status == 'new'
|
||||
table_avaliable = false
|
||||
end
|
||||
end
|
||||
|
||||
if table_avaliable == true
|
||||
table.status = 'available'
|
||||
table.save
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,4 +1,5 @@
|
||||
class PrintSettingsController < ApplicationController
|
||||
load_and_authorize_resource except: [:create]
|
||||
before_action :set_print_setting, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /print_settings
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class Reports::SaleItemController < BaseReportController
|
||||
|
||||
class Reports::SaleItemsController < BaseReportController
|
||||
authorize_resource :class => false
|
||||
def index
|
||||
|
||||
from, to, report_type = get_date_range_from_params
|
||||
17
app/controllers/reports/daily_sales_controller.rb
Normal file
17
app/controllers/reports/daily_sales_controller.rb
Normal file
@@ -0,0 +1,17 @@
|
||||
class Reports::DailySalesController < BaseReportController
|
||||
# authorize_resource :class => false
|
||||
def index
|
||||
from, to ,report_type = get_date_range_from_params
|
||||
@sale_data = Sale.daily_sales_list(from,to)
|
||||
@tax = SaleTax.get_tax(from,to)
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.xls
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,5 +1,5 @@
|
||||
class Reports::DailySaleController < BaseReportController
|
||||
|
||||
class Reports::DailySalesController < BaseReportController
|
||||
authorize_resource :class => false
|
||||
def index
|
||||
from, to ,report_type = get_date_range_from_params
|
||||
@sale_data = Sale.daily_sales_list(from,to)
|
||||
19
app/controllers/reports/sale_items_controller.rb
Normal file
19
app/controllers/reports/sale_items_controller.rb
Normal file
@@ -0,0 +1,19 @@
|
||||
class Reports::SaleItemsController < BaseReportController
|
||||
# authorize_resource :class => false
|
||||
def index
|
||||
|
||||
from, to, report_type = get_date_range_from_params
|
||||
|
||||
@sale_data = Sale.get_by_range_by_saleitems(from,to,Sale::SALE_STATUS_COMPLETED,report_type)
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.xls
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,4 +1,5 @@
|
||||
class Settings::AccountsController < ApplicationController
|
||||
load_and_authorize_resource except: [:create]
|
||||
before_action :set_account, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /settings/accounts
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class Settings::CashierTerminalsController < ApplicationController
|
||||
load_and_authorize_resource except: [:create]
|
||||
before_action :set_settings_cashier_terminal, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /settings/cashier_terminals
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class Settings::EmployeesController < ApplicationController
|
||||
# load_and_authorize_resource
|
||||
load_and_authorize_resource
|
||||
before_action :set_employee, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class Settings::MembershipActionsController < ApplicationController
|
||||
load_and_authorize_resource except: [:create]
|
||||
before_action :set_settings_membership_action, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /settings/membership_actions
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class Settings::MembershipSettingsController < ApplicationController
|
||||
load_and_authorize_resource except: [:create]
|
||||
before_action :set_settings_membership_setting, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /settings/membership_settings
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class Settings::MenuCategoriesController < ApplicationController
|
||||
load_and_authorize_resource except: [:create]
|
||||
before_action :set_settings_menu_category, only: [:show, :edit, :update, :destroy]
|
||||
before_action :set_settings_menu, only: [:new]
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class Settings::MenuItemAttributesController < ApplicationController
|
||||
load_and_authorize_resource except: [:create]
|
||||
before_action :set_settings_menu_item_attribute, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /settings/menu_item_attributes
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class Settings::MenuItemInstancesController < ApplicationController
|
||||
load_and_authorize_resource except: [:create]
|
||||
before_action :set_settings_menu_item_instance, only: [:show, :edit, :update, :destroy]
|
||||
before_action :set_settings_menu_item, only: [ :show, :edit, :new, :update]
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class Settings::MenuItemOptionsController < ApplicationController
|
||||
load_and_authorize_resource except: [:create]
|
||||
before_action :set_settings_menu_item_option, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /settings/menu_item_options
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class Settings::MenusController < ApplicationController
|
||||
load_and_authorize_resource except: [:create]
|
||||
before_action :set_settings_menu, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /settings/menus
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class Settings::OrderQueueStationsController < ApplicationController
|
||||
load_and_authorize_resource except: [:create]
|
||||
before_action :set_settings_order_queue_station, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /settings/order_queue_stations
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class Settings::PaymentMethodSettingsController < ApplicationController
|
||||
load_and_authorize_resource except: [:create]
|
||||
before_action :set_settings_payment_method_setting, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /settings/payment_method_settings
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class Settings::TaxProfilesController < ApplicationController
|
||||
load_and_authorize_resource except: [:create]
|
||||
before_action :set_settings_tax_profile, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /settings/tax_profiles
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class Settings::ZonesController < ApplicationController
|
||||
load_and_authorize_resource except: [:create]
|
||||
before_action :set_settings_zone, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /settings/zones
|
||||
|
||||
18
app/controllers/transactions/credit_notes_controller.rb
Normal file
18
app/controllers/transactions/credit_notes_controller.rb
Normal file
@@ -0,0 +1,18 @@
|
||||
class Transactions::CreditNotesController < ApplicationController
|
||||
before_action :set_transactions_sale, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /transactions/sales
|
||||
# GET /transactions/sales.json
|
||||
def index
|
||||
|
||||
@sales = Sale.where('payment_status = ?', Sale::SALE_STATUS_OUTSTANDING)
|
||||
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.json { render json: @sales }
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@@ -1,4 +1,5 @@
|
||||
class Transactions::OrdersController < ApplicationController
|
||||
load_and_authorize_resource except: [:create]
|
||||
def index
|
||||
|
||||
filter = params[:filter]
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class Transactions::SalesController < ApplicationController
|
||||
load_and_authorize_resource except: [:create]
|
||||
before_action :set_transactions_sale, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /transactions/sales
|
||||
|
||||
Reference in New Issue
Block a user