Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //- Author: Tony Visconti
- //- Date Created: 8-11-23
- //- 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
- <html document-width="8.5" document-height="11" document-name="Registrants Export as of {{ 'Now' | Date:'M/d/yyyy' }}.pdf" autogenerate-bookmarks="true"
- table-header-repeat-enabled="true" avoid-image-breaks="true"
- image-scaling-enabled="false" reset-page-numbers-per-row="true">
- <style>
- .page-break-before {
- page-break-before: always
- }
- body {
- font-family: Arial, sans-serif;
- margin: 50px;
- padding: 0;
- min-height: 100vh;
- }
- .container {
- border-radius: 10px;
- box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.2);
- border: 4px solid #3498db;
- padding: 20px;
- width: 90%;
- margin-top:50px
- }
- h1 {
- font-size: 24px;
- margin-bottom: 10px;
- }
- p, li {
- font-size: 18px;
- margin-bottom: 10px;
- }
- .info-label {
- font-weight: bold;
- }
- header {
- background-color: #f5f5f5;
- }
- </style>
- <body>
- <header height=".1" spacing="1" background-color="#c80505">
- //-{% assign rowfirst = Rows | First %}
- //-<h1>{{rowfirst.Registration.RegistrationInstance.Name}} Registrant</h1>
- </header>
- {% assign rowfirst = Rows | First %}
- //-<BR>Registration Instance ID: {{ rowfirst.Registration.RegistrationInstanceId }}<BR>
- {% sql %}
- SELECT
- --PA.PersonId AS PersonId,
- RR.Id AS RegistrationRegistrantId,
- RR.PersonAliasId,
- --RI.Name AS [Registration Instance Name],
- P.FirstName,
- P.LastName,
- RTFF.[Order],
- --A.Id,
- A.Name AS AttributeName,
- AV.PersistedCondensedTextValue AS ValueFormatted,
- IsGridField
- FROM RegistrationInstance RI
- JOIN Registration R ON R.RegistrationInstanceId = RI.Id
- JOIN RegistrationTemplate RT ON RT.Id = RI.RegistrationTemplateId
- JOIN RegistrationTemplateForm RTF ON RTF.RegistrationTemplateId = RT.Id
- JOIN RegistrationTemplateFormField RTFF ON RTFF.RegistrationTemplateFormId = RTF.Id
- JOIN RegistrationRegistrant RR ON RR.RegistrationId = R.Id
- JOIN Attribute A ON RTFF.AttributeId = A.Id
- JOIN PersonAlias PA ON PA.Id = RR.PersonAliasId
- JOIN Person P ON P.Id = PA.PersonId
- LEFT JOIN AttributeValue AV ON AV.AttributeId = A.Id AND (EntityId = PA.PersonId OR EntityId = RR.Id)
- WHERE
- RI.Id = {{ rowfirst.Registration.RegistrationInstanceId }}
- ORDER BY P.Id, RTFF.[Order]
- {% endsql %}
- {% for row in Rows %}
- <div class="page-break-before wrapper container">
- <h1>{{row.Registration.RegistrationInstance.Name}} Registrant # {{forloop.index}}</h1>
- <h2>{{row.Person.FullName}} </h2>
- <h3>Registered by {{row.Registration.FirstName}} {{row.Registration.LastName}} on {{ row.CreatedDateTime }}</h3>
- <p><span class="info-label">Address:</span> {{row.Person | Address:'Home'}}
- <br><span class="info-label">Gender:</span> {{row.Person.Gender}}
- <br><span class="info-label">Birthdate:</span> {{row.Person.BirthDate | Date:'M/d/yyyy'}}</p>
- <h2>Registration Questions/Answers:</h2>
- <ul>
- {% assign tempItem = results | Where:'RegistrationRegistrantId', row.Id %}
- //-<br>{{ tempItem | ToJSON}}
- {% for item in tempItem %}
- {%- if item.IsGridField == 'true' -%}
- <li><span class="info-label">{{ item.AttributeName }}: </span>
- {%- if item.ValueFormatted and item.ValueFormatted != empty -%}
- {{ item.ValueFormatted }}
- {%- else -%}
- No Value Entered
- {%- endif -%}
- </li>
- {%- endif -%}
- {% endfor %} //- end of for loop through attributes
- {% comment %}
- //- Unfortunately a rows attributes are only populated with registrant attributes, many of our forms make use of person attributes so this will not work
- {% for attribute in row.AttributeValues %}
- {%- if attribute.AttributeIsGridColumn -%}
- <li><span class="info-label">{{ attribute.AttributeName }}: </span>
- {%- if attribute.ValueFormatted != "" -%}
- {{ attribute.ValueFormatted }}
- {%- else -%}
- No Value Entered
- {%- endif -%}
- </li>
- {%- endif -%}
- {% endfor %} //- end of for loop through attributes
- {% endcomment %}
- </ul>
- {% assign feeCount = row.Fees | Size %}
- {% if feeCount > 0 %}
- <h2>Fees:</h2>
- <p><span class="info-label">{{ row.Registration.RegistrationInstance.RegistrationTemplate.FeeTerm | PluralizeForQuantity:registrantCount }} </span></p>
- <ul>
- {% for fee in row.Fees %}
- <li><span class="info-label">{{ fee.RegistrationTemplateFee.Name }}: </span>
- {%- if fee.Quantity > 1 -%} {{ fee.RegistrationTemplateFee.Name }} ({{ fee.Quantity }} @ {{ fee.Cost | FormatAsCurrency }})
- | Fee Total Cost: {{ fee.TotalCost | FormatAsCurrency }}
- {%- else -%} None Selected {%- endif -%}
- </li>
- {% endfor %} //- end of for loop through fees
- </ul>
- {% endif %}
- </div>
- <footer height=".1" spacing="2">
- //-This is the footer.
- //- add footer text here if desired
- [page] of [topage];
- </footer>
- {% endfor %} //- end of for loop through rows
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement