xref: /plugin/bez/tpl/report.php (revision bc2653b00a718c1ef68486f970cffe35acb167aa)
1<h1><?php echo $tpl->getLang('report') ?></h1>
2
3<div class="bez_filter_form">
4    <form action="<?php echo $tpl->url('report') ?>" method="post">
5        <span class="datepair">
6            <label><?php echo $tpl->getLang('report from') ?>: <input name="from" value="<?php echo $tpl->value('from') ?>" class="date start" style="width: 90px"></label>
7            <label><?php echo $tpl->getLang('report to') ?>: <input name="to" value="<?php echo $tpl->value('to') ?>" class="date end" style="width: 90px"></label>
8        </span>
9        <button><?php echo $tpl->getLang('show') ?></button>
10    </form>
11
12</div>
13
14<h2><?php echo $tpl->getLang('issues') ?></h2>
15
16<table class="bez_sumarise">
17    <tr>
18        <th><?php echo $tpl->getLang('type') ?></th>
19        <th><?php echo ucfirst($tpl->getLang('proposal')) ?></th>
20        <th><?php echo ucfirst($tpl->getLang('open')) ?></th>
21        <th><?php echo ucfirst($tpl->getLang('report threads done')) ?></th>
22        <th><?php echo ucfirst($tpl->getLang('closed')) ?></th>
23        <th><?php echo ucfirst($tpl->getLang('report threads rejected')) ?></th>
24        <th><?php echo ucfirst($tpl->getLang('all')) ?></th>
25    </tr>
26    <?php foreach ($tpl->get('issues') as $issue): ?>
27        <tr>
28            <td>
29                <?php if (empty($issue['label_name'])) : ?>
30                    <i><?php echo $tpl->getLang('issue_type_no_specified') ?></i>
31                <?php else: ?>
32                    <?php echo $issue['label_name'] ?>
33                <?php endif ?>
34            </td>
35            <td><?php echo $issue['proposal'] ?></td>
36            <td><?php echo $issue['opened'] ?></td>
37            <td><?php echo $issue['done'] ?></td>
38            <td><?php echo $issue['closed'] ?></td>
39            <td><?php echo $issue['rejected'] ?></td>
40            <td><?php echo $issue['count_all'] ?></td>
41        </tr>
42    <?php endforeach ?>
43    <tr>
44        <th><?php echo $tpl->getLang('report_total') ?></th>
45        <td><?php echo array_sum(array_column($tpl->get('issues'), 'proposal')) ?></td>
46        <td><?php echo array_sum(array_column($tpl->get('issues'), 'opened')) ?></td>
47        <td><?php echo array_sum(array_column($tpl->get('issues'), 'done')) ?></td>
48        <td><?php echo array_sum(array_column($tpl->get('issues'), 'closed')) ?></td>
49        <td><?php echo array_sum(array_column($tpl->get('issues'), 'rejected')) ?></td>
50        <td><?php echo array_sum(array_column($tpl->get('issues'), 'count_all')) ?></td>
51    </tr>
52</table>
53
54<table class="bez_sumarise">
55    <tr>
56        <th><?php echo $tpl->getLang('type') ?></th>
57        <th><?php echo ucfirst($tpl->getLang('report threads cost')) ?></th>
58        <th><?php echo ucfirst($tpl->getLang('report threads cost closed')) ?></th>
59        <th><?php echo ucfirst($tpl->getLang('average_of_close')) ?></th>
60    </tr>
61    <?php foreach ($tpl->get('issues') as $issue): ?>
62        <tr>
63            <td>
64                <?php if (empty($issue['label_name'])) : ?>
65                    <i><?php echo $tpl->getLang('issue_type_no_specified') ?></i>
66                <?php else: ?>
67                    <?php echo $issue['label_name'] ?>
68                <?php endif ?>
69            </td>
70            <td>
71                <?php if (empty($issue['sum_all'])) : ?>
72                    ---
73                <?php else: ?>
74                    <?php echo $issue['sum_all'] ?>
75                <?php endif ?>
76            </td>
77            <td>
78                <?php if (empty($issue['sum_closed'])) : ?>
79                    ---
80                <?php else: ?>
81                    <?php echo $issue['sum_closed'] ?>
82                <?php endif ?>
83            </td>
84            <td>
85                <?php if (empty($issue['avg_closed'])) : ?>
86                    ---
87                <?php else: ?>
88                    <?php echo round($issue['avg_closed']) ?> <?php echo $tpl->getLang('days') ?>
89                <?php endif ?>
90            </td>
91        </tr>
92    <?php endforeach ?>
93    <tr>
94        <th><?php echo $tpl->getLang('report_total') ?></th>
95        <td><?php echo array_sum(array_column($tpl->get('issues'), 'sum_all')) ?></td>
96        <td><?php echo array_sum(array_column($tpl->get('issues'), 'sum_closed')) ?></td>
97        <td><?php echo round(array_sum(array_column($tpl->get('issues'), 'avg_closed'))
98                             / count(array_filter(array_column($tpl->get('issues'), 'avg_closed')))) ?>
99            <?php echo $tpl->getLang('days') ?></td>
100    </tr>
101</table>
102
103<h2><?php echo $tpl->getLang('nav projects') ?></h2>
104
105<table>
106    <tr>
107        <th><?php echo ucfirst($tpl->getLang('proposal')) ?></th>
108        <th><?php echo ucfirst($tpl->getLang('open')) ?></th>
109        <th><?php echo ucfirst($tpl->getLang('report threads done')) ?></th>
110        <th><?php echo ucfirst($tpl->getLang('closed')) ?></th>
111        <th><?php echo ucfirst($tpl->getLang('report threads rejected')) ?></th>
112        <th><?php echo ucfirst($tpl->getLang('all')) ?></th>
113    </tr>
114    <?php foreach ($tpl->get('projects') as $project): ?>
115        <tr>
116            <td><?php echo $project['proposal'] ?></td>
117            <td><?php echo $project['opened'] ?></td>
118            <td><?php echo $project['done'] ?></td>
119            <td><?php echo $project['closed'] ?></td>
120            <td><?php echo $project['rejected'] ?></td>
121            <td><?php echo $project['count_all'] ?></td>
122        </tr>
123    <?php endforeach ?>
124</table>
125
126<table>
127    <tr>
128        <th><?php echo ucfirst($tpl->getLang('report threads cost')) ?></th>
129        <th><?php echo ucfirst($tpl->getLang('report threads cost closed')) ?></th>
130        <th><?php echo ucfirst($tpl->getLang('average_of_close')) ?></th>
131    </tr>
132    <?php foreach ($tpl->get('projects') as $project): ?>
133        <tr>
134            <td>
135                <?php if (empty($project['sum_all'])) : ?>
136                    ---
137                <?php else: ?>
138                    <?php echo $project['sum_all'] ?>
139                <?php endif ?>
140            </td>
141            <td>
142                <?php if (empty($project['sum_closed'])) : ?>
143                    ---
144                <?php else: ?>
145                    <?php echo $project['sum_closed'] ?>
146                <?php endif ?>
147            </td>
148            <td>
149                <?php if (empty($project['avg_closed'])) : ?>
150                    ---
151                <?php else: ?>
152                    <?php echo round($project['avg_closed']) ?> <?php echo $tpl->getLang('days') ?>
153                <?php endif ?>
154            </td>
155        </tr>
156    <?php endforeach ?>
157</table>
158
159<h2><?php echo $tpl->getLang('tasks') ?></h2>
160
161<table class="bez_sumarise">
162    <tr>
163        <th><?php echo ucfirst($tpl->getLang('task_type')) ?></th>
164        <th><?php echo ucfirst($tpl->getLang('open')) ?></th>
165        <th><?php echo ucfirst($tpl->getLang('number_of_close_on_time')) ?></th>
166        <th><?php echo ucfirst($tpl->getLang('number_of_close_off_time')) ?></th>
167        <th><?php echo ucfirst($tpl->getLang('all')) ?></th>
168
169    </tr>
170    <?php foreach ($tpl->get('tasks') as $task): ?>
171        <tr>
172            <td>
173                <?php if (empty($task['task_program_name'])) : ?>
174                    <i><?php echo $tpl->getLang('tasks_no_type') ?></i>
175                <?php else: ?>
176                    <?php echo $task['task_program_name'] ?>
177                <?php endif ?>
178            </td>
179            <td><?php echo $task['opened'] ?></td>
180            <td><?php echo $task['closed_on_time'] ?></td>
181            <td><?php echo $task['closed_after_the_dedline'] ?></td>
182            <td><?php echo $task['count_all'] ?></td>
183        </tr>
184    <?php endforeach ?>
185    <tr>
186        <th><?php echo $tpl->getLang('report_total') ?></th>
187        <td><?php echo array_sum(array_column($tpl->get('tasks'), 'opened')) ?></td>
188        <td><?php echo array_sum(array_column($tpl->get('tasks'), 'closed_on_time')) ?></td>
189        <td><?php echo array_sum(array_column($tpl->get('tasks'), 'closed_after_the_dedline')) ?></td>
190        <td><?php echo array_sum(array_column($tpl->get('tasks'), 'count_all')) ?></td>
191    </tr>
192</table>
193
194<table class="bez_sumarise">
195    <tr>
196        <th><?php echo ucfirst($tpl->getLang('task_type')) ?></th>
197        <th><?php echo ucfirst($tpl->getLang('report threads cost')) ?></th>
198        <th><?php echo ucfirst($tpl->getLang('report threads cost closed')) ?></th>
199    </tr>
200    <?php foreach ($tpl->get('tasks') as $task): ?>
201        <tr>
202            <td>
203                <?php if (empty($task['task_program_name'])) : ?>
204                    <i><?php echo $tpl->getLang('tasks_no_type') ?></i>
205                <?php else: ?>
206                    <?php echo $task['task_program_name'] ?>
207                <?php endif ?>
208            </td>
209            <td>
210                <?php if (empty($task['total_cost'])) : ?>
211                    ---
212                <?php else: ?>
213                    <?php echo $task['total_cost'] ?>
214                <?php endif ?>
215            </td>
216            <td>
217                <?php if (empty($task['cost_of_closed'])) : ?>
218                    ---
219                <?php else: ?>
220                    <?php echo $task['cost_of_closed'] ?>
221                <?php endif ?>
222            </td>
223        </tr>
224    <?php endforeach ?>
225    <tr>
226        <th><?php echo $tpl->getLang('report_total') ?></th>
227        <td><?php echo array_sum(array_column($tpl->get('tasks'), 'total_cost')) ?></td>
228        <td><?php echo array_sum(array_column($tpl->get('tasks'), 'cost_of_closed')) ?></td>
229    </tr>
230</table>
231