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


Current Path : /proc/thread-self/root/var/www/html/suk_discontinued/custom_src/
Upload File :
Current File : //proc/thread-self/root/var/www/html/suk_discontinued/custom_src/practical_entry_freezing.php

<?php 
function getPracticalEntryFreezeDetails($aobj_context)
{
	session_start();	
	$college_code = $_SESSION['collcode'];
	$user_type = $_SESSION['user_type'];
	 
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);  
	$subject_code = $aobj_context->mobj_data["subject_code"]; 	
    $degree = trim($aobj_context->mobj_data["degree_code"]); 	
    $exam_no = trim($aobj_context->mobj_data["exam_no"]);     
    $subject = trim($aobj_context->mobj_data["subject"]);     
    $g_freeze_time = trim($aobj_context->mobj_data["g_freeze_time"]);  
	
	 
	$get_subject = " select  s.FDEGREE,s.FEXAMNO,s.FSUBCODE,s.FBATCH,
				ifnull(FFREEZED,'F') as FFREEZED,
				ifnull(PRINTFREEZED,'F') as PRINTFREEZED,
				GROUP_CONCAT(distinct  if(abs(FMarks11)<1,0,abs(FMarks11)) separator '') as tot_marks,	
				pf.FBATCH as freezed_batch,date_format(ifnull(pf.FEXAMDATE,'00/00/0000'),'%d/%m/%Y') as FEXAMDATE,pf.FEXAMTIME 
				from marks_pr  s  inner join  subject sub 
				on s.FDEGREE=sub.FDEGREE and s.FEXAMNO=sub.FEXAMNO and s.FSUBCODE=sub.FCSUBCODE
				left join practical_entry_freeze pf
				on pf.FDEGREE=s.FDEGREE and pf.FEXAM=s.FEXAMNO and pf.FCSUBCODE=s.FSUBCODE 
				and pf.FCOLLCODE=s.FCOLLCODE
				and lpad(s.FBATCH,2,'0')=lpad(pf.FBATCH,2,'0')
				where  s.fdegree =  '{$degree}'				   
				and  s.fexamno='{$exam_no}'
				and  s.FSUBCODE='{$subject}'
				and s.FCOLLCODE='{$college_code}' and s.FBATCH>0
				group by s.FDEGREE,s.FEXAMNO,s.FSUBCODE,s.FBATCH ";
		   
	$obj_get_details = $aobj_context->mobj_db->GetAll($get_subject);	
	$col_span=7;
    if($g_freeze_time=='TIMETABLE')
	$col_span=4;
	 
	   	$e_data.="<table  width='90%'  class='tr_ventor_row' align='center' cellspacing='0' cellpadding='0' border='0' >";
		$e_data.="<th align='left' colspan='{$col_span}' class='ui-jqgrid-titlebar ui-widget-header ui-corner-tl ui-corner-tr ui-helper' style='font-size:12px; padding-left:6px; height:22px;'>Practical Entry Freeze Details </th>";		
		$e_data.="<tr  class='ui-state-default ui-jqgrid-hdiv'>";
		$e_data.="<td  align=center style='padding:2px; width:24px; border-bottom:1px solid #C5DBEC; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Sl No</td>";
		$e_data.="<td align=center  style='padding:2px;  width:60px; border-bottom:1px solid #C5DBEC;border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC;  border-bottom:1px solid #C5DBEC;'>Batch</td>";
		$e_data.="<td  align=center style='padding:2px; width:20px; border-bottom:1px solid #C5DBEC; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC;  border-bottom:1px solid #C5DBEC;'>Exam Date</td>"; 
		$e_data.="<td  align=center style='padding:2px; width:20px; border-bottom:1px solid #C5DBEC; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC;  border-bottom:1px solid #C5DBEC;'>Exam Time</td>"; 
		if($g_freeze_time=='FREEZE')
		{
			$e_data.="<td  align=center style='padding:2px; width:20px; border-bottom:1px solid #C5DBEC; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC;  border-bottom:1px solid #C5DBEC;'>Freeze Entry</td>"; 
			$e_data.="<td  align=center style='padding:2px; width:20px; border-bottom:1px solid #C5DBEC; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC;  border-bottom:1px solid #C5DBEC;'>Freeze Print</td>"; 
			
			$e_data.="<td  align=center style='padding:2px; width:20px; border-bottom:1px solid #C5DBEC; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC;  border-bottom:1px solid #C5DBEC;'>Print</td>"; 
		}
		$e_data.="</tr>";		
		$sl_no=1;
		for($m=0;$m<count($obj_get_details);$m++)
		{		
			$FSUBCODE=$obj_get_details[$m]['FCSUBCODE']; 
			$FBATCH=$obj_get_details[$m]['FBATCH']; 
			$FEXAMDATE=$obj_get_details[$m]['FEXAMDATE']; 
			$tot_marks=$obj_get_details[$m]['tot_marks']; 
			$FFREEZED=$obj_get_details[$m]['FFREEZED']; 
			$PRINTFREEZED=$obj_get_details[$m]['PRINTFREEZED']; 
			 
			$FEXAMTIME=$obj_get_details[$m]['FEXAMTIME']; 
			$freezed_batch=$obj_get_details[$m]['freezed_batch']; 
			 
			$report_link="GenerateBatchWorkSheetsFromLink({$m});"; 
			$fc_checked="";
			
			$fc_print_checked="";
			$diasable = "";
			$fc_print_disabled="disabled=true;";
			if($FFREEZED=="T")
			{
				$report_link="GeneratePracticalMarksReportsFromLink({$m});"; 
				$fc_checked = "checked  disabled=true;";
				$diasable = "disabled";
				if(strtolower($user_type)=='superuser')	
				$fc_checked=" checked";
				if($PRINTFREEZED=="T")
				{
					 
					$fc_print_disabled="disabled=true;";
					if(strtolower($user_type)=='superuser')	
					$fc_print_disabled = "";
				 	$fc_print_checked=" checked";
				}
				else
				{
					$fc_print_disabled = "";
				}
			
			}
				
			if($k%2==0)
			{
				$class='tbl_row';
			}
			else
			{
				$class='tbl_row1'; 
			}  
			 $e_data.="<tr class='ui-widget-content jqgrow'>";
			 $e_data.="<td class='tbl_row_new' align='center' style='width:20px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px;' id='batch_sl_no_{$m}'>{$sl_no} </td>";
			 $e_data.="<td class='tbl_row_new' align='center' style='width:50px; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px;' id='batch_{$m}'>{$FBATCH} </td>";
			 if($g_freeze_time=='FREEZE')
			 {
			 $e_data.="<td class='tbl_row_new' align='center'  style='width:100px; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px;' id='date_{$m}'>";			
			 $e_data.=" <div id='input_div_97' class=' imageInputWrapperDate' style='width:120px;'>
						 <input id='practical_entry_freeze_exam_date_{$m}'  class='inputWithImge ElementCount'  type='text' style='background-color:#e1e1e1; width:100px; border:0px;' value='{$FEXAMDATE}' />
						 <script>$('#practical_entry_freeze_exam_date_{$m}').datepicker({showOn: 'button',showButtonPanel: true, changeMonth: true,	changeYear: true,dateFormat:'dd/mm/yy',buttonImage: 'images/date.gif', buttonImageOnly: true});</script>
						 </div></td>";
			 }	
			else
			 {
			 $e_data.="<td class='tbl_row_new' align='center'  style='width:100px; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px;' id='date_{$m}'>";			
			 $e_data.=" <div id='input_div_97' class=' imageInputWrapperDate' style='width:120px;'>
						 <input id='practical_entry_freeze_exam_date_{$m}' {$diasable} class='inputWithImge ElementCount' onkeydown = 'dmydateformat(event,this.id)' maxlength = 10 type='text' style='width:100px; border:0px;' value='{$FEXAMDATE}' />
						 <script>$('#practical_entry_freeze_exam_date_{$m}').datepicker({showOn: 'button',showButtonPanel: true, changeMonth: true,	changeYear: true,dateFormat:'dd/mm/yy',buttonImage: 'images/date.gif', buttonImageOnly: true});</script>
						 </div></td>";
			 }
			 if($g_freeze_time=='FREEZE')
			 {
				$e_data.="<td class='tbl_row_new' align='center'   style=' width:100px; border-right:1px solid #C5DBEC;  padding:2px;'><input type='text'  style='background-color:#e1e1e1;' value='{$FEXAMTIME}' id='time_{$m}'></td>";
			 }
			 else
			 {
			   $e_data.="<td class='tbl_row_new' align='center'  style='width:100px; border-right:1px solid #C5DBEC;  padding:2px;'><input type='text' {$diasable} value='{$FEXAMTIME}'  id='time_{$m}'></td>";
			 }
			$freeze_dis="";
			 if($g_freeze_time=='TIMETABLE' || $tot_marks<=0 )
			  $freeze_dis=" disabled=true; ";
			$hide_freeze="";
			 if($g_freeze_time=='TIMETABLE' )
			  $hide_freeze=" display:none; ";
			  
			 $e_data.="<td class='tbl_row_new' align='center' style='{$hide_freeze};width:100px; border-right:1px solid #C5DBEC;  padding:2px;'><input  id='fmacas_FCSTATUS_check_{$m}' type='checkbox' {$fc_checked} {$freeze_dis}  ></td>"; 
			 $e_data.="<td class='tbl_row_new' align='center' style='{$hide_freeze};width:100px; border-right:1px solid #C5DBEC;  padding:2px;'><input  id='fmacas_print_check_{$m}' type='checkbox' {$fc_print_checked} {$fc_print_disabled}  ></td>"; 
			 
			  if($g_freeze_time=='FREEZE')
			 $e_data.="<td class='tbl_row_new' align='center' style='width:100px; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px;' id='report_{$m}'><a href='#'  style='cursor:pointer;color:blue;' onclick='{$report_link}'>Report</a></td>";			 
			 $e_data.="</tr>";   
			 $k++;
			 $sl_no++;
		}	
		$arr['html_data']=$e_data;		  
		$arr['freeze_data']=$obj_get_details;		  
		$arr['total_count']=$m;	
	 
		
		if($obj_get_details)	
	      echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
	    else
	      echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure");
    return;
		
}

function FreezePracticalMaks($aobj_context)
{
    include_once("/JSON.php"); 
	$json = new Services_JSON();
	session_start();
	$college_code = $_SESSION['collcode'];
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$format_file= $aobj_context->main_src."/src/format.php";
	include($format_file);
	
	$degree=trim($aobj_context->mobj_data["degree_code"]);
	$examno=trim($aobj_context->mobj_data["exam_no"]);
	$subject=trim($aobj_context->mobj_data["subject"]);
	$g_freeze_time = trim($aobj_context->mobj_data["g_freeze_time"]);
    $lstr_param = stripslashes($aobj_context->mobj_data["output_details"]);
	$mobj_jsondata = $json->decode($lstr_param);
	$larr_output_details = get_object_vars($mobj_jsondata);
	$ex_fields = "";
	$external = "";	 
    //var_dump($larr_output_details);
    if ($_SESSION['FUNIVCODE'] == '017')
    {
    	$external = ",fintexamcode = '{$larr_output_details[$i]->fintexamcode}',
					  fextexamcode = '{$larr_output_details[$i]->fextexamcode}',
					  fbatchcnt = '{$larr_output_details[$i]->fbatchcnt}',
					  fpresent = '{$larr_output_details[$i]->fpresent}',
					  fchief = '{$larr_output_details[$i]->fchief}',
					  fclerk = '{$larr_output_details[$i]->fclerk}',
					  fgroup = '{$larr_output_details[$i]->fgroup}',
					  fsession = '{$larr_output_details[$i]->fsession}'";
    }
	
	if($g_freeze_time == 'TIMETABLE')
	{
		$del="delete from practical_entry_freeze 
					  where 
							FCOLLCODE='{$college_code}'
							and
							FDEGREE='{$degree}'
							and
							FEXAM='{$examno}' and
							FCSUBCODE='{$subject}'
							 and ifnull(ffreezed,'')<>'T'";	
					
		$obj_del = $aobj_context->mobj_db->Execute($del); 	

		for( $i = 0; $i < count($larr_output_details); $i++ )
		{	
			$insert_qty = "insert into practical_entry_freeze(
							   FCOLLCODE,
							   FDEGREE,
							   FEXAM,
							   FBATCH,
							   FCSUBCODE, FEXAMDATE,FEXAMTIME
							   )
							   values(
								'{$college_code}',
								'{$degree}',
								'{$examno}',
								'{$larr_output_details[$i]->batch}',
								'{$subject}',									
								'{$larr_output_details[$i]->date}',
								'{$larr_output_details[$i]->time}'
							     )";
							     
			$lobj_insert_qty = $aobj_context->mobj_db->Execute($insert_qty);
		}
	}
	else if ($g_freeze_time == 'FREEZE')
	{
		for( $i = 0; $i < count($larr_output_details); $i++ )
		{
			$ver_freeze = "SELECT * FROM marks_pr WHERE fdegree= '{$degree}' AND fexamno = '{$examno}' AND fsubcode = '{$subject}' AND FBATCH = '{$larr_output_details[$i]->batch}' AND fmarks11 = '-1'";
			$ver_freeze_res = $aobj_context->mobj_db->GetAll($ver_freeze);

			if(count($ver_freeze_res) == 0)
			{	
				$insert_qty = "update practical_entry_freeze 
								set FFREEZED = '{$larr_output_details[$i]->checked}',
									PRINTFREEZED = '{$larr_output_details[$i]->p_checked}'
									{$external}
								where FCOLLCODE = '{$college_code}' AND 
									  FDEGREE = '{$degree}' AND
									  FEXAM = '{$examno}' AND
									  FBATCH = '{$larr_output_details[$i]->batch}' AND
									  FCSUBCODE = '{$subject}'";
				$lobj_insert_qty = $aobj_context->mobj_db->Execute($insert_qty);
			}
			else
			{
				break;
			}
			
		}
		if(count($ver_freeze_res) == 0) 
		{
				 $arr='Data inserted Successfully';
				 echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
				 return;
		}	
		else
		{
				$arr="Freezing with Marks -1 is Not Allowed! for Batch- '{$larr_output_details[$i]->batch}'";
				echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure");
			   return;
		}
	}

	if($lobj_insert_qty) 
	{
		$arr='Data inserted Successfully';
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
		return;
	}	
	else
	{
		$arr='insertion Failed';
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure");
		return;
	}		
}
?>