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/ability.rb b/app/models/ability.rb
index f3e8da5c..5e5fb4f3 100644
--- a/app/models/ability.rb
+++ b/app/models/ability.rb
@@ -20,9 +20,9 @@ class Ability
can :manage, Zone
can :manage, CashierTerminal
can :manage, Employee
- can :manage, MembershipSetting
- can :manage, MembershipAction
- can :manage, PaymentMethodSetting
+ # can :manage, MembershipSetting
+ # can :manage, MembershipAction
+ # can :manage, PaymentMethodSetting
can :manage, TaxProfile
can :manage, PrintSetting
can :manage, Account
@@ -30,9 +30,26 @@ class Ability
can :manage, Order
can :manage, Sale
+ can :manage, Customer
+
can :index, :dailysale
can :index, :saleitem
+ can :add_customer, Customer
+ can :update_sale_by_customer, Customer
+
+ can :index, :discount
+ can :create, :discount
+
+ can :show, :payment
+ can :create, :payment
+ can :reprint, :payment
+
+ can :move_dining, :movetable
+ can :moving, :movetable
+
+ can :move_dining, :moveroom
+
elsif user.role == "cashier"
can :read, Order
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/crm/customers/index.html.erb b/app/views/crm/customers/index.html.erb
index a5ce8550..b3c1fce7 100644
--- a/app/views/crm/customers/index.html.erb
+++ b/app/views/crm/customers/index.html.erb
@@ -47,7 +47,7 @@
<% @i = 0 %>
<% @crm_customers.each do |crm_customer| %>
- <% if crm_customer.customer_id != "CUS-000000000001" && crm_customer.customer_id != "CUS-000000000002" %>
+ <% if crm_customer.customer_id != "CUS-00001" && crm_customer.customer_id != "CUS-000000000" %>
|
|
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/origami/customers/index.html.erb b/app/views/origami/customers/index.html.erb
index d1886423..489487ab 100644
--- a/app/views/origami/customers/index.html.erb
+++ b/app/views/origami/customers/index.html.erb
@@ -41,7 +41,7 @@
<% if @crm_customers.count > 0 %>
<% @i = 0 %>
<% @crm_customers.each do |crm_customer| %>
- <% if crm_customer.customer_id != "CUS-000000000001" && crm_customer.customer_id != "CUS-000000000002" %>
+ <% if crm_customer.customer_id != "CUS-00000" && crm_customer.customer_id != "CUS-00000000" %>
|
|
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/application.rb b/config/application.rb
index 2a47de48..0e323d22 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -13,6 +13,7 @@ module SXRestaurants
# -- all .rb files in that directory are automatically loaded.
config.active_record.time_zone_aware_types = [:datetime, :time]
config.active_job.queue_adapter = :sidekiq
+ config.time_zone = 'Asia/Rangoon'
end
end
diff --git a/config/routes.rb b/config/routes.rb
index 73b361ce..54610346 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -228,6 +228,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"