~eventum-developers/eventum/trunk

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
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
{extends "reports/reports_base.tpl.html"}
{block "page_id"}customer_stats_report{/block}
{block "title"}Customer Stats{/block}

{block "report_content"}
<br />
{if $no_customer_integration == 1}
    <span>{t}The current project does not have customer integration so this report can not be viewed.{/t}</span>
{else}
<form method="post" name="customer_stats_report">
<input type="hidden" name="cat" value="generate">
<script type="text/javascript">

function clearDate()
{

    var f = document.forms['customer_stats_report'];

    f.elements["start[Year]"].selectedIndex = 0;
    f.elements["start[Month]"].selectedIndex = 0;
    f.elements["start[Day]"].selectedIndex = 0;

    f.elements["end[Year]"].selectedIndex = 0;
    f.elements["end[Month]"].selectedIndex = 0;
    f.elements["end[Day]"].selectedIndex = 0;
}

</script>
<table border="0" cellspacing="0" cellpadding="1" align="center">
  <tr>
    <td>
      <table bgcolor="#FFFFFF" width="100%" cellspacing="1" cellpadding="2" border="0">
        <tr>
          <td colspan="3">
            <b>{t}Customer Stats Report{/t} - {$project_name}</b>
          </td>
        </tr>
        <tr>
          <td width="30%" align="center">
            <b>{t}Support Level{/t}</b>
          </td>
          <td width="40%" align="center">
            <b>{t}Date Range{/t}</b>
          </td>
          <td width="30%" align="center">
            <b>{t}Sections to Display{/t}</b>
          </td>
        </tr>
        <tr>
          <td align="center" valign="top">
            <select name="support_level[]" size="5" multiple>
                {html_options options=$support_levels selected=$support_level}
            </select>
          </td>
          <td align="center" valign="top">
            <table>
                <tr>
                    <td align="right">{t}From{/t}</td>
                    {capture assign="year"}{t}year{/t}{/capture}
                    {capture assign="month"}{t}mon{/t}{/capture}
                    {capture assign="day"}{t}day{/t}{/capture}
                    <td align="center" NOWRAP>{html_select_date time=$start_date prefix="" field_array="start" start_year="-2" end_year="+1" field_order="YMD" month_format="%b" year_empty=$year month_empty=$month day_empty=$day all_extra="class='default'"}</td>
                </tr>
                <tr>
                    <td align="right">{t}To{/t}</td>
                    <td align="center" NOWRAP>{html_select_date time=$end_date prefix="" field_array="end" start_year="-2" end_year="+1" field_order="YMD" month_format="%b" year_empty=$year month_empty=$month day_empty=$day all_extra="class='default'"}</td>
                </tr>
            </table>
            <input type="button" name="clear_date" value="{t}Clear Date{/t}" onClick="clearDate()" class="shortcut">
          </td>
          <td align="center" valign="top">
            <select name="display_sections[]" size="5" multiple>
                {html_options options=$sections selected=$display_sections}
            </select>
          </td>
        </tr>
        <tr>
          <td align="center" valign="middle" >
            <b>{t}Options{/t}</b>
          </td>
          <td align="left" valign="bottom" colspan="2" NOWRAP>
            <input type="checkbox" name="include_expired" value="1" {if $include_expired==1}CHECKED{/if}>
            <a id="link" href="javascript:void(null)"
                            onClick="toggleCheckbox('customer_stats_report', 'include_expired');">{t}Include expired contracts{/t}</a>
          </td>
        </tr>
        <tr>
          <td align="center" valign="top">
          {if $core.current_role >= $core.roles.manager}
            <b>{t}Customer{/t}</b>
            {/if}
          </td>
          <td align="center" valign="top" colspan="2">
            {if $core.current_role >= $core.roles.manager}
            <select name="customer[]">
                <option value="">{t}All{/t}</option>
                {html_options options=$customers selected=$customer}
            </select>
            {/if}
          </td>
        </tr>
        <tr>
          <td colspan="3" align="center">
            <input type="submit" name="cat" value="{t}Generate{/t}" class="shortcut">
          </td>
        </tr>
        <tr>
          <td colspan="3" align="right">
             &nbsp;
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
</form>

{if $data != ''}
<span>
<span style="color: red">{t}Red values indicate value is higher than the aggregate one.{/t}</span><br />
<span style="color: blue">{t}Blue values indicate value is lower than the aggregate one.{/t}</span><br />
</span>

{$date_msg}
{if $display.customer_counts == 1 || $display.issue_counts == 1 || $display.email_counts == 1}
<table width="100%" border="0" cellspacing="0" cellpadding="1" align="center">
  <tr>
    <td>
        <table width="100%" bgcolor="#FFFFFF" border="0" cellspacing="1" cellpadding="2" align="center">
            <!-- header row -->
            <tr>
                <th rowspan="2">{$row_label}</th>
                {if $display.customer_counts == 1}<th colspan="3">{t}Customers{/t}</th>{/if}
                {if $display.issue_counts == 1}<th colspan="4">{t}Issues{/t}<sup>1</sup></th>{/if}
                {if $display.email_counts == 1}<th colspan="3">{t}Emails by Customers{/t}<sup>2</sup></th>
                <th colspan="3">{t}Emails by Staff{/t}<sup>3</sup></th>{/if}
            </tr>
            <tr>
                {if $display.customer_counts == 1}
                <th>{t}Count{/t}</th>
                <th>{t}Using CSC{/t}</th>
                <th>{t}Issues in CSC{/t}<br />(0/1-2/3-8/>8)</th>
                {/if}

                {if $display.issue_counts == 1}
                <th>{t}Tot{/t}</th>
                <th>{t}Avg{/t}</th>
                <th>{t}Med{/t}</th>
                <th>{t}Max{/t}</th>
                {/if}

                {if $display.email_counts == 1}
                <th>{t}Tot{/t}</th>
                <th>{t}Avg{/t}</th>
                <th>{t}Med{/t}</th>

                <th>{t}Tot{/t}</th>
                <th>{t}Avg{/t}.</th>
                <th>{t}Med{/t}</th>
                {/if}
            </tr>
            <!-- end of header -->
            {section name=stats loop=$data}
            {cycle values=$cycle assign="row_color"}
            <tr bgcolor="{$row_color}">
                {assign var=row_span value=1}
                <td align="center" rowspan="{$row_span}">{$data[stats].title}</td>

                <!-- Customer counts -->
                {if $display.customer_counts == 1}
                <td align="center" rowspan="{$row_span}">{$data[stats].customer_counts.customer_count}</td>
                <td align="center" rowspan="{$row_span}">{$data[stats].customer_counts.active}</td>
                <td align="center" rowspan="{$row_span}">
                    {$data[stats].customer_counts.inactive|floor}% /
                    {$data[stats].customer_counts.activity.low|floor}% /
                    {$data[stats].customer_counts.activity.medium|floor}% /
                    {$data[stats].customer_counts.activity.high|floor}%
                </td>
                {/if}

                <!-- Issue Counts -->
                {if $display.issue_counts == 1}
                <td align="center" rowspan="{$row_span}">{$data[stats].issue_counts.total}</td>
                <td align="center" rowspan="{$row_span}">{$data[stats].issue_counts.avg|formatValue:$data.0.issue_counts.avg:2}</td>
                <td align="center" rowspan="{$row_span}">{$data[stats].issue_counts.median|formatValue:$data.0.issue_counts.median:2}</td>
                <td align="center" rowspan="{$row_span}">{$data[stats].issue_counts.max|formatValue:$data.0.issue_counts.max:2}</td>
                {/if}

                <!-- Customer Action Counts -->
                {if $display.email_counts == 1}
                <td align="center" rowspan="{$row_span}">{$data[stats].email_counts.customer.total}</td>
                <td align="center" rowspan="{$row_span}">{$data[stats].email_counts.customer.avg|formatValue:$data.0.email_counts.customer.avg:2}</td>
                <td align="center" rowspan="{$row_span}">{$data[stats].email_counts.customer.median|formatValue:$data.0.email_counts.customer.median:2}</td>

                <!-- Developer Action Counts -->
                <td align="center" rowspan="{$row_span}">{$data[stats].email_counts.developer.total}</td>
                <td align="center" rowspan="{$row_span}">{$data[stats].email_counts.developer.avg|formatValue:$data.0.email_counts.developer.avg:2}</td>
                <td align="center" rowspan="{$row_span}">{$data[stats].email_counts.developer.median|formatValue:$data.0.email_counts.developer.median:2}</td>
                {/if}
            </tr>
            {/section}
        </table>
    </td>
  </tr>
</table>
{/if}

{* Display second table *}
{if $display.time_stats == 1}
<br />
<table width="100%" border="0" cellspacing="0" cellpadding="1" align="center">
  <tr>
    <td>
        <table width="100%" bgcolor="#FFFFFF" border="0" cellspacing="1" cellpadding="2" align="center">
            <!-- header row -->
            <tr>
                <th rowspan="2">{$row_label}</th>
                {if $display.time_stats == 1}
                <th colspan="4" >{t}Time To First Response{/t}</th>
                <th colspan="4" >{t}Time To Close{/t}<sup>4</sup></th>
                {/if}
            </tr>
            <tr>
                {if $display.time_stats == 1}
                <th>{t}Min{/t}</th>
                <th>{t}Avg{/t}</th>
                <th>{t}Med{/t}</th>
                <th>{t}Max{/t}</th>

                <th>{t}Min{/t}</th>
                <th>{t}Avg{/t}</th>
                <th>{t}Med{/t}</th>
                <th>{t}Max{/t}</th>
                {/if}
            </tr>
            <!-- end of header -->
            {section name=stats loop=$data}
            {cycle values=$cycle assign="row_color"}
            {assign var=row_span value=1}
            <tr bgcolor="{$row_color}">
                <td align="center" rowspan="{$row_span}">{$data[stats].title}</td>

                {if $display.time_stats == 1}
                <!-- Time to First Response -->
                <td align="center" rowspan="{$row_span}">{$data[stats].time_stats.time_to_first_response.min_formatted|formatValue:$data.0.time_stats.time_to_first_response.min:"":$data[stats].time_stats.time_to_first_response.min}</td>
                <td align="center" rowspan="{$row_span}">{$data[stats].time_stats.time_to_first_response.avg_formatted|formatValue:$data.0.time_stats.time_to_first_response.avg:"":$data[stats].time_stats.time_to_first_response.avg}</td>
                <td align="center" rowspan="{$row_span}">{$data[stats].time_stats.time_to_first_response.median_formatted|formatValue:$data.0.time_stats.time_to_first_response.median:"":$data[stats].time_stats.time_to_first_response.median}</td>
                <td align="center" rowspan="{$row_span}">{$data[stats].time_stats.time_to_first_response.max_formatted|formatValue:$data.0.time_stats.time_to_first_response.max:"":$data[stats].time_stats.time_to_first_response.max}</td>

                <!-- Time to Close -->
                <td align="center" rowspan="{$row_span}">{$data[stats].time_stats.time_to_close.min_formatted|formatValue:$data.0.time_stats.time_to_close.min:"":$data[stats].time_stats.time_to_close.min}</td>
                <td align="center" rowspan="{$row_span}">{$data[stats].time_stats.time_to_close.avg_formatted|formatValue:$data.0.time_stats.time_to_close.avg:"":$data[stats].time_stats.time_to_close.avg}</td>
                <td align="center" rowspan="{$row_span}">{$data[stats].time_stats.time_to_close.median_formatted|formatValue:$data.0.time_stats.time_to_close.median:"":$data[stats].time_stats.time_to_close.median}</td>
                <td align="center" rowspan="{$row_span}">{$data[stats].time_stats.time_to_close.max_formatted|formatValue:$data.0.time_stats.time_to_close.max:"":$data[stats].time_stats.time_to_close.max}</td>
                {/if}
            </tr>
            {/section}
        </table>
    </td>
  </tr>
</table>
<br />
{/if}

{* Display 3rd table *}
{if $display.time_tracking == 1}
<table width="100%" border="0" cellspacing="0" cellpadding="1" align="center">
  <tr>
    <td>
        <table width="100%" bgcolor="#FFFFFF" border="0" cellspacing="1" cellpadding="2" align="center">
            <!-- header row -->
            <tr>
                <th width="150" rowspan="2">{t}Support Level{/t}</th>
                {assign var=col_span value=$time_tracking_categories|@count}
                {assign var=col_span value="`$col_span+1`"}
                <th colspan="{$col_span}">{t}Time Tracking{/t}<span style="vertical-align: super; font-size: 80%">5</span></th>
            </tr>
            <tr>
                <th width="50">&nbsp;</th>
                {foreach name=time_tracking from=$time_tracking_categories key=ttc_id item=ttc_title}
                <th width="150">{$ttc_title}</th>
                {/foreach}
            </tr>
            {section name=stats loop=$data}
            {cycle values=$cycle assign="row_color"}
            <tr bgcolor="{$row_color}">
                <td align="center" rowspan="3" nowrap>{$data[stats].title}</td>
                <td align="center">{t}Total{/t}</td>
                {foreach name=time_tracking from=$time_tracking_categories key=ttc_id item=ttc_title}
                <td align="center">
                {$data[stats].time_tracking[$ttc_id].total_formatted|formatValue:$data.0.time_tracking[$ttc_id].total:"":$data[stats].time_tracking[$ttc_id].total}
                </td>
                {/foreach}
            </tr>
            <tr bgcolor="{$row_color}">
                <td align="center">{t}Avg{/t}</td>
                {foreach name=time_tracking from=$time_tracking_categories key=ttc_id item=ttc_title}
                <td align="center">
                {$data[stats].time_tracking[$ttc_id].avg_formatted|formatValue:$data.0.time_tracking[$ttc_id].avg:"":$data[stats].time_tracking[$ttc_id].avg}
                </td>
                {/foreach}
            </tr>
            <tr bgcolor="{$row_color}">
                <td align="center">{t}Med{/t}</td>
                {foreach name=time_tracking from=$time_tracking_categories key=ttc_id item=ttc_title}
                <td align="center">
                {$data[stats].time_tracking[$ttc_id].median_formatted|formatValue:$data.0.time_tracking[$ttc_id].median:"":$data[stats].time_tracking[$ttc_id].median}
                </td>
                {/foreach}
            </tr>
            {/section}
        </table>
    </td>
  </tr>
</table>
{/if}

<span>
1. {t}Refers to the number of issues in eventum for the given support level or customer.{/t}
 &nbsp;&nbsp;&nbsp;{t}Average and median counts do not include customers who have never opened an issue.{/t}<br />
2. {t escape=no}Refers to the number of emails sent by customers in eventum per issue. Does <b>not</b> include emails sent to general support mailbox.{/t}<br />
3. {t escape=no}Refers to the number of emails sent by developers in eventum per issue. Does <b>not</b> include emails sent to general support mailbox.{/t}<br />
4. {t}Date issue was opened - Date issue was closed for all closed issues.{/t}<br />
5. {t}All time tracking information for the given support level or customer. Issues without any time tracking data do not affect the average or median.{/t}<br />
</span>
<br />
{* Loop through graphs, display them all *}
{foreach name=graphs from=$graphs item=graph key=graph_id}
{$date_msg}
<div align="center"><img src="customer_stats_graph.php?graph_id={$graph_id}"></div><br />
{/foreach}

{/if}
{/if}
{/block}