diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb
index a601e4b8..fb42bfee 100644
--- a/app/controllers/home_controller.rb
+++ b/app/controllers/home_controller.rb
@@ -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
diff --git a/app/controllers/oqs/home_controller.rb b/app/controllers/oqs/home_controller.rb
index 28645a74..c79c971c 100644
--- a/app/controllers/oqs/home_controller.rb
+++ b/app/controllers/oqs/home_controller.rb
@@ -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")
diff --git a/app/controllers/origami/customers_controller.rb b/app/controllers/origami/customers_controller.rb
index 203e5600..26e3c74b 100644
--- a/app/controllers/origami/customers_controller.rb
+++ b/app/controllers/origami/customers_controller.rb
@@ -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
diff --git a/app/controllers/origami/other_charges_controller.rb b/app/controllers/origami/other_charges_controller.rb
index bb0d9e42..b0e6472c 100644
--- a/app/controllers/origami/other_charges_controller.rb
+++ b/app/controllers/origami/other_charges_controller.rb
@@ -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
diff --git a/app/views/crm/customers/index.html.erb b/app/views/crm/customers/index.html.erb
index a73fd08f..71b90b1b 100644
--- a/app/views/crm/customers/index.html.erb
+++ b/app/views/crm/customers/index.html.erb
@@ -23,15 +23,15 @@
|
<%= form_tag crm_customers_path, :id => "filter_form", :method => :get do %>
- |
@@ -102,13 +102,11 @@ $(function() {
var cardNo = "";
$("#sxModal").show();
setTimeout(function(){
- getCardNo;
- $("#sxModal").hide();
- },5000);
-alert($("#search").val());
- $("#filter_form").submit();
+ getCardNo();
+ $("#sxModal").hide();
+ $("#filter_form").submit();
+ },100);
});
-
});
$(document).on('click',".customer_tr",function(){
diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb
index fd951d6c..2a0684a1 100644
--- a/app/views/layouts/_header.html.erb
+++ b/app/views/layouts/_header.html.erb
@@ -45,6 +45,8 @@
<%= link_to "Shift Sale Report", reports_shiftsale_index_path, :tabindex =>"-1" %>
+
+ CRM
diff --git a/app/views/origami/customers/index.html.erb b/app/views/origami/customers/index.html.erb
index a9079efe..b11488b4 100644
--- a/app/views/origami/customers/index.html.erb
+++ b/app/views/origami/customers/index.html.erb
@@ -12,20 +12,20 @@
-
+
|
<% path ="/origami/#{@sale_id}/customers" %>
- <%= form_tag path, :method => :get do %>
- |
@@ -94,8 +94,7 @@
@@ -224,6 +223,23 @@
$("#sxModal").hide();
},100);
});
+
+ // Read Card Reader
+ $("#member_acc_no").on('click', function(e){
+ var cardNo = "";
+ var sale_id = $("#sale_id").val() || 0;
+ var customer_mamber_card_no = 0;
+ $("#sxModal").show();
+ setTimeout(function(){
+ getCardNo();
+ $("#sxModal").hide();
+ customer_mamber_card_no = $("#search").val();
+
+ if(sale_id != 0 && customer_mamber_card_no != 0){
+ update_sale(customer_mamber_card_no,sale_id);
+ }
+ },100);
+ });
});
@@ -236,6 +252,7 @@
function setCardNo(cardNo){
if(cardNo.length == 16){
$("#paypar_account_no").val(cardNo);
+ $("#search").val(cardNo);
}
}
@@ -253,6 +270,7 @@
var url = "customers/"+customer_id;
}
+ // Need To Clean?
$.ajax({
type: "GET",
url: url,
diff --git a/app/views/origami/home/index.html.erb b/app/views/origami/home/index.html.erb
index 3afea88d..77d85f10 100644
--- a/app/views/origami/home/index.html.erb
+++ b/app/views/origami/home/index.html.erb
@@ -107,7 +107,8 @@
-
+
+
diff --git a/dump.rdb b/dump.rdb
index 915b2462..2747d973 100644
Binary files a/dump.rdb and b/dump.rdb differ