update pagination and booking and rebate redeem

This commit is contained in:
Aung Myo
2017-11-15 12:02:02 +06:30
parent de3f2e5e90
commit 1c0a93d56d
7 changed files with 65 additions and 12 deletions

View File

@@ -32,6 +32,7 @@ class Ability
can :manage, Order
can :manage, Booking
can :manage, Sale
@@ -84,7 +85,7 @@ class Ability
can :read, Order
can :update, Order
can :menage, Booking
can :read, Sale
can :update, Sale
can :get_customer, Customer

View File

@@ -95,7 +95,7 @@ class Customer < ApplicationRecord
auth_token = memberaction.auth_token.to_s
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
@customers = Customer.where("membership_type IS NOT NULL AND membership_id IS NULL")
@customers = Customer.where("membership_type IS NOT NULL AND membership_id IS NULL")
@customers.each do |customer|
member_params = { name: customer.name,phone: customer.contact_no,
@@ -106,7 +106,7 @@ class Customer < ApplicationRecord
# Check for paypar account exists
# if paypar_account_no != nil || paypar_account_no != ''
if paypar_account_no.present?
if customer.paypar_account_no.present?
member_params = { name: customer.name,phone: customer.contact_no,
email: customer.email,dob: customer.date_of_birth,
address: customer.address,nrc:customer.nrc_no,
@@ -131,7 +131,6 @@ class Customer < ApplicationRecord
rescue SocketError
response = { status: false, message: "Can't connect server"}
end
if response["status"] == true
status = customer.update_attributes(membership_id: response["customer_datas"]["id"])
end
@@ -165,10 +164,12 @@ class Customer < ApplicationRecord
credit = 1
end
end
# overall_dis = SaleItem.get_overall_discount(sObj.id)
overall_dis = sObj.total_discount
total_amount = rebate_prices - payparcost - overall_dis
if credit == 1
total_amount = 0
end