# REVISIONDATA

ACTIONTIME: 2016-03-18 11:34:08
PARAMS: {"action":"s"}
SOURCE:


global $conn;
//$data1=$values['Facility_Code'];
//$data2=$values['Funding'];
//$data3=$values['Program_Area'];
//$data4=$values['Project_Name'];
//$data5=$values['Reporting_Year'];
//$data6=$values['Report_EndMthn'];
//$data7=$values['Report_StartMthn'];

//**********  Check if specific record exists  ************

//$strSQLExists = "select * from facilityreport where Facility_Code= '$data1' and Funding='$data2' and Program_Area='$data3' and Project_Name ='$data4' and Reporting_Year='$data5' and Report_EndMthn='$data6' and Report_StartMthn='$data7'" ;
//$strSQLExists = "select * from facilityreport where Facility_Code='FCT01001'";
$strSQLExists = "select * from facilityreport where Facility_Code='" . $values["Facility_Code"] . "'  AND  Program_Area='" . $values["Program_Area"] . "' AND  Reporting_Year='" . $values["Reporting_Year"] . "' AND  Report_EndMthn='" . $values["Report_EndMthn"] . "' AND  Report_StartMthn='" . $values["Report_StartMthn"] . "'";
$rsExists = db_query($strSQLExists,$conn);
$data=db_fetch_array($rsExists);
if($data)
{
	$message = $values["Program_Area"] . " Reports for  " . $values["Facility_Code"] . " in the Period :" . $values["Report_StartMthn"] . " - " . $values["Report_EndMthn"] ."  " . $values["Reporting_Year"] . " already exist.";
  return false;
}
else
{
	
}

$strSQLExists1 = "select RecID from tblreportmonth where ReportMonth='" . $values["Report_EndMthn"] . "'";
$rsExists1 = db_query($strSQLExists1,$conn);
$data1=db_fetch_array($rsExists1);

$strSQLExists2 = "select RecID from tblreportmonth where ReportMonth='" . $values["Report_StartMthn"] . "'";
$rsExists2 = db_query($strSQLExists2,$conn);
$data2=db_fetch_array($rsExists2);

if ($data2 > $data1)
{
  $message= "Report Start Month Cannot be greater than Report End Month";
   return false;
}
else
{

}

$strSQLExists3 = "SELECT YEAR(CURDATE())";
$rsExists3 = db_query($strSQLExists3,$conn);
$data3=db_fetch_array($rsExists3);
$data4=intval(date("Y"));
if (intval($values["Reporting_Year"]) > $data4)
{
 $message=" You Cannot select a future year " . " Current Year is : " . $data4 . "  and Not : " . intval($values["Reporting_Year"]) ;
  return false;
}
else
{
}



// Place event code here.
// Use "Add Action" button to add code snippets.

return true;


ACTIONTIME: 2016-03-18 11:34:45
PARAMS: {"action":"s"}
SOURCE:

global $conn;
//$data1=$values['Facility_Code'];
//$data2=$values['Funding'];
//$data3=$values['Program_Area'];
//$data4=$values['Project_Name'];
//$data5=$values['Reporting_Year'];
//$data6=$values['Report_EndMthn'];
//$data7=$values['Report_StartMthn'];

//**********  Check if specific record exists  ************

//$strSQLExists = "select * from facilityreport where Facility_Code= '$data1' and Funding='$data2' and Program_Area='$data3' and Project_Name ='$data4' and Reporting_Year='$data5' and Report_EndMthn='$data6' and Report_StartMthn='$data7'" ;
//$strSQLExists = "select * from facilityreport where Facility_Code='FCT01001'";
$strSQLExists = "select * from facilityreport where Facility_Code='" . $values["Facility_Code"] . "'  AND  Program_Area='" . $values["Program_Area"] . "' AND  Reporting_Year='" . $values["Reporting_Year"] . "' AND  Report_EndMthn='" . $values["Report_EndMthn"] . "' AND  Report_StartMthn='" . $values["Report_StartMthn"] . "'";
$rsExists = db_query($strSQLExists,$conn);
$data=db_fetch_array($rsExists);
if($data)
{
	$message = $values["Program_Area"] . " Reports for  " . $values["Facility_Code"] . " in the Period :" . $values["Report_StartMthn"] . " - " . $values["Report_EndMthn"] ."  " . $values["Reporting_Year"] . " already exist.";
  return false;
}
else
{
	
}

$strSQLExists1 = "select RecID from tblreportmonth where ReportMonth='" . $values["Report_EndMthn"] . "'";
$rsExists1 = db_query($strSQLExists1,$conn);
$data1=db_fetch_array($rsExists1);

$strSQLExists2 = "select RecID from tblreportmonth where ReportMonth='" . $values["Report_StartMthn"] . "'";
$rsExists2 = db_query($strSQLExists2,$conn);
$data2=db_fetch_array($rsExists2);

if ($data2 > $data1)
{
  $message= "Report Start Month Cannot be greater than Report End Month";
   return false;
}
else
{

}

$strSQLExists3 = "SELECT YEAR(CURDATE())";
$rsExists3 = db_query($strSQLExists3,$conn);
$data3=db_fetch_array($rsExists3);
$data4=intval(date("Y"));
if (intval($values["Reporting_Year"]) > $data4)
{
 $message=" You Cannot select a future year " . " Current Year is : " . $data4 . "  and Not : " . intval($values["Reporting_Year"]) ;
  return false;
}
else
{
}
return true;
// Place event code here.
// Use "Add Action" button to add code snippets.

    


ACTIONTIME: 2016-03-18 11:34:58
PARAMS: {"action":"s"}
SOURCE:




// Place event code here.
// Use "Add Action" button to add code snippets.


//strSQLExists = "select ProductName INTO tmpproductslist from tblproducts where programs='" .$values["Program_Area"] ."'";
//$rsExists = db_query($strSQLExists,$conn);


header("Location: facilityreport_edit.php?editid1=".$keys["ReportID"]);
exit();

//facilityreport_edit.php?editid1=29


