diff --git a/app/controllers/origami/customers_controller.rb b/app/controllers/origami/customers_controller.rb index 3215f9e6..601055e5 100644 --- a/app/controllers/origami/customers_controller.rb +++ b/app/controllers/origami/customers_controller.rb @@ -28,11 +28,10 @@ class Origami::CustomersController < BaseOrigamiController @crm_customers = Kaminari.paginate_array(@crm_customers).page(params[:page]).per(50) @crm_customer = Customer.new - if flash["errors"] - @crm_customer.valid? - end + # if flash["errors"] + # @crm_customer.valid? + # end - respond_to do |format| # format.html { render :template => "crm/customers/index" } format.html { render action: "index"} diff --git a/app/controllers/transactions/sales_controller.rb b/app/controllers/transactions/sales_controller.rb index b1c28e98..82be6f59 100644 --- a/app/controllers/transactions/sales_controller.rb +++ b/app/controllers/transactions/sales_controller.rb @@ -104,7 +104,19 @@ class Transactions::SalesController < ApplicationController end def manual_void_sale - sale_id = params[:sale_id] + + sale_id = params[:sale_id] + reason = params[:reason] + sale = Sale.find(sale_id) + sale.sales_status = 'void' + sale.remarks = reason + sale.void_by = current_user.id + if sale.save + sale =SaleAudit.record_audit_void(sale_id, current_user.id, current_user.id, reason) + end + respond_to do |format| + format.html { redirect_to transactions_sales_url, notice: 'Sale was successfully void.' } + end end diff --git a/app/views/crm/customers/index.html.erb b/app/views/crm/customers/index.html.erb index 36008efb..7ccd8fb8 100644 --- a/app/views/crm/customers/index.html.erb +++ b/app/views/crm/customers/index.html.erb @@ -44,6 +44,7 @@
<% if @crm_customers.count > 0 %> <% @crm_customers.each do |crm_customer| %> +There are no record for your search