Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head><meta http-equiv="content-type" content="text/html;charset=Windows-1251">
- <link rel="stylesheet" href="css/themes/base/jquery.ui.all.css">
- <script src="js/jquery-1.4.4.js"></script>
- <script src="ui/jquery.ui.core.js"></script>
- <script src="ui/jquery.ui.widget.js"></script>
- <script src="ui/jquery.ui.position.js"></script>
- <script src="ui/jquery.ui.autocomplete.js"></script>
- <script src="ui/jquery.ui.datepicker.js"></script>
- <script src="ui/i18n/jquery.ui.datepicker-ru.js"></script>
- <script>
- $(function() {
- $( "#dt1" ).datepicker();
- });
- $(function() {
- $( "#dt2" ).datepicker();
- });
- </script>
- <style>
- .cap2 {font-weight: bold;font-size: 12pt;border-left:1px solid #aaaaaa;border-right:1px solid #aaaaaa;border-top:1px solid #aaaaaa;}
- .cap1 {font-weight: bold;font-size:10pt;border-left:1px solid #aaaaaa;border-right:1px solid #aaaaaa;border-top:1px solid #aaaaaa;}
- .cap0 {font-size: 8pt;}
- </style>
- </head>
- <script>
- function openur()
- {
- location.href="skd_in_excel.php?dt1="+dt1.value+"&dt2="+dt2.value+"&podr_id="+podr_id.value;
- }
- </script>
- <?
- require_once 'Classes/PHPExcel.php';
- function cp1251_to_utf8_recursive($data)
- {
- if (is_array($data))
- {
- $d = array();
- foreach ($data as $k => &$v)
- {
- $d[cp1251_to_utf8_recursive($k)] = cp1251_to_utf8_recursive($v);
- }
- return $d;
- }
- if (is_string($data)) return iconv('cp1251', 'utf-8//IGNORE//TRANSLIT', $data);
- //if (is_string($data)) return iconv('cp1251', 'utf-8', $data);
- if (is_scalar($data) or is_null($data)) return $data;
- return $data;
- }
- function cp1251_to_utf8 ($txt) {
- $txt=cp1251_to_utf8_recursive($txt);
- return $txt;
- }
- $dt=date("d.m.Y");
- $dt1=$_GET["dt1"];
- if ($dt1=="") $dt1=$dt;
- $dt2=$_GET["dt2"];
- if ($dt2=="") $dt2=$dt;
- $podr_id=$_GET["podr_id"];
- ?>
- <body><h1>СКД</h1><form>
- <table cellpadding="2" cellspacing="0">
- <tr><td>Период: с </td><td><input type="text" id="dt1" name="dt1" value="<? echo $dt1; ?>" autocomplete="off" onblur="setTimeout('getasbn(1)',200);"></td></tr>
- <tr><td>по</td><td><input type="text" id="dt2" name="dt2" value="<? echo $dt2; ?>" autocomplete="off" onblur="setTimeout('getasbn(1)',200);"></td></tr>
- <tr><td>Подразделение:</td><td>
- <?php
- $strconnect = '192.168.1.254:D:\Perco\SKD_Base\SCD15.FDB';
- $db=ibase_connect($strconnect, 'SYST', 'Wbnhec98', 'WIN1251', 0, 3);
- $sql="select * from v_ref_depart";
- $cursor = ibase_query($sql);
- ?><select name="podr_id" id="podr_id"><?
- while($row_array = ibase_fetch_row($cursor))
- {
- ?><option value=<? echo $row_array[0]; if ($row_array[0]==$podr_id) echo " selected"; ?>><?
- echo $row_array[1];
- ?></option><?
- }
- ?></select></tr><tr><td colspan=2 align="center"><input type="submit" value="Сформировать"><input type="button" value="XLS" onclick="openur()"></td></table></form><?
- ibase_free_result($cursor);
- $dt1=substr($dt1,6,4)."-".substr($dt1,3,2)."-".substr($dt1,0,2);//." 00:00:00";
- $dt2=substr($dt2,6,4)."-".substr($dt2,3,2)."-".substr($dt2,0,2);//." 23:59:59";
- if ($podr_id!="")
- {
- $sql="SELECT
- upper(last_name||' '||first_name||' '||middle_name) fam,type_pass,
- date_pass,time_pass
- from
- tabel_intermediadate,staff,staff_ref
- where
- tabel_intermediadate.staff_id=staff.id_staff and
- staff.id_staff=staff_ref.staff_id and visible=1
- and subdiv_id=$podr_id and
- (type_pass=1 or type_pass=2) and date_pass between '$dt1' and '$dt2'
- order by
- upper(last_name||' '||first_name||' '||middle_name) ,
- date_pass,time_pass";
- //echo $sql;
- $cursor = ibase_query($sql);
- $curr_user="ХУЕМВГРЫЗЛО";
- $curr_date="ХУЕМВГРЫЗЛО";
- ?><table width="800pt" border="0" cellspacing="0"><tr><th style="border-left:1px solid #aaaaaa;border-right:1px solid #aaaaaa;border-top:1px solid #aaaaaa;">Тип события</th><th style="border-right:1px solid #aaaaaa;border-top:1px solid #aaaaaa;">Время</th></tr><?
- while($row_array = ibase_fetch_assoc($cursor))
- {
- if ($row_array["FAM"]!=$curr_user)
- {
- $curr_user=$row_array["FAM"];
- $curr_date="ХУЕМВГРЫЗЛО";
- echo "<tr><td colspan=\"2\" class=\"cap2\">".$row_array["FAM"]."</td></tr>";
- }
- if ($row_array["DATE_PASS"]!=$curr_date)
- {
- $curr_date=$row_array["DATE_PASS"];
- $dt=substr($row_array["DATE_PASS"],8,2).".".substr($row_array["DATE_PASS"],5,2).".".substr($row_array["DATE_PASS"],0,4);
- echo "<tr><td colspan=\"2\" class=\"cap1\">".$dt."</td></tr>";
- }
- if ($row_array["TYPE_PASS"]==1) $typ="Вход"; else $typ="Выход";
- echo "<tr><td class=\"cap0\" style=\"border-left:1px solid #aaaaaa;border-right:1px solid #aaaaaa;border-top:1px solid #aaaaaa;\">$typ</td><td class=\"cap0\" style=\"border-right:1px solid #aaaaaa;border-top:1px solid #aaaaaa;\">".$row_array["TIME_PASS"]."</td></tr>";
- //echo "<pre>";
- //print_r($row_array);
- //echo "</pre>";
- }
- ?><tr><td colspan="2" style="border-top:1px solid #aaaaaa;"> </td></tr></table><?
- ibase_free_result($cursor);
- }
- ibase_close($db);
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement