Subversion Repositories computer_asset_manager_v1

Rev

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

<?php 
   global $reporticoURL;
   if ( $reporticoURL ) {
      header( "location: $reporticoURL" ;
   }
   include_once("header.php");
   include_once('reports.php');
   $query = stripslashes($_POST['query']);
?>
<?php include_once( 'header.php' ); ?>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<SCRIPT LANGUAGE="JavaScript">

function openindex( text, title, wTitle ) {
   var scroll = 1;
   OpenWindow=window.open("", "newwin", "height=250, width=1000,toolbar=no,scrollbars="+scroll+",menubar=yes");
   OpenWindow.document.write("<TITLE>" + wTitle + "</TITLE>");
   OpenWindow.document.write("<BODY>");
   OpenWindow.document.write( '<h1 align="center">' + title + "</h1>");
   OpenWindow.document.write(text);
   OpenWindow.document.write("</BODY>");
   OpenWindow.document.write("</HTML>");
   
   OpenWindow.document.close()
   self.name="main"
}
</SCRIPT>
<head>
  <title>Daily Data - Computer Asset Management Program</title>
  <link rel="stylesheet" type="text/css" href="camp.css">
</head>
<body>
<?php include_once('menu.php'); ?>
<div id="content">
   <h1>Defined Reports</h1>
      <?php
          if ($_POST['report']) { // a report is defined, so let's show the parameters for it
            $thisReport = new Report();
            $thisReport->loadFromDatabase($_POST['report']);
            if ( $thisReport->parameters() ) {
               print "<p>Fill out the parameter values below, then click Submit to generate the report in a new window</p>";
               print '<FORM action="' . $_SERVER['PHP_SELF'] . '" method="POST" enctype="multipart/form-data">';
               print "<table>";
               print "<INPUT type='hidden' name='report' value='" . $_POST['report'] . "'>";
               print "<INPUT type='hidden' name='action' value='run'>";
               print "<tr><td>";
               print $thisReport->parameterInputScreen();
               print "</td></tr>";
               print '<tr><td><INPUT type="submit" name="Submit" value="Submit"></td></tr>';
               print "</table>";
               print '</form>';
            } else { // no parameters
               $_POST['action'] = 'run'; // just tell the report to run
            }
         }
         if ( $_POST['action'] == 'run' ) { // we have a report name, and all the parameters. Display results in a window
            $thisReport = new Report();
            $thisReport->loadFromDatabase($_POST['report']);
            $reportResults = $thisReport->run();
            $windowTitle = $thisReport->name();
            print "<SCRIPT LANGUAGE='JavaScript'> openindex( '$reportResults','', '$windowTitle' ); </script>";
            // print $thisReport->run(  );
         }
      ?>
      <p>Select a report from the list below and click Submit to run it</p>
      <FORM action="<?php print $_SERVER['PHP_SELF']; ?>" method="POST" enctype="multipart/form-data">
         <select name='report'>
            <?php print Report::listAllReports(); ?>
         </select>
         <INPUT type="submit" name="Submit" value="Submit">
      </form>
   <h1>Ad-Hoc Report</h1>
   <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data">
      <table width='90%' border="1" align='center'>
         <tr>
            <td valign='top'>
               Enter Query
            </td>
            <td valign='top'>
               <textarea name="query" cols="75%" rows="10"><?php print $query; ?></textarea> 
            </td>
         </tr>
         <tr>
            <td valign='top'>
               Title of Report
            </td>
            <td valign='top'>
               <input type="text" name="title" value="<?php print $_POST['title']; ?>">
            </td>
         </tr>
         <tr>
            <td valign='top'>
               Window Title
            </td>
            <td valign='top'>
               <input type="text" name="wtitle" value="<?php print $_POST['wtitle']; ?>">
            </td>
         </tr>
         <tr>
            <input type="submit" name="Submit" value="Run Query" />
         </tr>
      </table>
   </form>
   <?php 
     if ( $query ) {
        $reportResults = queryToTable( $query );
        $reportTitle = htmlentities($_POST['title']);
        $windowTitle = htmlentities($_POST['wtitle']);
        print "<SCRIPT LANGUAGE='JavaScript'> openindex( '$reportResults','$reportTitle', '$windowTitle' ); </script>";
     }
   ?>
</div>
</body>
</html>