Advertisement
Guest User

Untitled

a guest
May 8th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.31 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. <script>
  34. function itog()
  35. {
  36. header("Content-Type: application/force-download");
  37. header("Content-Type: application/octet-stream");
  38. header("Content-Type: application/download");;
  39. header("Content-Disposition: attachment;filename=list.xls");
  40. echo $table;
  41. }
  42. </script>
  43.  
  44. <?
  45. require_once 'Classes/PHPExcel.php';
  46. function cp1251_to_utf8_recursive($data)
  47. {
  48. if (is_array($data))
  49. {
  50. $d = array();
  51. foreach ($data as $k => &$v)
  52. {
  53. $d[cp1251_to_utf8_recursive($k)] = cp1251_to_utf8_recursive($v);
  54. }
  55. return $d;
  56. }
  57. if (is_string($data)) return iconv('cp1251', 'utf-8//IGNORE//TRANSLIT', $data);
  58. //if (is_string($data)) return iconv('cp1251', 'utf-8', $data);
  59. if (is_scalar($data) or is_null($data)) return $data;
  60. return $data;
  61. }
  62. function cp1251_to_utf8 ($txt) {
  63. $txt=cp1251_to_utf8_recursive($txt);
  64. return $txt;
  65. }
  66. $dt=date("d.m.Y");
  67. $dt1=$_GET["dt1"];
  68. if ($dt1=="") $dt1=$dt;
  69. $dt2=$_GET["dt2"];
  70. if ($dt2=="") $dt2=$dt;
  71. $podr_id=$_GET["podr_id"];
  72. ?>
  73. <body><h1>СКД</h1><form>
  74. <table cellpadding="2" cellspacing="0">
  75. <tr><td>Период: с </td><td><input type="text" id="dt1" name="dt1" value="<? echo $dt1; ?>" autocomplete="off" onblur="setTimeout('getasbn(1)',200);"></td></tr>
  76. <tr><td>по</td><td><input type="text" id="dt2" name="dt2" value="<? echo $dt2; ?>" autocomplete="off" onblur="setTimeout('getasbn(1)',200);"></td></tr>
  77. <tr><td>Подразделение:</td><td>
  78. <?php
  79.  
  80. $strconnect = '192.168.1.254:D:\Perco\SKD_Base\SCD15.FDB';
  81. $db=ibase_connect($strconnect, 'SYST', 'Wbnhec98', 'WIN1251', 0, 3);
  82.  
  83. $sql="select * from v_ref_depart";
  84. $cursor = ibase_query($sql);
  85. ?><select name="podr_id" id="podr_id"><?
  86. while($row_array = ibase_fetch_row($cursor))
  87. {
  88. ?><option value=<? echo $row_array[0]; if ($row_array[0]==$podr_id) echo " selected"; ?>><?
  89. echo $row_array[1];
  90. ?></option><?
  91. }
  92. ?></select></tr><tr><td colspan=2 align="center"><input type="submit" value="Сформировать"><input type="button" value="XLS" onclick="openur()"><input type="button" value="На заводе" onclick="itog()"></td></table></form><?
  93. ibase_free_result($cursor);
  94.  
  95.  
  96. $dt1=substr($dt1,6,4)."-".substr($dt1,3,2)."-".substr($dt1,0,2);//." 00:00:00";
  97. $dt2=substr($dt2,6,4)."-".substr($dt2,3,2)."-".substr($dt2,0,2);//." 23:59:59";
  98. if ($podr_id!="")
  99. {
  100. $sql="SELECT
  101. upper(last_name||' '||first_name||' '||middle_name) fam,type_pass,
  102. date_pass,time_pass
  103. from
  104. tabel_intermediadate,staff,staff_ref
  105. where
  106. tabel_intermediadate.staff_id=staff.id_staff and
  107. staff.id_staff=staff_ref.staff_id and visible=1
  108. and subdiv_id=$podr_id and
  109. (type_pass=1 or type_pass=2) and date_pass between '$dt1' and '$dt2'
  110. order by
  111. upper(last_name||' '||first_name||' '||middle_name) ,
  112. date_pass,time_pass";
  113. //echo $sql;
  114. $cursor = ibase_query($sql);
  115.  
  116. $curr_user="ХУЕМВГРЫЗЛО";
  117. $curr_date="ХУЕМВГРЫЗЛО";
  118.  
  119. $table='<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>';
  120. while($row_array = ibase_fetch_assoc($cursor))
  121. {
  122. if ($row_array["FAM"]!=$curr_user)
  123. {
  124. $curr_user=$row_array["FAM"];
  125. $curr_date="ХУЕМВГРЫЗЛО";
  126. echo "<tr><td colspan=\"2\" class=\"cap2\">".$row_array["FAM"]."</td></tr>";
  127. }
  128. if ($row_array["DATE_PASS"]!=$curr_date)
  129. {
  130. $curr_date=$row_array["DATE_PASS"];
  131. $dt=substr($row_array["DATE_PASS"],8,2).".".substr($row_array["DATE_PASS"],5,2).".".substr($row_array["DATE_PASS"],0,4);
  132. echo "<tr><td colspan=\"2\" class=\"cap1\">".$dt."</td></tr>";
  133. }
  134. if ($row_array["TYPE_PASS"]==1) $typ="Вход"; else $typ="Выход";
  135. 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>";
  136. //echo "<pre>";
  137. //print_r($row_array);
  138. //echo "</pre>";
  139.  
  140. }
  141. $table .= '<tr><td colspan="2" style="border-top:1px solid #aaaaaa;">&nbsp;</td></tr></table>';
  142. ibase_free_result($cursor);
  143. }
  144. ibase_close($db);
  145.  
  146.  
  147. ?>
  148.  
  149. </body>
  150. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement