diff --git a/app/controllers/crm/customers_controller.rb b/app/controllers/crm/customers_controller.rb
index 96e76574..4cacae00 100644
--- a/app/controllers/crm/customers_controller.rb
+++ b/app/controllers/crm/customers_controller.rb
@@ -51,34 +51,14 @@ class Crm::CustomersController < BaseCrmController
#get customer amount
@customer = Customer.find(params[:id])
+ response = Customer.get_member_account(@customer)
- membership = MembershipSetting.find_by_membership_type("paypar_url")
-
- memberaction = MembershipAction.find_by_membership_type("get_all_member_account")
- merchant_uid = memberaction.merchant_account_id.to_s
- auth_token = memberaction.auth_token.to_s
- url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
-
- response = HTTParty.get(url, :body => { membership_id: @customer.membership_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
- :headers => {
- 'Content-Type' => 'application/json',
- 'Accept' => 'application/json'
- }
- )
if(response["status"] == true)
@membership = response["data"]
else
@membership = 0
end
- # @type = "-"
- # @balance = 0.00
- # response["data"].each do |res|
- # if res["accountable_type"] == "RebateAccount"
- # @balance = res["balance"]
- # @type = "RebateAccount"
- # end
- # end
-
+
#end customer amount
end
diff --git a/app/controllers/origami/home_controller.rb b/app/controllers/origami/home_controller.rb
index 22c0c119..b67eb352 100644
--- a/app/controllers/origami/home_controller.rb
+++ b/app/controllers/origami/home_controller.rb
@@ -69,20 +69,8 @@ class Origami::HomeController < BaseOrigamiController
def get_customer
@customer = Customer.find(params[:customer_id])
-
- membership = MembershipSetting.find_by_membership_type("paypar_url")
-
- memberaction = MembershipAction.find_by_membership_type("get_all_member_account")
- merchant_uid = memberaction.merchant_account_id.to_s
- auth_token = memberaction.auth_token.to_s
- url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
-
- response = HTTParty.get(url, :body => { membership_id: @customer.membership_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
- :headers => {
- 'Content-Type' => 'application/json',
- 'Accept' => 'application/json'
- }
- )
+
+ response = Customer.get_member_account(@customer)
respond_to do |format|
format.js do
diff --git a/app/controllers/transactions/sales_controller.rb b/app/controllers/transactions/sales_controller.rb
index 36b2be3d..c8ecb725 100644
--- a/app/controllers/transactions/sales_controller.rb
+++ b/app/controllers/transactions/sales_controller.rb
@@ -92,6 +92,16 @@ class Transactions::SalesController < ApplicationController
end
end
+ def void
+ @sale = params[:sale_id]
+ @reason = Lookup.where("lookup_type = 'void_reason'")
+ end
+
+ def manual_void_sale
+ sale_id = params[:sale_id]
+
+ end
+
private
# Use callbacks to share common setup or constraints between actions.
def set_transactions_sale
diff --git a/app/models/customer.rb b/app/models/customer.rb
index 93834b43..d6d2a0d8 100644
--- a/app/models/customer.rb
+++ b/app/models/customer.rb
@@ -12,21 +12,40 @@ class Customer < ApplicationRecord
paginates_per 50
- def self.get_member_group
+ # def self.get_member_group
- membership = MembershipSetting.find_by_membership_type("paypar_url")
- memberaction = MembershipAction.find_by_membership_type("get_all_member_group")
- app_token = membership.auth_token.to_s
+ # membership = MembershipSetting.find_by_membership_type("paypar_url")
+ # memberaction = MembershipAction.find_by_membership_type("get_all_member_group")
+ # app_token = membership.auth_token.to_s
- url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
- response = HTTParty.get(url,
- :body => { app_token: app_token}.to_json,
- :headers => {
- 'Content-Type' => 'application/json',
- 'Accept' => 'application/json'
- }
- )
- puts response.body, response.code, response.message, response.headers.inspect
+ # url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
+ # response = HTTParty.get(url,
+ # :body => { app_token: app_token}.to_json,
+ # :headers => {
+ # 'Content-Type' => 'application/json',
+ # 'Accept' => 'application/json'
+ # }
+ # )
+ # puts response.body, response.code, response.message, response.headers.inspect
+
+ # return response;
+
+ # end
+
+ def self.get_member_account(customer)
+
+ membership = MembershipSetting.find_by_membership_type("paypar_url")
+ memberaction = MembershipAction.find_by_membership_type("get_all_member_account")
+ merchant_uid = memberaction.merchant_account_id.to_s
+ auth_token = memberaction.auth_token.to_s
+ url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
+
+ response = HTTParty.get(url, :body => { membership_id: customer.membership_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
+ :headers => {
+ 'Content-Type' => 'application/json',
+ 'Accept' => 'application/json'
+ }
+ )
return response;
diff --git a/app/views/transactions/sales/show.html.erb b/app/views/transactions/sales/show.html.erb
index a96c63db..36994ec7 100644
--- a/app/views/transactions/sales/show.html.erb
+++ b/app/views/transactions/sales/show.html.erb
@@ -93,7 +93,7 @@
Grand Total |
<%= number_with_precision(@sale.grand_total, :precision => 2, :delimiter => ',') rescue ' '%> |
- | | |
+ | | |
|
Pay Amount |
@@ -108,7 +108,7 @@
|
Payment <%= r.payment_method rescue ' '%> |
- <%= number_with_precision(r.payment_amount, :precision => 2, :delimiter => ',') rescue ' '%>
+ | <%= number_with_precision(r.payment_amount, :precision => 2, :delimiter => ',') rescue ' '%>
|
@@ -171,12 +171,12 @@
Back
-
+
diff --git a/app/views/transactions/sales/show__.html.erb b/app/views/transactions/sales/show__.html.erb
deleted file mode 100644
index b9a57ed9..00000000
--- a/app/views/transactions/sales/show__.html.erb
+++ /dev/null
@@ -1,112 +0,0 @@
-
-
-
-
-
-
-
-
-
-
- |
- |
-
-
- |
-
-
- | |
-
-
- | Receipt Date |
- Receipt no |
- Cashier |
- Sales status |
- Receipt generated at |
-
-
-
-
-
- | <%= @sale.receipt_date.strftime("%d-%M-%Y") %> |
- <%= @sale.receipt_no %> |
- <%= @sale.cashier rescue '-' %> |
- <%= @sale.sale_status %> |
- <%= @sale.requested_at.strftime("%d-%m-%Y") %> |
-
-
- | Sale item name |
- Qty |
- Unit price |
- Total pirce |
- Created at |
-
- <% @sale.sale_items.each do |s| %>
-
-
- | <%=s.product_name rescue ' '%> |
- <%=s.qty rescue ' '%> |
- <%= number_with_precision(s.price, :precision => 2, :delimiter => ',') rescue ' '%> |
- <%= number_with_precision(s.qty * s.price, :precision => 2, :delimiter => ',') rescue ' '%> |
- <%=l s.created_at.utc.getlocal , :format => :short rescue ' ' %> |
-
- <% end %>
-
- |
- Total |
- <%= number_with_precision(@sale.total_amount, :precision => 2, :delimiter => ',') rescue ' '%> |
-
-
- |
- Discount |
- <%= number_with_precision(@sale.total_discount, :precision => 2, :delimiter => ',') rescue ' '%> |
-
-
- |
- Tax |
- <%= number_with_precision(@sale.total_tax, :precision => 2, :delimiter => ',') rescue ' '%> |
-
-
-
- |
- Grand Total |
- <%= number_with_precision(@sale.grand_total, :precision => 2, :delimiter => ',') rescue ' '%> |
-
- | | |
-
- |
- Pay Amount |
- <%= number_with_precision(@sale.amount_received, :precision => 2, :delimiter => ',') rescue ' '%> |
-
-
- |
- Change |
- <%= number_with_precision(@sale.amount_changed, :precision => 2, :delimiter => ',') rescue ' '%> |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/views/transactions/sales/void.html.erb b/app/views/transactions/sales/void.html.erb
new file mode 100644
index 00000000..6d0d9fb7
--- /dev/null
+++ b/app/views/transactions/sales/void.html.erb
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+
diff --git a/config/routes.rb b/config/routes.rb
index a0da05ae..6d1a7ce0 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -198,6 +198,8 @@ Rails.application.routes.draw do
namespace :transactions do
resources :sales
resources :orders
+ get "/sales/:sale_id/void" =>"sales#void", :as => "void"
+ post "sales/manual_void_sale", to: "sales#manual_void_sale", :as => "manual_void_sale"
end
#--------- Reports Controller Sections ------------#