From 5eb925c2cd04f0333f33729919a5bde2d8e7dda0 Mon Sep 17 00:00:00 2001 From: Dan Gowans Date: Mon, 27 Feb 2023 14:30:23 -0500 Subject: [PATCH] fix missing quantity calculation --- views/print/pdf/ssm.cemetery.contract.ejs | 329 +++++++++++----------- 1 file changed, 168 insertions(+), 161 deletions(-) diff --git a/views/print/pdf/ssm.cemetery.contract.ejs b/views/print/pdf/ssm.cemetery.contract.ejs index 4cdd7e8e..5053d06a 100644 --- a/views/print/pdf/ssm.cemetery.contract.ejs +++ b/views/print/pdf/ssm.cemetery.contract.ejs @@ -32,42 +32,42 @@ <%- include('style.css'); %> body { - margin: 0 50px; + margin: 0 50px; } @page { - margin: 50px 0; + margin: 50px 0; } .termsList { - counter-reset: list; + counter-reset: list; } .termsList > li { - list-style: none; - position: relative; - padding-bottom: 10px; + list-style: none; + position: relative; + padding-bottom: 10px; } .termsList > li::before { - content: "(" counter(list, lower-alpha) ")"; - counter-increment: list; - position: absolute; - left: -1.8em; + content: "(" counter(list, lower-alpha) ")"; + counter-increment: list; + position: absolute; + left: -1.8em; } .confirmList > li { - list-style: none; - position: relative; - padding-bottom: 10px; + list-style: none; + position: relative; + padding-bottom: 10px; } .confirmList > li::before { - content: "▢"; - position: absolute; - left: -1.4em; - top: -0.2em; - font-size: 15pt; + content: "▢"; + position: absolute; + left: -1.4em; + top: -0.2em; + font-size: 15pt; } @@ -79,7 +79,7 @@

in - <%= lotOccupancy.mapName %> + <%= lotOccupancy.mapName %> cemetery
operated by
@@ -103,80 +103,80 @@

- - + + - - + +
-

Purchaser

+
+

Purchaser

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name: + <%= purchaser ? purchaser.occupantName + ' ' + purchaser.occupantFamilyName : "" %> +
Address:<%= purchaser ? purchaser.occupantAddress1 : "" %> 
<%= purchaser ? purchaser.occupantAddress2 : "" %> 
City:<%= purchaser ? purchaser.occupantCity : "" %> 
Province:<%= purchaser ? purchaser.occupantProvince : "" %> 
Postal Code:<%= purchaser ? purchaser.occupantPostalCode : "" %> 
Telephone:<%= purchaser ? purchaser.occupantPhoneNumber : "" %> 
E-mail:<%= purchaser ? purchaser.occupantEmailAddress : "" %> 
+
+

Recipient

- - + + - - + + - + - - + + - - + + - - + + - - + + - - + + + + + + + +
Name: - <%= purchaser ? purchaser.occupantName + ' ' + purchaser.occupantFamilyName : "" %> - Name: + <%= recipient ? recipient.occupantName + ' ' + recipient.occupantFamilyName : "" %> +
Address:<%= purchaser ? purchaser.occupantAddress1 : "" %> Address:<%= recipient ? recipient.occupantAddress1 : "" %> 
<%= purchaser ? purchaser.occupantAddress2 : "" %> <%= recipient ? recipient.occupantAddress2 : "" %> 
City:<%= purchaser ? purchaser.occupantCity : "" %> City:<%= recipient ? recipient.occupantCity : "" %> 
Province:<%= purchaser ? purchaser.occupantProvince : "" %> Province:<%= recipient ? recipient.occupantProvince : "" %> 
Postal Code:<%= purchaser ? purchaser.occupantPostalCode : "" %> Postal Code:<%= recipient ? recipient.occupantPostalCode : "" %> 
Telephone:<%= purchaser ? purchaser.occupantPhoneNumber : "" %> Telephone:<%= recipient ? recipient.occupantPhoneNumber : "" %> 
E-mail:<%= purchaser ? purchaser.occupantEmailAddress : "" %> E-mail:<%= recipient ? recipient.occupantEmailAddress : "" %> 
Date of birth: 
Place of birth: 
-
-

Recipient

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Name: - <%= recipient ? recipient.occupantName + ' ' + recipient.occupantFamilyName : "" %> -
Address:<%= recipient ? recipient.occupantAddress1 : "" %> 
<%= recipient ? recipient.occupantAddress2 : "" %> 
City:<%= recipient ? recipient.occupantCity : "" %> 
Province:<%= recipient ? recipient.occupantProvince : "" %> 
Postal Code:<%= recipient ? recipient.occupantPostalCode : "" %> 
Telephone:<%= recipient ? recipient.occupantPhoneNumber : "" %> 
E-mail:<%= recipient ? recipient.occupantEmailAddress : "" %> 
Date of birth: 
Place of birth: 
-

@@ -206,81 +206,88 @@

Details

- - + + - - + + <% - for (const field of lotOccupancy.lotOccupancyFields) { - if (field.lotOccupancyFieldValue) { + for (const field of lotOccupancy.lotOccupancyFields) { + if (field.lotOccupancyFieldValue) { %> - - + + <% - } } + } %>
<%= configFunctions.getProperty("aliases.map") %><%= lotOccupancy.mapName %><%= configFunctions.getProperty("aliases.map") %><%= lotOccupancy.mapName ?? '(No ' + configFunctions.getProperty("aliases.map") + ')' %>
<%= configFunctions.getProperty("aliases.lot") %><%= lotOccupancy.lotName %><%= configFunctions.getProperty("aliases.lot") %><%= lotOccupancy.lotName ?? '(No ' + configFunctions.getProperty("aliases.lot") + ')' %>
<%= field.occupancyTypeField %><%= field.lotOccupancyFieldValue %><%= field.occupancyTypeField %><%= field.lotOccupancyFieldValue %>
-

Interment Rights and Services

- - - <% - let currentFeeCategory = ""; - let feeAmountTotal = 0; - let taxAmountTotal = 0; - %> - <% for (const fee of lotOccupancy.lotOccupancyFees) { %> - <% if (currentFeeCategory !== fee.feeCategory) { %> - - - - <% currentFeeCategory = fee.feeCategory; %> - <% } %> +

Interment Rights and Services

+
- <%= fee.feeCategory %> -
+ + <% + let currentFeeCategory = ""; + let feeAmountTotal = 0; + let taxAmountTotal = 0; + %> + <% for (const fee of lotOccupancy.lotOccupancyFees) { %> + <% if (currentFeeCategory !== fee.feeCategory) { %> - - + - <% - feeAmountTotal += fee.feeAmount; - taxAmountTotal += fee.taxAmount; - %> - <% } %> - - - + - - + <% if (fee.quantity !== 1) { %> + + <% } %> - - - - - - - - -
- <%= fee.feeName %> - - $<%= fee.feeAmount.toFixed(2) %> - + <%= fee.feeCategory %> +
Sub Total - $<%= feeAmountTotal.toFixed(2) %> + <% currentFeeCategory = fee.feeCategory; %> + <% } %> +
colspan="2"<% } %>> + <%= fee.feeName %>
HST + $<%= fee.feeAmount.toFixed(2) %> + × + <%= fee.quantity %> + - $<%= taxAmountTotal.toFixed(2) %> + $<%= fee.feeAmount.toFixed(2) %>
Total Sale - $<%= (feeAmountTotal + taxAmountTotal).toFixed(2) %> -
Balance Owing - $<%= (feeAmountTotal + taxAmountTotal - lotOccupancyFunctions.getTransactionTotal(lotOccupancy)).toFixed(2) %> -
+ + <% + feeAmountTotal += fee.feeAmount * fee.quantity; + taxAmountTotal += fee.taxAmount * fee.quantity; + %> + <% } %> + + Sub Total + + $<%= feeAmountTotal.toFixed(2) %> + + + HST + + $<%= taxAmountTotal.toFixed(2) %> + + + Total Sale + + $<%= (feeAmountTotal + taxAmountTotal).toFixed(2) %> + + + Balance Owing + + $<%= (feeAmountTotal + taxAmountTotal - lotOccupancyFunctions.getTransactionTotal(lotOccupancy)).toFixed(2) %> + + + + @@ -288,36 +295,36 @@

- Contribution Levels to the Care and Maintenance Fund
- (based on the price of Interment Rights and as prescribed by the Funeral, Burial and Cremation Services Act) + Contribution Levels to the Care and Maintenance Fund
+ (based on the price of Interment Rights and as prescribed by the Funeral, Burial and Cremation Services Act)

- - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + +
Nichesthe greater of 15% and $100
Cryptsthe greater of 20% and $500
- In-ground grave (2.23 sq.m. or 24 sq.ft. or larger) - - the greater of 40% and $250 -
In-ground grave (smaller than 2.23 sq.m. or 24 sq ft)the greater of 40% and $150
Nichesthe greater of 15% and $100
Cryptsthe greater of 20% and $500
+ In-ground grave (2.23 sq.m. or 24 sq.ft. or larger) + + the greater of 40% and $250 +
In-ground grave (smaller than 2.23 sq.m. or 24 sq ft)the greater of 40% and $150

- Contribution Levels to the Care and Maintenance Fund - Markers
- (as prescribed by the Funeral, Burial and Cremation Services Act) + Contribution Levels to the Care and Maintenance Fund - Markers
+ (as prescribed by the Funeral, Burial and Cremation Services Act)