This commit is contained in:
Yan
2017-07-18 16:06:36 +06:30
parent c068d702b3
commit a5546920b6
9 changed files with 54 additions and 24 deletions

View File

@@ -85,7 +85,7 @@ class HomeController < ApplicationController
if !shift.nil?
redirect_to origami_root_path
else
redirect_to crm_customers_path
redirect_to dashboard_path
end
elsif employee.role == "cashier"
#check if cashier has existing open cashier

View File

@@ -112,7 +112,7 @@ class Oqs::HomeController < BaseOqsController
left join booking_orders as bo on bo.order_id = assigned_order_items.order_id
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 = true AND odt.price <> 0 AND assigned_order_items.created_at <= ?", Time.now.end_of_day.utc)
.where("assigned_order_items.delivery_status = true AND odt.price <> 0 AND assigned_order_items.created_at between #{Time.now.beginning_of_day.utc} and #{Time.now.end_of_day.utc}")
.group("assigned_order_items.order_id")

View File

@@ -50,12 +50,22 @@ class Origami::CustomersController < BaseOrigamiController
def update_sale_by_customer
id = params[:sale_id][0,3]
customer_id = params[:customer_id]
# Check and find with card no
if(!customer_id.include? "CUS")
customer = Customer.find_by_paypar_account_no(customer_id)
if(customer != nil)
customer_id = customer.customer_id
end
end
if(id == "SAL")
sale = Sale.find(params[:sale_id])
status = sale.update_attributes(customer_id: params[:customer_id])
status = sale.update_attributes(customer_id: 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])
status = order.update_attributes(customer_id: customer_id)
end
else
@booking = BookingOrder.find_by_order_id(params[:sale_id])
@@ -63,7 +73,7 @@ class Origami::CustomersController < BaseOrigamiController
@orders.each do |bo|
order = Order.find(bo.order_id)
status = order.update_attributes(customer_id: params[:customer_id])
status = order.update_attributes(customer_id: customer_id)
end
end

View File

@@ -37,6 +37,7 @@ class Origami::OtherChargesController < BaseOrigamiController
sale_item.unit_price = di["price"]
sale_item.taxable_price = 0
sale_item.is_taxable = 0
sale_item.account_id = 0
sale_item.price = di["price"]
sale_item.save