0xV3NOMx
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 : 13.59.54.188


Current Path : /proc/thread-self/root/var/www/html/gfgcg/src/
Upload File :
Current File : //proc/thread-self/root/var/www/html/gfgcg/src/daterange.php

<?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')";
	if($fdaterange == 'FATT')
	{
		$attmth = ",ifnull(FATTFROMMTH,''),ifnull(FATTTOMTH,''),ifnull(FATTLAST,'')";
	}

	$cnd = "";

	if($fdaterange == 'fiafrom')
	{

		$cnd = " inner join marks m on  c.fcollcode = m.fcollcode 
		and c.fdegree = m.fdegree and c.fexamno = m.fexamno";	

	}else if($fdaterange == 'fprfrom')
	{

		$cnd = " inner join marks_pr m on  c.fcollcode = m.fcollcode 
		and c.fdegree = m.fdegree and c.fexamno = m.fexamno";

	}else if($fdaterange == 'fappfrom' || $fdaterange == 'fhtfrom')
	{
		
		$cnd = " inner join candsum m on  c.fcollcode = m.fcollcode 
		and c.fdegree = m.fdegree and c.fexamno = m.ffreshexam";
	}



	$query = "select c.fcollcode,c.fdegree,c.fexamno {$fileds} {$attmth} from collexam c {$cnd}
			where c.fcollcode between '{$college_code_from}' and '{$college_code_to}'
			and c.fdegree between '{$degree_code_from}' and '{$degree_code_to}'
			and c.fexamno between '{$Examno_from}' and '{$Examno_to}'
			order by c.fcollcode,c.fdegree,c.fexamno";
			//var_dump($query);
	$options = "<option value=''>Select</option>
				<option value='JAN'>JAN</option>
				<option value='FEB'>FEB</option>
				<option value='MAR'>MAR</option>
				<option value='APR'>APR</option>
				<option value='MAY'>MAY</option>
				<option value='JUN'>JUN</option>
				<option value='JUL'>JUL</option>
				<option value='AUG'>AUG</option>
				<option value='SEP'>SEP</option>
				<option value='OCT'>OCT</option>
				<option value='NOV'>NOV</option>
				<option value='DEC'>DEC</option>";
	$result = $aobj_context->mobj_db->getAll($query);
	//var_dump($query);
	$i = 1;
	$table.="<table class='tr_ventor_row' id ='ftable1' align='left'  cellpadding='1' cellspacing='1' style='overflow:auto;width:350px;margin:0px;padding:0px;'>";
	foreach($result as $key => $value)
	{
		//var_dump($value[5]."-----".$value[6]);      
		$table.="<tr class='ui-widget-content jqgrow' style='border-bottom: 1px solid grey;'>";
		$table.="<b><td  align='center' style='padding-left:5px;border-bottom: 1px solid #babbbc;border-left: 1px solid #babbbc;' ><input type = 'text' tabindex = '-1' id = '{$i}collcode' style='width:100px;height:20px;border:none;' readonly onchange = 'getid(this.id)' value = '{$value['fcollcode']}' name = 'date'/></td></b>";			
		$table.="<td  align='center' style='padding-left:10px; border-bottom: 1px solid #babbbc;border-left: 1px solid #babbbc;' ><input type = 'text' tabindex = '-1'  id = '{$i}degree' style='width:95px;height:20px;border:none;' readonly  onchange = 'getid(this.id)' value = '{$value['fdegree']}' /></td>";
		$table.="<td  align='center' style='padding-left:10px;border-bottom: 1px solid #babbbc;border-left: 1px solid #babbbc;' ><input type = 'text' tabindex = '-1' id = '{$i}exam' style='width:50px;height:20px;border:none;'   readonly 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,$i)' value = '{$value[3]}'/> 
		<input type = 'hidden' id = '{$i}date1h' value = 'E' /></td>";
		$table.="<td  align='center' style='padding-left:3px;' ><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,$i)' value = '{$value[4]}'  />
		<input type = 'hidden' id = '{$i}h' value = 'E'/></td>";
		if($fdaterange == 'FATT')
		{
			$pos = stripos($options, $value[5]);
			$options1 = substr_replace($options, ' selected ', $pos+4, 0);
			$table.="<td  align='center' style=''><select id = '{$i}fmth' value = '{$value[5]}' style='width:100px;height:25px' onchange = 'getid(this.id,$i)' >
				$options1		
					</select></td>";
			$pos = stripos($options, $value[6]);
			$options1 = substr_replace($options, ' selected ', $pos+4, 0);
			$table.="<td align='center' style='padding-left:10px;'>
			<select id = '{$i}tmth' value = '{$value[6]}' style='width:100px;height:25px' onchange = 'getid(this.id,$i)' >
				$options1			
					</select></td>";
			$table.="<td  align='center' style='padding-left:5px;' ><input type = 'text' style='width:100px;height:20px' id = '{$i}lstdate' onkeypress='return acceptNumbersOnlyForModule(event);' value = '{$value[7]}' placeholder = 'dd' maxlength = 2 onchange = 'getid(this.id,$i)'   />";
		}
		$table.="</tr>";
		$i++;
	}
	$table.="</table>";
	//var_dump($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"]);

	$from_month = trim($aobj_context->mobj_data["from_month"]);
	$to_month = trim($aobj_context->mobj_data["to_month"]);
	$last_date = trim($aobj_context->mobj_data["last_date"]);


	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')";

		if($fdaterange == 'FATT')
		{
			$fields1 = ",FATTFROMMTH ='{$date_arr[$k]->fmth}',FATTTOMTH = '{$date_arr[$k]->tmth}',FATTLAST ='{$date_arr[$k]->lstdate}' "; 
		}	

		$query = "update collexam set
				{$fileds} {$fields1}
				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')";	
		
		if($fdaterange == 'FATT')
		{
			$fields1 = ",FATTFROMMTH ='{$from_month}',FATTTOMTH = '{$to_month}',FATTLAST ='{$last_date}' "; 
		}
		$query = "update collexam set
				{$fileds} {$fields1}
				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"); 
	}
	
}


?>