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


Current Path : /var/www/oasis/Report_details/
Upload File :
Current File : /var/www/oasis/Report_details/affliation_detailed_report.php

<?php
$main_src=substr($_SERVER['SCRIPT_FILENAME'],0,strlen($_SERVER['SCRIPT_FILENAME'])-7);
$pdf_writer_class =$main_src."/tarka_pdf/fpdf.php";
require_once($pdf_writer_class);
include_once("stringspliter.php");
	
class report_ra_qp_wise_student_count  extends FPDF
{
		 
	function DefaultConstructor($aobj_context)
	{
		session_start();
		$this->aobj_context=$aobj_context;
		$this->pdf=  new FPDF();
        $this->pdf=$this;
        $this->fsaffid = $this->aobj_context->mobj_data["fsaffid"];
        // $this->ttd_examno = $this->aobj_context->mobj_data["examno"];
        // $this->alldeg = $this->aobj_context->mobj_data["alldeg"];
		
		$this->ip=$_SERVER["REMOTE_ADDR"];
		$get_date="select date_format(now(),'%d/%m/%Y %H:%i:%s') now_date";
		$obj=$this->aobj_context->mobj_db->GetRow($get_date);
		$this->current_date=$obj[now_date];	
		$this->collcode=$_SESSION['collcode'];	
	}
	 
	function Header()
	{
		session_start();
		$FUNIVCODE = $_SESSION['FUNIVCODE'];
		
		$img_path=$this->aobj_context->main_src.$this->photo_path;
		if(!empty($this->photo_path) && file_exists($img_path)) 
		{			
			$this->pdf->Image($img_path,166,50,50);
		}	
		if(!empty($this->pdf_logo_path))
		{
			$img_logo_path=$this->aobj_context->main_src.'/'.$this->aobj_context->mobj_data["db"].'/'.$this->pdf_logo_path;
			$this->pdf->Image($img_logo_path,10,10,23,22);
		}
		$img_path2 = $this->aobj_context->main_src."/img/logo2.jpg";
		if(file_exists($img_path2))
		{
			$this->pdf->Image($img_path2,170,6,23,23);
		}
		
		$this->pdf->SetFont('Times','B',12);
		$this->pdf->cell(180,3,$this->FUNIVNAME."","0",1,"C");
		$this->pdf->SetFont('Times','B',7);
		$this->pdf->cell(180,7, $this->s_state,"0",1,"C");
		$this->pdf->SetFont('Times','B',9);
		$this->pdf->cell(180,7, $this->college_details,"0",'1',"C");
		$this->pdf->SetFont('Times','B',10);
		$this->pdf->Cell(180,7,"Affliation Fees Detailed","0",1,"C");
		
		$this->pdf->Ln(2);
		$this->pdf->SetFont('Times','',13);
		
	}
	
	function Footer()
	{
		 
		$this->SetY(-15);
		$this->pdf->SetFont('Times','B',8);
		$this->Cell(140,6,'Printed   : IP Address : '.$this->ip." Date ".$this->current_date,'0',0,'L');
		$this->Cell(50,6,'Page '.$this->PageNo().' of {nb}',0,1,'R');
	}
	
	function formcolldata()
	{

		$get_coll_name="select FUNIVNAME as 'FUNIVNAME',
						FUNIVADD1 as 'state', pdf_logo_path From control";
		$lobj_get_coll_name=$this->aobj_context->mobj_db->GetRow($get_coll_name);
		
		$this->FUNIVNAME=$lobj_get_coll_name['FUNIVNAME'];
		$this->s_state=$lobj_get_coll_name['state'];
		$this->f_year=$lobj_get_coll_name['f_year'];
		$this->pdf_logo_path=$lobj_get_coll_name['pdf_logo_path'];

		$get_data="SELECT c.FCOLLCODE,
			CONCAT(c.FCOLLCODE, ' - ', c.FCOLLNAME,', ',c.FTOWN) AS FCOLLNAME FROM college c
			where c.FCOLLCODE='{$this->collcode}'";
		 
		$obj_student=$this->aobj_context->mobj_db->GetRow($get_data); 

		$this->college_details=$obj_student[FCOLLNAME];

		$this->degree_details=" College : {$this->FCOLLNAME}";		

	}

	function GetFullQry()
	{		
        
        if($this->ttd_examno == ''){
            $this->ttd_examno = '%';
        }
    
        $fsaffid = $this->fsaffid;
        // $ttd_examno = $this->ttd_examno;

    
        $query = "SELECT d.fsaffid, d.faffid,f1.faffihead,d.ffeeid, f1.ffeehead, d.ffees, d.fgst, d.ftotal, DATE_FORMAT(d.fcreatedate,'%d/%m/%Y') AS fcreatedate
		FROM affliation_det d
		INNER JOIN affliation_fee f1 ON d.ffeeid = f1.ffeeid AND f1.faffid = d.faffid
		WHERE fsaffid ='{$fsaffid}'";
        // var_dump($query);
        $this->lobj_get_data = $this->aobj_context->mobj_db->GetAll($query);

        $query = "SELECT fsaffid, fprincipalname, fcollcode, fmobileno, faisuecode, faisueid, ftotalsum, 
        DATE_FORMAT(fcreatedate,'%d/%m/%Y') AS fcreatedate, IFNULL(fpaymentstatus,'') AS fpaymentstatus,
				ifnull(ffine,0) as ffine,
        IFNULL(ftransactionid, '') AS ftransactionid ,  
        IFNULL(forderid,'') AS forderid, IFNULL(DATE_FORMAT(ftransactiondate,'%d/%m/%Y'),'') AS ftransactiondate
        FROM affliation_sum WHERE fsaffid = '{$fsaffid}'";
        // var_dump($query);
        $this->lobj_get_data_sum = $this->aobj_context->mobj_db->GetRow($query);
        // var_dump($this->lobj_get_data);
        // die();
		
		
	}
	
	function formData()
	{
		$len = 2;
		for($s = 0;$s < $len; $s++){

		$this->pdf->SetMargins(10,12,10);		
		$this->pdf->AddPage();
		// var_dump($s);
		$empty_cell_width=2;
		$sl_no=1;
		$k2 = 1;
		$first = true;
        // var_dump($this->lobj_get_data);
        $A1 = 0;
        $A2 = 0;
        $A3 = 0;
        $sum_data = $this->lobj_get_data_sum;
		$this->pdf->setY(35);
		if($s == 0){
		$this->pdf->SetFont('Times','BU',10);
		$this->pdf->cell(180,7, "COLLEGE COPY","",0,"C");
		}else if($s == 1){
			$this->pdf->SetFont('Times','BU',10);
			$this->pdf->cell(180,7, "UNIVERSITY COPY","",0,"C");

		}
		
		$this->pdf->ln(10);
        $this->pdf->SetFont('Times','B',10);
        $this->pdf->cell(35,7, "Principal Name    ","",0,"L");
        $this->pdf->SetFont('Times','',10);
        $this->pdf->cell(100,7, ': '.$sum_data['fprincipalname'],"",1,"L"); 
        $this->pdf->SetFont('Times','B',10);
        $this->pdf->cell(35,7, "Mobile No.    ","",0,"L");
        $this->pdf->SetFont('Times','',10);
        $this->pdf->cell(100,7, ': '.$sum_data['fmobileno'],"",1,"L"); 
        $this->pdf->SetFont('Times','B',10);
        $this->pdf->cell(35,7, "Aisue Code    ","",0,"L");
        $this->pdf->SetFont('Times','',10);
        $this->pdf->cell(100,7, ': '.$sum_data['faisuecode'],"",1,"L"); 
        $this->pdf->SetFont('Times','B',10);
        $this->pdf->cell(35,7, "Aisue User Id    ","",0,"L");
        $this->pdf->SetFont('Times','',10);
				$this->pdf->cell(100,7, ': '.$sum_data['faisueid'],"",1,"L"); 
				$fine = $sum_data['ffine'];
        $this->pdf->ln(5); 
		$C1 = '';  
		$C2 = '';

		foreach($this->lobj_get_data as $dk => $dv)
		{
			
			if($k2 > 29)
			{
				$this->pdf->AddPage();
				$k2 = 1;
			}
			$C1 = $dv['faffid'];
			if($C1 !=  $C2 ){
				$this->pdf->SetFont('Times','B',10);
				$this->pdf->cell($empty_cell_width,7, ""," ",0,"C");
				// $this->pdf->SetX($x + 14);
				$this->pdf->cell(182,7, $dv['faffihead'],"1",1,"L");
				$this->pdf->SetFont('Times','',9);
				// $y1 = $this->pdf->GetY();
				// $h = $y1 - $y;
				// $this->pdf->SetXY($x, $y);
				

			}
			

			
			if($first == true || $k2 == 1)
			{
				$this->pdf->SetFont('Times','B',10);
				$this->pdf->cell($empty_cell_width,7, ""," ",0,"C");
				$this->pdf->cell(12,7, "Sl. No.","1",0,"C");
				$this->pdf->cell(90,7, "Courses","1",0,"C");
				$this->pdf->cell(20,7, "Fees","1",0,"C");
				$this->pdf->cell(20,7, "GST (18%)","1",0,"C");
				$this->pdf->cell(20,7, "Date","1",0,"C");
				$this->pdf->cell(20,7, "Total","1",1,"C");
				$this->pdf->SetFont('Times','',9);
				$first = false;
			}


			
			$x = $this->pdf->GetX();
			$y = $this->pdf->GetY();
			
			$subname = trim($dv['FSSUBNAME']);
			$subnamearr = str_splitf($subname,50);
			
			$this->pdf->cell($empty_cell_width,7, ""," ",0,"C");
			$this->pdf->cell(12,7, $sl_no,"LRT",0,"C");
            $this->pdf->SetX($x + 14);
			$this->pdf->MultiCell(90,7, $dv['ffeehead'],"T", "L");
            $this->pdf->SetXY($x+104, $y);
			$this->pdf->cell(20,7, moneyFormatIndia($dv['ffees']),"LRT",0,"C");
			// $this->pdf->MultiCell(60,7, $dv['fsubname'],"LRT",0,"L");
			
            $this->pdf->cell(20, 7, moneyFormatIndia($dv['fgst']),"LRT",0,"C");
			$this->pdf->SetFont('Times','',8);
			
			$this->pdf->cell(20,7, $dv['fcreatedate'],"LRT",0,"C");
			$this->pdf->SetFont('Times','',9);
			$this->pdf->cell(20,7, moneyFormatIndia($dv['ftotal']),"LRT",1,"C");
            $A1 += $dv['ffees'];
            $A2 += $dv['fgst'];
            $A3 += $dv['ftotal'];            
			if($k2 == 29)
			{	
				// $this->pdf->cell($empty_cell_width,7, "","",0,"C");
				// $this->pdf->cell(170,1, "","T",0,"C");
			}
			if($subnamearr[1] != '')
			{
				$this->pdf->cell($empty_cell_width,7, ""," ",0,"C");
				$this->pdf->cell(12,4,'',"LRB",0,"C");
				$this->pdf->cell(90,4,'',"LRB",0,"C");
				$this->pdf->cell(20,4,'',"LRB",0,"C");
				$this->pdf->cell(20,4,'',"LRB",0,"L");
				$this->pdf->SetFont('Times','',8);
				$this->pdf->cell(20,4, $subnamearr[1],"LRB",0,"L");
				$this->pdf->SetFont('Times','',9);
				$this->pdf->cell(20,4,'',"LRB",1,"C");
				if($k2 == 30)
				{	
					// $this->pdf->cell($empty_cell_width,7, "","",0,"C");
					// $this->pdf->cell(190,1, "","T",0,"C");
				}	
			}
			$sl_no++;
			$k2++;
			$C2 = $C1;
		}
        $this->pdf->SetX($x +2);
        $this->pdf->SetFont('Times','B',9);

				$this->pdf->cell(102,7, "Total","LTRB",0,"R");
				$this->pdf->cell(20,7, moneyFormatIndia($A1),"LTRB",0,"C");
        $this->pdf->cell(20,7, moneyFormatIndia($A2),"LTRB",0,"C");
        $this->pdf->cell(20,7, "","LTRB",0,"C");
				$this->pdf->cell(20,7, moneyFormatIndia($A3),"LTRB",1,"C");
				$this->pdf->SetX($x +2);
				$this->pdf->cell(102,7, "Fine","LTRB",0,"R");
				$this->pdf->cell(20,7,'',"LTRB",0,"C");
				$this->pdf->cell(20,7, '',"LTRB",0,"C");
				$this->pdf->cell(20,7, "","LTRB",0,"C");
				$this->pdf->cell(20,7, moneyFormatIndia($fine),"LTRB",1,"C");
				$this->pdf->SetX($x +2);
				$this->pdf->cell(102,7, "Grand Total","LTRB",0,"R");
				$this->pdf->cell(20,7,'',"LTRB",0,"C");
				$this->pdf->cell(20,7, '',"LTRB",0,"C");
				$this->pdf->cell(20,7, "","LTRB",0,"C");
				$this->pdf->cell(20,7, moneyFormatIndia($fine+$A3),"LTRB",1,"C");


        if($sum_data['fpaymentstatus'] != 'success'){
            $this->pdf->ln(10);
            $this->pdf->SetFont('Times','B',12);
            $this->pdf->cell(35,7, "Payment Not Made..!","",0,"L");
        }else{
			$this->pdf->ln(10);
			
			$this->pdf->SetFont('Times','B',12);
			$this->pdf->cell(35,7, "Payment Details :-    ","",1,"L");
			// $this->pdf->setX(18);
            $this->pdf->ln(5);
            $this->pdf->SetFont('Times','B',10);
            $this->pdf->cell(35,7, "Payment Status    ","1",0,"L");
            $this->pdf->SetFont('Times','',10);
            $this->pdf->cell(57,7, ': '.$sum_data['fpaymentstatus'],"1",0,"L"); 
            $this->pdf->SetFont('Times','B',10);
            $this->pdf->cell(35,7, "Transaction ID    ","1",0,"L");
            $this->pdf->SetFont('Times','',10);
            $this->pdf->cell(57,7, ': '.$sum_data['ftransactionid'],"1",1,"L"); 
            $this->pdf->SetFont('Times','B',10);
            $this->pdf->cell(35,7, "Order ID    ","1",0,"L");
            $this->pdf->SetFont('Times','',10);
            $this->pdf->cell(57,7, ': '.$sum_data['forderid'],"1",0,"L"); 
            $this->pdf->SetFont('Times','B',10);
            $this->pdf->cell(35,7, "Payment Date    ","1",0,"L");
            $this->pdf->SetFont('Times','',10);
            $this->pdf->cell(57,7, ': '.$sum_data['ftransactiondate'],"1",1,"L");

			$this->pdf->ln(30);
			$this->pdf->SetFont('Times','B',11);

			
			$this->pdf->cell(180,7,"Principal Sign","",1,"R");


        }		
	}
	
	}
			 
	function SendOutput()
	{
		$this->pdf->Output("AffliationFeesDetailed.pdf","I");
	}
	
}

function affliation_detailed_report($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);

	$class_obj=new report_ra_qp_wise_student_count();
	$class_obj->AliasNbPages();
	$class_obj->DefaultConstructor($aobj_context);

	$class_obj->GetFullQry();
	 $class_obj->formcolldata();
	$class_obj->formData();
	 
	$class_obj->SendOutput();
}

function moneyFormatIndia($num)
{
    $explrestunits = "";
    if (strlen($num) > 3) {
        $lastthree = substr($num, strlen($num) - 3, strlen($num));
        $restunits = substr($num, 0, strlen($num) - 3); // extracts the last three digits
        $restunits = (strlen($restunits) % 2 == 1) ? "0" . $restunits : $restunits; // explodes the remaining digits in 2's formats, adds a zero in the beginning to maintain the 2's grouping.
        $expunit = str_split($restunits, 2);
        for ($i = 0; $i < sizeof($expunit); $i++) {
            // creates each of the 2's group and adds a comma to the end
            if ($i == 0) {
                $explrestunits .= (int)$expunit[$i] . ","; // if is first value , convert into integer
            } else {
                $explrestunits .= $expunit[$i] . ",";
            }
        }
        $thecash = $explrestunits . $lastthree;
    } else {
        $thecash = $num;
    }
    return $thecash; // writes the final format where $currency is the currency symbol.
}

?>