update customer transaction

This commit is contained in:
Aung Myo
2017-06-21 18:29:02 +06:30
parent d9d07a1cdc
commit 3ba836b446
3 changed files with 60 additions and 66 deletions

View File

@@ -53,13 +53,7 @@ class Transactions::SalesController < ApplicationController
#get customer amount #get customer amount
@customer = Customer.find(@sale.customer_id) @customer = Customer.find(@sale.customer_id)
response = Customer.get_member_account(@customer) @response = Customer.get_membership_transactions(@customer)
if(response["status"] == true)
@membership = response["data"]
else
@membership = 0
end
#end customer amount #end customer amount
respond_to do |format| respond_to do |format|

View File

@@ -47,7 +47,7 @@
<th>Redeem</th> <th>Redeem</th>
<th>Rebate</th> <th>Rebate</th>
<th>Balance</th> <th>Balance</th>
<th>Account No</th> <!-- <th>Account No</th> -->
<th>Status</th> <th>Status</th>
<th>Receipt No</th> <th>Receipt No</th>
</tr> </tr>
@@ -60,7 +60,7 @@
<td><%= transaction["redeem"]%></td> <td><%= transaction["redeem"]%></td>
<td><%= transaction["rebate"] %></td> <td><%= transaction["rebate"] %></td>
<td><%= transaction["balance"] %></td> <td><%= transaction["balance"] %></td>
<td><%= transaction["account_no"] %></td> <!-- <td><%= transaction["account_no"] %></td> -->
<td><%= transaction["status"] %></td> <td><%= transaction["status"] %></td>
<td><%= transaction["receipt_no"] %></td> <td><%= transaction["receipt_no"] %></td>

View File

@@ -175,63 +175,63 @@
</div> </div>
<div class="tab-pane" id="customer" role="tabpanel"> <div class="tab-pane" id="customer" role="tabpanel">
<br>
<div class="table-responsive"> <div class="table-responsive">
<div class="row"> <table class="table table-striped">
<div class="col-md-6"> <thead>
<br> <tr>
<h4>Customer Profile</h4> <th>Card No</th>
<div class="table-responsive"> <th>Name</th>
<table class="table table-striped"> <th>Company</th>
<tbody> <th>Contact no</th>
<tr> <th>Email</th>
<th>Name</th> <th>NRC/Passport No</th>
<td><%= @customer.name %></td> <th>Address</th>
</tr> <th>DOB</th>
<tr> </tr>
<th>Email</th> </thead>
<td><%= @customer.email %></td>
</tr> <tbody>
<tr> <tr>
<th>Contact no</th> <td><%= @customer.card_no rescue '-'%></td>
<td><%= @customer.contact_no %></td> <td><%= @customer.name %></td>
</tr> <td><%= @customer.company rescue '-' %></td>
<tr> <td><%= @customer.contact_no %></td>
<th>Company</th> <td><%= @customer.email %></td>
<td><%= @customer.company %></td> <td><%= @customer.nrc_no %></td>
</tr> <td><%= @customer.address%></td>
<tr> <td><%= @customer.date_of_birth %></td>
<th>Date Of Birth</th> </tr>
<td><%= @customer.date_of_birth %> </td> <tr>
</tr> <th colspan="8">Membership Transactions</th>
</tbody> </tr>
</table> <tr>
</div> <th>Date</th>
</div> <th>Redeem</th>
<div class="col-md-6"> <th>Rebate</th>
<br> <th>Balance</th>
<h4>Membership Detail</h4> <!-- <th>Account No</th> -->
<div class="table-responsive"> <th>Status</th>
<table class="table table-striped"> <th>Receipt No</th>
<tbody> </tr>
<% if @membership == 0 %>
<tr> <%
<td colspan="2">"There is no membership data"</td> if @response["status"] == true %>
</tr> <% @response["data"].each do |transaction| %>
<% else %> <tr>
<% @membership.each do |member| %> <td><%= transaction["date"]%></td>
<tr> <td><%= transaction["redeem"]%></td>
<th><%= member["accountable_type"] %></th> <td><%= transaction["rebate"] %></td>
<td><%= member["balance"] %></td> <td><%= transaction["balance"] %></td>
</tr> <!-- <td><%= transaction["account_no"] %></td> -->
<% end %> <td><%= transaction["status"] %></td>
<td><%= transaction["receipt_no"] %></td>
<% end %>
</tbody> </tr>
</table> <% end %>
</div> <% end %>
</div> </tbody>
</div> </table>
</div> </div>
</div> </div>