Subversion Repositories computer_asset_manager_v1

Rev

Rev 1 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 rodolico 1
<?php 
116 rodolico 2
   global $reporticoURL;
3
   if ( $reporticoURL ) {
4
      header( "location: $reporticoURL" ;
5
   }
1 rodolico 6
   include_once("header.php");
7
   include_once('reports.php');
8
   $query = stripslashes($_POST['query']);
9
?>
10
<?php include_once( 'header.php' ); ?>
11
<?xml version="1.0" encoding="utf-8"?>
12
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
13
<html xmlns="http://www.w3.org/1999/xhtml">
14
<SCRIPT LANGUAGE="JavaScript">
15
 
16
function openindex( text, title, wTitle ) {
17
   var scroll = 1;
18
   OpenWindow=window.open("", "newwin", "height=250, width=1000,toolbar=no,scrollbars="+scroll+",menubar=yes");
19
   OpenWindow.document.write("<TITLE>" + wTitle + "</TITLE>");
20
   OpenWindow.document.write("<BODY>");
21
   OpenWindow.document.write( '<h1 align="center">' + title + "</h1>");
22
   OpenWindow.document.write(text);
23
   OpenWindow.document.write("</BODY>");
24
   OpenWindow.document.write("</HTML>");
25
 
26
   OpenWindow.document.close()
27
   self.name="main"
28
}
29
</SCRIPT>
30
<head>
31
  <title>Daily Data - Computer Asset Management Program</title>
32
  <link rel="stylesheet" type="text/css" href="camp.css">
33
</head>
34
<body>
35
<?php include_once('menu.php'); ?>
36
<div id="content">
37
   <h1>Defined Reports</h1>
38
      <?php
39
          if ($_POST['report']) { // a report is defined, so let's show the parameters for it
40
            $thisReport = new Report();
41
            $thisReport->loadFromDatabase($_POST['report']);
42
            if ( $thisReport->parameters() ) {
43
               print "<p>Fill out the parameter values below, then click Submit to generate the report in a new window</p>";
44
               print '<FORM action="' . $_SERVER['PHP_SELF'] . '" method="POST" enctype="multipart/form-data">';
45
               print "<table>";
46
               print "<INPUT type='hidden' name='report' value='" . $_POST['report'] . "'>";
47
               print "<INPUT type='hidden' name='action' value='run'>";
48
               print "<tr><td>";
49
               print $thisReport->parameterInputScreen();
50
               print "</td></tr>";
51
               print '<tr><td><INPUT type="submit" name="Submit" value="Submit"></td></tr>';
52
               print "</table>";
53
               print '</form>';
54
            } else { // no parameters
55
               $_POST['action'] = 'run'; // just tell the report to run
56
            }
57
         }
58
         if ( $_POST['action'] == 'run' ) { // we have a report name, and all the parameters. Display results in a window
59
            $thisReport = new Report();
60
            $thisReport->loadFromDatabase($_POST['report']);
61
            $reportResults = $thisReport->run();
62
            $windowTitle = $thisReport->name();
63
            print "<SCRIPT LANGUAGE='JavaScript'> openindex( '$reportResults','', '$windowTitle' ); </script>";
64
            // print $thisReport->run(  );
65
         }
66
      ?>
67
      <p>Select a report from the list below and click Submit to run it</p>
68
      <FORM action="<?php print $_SERVER['PHP_SELF']; ?>" method="POST" enctype="multipart/form-data">
69
         <select name='report'>
70
            <?php print Report::listAllReports(); ?>
71
         </select>
72
         <INPUT type="submit" name="Submit" value="Submit">
73
      </form>
74
   <h1>Ad-Hoc Report</h1>
75
   <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data">
76
      <table width='90%' border="1" align='center'>
77
         <tr>
78
            <td valign='top'>
79
               Enter Query
80
            </td>
81
            <td valign='top'>
82
               <textarea name="query" cols="75%" rows="10"><?php print $query; ?></textarea> 
83
            </td>
84
         </tr>
85
         <tr>
86
            <td valign='top'>
87
               Title of Report
88
            </td>
89
            <td valign='top'>
90
               <input type="text" name="title" value="<?php print $_POST['title']; ?>">
91
            </td>
92
         </tr>
93
         <tr>
94
            <td valign='top'>
95
               Window Title
96
            </td>
97
            <td valign='top'>
98
               <input type="text" name="wtitle" value="<?php print $_POST['wtitle']; ?>">
99
            </td>
100
         </tr>
101
         <tr>
102
            <input type="submit" name="Submit" value="Run Query" />
103
         </tr>
104
      </table>
105
   </form>
106
   <?php 
107
     if ( $query ) {
108
        $reportResults = queryToTable( $query );
109
        $reportTitle = htmlentities($_POST['title']);
110
        $windowTitle = htmlentities($_POST['wtitle']);
111
        print "<SCRIPT LANGUAGE='JavaScript'> openindex( '$reportResults','$reportTitle', '$windowTitle' ); </script>";
112
     }
113
   ?>
114
</div>
115
</body>
116
</html>