Subversion Repositories computer_asset_manager_v1

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

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