merge with master

This commit is contained in:
Yan
2017-12-15 10:36:43 +06:30
30 changed files with 218 additions and 99 deletions

View File

@@ -5,8 +5,12 @@ class Api::CheckInProcessController < Api::ApiController
dining_facility = DiningFacility.find(params[:dining_id])
booking = dining_facility.get_current_checkout_booking
if !booking.nil?
DiningFacility.check_in_booking(params[:dining_id])
check_in_time = booking.checkin_at.utc.getlocal.strftime("%Y-%m-%d %H:%M")
check_out_time = booking.checkout_at.utc.getlocal.strftime("%Y-%m-%d %H:%M")
render :json => { :status => true, :check_in_time => check_in_time, :check_out_time => check_out_time }
else
render :json => { :status => false, :error_message => "No current booking!" }
@@ -18,20 +22,16 @@ class Api::CheckInProcessController < Api::ApiController
if params[:dining_id]
dining_facility = DiningFacility.find(params[:dining_id])
if dining_facility.status == "available"
dining_charge = DiningCharge.select('charge_type','charge_block')
.where('dining_facility_id = ?',params[:dining_id])
.first()
lookup_checkout_time = Lookup.collection_of("checkout_time")
checkout_at = Time.now.utc
if !dining_charge.nil?
hr = (dining_charge.charge_block.utc.strftime("%H").to_i).to_int
min = (dining_charge.charge_block.utc.strftime("%M").to_i).to_int
# if dining_charge.charge_type == 'hr'
checkout_at = checkout_at + hr.hour + min.minutes
# else
# end
if !lookup_checkout_time.nil?
if lookup_checkout_time[0][0] == 'hr'
checkout_at = checkout_at + (lookup_checkout_time[0][1]).to_i.hour
else
checkout_at = checkout_at + (lookup_checkout_time[0][1]).to_i.minutes
end
end
dining_facility.status = "occupied"

View File

@@ -23,7 +23,6 @@ class ApplicationController < ActionController::Base
end
def lookup_domain
if request.subdomain.present? && request.subdomain != "www"
from = request.subdomain.downcase + "." + request.domain.downcase
@license = cache_license(ENV["SX_PROVISION_URL"], from) # request.subdomain.downcase

View File

@@ -2,7 +2,7 @@ class BaseOrigamiController < ActionController::Base
include LoginVerification
layout "origami"
before_action :checkin_process
# before_action :checkin_process
#before_action :check_installation
protect_from_forgery with: :exception
@@ -15,7 +15,7 @@ class BaseOrigamiController < ActionController::Base
@current_user ||= Employee.find_by_token_session(session[:session_token]) if session[:session_token]
end
def checkin_process
CheckinJob.set(wait: 1.minute).perform_later()
end
# def checkin_process
# CheckinJob.set(wait: 1.minute).perform_later()
# end
end

View File

@@ -72,7 +72,8 @@ class HomeController < ApplicationController
@hourly_sales = Sale.hourly_sales(today).sum(:grand_total)
# .group_by_hour(:created_at, :time_zone => 'Asia/Rangoon',format: '%I:%p')
# .sum(:grand_total)
@employee_sales = Sale.employee_sales(today).sum('payment_amount')
@employee_sales = Sale.employee_sales(today)
.sum('(CASE WHEN sp.payment_method="cash" THEN (sp.payment_amount - sales.amount_changed) ELSE sp.payment_amount END)')
@inventories = StockJournal.inventory_balances(today).sum(:balance)
@total_sale = Sale.total_sale(today)

View File

@@ -1,20 +1,15 @@
class Origami::CheckInProcessController < BaseOrigamiController
def check_in_process
dining_charge = DiningCharge.select('charge_type','charge_block')
.where('dining_facility_id = ?',params[:dining_id])
.first()
lookup_checkout_time = Lookup.collection_of("checkout_time")
checkout_at = Time.now.utc
if !dining_charge.nil?
hr = (dining_charge.charge_block.utc.strftime("%H").to_i).to_int
min = (dining_charge.charge_block.utc.strftime("%M").to_i).to_int
# if dining_charge.charge_type == 'hr'
checkout_at = checkout_at + hr.hour + min.minutes
# else
# end
if !lookup_checkout_time.nil?
if lookup_checkout_time[0][0] == 'hr'
checkout_at = checkout_at + (lookup_checkout_time[0][1]).to_i.hour
else
checkout_at = checkout_at + (lookup_checkout_time[0][1]).to_i.minutes
end
end
@dining_facility = DiningFacility.find(params[:dining_id])
@dining_facility.status = "occupied"

View File

@@ -44,7 +44,7 @@ class Origami::PaymentsController < BaseOrigamiController
# printer = Printer::ReceiptPrinter.new(print_settings)
# printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,sale_data,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, shop_details, "Frt")
# printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,sale_data,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, shop_details, "Frt")
end
def create
@@ -264,8 +264,13 @@ class Origami::PaymentsController < BaseOrigamiController
# 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)
<<<<<<< HEAD
# printer = Printer::ReceiptPrinter.new(print_settings)
# printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "FOC")
=======
printer = Printer::ReceiptPrinter.new(print_settings)
printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "FOC",nil)
>>>>>>> master
end
end

View File

@@ -5,6 +5,10 @@ class Origami::SalesController < BaseOrigamiController
@complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
@orders = Order.all.order('date desc')
@sale = Sale.find(params[:sale_id])
@order = SaleOrder.find_by_sale_id(@sale.sale_id).order_id
@booking = BookingOrder.find_by_order_id(@order).booking_id
@table_id = Booking.find(@booking).dining_facility_id
@dining = DiningFacility.find(@table_id)
end
def add_to_existing_invoice

View File

@@ -18,7 +18,7 @@ class Reports::SaleitemController < BaseReportController
@sale_data, @other_charges,@discount_data , @cash_data , @card_data , @credit_data , @foc_data , @grand_total , @change_amount = Sale.get_by_shift_items(shift_sale_range,shift, from, to, Sale::SALE_STATUS_COMPLETED)
@sale_taxes = Sale.get_separate_tax(shift_sale_range,shift,from,to,nil)
puts @sale_data.to_json
@account_cate_count = Hash.new {|hash, key| hash[key] = 0}