sunrise-cms/views/print/screen/contract.ejs

228 lines
8.7 KiB
Plaintext

<%- include('_header-print'); -%>
<h1 class="title is-2 has-text-centered">
Burial Site
Contract
</h1>
<div class="columns">
<div class="column">
<p>
<strong>Contract Type</strong><br />
<%= contract.contractType %>
</p>
</div>
<div class="column">
<p class="mb-2">
<strong>Burial Site</strong><br />
<% if (contract.burialSiteId) { %>
<%= contract.burialSiteName %>
<% } else { %>
(No Burial Site)
<% } %>
</p>
<p>
<strong>Cemetery</strong><br />
<% if (contract.cemeteryId) { %>
<%= contract.cemeteryName %>
<% } else { %>
(No Cemetery)
<% } %>
</p>
</div>
<div class="column">
<p class="mb-2">
<strong><%= configFunctions.getConfigProperty("aliases.occupancyStartDate") %></strong><br />
<%= contract.occupancyStartDateString %>
</p>
<p>
<strong>End Date</strong><br />
<%= (contract.occupancyEndDateString === "" ? "(No End Date)" : contract.occupancyEndDateString) %>
</p>
</div>
<% if (contract.contractFields.length > 0) { %>
<div class="column">
<% for (const contractField of contract.contractFields) { %>
<p class="mb-2">
<strong><%= contractField.contractTypeField %></strong><br />
<%= contractField.contractFieldValue || "(No Value)" %>
</p>
<% } %>
</div>
<% } %>
</div>
<section>
<h2 class="title is-4"><%= configFunctions.getConfigProperty("aliases.occupants") %></h2>
<% if (contract.contractOccupants.length === 0) { %>
<div class="message is-warning">
<p class="message-body">
There are no <%= configFunctions.getConfigProperty("aliases.occupants").toLowerCase() %>
associated with this record.
</p>
</div>
<% } else { %>
<table class="table is-fullwidth">
<thead>
<tr>
<th><%= configFunctions.getConfigProperty("aliases.occupant") %> Type</th>
<th><%= configFunctions.getConfigProperty("aliases.occupant") %></th>
<th>Address</th>
<th>Phone Number</th>
</tr>
</thead>
<tbody>
<% for (const contractOccupant of contract.contractOccupants) { %>
<tr>
<td><%= contractOccupant.lotOccupantType %></td>
<td><%= contractOccupant.occupantName %> <%= contractOccupant.occupantFamilyName %></td>
<td>
<%= contractOccupant.occupantAddress1 %><br />
<% if (contractOccupant.occupantAddress2 && contractOccupant.occupantAddress2 !== "") { %>
<%= contractOccupant.occupantAddress2 %><br />
<% } %>
<% if (contractOccupant.occupantCity) { %>
<%= contractOccupant.occupantCity %>,
<% } %>
<%= contractOccupant.occupantProvince %><br />
<%= contractOccupant.occupantPostalCode %>
</td>
<td>
<%= contractOccupant.occupantPhoneNumber %>
</td>
</tr>
<% } %>
</tbody>
</table>
<% } %>
</section>
<% if (contract.contractComments.length > 0) { %>
<section class="mt-4">
<h2 class="title is-4">Comments</h2>
<table class="table is-fullwidth">
<thead>
<tr>
<th>Commentor</th>
<th>Comment Date</th>
<th>Comment</th>
</tr>
</thead>
<tbody>
<% for (const contractComment of contract.contractComments) { %>
<tr>
<td><%= contractComment.recordCreate_userName %></td>
<td>
<%= contractComment.contractCommentDateString %>
<%= (contractComment.contractCommentTime === 0 ? "" : contractComment.contractCommentTimeString) %>
</td>
<td><%= contractComment.contractComment %></td>
</tr>
<% } %>
</tbody>
</table>
</section>
<% } %>
<section class="mt-4">
<h2 class="title is-4">Fees</h2>
<% if (contract.contractFees.length === 0) { %>
<div class="message is-info">
<p class="message-body">
There are no fees applied to this <%= configFunctions.getConfigProperty("aliases.occupancy").toLowerCase() %> record.
</p>
</div>
<% } else { %>
<%
let feeAmountTotal = 0;
let taxAmountTotal = 0;
%>
<table class="table is-fullwidth">
<thead>
<tr>
<th>Fee</th>
<th class="has-text-right"><span class="is-sr-only">Unit Cost</span></th>
<th class="has-width-1"><span class="is-sr-only">&times;</span></th>
<th class="has-width-1 has-text-right"><span class="is-sr-only">Quantity</span></th>
<th class="has-width-1"><span class="is-sr-only">=</span></th>
<th class="has-width-1 has-text-right">Total</th>
</tr>
</thead>
<tbody>
<% for (const contractFee of contract.contractFees) { %>
<%
feeAmountTotal += (contractFee.feeAmount * contractFee.quantity);
taxAmountTotal += (contractFee.taxAmount * contractFee.quantity);
%>
<tr>
<td colspan="<%= (contractFee.quantity === 1 ? "5" : "1") %>">
<%= contractFee.feeName %>
</td>
<% if (contractFee.quantity !== 1) { %>
<td class="has-text-right">$<%= contractFee.feeAmount.toFixed(2) %></td>
<td>&times;</td>
<td class="has-text-right"><%= contractFee.quantity %></td>
<td>=</td>
<% } %>
<td class="has-text-right">$<%= (contractFee.feeAmount * contractFee.quantity).toFixed(2) %></td>
</tr>
<% } %>
</tbody>
<tfoot>
<tr>
<th colspan="5">Subtotal</th>
<td class="has-text-right has-text-weight-bold">$<%= feeAmountTotal.toFixed(2) %></td>
</tr>
<tr>
<th colspan="5">Tax</th>
<td class="has-text-right">$<%= taxAmountTotal.toFixed(2) %></td>
</tr>
<tr>
<th colspan="5">Grand Total</th>
<td class="has-text-right has-text-weight-bold">$<%= (feeAmountTotal + taxAmountTotal).toFixed(2) %></td>
</tr>
</tfoot>
</table>
<% } %>
</section>
<section class="mt-4">
<h2 class="title is-4">Transactions</h2>
<% if (contract.contractTransactions.length === 0) { %>
<div class="message is-info">
<p class="message-body">
There are no transactions associated with this <%= configFunctions.getConfigProperty("aliases.occupancy").toLowerCase() %> record.
</p>
</div>
<% } else { %>
<table class="table is-fullwidth">
<thead>
<tr>
<th>Date</th>
<th><%= configFunctions.getConfigProperty("aliases.externalReceiptNumber") %></th>
<th class="has-text-right">Amount</th>
</tr>
</thead>
<tbody>
<% for (const contractTransaction of contract.contractTransactions) { %>
<tr>
<td><%= contractTransaction.transactionDateString %></td>
<td>
<%= contractTransaction.externalReceiptNumber %><br />
<small><%= contractTransaction.transactionNote %></small>
</td>
<td class="has-text-right">
$<%= contractTransaction.transactionAmount.toFixed(2) %>
</td>
</tr>
<% } %>
</tbody>
</table>
<% } %>
</section>
<%- include('_footer-print'); -%>