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| %> + @@ -54,6 +55,7 @@ <%= link_to 'Show', crm_customer_path(crm_customer) %> + <% end %> <%else%>

There are no record for your search

@@ -107,7 +109,6 @@
@@ -55,6 +56,7 @@ + <% end %> <%else%>

There are no record for your search

@@ -77,19 +79,29 @@ <%= f.error_notification %> <%= f.hidden_field :id, :class => "form-control col-md-6 " %> -
+
"> <%= f.input :name, :class => "form-control col-md-6 name" %> - + <% flash.each do |name, msg| %> + <%= msg['name'] %> + <% end -%> +
<%= f.input :company, :class => "form-control col-md-6 company" %>
-
+
"> <%= f.input :contact_no, :class => "form-control col-md-6 contact_no" %> + <% flash.each do |name, msg| %> + <%= msg['contact_no'] %> + <% end -%>
-
- <%= f.input :email, :class => "form-control col-md-6 email" %> +
"> + <%= f.input :email, :class => "form-control col-md-6 email" %> + + <% flash.each do |name, msg| %> + <%= msg['email'] %> + <% end -%>
@@ -100,7 +112,6 @@