Advertisement
DataCCIW

Single Page Registrant Info PDF

Aug 11th, 2023
1,062
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 6.10 KB | None | 0 0
  1. //- Author: Tony Visconti
  2. //- Date Created: 8-11-23
  3. //- Purpose: Rock Merge Template that can be leveraged from the Registrants tab to generate a pdf with one page per registrant and their registration info
  4.  
  5. <html document-width="8.5" document-height="11" document-name="Registrants Export as of {{ 'Now' | Date:'M/d/yyyy' }}.pdf" autogenerate-bookmarks="true"
  6.    table-header-repeat-enabled="true" avoid-image-breaks="true"
  7.    image-scaling-enabled="false" reset-page-numbers-per-row="true">
  8. <style>
  9.     .page-break-before {
  10.         page-break-before: always
  11.     }
  12.     body {
  13.         font-family: Arial, sans-serif;
  14.         margin: 50px;
  15.         padding: 0;
  16.         min-height: 100vh;
  17.     }
  18.     .container {
  19.         border-radius: 10px;
  20.         box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.2);
  21.         border: 4px solid #3498db;
  22.         padding: 20px;
  23.         width: 90%;
  24.         margin-top:50px
  25.     }
  26.     h1 {
  27.         font-size: 24px;
  28.         margin-bottom: 10px;
  29.     }
  30.     p, li {
  31.         font-size: 18px;
  32.         margin-bottom: 10px;
  33.     }
  34.     .info-label {
  35.         font-weight: bold;
  36.     }
  37.  
  38.     header {
  39.         background-color: #f5f5f5;
  40.     }
  41.  
  42. </style>
  43.  
  44. <body>
  45.     <header height=".1" spacing="1" background-color="#c80505">
  46.         //-{% assign rowfirst = Rows | First %}
  47.         //-<h1>{{rowfirst.Registration.RegistrationInstance.Name}} Registrant</h1>
  48.     </header>
  49.  
  50.     {% assign rowfirst = Rows | First %}
  51.     //-<BR>Registration Instance ID: {{ rowfirst.Registration.RegistrationInstanceId }}<BR>
  52.     {% sql %}
  53.         SELECT
  54.           --PA.PersonId AS PersonId,
  55.           RR.Id AS RegistrationRegistrantId,
  56.           RR.PersonAliasId,
  57.           --RI.Name AS [Registration Instance Name],
  58.           P.FirstName,
  59.           P.LastName,
  60.           RTFF.[Order],
  61.           --A.Id,
  62.           A.Name AS AttributeName,
  63.           AV.PersistedCondensedTextValue AS ValueFormatted,
  64.           IsGridField
  65.         FROM  RegistrationInstance RI
  66.         JOIN Registration R ON R.RegistrationInstanceId = RI.Id
  67.         JOIN RegistrationTemplate RT ON RT.Id = RI.RegistrationTemplateId
  68.         JOIN RegistrationTemplateForm RTF ON RTF.RegistrationTemplateId = RT.Id
  69.         JOIN RegistrationTemplateFormField RTFF ON RTFF.RegistrationTemplateFormId = RTF.Id
  70.         JOIN  RegistrationRegistrant RR ON RR.RegistrationId = R.Id
  71.         JOIN Attribute A ON RTFF.AttributeId = A.Id
  72.         JOIN PersonAlias PA ON PA.Id = RR.PersonAliasId
  73.         JOIN Person P ON P.Id = PA.PersonId
  74.         LEFT JOIN AttributeValue AV ON AV.AttributeId = A.Id AND (EntityId = PA.PersonId OR EntityId = RR.Id)
  75.         WHERE
  76.           RI.Id = {{ rowfirst.Registration.RegistrationInstanceId }}
  77.         ORDER BY P.Id, RTFF.[Order]
  78.     {% endsql %}
  79.  
  80.     {% for row in Rows %}
  81.         <div class="page-break-before wrapper container">
  82.             <h1>{{row.Registration.RegistrationInstance.Name}} Registrant # {{forloop.index}}</h1>
  83.             <h2>{{row.Person.FullName}} </h2>
  84.             <h3>Registered by {{row.Registration.FirstName}} {{row.Registration.LastName}} on {{ row.CreatedDateTime }}</h3>
  85.             <p><span class="info-label">Address:</span> {{row.Person | Address:'Home'}}
  86.             <br><span class="info-label">Gender:</span> {{row.Person.Gender}}
  87.             <br><span class="info-label">Birthdate:</span> {{row.Person.BirthDate | Date:'M/d/yyyy'}}</p>
  88.  
  89.             <h2>Registration Questions/Answers:</h2>
  90.             <ul>
  91.                 {% assign tempItem = results | Where:'RegistrationRegistrantId', row.Id %}
  92.                 //-<br>{{ tempItem | ToJSON}}
  93.                 {% for item in tempItem %}
  94.                     {%- if item.IsGridField == 'true' -%}
  95.                     <li><span class="info-label">{{ item.AttributeName }}: </span>
  96.                         {%- if item.ValueFormatted and item.ValueFormatted != empty -%}
  97.                             {{ item.ValueFormatted }}
  98.                         {%- else -%}
  99.                             No Value Entered
  100.                         {%- endif -%}
  101.                         </li>
  102.                     {%- endif -%}
  103.                 {% endfor %} //- end of for loop through attributes
  104.  
  105.                 {% comment %}
  106.                 //- Unfortunately a rows attributes are only populated with registrant attributes, many of our forms make use of person attributes so this will not work
  107.                 {% for attribute in row.AttributeValues %}
  108.                     {%- if attribute.AttributeIsGridColumn -%}
  109.                     <li><span class="info-label">{{ attribute.AttributeName }}: </span>
  110.                         {%- if attribute.ValueFormatted != "" -%}
  111.                             {{ attribute.ValueFormatted }}
  112.                         {%- else -%}
  113.                             No Value Entered
  114.                         {%- endif -%}
  115.                         </li>
  116.                     {%- endif -%}
  117.                 {% endfor %} //- end of for loop through attributes
  118.                 {% endcomment %}
  119.             </ul>
  120.  
  121.  
  122.             {% assign feeCount = row.Fees | Size %}
  123.             {% if feeCount > 0 %}
  124.                 <h2>Fees:</h2>
  125.                 <p><span class="info-label">{{ row.Registration.RegistrationInstance.RegistrationTemplate.FeeTerm | PluralizeForQuantity:registrantCount }} </span></p>
  126.                 <ul>
  127.                 {% for fee in row.Fees %}
  128.  
  129.                     <li><span class="info-label">{{ fee.RegistrationTemplateFee.Name }}: </span>
  130.                     {%- if fee.Quantity > 1 -%} {{ fee.RegistrationTemplateFee.Name }} ({{ fee.Quantity }} @ {{ fee.Cost | FormatAsCurrency }})
  131.                     | Fee Total Cost: {{ fee.TotalCost | FormatAsCurrency }}
  132.                     {%- else -%} None Selected {%- endif -%}
  133.                     </li>
  134.                 {% endfor %} //- end of for loop through fees
  135.                 </ul>
  136.             {% endif %}
  137.         </div>
  138.  
  139.         <footer height=".1" spacing="2">
  140.             //-This is the footer.
  141.             //- add footer text here if desired
  142.             [page] of [topage];
  143.         </footer>
  144.  
  145.      {% endfor %} //- end of for loop through rows
  146.  
  147. </body>
  148.  
  149. </html>
  150.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement