2017-03-29 07:09:14 +00:00
|
|
|
<% content_for :page_specific_css do %>
|
|
|
|
<%= stylesheet_link_tag "client_management/backend" %>
|
|
|
|
<% end %>
|
|
|
|
|
2017-04-10 08:21:41 +00:00
|
|
|
<div class="page-receipts page-client">
|
2017-03-29 07:09:14 +00:00
|
|
|
<div class="info-contract">
|
|
|
|
<h3 class="sub-title">
|
2017-04-10 08:21:41 +00:00
|
|
|
Purchase Info
|
2017-03-29 07:09:14 +00:00
|
|
|
<% if @purchase.total_amount == (@total_received_amount + @total_adjustable_amount) %>
|
2017-04-10 08:21:41 +00:00
|
|
|
<span class="label label-success">Received</span>
|
2017-03-29 07:09:14 +00:00
|
|
|
<% else %>
|
2017-04-10 08:21:41 +00:00
|
|
|
<span class="label label-important">Pending</span>
|
2017-03-29 07:09:14 +00:00
|
|
|
<% end %>
|
|
|
|
</h3>
|
|
|
|
<div class="line-content">
|
|
|
|
<span class="header-line">Contract Id :</span>
|
|
|
|
<span class="content-line"><%= @contract.uid %></span>
|
|
|
|
</div>
|
|
|
|
<div class="line-content">
|
|
|
|
<span class="header-line">Contract Date :</span>
|
|
|
|
<span class="content-line"><%= @contract.created_at.strftime("%Y, %B %d") %></span>
|
|
|
|
</div>
|
|
|
|
<div class="line-content">
|
|
|
|
<span class="header-line">Total Amount :</span>
|
|
|
|
<span class="content-line"><%= @purchase.total_amount %> NTD.</span>
|
|
|
|
</div>
|
|
|
|
<div class="line-content">
|
|
|
|
<span class="header-line">Amount Received :</span>
|
|
|
|
<span class="content-line" style="color: green;"><%= @total_received_amount %> NTD.</span>
|
|
|
|
</div>
|
|
|
|
<div class="line-content">
|
|
|
|
<span class="header-line">Amount Adjusted :</span>
|
|
|
|
<span class="content-line" style="color: indigo;"><%= @total_adjustable_amount %> NTD.</span>
|
|
|
|
</div>
|
|
|
|
<div class="line-content">
|
|
|
|
<span class="header-line">Amount Pending :</span>
|
|
|
|
<span class="content-line" style="color: red;"><%= @purchase.total_amount - (@total_received_amount + @total_adjustable_amount) %> NTD.</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
2017-04-10 08:21:41 +00:00
|
|
|
<div class="info-receipts">
|
|
|
|
<table class="table main-list">
|
|
|
|
<thead>
|
|
|
|
<tr class="sort-header">
|
|
|
|
<% ["client_management.receipt_number", "client_management.amount", "client_management.amount_received", "client_management.amount_pending", "client_management.receipt_status", :actions].each_with_index do |f,i| %>
|
|
|
|
<%= thead(f) %>
|
|
|
|
<% end %>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<% if !@purchase.purchase_receipts.blank? %>
|
|
|
|
<% @purchase.purchase_receipts.each do |pr| %>
|
|
|
|
<tr>
|
|
|
|
<td><%= pr.receipt_number %></td>
|
|
|
|
<td><%= pr.amount %></td>
|
|
|
|
<td style="color:green;"><%= pr.amount_received %></td>
|
|
|
|
<td style="color:red;"><%= pr.amount_pending %></td>
|
|
|
|
<td>
|
|
|
|
<% if pr.is_pending? %>
|
|
|
|
<span class="label label-important">Pending</span>
|
|
|
|
<% else %>
|
|
|
|
<span class="label label-success">Cleared</span>
|
|
|
|
<% end %>
|
|
|
|
</td>
|
|
|
|
<td><a href="<%= edit_receipt_admin_client_management_path(pr.id) %>" class="btn btn-warning">Edit</a></td>
|
|
|
|
</tr>
|
|
|
|
<% end %>
|
|
|
|
<% else %>
|
2017-03-29 07:09:14 +00:00
|
|
|
<tr>
|
2017-04-10 08:21:41 +00:00
|
|
|
<td colspan="6" style="text-align: center;">No receipts issued.</td>
|
2017-03-29 07:09:14 +00:00
|
|
|
</tr>
|
|
|
|
<% end %>
|
2017-04-10 08:21:41 +00:00
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
<div class="info-contract-buttons">
|
|
|
|
<div class="line-content button">
|
|
|
|
<% if @purchase.total_amount > (@total_received_amount + @total_adjustable_amount) %>
|
|
|
|
<a class="btn btn-info" href="<%= add_receipt_admin_client_management_path(@purchase.id) %>">Add Receipt</a>
|
2017-03-29 07:09:14 +00:00
|
|
|
<% end %>
|
2017-04-10 08:21:41 +00:00
|
|
|
<a class="btn" href="<%= see_contract_admin_client_management_path(@contract.id) %>">Back to Contract</a>
|
|
|
|
</div>
|
2017-03-29 07:09:14 +00:00
|
|
|
</div>
|
|
|
|
</div>
|