diff --git a/app/controllers/origami/customers_controller.rb b/app/controllers/origami/customers_controller.rb index 026e59e3..ec826416 100644 --- a/app/controllers/origami/customers_controller.rb +++ b/app/controllers/origami/customers_controller.rb @@ -37,14 +37,14 @@ class Origami::CustomersController < BaseOrigamiController @crm_customers = Customer.order("customer_id").page(params[:page]) #@products = Product.order("name").page(params[:page]).per(5) else - @crm_customers = Customer.search(filter) - + @crm_customers = Customer.search(filter) end #@crm_customers = Customer.all @crm_customers = Kaminari.paginate_array(@crm_customers).page(params[:page]).per(50) @crm_customer = Customer.new @count_customer = Customer.count_customer + @taxes = TaxProfile.all.order("order_by asc") # if flash["errors"] # @crm_customer.valid? # end diff --git a/app/models/sale.rb b/app/models/sale.rb index 712584a5..b252fdf1 100644 --- a/app/models/sale.rb +++ b/app/models/sale.rb @@ -277,8 +277,8 @@ class Sale < ApplicationRecord # #Creat new tax records tax_profiles.each do |tax| - customer.tax_profiles.each do |cus_tax| - if cus_tax == tax.id + customer.tax_profiles.each do |cus_tax| + if cus_tax.to_i == tax.id sale_tax = SaleTax.new(:sale => sale) sale_tax.tax_name = tax.name sale_tax.tax_rate = tax.rate @@ -318,10 +318,11 @@ class Sale < ApplicationRecord tax_profiles = TaxProfile.all.order("order_by asc") customer = Customer.find(self.customer_id) + # #Create new tax records tax_profiles.each do |tax| customer.tax_profiles.each do |cus_tax| - if cus_tax == tax.id + if cus_tax.to_i == tax.id sale_tax = SaleTax.new(:sale => self) sale_tax.tax_name = tax.name sale_tax.tax_rate = tax.rate diff --git a/app/views/crm/customers/_new_form.html.erb b/app/views/crm/customers/_new_form.html.erb index 5f1d1b46..35c3a46d 100644 --- a/app/views/crm/customers/_new_form.html.erb +++ b/app/views/crm/customers/_new_form.html.erb @@ -82,17 +82,7 @@