Advertisement
Guest User

Untitled

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