Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64
Your IP : 18.220.94.189
<?php
function getdatedetails($aobj_context)
{
$fdaterange = trim($aobj_context->mobj_data["fdaterange"]);
$college_code_from = trim($aobj_context->mobj_data["college_code_from"]);
$college_code_to = trim($aobj_context->mobj_data["college_code_to"]);
$degree_code_from = trim($aobj_context->mobj_data["degree_code_from"]);
$degree_code_to = trim($aobj_context->mobj_data["degree_code_to"]);
$Examno_from = trim($aobj_context->mobj_data["Examno_from"]);
$Examno_to = trim($aobj_context->mobj_data["Examno_to"]);
$fileds = ",DATE_FORMAT({$fdaterange}FROM,'%d/%m/%Y'),DATE_FORMAT({$fdaterange}TO,'%d/%m/%Y')";
$query = "select fcollcode,fdegree,fexamno {$fileds} from collexam
where fcollcode between '{$college_code_from}' and '{$college_code_to}'
and fdegree between '{$degree_code_from}' and '{$degree_code_to}'
and fexamno between '{$Examno_from}' and '{$Examno_to}'
order by fcollcode,fdegree,fexamno";
//var_dump($query);
$result = $aobj_context->mobj_db->getAll($query);
//var_dump($query);
$i = 1;
$table.="<table id ='ftable1' align='left' cellpadding='1' cellspacing='1' border='1' style='overflow:auto;width:350px;margin:0px;padding:0px;'>";
foreach($result as $key => $value)
{
$table.="<tr>";
$table.="<b><td align='center' ><input type = 'text' tabindex = '-1' id = '{$i}collcode' style='width:100px;height:20px' disabled onchange = 'getid(this.id)' value = '{$value['fcollcode']}' name = 'date'/></td></b>";
$table.="<td align='center' ><input type = 'text' tabindex = '-1' id = '{$i}degree' style='width:100px;height:20px' disabled onchange = 'getid(this.id)' value = '{$value['fdegree']}' /></td>";
$table.="<td align='center' ><input type = 'text' tabindex = '-1' id = '{$i}exam' style='width:50px;height:20px' disabled onchange = 'getid(this.id)' value = '{$value[fexamno]}' /></td>";
$table.="<td align='center' ><input type = 'text' id = '{$i}date1' style='width:100px;height:20px' onkeypress='return acceptNumbersOnlyForModule(event);' onkeydown = 'dmydateformat(event,this.id)' placeholder = 'dd/mm/yyyy' maxlength = 10 onchange = 'getid(this.id)' value = '{$value[3]}'/>
<input type = 'hidden' id = '{$i}date1h' value = 'E' /></td>";
$table.="<td align='center' ><input type = 'text' style='width:100px;height:20px' id = '{$i}date2' onkeypress='return acceptNumbersOnlyForModule(event);' onkeydown = 'dmydateformat(event,this.id)' placeholder = 'dd/mm/yyyy' maxlength = 10 onchange = 'getid(this.id)' value = '{$value[4]}' />
<input type = 'hidden' id = '{$i}date2h' value = 'E'/></td>";
$table.="</tr>";
$i++;
// var_dump($table);
}
$table.="</table>";
if($result)
{
$arr['table'] = $table;
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
return;
}else
{
$arr = '';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failur");
return;
}
}
function SaveDateRange($aobj_context)
{
include_once($aobj_context."/src/JSON.php");
$json = new Services_JSON();
$date_arr = stripslashes($aobj_context->mobj_data["date_arr"]);
$mobj_jsondata = $json->decode($date_arr);
$date_arr = get_object_vars($mobj_jsondata);
$fdaterange = trim($aobj_context->mobj_data["fdaterange"]);
$college_code_from = trim($aobj_context->mobj_data["college_code_from"]);
$college_code_to = trim($aobj_context->mobj_data["college_code_to"]);
$degree_code_from = trim($aobj_context->mobj_data["degree_code_from"]);
$degree_code_to = trim($aobj_context->mobj_data["degree_code_to"]);
$Examno_from = trim($aobj_context->mobj_data["Examno_from"]);
$Examno_to = trim($aobj_context->mobj_data["Examno_to"]);
$fdate = trim($aobj_context->mobj_data["fdate"]);
$tdate = trim($aobj_context->mobj_data["tdate"]);
$bulkinsert = trim($aobj_context->mobj_data["bulkinsert"]);
for($k=1;$k<=count($date_arr);$k++)
{
$fileds = "{$fdaterange}FROM = DATE_FORMAT(str_to_date('{$date_arr[$k]->fromdate}','%d/%m/%Y'),'%Y-%m-%d') , {$fdaterange}TO = DATE_FORMAT(str_to_date('{$date_arr[$k]->todate}','%d/%m/%Y'),'%Y-%m-%d')";
var_dump($fileds);
$query = "update collexam set
{$fileds}
where fdegree = '{$date_arr[$k]->degree}'
and fexamno = '{$date_arr[$k]->examno}'
and fcollcode = '{$date_arr[$k]->collcode}'";
//var_dump($query);
$lobj_update = $aobj_context->mobj_db->Execute($query);
}
if($bulkinsert == 'T')
{
$fileds = "{$fdaterange}FROM = DATE_FORMAT(str_to_date('{$fdate}','%d/%m/%Y'),'%Y-%m-%d') , {$fdaterange}TO = DATE_FORMAT(str_to_date('{$tdate}','%d/%m/%Y'),'%Y-%m-%d')";
$query = "update collexam set
{$fileds}
where fdegree between '{$degree_code_from}' and '{$degree_code_to}'
and fexamno between '{$Examno_from}' and '{$Examno_to}'
and fcollcode between '{$college_code_from}' and '{$college_code_to}'";
var_dump($query);
$lobj_update = $aobj_context->mobj_db->Execute($query);
}
if($lobj_update)
{
$arr = "updated successfully";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
}
}
?>
|