File "printable.php"
Full path: /home/andyrdhboardrevi/public_html/.cp__/printable.php
File size: 4.14 KiB (4242 bytes)
MIME-type: text/x-php
Charset: utf-8
Download Open Edit Advanced Edit Back
<?php
if($_REQUEST['cecource'] == 2)
{$usrTable = "dha_registered_user_ce";}
else
{$usrTable = "dha_registered_user";}
include ('php/database.php');
$db = new db;
// get fields and order
$fields1 = trim($_POST['order'],',');
$order = explode(',',$fields1);
// build sql statement
$sql_search = '';
$sql_sort = '';
function get_User_Meta_Cust($metaKey, $userID = 0){
global $db;
$data = $db->query("SELECT * FROM dha_user_metadata where user_id='".$userID."' and meta_key='".$metaKey."'");
$row = mysqli_fetch_assoc($data[0]);
return $row['meta_value'];
}
foreach($order as $f) {
// search
if($f=="gradMonth" || $f == "gradYear" || $f == "boardMonth"){
break;
}
if($f == "DhaPinNumber")
$f = "DhsPinNumber";
$fields .= $f." ,";
if($_POST[$f] != '')
$sql_search .= " $f like '%".$_POST[$f]."%' ,";
// sort
if($_POST['_'.$f] != 'none')
$sql_sort = $f." ,";
}
$fields = trim($fields,',');
$dateFYear = $_POST['dispyear'] ;
$dateNYear = $dateFYear + 1;
$date1 = $dateFYear.'-04-01' ;
$date2 = $dateNYear.'-04-01' ;
// limit
if ($_POST['numbers'] == 'limit')
$limit = " LIMIT ".$_POST['num'];
else
$limit = '';
// check for sort and search
if ($sql_search != '')
{$sql_search = " WHERE ".trim($sql_search,',');
$sql_search .= " and date between '$date1' and '$date2'";
}
else
{
$sql_search = " WHERE date between '$date1' and '$date2'";
}
if ($sql_sort != '')
$sql_sort = ' ORDER BY '.trim($sql_sort,',');
// execute
$data = $db->query("SELECT name_id, $fields FROM ".$usrTable." $sql_search $sql_sort");
$dataTwilio = $db->query("SELECT * FROM dha_twilio_numbers order by numID");
while ($row = mysqli_fetch_assoc($dataTwilio[0])) {
$twilioARR[$row['numID']] = $row['twilioNum'];
}
?>
<?php
// cost related values
$total = 0;
$iscost = false;
$width = 0;
?>
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $_POST['title']; ?></title>
<link rel="stylesheet" type="text/css" href="css/printer_friendly.css">
</head>
<body>
<h2><?php echo $_POST['title']; ?></h2>
<table border="0" cellspacing="0" cellpadding="3" class="box" >
<tr>
<td class="head" align="center">Serial #</td>
<?php foreach ($order as $f){ ?>
<td class="head" align="center" width="<?php echo $_POST[$f."_size"]; ?>"><?php echo ucfirst($f); ?></td>
<?php
$width += $_POST[$f."_size"] +1;
}
?>
</tr>
<?php $i=1;
while ($row = mysqli_fetch_assoc($data[0])) { ?>
<tr>
<td class="data"><?php echo $i; ?></td>
<?php foreach ($order as $f){ ?>
<td class="data" ><?php
if($f == "DhaPinNumber")
$f = "DhsPinNumber";
if ($f == 'cost') {
echo '$'.number_format($row[$f],2);
$iscost = true;
$total += $row[$f];
}
else if ($f == 'status'){
if ($row[$f] == 1)
echo 'Registered';
else
echo 'Unregistered';
}
else if ($f == 'texttimezone') {
if($row[$f] == 'America/Chicago')
echo "Central";
else if($row[$f] == 'America/Denver')
echo "Mountain";
else if($row[$f] == 'America/Los_Angeles')
echo "Pacific";
else if($row[$f] == 'America/Anchorage')
echo "Alaska";
else if($row[$f] == 'America/Adak')
echo "Hawaii";
else if($row[$f] == 'America/New_York')
echo "Eastern";
else
echo "";
}
else if ($f == 'textPhone'){
echo $twilioARR[$row[$f]];
}
else if ($f == 'date'){
echo date("n/j/Y", strtotime($row[$f]));
}
else if ($f == 'gradMonth'){
echo get_User_Meta_Cust("USER_GRAD_MONTH",$row['name_id'] );
}
else if ($f == 'gradYear'){
echo get_User_Meta_Cust("USER_GRAD_YEAR",$row['name_id'] );
}
else if ($f == 'boardMonth'){
echo get_User_Meta_Cust("USER_BOARD_MONTH",$row['name_id'] );
}
else
echo ucfirst($row[$f])." ";
?></td>
<?php } ?>
</tr>
<?php
$i ++ ;
} ?>
</table>
<br />
<div style="padding-left:20px;">
<?php if ($iscost) echo "Total Cost : $".number_format($total,2); ?>
</div>
<br /><br /><br />
<?php echo ucfirst($_POST['title']).' @ '.$_POST['time']; ?>
<span>
</span>
<style>
.box {width:<?php echo $width; ?>px;}
</style>
</body>
</html>