Current File : /home/inlingua/public_html/faridabad/icentex/admin/timesheet_block_action.php |
<?php
ob_start();
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();
?>
<?php
$half=$_REQUEST[half];
$month=$_REQUEST[month];
$year=$_REQUEST[year];
if($half==1)
{
$date1="".$year."-".$month."-01";
$date2="".$year."-".$month."-15";
$datetime2="".$date2."";
}
else if($half==2)
{
$num = cal_days_in_month(CAL_GREGORIAN, $month, $year); // 31
//echo "There was $num days in August 2003";
$date1="".$year."-".$month."-16";
$date2="".$year."-".$month."-".$num."";
$datetime2="".$date2."";
}
$query="select * from timesheet_block where fromDate='".$date1."' && toDate='".$date2."'";
$result=mysqli_query($conn,$query);
$count=mysqli_num_rows($result);
$num=mysqli_fetch_array($result);
if($count>0)
{
$queryU="update timesheet_block set status='".$_REQUEST[block]."' where recNo='".$num[recNo]."'";
$resultU=mysqli_query($conn,$queryU) or die(mysql_error($conn));
}
else
{
$createDate=date("Y-m-d");
$queryI="insert into timesheet_block (fromDate,toDate,status,location,createDate) values ('".$date1."','".$date2."','".$_REQUEST[block]."','".$_REQUEST[location]."','".$createDate."')";
$resultI=mysqli_query($conn,$queryI) or die(mysql_error($conn));
}
header("Location:timesheet_block.select.php");
?>