merge with crm

This commit is contained in:
Yan
2017-07-01 11:13:34 +06:30
5 changed files with 80 additions and 38 deletions

View File

@@ -34,7 +34,7 @@ class BaseReportController < ActionController::Base
to = params[:to]
day_ref = Time.now.utc.getlocal
if params[:report_type] == "daily_sale"
if params[:report_type] == "daily_sale" || params[:report_type] == "sale_item"
if from != "" && to != ""
@@ -86,9 +86,7 @@ class BaseReportController < ActionController::Base
else # end daily sale report
if period_type.to_i == 1
if params[:from] && params[:to]
if params[:from] != "" && params[:to] !=""
if params[:from] != "" && params[:to] !=""
f_date = DateTime.parse(params[:from])
t_date = DateTime.parse(params[:to])
@@ -99,8 +97,7 @@ class BaseReportController < ActionController::Base
else
from = day_ref.beginning_of_day.utc
to = day_ref.end_of_day.utc
end
end
end
else
case period.to_i
when PERIOD["today"]

View File

@@ -82,7 +82,8 @@ class Crm::CustomersController < BaseCrmController
card_no = customer_params[:card_no]
member_group_id = params[:member_group_id]
if !member_group_id.nil?
if member_group_id.present?
puts "aaaaaaaaa"
membership = MembershipSetting.find_by_membership_type("paypar_url")
memberaction = MembershipAction.find_by_membership_type("create_membership_customer")
merchant_uid = memberaction.merchant_account_id.to_s
@@ -101,6 +102,7 @@ class Crm::CustomersController < BaseCrmController
},
:timeout => 10
)
rescue Net::OpenTimeout
response = { status: false }
@@ -110,9 +112,7 @@ class Crm::CustomersController < BaseCrmController
rescue SocketError
response = { status: false}
end
if response["status"] == true
customer = Customer.find(@crm_customers.customer_id)
status = customer.update_attributes(membership_id: response["customer_datas"]["id"],membership_type:member_group_id )
@@ -125,11 +125,17 @@ class Crm::CustomersController < BaseCrmController
else
# @crm_customers.destroy
if params[:sale_id]
format.html { redirect_to '/origami/'+params[:sale_id]+'/customers'}
format.html { redirect_to '/origami/'+params[:sale_id]+'/customers', notice: 'Customer was successfully created. '}
else
format.html { redirect_to crm_customers_path, notice: response["message"] }
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully created. ' }
end
end
else
if params[:sale_id]
format.html { redirect_to '/origami/'+params[:sale_id]+'/customers', notice: 'Customer was successfully created. '}
else
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully created. ' }
end
end
else
@@ -183,6 +189,8 @@ end
},
:timeout => 10
)
puts "hhhhhhhhh"
puts response.to_json
rescue Net::OpenTimeout
response = { status: false }
@@ -200,7 +208,7 @@ end
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully updated'}
else
format.html { redirect_to crm_customers_path, notice: response["message"] }
format.html { redirect_to crm_customers_path, notice: response["error"] }
end
else

View File

@@ -20,6 +20,7 @@ class Transactions::OrdersController < ApplicationController
format.json { render json: @orders }
end
end
def show
@order = Order.find(params[:id])