Merge branch 'r-1902001-01' into foodcourt

This commit is contained in:
Thein Lin Kyaw
2020-09-10 10:31:07 +06:30
184 changed files with 2672 additions and 1021 deletions

View File

@@ -36,7 +36,7 @@ private
crm_root_path
elsif current_user.role == "account"
reports_dailysale_index_path
elsif @current_user.role == "kitchen"
elsif current_user.role == "kitchen"
oqs_root_path
elsif @current_user.role == "foodcourt_cashier"
#check if cashier has existing open cashier

View File

@@ -31,47 +31,40 @@ class Origami::HomeController < BaseOrigamiController
@status_order = ""
@status_sale = ""
@sale_array = Array.new
@shop = current_shop
@membership = MembershipSetting::MembershipSetting
@payment_methods = PaymentMethodSetting.all
@order_items = Array.new
@dining.current_bookings.each do |booking|
if @obj_sale || @booking.blank?
@booking = booking
end
@sale_array = @dining.current_sales
if (booking = @dining.current_checkin_booking)
@booking = booking
@order_items = booking.order_items
@obj_order = booking.orders.first
end
if booking.sale_id
@sale_array.push(booking.sale)
if (booking = @dining.current_checkout_booking)
@booking = booking
@obj_sale = booking.sale
@sale_taxes = @obj_sale.sale_taxes
@status_sale = 'sale'
end
if @obj_sale.blank?
@obj_sale = booking.sale
@sale_taxes = @obj_sale.sale_taxes
@status_sale = 'sale'
end
else
@order_items += booking.order_items
@obj_order = booking.orders.first
if @obj_sale || @customer.blank?
if obj = @obj_sale || @obj_order
@customer = obj.customer
@date = obj.created_at
end
end
if @obj_sale || @customer.blank?
if obj = @obj_sale || @obj_order
@customer = obj.customer
@date = obj.created_at
end
end
if @obj_sale
@status_order = 'sale'
elsif @obj_order
@status_order = 'order'
end
if @obj_sale
@status_order = 'sale'
else
@status_order = 'order'
end
if (@obj_sale || @account_arr.blank?) && @customer
@account_arr = TaxProfile.find_by(id: @customer.tax_profiles)
end
if (@obj_sale || @account_arr.blank?) && @customer
@account_arr = TaxProfile.find_by(id: @customer.tax_profiles)
end
#for bank integration

View File

@@ -610,7 +610,7 @@ class Origami::PaymentsController < BaseOrigamiController
end
# get printer info
print_settings = PrintSetting.find_by_unique_code(unique_code)
# print_settings = PrintSetting.find_by_unique_code(unique_code)
printer = Printer::ReceiptPrinter.new(print_settings)
printer.print_receipt_pdf(filename,receipt_no,print_settings.print_copies,printer_name)

View File

@@ -0,0 +1,58 @@
class Reports::CustomerController < BaseReportController
authorize_resource :class => false
def index
@membership_type = Lookup.where(lookup_type: 'membership_type')
from, to = get_date_range_from_params
customer_filter = params[:customer]
@shift_sale_range = ''
@shift = ''
if params[:shift_name].to_i != 0
@shift_sale_range = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
@shift_sale = ShiftSale.find(params[:shift_name])
if to.blank?
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL ',@shift_sale.shift_started_at)
else
if @shift_sale.shift_closed_at.blank?
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL',@shift_sale.shift_started_at)
else
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at = ? ',@shift_sale.shift_started_at, @shift_sale.shift_closed_at)
end
end
end
@lookup = Lookup.find_by_lookup_type('reprint_receipt')
if @lookup.nil?
@lookup = Lookup.create_reprint_receipt_lookup
end
if params[:membership_type] == "0"
membership_type = ''
else
membership_type = params[:membership_type]
end
@sale_data = Sale.get_shift_sales_by_customer(@shift_sale_range, @shift, from, to, membership_type, customer_filter)
@sale_taxes = Sale.get_separate_tax(@shift_sale_range, @shift, from, to, nil)
@tax_profiles = TaxProfile.group('name').order('order_by asc') #.limit(2)
@from = from
@to = to
# get printer info
@print_settings = PrintSetting.get_precision_delimiter()
if @shift.present?
@shift.each do |sh|
@shift_from = sh.shift_started_at.nil? ? '-' : sh.shift_started_at.utc.getlocal.strftime("%e %b %I:%M%p")
@shift_to = sh.shift_closed_at.nil? ? '-' : sh.shift_closed_at.utc.getlocal.strftime("%e %b %I:%M%p")
@shift_data = sh
end
end
respond_to do |format|
format.html
format.xls
end
end
end