client_management/app/views/admin/client_managements/receipts.html.erb

81 lines
3.0 KiB
Plaintext

<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "client_management/backend" %>
<% end %>
<div class="page-contract page-client">
<div class="info-contract">
<h3 class="sub-title">
<% if @purchase.total_amount == (@total_received_amount + @total_adjustable_amount) %>
<span class="label label-success pull-right">Received</span>
<% else %>
<span class="label label-important pull-right">Pending</span>
<% end %>
Purchase Info
</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>
</div>
<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 %>
<tr>
<td colspan="6" style="text-align: center;">No receipts issued.</td>
</tr>
<% end %>
</tbody>
</table>
<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>
<% end %>
<a class="btn" href="<%= see_contract_admin_client_management_path(@contract.id) %>">Back to Contract</a>
</div>
</div>