Current File : /home/inlingua/public_html/noida/icentex/admin/backup/modify.timesheet.php |
<?php
session_start();
ob_start();
// 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');
// Setup table name, configuration and data entry form
$tableName = "timesheet";
$tableConf = $tableName . ".conf.php";
// Init and connect to database
$dbObject = new dbHandler();
$dbObject->setTableName($tableName);
$dbObject->setDbFieldList($dbFieldList);
$dbObject->setKeyFieldName("recNo");
$dbObject->connect();
// Retrieve parameters from request
//$dbObject->getDbFieldsFromRequest();
// Records selection sql
$query="select * from timesheet where recNo='".$_REQUEST[id]."'";
$res=mysql_query($query);
$result_array=mysql_fetch_array($res);
$queryU="select recNo,email,startingHours from timesheet_user where recNo='".$result_array[instructorId]."'";
$resultU=mysql_query($queryU);
$numU=mysql_fetch_array($resultU);
$startinghours=$numU[startingHours];
$queryT="select (sum(hours1) + sum(hours2) + sum(hours3) + sum(hours4) + sum(hours5) + sum(hours7) + sum(hours8) + sum(hours9)) as totalhrs from timesheet where count_send <='".$result_array[count_send]."' && instructorId='".$numU[recNo]."' && status_send=1 && approve_status=1 && modify_status!='1' && modify_status!='3'";
$resultT=mysql_query($queryT) or die(mysql_error());
$numT=mysql_fetch_array($resultT);
$totalHours1=$startinghours+$numT[totalhrs];
/*if($totalHours1 >=1500)
{
$query_f="select * from timesheet where recNo='".$_REQUEST[id]."'";
}
else
{
$query_f="select * from timesheet where count_send >='".$result_array[count_send]."' && instructorId ='".$result_array[instructorId]."' and status_send ='1' and approve_status='1' && modify_status!='1' && modify_status!='3' order by count_send desc";
}*/
$query_f="select * from timesheet where recNo='".$_REQUEST[id]."'";
$res_f=mysql_query($query_f);
$_SESSION['modtatus']='';
while($result_fetch=mysql_fetch_array($res_f))
{
if($result_fetch[recNo]==$result_array[recNo])
{
//$msg="Due to some problem , timesheet dated from".$result_fetch[fromDate]." to ".$result_fetch[toDate]." is cancelled by the administrator . Please resend it.";
$_SESSION['modtatus'] .="* Timesheet from ".$result_fetch[fromDate]." to ".$result_fetch[toDate]." submitted successfully for modification.<br>";
//$message1.="* Due to some problem your timesheet from ".$result_fetch[fromDate]." to ".$result_fetch[toDate]." is cancelled .Please contact administrator and resend it.<br>";
}
else
{
//$msg="The timesheet dated from".$result_fetch[fromDate]." to ".$result_fetch[toDate]." is after problemed timesheet dated from".$result_array[fromDate]." to ".$result_array[toDate]."so cancelled" ;
$_SESSION['modtatus'] .="* Timesheet from ".$result_fetch[fromDate]." to ".$result_fetch[toDate]." submitted successfully for modification. <br>";
//$message1.="* Due to some problem your timesheet from ".$result_fetch[fromDate]." to ".$result_fetch[toDate]." is cancelled due to problemed timesheet <br> from".$result_array[fromDate]." to ".$result_array[toDate]." .Please contact administrator and resend it.<br>";
}
$dbObject->setDbField("modify_status",'1');
//$dbObject->setDbField("msg",$msg);
$dbObject->Update("recNo",$result_fetch[recNo]);
}
$totalHours1=$startinghours;
/*$query="select (sum(hours1) + sum(hours2) + sum(hours3) + sum(hours4) + sum(hours5) + sum(hours7) + sum(hours8) + sum(hours9)) as totalhrs from timesheet where instructorId='".$result_array[instructorId]."' && status_send=1 && approve_status=1 && modify_status!='1' && modify_status!='3'";
$result=mysql_query($query) or die(mysql_error());
$num=mysql_fetch_array($result);
$totalHours1=$totalHours1+$num[totalhrs];
if($totalHours1<500)
{
$rate_1="Rate1";
}
elseif($totalHours1>=500 && $totalHours1<1000)
{
$rate_1="Rate2";
}
elseif($totalHours1>=1000 && $totalHours1<1500)
{
$rate_1="Rate3";
}
else if($totalHours1>=1500)
{
$rate_1="Rate4";
}
*/
//$queryRU="update timesheet_user set rateGroup='".$rate_1."' where recNo='".$result_array[instructorId]."'";
//$resultRU=mysql_query($queryRU) or die(mysql_query());
/*$message="Dear ".$result_array[Instname].", <br><br>";
$message.=$message1;
$message.="<br><br>";
$message.="-Administrator<br><br>Inlingua New Delhi";
require("../class.phpmailer.php");
$fromEmail= "hrd@inlinguanewdelhi.com";
$fromName="Timesheet Admin-Inlingua";
$to=$numU[email];
$subject="Timesheet Cancelled";
$mail = new PHPMailer();
$mail->IsMail();
$mail->From = $fromEmail;
$mail->FromName = $fromName;
$toAddress;
$mail->AddAddress($to, "");
$mail->IsHTML(true); // set email format to HTML
$mail->Subject = $subject;
$mail->Body = $message;
//$mail->AddReplyTo("umraovikas@gmail.com","");
$mail->AddAttachment($path);
/*if(!$mail->Send())
{
echo "Message could not be sent on mailid: <font color='red'>'".$to."'</font><br>";
echo "Please check the emailId.<br>";
//echo "Mailer Error: " . $mail->ErrorInfo;
//exit;
}*/
header("Location:list_modify.php");
// Print navigation bar
?>