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 : 3.149.255.239


Current Path : /var/www/html/dud/servadm/src/
Upload File :
Current File : /var/www/html/dud/servadm/src/applicationStatus.php

<?php

function getApplicationDetails($aobj_context)
{
	//var_dump($aobj_context);
	$status = trim($aobj_context->mobj_data["status"]);
	$fromdate = trim($aobj_context->mobj_data["fromdate"]);
	$todate = trim($aobj_context->mobj_data["todate"]);
	$fromroll = trim($aobj_context->mobj_data["fromroll"]);
	$toroll = trim($aobj_context->mobj_data["toroll"]);
	$servcode = trim($aobj_context->mobj_data["servcode"]);
	$paystatus = trim($aobj_context->mobj_data["paystatus"]);
	$user  =   $_SESSION['username'];
	$lstrserv = "and st.fservcode='{$servcode}'";
	if($servcode=="all")
		$lstrserv="";
	
	$lstrstatus = "and st.fverifystatus='{$status}'";
	if($status=="all")
		$lstrstatus="";
	
	$lstrpaystatus = "and st.fpaystatus='{$paystatus}'";
	if($paystatus == "all")
		$lstrpaystatus = "";
	
	if($user == 'admin' || $user == 'pmadmin')
	{
		$applist = "and 1=1";
		$disabled = "";
	}else
	{
		$applist = "and FAPPASSIGN = '{$user}'";
		$disabled = "disabled";
	}	
	
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	
	$query = "SELECT st.fappno,DATE_FORMAT(fappdate,'%d/%m/%Y') AS fappdate,ifnull(st.FAPPASSIGN,'') as FAPPASSIGN, st.fregno, st.fname, st.fcategory, st.ftotal, st.fpaystatus, 
	s.fservname, st.fverifystatus, DATE_FORMAT(st.fverifydate,'%d/%m/%Y') as fverifydate FROM servtran st INNER JOIN servtype s ON 
	s.fservcode =  st.fservcode
	WHERE st.fappdate BETWEEN DATE_FORMAT(str_to_date('{$fromdate}','%d/%m/%Y'),'%Y-%m-%d') 
	AND DATE_FORMAT(str_to_date('{$todate}','%d/%m/%Y'),'%Y-%m-%d') 
	AND st.fregno BETWEEN '{$fromroll}' AND '{$toroll}' {$lstrserv} {$lstrstatus} {$applist}
	{$lstrpaystatus} order by st.fappno, st.fregno";
	//var_dump($query);
	$result = $aobj_context->mobj_db->GetAll($query);
	$i=1;
	//$table .= "<tbody id="trecords">"; 
	$query1  = "select fusername from masuser where fusertype <> 'adm'";	
	$result1 = $aobj_context->mobj_db->GetAll($query1);
	
	$options = "";
	
	
	foreach($result as $key => $value)
	{
		$options = "<option value = '' >Select</option>";
		foreach($result1 as $key => $value1)
		{
			$selected = "";
			if($value['FAPPASSIGN'] == $value1[fusername])
			{	
				//var_dump($value['FAPPASSIGN']."--".$value1[fusername]);
				$selected = "selected";
			}
			
			$options .= "<option value = '{$value1[fusername]}' {$selected} >{$value1[fusername]}</option>";
			
		}
		
		$table.="<tr style='cursor:pointer;' id='tr$value[fappno]'>";
		
		$table.="<td>
				<span><center>{$i}</center></span>
				</td>";
		$table.="<td id='appno' onclick='loadStudDet($value[fappno])'>
				{$value['fappno']}
				</td>";
		$table.="<td id='appno' onclick='loadStudDet($value[fappno])'>
				{$value['fappdate']}
				</td>";
		$table.="<td onclick='loadStudDet($value[fappno])'>
				{$value['fregno']}
				</td>";
		$table.="<td onclick='loadStudDet($value[fappno])'>
				{$value['fname']}
				</td>";
		$table.="<td onclick='loadStudDet($value[fappno])'>
				{$value['fcategory']}
				</td>";

		$table.="<td onclick='loadStudDet($value[fappno])'>
				{$value['fservname']}
				</td>";
		$table.="<td onclick='loadStudDet($value[fappno])'>
				<span style='float : right;'>{$value['ftotal']}</span>
				</td>";
		$table.="<td id='$value[fappno]' onclick='loadStudDet($value[fappno])'>
				{$value['fverifystatus']}
				</td>";
		$table.="<td id='date$value[fappno]' onclick='loadStudDet($value[fappno])'>
				{$value['fverifydate']}
				</td>";
/* 		$table.="<td>
				<span class='btn btn-primary waves-effect' onclick='printMailAdd($value[fappno])'>Cov. Lett.</span>
				</td>"; */
		$table.="<td>
				<select class='btn btn-blue waves-effect' {$disabled} id = 'user_$value[fappno]'>{$options}</select>
				</td>";
		$table.="<td>
				<span class='btn btn-primary waves-effect' onclick='saveassigneduser($value[fappno])'>Save</span>
				</td>";
		$table.="</tr>";
		$i++;
	}
	//$table .= "</tbody>";

	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 saveassigneduser($aobj_context)
{
	$appno = trim($aobj_context->mobj_data["appno"]);
	$user1 = trim($aobj_context->mobj_data["user"]);
	
	$query = "update servtran set FAPPASSIGN = '{$user1}' where fappno = '{$appno}'";
	$result = $aobj_context->mobj_db->Execute($query);

	if($result)
	{
		$arr = "Updated Successfully";
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");	
		return; 
	}else
	{
		$arr = "Updation Failure";
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure");	
		return; 
	}
}