shop_code

This commit is contained in:
Myat Zin Wai Maw
2019-12-05 14:56:47 +06:30
parent ccbd3c6966
commit b0f6368248
58 changed files with 95 additions and 26 deletions

View File

@@ -109,7 +109,7 @@ def get_all_menu
end end
def get_credit_sales def get_credit_sales
credit_sales = SalePayment.get_credit_sales(params,@shop.shop_code) credit_sales = SalePayment.get_credit_sales(params,Shop.current_shop.shop_code)
if !credit_sales.nil? if !credit_sales.nil?
result = {:status=> true, :data=> credit_sales } result = {:status=> true, :data=> credit_sales }
else else

View File

@@ -1,5 +1,6 @@
class Foodcourt::SurveysController < BaseFoodcourtController class Foodcourt::SurveysController < BaseFoodcourtController
def new def new
@shop = Shop.current_shop
@webview = false @webview = false
if check_mobile if check_mobile
@webview = true @webview = true
@@ -38,6 +39,7 @@ class Foodcourt::SurveysController < BaseFoodcourtController
end end
def create def create
@shop = Shop.current_shop
@type = params[:cashier_type] @type = params[:cashier_type]
@sale_id = params[:sale_id] @sale_id = params[:sale_id]
if params[:table_id].to_i>0 if params[:table_id].to_i>0

View File

@@ -1,6 +1,6 @@
class Foodcourt::WasteSpoileController < BaseFoodcourtController class Foodcourt::WasteSpoileController < BaseFoodcourtController
def waste_and_spoilage def waste_and_spoilage
@shop = Shop.current_shop
sale_id = params[:sale_id] sale_id = params[:sale_id]
remark = params[:remark] remark = params[:remark]
order_source = params[:type] order_source = params[:type]

View File

@@ -1,6 +1,7 @@
class Oqs::HomeController < BaseOqsController class Oqs::HomeController < BaseOqsController
authorize_resource :class => false authorize_resource :class => false
def index def index
@shop = Shop.current_shop
# Query for OQS with delivery status false # Query for OQS with delivery status false
# @queue_items_details = queue_items_query(false) # @queue_items_details = queue_items_query(false)

View File

@@ -3,6 +3,7 @@ class Origami::CashInsController < BaseOrigamiController
end end
def create def create
@shop = Shop.current_shop
reference = params[:reference] reference = params[:reference]
remark = params[:remark] remark = params[:remark]
amount = params[:amount] amount = params[:amount]

View File

@@ -3,6 +3,7 @@ class Origami::CashOutsController < BaseOrigamiController
end end
def create def create
@shop = Shop.current_shop
reference = params[:reference] reference = params[:reference]
remark = params[:remark] remark = params[:remark]
amount = params[:amount] amount = params[:amount]

View File

@@ -49,6 +49,7 @@ class Origami::CreditPaymentsController < BaseOrigamiController
end end
def create_credit_payment def create_credit_payment
@shop = Shop.current_shop
arr_sale = JSON.parse(params[:data]) arr_sale = JSON.parse(params[:data])
if !ShiftSale.current_shift(@shop.shop_code).nil? if !ShiftSale.current_shift(@shop.shop_code).nil?
if !arr_sale.nil? if !arr_sale.nil?

View File

@@ -46,6 +46,7 @@ class Origami::CustomersController < BaseOrigamiController
end end
def add_customer def add_customer
@shop = Shop.current_shop
@webview = false @webview = false
if check_mobile if check_mobile
@webview = true @webview = true
@@ -162,6 +163,7 @@ class Origami::CustomersController < BaseOrigamiController
end end
def send_account def send_account
@shop = Shop.current_shop
amount = params[:amount] amount = params[:amount]
account_no = params[:account_no] account_no = params[:account_no]
receipt_no = params[:receipt_no] receipt_no = params[:receipt_no]

View File

@@ -114,7 +114,7 @@ def get_all_menu
end end
def get_credit_sales def get_credit_sales
credit_sales = SalePayment.get_credit_sales(params,current_shop.shop_code) credit_sales = SalePayment.get_credit_sales(params,Shop.current_shop.shop_code)
if !credit_sales.nil? if !credit_sales.nil?
result = {:status=> true, :data=> credit_sales } result = {:status=> true, :data=> credit_sales }
else else

View File

@@ -3,6 +3,7 @@ class Origami::DiscountsController < BaseOrigamiController
#discount page show from origami index with selected order #discount page show from origami index with selected order
def index def index
@shop = Shop.current_shop
# get printer info # get printer info
@print_settings = PrintSetting.get_precision_delimiter() @print_settings = PrintSetting.get_precision_delimiter()
@webview = false @webview = false

View File

@@ -154,6 +154,7 @@ class Origami::FoodCourtController < ApplicationController
end end
def get_all_product() def get_all_product()
@shop = Shop.current_shop
@product = Product..where("shop_code='#{@shop.shop_code}'") @product = Product..where("shop_code='#{@shop.shop_code}'")
end end

View File

@@ -3,6 +3,7 @@ class Origami::HomeController < BaseOrigamiController
before_action :set_dining, only: [:show] before_action :set_dining, only: [:show]
def index def index
@shop = Shop.current_shop
@webview = check_mobile @webview = check_mobile
@@ -19,6 +20,7 @@ class Origami::HomeController < BaseOrigamiController
# origami table detail # origami table detail
def show def show
@shop = Shop.current_shop
# get printer info # get printer info
@print_settings = PrintSetting.get_precision_delimiter() @print_settings = PrintSetting.get_precision_delimiter()
@webview = check_mobile @webview = check_mobile

View File

@@ -10,6 +10,7 @@ class Origami::OrderReservationController < BaseOrigamiController
end end
def update def update
@shop = Shop.current_shop
@id = params[:order_id] @id = params[:order_id]
@status = params[:status] @status = params[:status]
min_type = params[:min_type] min_type = params[:min_type]
@@ -86,6 +87,7 @@ class Origami::OrderReservationController < BaseOrigamiController
end end
def send_status def send_status
@shop = Shop.current_shop
order_reservation = OrderReservation.find_by_transaction_ref(params[:ref_no]) order_reservation = OrderReservation.find_by_transaction_ref(params[:ref_no])
if !order_reservation.nil? if !order_reservation.nil?
if !ShiftSale.current_shift(@shop.shop_code).nil? || params[:status] == 'accepted' || (order_reservation.status == 'new' && params[:status] == 'rejected') if !ShiftSale.current_shift(@shop.shop_code).nil? || params[:status] == 'accepted' || (order_reservation.status == 'new' && params[:status] == 'rejected')
@@ -105,6 +107,7 @@ class Origami::OrderReservationController < BaseOrigamiController
end end
def check_receipt_bill def check_receipt_bill
@shop = Shop.current_shop
receipt_bill = Lookup.where("shop_code='#{@shop.shop_code}'").collection_of("order_reservation") receipt_bill = Lookup.where("shop_code='#{@shop.shop_code}'").collection_of("order_reservation")
status = 0 status = 0

View File

@@ -1,5 +1,6 @@
class Origami::PendingOrderController < BaseOrigamiController class Origami::PendingOrderController < BaseOrigamiController
def index def index
@shop = Shop.current_shop
# @dining= DiningFacility.where("status = 'occupied'") # @dining= DiningFacility.where("status = 'occupied'")
# @order = Order.where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status = 'billed' and source = 'quick_service'",DateTime.now.strftime('%Y-%m-%d')) # @order = Order.where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status = 'billed' and source = 'quick_service'",DateTime.now.strftime('%Y-%m-%d'))
@cashier_type = params[:type] @cashier_type = params[:type]
@@ -13,6 +14,7 @@ class Origami::PendingOrderController < BaseOrigamiController
end end
def show def show
@shop = Shop.current_shop
id = params[:sale_id] id = params[:sale_id]
if id.start_with?("SAL") if id.start_with?("SAL")
@sale = Sale.find(id) @sale = Sale.find(id)
@@ -43,6 +45,7 @@ class Origami::PendingOrderController < BaseOrigamiController
end end
def completed_sale def completed_sale
@shop = Shop.current_shop
@cashier_type = params[:type] @cashier_type = params[:type]
@sales = Sale.pending_sale(@cashier_type) @sales = Sale.pending_sale(@cashier_type)
@orders = Sale.pending_order(@cashier_type) @orders = Sale.pending_order(@cashier_type)
@@ -78,6 +81,7 @@ class Origami::PendingOrderController < BaseOrigamiController
end end
def credit_sale def credit_sale
@shop = Shop.current_shop
@cashier_type = params[:type] @cashier_type = params[:type]
@sales = Sale.pending_sale(@cashier_type) @sales = Sale.pending_sale(@cashier_type)
@orders = Sale.pending_order(@cashier_type) @orders = Sale.pending_order(@cashier_type)

View File

@@ -8,6 +8,7 @@ class Origami::RequestBillsController < ApplicationController
end end
# Print Request Bill and add to sale tables # Print Request Bill and add to sale tables
def print def print
@shop = Shop.current_shop
if !ShiftSale.current_shift(@shop.shop_code).nil? if !ShiftSale.current_shift(@shop.shop_code).nil?
order_id = params[:id] # order_id order_id = params[:id] # order_id
order = Order.find(order_id) order = Order.find(order_id)

View File

@@ -13,6 +13,7 @@ class Origami::RoomsController < BaseOrigamiController
end end
def show def show
@shop = Shop.current_shop
@webview = false @webview = false
if check_mobile if check_mobile
@webview = true @webview = true

View File

@@ -42,6 +42,7 @@ class Origami::ShiftsController < BaseOrigamiController
def update_shift def update_shift
@shop = Shop.current_shop
closing_balance = params[:closing_balance] closing_balance = params[:closing_balance]
shift_id = params[:shift_id] shift_id = params[:shift_id]
@shift = ShiftSale.find_by_id(shift_id) @shift = ShiftSale.find_by_id(shift_id)

View File

@@ -84,6 +84,7 @@ class Origami::SplitBillController < BaseOrigamiController
end end
def create def create
@shop = Shop.current_shop
cashier_type = params[:cashier_type] cashier_type = params[:cashier_type]
order_ids = params[:order_ids] order_ids = params[:order_ids]
arr_order_ids = nil arr_order_ids = nil

View File

@@ -1,5 +1,6 @@
class Origami::SurveysController < BaseOrigamiController class Origami::SurveysController < BaseOrigamiController
def new def new
@shop = Shop.current_shop
@webview = false @webview = false
if check_mobile if check_mobile
@webview = true @webview = true
@@ -38,6 +39,7 @@ class Origami::SurveysController < BaseOrigamiController
end end
def create def create
@shop = Shop.current_shop
@type = params[:cashier_type] @type = params[:cashier_type]
@sale_id = params[:sale_id] @sale_id = params[:sale_id]
if params[:table_id].to_i>0 if params[:table_id].to_i>0

View File

@@ -2,7 +2,7 @@ class Origami::TableInvoicesController < BaseOrigamiController
def index def index
@table = DiningFacility.find(params[:table_id]) @table = DiningFacility.find(params[:table_id])
shop = Shop.current_shop @shop = Shop.current_shop
@sale_array = Array.new @sale_array = Array.new
@table.bookings.each do |booking| @table.bookings.each do |booking|
@@ -33,7 +33,7 @@ class Origami::TableInvoicesController < BaseOrigamiController
@membership = MembershipSetting::MembershipSetting @membership = MembershipSetting::MembershipSetting
@payment_methods = PaymentMethodSetting.all @payment_methods = PaymentMethodSetting.all
shop = Shop.current_shop @shop = Shop.current_shop
@sale_array = Array.new @sale_array = Array.new
@table.bookings.each do |booking| @table.bookings.each do |booking|
if booking.sale_id.nil? if booking.sale_id.nil?

View File

@@ -1,7 +1,7 @@
class Origami::VoidController < BaseOrigamiController class Origami::VoidController < BaseOrigamiController
authorize_resource :class => false authorize_resource :class => false
def overall_void def overall_void
@shop = Shop.current_shop
sale_id = params[:sale_id] sale_id = params[:sale_id]
remark = params[:remark] remark = params[:remark]
order_source = params[:type] #tax profile source order_source = params[:type] #tax profile source

View File

@@ -1,6 +1,6 @@
class Origami::WasteSpoileController < BaseOrigamiController class Origami::WasteSpoileController < BaseOrigamiController
def waste_and_spoilage def waste_and_spoilage
@shop = Shop.current_shop
sale_id = params[:sale_id] sale_id = params[:sale_id]
remark = params[:remark] remark = params[:remark]
order_source = params[:type] order_source = params[:type]

View File

@@ -2,6 +2,7 @@ class Reports::CommissionController < BaseReportController
# authorize_resource :class => false # authorize_resource :class => false
def index def index
@shop = Shop.current_shop
from_date, to_date = get_date_range_from_params from_date, to_date = get_date_range_from_params
commissioner = params[:commissioner].to_i commissioner = params[:commissioner].to_i
@@ -21,6 +22,7 @@ class Reports::CommissionController < BaseReportController
end end
def show def show
@shop = Shop.current_shop
from, to = get_date_range_from_params from, to = get_date_range_from_params
@sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'") @sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")

View File

@@ -1,6 +1,7 @@
class Reports::CreditPaymentController < BaseReportController class Reports::CreditPaymentController < BaseReportController
authorize_resource :class => false authorize_resource :class => false
def index def index
@shop = Shop.current_shop
@filter_for_credit = [['All',''],['Paid','paid'],['Unpaid','unpaid']] @filter_for_credit = [['All',''],['Paid','paid'],['Unpaid','unpaid']]
@sources = [["All",''], ["Cashier","cashier"],["Quick Service","quick_service"],["Online Order","doemal_order"]] @sources = [["All",''], ["Cashier","cashier"],["Quick Service","quick_service"],["Online Order","doemal_order"]]
from, to = get_date_range_from_params from, to = get_date_range_from_params
@@ -42,6 +43,7 @@ authorize_resource :class => false
end end
def show def show
@shop = Shop.current_shop
from, to = get_date_range_from_params from, to = get_date_range_from_params
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED) @sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)

View File

@@ -2,6 +2,7 @@ class Reports::DailysaleController < BaseReportController
authorize_resource :class => false authorize_resource :class => false
def index def index
@shop = Shop.current_shop
from, to = get_date_range_from_params from, to = get_date_range_from_params
@sale_data = Sale.daily_sales_list(from,to,@shop.shop_code) @sale_data = Sale.daily_sales_list(from,to,@shop.shop_code)
@tax = SaleTax.get_tax(from,to,@shop.shop_code) @tax = SaleTax.get_tax(from,to,@shop.shop_code)

View File

@@ -1,7 +1,7 @@
class Reports::HourlySaleitemController < BaseReportController class Reports::HourlySaleitemController < BaseReportController
authorize_resource :class => false authorize_resource :class => false
def index def index
@shop = Shop.current_shop
@account = Account.where("shop_code='#{@shop.shop_code}'") @account = Account.where("shop_code='#{@shop.shop_code}'")
from, to = get_date_range_from_params from, to = get_date_range_from_params
@@ -65,6 +65,7 @@ class Reports::HourlySaleitemController < BaseReportController
end end
def show def show
@shop = Shop.current_shop
from, to, report_type = get_date_range_from_params from, to, report_type = get_date_range_from_params
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED) @sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
sale_data = @sale_data sale_data = @sale_data

View File

@@ -1,6 +1,7 @@
class Reports::IndutyController < BaseReportController class Reports::IndutyController < BaseReportController
authorize_resource :class => false authorize_resource :class => false
def index def index
@shop = Shop.current_shop
@commissioners = Commissioner.where("shop_code='#{@shop.shop_code}'") #.where("is_active='1'") @commissioners = Commissioner.where("shop_code='#{@shop.shop_code}'") #.where("is_active='1'")
from, to = get_date_range_from_params from, to = get_date_range_from_params
@@ -41,6 +42,7 @@ class Reports::IndutyController < BaseReportController
end end
def show def show
@shop = Shop.current_shop
from, to = get_date_range_from_params from, to = get_date_range_from_params
@induty_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'") @induty_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")

View File

@@ -1,6 +1,7 @@
class Reports::OrderReservationController < BaseReportController class Reports::OrderReservationController < BaseReportController
# authorize_resource :class => false # authorize_resource :class => false
def index def index
@shop = Shop.current_shop
@providers = [["All",''], ["Direct Delivery","direct_delivery"],["Pick-Up","pick_up"],["TURBO","turbo"],["food2u","food2u"], ["ygndoor2door","ygndoor2door"]] @providers = [["All",''], ["Direct Delivery","direct_delivery"],["Pick-Up","pick_up"],["TURBO","turbo"],["food2u","food2u"], ["ygndoor2door","ygndoor2door"]]
@payment_types = [["All",''], ["COD","cash_on_delivery"],["DINGA","dinga"]] @payment_types = [["All",''], ["COD","cash_on_delivery"],["DINGA","dinga"]]
@@ -47,6 +48,7 @@ class Reports::OrderReservationController < BaseReportController
end end
def show def show
@shop = Shop.current_shop
from, to = get_date_range_from_params from, to = get_date_range_from_params
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'") @sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")

View File

@@ -1,7 +1,7 @@
class Reports::PaymentMethodController < BaseReportController class Reports::PaymentMethodController < BaseReportController
# authorize_resource :class => false # authorize_resource :class => false
def index def index
@shop = Shop.current_shop
@payments = [["All Payment",''],["Cash Payment","cash"], ["KBZ Payment", KbzPay::KBZ_PAY], ["Credit Payment","creditnote"], @payments = [["All Payment",''],["Cash Payment","cash"], ["KBZ Payment", KbzPay::KBZ_PAY], ["Credit Payment","creditnote"],
["FOC Payment","foc"], ["MPU Payment","mpu"], ["Visa Payment","visa"], ["FOC Payment","foc"], ["MPU Payment","mpu"], ["Visa Payment","visa"],
["Master Payment","master"], ["JCB Payment","jcb"],["UnionPay Payment","unionpay"], ["Master Payment","master"], ["JCB Payment","jcb"],["UnionPay Payment","unionpay"],
@@ -42,6 +42,7 @@ class Reports::PaymentMethodController < BaseReportController
end end
def show def show
@shop = Shop.current_shop
from, to = get_date_range_from_params from, to = get_date_range_from_params
@sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'") @sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")

View File

@@ -1,6 +1,7 @@
class Reports::ReceiptNoController < BaseReportController class Reports::ReceiptNoController < BaseReportController
authorize_resource :class => false authorize_resource :class => false
def index def index
@shop = Shop.current_shop
@payments = [["All Payment",''], ["Cash Payment","cash"], ["Credit Payment","creditnote"], ["FOC Payment","foc"]] @payments = [["All Payment",''], ["Cash Payment","cash"], ["Credit Payment","creditnote"], ["FOC Payment","foc"]]
@payment_method = PaymentMethodSetting.where("shop_code='#{@shop.shop_code}'") @payment_method = PaymentMethodSetting.where("shop_code='#{@shop.shop_code}'")
from, to = get_date_range_from_params from, to = get_date_range_from_params
@@ -53,6 +54,7 @@ authorize_resource :class => false
end end
def show def show
@shop = Shop.current_shop
from, to = get_date_range_from_params from, to = get_date_range_from_params
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'") @sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")
@@ -76,6 +78,7 @@ authorize_resource :class => false
end end
def sync_data def sync_data
@orders, @order_items, @sales, @sale_items, @sale_taxes, @sale_payments, @sale_orders, @sale_audits, @bookings, @assigned_order_items, @shift_sales = Booking.get_sync_data(params[:sale_id]) @orders, @order_items, @sales, @sale_items, @sale_taxes, @sale_payments, @sale_orders, @sale_audits, @bookings, @assigned_order_items, @shift_sales = Booking.get_sync_data(params[:sale_id])
# Here comes to call the sync api # Here comes to call the sync api

View File

@@ -1,6 +1,7 @@
class Reports::ReceiptNoDetailController < BaseReportController class Reports::ReceiptNoDetailController < BaseReportController
authorize_resource :class => false authorize_resource :class => false
def index def index
@shop = Shop.current_shop
@payments = [["All Payment",''], ["Cash Payment","cash"], ["Credit Payment","creditnote"], ["FOC Payment","foc"]] @payments = [["All Payment",''], ["Cash Payment","cash"], ["Credit Payment","creditnote"], ["FOC Payment","foc"]]
@payment_method = PaymentMethodSetting.where("shop_code='#{@shop.shop_code}'") @payment_method = PaymentMethodSetting.where("shop_code='#{@shop.shop_code}'")
from, to = get_date_range_from_params from, to = get_date_range_from_params
@@ -48,6 +49,7 @@ authorize_resource :class => false
end end
def show def show
@shop = Shop.current_shop
from, to = get_date_range_from_params from, to = get_date_range_from_params
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'") @sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")

View File

@@ -1,7 +1,7 @@
class Reports::SaleitemController < BaseReportController class Reports::SaleitemController < BaseReportController
authorize_resource :class => false authorize_resource :class => false
def index def index
@shop = Shop.current_shop
@account = Account.where("shop_code='#{@shop.shop_code}'") @account = Account.where("shop_code='#{@shop.shop_code}'")
from, to = get_date_range_from_params from, to = get_date_range_from_params
@@ -60,6 +60,7 @@ class Reports::SaleitemController < BaseReportController
end end
def show def show
@shop = Shop.current_shop
from, to, report_type = get_date_range_from_params from, to, report_type = get_date_range_from_params
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'") @sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")
@@ -85,6 +86,7 @@ class Reports::SaleitemController < BaseReportController
end end
def print_sale_items def print_sale_items
@shop = Shop.current_shop
from, to = get_date_range_from_params from, to = get_date_range_from_params
shift_sale_range = '' shift_sale_range = ''

View File

@@ -2,7 +2,7 @@ class Reports::ShiftsaleController < BaseReportController
authorize_resource :class => false authorize_resource :class => false
def index def index
@shop = Shop.current_shop
from, to = get_date_range_from_params from, to = get_date_range_from_params
@shift = '' @shift = ''
if params[:shift_name].to_i != 0 if params[:shift_name].to_i != 0
@@ -26,6 +26,7 @@ class Reports::ShiftsaleController < BaseReportController
end end
def show def show
@shop = Shop.current_shop
from, to = get_date_range_from_params from, to = get_date_range_from_params
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'") @sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")
@@ -49,6 +50,7 @@ class Reports::ShiftsaleController < BaseReportController
end end
def print_close_receipt def print_close_receipt
@shop = Shop.current_shop
shift_id = params[:id] shift_id = params[:id]
@shift = ShiftSale.find_by_id(shift_id) @shift = ShiftSale.find_by_id(shift_id)
shift_obj = ShiftSale.where('id =?',shift_id) shift_obj = ShiftSale.where('id =?',shift_id)

View File

@@ -1,7 +1,7 @@
class Reports::StaffMealController < BaseReportController class Reports::StaffMealController < BaseReportController
authorize_resource :class => false authorize_resource :class => false
def index def index
@shop = Shop.current_shop
@account = Account.where("shop_code='#{@shop.shop_code}'") @account = Account.where("shop_code='#{@shop.shop_code}'")
from, to = get_date_range_from_params from, to = get_date_range_from_params

View File

@@ -2,6 +2,7 @@ class Reports::StockCheckController < BaseReportController
# authorize_resource :class => false # authorize_resource :class => false
def index def index
@shop = Shop.current_shop
# from_date = DateTime.now.beginning_of_day.utc.getlocal # from_date = DateTime.now.beginning_of_day.utc.getlocal
# to_date = DateTime.now.end_of_day.utc.getlocal # to_date = DateTime.now.end_of_day.utc.getlocal
# unless params[:daterange].blank? # unless params[:daterange].blank?
@@ -25,6 +26,7 @@ class Reports::StockCheckController < BaseReportController
end end
def show def show
@shop = Shop.current_shop
from, to = get_date_range_from_params from, to = get_date_range_from_params
@sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'") @sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")

View File

@@ -1,7 +1,7 @@
class Reports::VoidSaleController < BaseReportController class Reports::VoidSaleController < BaseReportController
authorize_resource :class => false authorize_resource :class => false
def index def index
@shop = Shop.current_shop
from, to = get_date_range_from_params from, to = get_date_range_from_params
# @shift_sale_range = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED) # @shift_sale_range = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED)
@@ -9,10 +9,10 @@ authorize_resource :class => false
if params[:shift_name].to_i != 0 if params[:shift_name].to_i != 0
shift_sale = ShiftSale.find(params[:shift_name]) shift_sale = ShiftSale.find(params[:shift_name])
if to.blank? if to.blank?
@shift = ShiftSale.where("shift_started_at = ? and shift_closed_at is NULL and shop_code='#@shop.shop_code' ",shift_sale.shift_started_at) @shift = ShiftSale.where("shift_started_at = ? and shift_closed_at is NULL and shop_code='#{@shop.shop_code}' ",shift_sale.shift_started_at)
else else
@shift = ShiftSale.where("shift_started_at = ? and shift_closed_at = ? and shop_code='#@shop.shop_code' ",shift_sale.shift_started_at, shift_sale.shift_closed_at) @shift = ShiftSale.where("shift_started_at = ? and shift_closed_at = ? and shop_code='#{@shop.shop_code}' ",shift_sale.shift_started_at, shift_sale.shift_closed_at)
end end
end end

View File

@@ -1,6 +1,7 @@
class Reports::WasteAndSpoilageController < BaseReportController class Reports::WasteAndSpoilageController < BaseReportController
authorize_resource :class => false authorize_resource :class => false
def index def index
@shop = Shop.current_shop
from, to = get_date_range_from_params from, to = get_date_range_from_params
@sale_type = params[:sale_type] @sale_type = params[:sale_type]
@sale_data = Sale.get_wastes_and_spoilages(from,to,@sale_type).where("sales.shop_code='#{@shop.shop_code}'") @sale_data = Sale.get_wastes_and_spoilages(from,to,@sale_type).where("sales.shop_code='#{@shop.shop_code}'")

View File

@@ -5,6 +5,7 @@ class Settings::AccountsController < ApplicationController
# GET /settings/accounts # GET /settings/accounts
# GET /settings/accounts.json # GET /settings/accounts.json
def index def index
@shop = Shop.current_shop
@settings_accounts = Account.all.where("shop_code='#{@shop.shop_code}'") @settings_accounts = Account.all.where("shop_code='#{@shop.shop_code}'")
end end
@@ -25,6 +26,7 @@ class Settings::AccountsController < ApplicationController
# POST /settings/accounts # POST /settings/accounts
# POST /settings/accounts.json # POST /settings/accounts.json
def create def create
@shop = Shop.current_shop
@settings_account = Account.new(account_params) @settings_account = Account.new(account_params)
@settings_account.shop_code = @shop.shop_code @settings_account.shop_code = @shop.shop_code
respond_to do |format| respond_to do |format|

View File

@@ -27,6 +27,7 @@ class Settings::CashierTerminalsController < ApplicationController
# POST /settings/cashier_terminals # POST /settings/cashier_terminals
# POST /settings/cashier_terminals.json # POST /settings/cashier_terminals.json
def create def create
@shop = Shop.current_shop
@settings_cashier_terminal = CashierTerminal.new(settings_cashier_terminal_params) @settings_cashier_terminal = CashierTerminal.new(settings_cashier_terminal_params)
@settings_cashier_terminal.shop_code = @shop.shop_code @settings_cashier_terminal.shop_code = @shop.shop_code
respond_to do |format| respond_to do |format|

View File

@@ -28,6 +28,7 @@ class Settings::CommissionersController < ApplicationController
# POST /commissioners # POST /commissioners
# POST /commissioners.json # POST /commissioners.json
def create def create
@shop = Shop.current_shop
@commissioner = Commissioner.new(commissioner_params) @commissioner = Commissioner.new(commissioner_params)
@commissioner.created_by = current_user.id @commissioner.created_by = current_user.id
@commissioner.shop_code = @shop.shop_code @commissioner.shop_code = @shop.shop_code

View File

@@ -28,6 +28,7 @@ class Settings::CommissionsController < ApplicationController
# POST /commissions # POST /commissions
# POST /commissions.json # POST /commissions.json
def create def create
@shop = Shop.current_shop
@commission = Commission.new(commission_params) @commission = Commission.new(commission_params)
@commission.product_type = 'menu_item' @commission.product_type = 'menu_item'
@commission.product_code = "[]" @commission.product_code = "[]"

View File

@@ -25,6 +25,7 @@ class Settings::MembershipActionsController < ApplicationController
# POST /settings/membership_actions # POST /settings/membership_actions
# POST /settings/membership_actions.json # POST /settings/membership_actions.json
def create def create
@shop = Shop.current_shop
@settings_membership_action = MembershipAction.new(settings_membership_action_params) @settings_membership_action = MembershipAction.new(settings_membership_action_params)
@settings_membership_action.shop_code = @shop.shop_code @settings_membership_action.shop_code = @shop.shop_code
respond_to do |format| respond_to do |format|

View File

@@ -25,6 +25,7 @@ class Settings::MembershipSettingsController < ApplicationController
# POST /settings/membership_settings # POST /settings/membership_settings
# POST /settings/membership_settings.json # POST /settings/membership_settings.json
def create def create
@shop = Shop.current_shop
@settings_membership_setting = MembershipSetting.new(settings_membership_setting_params) @settings_membership_setting = MembershipSetting.new(settings_membership_setting_params)
@settings_membership_setting.shop_code = @shop.shop_code @settings_membership_setting.shop_code = @shop.shop_code
respond_to do |format| respond_to do |format|

View File

@@ -5,6 +5,7 @@ class Settings::MenusController < ApplicationController
# GET /settings/menus # GET /settings/menus
# GET /settings/menus.json # GET /settings/menus.json
def index def index
@shop = Shop.current_shop
@settings_menus = Menu.all.where("shop_code='#{@shop.shop_code}'").page(params[:page]).per(10) @settings_menus = Menu.all.where("shop_code='#{@shop.shop_code}'").page(params[:page]).per(10)
respond_to do |format| respond_to do |format|
format.html format.html
@@ -30,6 +31,7 @@ class Settings::MenusController < ApplicationController
# POST /settings/menus # POST /settings/menus
# POST /settings/menus.json # POST /settings/menus.json
def create def create
@shop = Shop.current_shop
@settings_menu = Menu.new(settings_menu_params) @settings_menu = Menu.new(settings_menu_params)
@settings_menu.created_by = current_login_employee.name @settings_menu.created_by = current_login_employee.name
@settings_menu.shop_code = @shop.shop_code @settings_menu.shop_code = @shop.shop_code
@@ -74,6 +76,7 @@ class Settings::MenusController < ApplicationController
end end
def export def export
@shop = Shop.current_shop
@settings_menus = Menu.all.where("shop_code='#{@shop.shop_code}'").page(params[:page]).per(10) @settings_menus = Menu.all.where("shop_code='#{@shop.shop_code}'").page(params[:page]).per(10)
menu = Menu.find(params[:id]) menu = Menu.find(params[:id])

View File

@@ -29,6 +29,7 @@ class Settings::OrderQueueStationsController < ApplicationController
# POST /settings/order_queue_stations # POST /settings/order_queue_stations
# POST /settings/order_queue_stations.json # POST /settings/order_queue_stations.json
def create def create
@shop = Shop.current_shop
@settings_order_queue_station = OrderQueueStation.new(settings_order_queue_station_params) @settings_order_queue_station = OrderQueueStation.new(settings_order_queue_station_params)
@settings_order_queue_station.created_by = current_login_employee.name @settings_order_queue_station.created_by = current_login_employee.name
@settings_order_queue_station.processing_items = "[]" @settings_order_queue_station.processing_items = "[]"

View File

@@ -26,7 +26,7 @@ load_and_authorize_resource except: [:create]
# POST /settings/products # POST /settings/products
# POST /settings/products.json # POST /settings/products.json
def create def create
@shop = Shop.current_shop
@settings_product = Product.new(settings_product_params) @settings_product = Product.new(settings_product_params)
@settings_product.created_by = current_user.name @settings_product.created_by = current_user.name
@settings_product.shop_code = @shop.shop_code @settings_product.shop_code = @shop.shop_code

View File

@@ -28,6 +28,7 @@ class Settings::PromotionsController < ApplicationController
# POST /promotions # POST /promotions
# POST /promotions.json # POST /promotions.json
def create def create
@shop = Shop.current_shop
@promotion = Promotion.new(promotion_params) @promotion = Promotion.new(promotion_params)
@promotion.created_by = current_login_employee.id @promotion.created_by = current_login_employee.id
@promotion.shop_code = @shop.shop_code @promotion.shop_code = @shop.shop_code

View File

@@ -25,6 +25,7 @@ class Settings::RoomsController < ApplicationController
# POST /settings/rooms # POST /settings/rooms
# POST /settings/rooms.json # POST /settings/rooms.json
def create def create
@shop = Shop.current_shop
@settings_room = Room.new(settings_room_params) @settings_room = Room.new(settings_room_params)
@settings_room.type = DiningFacility::ROOM_TYPE @settings_room.type = DiningFacility::ROOM_TYPE
@settings_room.zone_id = params[:zone_id] @settings_room.zone_id = params[:zone_id]

View File

@@ -25,6 +25,7 @@ class Settings::TablesController < ApplicationController
# POST /settings/tables # POST /settings/tables
# POST /settings/tables.json # POST /settings/tables.json
def create def create
@shop = Shop.current_shop
@settings_table = Table.new(settings_table_params) @settings_table = Table.new(settings_table_params)
@settings_table.type = DiningFacility::TABLE_TYPE @settings_table.type = DiningFacility::TABLE_TYPE
@settings_table.zone_id = params[:zone_id] @settings_table.zone_id = params[:zone_id]

View File

@@ -45,6 +45,7 @@ class Settings::TaxProfilesController < ApplicationController
# POST /settings/tax_profiles # POST /settings/tax_profiles
# POST /settings/tax_profiles.json # POST /settings/tax_profiles.json
def create def create
@shop = Shop.current_shop
@settings_tax_profile = TaxProfile.new(settings_tax_profile_params) @settings_tax_profile = TaxProfile.new(settings_tax_profile_params)
@settings_tax_profile.created_by = current_login_employee.name @settings_tax_profile.created_by = current_login_employee.name
@settings_tax_profile.shop_code = @shop.shop_code @settings_tax_profile.shop_code = @shop.shop_code

View File

@@ -5,6 +5,7 @@ class Settings::ZonesController < ApplicationController
# GET /settings/zones # GET /settings/zones
# GET /settings/zones.json # GET /settings/zones.json
def index def index
@shop = Shop.current_shop
@settings_zones = Zone.all.where("shop_code='#{@shop.shop_code}' and is_active= true") @settings_zones = Zone.all.where("shop_code='#{@shop.shop_code}' and is_active= true")
end end
@@ -27,6 +28,7 @@ class Settings::ZonesController < ApplicationController
# POST /settings/zones # POST /settings/zones
# POST /settings/zones.json # POST /settings/zones.json
def create def create
@shop = Shop.current_shop
@settings_zone = Zone.new(settings_zone_params) @settings_zone = Zone.new(settings_zone_params)
@settings_zone.shop_code =@shop.shop_code @settings_zone.shop_code =@shop.shop_code
@settings_zone.created_by = current_login_employee.name @settings_zone.created_by = current_login_employee.name

View File

@@ -6,6 +6,7 @@ class Transactions::CreditNotesController < ApplicationController
# GET /transactions/sales # GET /transactions/sales
# GET /transactions/sales.json # GET /transactions/sales.json
def index def index
@shop = Shop.current_shop
@sources = [["All",''], ["Cashier","cashier"],["Quick Service","quick_service"],["Online Order","doemal_order"]] @sources = [["All",''], ["Cashier","cashier"],["Quick Service","quick_service"],["Online Order","doemal_order"]]
@customers = Customer.all @customers = Customer.all

View File

@@ -6,6 +6,7 @@ class Transactions::OrderReservationsController < ApplicationController
# GET /transactions/order_reservations # GET /transactions/order_reservations
# GET /transactions/order_reservations.json # GET /transactions/order_reservations.json
def index def index
@shop = Shop.current_shop
from, to = get_date_range_from_params from, to = get_date_range_from_params
filter = params[:filter] filter = params[:filter]

View File

@@ -3,7 +3,7 @@ class Transactions::OrdersController < ApplicationController
before_action :check_user before_action :check_user
def index def index
@shop = Shop.current_shop
filter = params[:filter] filter = params[:filter]
from = params[:from] from = params[:from]
to = params[:to] to = params[:to]

View File

@@ -4,6 +4,7 @@ class Transactions::ShiftSalesController < ApplicationController
before_action :check_user before_action :check_user
def index def index
@shop = Shop.current_shop
filter = params[:filter] filter = params[:filter]
from = params[:from] from = params[:from]
@@ -32,7 +33,7 @@ class Transactions::ShiftSalesController < ApplicationController
# GET /transactions/shift_sales/1 # GET /transactions/shift_sales/1
# GET /transactions/shift_sales/1.json # GET /transactions/shift_sales/1.json
def show def show
@shop = Shop.current_shop
@shift = ShiftSale.find(params[:id]) @shift = ShiftSale.find(params[:id])
#get tax #get tax

View File

@@ -1,5 +1,6 @@
class Transactions::SurveysController < ApplicationController class Transactions::SurveysController < ApplicationController
def index def index
@shop = Shop.current_shop
filter = params[:filter] filter = params[:filter]
from = params[:from] from = params[:from]
to = params[:to] to = params[:to]

View File

@@ -957,14 +957,14 @@ class SalePayment < ApplicationRecord
#credit payment query #credit payment query
def self.get_credit_sales(params) def self.get_credit_sales(params,shop_code)
payments = SalePayment.select("sale_payments.sale_id, sale_payments.sale_payment_id, sale_payments.payment_method, sale_payments.payment_amount") payments = SalePayment.select("sale_payments.sale_id, sale_payments.sale_payment_id, sale_payments.payment_method, sale_payments.payment_amount")
.select("SUM(sale_payments.payment_amount) OVER (PARTITION BY sale_payments.sale_id) total_payment_amount") .select("SUM(sale_payments.payment_amount) OVER (PARTITION BY sale_payments.sale_id) total_payment_amount")
credit_sales = Sale.select("sales.sale_id, sales.receipt_no, sales.receipt_date as sale_date, sales.cashier_name") credit_sales = Sale.select("sales.sale_id, sales.receipt_no, sales.receipt_date as sale_date, sales.cashier_name")
.select("sale_payments.sale_payment_id, sale_payments.payment_amount").select("customers.name as customer_name") .select("sale_payments.sale_payment_id, sale_payments.payment_amount").select("customers.name as customer_name")
.joins("JOIN (#{payments.to_sql}) AS sale_payments ON sale_payments.sale_id = sales.sale_id").joins(:customer).joins(:orders) .joins("JOIN (#{payments.to_sql}) AS sale_payments ON sale_payments.sale_id = sales.sale_id").joins(:customer).joins(:orders)
.completed.paid.where("sale_payments.payment_method = 'creditnote' AND sales.grand_total > sale_payments.total_payment_amount - sale_payments.payment_amount") .completed.paid.where("sale_payments.payment_method = 'creditnote' AND sales.grand_total > sale_payments.total_payment_amount - sale_payments.payment_amount and sales.shop_code=?",shop_code)
.group(:receipt_no) .group(:receipt_no)
.order(:receipt_date).order(:receipt_no) .order(:receipt_date).order(:receipt_no)