Corporate Reports
Corporate Reports

Browse Listing of Corporate Reports

"; } echo ""; //used tables $tablecomp = "company"; $tablereport = "report"; if (empty($offset)) { $offset = 0; } // Search for companies that start with a certain letter $SQL = "select $tablecomp.name, $tablecomp.companyID from $tablecomp where $tablecomp.name like '$company%' order by name"; if($records =="") { $QUERY = db_query(array($dbname, $SQL,$conn)); $records = db_num_rows(array($QUERY)); } if($page =="") { $page = 1; } $SQL .=" LIMIT $offset, $recordsperpage"; //echo "$SQL"; $QUERY = db_query(array($dbname, $SQL,$conn)) or die(mysql_error()); //***********************PROCESS THIS IF STATEMENT IF THE MINIMUM NUMBER OF ROWS IS NOT EMPTY***************************** //**********************************the result is already fetched out***************************************************** if($records !=0) { //*************NUMBER OF PAGES TO BE DISPLAYED FROM THE TOTAL RESULTS.********* $page=intval($records/$recordsperpage); // $pages now contains int of pages needed unless there is a remainder from division if ($records%$recordsperpage) {//stays same // has remainder so add one page $page++; } // $lastpage contains the offset number that indicates the last page $lastpage = $page * $recordsperpage - $recordsperpage; //FIND OUT WHAT IS THE CURRENT PAGE if(($offset/$recordsperpage) == 0) { $currpage = 1; } else { $currpage =(intval($offset/$recordsperpage)) + 1; } }//*********************************************CLOSING THE IF REGARDING THE MINIMUM NUMBER OF ROWS*********************** //************************************CHECK IF RESULT IS EMPTY************************************************************ //++++++++++++++++++++++IF THE MAXRESULTS IS EMPTY, THEN THERE IS NO MATCHING ROW FOUND+++++++++++++++++++++++++++++++++++ if($records > 0) { while($row = db_fetch_row(array($QUERY))) { echo ""; } //*************NUMBER OF PAGES TO BE DISPLAYED FROM THE TOTAL RESULTS.********* if($lastpage != 0) { echo ""; } // end of if records are found else { //if no records found if ($companyID == "") { echo ""; } } echo "
A :: B :: C :: D :: E :: F :: G :: H :: I :: J :: K :: L :: M :: N :: O :: P :: Q :: R :: S :: T :: U :: V :: W :: X :: Y :: Z
$row[name] (View Company Detail)
Page $currpage of $page"; //If the $offset is 0, first page, do not show LINK FOR PREVIOUS PAGE if ($offset!=0) { // bypass PREV link if offset is not 0 $prevoffset=$offset-$recordsperpage; echo "<< First | "; echo ""; if ($offset != $lastpage) { echo "Previous | "; } else { echo "Previous"; } } // check to see if last page $remainder = $offset + 1; if (((intval($remainder/$recordsperpage))+($remainder%$recordsperpage) !=$page) && $page!=1) {// not last page so give NEXT link $newoffset=$offset+$recordsperpage; echo "Next | "; echo "Last >>"; } } // end of else which creates the links First, Next, Previous, Last echo "
There are no companies that start with ".$company."
"; if ($companyname != "") // DISPLAY THE LIST OF REPORTS { $companyname = addslashes($companyname); $SQL = "select $tablereport.startYear, $tablereport.endYear, $tablereport.filename, $tablereport.filesize from $tablereport left join $tablecomp using (companyID) where $tablecomp.name = '$companyname' order by $tablereport.startYear"; $QUERY = db_query(array($dbname, $SQL,$conn)); $records2 = db_num_rows(array($QUERY)); $companyname = stripslashes($companyname); //echo "$SQL"; $QUERY = db_query(array($dbname, $SQL,$conn)) or die(mysql_error()); echo "
"; if($records2 > 0) { echo ""; $samestartyear; $sameendyear; $char = 98; //the letter b while($row = db_fetch_row(array($QUERY))) { if ($row[startYear] == $row[endYear]) { if ($row[filename] == "") { if ($row[startYear] != $samestartyear) { echo ""; $char = 98; } else { echo ""; $char++; } } else { if ($row[startYear] != $samestartyear) { echo ""; $char = 98; } else { echo ""; $char++; } } } else { if ($row[filename] == "") { if ($row[startYear] != $samestartyear || $row[endYear] != $sameendyear) { echo ""; $char = 98; } else { echo ""; $char++; } } else { if ($row[startYear] != $samestartyear || $row[endYear] != $sameendyear) { echo ""; $char = 98; } else { echo ""; $char++; } } } $samestartyear = $row[startYear]; $sameendyear = $row[endYear]; } } else { echo ""; } echo "
Reports
$companyname
$row[startYear]
$row[startYear]".chr($char)."
$row[startYear] ($row[filesize])
$row[startYear]".chr($char)." ($row[filesize])
$row[startYear]/$row[endYear]
$row[startYear]/$row[endYear]".chr($char)."
$row[startYear]/$row[endYear] ($row[filesize])
$row[startYear]/$row[endYear]".chr($char)." ($row[filesize])
There are currently no reports available for $companyname
"; echo "
"; } // END OF IF FOR DISPLAYING THE REPORT LIST ?>