- 001
- 002
- 003
- 004
- 005
- 006
- 007
- 008
- 009
- 010
- 011
- 012
- 013
- 014
- 015
- 016
- 017
- 018
- 019
- 020
- 021
- 022
- 023
- 024
- 025
- 026
- 027
- 028
- 029
- 030
- 031
- 032
- 033
- 034
- 035
- 036
- 037
- 038
- 039
- 040
- 041
- 042
- 043
- 044
- 045
- 046
- 047
- 048
- 049
- 050
- 051
- 052
- 053
- 054
- 055
- 056
- 057
- 058
- 059
- 060
- 061
- 062
- 063
- 064
- 065
- 066
- 067
- 068
- 069
- 070
- 071
- 072
- 073
- 074
- 075
- 076
- 077
- 078
- 079
- 080
- 081
- 082
- 083
- 084
- 085
- 086
- 087
- 088
- 089
- 090
- 091
- 092
- 093
- 094
- 095
- 096
- 097
- 098
- 099
- 100
<?php
set_time_limit(86400);
$begin = new DateTime($_GET["min_date"]);
$end = new DateTime($_GET["max_date"]);
$begincp = clone $begin;
$begincp_2 = clone $begin;
$dt_diff = $begin->diff($end);
$dt_diff = (int) $dt_diff->format("%a");
for($i = 1; $i <= $dt_diff; $i++)
{
$begincp_2->modify("+1 day");
$q = mysql_query("SELECT * FROM `skud_stat` WHERE
`arrival` >= '".$begincp->getTimestamp()."' AND
`arrival` < '".$begincp_2->getTimestamp()."'
ORDER BY `name`");
while($data = mysql_fetch_array($q))
{
$workers[$data["name"]][] = $data;
}
/* Сортировку */
//uksort($workers, "strnatcasecmp");
//ksort($workers);
$coun = 0;
$begincp->modify("+1 day");
}
/* быстрая сортировка */
uksort($workers, "strnatcasecmp");
?>
<table class="table table-striped table-hover table-condensed skud-chart">
<thead></thead>
<tr>
<th style="text-align: left">Имя</th>
<?php
$begin = new DateTime($_GET["min_date"]);
$end = new DateTime($_GET["max_date"]);
$bgcp = clone $begin;
$dt_diff = $begin->diff($end);
$dt_diff = (int) $dt_diff->format("%a");
for($i = 1; $i <= $dt_diff; $i++)
{
?>
<th><?=date("d.m.Y", $bgcp->getTimestamp());?></th>
<?php
$bgcp->modify("+1 day");
}
?>
</tr>
<?php
foreach($workers as $worker => $arr)
{
$begin_copy = clone $begin;
$begin_copy2 = clone $begin;
?>
<tr>
<td class="b"><?=$worker?></td>
<?php
for($i = 1; $i <= $dt_diff; $i++)
{
$begin_copy2->modify("+1 day");
foreach($arr as $day)
{
if($day["arrival"] > $begin_copy->getTimestamp() && $day["leaving"] < $begin_copy2->getTimestamp())
{
/* 28800 - рабочее время (8 часов)
27000 - как погрешность (7 часов 30 минут)
*/
?>
<td><?=date("H:i", $day["arrival"]);?> / <?=date("H:i", $day["leaving"]);?> / <?php if($day["worktime"] < 27000) { ?><b class="notenough"><?php } ?><?=date("H:i", $day["worktime"]);?><?php if($day["worktime"] < 21600) { ?></b><?php } ?></td>
<?php
$success_day = true;
}
else
{
?>
<!--<td>-</td>-->
<?php
}
}
if(!$success_day)
{
?>
<td class="naw">-</td>
<?php
}
unset($success_day);
//if($begin_copy->getTimestamp())
Корпоративная Статистика (!). Читаю из базы и строю отчёт.
varg242 24.01.2013 16:54 # 0
eth0 24.01.2013 17:31 # 0