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
@customer = Customer.find(@sale.customer_id)
response = Customer.get_member_account(@customer)
if(response["status"] == true)
@membership = response["data"]
else
@membership = 0
end
@response = Customer.get_membership_transactions(@customer)
#end customer amount
respond_to do |format|

View File

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

View File

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