Announcement

Collapse
No announcement yet.

PDF template-issue (Duration display in seconds instead of hours

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • PDF template-issue (Duration display in seconds instead of hours

    The meetings entity has meeting 'startdate' and 'enddate' fields, and the duration of meeting is calculated and stored in the 'duration' field.

    I created a PDF template to export the meeting details into a pdf file, and everything worked perfectly except the duration.
    Duration is displayed in hours gets exported to seconds in the PDF file, I have attached the screenshot.

    {{duration}} is fetching 3,600
    {{duration_RAW}} is fetching 3600

    How is possible to display the duration in hours instead of seconds?

    Thanks in Advance

  • #2
    Hi cdmindya,
    1. Go to Administration > Entity Manager > Meeting > Fields and create a field with the Varchar type (screenshot 1);
    2. Go to Administration > Entity Manager > Meeting > Formula and create a formula (screenshot 2);
      Code:
      myDuration = duration/3600;
    3. Go to ​Administration >PDF Templates and insert a new placeholder {{myDuration}}​ into your template screenshot 3);
    4. Go to Administration > Layout Manager > Meetings > Detail (screenshot 4)​​
    It is very important: for you to succeed, you need to recalculate the formula in the old records before Print to PDF, or simply change anything in this record. For new meetings, everything will work immediately.
    Attached Files
    Last edited by victor; 09-20-2022, 03:29 PM.

    Comment


  • #3
    Thanks, victor yes that is very much possible by creating a new field and using calculation this can be achieved but is there a way or I am missing something to display the 'Duration'.

    Comment


    • victor
      victor commented
      Editing a comment
      Duration is calculated in seconds and I showed you the easiest way to convert seconds to hours (in my opinion). Perhaps someone will recommend an even simpler option, but for now you have a working option for your template.

  • #4
    Hi @victor,

    I could resolve this time conversion issue without creating a new variable, below the screenshot,
    I changed the "TIMESTAMPDIFF_SECOND" to "TIMESTAMPDIFF_HOUR" now the difference itself is displayed in Hours.

    Just thought to share, this may not be a good practice to do, and can lead to other related functions being affected.

    Click image for larger version

Name:	image.png
Views:	273
Size:	89.6 KB
ID:	83300​​
    Attached Files

    Comment


    • yuri
      yuri commented
      Editing a comment
      It's not good to modify the existing field. You'd rather create a separate field called durationHours.

  • #5
    Sorry off-topic but your PDF look beautiful. Can you share the code/template?

    Comment


    • #6
      Sure, thanks for asking. (Some lines deleted as not able to post full code please check once)

      Click image for larger version

Name:	image.png
Views:	320
Size:	76.0 KB
ID:	83334

      Code Start

      <table align="center" style="border-spacing:0; Margin:0; width:100%; max-width:600px;" border="0" cellpadding="4px" cellspacing="0.1px" width="100%">
      <tbody>
      <tr>
      <td align="Right" valign="middle" style="width: 20%; background-color:#41aea9; color:#FFFFFF; border-bottom: 0.1px solid white; border-top: 0.1px solid #41aea9;font-size: 18px; font-weight:bold;line-height: 24px;padding-top: 30px;padding-bottom: 30px; text-align:Right;text-shadow: 0px 0px #0d0000;">
      Project:
      </td>
      <td align="left" valign="middle" style="width: 35%; color:#41aea9; border-top: 0.1px solid #41aea9; border-right: 0.1px solid #41aea9; font-size:18px; font-weight: normal; line-height:24px; padding-top:30px; padding-bottom:30px; text-align:left; text-shadow: 0px 0px #0d0000;">
      {{parentName}}
      </td>

      <td align="left" valign="top" style="color:#41aea9; width: 5%; font-size:10px; font-weight:bold; padding-top:10px; padding-bottom:10px; text-align:left; text-shadow: 0px 0px #160101;">
      </td>
      <td align="Right" valign="middle" style="border-left: 0.1px solid #41aea9; border-right: 0.1px solid #41aea9; width: 40%; background-color:#41aea9; color:#FFFFFF; font-size:14px; font-weight:bold;line-height: 20px; padding-top:20px; padding-bottom:20px; vertical-align: middle;text-align:Right; /* text-shadow: 0px 0px #160101; */">
      Meeting Stakeholders</td>
      </tr>
      <tr>
      <td align="Right" valign="middle" style="border-bottom: 0.1px solid white; width: 20%; background-color:#41aea9; color:#FFFFFF; font-size:12px; font-weight:bold; line-height:15px; padding-top:15px; padding-bottom:15px; text-align:Right; text-shadow: 0px 0px #0d0000;">
      Title:
      </td>
      <td align="left" valign="middle" style="border-bottom: 0.1px solid #41aea9; border-right: 0.1px solid #41aea9; width: 35%; color:#41aea9; font-size:10px; font-weight: normal; line-height:15px; padding-top:15px; padding-bottom:15px; text-align:justify; text-shadow: 0px 0px #0d0000;">{{{name}}}
      </td>
      <td align="Right" valign="top" style="width: 5%; color:#41aea9; font-size:10px; font-weight:bold; line-height:100%; padding-top:15px; padding-bottom:15px; text-align:Right; text-shadow: 0px 0px #0d0000;">
      </td>
      <td align="Right" valign="bottom"style="border-left: 0.1px solid #41aea9; border-right: 0.1px solid #41aea9;border-bottom: 0.1px solid #41aea9; width: 40%; line-height: 15px; padding-top: 10px; padding-bottom: 10px; text-align: right; text-shadow: rgb(13, 0, 0) 0px 0px;">
      <p>
      <font color="#41aea9"><span style="font-size: 10px;"><b>Host</b><br>{{#each users}}
      {{#ifMultipleOf @key 3}}{{/ifMultipleOf}} {{usersNames}} {{name}}
      [{{title}}]{{/each}}</span></font>
      </p>

      </td>
      </tr>
      <tr text-align="justify;">
      <td align="Right" valign="middle" style="border-bottom: 0.1px solid white; width: 20%; background-color:#41aea9; color:#FFFFFF; font-size:10px; font-weight:bold; line-height:normal; padding-top:15px; padding-bottom:15px; text-align:Right; text-shadow: 0px 0px #0d0000;">
      Agenda
      </td>
      <td align="left" valign="middle" style="border-bottom: 0.1px solid #41aea9; border-right: 0.1px solid #41aea9; width: 35%; color:#41aea9; font-size:10px; font-weight: normal; line-height:15px; padding-top:15px; padding-bottom:15px; text-align:justify; text-shadow: 0px 0px #0d0000;"><p style="text-align:justify;">{{description}}</p>
      </td>
      <td align="Right" valign="top" rowspan="5" style="width: 5%; color:#41aea9; font-size:10px; font-weight:bold; line-height:100%; padding-top:15px; padding-bottom:15px; text-align:Right; text-shadow: 0px 0px #0d0000;">
      </td>
      <td align="Right" valign="bottom" rowspan="5" style="border-left: 0.1px solid #41aea9; border-right: 0.1px solid #41aea9;border-bottom: 0.1px solid #41aea9; width: 40%; line-height: 15px; padding-top: 10px; padding-bottom: 10px; text-align: right; text-shadow: rgb(13, 0, 0) 0px 0px;">

      <p>
      <font color="#41aea9"><span style="font-size: 10px;"><b>Attendees</b><br> {{#each contacts}}
      {{#ifMultipleOf @key 3}}{{/ifMultipleOf}} {{contactsNames}} {{name}},[{{role}}]<br>
      {{/each}}</span></font>
      </p>
      </td>
      </tr>

      <tr>
      <td align="Right" valign="middle" style="border-bottom: 0.1px solid white; width: 20%; background-color:#41aea9; color:#FFFFFF; font-size:10px; font-weight:bold; line-height:100%; padding-top:15px; padding-bottom:15px; text-align:Right; text-shadow: 0px 0px #0d0000;">
      Location
      </td>
      <td align="left" valign="middle" style="border-bottom: 0.1px solid #41aea9; border-right: 0.1px solid #41aea9; width: 35%; color:#41aea9; font-size:10px; font-weight: normal; line-height:100%; padding-top:15px; padding-bottom:15px; text-align:left; text-shadow: 0px 0px #0d0000;">
      Online web/Location
      </td>

      </tr>
      <tr>
      <td align="Right" valign="top" style="border-bottom: 0.1px solid white; width: 20%; background-color:#41aea9; color:#FFFFFF; font-size:10px; font-weight:bold; line-height:100%; padding-top:15px; padding-bottom:15px; text-align:Right; text-shadow: 0px 0px #0d0000;">
      Start Date/Time:
      </td>
      <td align="left" valign="top" style="border-bottom: 0.1px solid #41aea9; border-right: 0.1px solid #41aea9; width: 35%; color:#41aea9; font-size:10px; font-weight: normal; line-height:100%; padding-top:15px; padding-bottom:15px; text-align:left; text-shadow: 0px 0px #0d0000;">
      {{dateFormat dateStart_RAW format='DD MMMM YYYY HH:mm'}}
      </td>

      </tr>
      <tr>
      <td align="Right" valign="top" style="border-bottom: 0.1px solid #41aea9; width: 20%; background-color:#41aea9; color:#FFFFFF; font-size:10px; font-weight:bold; line-height:100%; padding-top:15px; padding-bottom:15px; text-align:Right; text-shadow: 0px 0px #0d0000;">
      End Date/Time:
      </td>
      <td align="left" valign="top" style="border-bottom: 0.1px solid #41aea9; border-right: 0.1px solid #41aea9; width: 35%; color:#41aea9; font-size:10px; font-weight: normal; line-height:100%; padding-top:15px; padding-bottom:15px; text-align:left; text-shadow: 0px 0px #0d0000;">
      {{dateFormat dateEnd_RAW format='DD MMMM YYYY HH:mm'}}
      </td>

      </tr>
      <tr>
      <td align="Right" valign="top" style="border-bottom: 0.1px solid #41aea9; width: 20%; background-color:#41aea9; color:#FFFFFF; font-size:10px; font-weight:bold; line-height:100%; padding-top:15px; padding-bottom:15px; text-align:Right; text-shadow: 0px 0px #0d0000;">
      Duration:
      </td>
      <td align="left" valign="top" style="border-bottom: 0.1px solid #41aea9; border-right: 0.1px solid #41aea9; width: 35%; color:#41aea9; font-size:10px; font-weight: normal; line-height:100%; padding-top:15px; padding-bottom:15px; text-align:left; text-shadow: 0px 0px #0d0000;">
      {{durationc}} (Minutes)
      </td>

      </tr>
      </tbody>
      </table>
      <span style="letter-spacing: 1.2px;">

      <br>

      </span>
      <hr style="line-height: 0.4; border-color: #176259;">
      <hr style="line-height: 0.4; border-color: #176259;">

      <table align="center" style="border-spacing:0; Margin:0; width:100%; max-width:600px;" border="0" cellpadding="4px" cellspacing="0.1px" width="100%">
      <tbody>
      <tr>
      <td align="left" valign="top" style="border-color: #176259; border-bottom: 0.1px solid white; border-right: 0.1px solid #176259; border-left: 0.1px solid #176259; width: 100%; background-color:#41aea9; color:#FFFFFF; font-size:10px; font-weight: normal; padding-top:10px; padding-bottom:10px; text-align:Left; text-shadow: 0px 0px #160101;" colspan="4" rowspan="1">
      Revision History:
      </td>
      </tr>
      <tr>
      <td align="Right" valign="top" style="border-color: #176259; border-bottom: 0.1px solid white; border-right: 0.1px solid #176259; border-left: 0.1px solid #176259; width: 15%; background-color:#41aea9; color:#FFFFFF; font-size:8px; font-weight: normal; padding-top:10px; padding-bottom:10px; text-align:Right; text-shadow: 0px 0px #160101;">
      Created By:
      </td>
      <td align="left" valign="top" style="border-color: #176259; border-right: 0.1px solid #176259; border-left: 0.1px solid #176259; color:#41aea9; width: 35%; font-size:8px; font-weight: bold; padding-top:10px; padding-bottom:10px; text-align:left; text-shadow: 0px 0px #160101;">
      {{createdByName}}
      </td>
      <td align="Right" valign="top" style="border-color: #176259; border-bottom: 0.1px solid white; border-right: 0.1px solid #176259; border-left: 0.1px solid #176259; width: 15%; background-color:#41aea9; color:#FFFFFF; font-size:8px; font-weight:normal; padding-top:10px; padding-bottom:10px; text-align:Right; /* text-shadow: 0px 0px #160101; */">
      Updated By</td>
      <td align="left" valign="top" style="border-color: #176259; border-right: 0.1px solid #176259; border-left: 0.1px solid #176259; color:#41aea9; width: 35%; font-size:8px; font-weight: bold; padding-top:10px; padding-bottom:10px; text-align:left; text-shadow: 0px 0px #160101;">
      {{modifiedByName}}
      </td>
      </tr>
      <tr>
      <td align="Right" valign="top" style="border-color: #176259; border-bottom: 0.1px solid white; border-right: 0.1px solid #176259; border-left: 0.1px solid #176259; width: 15%; background-color:#41aea9; color:#FFFFFF; font-size:8px; font-weight: normal; padding-top:10px; padding-bottom:10px; text-align:Right; text-shadow: 0px 0px #160101;">
      Created on:
      </td>
      <td align="left" valign="top" style="border-color: #176259; border-right: 0.1px solid #176259; border-left: 0.1px solid #176259; color:#41aea9; width: 35%; font-size:8px; font-weight:bold; padding-top:10px; padding-bottom:12px; text-align:left; text-shadow: 0px 0px #160101;">
      {{dateFormat createdAt_RAW format='MMMM DD, YYYY HH:mm'}}
      </td>

      </tr>
      <tr>
      <td style="width: 100%; border-color: #176259;" colspan="4" rowspan="1">
      <span style="letter-spacing: 1.2px;"></span>
      </td>
      </tr>
      </tbody>
      </table>

      <span style="letter-spacing: 1.2px;">

      <br>

      </span>
      <hr style="line-height: 0.4; border-color: #176259;">

      <span style="letter-spacing: 1.2px;"><br></span><span style="letter-spacing: 1.2px;"><br></span>

      Code End

      Comment

      Working...
      X