diff --git a/app/controllers/transactions/credit_notes_controller.rb b/app/controllers/transactions/credit_notes_controller.rb
index e69de29b..0f370c96 100644
--- a/app/controllers/transactions/credit_notes_controller.rb
+++ b/app/controllers/transactions/credit_notes_controller.rb
@@ -0,0 +1,18 @@
+class Transactions::CreditNotesController < ApplicationController
+ before_action :set_transactions_sale, only: [:show, :edit, :update, :destroy]
+
+ # GET /transactions/sales
+ # GET /transactions/sales.json
+ def index
+
+ @sales = Sale.where('payment_status = ?', Sale::SALE_STATUS_OUTSTANDING)
+
+
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.json { render json: @sales }
+ end
+
+ end
+ end
\ No newline at end of file
diff --git a/app/models/sale.rb b/app/models/sale.rb
index 6b5efbb3..8f7f17d8 100644
--- a/app/models/sale.rb
+++ b/app/models/sale.rb
@@ -22,7 +22,7 @@ class Sale < ApplicationRecord
"monthly" => 1,
"yearly" => 2
}
-
+ SALE_STATUS_OUTSTANDING = "outstanding"
SALE_STATUS_COMPLETED = "completed"
def generate_invoice_from_booking(booking_id, requested_by)
diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb
index 5505bad7..05b74b7a 100644
--- a/app/views/layouts/_header.html.erb
+++ b/app/views/layouts/_header.html.erb
@@ -33,6 +33,7 @@
diff --git a/app/views/transactions/credit_notes/index.html.erb b/app/views/transactions/credit_notes/index.html.erb
new file mode 100644
index 00000000..fba0b52f
--- /dev/null
+++ b/app/views/transactions/credit_notes/index.html.erb
@@ -0,0 +1,70 @@
+
+
+
+
+
+
+
+
+
+ | Sale Id |
+ Receipt no |
+ Credit Amount |
+ Cashier |
+ Customer Name |
+ Receipt Date |
+
+
+
+
+ <% @sales.each do |sale| %>
+
+ | <%= link_to sale.sale_id, transactions_sale_path(sale) %> |
+ <%= sale.receipt_no %> |
+ <%credit = SalePayment.where('sale_id = ? AND payment_method=?', sale.sale_id,"creditnote").first %>
+ <%= credit.payment_amount rescue '-' %>
+ |
+ <%= sale.cashier_name rescue '-' %> |
+ <%= link_to sale.customer.name, crm_customer_path(sale.customer_id) %> |
+ <%= sale.receipt_date.strftime("%d-%m-%Y") %> |
+
+ <% end %>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/config/routes.rb b/config/routes.rb
index 39b9aca5..1f5ae75a 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -225,6 +225,7 @@ Rails.application.routes.draw do
namespace :transactions do
resources :sales
resources :orders
+ resources :credit_notes
get "/sales/:sale_id/manual_complete_sale" =>"manual_sales#manual_complete_sale", :as => "manual_complete_sale"
get "/sales/:sale_id/void" =>"manual_sales#void", :as => "void"