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/origami/customers/index.html.erb b/app/views/origami/customers/index.html.erb index b58ca35a..a180bda6 100644 --- a/app/views/origami/customers/index.html.erb +++ b/app/views/origami/customers/index.html.erb @@ -77,19 +77,29 @@ <%= f.error_notification %> <%= f.hidden_field :id, :class => "form-control col-md-6 " %> -
<%= notice %>
- -- Cashier: - <%= @transactions_sale.cashier %> -
- -- Cashier name: - <%= @transactions_sale.cashier_name %> -
- -- Requested by: - <%= @transactions_sale.requested_by %> -
- -- Requested at: - <%= @transactions_sale.requested_at %> -
- -- Receipt no: - <%= @transactions_sale.receipt_no %> -
- -- Receipt date: - <%= @transactions_sale.receipt_date %> -
- -- Customer: - <%= @transactions_sale.customer %> -
- -- Payment status: - <%= @transactions_sale.payment_status %> -
- -- Sale status: - <%= @transactions_sale.sale_status %> -
- -- Total amount: - <%= @transactions_sale.total_amount %> -
- -- Total discount: - <%= @transactions_sale.total_discount %> -
- -- Total tax: - <%= @transactions_sale.total_tax %> -
- -- Tax type: - <%= @transactions_sale.tax_type %> -
- -- Grand total: - <%= @transactions_sale.grand_total %> -
- -- Rounding adjustment: - <%= @transactions_sale.rounding_adjustment %> -
- -- Amount received: - <%= @transactions_sale.amount_received %> -
- -- Amount changed: - <%= @transactions_sale.amount_changed %> -
- -<%= link_to 'Edit', edit_transactions_sale_path(@transactions_sale) %> | -<%= link_to 'Back', transactions_sales_path %> diff --git a/app/views/transactions/sales/void.html.erb b/app/views/transactions/sales/void.html.erb index d8091876..aef0aa40 100644 --- a/app/views/transactions/sales/void.html.erb +++ b/app/views/transactions/sales/void.html.erb @@ -15,12 +15,16 @@| - <%= check_box_tag "reason", "#{r.name}" rescue '-' %> + + | <%= label_tag "reasons[#{r.id}]", r.name, :style=>'font-weight:bold;font-size:18px;' rescue '-' %> | @@ -29,10 +33,13 @@