diff --git a/app/controllers/origami/payments_controller.rb b/app/controllers/origami/payments_controller.rb
index 03e0931e..5c725aca 100644
--- a/app/controllers/origami/payments_controller.rb
+++ b/app/controllers/origami/payments_controller.rb
@@ -50,7 +50,7 @@ class Origami::PaymentsController < BaseOrigamiController
unique_code = "ReceiptBillPdf"
customer= Customer.find(saleObj.customer_id)
- rebate_amount = Customer.get_membership_transactions(customer)
+ rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no)
#shop detail
shop_details = Shop.find(1)
# get member information
@@ -133,7 +133,7 @@ class Origami::PaymentsController < BaseOrigamiController
shop_details = Shop.find(1)
# get member information
member_info = Customer.get_member_account(customer)
- rebate_amount = Customer.get_membership_transactions(customer)
+ rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no)
# get printer info
print_settings=PrintSetting.find_by_unique_code(unique_code)
diff --git a/app/models/customer.rb b/app/models/customer.rb
index 60cf8b14..f5a37164 100644
--- a/app/models/customer.rb
+++ b/app/models/customer.rb
@@ -46,7 +46,7 @@ class Customer < ApplicationRecord
end
- def self.get_membership_transactions(customer)
+ def self.get_membership_transactions(customer,receipt_no = nil)
membership = MembershipSetting.find_by_membership_type("paypar_url")
memberaction = MembershipAction.find_by_membership_type("get_member_transactions")
merchant_uid = memberaction.merchant_account_id.to_s
@@ -55,13 +55,17 @@ class Customer < ApplicationRecord
# urltest =self.url_exist?(url)
begin
- 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'
- },
- :timeout => 10
- )
+ response = HTTParty.get(url,
+ :body => { membership_id: customer.membership_id,
+ receipt_no:receipt_no,
+ merchant_uid:merchant_uid,auth_token:auth_token
+ }.to_json,
+ :headers => {
+ 'Content-Type' => 'application/json',
+ 'Accept' => 'application/json'
+ },
+ :timeout => 10
+ )
rescue Net::OpenTimeout
response = { status: false , message: "Server Time out"}
diff --git a/app/pdf/receipt_bill_pdf.rb b/app/pdf/receipt_bill_pdf.rb
index 52cdf586..9807b2d5 100644
--- a/app/pdf/receipt_bill_pdf.rb
+++ b/app/pdf/receipt_bill_pdf.rb
@@ -269,20 +269,19 @@ class ReceiptBillPdf < Prawn::Document
if rebate_amount["status"] == true
stroke_horizontal_rule
- rebate = 0
+ balance = 0
redeem = 0
rebate_amount["data"].each do |res|
-
+ #total redeem amount
if res["receipt_no"]== sale_data.receipt_no && res["status"]== "Redeem"
redeem = redeem + res["redeem"]
-
+ balance = balance + res["balance"]
end
-
-
-
+ #end Total redem
+ #total Rebate Earn
if res["receipt_no"]== sale_data.receipt_no && res["account_status"]== "RebateAccount" && res["status"]== "Rebate"
- rebate = rebate + res["rebate"]
+ # balance = balance + res["balance"]
move_down 5
y_position = cursor
@@ -294,11 +293,9 @@ class ReceiptBillPdf < Prawn::Document
end
end
-
+ # Total Rebate Amount if birthday
if res["receipt_no"]== sale_data.receipt_no && res["account_status"]== "RebateBonusAccount" && res["status"]== "Rebate"
-
- rebate = rebate + res["rebate"]
-
+ # balance = balance + res["balance"]
move_down 5
y_position = cursor
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
@@ -307,21 +304,33 @@ class ReceiptBillPdf < Prawn::Document
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
text "#{number_with_precision(res["balance"], :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
end
-
end
+ #end Total rebate if birthday
end
move_down 5
- y_position = cursor
- bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
- text "Redeem Amount", :size => self.item_font_size,:align => :left
- end
- bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
- text "#{number_with_precision(redeem, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
- end
+ y_position = cursor
+ bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
+ text "Redeem Amount", :size => self.item_font_size,:align => :left
+ end
+ bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
+ text "#{number_with_precision(redeem, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
+ end
+
+ # old = balance + redeem
+
+ # move_down 5
+ # y_position = cursor
+ # bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
+ # text "Old Balance", :size => self.item_font_size,:align => :left
+ # end
+ # bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
+ # text "#{number_with_precision(old, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
+ # end
end
end
+
if member_info["status"] == true && member_info["data"].present?
balance = 0
member_info["data"].each do |res|
diff --git a/app/views/crm/customers/_new_form.html.erb b/app/views/crm/customers/_new_form.html.erb
index d52c0456..66a16b2b 100644
--- a/app/views/crm/customers/_new_form.html.erb
+++ b/app/views/crm/customers/_new_form.html.erb
@@ -1,4 +1,4 @@
-
+
<%= simple_form_for @crm_customer,:url => crm_customers_path, :method => :post do |f| %>
diff --git a/app/views/origami/customers/index.html.erb b/app/views/origami/customers/index.html.erb
index 72e402e8..a1d359e8 100644
--- a/app/views/origami/customers/index.html.erb
+++ b/app/views/origami/customers/index.html.erb
@@ -10,7 +10,7 @@
-
+
@@ -71,7 +71,7 @@
-
+
<%= simple_form_for @crm_customer,:url => crm_customers_path, :method => :post do |f| %>
diff --git a/app/views/origami/discounts/index.html.erb b/app/views/origami/discounts/index.html.erb
index faa48c05..5eb4afe6 100644
--- a/app/views/origami/discounts/index.html.erb
+++ b/app/views/origami/discounts/index.html.erb
@@ -17,7 +17,7 @@
Date: <%=@sale_data.receipt_date.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%>
-
+
diff --git a/app/views/origami/home/index.html.erb b/app/views/origami/home/index.html.erb
index 99fa713e..6bdadd85 100644
--- a/app/views/origami/home/index.html.erb
+++ b/app/views/origami/home/index.html.erb
@@ -19,9 +19,9 @@
-
+
-
+
<% @complete.each do |sale| %>
@@ -35,7 +35,7 @@
-
+
<% @tables.each do |table| %>
<% if table.status == 'occupied' %>
@@ -67,7 +67,7 @@
-
+
<% @rooms.each do |room| %>
<% if room.status == 'occupied' %>
@@ -88,7 +88,7 @@
-
+
<% @orders.each do |order| %>
diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb
index baad1a0a..fd211ccc 100644
--- a/app/views/origami/home/show.html.erb
+++ b/app/views/origami/home/show.html.erb
@@ -6,7 +6,7 @@
-
+
-
+
<% @complete.each do |sale| %>
@@ -38,7 +38,7 @@
-
+
<% @tables.each do |table| %>
<% if table.status == 'occupied' %>
@@ -71,7 +71,7 @@
-
+
<% @rooms.each do |room| %>
<% if room.status == 'occupied' %>
@@ -98,7 +98,7 @@
-
+
<% @orders.each do |order| %>
@@ -150,7 +150,7 @@
<%end%>
-
+
diff --git a/app/views/origami/moveroom/move_dining.html.erb b/app/views/origami/moveroom/move_dining.html.erb
index 109bc418..a8620d6e 100644
--- a/app/views/origami/moveroom/move_dining.html.erb
+++ b/app/views/origami/moveroom/move_dining.html.erb
@@ -21,7 +21,7 @@
-
+
<% @tables.each do |table| %>
<% if table.status == 'occupied' %>
@@ -42,7 +42,7 @@
-
+
<% @rooms.each do |room| %>
<% if room.status == 'occupied' %>
@@ -95,7 +95,7 @@
-
+
diff --git a/app/views/origami/movetable/move_dining.html.erb b/app/views/origami/movetable/move_dining.html.erb
index c8254d42..d64b71f0 100644
--- a/app/views/origami/movetable/move_dining.html.erb
+++ b/app/views/origami/movetable/move_dining.html.erb
@@ -21,7 +21,7 @@
-
+
<% @tables.each do |table| %>
<% if table.status == 'occupied' %>
@@ -42,7 +42,7 @@
-
+
<% @rooms.each do |room| %>
<% if room.status == 'occupied' %>
@@ -95,7 +95,7 @@
-
+
diff --git a/app/views/origami/orders/show.html.erb b/app/views/origami/orders/show.html.erb
index e0448009..40388847 100644
--- a/app/views/origami/orders/show.html.erb
+++ b/app/views/origami/orders/show.html.erb
@@ -19,9 +19,9 @@
-
+
-
+
<% @complete.each do |sale| %>
@@ -34,7 +34,7 @@
-
+
<% @tables.each do |table| %>
<% if table.status == 'occupied' %>
@@ -60,7 +60,7 @@
-
+
<% @rooms.each do |room| %>
<% if room.status == 'occupied' %>
@@ -86,7 +86,7 @@
-
+
<% @orders.each do |order| %>
@@ -140,7 +140,7 @@
-
+
diff --git a/app/views/origami/other_charges/index.html.erb b/app/views/origami/other_charges/index.html.erb
index 129aa0e0..20bb5a4b 100644
--- a/app/views/origami/other_charges/index.html.erb
+++ b/app/views/origami/other_charges/index.html.erb
@@ -17,7 +17,7 @@
Date: <%=@sale_data.receipt_date.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%>
-
+
diff --git a/app/views/origami/room_invoices/show.html.erb b/app/views/origami/room_invoices/show.html.erb
index 4b507526..b44340d4 100644
--- a/app/views/origami/room_invoices/show.html.erb
+++ b/app/views/origami/room_invoices/show.html.erb
@@ -41,7 +41,7 @@
-
+
diff --git a/app/views/origami/rooms/show.html.erb b/app/views/origami/rooms/show.html.erb
index e968c34a..9b681fe1 100644
--- a/app/views/origami/rooms/show.html.erb
+++ b/app/views/origami/rooms/show.html.erb
@@ -19,9 +19,9 @@
-
+
-
+
<% @complete.each do |sale| %>
@@ -34,7 +34,7 @@
-
+
<% @tables.each do |table| %>
<% if table.status == 'occupied' %>
@@ -65,7 +65,7 @@
-
+
<% @rooms.each do |room| %>
<% if room.status == 'occupied' %>
@@ -98,7 +98,7 @@
-
+
<% @orders.each do |order| %>
@@ -148,7 +148,7 @@
-
+
diff --git a/app/views/origami/sale_edit/edit.html.erb b/app/views/origami/sale_edit/edit.html.erb
index 13812e59..d604e654 100644
--- a/app/views/origami/sale_edit/edit.html.erb
+++ b/app/views/origami/sale_edit/edit.html.erb
@@ -22,7 +22,7 @@
-
+
diff --git a/app/views/origami/sales/show.html.erb b/app/views/origami/sales/show.html.erb
index 86a82053..ad8a73aa 100644
--- a/app/views/origami/sales/show.html.erb
+++ b/app/views/origami/sales/show.html.erb
@@ -19,9 +19,9 @@
-
+
-
+
<% @complete.each do |sale| %>
@@ -34,7 +34,7 @@
-
+
<% @tables.each do |table| %>
<% if table.status == 'occupied' %>
@@ -60,7 +60,7 @@
-
+
<% @rooms.each do |room| %>
<% if room.status == 'occupied' %>
@@ -86,7 +86,7 @@
-
+
<% @orders.each do |order| %>
@@ -126,7 +126,7 @@
-
+
diff --git a/app/views/origami/table_invoices/show.html.erb b/app/views/origami/table_invoices/show.html.erb
index de43e654..c49ddfbc 100644
--- a/app/views/origami/table_invoices/show.html.erb
+++ b/app/views/origami/table_invoices/show.html.erb
@@ -41,7 +41,7 @@
-
+
diff --git a/app/views/settings/employees/index.html.erb b/app/views/settings/employees/index.html.erb
index 1112f72b..21a196e4 100644
--- a/app/views/settings/employees/index.html.erb
+++ b/app/views/settings/employees/index.html.erb
@@ -25,7 +25,7 @@
| <%= link_to employee.name,settings_employee_path(employee) %> |
<%= employee.role %> |
- <%= link_to 'Edit', edit_settings_employee_path(employee) %> | <%= link_to 'Destroy', employee[:setting], method: :delete, data: { confirm: 'Are you sure?' } %> |
+ <%= link_to 'Edit', edit_settings_employee_path(employee) %> | <%= link_to 'Destroy', settings_employee_path(employee), method: :delete, data: { confirm: 'Are you sure?' } %>
<% end %>
diff --git a/app/views/transactions/sales/show.html.erb b/app/views/transactions/sales/show.html.erb
index 8e4ccc9a..cbd07c41 100644
--- a/app/views/transactions/sales/show.html.erb
+++ b/app/views/transactions/sales/show.html.erb
@@ -205,15 +205,16 @@
<%= @customer.address%> |
<%= @customer.date_of_birth %> |
+
- | Membership Transactions |
+ Membership Transactions |
| Date |
Redeem |
Rebate |
Balance |
-
+ From Account |
Status |
Receipt No |
@@ -226,7 +227,7 @@
<%= transaction["redeem"]%> |
<%= transaction["rebate"] %> |
<%= transaction["balance"] %> |
-
+ <%= transaction["account_status"] %> |
<%= transaction["status"] %> |
<%= transaction["receipt_no"] %> |