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


Current Path : /var/www/html/suk_discontinued/src/
Upload File :
Current File : /var/www/html/suk_discontinued/src/ack_exam_app_form.php

<?php	
class ack_exam_app_form
{
    
		function __construct($aobj_context)
		{
		session_start();
		$this->aobj_context=$aobj_context;
		$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
		$this->user_id=$_SESSION['user_id'];
		$this->funivcode=$_SESSION['FUNIVCODE'];		
		$this->collcode=$_SESSION['collcode'];	
		$this->log_name = $_SESSION['usr'];	
		$this->user_type=$_SESSION['user_type'];
		}
		 
		function AcknowledgeSelectedExamApplications()
		{
			  
			 	$checked_app_nos = ($this->aobj_context->mobj_data["checked_app_nos"]);
				$exp_arr=explode(",",$checked_app_nos);
				foreach($exp_arr as $apk)
				{
					$update =" update appcandsum 
					set fackdate = now(), fackuser = '{$this->log_name}', fpaymentconfirm = 'success', fpaymentstatus = 'success', 
					fpaymentremarks = 'Manual Acknowledgement', frecptdate = now() 
					where appno = '{$apk}'";
				
					$lobj_get_data = $this->aobj_context->mobj_db->Execute($update);
					
					$lquery = "select fregno from appcandsum where appno = '{$apk}'";
					
					$lresult = $this->aobj_context->mobj_db->getRow($lquery);
					
					$fregno = $lresult['fregno'];
					
					$update_cand_sum = "UPDATE appcandsumview a, candsum c, appcandsum ac
					SET 
					c.FEXAMFEEA = if(ifnull(a.FEXAMFEEA,0) > 0,ifnull(a.FEXAMFEEA,0),ifnull(c.FEXAMFEEA,0)),
					c.FEXAMFEEB = if(ifnull(a.FEXAMFEEB,0) > 0,ifnull(a.FEXAMFEEB,0),ifnull(c.FEXAMFEEB,0)),
					c.FEXAMFEEC = if(ifnull(a.FEXAMFEEC,0) > 0,ifnull(a.FEXAMFEEC,0),ifnull(c.FEXAMFEEC,0)),
					c.FEXAMFEED = if(ifnull(a.FEXAMFEED,0) > 0,ifnull(a.FEXAMFEED,0),ifnull(c.FEXAMFEED,0)),
					c.FEXAMFEEE = if(ifnull(a.FEXAMFEEE,0) > 0,ifnull(a.FEXAMFEEE,0),ifnull(c.FEXAMFEEE,0)),
					c.FEXAMFEEF = if(ifnull(a.FEXAMFEEF,0) > 0,ifnull(a.FEXAMFEEF,0),ifnull(c.FEXAMFEEF,0)),
					c.FEXAMFEEG = if(ifnull(a.FEXAMFEEG,0) > 0,ifnull(a.FEXAMFEEG,0),ifnull(c.FEXAMFEEG,0)),
					c.FEXAMFEEH = if(ifnull(a.FEXAMFEEH,0) > 0,ifnull(a.FEXAMFEEH,0),ifnull(c.FEXAMFEEH,0)),
					c.FEXAMFEEI = if(ifnull(a.FEXAMFEEI,0) > 0,ifnull(a.FEXAMFEEI,0),ifnull(c.FEXAMFEEI,0)),
					c.FEXAMFEEJ = if(ifnull(a.FEXAMFEEJ,0) > 0,ifnull(a.FEXAMFEEJ,0),ifnull(c.FEXAMFEEJ,0)),
					c.FTOTALFEE = a.FTOTALFEE,
					c.frecptdate = date(ac.FACKDATE)
					WHERE a.fregno = c.FREGNO and ac.fregno = c.fregno and ac.fdegree = c.fdegree 
					and ac.APPNO='{$apk}'";
					
					$lobj_update_cand_sum = $this->aobj_context->mobj_db->Execute($update_cand_sum);
					
					$lquery = "update canddet cd, appcanddet ad set cd.fpresent = ad.fpresent, cd.finserted	= ad.finserted
					where cd.fcollcode = ad.fcollcode and cd.fdegree = ad.fdegree and cd.fexamno = ad.fexamno 
					and cd.fsubcode = ad.fsubcode and cd.fregno = ad.fregno
					and cd.fregno='{$fregno}'
					and ad.appno = '{$apk}' and ifnull(cd.fpresent,'') <> 'P'";
					
					$lobj_get_app_cand_det = $this->aobj_context->mobj_db->Execute($lquery);
			
					$lquery = "insert ignore into canddet(FDEGREE, FEXAMNO, FCOLLCODE, FREGNO, FSUBCODE, FINSERTED, FPRESENT, FYEAR, FEXAMTYPE)  
					select FDEGREE, FEXAMNO, FCOLLCODE, FREGNO, FSUBCODE, FINSERTED, FPRESENT, FYEAR, FEXAMTYPE from appcanddet 
					where fregno='{$fregno}' and appno = '{$apk}' and ifnull(fpresent,'') = 'P'";
					
					$lobj_get_app_cand_det = $this->aobj_context->mobj_db->Execute($lquery);
					
					
					$lquery = "drop table if exists tmpstudfeeupd";
					$lresult = $this->aobj_context->mobj_db->Execute($lquery);	
					
					$lquery = "create table tmpstudfeeupd
					select distinct f.fdegree, f.fexamno, f.fcollcode, f.fregno, f.ffeecode, sum(ifnull(f.famount,0)) as famount, 
					'F' as fdeleted from appstudfee f, appcandsum  s
					where f.appno = s.appno and f.fdegree = s.fdegree and f.fregno = s.fregno 
					and s.fregno = '{$fregno}' and ifnull(s.fackdate, '') <> '' 
					and s.fpaymentconfirm = 'success' and s.fpaymentstatus = 'success'
					group by f.fdegree, f.fexamno, f.fcollcode, f.fregno, f.ffeecode";
					
					$lobj_update = $this->aobj_context->mobj_db->Execute($lquery);
					
					$lquery = "CREATE INDEX tmpstudfeeupd_idx ON tmpstudfeeupd(fdegree, fexamno, fcollcode, fregno, ffeecode)";
					
					$lobj_update = $this->aobj_context->mobj_db->Execute($lquery);
					
					$update = "update studfee sd, tmpstudfeeupd asd set sd.famount = asd.famount,
					sd.flogname = '{$this->log_name}', sd.flogdate = now()
					where sd.fdegree = asd.fdegree and sd.fexamno = asd.fexamno 
					and sd.fregno = asd.fregno and sd.ffeecode = asd.ffeecode 
					and asd.fregno='{$fregno}'";
					
					$lobj_update = $this->aobj_context->mobj_db->Execute($update);	
					
					$insert_into_student_fee = "insert ignore into studfee
					(FDEGREE,FEXAMNO, FCOLLCODE, FREGNO, FFEECODE, FAMOUNT, FLOGNAME, FLOGDATE) 
					select fdegree, fexamno, fcollcode, fregno, ffeecode, famount, '{$this->log_name}', now() 
					from tmpstudfeeupd where fregno='{$fregno}'";
					
					$lobj_insert_into_student_fee = $this->aobj_context->mobj_db->Execute($insert_into_student_fee);
					
					//$this->UpdateCandSumCandDet($apk);					
					//$this->UpdateStudeFee($apk);					
				}
			$data="Application(s) acknowledged successfully.";
			echo $this->aobj_context->mobj_output->ToJSONEnvelope($data,0,"success"); 		
 		}
		
		function UpdateStudeFee($apk)
		{
			$get_app_stud_fee="SELECT FDEGREE,FEXAMNO,FCOLLCODE,FREGNO,FFEECODE,FAMOUNT
										FROM appstudfee  WHERE   APPNO='{$apk}'
									and FCOLLCODE='{$this->collcode}' ";
			$lobj_get_app_stud_fee = $this->aobj_context->mobj_db->GetAll($get_app_stud_fee);	
		  
			foreach($lobj_get_app_stud_fee as $ak=>$av)
			{
					$FCOLLCODE=$av['FCOLLCODE'];
					$FDEGREE=$av['FDEGREE'];
					$FEXAMNO=$av['FEXAMNO'];
					$FREGNO=$av['FREGNO'];
					$FFEECODE=$av['FFEECODE'];
					$FAMOUNT=$av['FAMOUNT'];
					$get_dup_cnt="SELECT  count(1) as dup_cnt
												FROM studfee
												where FDEGREE='{$FDEGREE}'
												AND FEXAMNO='{$FEXAMNO}'
												AND FCOLLCODE='{$FCOLLCODE}'
												AND FREGNO='{$FREGNO}'
												AND FFEECODE='{$FFEECODE}' and FCOLLCODE='{$this->collcode}'";
					$lobj_get_dup_cnt = $this->aobj_context->mobj_db->GetRow($get_dup_cnt);	
					//echo "<br>".$get_dup_cnt;
					$dup_cnt=$lobj_get_dup_cnt['dup_cnt'];
					if($dup_cnt==0)
					{
						$insert_into_student_fee="insert into studfee
										(
										FDEGREE,FEXAMNO,FCOLLCODE,FREGNO,FFEECODE,FAMOUNT,FLOGNAME,FLOGDATE
										) VALUES
										(
										'{$FDEGREE}',
										'{$FEXAMNO}',
										'{$this->collcode}',
										'{$FREGNO}',
										'{$FFEECODE}',
										'{$FAMOUNT}',
										'{$this->log_name}',
										NOW()
										)";
										$lobj_insert_into_student_fee = $this->aobj_context->mobj_db->Execute($insert_into_student_fee);
							//echo $insert_into_student_fee."<br>";			 
						 				
					}
					else
					{
						$update="	update   studfee set FAMOUNT={$FAMOUNT},
									FLOGNAME='{$this->log_name}',FLOGDATE=now()
									where FDEGREE='{$FDEGREE}'
									AND FEXAMNO='{$FEXAMNO}'
									AND FCOLLCODE='{$FCOLLCODE}'
									AND FREGNO='{$FREGNO}'
									AND FFEECODE='{$FFEECODE}'
									and FCOLLCODE='{$this->collcode}'";
					 					
						$lobj_update = $this->aobj_context->mobj_db->Execute($update);							
					}
			}			
		}
		function UpdateCandSumCandDet($apk)
		{
			
			
			
			$get_app_cand_det = "SELECT FDEGREE,FEXAMNO,FCOLLCODE,FREGNO,FSUBCODE,FINSERTED,FPRESENT,FYEAR,FEXAMTYPE
								FROM appcanddet
								WHERE APPNO = {$apk} and ifnull(fpresent,'') = 'P'";
			$lobj_get_app_cand_det = $this->aobj_context->mobj_db->GetAll($get_app_cand_det);
			foreach($lobj_get_app_cand_det as $ak=>$av)
			{
					$FCOLLCODE=$av['FCOLLCODE'];
					$FDEGREE=$av['FDEGREE'];
					$FEXAMNO=$av['FEXAMNO'];
					$FREGNO=$av['FREGNO'];
					$FSUBCODE=$av['FSUBCODE'];
					$FINSERTED=$av['FINSERTED'];
					$FPRESENT=$av['FPRESENT'];
					$FYEAR=$av['FYEAR'];
					$FEXAMTYPE=$av['FEXAMTYPE'];
					$get_cand_det_cnt = "select count(1) as cnt from canddet
										where    FDEGREE='{$FDEGREE}'
										AND FEXAMNO='{$FEXAMNO}'
										AND FCOLLCODE='{$FCOLLCODE}'
										AND FREGNO='{$FREGNO}'
										AND FSUBCODE='{$FSUBCODE}'";
					$lobj_get_cand_det_cnt = $this->aobj_context->mobj_db->GetRow($get_cand_det_cnt);	
					$cnt=$lobj_get_cand_det_cnt['cnt'];
					if($cnt>0)
					{
						$update = " update canddet 
									set FINSERTED='{$FINSERTED}',
									FPRESENT='{$FPRESENT}'
									where    FDEGREE='{$FDEGREE}'
									AND FEXAMNO='{$FEXAMNO}'
									AND FCOLLCODE='{$FCOLLCODE}'
									AND FREGNO='{$FREGNO}'
									AND FSUBCODE='{$FSUBCODE}' AND FEXAMNO = '{$FEXAMNO}' and ifnull(fpresent,'') <> 'P'";
						$lobj_update = $this->aobj_context->mobj_db->Execute($update);		 
					}
					else
					{
						$insert="
							INSERT INTO canddet 
							(FDEGREE, 
							FEXAMNO, 
							FCOLLCODE, 
							FREGNO, 
							FSUBCODE, 
							FINSERTED, 
							FPRESENT, 
							FYEAR, 
							FEXAMTYPE
							)
							values
							(
							'{$FDEGREE}',
							'{$FEXAMNO}',
							'{$FCOLLCODE}',
							'{$FREGNO}',
							'{$FSUBCODE}',
							'{$FINSERTED}',
							'{$FPRESENT}',
							'{$FYEAR}',
							'{$FEXAMTYPE}' 
							)";
						 	
							$lobj_insert = $this->aobj_context->mobj_db->Execute($insert);		 	
					}	
			}			
		}
		
		function DisplayAllAckExamApplications()
		{
			 	$app_no_from = trim($this->aobj_context->mobj_data["app_no_from"]);
				//var_dump(stripslashes($app_no_from));
				//$app_no_from=str_pad($app_no_from, 10, "0", STR_PAD_LEFT);
				
				$app_no_to = ($this->aobj_context->mobj_data["app_no_to"]);
				$ack_type = ($this->aobj_context->mobj_data["ack_type"]);
				$app_no_to.= $app_no_from;
				$app_no_from = stripslashes($app_no_from);
				$app_no_from = substr($app_no_from, 0, -1);
				//die();
				$fisrt = true;
				
				if($ack_type == 'Pending')
				{
					$ref = "AND (FACKDATE IS NULL OR FACKDATE='')";
				}
				else if($ack_type == 'Acknowledged')
				{
					$ref = "AND ifnull(FACKDATE,'') <> ''";
				}
				else
				{
					$ref = "";
				}
				/* if($this->funivcode == '018')
					$condition = "AND (concat(r.APPNO,r.fregno) in({$app_no_from}) or concat(r.fregno) in ({$app_no_from}))";
				else */
					$condition = "AND r.APPNO in({$app_no_from})";
				
				$get_data =" SELECT DISTINCT r.APPNO,  r.FPAYMENTYPE,FACKDATE,
				DATE_FORMAT(r.FDATE,'%d/%m/%Y') AS FAPPDATE,r.FREGNO,s.FNAME,
				r.FDEGREE,r.FTOTALFEE 
				FROM appcandsum r INNER JOIN student s ON s.FREGNO=r.FREGNO 
				WHERE r.FCOLLCODE='{$this->collcode}'  {$ref}
				{$condition} 
				order by r.FREGNO,r.APPNO";		
				//var_dump($get_data);
				$lobj_get_data = $this->aobj_context->mobj_db->GetAll($get_data);
				/* if($fisrt)
				{	
					$str_reval.="<br>";
					$str_reval.="<table style='' class='tr_ventor_row' id='reval_table_data' width='780px;' border='0' cellspacing='0' cellpadding='0'>";
					$str_reval.="<tr class='tr_bg1'>";
					$str_reval.="<td align='center' style=' font-size:12px; font-weight:bold; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-top:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Sl. No.</td>";
					$str_reval.="<td align='center' style=' font-size:12px; font-weight:bold; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-top:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Application No</td>";
					$str_reval.="<td align='center' style=' font-size:12px; font-weight:bold; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-top:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Date</td>";
					$str_reval.="<td align='center' style=' font-size:12px; font-weight:bold; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-top:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Reg. No.</td>";
					$str_reval.="<td align='center' style=' font-size:12px; font-weight:bold; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-top:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Student Name</td>";
					$str_reval.="<td align='center' style=' font-size:12px; font-weight:bold; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-top:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Degree</td>";
					$str_reval.="<td align='center' style=' font-size:12px; font-weight:bold; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-top:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Amount</td>";
					$str_reval.="<td align='center' style=' font-size:12px; font-weight:bold; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-top:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Select</td>";
					$str_reval.="</tr>";
					$fisrt = false;
				} */
	 
			$k=0;
			$sl_no=1;
			foreach($lobj_get_data as $ak=>$av)
			{
				$strPos = strpos($this->collcode,'P');
				if($this->user_type != 'SuperUser' && ($striPos != 0) && $this->user_type != 'Admin')
				{
					if($av['FPAYMENTYPE'] == 'POSTOFFICE' || $av['FPAYMENTYPE'] == 'DEBIT/CREDIT/NET BANKING')
					{
						$disabled = 'disabled';
					}
					else
					{
						$disabled= '';
					}
				}
				
				$APPNO=$av['APPNO'];
				$FREGNO=$av['FREGNO'];
				$FAPPDATE=$av['FAPPDATE'];
				$FNAME=$av['FNAME'];
				$FDEGREE=$av['FDEGREE'];
				$FAMOUNT=$av['FTOTALFEE'];
				$FACKDATE = $av['FACKDATE'];

				if($FACKDATE != '')
				{
					$disabled = 'disabled checked';
				}
				else
				{
					$disabled = 'checked';
				}
				if($k%2==0)
				$class='tbl_row1';
				else
				$class='tbl_row_alter1';
				$str_reval.="<tr>";		
				$str_reval.="<td class='{$class}' style=' font-size:12px; text-align:center; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px;' >{$sl_no}</td>";
				$str_reval.="<td class='{$class}' style=' font-size:12px; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; text-align:center; ' >&nbsp;<a href=# style='color:blue;' onclick='PrintOnlineExamApplicationForm(\"{$APPNO}\")'>{$APPNO}</a></td>";
				$str_reval.="<td class='{$class}' style=' font-size:12px; text-align:left; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; text-align:center;  ' >{$FAPPDATE}&nbsp;</td>";
				$str_reval.="<td class='{$class}' style=' font-size:12px; text-align:left; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; text-align:center;  ' >&nbsp;{$FREGNO}</td>";
				$str_reval.="<td class='{$class}' style=' font-size:12px; text-align:left; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; text-align:left; ' >{$FNAME}</td>";
				$str_reval.="<td class='{$class}' style=' font-size:12px; text-align:left; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; text-align:center; ' >{$FDEGREE}</td>";
				$str_reval.="<td class='{$class}' style=' font-size:12px; text-align:left; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; text-align:center; ' >{$FAMOUNT}</td>";
				$str_reval.="<td class='{$class}' align='center' style=' font-size:12px; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; font-weight:bold;text-align:center;' ><input type='checkbox' {$disabled}  id='ack_check_box_{$APPNO}' /></td>"; 
			//	$str_reval.="<td class='{$class}' style=' font-size:12px; text-align:left; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; text-align:center; ' >{$disabled_txt}</td>";
				$str_reval.="</tr>";
				$sl_no++;
				$k++;
			}			
		/* $str_reval.="</table>";
		$str_reval.="<br>"; */
		$arr['html']=$str_reval;
		$arr['app_no']=$app_no_from;
		echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 	
			 
		}
		 
 }
	
function DisplayAllAckExamApplications($aobj_context)
{
    $class_obj=new ack_exam_app_form($aobj_context);
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC); 
	$class_obj->DisplayAllAckExamApplications();
} function AcknowledgeSelectedExamApplications($aobj_context)
{
    $class_obj=new ack_exam_app_form($aobj_context);
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC); 
	$class_obj->AcknowledgeSelectedExamApplications();
} 
 

?>