|
Server : Apache/2.4.62 System : FreeBSD fbsdweb2.web.rcn.net 14.1-RELEASE FreeBSD 14.1-RELEASE releng/14.1-n267679-10e31f0946d8 GENERIC amd64 User : www ( 80) PHP Version : 8.3.8 Disable Function : NONE Directory : /domains/academic/demo/academic/SmartReport/wizard/engine/layouts/ |
Upload File : |
<?php
/**
* Generated by Smart Report Maker
*All copyrights are preserved to StarSoft
*http://mysqlreports.com/
*
*/
error_reporting(E_ERROR | E_PARSE);
require_once("lib.php");
$css = $style_name . ".css" ;
//*************************create sql statement ******************* $$$
if($datasource=='sql')
{
$sql = Prepare_QSql();
}
else
{
$sql = Prepare_TSql();
}
//get number of rows
$result = query($sql);
$nRecords = mysql_num_rows($result); //$$$
if(isset($_GET["start"]))
$start = $_GET["start"];
if(isset($_GET["print"]))
$print = $_GET["print"];
else
$print = 0;
if(empty($records_per_page)) $records_per_page = 10;
if(empty($start)) $start = 0;
/* begin of export section*********** */
//Exporting section
if(isset($_GET['export']))
{
$export = $_GET['export'];
}
else
{
$export = "";
}
//export data
if($export =='csv' )
{
export_csv($sql,false,0,10);
exit;
}
elseif($export == 'csv1')
{
export_csv($sql,true,$start,$records_per_page);
exit;
}
else if($export=='xml')
{
export_xml($sql,false,0,10);
exit;
}
elseif($export == 'xml1')
{
export_xml($sql,true,$start,$records_per_page);
exit;
}
else if($export =='pdf1')
{
if(count($fields)>8)
get_pdf($sql,'a4','landscape',10,10,10,10,780,800,10,11,true,$start,$records_per_page);
else
get_pdf($sql,'a4','portrait',10,10,10,10,490,500,9,10,true,$start,$records_per_page);
exit;
}
else if($export =='pdf')
{
if(count($fields)>8)
get_pdf($sql,'a4','landscape',10,10,10,10,780,800,10,11,false,$start,$records_per_page);
else
get_pdf($sql,'a4','portrait',10,10,10,10,490,500,9,10,false,$start,$records_per_page);
exit;
}
//exporting links
$link_pdf_current = $_SERVER["PHP_SELF"]."?export=pdf1&&start=$start";
$link_csv_current = $_SERVER["PHP_SELF"]."?export=csv1&&start=$start";
$link_xml_current = $_SERVER["PHP_SELF"]."?export=xml1&&start=$start";
$link_csv_all = $_SERVER["PHP_SELF"]."?export=csv";
$link_xml_all = $_SERVER["PHP_SELF"]."?export=xml";
$link_pdf_all = $_SERVER["PHP_SELF"]."?export=pdf";
// ********************************************/
//**************************print links****************************** $$$
$link_print1 = $_SERVER["PHP_SELF"]."?print=1&&start=$start";
$link_print2 = $_SERVER["PHP_SELF"]."?print=2";
$link_print_real = $_SERVER['PHP_SELF']."?print=3&start=$start";
$levels = count($group_by);
//*************************next and prev links ********************* $$$
$next_start = $start+$records_per_page;
if($next_start >= $nRecords) $next_start = $start;
$link_next=$_SERVER["PHP_SELF"]."?start=$next_start ";
$prev_start = $start - $records_per_page;
if($prev_start < 0) $prev_start = 0;
$link_prev=$_SERVER["PHP_SELF"]."?start=$prev_start";
$link_home = $_SERVER["PHP_SELF"];
if($print !=2)
$sql .= " limit $start,$records_per_page";
$link = query($sql);
$columns = mysql_num_fields($link)-$levels;
$span = "colspan='$columns'";
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title><?php echo $title ?></title>
<script type="text/javascript" language="javascript">
function PrintMe()
{
var Print = document.getElementById('Print');
var Report_Preview = document.getElementById('Report_Preview');
Print.style.display = 'none';
Report_Preview.style.display = 'none';
window.print();
}
</script>
<link href="
<?php
if($print!= 0)
{
echo "print.css" ;
}
else
{
echo $css;
}
?>" rel="stylesheet" type="text/css" />
</head>
<body class="MainPage">
<table border="0"
<?php
//width of report
if($print != 0)
echo "width='500'";
else
echo "width ='100%'";
?>
align="center" cellpadding="2" cellspacing="0" class="MainTable">
<!-- ************************* Menu code **************************** !-->
<?php
if($print !=3 ) //not in real priting mode
{
?>
<tr>
<td height="27" class="menu" <?php echo($span);?> id="menu_row">
<?php
include("menu.php")
?></td>
</tr>
<?php
}
?>
<!-- *************************End Of Menu code **************************** !-->
<?php
if(!empty($header))
{
?>
<tr>
<td <?php echo $span; ?> valign="top" ><?php echo $header;?></td>
</tr>
<tr>
<td <?php echo $span;?> valign="top" class="Separator" ></td>
</tr>
<?php
}
?>
<!-- ******************** end custom header ******************** !-->
<tr>
<td <?php echo $span; ?> height="33" valign="top" class="Title"><?php echo $title; ?></td>
</tr>
<?php
if(!empty($group_by))
{
?>
<tr>
<td <?php echo $span; ?> class="Separator"> </td>
</tr>
<?php
}
$cur_grouped = array();
$saved_grouped = array();
$records = 0;
$state = true; //flag for toggling
while($row = mysql_fetch_array($link,MYSQL_ASSOC))
//$row = mysql_fetch_array($link,MYSQL_ASSOC);
{
//filling array with current grouping vals
foreach($group_by as $val)
{
$cur_grouped[$val]=$row[$val];
}
//checking the variations
if(count($saved_grouped) != 0)
{
$index = grouping_diff_index($cur_grouped,$saved_grouped);
}
else
{
if($records == 0)
{
$index = 0; //intialize the structure
}
else
{
$index = -1;//No grouping and the structure is intialized
}
}
if($index != -1)
{
//things that done only when there is variations
// if($records != 0 )echo"</table></td></tr>";
if(!empty($group_by))
{
for($i=$index;$i<$levels;$i++)
{
if($i==0&&$index ==0)
{
//main grouping
echo "<tr><td $span class='MainGroup'>".$group_by[0]." : ".$row[$group_by[0]]."</td></tr>";
}
else
{
//sub grouping
$step_length = 3 * $i;
$step = str_repeat(" ",$step_length);
echo "<tr><td $span class='SubGroup'>$step".$group_by[$i]." : ".$row[$group_by[$i]]."</td></tr>";
}
}
}
//columns and table head
echo"<tr><td height='15' $span class='TableHeader'></td>
</tr>";
//echo"<tr><td><table width='100%' cellspacing='0' cellpadding='10'>";
echo"<tr>";
//drawing the fields head
foreach($fields as $f)
{
if(in_array($f,$group_by))
{
continue;
}
else
{
echo"<td align='center' class='ColumnHeader'>$f </td>";
}
}
echo "</tr>";
//that's all the things that done only when there is variation in grouping array
}
// things that should be done weather or not there is a variations
//adding a data row
echo"<tr>";
foreach($fields as $f)
{
if(empty($row[$f]))$row[$f]=" ";
if(in_array($f,$group_by))
{
continue;
}
else
{
if($state)
echo"<td align='center' class='TableCell'>$row[$f]</td>";
else
echo"<td align='center' class='AlternateTableCell'>$row[$f]</td>";
}
$state =!$state;
}
echo"</tr>";
//updating saved array
foreach($group_by as $v)
{
$saved_grouped[$v]=$row[$v];
}
$records++;
} //ending of main while loop
// echo"</table></td></tr>";
?>
<!--*****************************-->
<!-- ******************** start custom footer ******************** !-->
<?php
if(!empty($footer))
{
echo "<tr><td $span > $footer</td></tr>";
}
?>
<!-- ******************** end custom footer ******************** !-->
<!--Footer of report******************-->
<tr>
<td <?php echo $span; ?> class="TableFooter"> </td>
</tr>
</table>
<!-- ************************* Show print Dialog **************************** !-->
<?php
//show print dialog in case of print mode $$$
if($print==3)
{
?>
<script>
window.print();
</script>
<?php
}
?>
<!-- ************************* End Of Show print Dialog ********************* !-->
</body>
</html>