Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.97 KB | None | 0 0
  1. <html>
  2. <head><meta http-equiv="content-type" content="text/html;charset=Windows-1251">
  3. <link rel="stylesheet" href="css/themes/base/jquery.ui.all.css">
  4. <script src="js/jquery-1.4.4.js"></script>
  5. <script src="ui/jquery.ui.core.js"></script>
  6. <script src="ui/jquery.ui.widget.js"></script>
  7. <script src="ui/jquery.ui.position.js"></script>
  8. <script src="ui/jquery.ui.autocomplete.js"></script>
  9. <script src="ui/jquery.ui.datepicker.js"></script>
  10. <script src="ui/i18n/jquery.ui.datepicker-ru.js"></script>
  11.  
  12. <script>
  13. $(function() {
  14. $( "#dt1" ).datepicker();
  15. });
  16. $(function() {
  17. $( "#dt2" ).datepicker();
  18. });
  19. </script>
  20. <style>
  21. .cap2 {font-weight: bold;font-size: 12pt;border-left:1px solid #aaaaaa;border-right:1px solid #aaaaaa;border-top:1px solid #aaaaaa;}
  22. .cap1 {font-weight: bold;font-size:10pt;border-left:1px solid #aaaaaa;border-right:1px solid #aaaaaa;border-top:1px solid #aaaaaa;}
  23. .cap0 {font-size: 8pt;}
  24.  
  25. </style>
  26. </head>
  27. <script>
  28. function openur()
  29. {
  30. location.href="skd_in_excel.php?dt1="+dt1.value+"&dt2="+dt2.value+"&podr_id="+podr_id.value;
  31. }
  32. </script>
  33.  
  34. <?
  35. require_once 'Classes/PHPExcel.php';
  36. function cp1251_to_utf8_recursive($data)
  37. {
  38. if (is_array($data))
  39. {
  40. $d = array();
  41. foreach ($data as $k => &$v)
  42. {
  43. $d[cp1251_to_utf8_recursive($k)] = cp1251_to_utf8_recursive($v);
  44. }
  45. return $d;
  46. }
  47. if (is_string($data)) return iconv('cp1251', 'utf-8//IGNORE//TRANSLIT', $data);
  48. //if (is_string($data)) return iconv('cp1251', 'utf-8', $data);
  49. if (is_scalar($data) or is_null($data)) return $data;
  50. return $data;
  51. }
  52. function cp1251_to_utf8 ($txt) {
  53. $txt=cp1251_to_utf8_recursive($txt);
  54. return $txt;
  55. }
  56. $dt=date("d.m.Y");
  57. $dt1=$_GET["dt1"];
  58. if ($dt1=="") $dt1=$dt;
  59. $dt2=$_GET["dt2"];
  60. if ($dt2=="") $dt2=$dt;
  61. $podr_id=$_GET["podr_id"];
  62. ?>
  63. <body><h1>СКД</h1><form>
  64. <table cellpadding="2" cellspacing="0">
  65. <tr><td>Период: с </td><td><input type="text" id="dt1" name="dt1" value="<? echo $dt1; ?>" autocomplete="off" onblur="setTimeout('getasbn(1)',200);"></td></tr>
  66. <tr><td>по</td><td><input type="text" id="dt2" name="dt2" value="<? echo $dt2; ?>" autocomplete="off" onblur="setTimeout('getasbn(1)',200);"></td></tr>
  67. <tr><td>Подразделение:</td><td>
  68. <?php
  69.  
  70. $strconnect = '192.168.1.254:D:\Perco\SKD_Base\SCD15.FDB';
  71. $db=ibase_connect($strconnect, 'SYST', 'Wbnhec98', 'WIN1251', 0, 3);
  72.  
  73. $sql="select * from v_ref_depart";
  74. $cursor = ibase_query($sql);
  75. ?><select name="podr_id" id="podr_id"><?
  76. while($row_array = ibase_fetch_row($cursor))
  77. {
  78. ?><option value=<? echo $row_array[0]; if ($row_array[0]==$podr_id) echo " selected"; ?>><?
  79. echo $row_array[1];
  80. ?></option><?
  81. }
  82. ?></select></tr><tr><td colspan=2 align="center"><input type="submit" value="Сформировать"><input type="button" value="XLS" onclick="openur()"></td></table></form><?
  83. ibase_free_result($cursor);
  84.  
  85.  
  86. $dt1=substr($dt1,6,4)."-".substr($dt1,3,2)."-".substr($dt1,0,2);//." 00:00:00";
  87. $dt2=substr($dt2,6,4)."-".substr($dt2,3,2)."-".substr($dt2,0,2);//." 23:59:59";
  88. if ($podr_id!="")
  89. {
  90. $sql="SELECT
  91. upper(last_name||' '||first_name||' '||middle_name) fam,type_pass,
  92. date_pass,time_pass
  93. from
  94. tabel_intermediadate,staff,staff_ref
  95. where
  96. tabel_intermediadate.staff_id=staff.id_staff and
  97. staff.id_staff=staff_ref.staff_id and visible=1
  98. and subdiv_id=$podr_id and
  99. (type_pass=1 or type_pass=2) and date_pass between '$dt1' and '$dt2'
  100. order by
  101. upper(last_name||' '||first_name||' '||middle_name) ,
  102. date_pass,time_pass";
  103. //echo $sql;
  104. $cursor = ibase_query($sql);
  105.  
  106. $curr_user="ХУЕМВГРЫЗЛО";
  107. $curr_date="ХУЕМВГРЫЗЛО";
  108.  
  109. ?><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><?
  110. while($row_array = ibase_fetch_assoc($cursor))
  111. {
  112. if ($row_array["FAM"]!=$curr_user)
  113. {
  114. $curr_user=$row_array["FAM"];
  115. $curr_date="ХУЕМВГРЫЗЛО";
  116. echo "<tr><td colspan=\"2\" class=\"cap2\">".$row_array["FAM"]."</td></tr>";
  117. }
  118. if ($row_array["DATE_PASS"]!=$curr_date)
  119. {
  120. $curr_date=$row_array["DATE_PASS"];
  121. $dt=substr($row_array["DATE_PASS"],8,2).".".substr($row_array["DATE_PASS"],5,2).".".substr($row_array["DATE_PASS"],0,4);
  122. echo "<tr><td colspan=\"2\" class=\"cap1\">".$dt."</td></tr>";
  123. }
  124. if ($row_array["TYPE_PASS"]==1) $typ="Вход"; else $typ="Выход";
  125. 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>";
  126. //echo "<pre>";
  127. //print_r($row_array);
  128. //echo "</pre>";
  129.  
  130. }
  131. ?><tr><td colspan="2" style="border-top:1px solid #aaaaaa;">&nbsp;</td></tr></table><?
  132. ibase_free_result($cursor);
  133. }
  134. ibase_close($db);
  135.  
  136.  
  137. ?>
  138.  
  139. </body>
  140. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement