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.224.38.170
<?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);
class Reconciliation extends FPDF
{
function DefaultConstructor($aobj_context)
{
$this->aobj_context=$aobj_context;
$this->pdf= new FPDF();
$this->pdf=$this;
session_start();
$this->ip=$_SERVER["REMOTE_ADDR"];
$this->collcode=$_SESSION['collcode'];
$this->degree_from = ($this->aobj_context->mobj_data["degree_from"]);
$this->degree_to = ($this->aobj_context->mobj_data["degree_to"]);
$this->app_from = ($this->aobj_context->mobj_data["app_from"]);
$this->app_to = ($this->aobj_context->mobj_data["app_to"]);
$get_date="select date_add(date_add(now(),INTERVAL 13 hour),interval 30 minute) as now_date";
$obj=$this->aobj_context->mobj_db->GetRow($get_date);
$this->current_date=$obj[now_date];
}
function Header()
{
}
function Footer()
{
$this->SetY(-15);
$this->pdf->SetFont('Times','B',8);
$this->pdf->Cell(140,6,'Printed : IP Address : '.$this->ip." Date ".$this->current_date,'0',0,'L');
$this->pdf->Cell(0,4,'Page No. : '.$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_coll_name="SELECT FCOLLCODE,FCOLLNAME
FROM college where FCOLLCODE='{$this->collcode}'";
$lobj_get_coll_name=$this->aobj_context->mobj_db->GetRow($get_coll_name);
$this->FCOLLCODE=$lobj_get_coll_name['FCOLLCODE'];
$this->FCOLLNAME=$lobj_get_coll_name['FCOLLNAME'];
}
function formData()
{
$this->pdf->SetMargins(15,12,10);
$this->pdf->AddPage();
$img_path=$this->aobj_context->main_src.$this->pdf_logo_path;
if(!empty($this->pdf_logo_path) && file_exists($img_path))
{
$this->pdf->Image($img_path,15,10,20);
}
$this->pdf->SetFont('Times','B',15);
$this->pdf->cell(0,3,"".$this->FUNIVNAME,"0",1,"C");
$this->pdf->SetFont('Times','B',8);
$this->pdf->cell(0,7, $this->s_state,"0",1,"C");
$this->pdf->SetFont('Times','B',10);
$this->pdf->SetFont('Times','B',11);
$this->pdf->cell(0,5, $this->FCOLLCODE." - ".$this->FCOLLNAME,"0",1,"C");
$this->pdf->SetFont('Times','B',11);
$this->pdf->Cell(0,5,"Reconciliation Report","0",1,"C");
$this->pdf->SetFont('Times','B',10);
$this->pdf->Cell(0,5,"Degree Range : ".$this->degree_from." - ".$this->degree_to,"0",1,"C");
$this->pdf->Cell(0,5,"Application Range : ".$this->app_from." - ".$this->app_to,"0",1,"C");
// $this->pdf->SetFont('Times','B',15);
}
function GetFullQry()
{
$get_data = "select cs.appno, cs.fdegree, cs.fregno, st.fname,
cs.ftotalfee, cs.fpaymentstatus from appcandsum cs
inner join student st on cs.fdegree = st.fdegree and cs.fcollcode = st.fcollcode
and cs.fregno = st.fregno
where cs.fpaymentype = 'College Bank'
and cs.fpaymentstatus = 'success'
and cs.fcollcode = '{$this->collcode}'
and cs.appno between '{$this->app_from}' and '{$this->app_to}'
and cs.fdegree between '{$this->degree_from}' and '{$this->degree_to}'
order by cs.fdegree, cs.fregno";
// var_dump($get_data);
$this->lobj_get_get_data= $this->aobj_context->mobj_db->GetAll($get_data);
$get_data = "select fid, fcollcode, famount, fremarks, fpaymenttranid,ifnull(fpaymentstatus,'Failure') as fpaymentstatus
from collfundtransfer
where fcollcode = '$this->collcode'";
// var_dump($get_data);
$this->lobj_coll_pay_data = $this->aobj_context->mobj_db->GetAll($get_data);
// var_dump($this->lobj_coll_pay_data);
}
function GetQry()
{
$i=0;
$this->SetFillColor(219,217,217);
if($this->pdf->GetY() >270)
$this->pdf->AddPage();
//$this->SetDrawColor(255,2,195);
$this->pdf->SetFont('Times','B',9);
if(count($this->lobj_get_get_data)>0)
{
$this->pdf->cell(15,7, "Sl. No.","1",0,"C",true);
$this->pdf->cell(20,7, "App. No","1",0,"C",true);
$this->pdf->cell(15,7, "Degree","1",0,"C",true);
$this->pdf->cell(18,7, "Reg. No","1",0,"C",true);
$this->pdf->cell(75,7, "Student Name","1",0,"C",true);
$this->pdf->cell(15,7, "Amount","1",0,"C",true);
$this->pdf->cell(20,7, "Status","1",1,"C",true);
}
$height=5;
$sl_no=1;
if($this->pdf->GetY() >270)
$this->pdf->SetFont('Times','',9);
$totfee = 0;
foreach($this->lobj_get_get_data as $ak=>$av)
{
$sub_code=$ak;
$this->pdf->cell(15,$height, $sl_no,"1",0,"C");
$this->pdf->cell(20,$height, $av['appno'],"1",0,"C");
$this->pdf->cell(15,$height, $av['fdegree'],"1",0,"L");
$this->pdf->cell(18,$height, $av['fregno'],"1",0,"C");
$this->pdf->cell(75,$height, $av['fname'],"1",0,"Ls");
$this->pdf->cell(15,$height, $av['ftotalfee'],"1",0,"R");
$totfee += $av['ftotalfee'];
$this->pdf->cell(20,$height, $av['fpaymentstatus'],"1",1,"C");
$sl_no++;
if($this->pdf->GetY() >270)
{
// $this->pdf->AddPage();
$this->formData();
// $this->formData();
$this->pdf->SetFont('Times','B',9);
$this->pdf->cell(15,7, "Sl. No.","1",0,"C",true);
$this->pdf->cell(20,7, "App. No","1",0,"C",true);
$this->pdf->cell(15,7, "Degree","1",0,"C",true);
$this->pdf->cell(18,7, "Reg. No","1",0,"C",true);
$this->pdf->cell(75,7, "Student Name","1",0,"C",true);
$this->pdf->cell(15,7, "Amount","1",0,"C",true);
$this->pdf->cell(20,7, "Status","1",1,"C",true);
}
}
$totfee = moneyFormatIndia($totfee);
$this->pdf->Ln(4);
if(count($this->lobj_get_get_data)>0)
$this->pdf->Cell(0,5,"Amount to be paid to the University : ".$totfee,'0',0,'L');
$this->pdf->Ln(10);
// $this->pdf->Ln(15);
if(count($this->lobj_coll_pay_data) > 0)
{
$this->pdf->SetFont('Times','B',12);
$this->pdf->cell(0,7, "College Fund Transfer Details","0",1,"C");
$this->pdf->SetFont('Times','B',9);
$this->pdf->Ln(4);
$this->pdf->cell(10,7, "Sl. No.","1",0,"C",true);
$this->pdf->cell(18,7, "Payment ID","1",0,"C",true);
$this->pdf->cell(15,7, "Amount","1",0,"C",true);
$this->pdf->cell(55,7, "Transaction ID","1",0,"C",true);
$this->pdf->cell(20,7, "Payment Status","1",0,"C",true);
$this->pdf->cell(60,7, "Remarks","1",1,"C",true);
$i = 1;
$tran_tot = 0;
foreach($this->lobj_coll_pay_data as $ak=>$av)
{
// var_dump($av);
$x1 = 10 + 18 + 15 + 55+20;
$y = $this->pdf->GetY();
$x = $this->pdf->GetX();
$this->pdf->SetX($x+$x1);
$this->pdf->MultiCell(60,7, $av['fremarks'],"1","J");
$y1 = $this->pdf->GetY();
$this->pdf->SetX($x);
$this->pdf->SetY($y);
$h = $y1 - $y;
$this->pdf->cell(10,$h, $i,"1",0,"C");
$this->pdf->cell(18,$h, $av['fid'],"1",0,"C");
$this->pdf->cell(15,$h, moneyFormatIndia($av['famount']),"1",0,"R");
$this->pdf->cell(55,$h, $av['fpaymenttranid'],"1",0,"C");
$this->pdf->cell(20,$h, $av['fpaymentstatus'],"1",0,"C");
$this->pdf->SetY($y1);
if($av['fpaymentstatus'] == 'success')
$tran_tot += $av['famount'];
$i++;
}
$this->pdf->Ln(6);
if(count($this->lobj_coll_pay_data) > 0)
{
$this->pdf->SetFont('Times','B',12);
$this->pdf->cell(0,7, "Transaction Summary","0",1,"C");
$this->pdf->Ln(3);
$this->pdf->SetFont('Times','B',10);
$this->pdf->cell(138,5, "Payment Status ","1",0,"C",true);
$this->pdf->cell(40,5, "Amount ","1",1,"C",true);
}
$tran_tot = moneyFormatIndia($tran_tot);
//var_dump($totfee.'----'.$tran_tot);
$this->pdf->cell(138,5, "Amount to be paid to the University ","1",0,"L");
$this->pdf->cell(40,5, $totfee ,"1",1,"R");
// $totfee
$this->pdf->cell(138,5, "Amount paid at the University ","1",0,"L");
$this->pdf->cell(40,5, $tran_tot ,"1",1,"R");
}
}
function SendOutput()
{
$this->pdf->Output("application_letter_{$this->app_no}.pdf","D");
}
}
function genarateReconciliation($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
// var_dump($aobj_context->mobj_db);
$class_obj=new Reconciliation();
$class_obj->AliasNbPages();
$class_obj->DefaultConstructor($aobj_context);
$class_obj->formcolldata();
$class_obj->GetFullQry();
/*$class_obj->Footer();*/
$class_obj->formData();
$class_obj->GetQry();
$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.
}
?>
|