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.144.224.116


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

<?php
 
function Getansbooklist($aobj_context)
{ 
   $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	session_start();	
	$College = $_SESSION['FCOLLCODE'];
	//var_dump($College);die();
	$range = ($aobj_context->mobj_data["range"]);
	$qp_code = ($aobj_context->mobj_data["qp_code"]);
	$ScreenType = ($aobj_context->mobj_data["ScreenType"]);
	$type = ($aobj_context->mobj_data["type"]);
	$limit = ($aobj_context->mobj_data["limit"]);
	$Subcode = ($aobj_context->mobj_data["Subcode"]);
	$Degcode = ($aobj_context->mobj_data["Degcode"]);
	$Examno = ($aobj_context->mobj_data["Examno"]);
	$LastRegno = ($aobj_context->mobj_data["LastRegno"]);
	$FirstRegno = ($aobj_context->mobj_data["FirstRegno"]);
	$FDOE = ($aobj_context->mobj_data["FDOE"]);
	$FSESSION = ($aobj_context->mobj_data["FSESSION"]);
	 
	$range_cond=($range=='')?"":" and stu.FREGNO like '%{$range}%'";
	$e_data.="<table  id='tbl_absent_subjectwise' align='center' width='80%' cellspacing='0' cellpadding='0' border='0' >";
	$e_data.="<th align='left' colspan='6' class='ui-jqgrid-titlebar ui-widget-header ui-corner-tl ui-corner-tr ui-helper' style='font-size:12px; padding-left:6px; height:24px;'></th>";			
	$e_data.="<tr class='ui-state-default ui-jqgrid-hdiv'>";
	$e_data.="<td  style='padding:2px; width:30px; border-left:1px solid #C5DBEC;text-align:center; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Sl.No.</td>";
	$e_data.="<td  style='padding:2px; width:10px; border-right:1px solid #C5DBEC;text-align:center; border-bottom:1px solid #C5DBEC;'>From Ans. Book No.</td>";
	$e_data.="<td  style='padding:2px; width:10px; border-right:1px solid #C5DBEC;text-align:center; border-bottom:1px solid #C5DBEC;'><center>To Ans. Book No.</center></td>";
	$e_data.="<td  style='padding:2px; width:5px; border-right:1px solid #C5DBEC;text-align:center; border-bottom:1px solid #C5DBEC;'><center>Total</center></td>";
	$e_data.="<td  style='padding:2px; width:160px; border-right:1px solid #C5DBEC;text-align:center; border-bottom:1px solid #C5DBEC;'><center>Remarks</center></td>";
	//$e_data.="<td  style='padding:2px; width:160px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'><center>Remarks</center></td>";
	$e_data.="</tr>";

	$get_records ="select FFROMANS,FTOANS,ifnull(if(FANSTYPE = 'R','Reserved Answer Books',''),'') as FANSTYPE 
				from ansdist where fcollcode = '{$College}' order by FANSTYPE,ffromans desc ";
	var_dump($get_records);
	$lobj_get_records = $aobj_context->mobj_db->GetAll($get_records);
	
	$k=0;
	//$border=($type=='Edit')?"":"border:none;";
	//$read_only=($type=='Edit')?"":"readOnly";
	
		$row_id=1;
		foreach($lobj_get_records as $key=>$value)
		{
			if($k%2==0)
			{
				$class='tbl_row';
				$inp_class='tbl_row_input';
			}
			else
			{
				$input_class='tbl_row1'; 
				$inp_class='tbl_row1_input';
			} 
			$total = substr($value['FTOANS'],2,10)-substr($value['FFROMANS'],2,10)+1;
			$totalans+= $total;
			
			//$on_blur=($type=='Edit')?" onblur=\"validateRegNoMarks($('#markentry_sub_maxmark').val(),this.value,'mes_present_{$value[FREGNO]}',this.id);\" ":" ";				
			//$on_blur=($type=='Edit')?" onblur=\"validateEditRegNoMarks(this.id);\" ":" ";				
			//$on_focus=($type=='Edit')?" onfocus=\"if(\$g_mes_edit_valid_marks_flag==0) $('#mes_marks_{$value[FREGNO]}').focus();\" ":" ";				
			 $e_data.="<tr class='ui-widget-content jqgrow' id='qp_row_{$row_id}' >";
			 $e_data.="<td class='tbl_row_new' align='center' style='border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px;text-align:center;width:30px;;'>{$row_id}</td>";
			 $e_data.="<td class='tbl_row_new' align='left' style='border-right:1px solid #C5DBEC; padding:2px;'><input {$inp_class} type=text style='width:75px;border:none;text-align:center;' readonly id='abs_subwise_stuname_{$row_id}' value='{$value['FFROMANS']}'></td>";//fansbookno
			 $e_data.="<td class='tbl_row_new' align='left' style='border-right:1px solid #C5DBEC; padding:2px;'><input {$inp_class} type=text style='width:75px;border:none;text-align:center;' readonly id='abs_subwise_ansbookno_{$row_id}' value='{$value['FTOANS']}'></td>";
			 $e_data.="<td class='tbl_row_new' align='left' style='border-right:1px solid #C5DBEC; padding:2px;'><input {$inp_class} type=text style='width:40px;border:none;text-align:center;'  readonly id='abs_subwise_newansbookno_{$row_id}' value='{$total}'></td>";//
			 $e_data.="<td class='tbl_row_new' align='left' style='border-right:1px solid #C5DBEC; padding:2px;'><input {$inp_class} type=text style='width:170px;border:none;text-align:center;'  readonly id='abs_subwise_remarks_{$row_id}' value='{$value['FANSTYPE']}'></td>";
			// $e_data.="<td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC; padding:2px;'><input  type=checkbox  id='abs_check_{$row_id}'  > <input id='st_{$row_id}' type=hidden value='U'>  </td>"; 
			 $e_data.="</tr>";
			 $k++;
			 $row_id++;
		 }
		 // $e_data.="<tr class='ui-widget-content jqgrow' id='qp_row_{$row_id}' >";
		   //$e_data.="<td class='tbl_row_new' align='center' style='border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px;'><input {$inp_class} type=text   style='width:60px;border:none;' readonly id='abs_subwise_regno_{$row_id}' value='{$totalans}'></td>";
		// $e_data.="</tr>";
		 $e_data.="<tr class='ui-widget-content jqgrow' id='qp_row_{$row_id}' colspan = '3' >";
			 $e_data.="<td class='tbl_row_new' align='center' style='padding:2px;border-left:1px solid #C5DBEC;'></td>";
			 $e_data.="<td class='tbl_row_new' align='left' style=' padding:2px;'></td>";//fansbookno
			 $e_data.="<td class='tbl_row_new' align='left' style=' padding:2px;border-right:1px solid #C5DBEC;'><b>Grand Total</b></td>";
			 $e_data.="<td class='tbl_row_new' align='left' style=' padding:2px;'><b>{$totalans}</b></td>";//
			 $e_data.="<td class='tbl_row_new' align='left' style=' padding:2px;border-right:1px solid #C5DBEC;'></td>";
			// $e_data.="<td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC; padding:2px;'><input  type=checkbox  id='abs_check_{$row_id}'  > <input id='st_{$row_id}' type=hidden value='U'>  </td>"; 
			 $e_data.="</tr>";
		
		$e_data.="</table><br>";
		
		$arr['html']=$e_data;
		$arr['table_data']=$lobj_get_records;
		 
	echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
	return;  						
}

function SaveansEntryQpStudetwise($aobj_context)
{
    session_start();
    include_once("/JSON.php"); 
	$json = new Services_JSON();
	$User_code = $_SESSION['usr'];
	 
	$qp_code = ($aobj_context->mobj_data["qp_code"]);
	$get_degree_data="select  FMEYEAR,FMEEXAMTYP  from subject s
						inner join degree d on d.FDEGREE=s.FDEGREE
						where FQPCODE='{$qp_code}' limit 1";
	$lobj_check_dup = $aobj_context->mobj_db->getRow($get_degree_data);
	$FMEYEAR=$lobj_check_dup['FMEYEAR'];	
	$FMEEXAMTYP=$lobj_check_dup['FMEEXAMTYP'];	
	$all_reg_nos = stripslashes($aobj_context->mobj_data["all_reg_nos"]);
	$all_reg_nos=substr($all_reg_nos,0,strlen($all_reg_nos)-1);
	session_start();
	$College = $_SESSION['FCOLLCODE'];
	
	$User_code = $_SESSION['usr']; 
	$type =($aobj_context->mobj_data["type"]);    
	$date =($aobj_context->mobj_data["date"]);    
	$ScreenType =($aobj_context->mobj_data["ScreenType"]);    
	$Session =($aobj_context->mobj_data["Session"]);    
 
	$lstr_param = stripslashes($aobj_context->mobj_data["output_details"]);
	$mobj_jsondata = $json->decode($lstr_param);
	$Markentry_details = get_object_vars($mobj_jsondata);
	 
	foreach($Markentry_details as $ak=>$av)
	{
		$delete=$av->delete;
		$FRegno=strtoupper($av->FRegno);
		$fremarks=strtoupper($av->fremarks);
		$newansbookno=strtoupper($av->newansbookno);
		$ansbookno=strtoupper($av->ansbookno);
		if($FRegno != '')
		{	
			$query = "select fregno from ansallot where fregno = '{$FRegno}' limit 1";
			$results = $aobj_context->mobj_db->getRow($query);	
			$count = $results['fregno'];	
			if(count($count) <= 0) 
			{
				$rdata = "Invaid Register No.";
				print_r($aobj_context->mobj_output->ToJSONEnvelope($rdata,-1,"Failure"));
				return $rdata;
			}	
			if($newansbookno == '')
			{
				$rdata = "Enter New Ans book no";
				print_r($aobj_context->mobj_output->ToJSONEnvelope($rdata,-1,"Failure"));
				return $rdata;
			}
			if($fremarks == '')
			{
				$rdata = "Enter Remarks";
				print_r($aobj_context->mobj_output->ToJSONEnvelope($rdata,-1,"Failure"));
				return $rdata;
			}
			if($ansbookno == '')
			{
				$rdata = "Enter Ans Book No";
				print_r($aobj_context->mobj_output->ToJSONEnvelope($rdata,-1,"Failure"));
				return $rdata;
			}
			
			$query = "select ifnull(flastused,ffromans) as flastused from  ansdist 
			where fcollcode = '{$College}' and fanstype = 'R' and  (flastused < ftoans or flastused is null)
			and '{$newansbookno}' between ffromans and ftoans";
			$results = $aobj_context->mobj_db->getRow($query);
			
			if(count($results) > 0) 
			{
				$query = "select * from ansallot where fansbookno = '{$newansbookno}'";
				$results = $aobj_context->mobj_db->getRow($query);
				
				if(count($results) > 0)
				{
					$rdata = "Anser Book No. Allready alloted.";
					print_r($aobj_context->mobj_output->ToJSONEnvelope($rdata,-1,"Failure"));
					return $rdata;
				}
				else				
				{
					
				}
				
			}
			else
			{
				$rdata = "Invalid Answer Book No.";
				print_r($aobj_context->mobj_output->ToJSONEnvelope($rdata,-1,"Failure"));
				return $rdata;
			}		
			
		
				
		}
		
		$query = "select * from ansallot where fansbookno = '{$newansbookno}'";
		$results = $aobj_context->mobj_db->getRow($query);
		if(count($results) > 0)
		{
			
		}	
				
		$College_Code = $results['fcollcode'];
		$query = "update ansallot set fcancel = 'T',fremarks = '{$fremarks}',FENTDATE = now(),FUSERNAME = '{$User_code}'
				  where fregno = '{$FRegno}' and fqpcode = '{$qp_code}' and fansbookno = '{$ansbookno}'";
		
		$lobj_insert_qry = $aobj_context->mobj_db->Execute($query);
		
		$query2 = "insert into ansallot
		select fcollcode,fqpcode,fregno,'{$newansbookno}',null,null,fyear,fexamtype,null,'M',now(),'{$User_code}' from ansallot  
		where fregno = '{$FRegno}' and fqpcode = '{$qp_code}' and fcancel = 'T'";
		//var_dump($query2);
		$lobj_insert_qry = $aobj_context->mobj_db->Execute($query2);
	}
	if($lobj_insert_qry)
	{
		$rdata = "Updated Successfully.";
		print_r($aobj_context->mobj_output->ToJSONEnvelope($rdata,0,"success"));
		return $rdata;
	}
	else
	{
		$rdata = "Insertion Failed.";
		print_r($aobj_context->mobj_output->ToJSONEnvelope($rdata,-1,"Failure"));  
		return $rdata;			
	}  
}	
	
?>