update customer
This commit is contained in:
@@ -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. But '}
|
||||
else
|
||||
format.html { redirect_to crm_customers_path, notice: response["message"] }
|
||||
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully created. But ' }
|
||||
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
|
||||
|
||||
@@ -29,6 +29,7 @@ class Origami::OtherChargesController < BaseOrigamiController
|
||||
sale_item.sale_id = sale_id
|
||||
sale_item.product_code = "Other Charges"
|
||||
sale_item.product_name = di["name"]
|
||||
sale_item.product_alt_name = ""
|
||||
sale_item.remark = "Other Charges"
|
||||
|
||||
sale_item.qty = 1
|
||||
|
||||
@@ -41,8 +41,8 @@ class Ability
|
||||
can :add_customer, Customer
|
||||
can :update_sale_by_customer, Customer
|
||||
|
||||
can :index, :other_charges
|
||||
can :create, :other_charges
|
||||
can :index, :other_charge
|
||||
can :create, :other_charge
|
||||
can :index, :discount
|
||||
can :create, :discount
|
||||
can :remove_discount_items, :discount
|
||||
@@ -77,11 +77,14 @@ class Ability
|
||||
can :add_customer, Customer
|
||||
can :update_sale_by_customer, Customer
|
||||
|
||||
can :index, :other_charge
|
||||
can :create, :other_charge
|
||||
can :index, :discount
|
||||
can :create, :discount
|
||||
can :remove_discount_items, :discount
|
||||
can :remove_all_discount, :discount
|
||||
|
||||
can :first_bill, :payment
|
||||
can :show, :payment
|
||||
can :create, :payment
|
||||
can :reprint, :payment
|
||||
|
||||
@@ -91,7 +91,7 @@ class Order < ApplicationRecord
|
||||
# self.employee_name)
|
||||
# end
|
||||
|
||||
OrderItem.processs_item(menu_item[:item_code], menu_item[:name], menu_item[:account_id],
|
||||
OrderItem.processs_item(menu_item[:item_code], menu_item[:name], menu_item[:alt_name], menu_item[:account_id],
|
||||
item[:quantity],menu_item[:price], item[:options], set_order_items, self.id,
|
||||
self.employee_name)
|
||||
|
||||
|
||||
@@ -20,12 +20,13 @@ class OrderItem < ApplicationRecord
|
||||
# option_values : [],
|
||||
# sub_order_items : [],
|
||||
# }
|
||||
def self.processs_item (item_code, menu_name, account_id, qty,price, options, set_menu_items, order_id, item_order_by)
|
||||
def self.processs_item (item_code, menu_name, alt_name, account_id, qty,price, options, set_menu_items, order_id, item_order_by)
|
||||
|
||||
orderitem = OrderItem.create do |oitem|
|
||||
oitem.order_id = order_id
|
||||
oitem.item_code = item_code
|
||||
oitem.item_name = menu_name
|
||||
oitem.alt_name = alt_name
|
||||
oitem.account_id = account_id
|
||||
oitem.qty = qty
|
||||
oitem.price = price
|
||||
|
||||
@@ -59,11 +59,11 @@ class OrderQueueStation < ApplicationRecord
|
||||
private
|
||||
#Print order_items in 1 slip
|
||||
def print_slip(oqs, order, order_items)
|
||||
unique_code="OrderSummaryPdf"
|
||||
unique_code="OrderSummaryPdf"
|
||||
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
||||
order_queue_printer.print_order_summary(oqs,order.order_id, order_items, print_status="")
|
||||
order_queue_printer.print_order_summary(print_settings, oqs,order.order_id, order_items, print_status="")
|
||||
|
||||
AssignedOrderItem.where("order_id = '#{ order.order_id }'").find_each do |ai|
|
||||
# update print status for order items
|
||||
@@ -80,7 +80,7 @@ class OrderQueueStation < ApplicationRecord
|
||||
# print when complete click
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
||||
order_queue_printer.print_order_item(oqs,item.order_id, item.item_code, print_status="" )
|
||||
order_queue_printer.print_order_item(print_settings, oqs,item.order_id, item.item_code, print_status="" )
|
||||
|
||||
# update print status for completed same order items
|
||||
assigned_order_item.each do |ai|
|
||||
|
||||
@@ -147,6 +147,7 @@ class Sale < ApplicationRecord
|
||||
#pull
|
||||
sale_item.product_code = item.item_code
|
||||
sale_item.product_name = item.item_name
|
||||
sale_item.product_alt_name = item.alt_name
|
||||
sale_item.account_id = item.account_id
|
||||
sale_item.remark = item.remark
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ class ShiftSale < ApplicationRecord
|
||||
puts today_date
|
||||
shift = ShiftSale.where("DATE(shift_started_at)= #{ today_date } and shift_started_at is not null and shift_closed_at is null and employee_id = #{current_user}").take
|
||||
|
||||
|
||||
return shift
|
||||
#end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user