Odyssey
stmt_hist.prg
1 <?php
2  $monLibrary= dirname(__FILE__) . "/../library";
3  require_once("$monLibrary/cu_top.i");
4  require_once("$monLibrary/ck_hticket.i");
5 
6 # share permissions of 'stmnt_reports' instead of 'basename($_SERVER['SCRIPT_NAME'])'
7  if (!CheckPerm($link, $Hu, 'stmnt_reports', $_SERVER['REMOTE_ADDR'])) {
8  // ** Permissions failed
9  // ** redirect to new page
10  header("Location: /hcuadm/hcu_noperm.prg");
11  exit;
12  }
13 
14 $dms_ok=array('rowid'=>'string');
15 dms_import($dms_ok);
16 
17  cu_header("$rowid Statement Load History");
18  $filepath = "/home/" . $rowid . "/stmnt";
19  if(is_readable("$filepath/summary.log")) {
20  print "<form>
21  <table border=1 cellpadding=1 cellspacing=1>
22  <tr>
23  <td class='bar' align=center colspan='8'>
24  $rowid Statement Load History
25  </td>
26  </tr>
27  <tr><th>Load Date</th>
28  <th>Period</th>
29  <th>Status</th>
30  <th>Loaded</th>
31  <th>Overwritten</th>
32  <th>Dropped</th>
33  <th colspan='2'>Details</th></tr>\n";
34 
35  $drop=array(" ","-",":");
36  # one year maximum displayed
37  $showmax = date('Y-m-d H:i:s',time() - (366 * 24 * 60 * 60));
38 
39  $fp = array();
40  $fp = file("$filepath/summary.log");
41  if(is_array($fp)) rsort($fp);
42  foreach($fp as $buffer) {
43  $buffer = rtrim($buffer);
44  if("$buffer" > '') {
45  list($lddate,$procid,$perdate,$pertype,$fin,$loadcount,$overcount,$dropcount,$perdesc) = explode("\t",$buffer);
46 
47  if ($lddate < $showmax) break;
48 
49  $procid = preg_replace('/^0*/','',$procid);
50  $fin = preg_replace('/Norm\/0$/','&nbsp;',$fin);
51  $fin = preg_replace('/\/0$/','',$fin);
52  $outlinkname=(str_replace($drop,"",$lddate) . "." . $procid . ".out");
53  $errlinkname=(str_replace($drop,"",$lddate) . "." . $procid . ".err");
54  $maelinkname=(str_replace($drop,"",$lddate) . "." . $procid . ".mae");
55 
56  if (is_readable("/home/$rowid/stmnt/logs/$errlinkname")) {
57  $log="<a href='tfiles.prg/$rowid/stmnt/logs/$errlinkname' target='CONTENT'>$lddate</a>";
58  } else {
59  $log=$lddate;
60  }
61  if (is_readable("/home/$rowid/stmnt/logs/$outlinkname")) {
62  $outlog="<a href='tfiles.prg/$rowid/stmnt/logs/$outlinkname' target='CONTENT'>Show</a>";
63  } else {
64  $outlog="&nbsp;";
65  }
66  if (is_readable("/home/$rowid/stmnt/logs/$maelinkname")) {
67  $maelog="<a href='tfiles.prg/$rowid/stmnt/logs/$maelinkname' target='CONTENT'>MAE</a>";
68  } else {
69  $maelog="&nbsp;";
70  }
71  print "<tr><td class='dtl'>$log</td>
72  <td class='dtl'>$perdesc</td>
73  <td class='dtl'>$fin</td>
74  <td class='dtl'>$loadcount</td>
75  <td class='dtl'>$overcount</td>
76  <td class='dtl'>$dropcount</td>
77  <td class='dtl'>$outlog</td>
78  <td class='dtl'>$maelog</td>
79  </tr>\n";
80  }
81 
82  }
83  print "</table></form>";
84  } else {
85  print "<H1>Not Found</H1>
86  E-Statement log (summary.log) not found for $rowid.
87  <HR>";
88 }
89  print "</body></html>";
90 ?>