<%- include('_header'); -%>

Contract #<%= contract.contractId %>: <%= contract.burialSiteName || "(No Burial Site)" %>

Contract #<%= contract.contractId %>: <%= contract.burialSiteName ?? "(No Burial Site)" %>
<% if (contractTypePrints.length > 0) { %> <% if (contractTypePrints.length === 1) { %> Print <% } else { %> <% } %> <% } %> <% if (user.userProperties.canUpdate) { %> " href="<%= urlPrefix %>/contracts/<%= contract.contractId %>/edit" accesskey="e"> Switch to Edit Mode Edit <% } %>

Contract Type
<%= contract.contractType %>

Burial Site
<% if (contract.burialSiteId) { %> <%= contract.burialSiteName %> <% } else { %> (No Burial Site) <% } %>

Cemetery
<% if (contract.cemeteryId) { %> <%= contract.cemeteryName %> <% } else { %> (No Cemetery) <% } %>

Contract Date
<%= contract.contractStartDateString %>

End Date
<% if (contract.contractEndDateString === "") { %> (No End Date) <% } else { %> <%= contract.contractEndDateString %> <% } %>

<% if (contract.contractFields.length > 0) { %>
<% for (const contractField of contract.contractFields) { %>

<%= contractField.contractTypeField %>
<% if (contractField.contractFieldValue) { %> <%= contractField.contractFieldValue %> <% } else { %> (No Value) <% } %>

<% } %>
<% } %>

Funeral

Funeral Home
<% if (contract.funeralHomeName === null) { %> (No Funeral Home) <% } else { %> <%= contract.funeralHomeName %> <% } %>
<% if (contract.funeralHomeAddress1) { %> <%= contract.funeralHomeAddress1 %>
<% } %> <% if (contract.funeralHomeAddress2) { %> <%= contract.funeralHomeAddress2 %>
<% } %> <% if (contract.funeralHomeCity) { %> <%= contract.funeralHomeCity %>, <% } %> <%= contract.funeralHomeProvince %>
<%= contract.funeralHomePostalCode %>

<% if ((contract.funeralHomePhoneNumber ?? '') !== '') { %>

Phone
<%= contract.funeralHomePhoneNumber %>

<% } %> <% if ((contract.funeralHomeEmail ?? '') !== '') { %>

Email
<%= contract.funeralHomeEmail %>

<% } %>

Funeral Director's Name
<%= contract.funeralDirectorName %>

Service Date
<%= contract.funeralDateString %>

Service Time
<%= contract.funeralTimePeriodString %>

Committal Type
<% if (contract.committalType === null) { %> (No Committal Type) <% } else { %> <%= contract.committalType %> <% } %>

Purchaser

<%= contract.purchaserName %>
<% if (contract.purchaserAddress1) { %> <%= contract.purchaserAddress1 %>
<% } %> <% if (contract.purchaserAddress2) { %> <%= contract.purchaserAddress2 %>
<% } %> <% if (contract.purchaserCity) { %> <%= contract.purchaserCity %>, <% } %> <%= contract.purchaserProvince %>
<%= contract.purchaserPostalCode %>

<% if ((contract.purchaserPhoneNumber ?? '') !== '') { %>

Phone
<%= contract.purchaserPhoneNumber %>

<% } %> <% if ((contract.purchaserEmail ?? '') !== '') { %>

Email
<%= contract.purchaserEmail %>

<% } %>

Relationship to <%= (contract.isPreneed ? "Recipient" : "Deceased") %>
<%= contract.purchaserRelationship %>

<%= (contract.isPreneed ? "Recipient" : "Deceased") %>

<% if (contract.contractInterments.length === 0) { %>

There are no interments associated with this record.

<% } else { %> <% for (const contractInterment of contract.contractInterments) { %> <% } %>
<%= (contract.isPreneed ? "Recipient" : "Deceased") %> Details
<%= contractInterment.deceasedName %>
<% if (contractInterment.deceasedAddress1) { %> <%= contractInterment.deceasedAddress1 %>
<% } %> <% if (contractInterment.deceasedAddress2) { %> <%= contractInterment.deceasedAddress2 %>
<% } %> <% if (contractInterment.deceasedCity) { %> <%= contractInterment.deceasedCity %>, <% } %> <%= contractInterment.deceasedProvince %>
<%= contractInterment.deceasedPostalCode %>
Birth:
<% if (contractInterment.birthDateString === '') { %> (No Birth Date) <% } else { %> <%= contractInterment.birthDateString %> <% } %>
<%= contractInterment.birthPlace %>
Death:
<% if (contractInterment.deathDateString === '') { %> (No Death Date) <% } else { %> <%= contractInterment.deathDateString %> <% } %>
<%= contractInterment.deathPlace %>
Age:
<%= contractInterment.deathAge %> <%= contractInterment.deathAgePeriod %>
Container:
<%= contractInterment.intermentContainerType ?? '(No Container Type)' %>
<% } %>

Fees

<% if (contract.contractFees.length === 0) { %>

There are no fees applied to this contract.

<% } else { %> <% let feeAmountTotal = 0; let taxAmountTotal = 0; %> <% for (const contractFee of contract.contractFees) { %> <% feeAmountTotal += (contractFee.feeAmount * contractFee.quantity); taxAmountTotal += (contractFee.taxAmount * contractFee.quantity); %> <% if (contractFee.quantity !== 1) { %> <% } %> <% } %>
Fee Unit Cost × Quantity = Total
"> <%= contractFee.feeName %>
<%= contractFee.feeCategory %>
$<%= contractFee.feeAmount.toFixed(2) %> × <%= contractFee.quantity %> =$<%= (contractFee.feeAmount * contractFee.quantity).toFixed(2) %>
Subtotal $<%= feeAmountTotal.toFixed(2) %>
Tax $<%= taxAmountTotal.toFixed(2) %>
Grand Total $<%= (feeAmountTotal + taxAmountTotal).toFixed(2) %>
<% } %>

Transactions

<% if (contract.contractTransactions.length === 0) { %>

There are no transactions associated with this contract.

<% } else { %> <% let transactionTotal = 0; %> <% for (const contractTransaction of contract.contractTransactions) { %> <% transactionTotal += contractTransaction.transactionAmount; %> <% } %>
Date <%= configFunctions.getConfigProperty("aliases.externalReceiptNumber") %> Amount
<%= contractTransaction.transactionDateString %> <% if (contractTransaction.externalReceiptNumber !== '') { %> <%= contractTransaction.externalReceiptNumber %> <% if (configFunctions.getConfigProperty('settings.dynamicsGP.integrationIsEnabled')) { %> <% if (contractTransaction.dynamicsGPDocument === undefined) { %> <% } else if (contractTransaction.dynamicsGPDocument.documentTotal.toFixed(2) === contractTransaction.transactionAmount.toFixed(2)) { %> <% } else { %> <% } %> <% } %>
<% } %> <%= contractTransaction.transactionNote %>
$<%= contractTransaction.transactionAmount.toFixed(2) %>
Transaction Total $<%= transactionTotal.toFixed(2) %>
<% } %>
<% if (contract.workOrders.length > 0) { %> <% const workOrderOpenDateAlias = configFunctions.getConfigProperty("aliases.workOrderOpenDate"); const workOrderCloseDateAlias = configFunctions.getConfigProperty("aliases.workOrderCloseDate"); %>

Work Orders

<% for (const workOrder of contract.workOrders) { %> <% } %>
Work Order Number Description Date
<%= workOrder.workOrderNumber %> <%= workOrder.workOrderType %>
<%= workOrder.workOrderDescription %>
<%= workOrder.workOrderOpenDateString %>
<% if (workOrder.workOrderCloseDate) { %> <%= workOrder.workOrderCloseDateString %> <% } else { %> (No <%= workOrderCloseDateAlias %>) <% } %>
<% } %> <% if (contract.contractComments.length > 0) { %>

Comments

<% for (const contractComment of contract.contractComments) { %> <% } %>
Commentor Comment Date Comment
<%= contractComment.recordCreate_userName %> <%= contractComment.commentDateString %> <%= (contractComment.commentTime === 0 ? "" : contractComment.commentTimePeriodString) %> <%= contractComment.comment %>
<% } %> <%- include('_footerA'); -%> <%- include('_footerB'); -%>