Modified Basic Report By Date
Imports: 16

I borrowed some code from Ron Hudson here on PCO Chef, used some PCO report code, and then altered it only to include: Event name/approval, Start/end time, Room(plus setup if applicable), Resource list by room, Owner of the event, and notes attached to the event/rooms. Thanks Ron! EDIT 2/11/2025: Corrected the code that was keeping resources from being displayed in the resource column, due to a hang-up on approval status.

Preview

Report Preview


  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
<!-- Set to "true" if you want each day on it's own page -->
<!-- Built by Jordan K -->

{% assign day_page_break = false %}

<!DOCTYPE html>
<html lang="en">
   
   
    <style>
  /* Style for even rows */
  tr:nth-child(even) {
    background-color: #f2f2f2;
  }
  /* Style for odd rows */
  tr:nth-child(odd) {
    background-color: #ffffff;
  }
</style>


  <head>
    <title> ECC Basic Report by Date</title>
    <link rel="stylesheet" type="text/css" media="all" href="{{ report.stylesheet_href.divider }}">
    <meta charset="utf-8">
    <style>
      li {
        list-style-type: none;
      }
    </style>
  </head>
 
  <body>
    {% if report.org_twenty_four_hour_time? %}
      {% assign time_format = "%H:%M" %}
    {% else %}
      {% assign time_format = "%-I:%M%P" %}
    {% endif %}

    {% if report.org_day_month_dates? %}
      {% assign date_format = "%d/%m/%Y" %}
    {% else %}
      {% assign date_format = "%m/%d/%Y" %}
    {% endif %}

    {% for day in days_with_instances %}
        {% if forloop.first or day_page_break %}
          <div>
            <h1 class="header-large txt-center gutter-bottom-small">Basic {{ report.kind | capitalize }} Report by Date</h1>
            <h2 class="header-medium txt-center soft gutter-bottom-large">{{ report.scope }}: {{ report.start_date }} through {{ report.end_date }}</h2>
          </div>
        {% endif %}
        <div class="table-container{% if day_page_break and forloop.index < forloop.length  %} page-break{% endif %}">
          <div class="gutter-bottom-large">
            <h3 class="header-medium">{{ day.date | date: '%A, %B %-d, %Y'}} </h3>
            <table>
               
               
<thead>
  <tr>
    <th> Time </th>
    <th width="20%">Event Name</th>
    <th width="20%">Room(s)/<span style="color: grey;">Setup</span></th>
    <th width="20%">Resources</th>
    <th width="15%">Owner/<span style="color: grey;">Mgr</span></th>
    <th width="25%">Notes</th>
  </tr>
  <tr>
    <th colspan="6" style="white-space: normal;">
      Unlock/lock doors 30 mins before/after earliest/latest times, unless otherwise specified in Room Answers or Event Notes.
    </th>
  </tr>
</thead>


<tbody>
  {% for instance in day.instances | sort: "starts_at" %}
    <tr>
      <td style="vertical-align: top;">
        {% assign event_times_count = instance.event_times | size %}
        {% if event_times_count > 1 %}
          {% for event_time in instance.event_times %}
            {% if event_time.name != "Event" %}
              <strong>{{ event_time.name }}:</strong><br>
              {{ event_time.starts_at | date: time_format }}<br>{{ event_time.ends_at | date: time_format }}<br>
            {% endif %}
          {% endfor %}
        {% elsif event_times_count == 1 %}
          {% for event_time in instance.event_times %}
            {% if event_time.name != "Event" %}
              {{ event_time.starts_at | date: time_format }}<br>{{ event_time.ends_at | date: time_format }}<br>
            {% endif %}
          {% endfor %}
        {% endif %}
      </td>


      <td style="vertical-align: top;">
        <div>
          <div>
            <span class="status {{ instance.approval_status_class }}">
              {{ instance.approval_status | replace: "Approved", "A" | replace: "Pending Conflicts", "PC"| replace: "Pending", "P" | replace: "Rejected", "R" }}
            </span>
          </div>
          <div class="status-text {{ instance.approval_status_class }}"><strong>{{ instance.event.name }}</strong></div>
        </div>
      </td>

                   
                   
<!-- Displays all Rooms requested and "Doors" answer, including setups in grey, if selected. -->          

<td style="vertical-align: top;">
  {% for room_request in instance.reservation.room_requests %}
    <li {% if forloop.last == false %}style="line-height: 1.5; padding-bottom: 5px;"{% endif %}>
      <strong>{{ room_request.room.name }}</strong>
      {% if room_request.room_setup %}
        <span style="color: grey;">( {{ room_request.room_setup.name }} )</span>
      {% endif %}
    </li>

    {% assign doors_question_asked = false %}
    {% assign entrances_question_asked = false %}
    {% assign ac_doors_unlocked_question_asked = false %}
    {% assign ac_doors_locked_question_asked = false %}
    {% assign building_entrance_question_asked = false %}

    {% for answer in room_request.answers %}
      {% if answer.label == 'Do you need doors unlocked/relocked?' or
           answer.label == 'Will you be needing the Activity Center doors unlocked/locked?' or
           answer.label == 'Do you need doors unlocked?' %}
        {% assign doors_question_asked = true %}
        <li style="line-height: 1.3; padding-bottom: 0px;">Doors: <strong{% if answer.answer != 'No' and answer.answer != blank and answer.answer != '(Unanswered)' %} style="background-color: FFFCD3;"{% endif %}>{{ answer.answer }}</strong></li>
      {% elsif answer.label == 'What building entrance(s) will you be using?' %}
        {% assign entrances_question_asked = true %}
        <li style="line-height: 1.3; padding-bottom: 0px;">Entrances: <strong{% if answer.answer != 'No' and answer.answer != blank and answer.answer != '(Unanswered)' %} style="background-color: FFFCD3;"{% endif %}>{{ answer.answer }}</strong></li>
      {% elsif answer.label == 'What BUILDING ENTRANCE will you be using?' %}
        {% assign building_entrance_question_asked = true %}
        <li style="line-height: 1.3; padding-bottom: 0px;">Building Entrance: <strong{% if answer.answer != 'No' and answer.answer != blank and answer.answer != '(Unanswered)' %} style="background-color: FFFCD3;"{% endif %}>{{ answer.answer }}</strong></li>
      {% elsif answer.label == 'What time would you like BUILDING ENTRANCE UNLOCKED?' %}
        {% assign entrances_question_asked = true %}
        <li style="line-height: 1.3; padding-bottom: 0px;">Building Entrance Unlocked: <strong{% if answer.answer != 'No' and answer.answer != blank and answer.answer != '(Unanswered)' %} style="background-color: FFFCD3;"{% endif %}>{{ answer.answer }}</strong></li>
      {% elsif answer.label == 'What time would you like BUILDING ENTRANCE LOCKED?' %}
        {% assign entrances_question_asked = true %}
        <li style="line-height: 1.3; padding-bottom: 0px;">Building Entrance Locked: <strong{% if answer.answer != 'No' and answer.answer != blank and answer.answer != '(Unanswered)' %} style="background-color: FFFCD3;"{% endif %}>{{ answer.answer }}</strong></li>
      {% elsif answer.label == 'What time would you like ROOM DOORS unlocked?' %}
        {% assign doors_question_asked = true %}
        <li style="line-height: 1.3; padding-bottom: 0px;">Room Doors Unlocked: <strong{% if answer.answer != 'No' and answer.answer != blank and answer.answer != '(Unanswered)' %} style="background-color: FFFCD3;"{% endif %}>{{ answer.answer }}</strong></li>
      {% elsif answer.label == 'What time would you like the ROOM DOORS locked?' %}
        {% assign doors_question_asked = true %}
        <li style="line-height: 1.3; padding-bottom: 0px;">Room Doors Locked: <strong{% if answer.answer != 'No' and answer.answer != blank and answer.answer != '(Unanswered)' %} style="background-color: FFFCD3;"{% endif %}>{{ answer.answer }}</strong></li>
      {% elsif answer.label == 'What time would you like the AC DOORS unlocked?' %}
        {% assign ac_doors_unlocked_question_asked = true %}
        <li style="line-height: 1.3; padding-bottom: 0px;">AC Doors Unlocked: <strong{% if answer.answer != 'No' and answer.answer != blank and answer.answer != '(Unanswered)' %} style="background-color: FFFCD3;"{% endif %}>{{ answer.answer }}</strong></li>
      {% elsif answer.label == 'What time would you like the AC DOORS locked?' %}
        {% assign ac_doors_locked_question_asked = true %}
        <li style="line-height: 1.3; padding-bottom: 0px;">AC Doors Locked: <strong{% if answer.answer != 'No' and answer.answer != blank and answer.answer != '(Unanswered)' %} style="background-color: FFFCD3;"{% endif %}>{{ answer.answer }}</strong></li>
      {% endif %}
    {% endfor %}

    {% unless doors_question_asked or entrances_question_asked or ac_doors_unlocked_question_asked or ac_doors_locked_question_asked or building_entrance_question_asked %}
      {% if doors_question_asked %}
        <li style="line-height: 1.3; padding-bottom: 0px;">Doors:</li>
      {% endif %}
      {% if entrances_question_asked %}
        <li style="line-height: 1.3; padding-bottom: 0px;">Entrances:</li>
      {% endif %}
      {% if building_entrance_question_asked %}
        <li style="line-height: 1.3; padding-bottom: 0px;">Building Entrance:</li>
      {% endif %}
      {% if building_entrance_unlocked_question_asked %}
        <li style="line-height: 1.3; padding-bottom: 0px;">Building Entrance Unlocked:</li>
      {% endif %}
      {% if building_entrance_locked_question_asked %}
        <li style="line-height: 1.3; padding-bottom: 0px;">Building Entrance Locked:</li>
      {% endif %}
      {% if room_doors_unlocked_question_asked %}
        <li style="line-height: 1.3; padding-bottom: 0px;">Room Doors Unlocked:</li>
      {% endif %}
      {% if room_doors_locked_question_asked %}
        <li style="line-height: 1.3; padding-bottom: 0px;">Room Doors Locked:</li>
      {% endif %}
      {% if ac_doors_unlocked_question_asked %}
        <li style="line-height: 1.3; padding-bottom: 0px;">AC Doors Unlocked:</li>
      {% endif %}
      {% if ac_doors_locked_question_asked %}
        <li style="line-height: 1.3; padding-bottom: 0px;">AC Doors Locked:</li>
      {% endif %}
    {% endunless %}

  {% endfor %}
</td>

                   
<!-- End Room column -->                    
                   
<td>
  {% for room_request in instance.reservation.room_requests %}
    <h5>{{ room_request.room.name }}</h5>
    <ul>
      {% for resource_request in room_request.resource_requests %}
        <li>
          {% if resource_request.quantity > 1 %}{{resource_request.quantity}} {% endif %}{{resource_request.resource.name}}
        </li>
      {% endfor %}
    </ul>
  {% endfor %}
</td>







     
<!-- This code pulls the event owner, but maybe also pulls the event manager? It works, but unsure how. UPDATE: resolved. No managers now. -->

<td style="vertical-align: top;">
  <strong>{{ instance.event.owner.name }}</strong>
  {% for manager in instance.event.event_managers %}
    <br>
    <span style="color: grey;">{{ manager.name }}</span>
  {% endfor %}
</td>

                   
<!-- Pulls event notes, ONLY from the "settings" tab of the event, and from rooms; does not include notes from resources. -->

   
   
<td style="vertical-align: top;">
  <ul>
    {% if instance.event.notes != blank %}
    <li>
      <h3>Event Notes</h3>
      <p>{{ instance.event.notes | newline_to_br }}</p>
    </li>
    {% endif %}

    {% for resource_request in instance.reservation.resource_requests %}
      {% if resource_request.notes != blank %}
      <li>
        <h3>{{ resource_request.resource.name }} Notes</h3>
        <p>{{ resource_request.notes | newline_to_br }}</p>
      </li>
      {% endif %}
    {% endfor %}

    {% for room_request in instance.reservation.room_requests %}
      {% if room_request.notes != blank %}
      <li>
        <h3>{{ room_request.room.name }} Notes</h3>
        <p>{{ room_request.notes | newline_to_br }}</p>
      </li>
      {% endif %}
    {% endfor %}

    {% for resource_booking in instance.reservation.resource_requests.bookings %}
      {% if resource_booking.notes != blank %}
      <li>
        <h3>{{ resource_booking.resource.name }} Notes</h3>
        <p>{{ resource_booking.notes | newline_to_br }}</p>
      </li>
      {% endif %}
    {% endfor %}
  </ul>
</td>


   
</td>
                   
                  </tr>
                {% endfor %}
               
               
              </tbody>
            </table>
          </div>
      </div>
    {% else %}
      <div>
        <h1 class="header-large txt-center gutter-bottom-small">Basic {{ report.kind | capitalize }} Report by Date</h1>
        <h2 class="header-medium txt-center soft gutter-bottom-large">{{ report.scope }}: {{ report.start_date }} through {{ report.end_date }}</h2>
        <h1 class="header-large txt-center gutter-bottom-small">There are no events which fit the filters in the selected date range.</h1>
      </div>
    {% endfor %}
  </body>
</html>