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        <?php $numerator = array_sum(array_column($tpl->get('issues'), 'avg_closed')) ?>
98        <?php $denominator = count(array_filter(array_column($tpl->get('issues'), 'avg_closed'))) ?>
99        <td><?php echo $denominator > 0 ? round($numerator/$denominator) : 0 ?>
100            <?php echo $tpl->getLang('days') ?></td>
101    </tr>
102</table>
103
104<table class="bez_sumarise">
105    <tr>
106        <th><?php echo ucfirst($tpl->getLang('causes')) ?></th>
107        <th><?php echo ucfirst($tpl->getLang('risks')) ?></th>
108        <th><?php echo ucfirst($tpl->getLang('opportunities')) ?></th>
109        <th><?php echo ucfirst($tpl->getLang('all')) ?></th>
110
111    </tr>
112    <tr>
113        <td><?php echo $tpl->get('comments')['cause'] ?></td>
114        <td><?php echo $tpl->get('comments')['risk'] ?></td>
115        <td><?php echo $tpl->get('comments')['opportunity'] ?></td>
116        <td><?php echo $tpl->get('comments')['all'] ?></td>
117    </tr>
118</table>
119
120<h2><?php echo $tpl->getLang('nav projects') ?></h2>
121
122<table>
123    <tr>
124        <th><?php echo ucfirst($tpl->getLang('proposal')) ?></th>
125        <th><?php echo ucfirst($tpl->getLang('open')) ?></th>
126        <th><?php echo ucfirst($tpl->getLang('report threads done')) ?></th>
127        <th><?php echo ucfirst($tpl->getLang('closed')) ?></th>
128        <th><?php echo ucfirst($tpl->getLang('report threads rejected')) ?></th>
129        <th><?php echo ucfirst($tpl->getLang('all')) ?></th>
130    </tr>
131    <?php foreach ($tpl->get('projects') as $project): ?>
132        <tr>
133            <td><?php echo $project['proposal'] ?></td>
134            <td><?php echo $project['opened'] ?></td>
135            <td><?php echo $project['done'] ?></td>
136            <td><?php echo $project['closed'] ?></td>
137            <td><?php echo $project['rejected'] ?></td>
138            <td><?php echo $project['count_all'] ?></td>
139        </tr>
140    <?php endforeach ?>
141</table>
142
143<table>
144    <tr>
145        <th><?php echo ucfirst($tpl->getLang('report threads cost')) ?></th>
146        <th><?php echo ucfirst($tpl->getLang('report threads cost closed')) ?></th>
147        <th><?php echo ucfirst($tpl->getLang('average_of_close')) ?></th>
148    </tr>
149    <?php foreach ($tpl->get('projects') as $project): ?>
150        <tr>
151            <td>
152                <?php if (empty($project['sum_all'])) : ?>
153                    ---
154                <?php else: ?>
155                    <?php echo $project['sum_all'] ?>
156                <?php endif ?>
157            </td>
158            <td>
159                <?php if (empty($project['sum_closed'])) : ?>
160                    ---
161                <?php else: ?>
162                    <?php echo $project['sum_closed'] ?>
163                <?php endif ?>
164            </td>
165            <td>
166                <?php if (empty($project['avg_closed'])) : ?>
167                    ---
168                <?php else: ?>
169                    <?php echo round($project['avg_closed']) ?> <?php echo $tpl->getLang('days') ?>
170                <?php endif ?>
171            </td>
172        </tr>
173    <?php endforeach ?>
174</table>
175
176<h2><?php echo $tpl->getLang('tasks') ?></h2>
177
178<table class="bez_sumarise">
179    <tr>
180        <th><?php echo ucfirst($tpl->getLang('task_type')) ?></th>
181        <th><?php echo ucfirst($tpl->getLang('open')) ?></th>
182        <th><?php echo ucfirst($tpl->getLang('number_of_close_on_time')) ?></th>
183        <th><?php echo ucfirst($tpl->getLang('number_of_close_off_time')) ?></th>
184        <th><?php echo ucfirst($tpl->getLang('all')) ?></th>
185
186    </tr>
187    <?php foreach ($tpl->get('tasks') as $task): ?>
188        <tr>
189            <td>
190                <?php if (empty($task['task_program_name'])) : ?>
191                    <i><?php echo $tpl->getLang('tasks_no_type') ?></i>
192                <?php else: ?>
193                    <?php echo $task['task_program_name'] ?>
194                <?php endif ?>
195            </td>
196            <td><?php echo $task['opened'] ?></td>
197            <td><?php echo $task['closed_on_time'] ?></td>
198            <td><?php echo $task['closed_after_the_dedline'] ?></td>
199            <td><?php echo $task['count_all'] ?></td>
200        </tr>
201    <?php endforeach ?>
202    <tr>
203        <th><?php echo $tpl->getLang('report_total') ?></th>
204        <td><?php echo array_sum(array_column($tpl->get('tasks'), 'opened')) ?></td>
205        <td><?php echo array_sum(array_column($tpl->get('tasks'), 'closed_on_time')) ?></td>
206        <td><?php echo array_sum(array_column($tpl->get('tasks'), 'closed_after_the_dedline')) ?></td>
207        <td><?php echo array_sum(array_column($tpl->get('tasks'), 'count_all')) ?></td>
208    </tr>
209</table>
210
211<table class="bez_sumarise">
212    <tr>
213        <th><?php echo ucfirst($tpl->getLang('task_type')) ?></th>
214        <th><?php echo ucfirst($tpl->getLang('report threads cost')) ?></th>
215        <th><?php echo ucfirst($tpl->getLang('report threads cost closed')) ?></th>
216    </tr>
217    <?php foreach ($tpl->get('tasks') as $task): ?>
218        <tr>
219            <td>
220                <?php if (empty($task['task_program_name'])) : ?>
221                    <i><?php echo $tpl->getLang('tasks_no_type') ?></i>
222                <?php else: ?>
223                    <?php echo $task['task_program_name'] ?>
224                <?php endif ?>
225            </td>
226            <td>
227                <?php if (empty($task['total_cost'])) : ?>
228                    ---
229                <?php else: ?>
230                    <?php echo $task['total_cost'] ?>
231                <?php endif ?>
232            </td>
233            <td>
234                <?php if (empty($task['cost_of_closed'])) : ?>
235                    ---
236                <?php else: ?>
237                    <?php echo $task['cost_of_closed'] ?>
238                <?php endif ?>
239            </td>
240        </tr>
241    <?php endforeach ?>
242    <tr>
243        <th><?php echo $tpl->getLang('report_total') ?></th>
244        <td><?php echo array_sum(array_column($tpl->get('tasks'), 'total_cost')) ?></td>
245        <td><?php echo array_sum(array_column($tpl->get('tasks'), 'cost_of_closed')) ?></td>
246    </tr>
247</table>
248