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


Current Path : /var/www/oasis/src_old/
Upload File :
Current File : /var/www/oasis/src_old/adm_challan_entries.php

<?php
class challan_entries
{
    
	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->collcode=$_SESSION['collcode'];	
		$this->college_code=$_SESSION['collcode'];	
		$this->log_name = $_SESSION['usr'];			
	}
		
	function DeleteChallanDetails()
	{
		  
		$FDOCNO = ($this->aobj_context->mobj_data["FDOCNO"]);	 
		$update="update chaldet 
					set FDELETED='T'
					where FCHALNO='{$FDOCNO}'";
		$lobj_get_data = $this->aobj_context->mobj_db->Execute($update);

		if($lobj_get_data)
		{
			$update="update studadm 
					set FCHALNO = null
					where FCHALNO='{$FDOCNO}'";
			$lobj_get_data = $this->aobj_context->mobj_db->Execute($update);	

			if($lobj_get_data)
			{
				$data = "Document deleted successfully.";
				echo $this->aobj_context->mobj_output->ToJSONEnvelope($data,0,"success");
			}
			else
			{
				$data = "Document deleted successfully.";
				echo $this->aobj_context->mobj_output->ToJSONEnvelope($data,0,"success");
			}	
		}
		else
		{
			$data = "Document deleted successfully.";
			echo $this->aobj_context->mobj_output->ToJSONEnvelope($data,0,"success");
		}	
	}

	function DeleteDocNoFromChallanDetails()
	{	  
		$APPNO = ($this->aobj_context->mobj_data["APPNO"]);
		$docno = ($this->aobj_context->mobj_data["FDOCNO"]);

		$update="update studadm 
					set fchalno=null
					where FAPPNO='{$APPNO}'";
		$lobj_get_data = $this->aobj_context->mobj_db->Execute($update);
		
		if($lobj_get_data)
		{
			$select = "select TOTAL_FEE from studadm where FAPPNO='{$APPNO}'";
			$lobj_get_fees = $this->aobj_context->mobj_db->GetRow($select);

			$update = "update chaldet set 
			fchalamt = fchalamt-{$lobj_get_fees['TOTAL_FEE']},
			fappcnt = fappcnt-1 where fchalno = {$docno}";
			$lobj_get_chall = $this->aobj_context->mobj_db->Execute($update);

			if($lobj_get_chall)
			{
				$data="Document deleted successfully.";
				echo $this->aobj_context->mobj_output->ToJSONEnvelope($data,0,"success");
			}
			else
			{
				$data="Error while deleting.";
				echo $this->aobj_context->mobj_output->ToJSONEnvelope($data,1,"error");
			}
		}
		else
		{
			$data="Error while deleting.";
			echo $this->aobj_context->mobj_output->ToJSONEnvelope($data,1,"error");
		}	
	}

	function UpdateChallanDetailsForDoc()
	{	  
		$FDOCNO = ($this->aobj_context->mobj_data["FDOCNO"]);
		$challan_no = ($this->aobj_context->mobj_data["challan_no"]);
		$challan_date = ($this->aobj_context->mobj_data["challan_date"]);
		$challan_amt = ($this->aobj_context->mobj_data["challan_amt"]);
		 
		$update="update chaldet
					set FRECNO='{$challan_no}',
					FCOLACKDATE='{$challan_date}',
					FCOLACKUSER='{$this->log_name}',
					FCHALAMT='{$challan_amt}',
					FSTATUS='SENT'
					where FCHALNO='{$FDOCNO}'";
					//var_dump($update);
					$lobj_get_data = $this->aobj_context->mobj_db->Execute($update);

					$update="update studadm
					set FAPPSTATUS = 'Acknowledged',
					FACKDATE = now(),
					FACKUSER ='{$this->log_name}'
					where FCHALNO='{$FDOCNO}'";			

		$lobj_get_data = $this->aobj_context->mobj_db->Execute($update);	

		if($lobj_get_data)
		{
			$data="Challan Entry Updated successfully.";				
			echo $this->aobj_context->mobj_output->ToJSONEnvelope($data,0,"success"); 
		}	
		else
		{
			$data="Challan Entry Updation failed ";				
			echo $this->aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure"); 
		}			
	}

	function DisplayChallanEntryDetails()
	{
	 	$up_to = ($aobj_context->mobj_data["up_to"]);
		$cond="";
		if($up_to!="0000-00-00")
			$cond=" and r.FACKDATE>='{$up_to}'";
		
		$get_data="select fchalno as docno, fchalamt, fappcnt, 
		date_format(fchaldate, '%d/%m/%Y') as fchalpredate, 
		ifnull(frecno,'') as chalno, 
		ifnull(date_format(fcolackdate, '%d/%m/%Y'),'') as fchaldate,
		ifnull(fstatus,'Pending') as fstatus
		from chaldet where fcollcode = '{$this->collcode}' 
		and ifnull(fdeleted,'F') <> 'T'";	

		$lobj_get_data = $this->aobj_context->mobj_db->GetAll($get_data);
		 
		$str_reval.="<table style='padding:3px 4px 3px 3px;' class='tr_ventor_row' id='reval_table_data' width='100%' border='0' cellspacing='0' cellpadding='0'>";
		$str_reval.="<tr class='ui-state-default ui-jqgrid-hdiv'>";
		$str_reval.="<td align='center' style='padding:4px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Sl No</td>";
		$str_reval.="<td align='center' style=' font-size:11px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Document No</td>";
		$str_reval.="<td align='center' style=' font-size:11px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Challan No </td>";
		$str_reval.="<td align='center' style=' font-size:11px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Challan Date</td>";
		$str_reval.="<td align='center' style=' font-size:11px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Amount</td>";
		$str_reval.="<td align='center' style=' font-size:11px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>No of Appl.</td>";
		$str_reval.="<td align='center' style=' font-size:11px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Challan Prepared Date</td>";
		$str_reval.="<td align='center' style=' font-size:11px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Status</td>";
		$str_reval.="<td align='center' style=' font-size:11px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>  &nbsp;  &nbsp;  &nbsp;  &nbsp;</td>"; 
		$str_reval.="</tr>";
 
		$k=0;
		$sl_no=1;
		foreach($lobj_get_data as $ak=>$av)
		{
			$FDOCNO=$av['docno'];
			$doc_status=$av['fstatus'];
			$challan_prepared_date=$av['fchalpredate'];
			$no_of_app=$av['fappcnt'];
			$FAMOUNT=$av['fchalamt'];
			$FCHALLANDATE=$av['fchaldate'];
			$FCHALLANNO=$av['chalno'];
			$div_class="red_corner_div";
			$delete_edit="<img  onclick='EnableAdmChallanUpdateScreen(\"{$FDOCNO}\")'  src='img/Edit_New.jpg' title='Edit'  /> ";
			$delete_edit.="<img  onclick='DeleteChallanDetails(\"{$FDOCNO}\")'; src='img/delete1.PNG' title='Delete'  /> ";
			$bg_color = "";
			if($doc_status=="Received")//srsoftsol@gmail.com
			{
				$delete_edit="";
				//$div_class="green_corner_div";
			}
			// $new_doc_status='<div style=  margin: 0 auto; " class="'.$div_class.'">
			// 				<span style="color:#FFFFFF;line-height: 19px;font-size:11px;font-weight:bold;"  >'.$doc_status.'</span>
			// 				</div>';

			if($FCHALLANNO != '')
			{
				$challprint = "<img  onclick='PrintAdmChallanEntryDetails(\"{$FDOCNO}\")'  src='img/Print_New.jpg' title='Edit'  />";
			}	
			else
			{
				$challprint = "";
			}
			if($k%2==0)
				$class='tbl_row1';
			else
				$class='tbl_row_alter1';
			
			$str_reval.="<tr>";		
			$str_reval.="<td class='{$class} tbl_row_new' style='text-align:center; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px;' >{$sl_no}</td>";
			$str_reval.="<td class='{$class} tbl_row_new' style='border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; font-size:11px;text-align:center; ' > {$FDOCNO}</td>";
			$str_reval.="<td class='{$class} tbl_row_new' style='text-align:left; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px;  ;text-align:center;  ' >{$FCHALLANNO}&nbsp;</td>";
			$str_reval.="<td class='{$class} tbl_row_new' style='text-align:left; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px;  ;text-align:center;  ' > {$FCHALLANDATE}</td>";
			$str_reval.="<td class='{$class} tbl_row_new' style='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} tbl_row_new' style='text-align:left; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; ;  ;text-align:center; ' >{$no_of_app}</td>";
			$str_reval.="<td class='{$class} tbl_row_new' style='text-align:left; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; ;  ;text-align:center; ' >{$challan_prepared_date}</td>";
			$str_reval.="<td class='{$class} tbl_row_new' style='text-align:left; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; ;  ;text-align:center; ' >{$doc_status}</td>";

			$str_reval.="<td class='{$class} tbl_row_new' style='text-align:left; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px;text-align:center; cursor:pointer; ' >{$challprint}{$delete_edit}</td>";
			$str_reval.="</tr>";
			
			$sl_no++;
			$k++;
		}			
		$str_reval.="</table>";
		$arr['html']=$str_reval;
		echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 	
		 
	}
		
	function ShowApplicationsForDocNo()
	{
	  
	 	$FDOCNO = ($this->aobj_context->mobj_data["FDOCNO"]);
	 
		$get_data="select FAPPNO, DATE_FORMAT(FLOGDATE,'%d/%m/%Y') AS FAPPDATE,
		FNAME,FDEGREE,TOTAL_FEE as FAMOUNT
		from studadm where fchalno = {$FDOCNO} and fcollcode = {$this->collcode}";	
		//var_dump($get_data);						
		$lobj_get_data = $this->aobj_context->mobj_db->GetAll($get_data);
 			
		$str_reval.="<table style='padding:3px 4px 3px 3px;' class='tr_ventor_row' id='reval_table_data' width='100%' border='0' cellspacing='0' cellpadding='0'>";
		$str_reval.="<tr class='ui-state-default ui-jqgrid-hdiv'>";
		$str_reval.="<td align='center' style='padding 4px; font-size:11px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Sl No</td>";
		$str_reval.="<td align='center' style='padding:4px; font-size:11px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Application No</td>";
		$str_reval.="<td align='center' style='padding:4px; font-size:11px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Applied Date</td>";
		$str_reval.="<td align='center' style='padding:4px; font-size:11px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Student Name</td>";
		$str_reval.="<td align='center' style='padding:4px; font-size:11px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Degree</td>";
		$str_reval.="<td align='center' style='padding:4px; font-size:11px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Amount</td>";
		$str_reval.="<td align='center' style='padding:4px; font-size:11px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'> Delete</td>";
		$str_reval.="</tr>";
	 
		$k=0;
		$sl_no=1;
		foreach($lobj_get_data as $ak=>$av)
		{
			$APPNO=$av['FAPPNO'];
			$FAPPDATE=$av['FAPPDATE'];
			$FNAME=$av['FNAME'];
			$FDEGREE=$av['FDEGREE'];
			$FAMOUNT=$av['FAMOUNT'];
			$FACKDATE=$av['FACKDATE'];
			if($k%2==0)
				$class='tbl_row1';
			else
				$class='tbl_row_alter1';
			
			$str_reval.="<tr>";		
			$str_reval.="<td class='{$class} tbl_row_new' style='text-align:center; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px;' >{$sl_no}</td>";
			$str_reval.="<td class='{$class} tbl_row_new' style='border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; font-size:11px;text-align:center; ' >&nbsp;{$APPNO}</td>";
			$str_reval.="<td class='{$class} tbl_row_new' style='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} tbl_row_new' style='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} tbl_row_new' style='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} tbl_row_new' style='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} tbl_row_new' align='center' style='border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; ;font-weight:bold;text-align:center;' ><img  onclick='DeleteDocNoFromChallanDetails(\"{$FDOCNO}\",\"{$APPNO}\")'; src='img/delete1.PNG' title='Delete Application from Challan'  /></td>"; 
			$str_reval.="</tr>";
			$sl_no++;
			$k++;
		}
		$str_reval.="</table>";
		$get_other_details="select fchalno as docno, fchalamt, fappcnt, 
		date_format(fchaldate, '%d/%m/%Y') as fchalpredate, 
		ifnull(frecno,'') as chalno, 
		ifnull(date_format(fcolackdate, '%d/%m/%Y'),'') as fchaldate,
		ifnull(fstatus,'Pending') as fstatus
		from chaldet where fcollcode = '{$this->collcode}' 
		and fchalno = '{$FDOCNO}'
		and ifnull(fdeleted,'F') <> 'T'";
							//var_dump($get_other_details);
		$lobj_get_other_details = $this->aobj_context->mobj_db->GetRow($get_other_details);					
		$arr['html']=$str_reval;
		$arr['data']=$lobj_get_other_details;
		echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 		 
	}
 }
	
function DisplayChallanEntryDetails($aobj_context)
{
    $class_obj=new challan_entries($aobj_context);
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC); 
	$class_obj->DisplayChallanEntryDetails();
}  
function DeleteChallanDetails($aobj_context)
{
    $class_obj=new challan_entries($aobj_context);
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC); 
	$class_obj->DeleteChallanDetails();
}   

function ShowApplicationsForDocNo($aobj_context)
{
    $class_obj=new challan_entries($aobj_context);
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC); 
	$class_obj->ShowApplicationsForDocNo();
} 

function DeleteDocNoFromChallanDetails($aobj_context)
{
    $class_obj=new challan_entries($aobj_context);
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC); 
	$class_obj->DeleteDocNoFromChallanDetails();
}

function UpdateChallanDetailsForDoc($aobj_context)
{
    $class_obj=new challan_entries($aobj_context);
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC); 
	$class_obj->UpdateChallanDetailsForDoc();
}     
 
?>