Current File : /home/inlingua/www/icentex/admin/timesheet_excel_monthly_old_12_6_19.php |
<?php
ini_set("memory_limit","128M");
//this sets it unlimited
//echo"<br><br>";
ini_set("max_execution_time",0);
include("header.php");
// Include the database connection details
require('dbConnection.php');
// Include common functions
require('commonFunc.php');
// Include common functions
require('globalVars.php');
// Include the table handler class
require('dbHandler.class.php');
// Init and connect to database
$dbObject = new dbHandler();
$dbObject->connect();
?>
<div class="clear"></div>
<?php include("left.php"); ?>
<div id="content-wrap" style="padding-top:20px;" >
<div id="content-box" >
<div id="toolbar-title" >
<h3>
Excel Report (Month wise)
</h3>
<div class="clear"></div>
</div>
<div id="toolbar-box">
<div class="toolbar" id="toolbar"></div>
<div class="clear"></div>
</div>
<div class="clear"></div>
<div id="element-box">
<div class="m">
<table class="adminform">
<tbody><tr>
<td valign="top" width="55%">
<br>
<?php
$half=$_REQUEST[half];
$month=$_REQUEST[month];
$year=$_REQUEST[year];
$num = cal_days_in_month(CAL_GREGORIAN, $month, $year); // 31
//echo "There was $num days in August 2003";
$date1="".$year."-".$month."-01";
$date2="".$year."-".$month."-".$num."";
$datetime2="".$date2."";
if($_REQUEST[location]=="All")
{
$query="select DISTINCT `instructorId`,`recNo`, `location`, `Instname`, `fromDate`, `toDate`, `date1`, `eng1`, `fr1`, `ger1`, `sp1`, `clubs1`, `training1`, `biz1`, `others1`, `orals1`, `date2`, `eng2`, `fr2`, `ger2`, `sp2`, `clubs2`, `training2`, `biz2`, `others2`, `orals2`, `date3`, `eng3`, `fr3`, `ger3`, `sp3`, `clubs3`, `training3`, `biz3`, `others3`, `orals3`, `date4`, `eng4`, `fr4`, `ger4`, `sp4`, `clubs4`, `training4`, `biz4`, `others4`, `orals4`, `date5`, `eng5`, `fr5`, `ger5`, `sp5`, `clubs5`, `training5`, `biz5`, `others5`, `orals5`, `date6`, `eng6`, `fr6`, `ger6`, `sp6`, `clubs6`, `training6`, `biz6`, `others6`, `orals6`, `date7`, `eng7`, `fr7`, `ger7`, `sp7`, `clubs7`, `training7`, `biz7`, `others7`, `orals7`, `date8`, `eng8`, `fr8`, `ger8`, `sp8`, `clubs8`, `training8`, `biz8`, `others8`, `orals8`, `date9`, `eng9`, `fr9`, `ger9`, `sp9`, `clubs9`, `training9`, `biz9`, `others9`, `orals9`, `date10`, `eng10`, `fr10`, `ger10`, `sp10`, `clubs10`, `training10`, `biz10`, `others10`, `orals10`, `date11`, `eng11`, `fr11`, `ger11`, `sp11`, `clubs11`, `training11`, `biz11`, `others11`, `orals11`, `date12`, `eng12`, `fr12`, `ger12`, `sp12`, `clubs12`, `training12`, `biz12`, `others12`, `orals12`, `date13`, `eng13`, `fr13`, `ger13`, `sp13`, `clubs13`, `training13`, `biz13`, `others13`, `orals13`, `date14`, `eng14`, `fr14`, `ger14`, `sp14`, `clubs14`, `training14`, `biz14`, `others14`, `orals14`, `date15`, `eng15`, `fr15`, `ger15`, `sp15`, `clubs15`, `training15`, `biz15`, `others15`, `orals15`, `date16`, `eng16`, `fr16`, `ger16`, `sp16`, `clubs16`, `training16`, `biz16`, `others16`, `orals16`, `hours1`, `hours2`, `hours3`, `hours4`, `hours5`, `hours6`, `hours7`, `hours8`, `hours9`, `rate1`, `rate2`, `rate3`, `rate4`, `rate5`, `rate6`, `rate7`, `rate8`, `rate9`, `subtot1`, `subtot2`, `subtot3`, `subtot4`, `subtot5`, `subtot6`, `subtot7`, `subtot8`, `subtot9`, `totalsubtotal`, `tdsper`, `tds`, `Final_total`, `miscellaneous`, `status_send`, `count_send`, `approve_status`, `msg`, `first_id`, `modify_status` from timesheet where fromDate >= '".$date1."' && toDate <= '".$date2."' && status_send ='1' && approve_status='1' && modify_status!='1' && modify_status!='3' order by Instname limit 0,1";
$result=mysqli_query($conn,$query);
$num=mysqli_fetch_array($result);
$count=mysqli_num_rows($result);
//order by Instname
$getid="select DISTINCT `instructorId`,recNo from timesheet where fromDate >= '".$date1."' && fromDate <= '".$date2."' && status_send ='1' && approve_status='1' && modify_status!='1' && modify_status!='3' limit 1,5000";
$tresults=mysqli_query($conn,$getid);
$counttottal=mysqli_num_rows($tresults);
//$totalrecs=mysqli_fetch_array($tresults);
//echo '<pre>'; print_r($totalrecs);
if($counttottal>0){
$i=0;
while($totalrec=mysqli_fetch_array($tresults))
{
$recNo['instructorId'][$i]=$totalrec['instructorId'];
$recNo['recNo'][$i]=$totalrec['recNo'];
$i++;
}
$data=array_unique($recNo['instructorId']);
foreach($data as $key => $value){
$insids[]=$recNo['recNo'][$key];
}
$insid=implode(',',$insids);
}
$query1="select * from timesheet where fromDate >= '".$date1."' && toDate <= '".$date2."' && status_send ='1' && approve_status='1' && modify_status!='1' && modify_status!='3' && recNo in ($insid) order by Instname limit 1,5000 ";
$result1=mysqli_query($conn,$query1);
}
else
{
$query="select DISTINCT `instructorId`, `recNo`, `location`, `Instname`, `fromDate`, `toDate`, `date1`, `eng1`, `fr1`, `ger1`, `sp1`, `clubs1`, `training1`, `biz1`, `others1`, `orals1`, `date2`, `eng2`, `fr2`, `ger2`, `sp2`, `clubs2`, `training2`, `biz2`, `others2`, `orals2`, `date3`, `eng3`, `fr3`, `ger3`, `sp3`, `clubs3`, `training3`, `biz3`, `others3`, `orals3`, `date4`, `eng4`, `fr4`, `ger4`, `sp4`, `clubs4`, `training4`, `biz4`, `others4`, `orals4`, `date5`, `eng5`, `fr5`, `ger5`, `sp5`, `clubs5`, `training5`, `biz5`, `others5`, `orals5`, `date6`, `eng6`, `fr6`, `ger6`, `sp6`, `clubs6`, `training6`, `biz6`, `others6`, `orals6`, `date7`, `eng7`, `fr7`, `ger7`, `sp7`, `clubs7`, `training7`, `biz7`, `others7`, `orals7`, `date8`, `eng8`, `fr8`, `ger8`, `sp8`, `clubs8`, `training8`, `biz8`, `others8`, `orals8`, `date9`, `eng9`, `fr9`, `ger9`, `sp9`, `clubs9`, `training9`, `biz9`, `others9`, `orals9`, `date10`, `eng10`, `fr10`, `ger10`, `sp10`, `clubs10`, `training10`, `biz10`, `others10`, `orals10`, `date11`, `eng11`, `fr11`, `ger11`, `sp11`, `clubs11`, `training11`, `biz11`, `others11`, `orals11`, `date12`, `eng12`, `fr12`, `ger12`, `sp12`, `clubs12`, `training12`, `biz12`, `others12`, `orals12`, `date13`, `eng13`, `fr13`, `ger13`, `sp13`, `clubs13`, `training13`, `biz13`, `others13`, `orals13`, `date14`, `eng14`, `fr14`, `ger14`, `sp14`, `clubs14`, `training14`, `biz14`, `others14`, `orals14`, `date15`, `eng15`, `fr15`, `ger15`, `sp15`, `clubs15`, `training15`, `biz15`, `others15`, `orals15`, `date16`, `eng16`, `fr16`, `ger16`, `sp16`, `clubs16`, `training16`, `biz16`, `others16`, `orals16`, `hours1`, `hours2`, `hours3`, `hours4`, `hours5`, `hours6`, `hours7`, `hours8`, `hours9`, `rate1`, `rate2`, `rate3`, `rate4`, `rate5`, `rate6`, `rate7`, `rate8`, `rate9`, `subtot1`, `subtot2`, `subtot3`, `subtot4`, `subtot5`, `subtot6`, `subtot7`, `subtot8`, `subtot9`, `totalsubtotal`, `tdsper`, `tds`, `Final_total`, `miscellaneous`, `status_send`, `count_send`, `approve_status`, `msg`, `first_id`, `modify_status` from timesheet where fromDate >= '".$date1."' && toDate <= '".$date2."' && status_send ='1' && approve_status='1' && location='".$_REQUEST[location]."' && modify_status!='1' && modify_status!='3' order by Instname limit 0,1";
$result=mysqli_query($conn,$query);
$num=mysqli_fetch_array($result);
$count=mysqli_num_rows($result);
$query1="select * from timesheet where fromDate >= '".$date1."' && toDate <= '".$date2."' && status_send ='1' && approve_status='1' && location='".$_REQUEST[location]."' && modify_status!='1' && modify_status!='3' group by instructorId,location order by Instname limit 1,100";
$result1=mysqli_query($conn,$query1);
}
if($count>0)
{
//echo ini_set("max_execution_time","120");
//echo set_time_limit(120);
include("05featuredemo1_monthly.php");
echo"<div><a href='uploads/".$date1." to ".$date2."_".$_REQUEST['location'].".xlsx'>Click Here To Save</a></div>";
}
else
{
echo"<div>There Are No Records Under Your Selection Criteria</div>";
}
?>
<div id="cpanel">
<div style="float: left;">
<div class="icon"></div>
</div>
<div style="float: left;">
<div class="icon"></div>
</div>
<div style="float: left;"></div>
</div>
</td>
<td valign="top" width="45%"> </td>
</tr>
</tbody></table>
</div>
</div>
<div class="clear"></div>
<p class="copyright"> </p>
</div>
</div>
</body></html>