Advertisement
Guest User

Untitled

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