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


Current Path : /var/www/html/univadmin/Reports/
Upload File :
Current File : /var/www/html/univadmin/Reports/remunerationReportPdf.php

<?php
    $main_src = substr($_SERVER['SCRIPT_FILENAME'], 0, strlen($_SERVER['SCRIPT_FILENAME']) - 7);
    $pdf_writer_class = $main_src . "/tcpdf/tcpdf.php";
    require_once $pdf_writer_class;
    ini_set('max_execution_time', '300');
    include('getnumword.php');
    include('ReportMisc.php');

    class MYPDF extends TCPDF{
        public function Header($resbill){
            $bMargin = $this->getBreakMargin();
            $auto_page_break = $this->AutoPageBreak;
            $this->SetAutoPageBreak(false, 0);
            $this->SetTitle("VALUATION BILL");

            $this->SetFillColor(248, 248, 255);
            $img_path = $this->aobj_context->main_src . "/img/".$this->aobj_context->FUNIVCODE."_logo.jpg";
        
            if (file_exists($img_path)) {
                $this->Image($img_path, 6, 6, 30, 25);
            }
            $this->SetFont('Times', 'B', 14);
            $this->SetY(5);
            $this->Cell(0, 7, $this->aobj_context->FUNIVNAME, 0, 1, 'C');
            //state
            $this->SetFont('Times', 'B', 11);
            $this->Cell(0, 4, $this->aobj_context->s_state, 0, 1, 'C');
            $this->SetFont('Times', 'B', 12);
            $this->Cell(0, 7, 'REMUNERATION BILL FOR EXAMINATIONS', '0', 1, 'C');
            $this->SetAutoPageBreak($auto_page_break, $bMargin);
            
    }

        public function Footer(){
            $this->SetY(-15);
            $this->SetFont('helvetica', 'I', 8);
            // var_dump();
            if($this->CurOrientation == 'P'){
                $this->Cell(60, 10, 'IP : ' . $_SERVER["REMOTE_ADDR"], 0, 0, 'L');
                $this->Cell(60, 10, 'Date : ' . date("d-m-Y h:i:s A"), 0, 1, 'C');
                // $this->Cell(60, 10, 'Page ' . $this->getPageNumGroupAlias() . '/' . $this->getPageGroupAlias(), 0, 1, 'R');
            } else {
                $this->Cell(90, 10, 'IP : ' . $_SERVER["REMOTE_ADDR"], 0, 0, 'L');
                $this->Cell(90, 10, 'Date : ' . date("d-m-Y h:i:s A"), 0, 1, 'C');
                // $this->Cell(90, 10, 'Page ' . $this->getPageNumGroupAlias() . '/' . $this->getPageGroupAlias(), 0, 1, 'R');
            }
        }
    }

    class ReprtObject{
        public function DefaultConstructor($aobj_context){
            $this->aobj_context = $aobj_context;
            $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);

            $this->ip = $_SERVER["REMOTE_ADDR"];
            $get_date = "select DATE_FORMAT(now(), '%d/%m/%Y') as now_date";
            $obj = $this->aobj_context->mobj_db->GetRow($get_date);
            $this->reportType = $aobj_context->mobj_data["rtype"];

            $get_coll_name = "select FUNIVNAME as FUNIVNAME,FUNIVCODE,
            FUNIVADD1 as state, pdf_logo_path,
            ifnull(FEXAMAPPREQ,'F') as FEXAMAPPREQ From control";
            $lobj_get_coll_name = $aobj_context->pobj_db->GetRow($get_coll_name);
    // var_dump($lobj_get_coll_name);
    // die();
            $aobj_context->FUNIVNAME = $lobj_get_coll_name['FUNIVNAME'];
            $aobj_context->s_state = $lobj_get_coll_name['state'];
            $aobj_context->pdf_logo_path = $lobj_get_coll_name['pdf_logo_path'];
            $aobj_context->FUNIVCODE = $lobj_get_coll_name['FUNIVCODE'];

            $this->current_date = $obj['now_date'];
            $deggrp = $this->aobj_context->mobj_data["deggrp"];

        $get_coll_name = "select concat(fdeggrp, ' - ', fdescpn) as fdeggrp 
            from deggrp where fdeggrp = '{$deggrp}'";
            $lobj_get_degree = $this->aobj_context->pobj_db->GetRow($get_coll_name);
            
            $aobj_context->deggrp = $lobj_get_degree['fdeggrp'];
            $this->pdf = new MYPDF('P');
            $this->pdf->aobj_context = $aobj_context;
        }

        public function Report($res, $univcode, $rtype, $examdate){
            $pdf = $this->pdf;
            $pdf->SetMargins(15, 25);
            $pdf->startPageGroup();
            $pdf->AddPage("P");
            
            $pdf->SetFont('Times','B',11);
            $pdf->Cell(0, 5, $examdate.' Examinations', '0', 1, 'C');

            $pdf->SetFont('Times','B',13);
            $pdf->Cell(0, 5, strtoupper('Details of examinar'), '0', 1, 'C');
            $pdf->ln(3);
            $pdf->SetFont('Times','',12);

            $table1 = '<style>
                        td {padding: 3px; border: 0.5px solid black;}
                       </style> 
                       <table cellpadding="3" cellspacing="0">
                        <tr nobr="true">
                            <td width="29%"><b>Examiner Name</b></td><td width="71%">'.$res['fteachname'].'</td>
                        </tr>
                        <tr>
                            <td width="29%"><b>School / Department</b></td><td width="71%"></td>
                        </tr>
                        <tr>
                            <td width="29%"><b>University / College Name</b></td><td width="71%">'.$res['fcollname'].'</td>
                        </tr>
                        <tr>
                            <td width="29%"><b>Address</b></td><td width="71%">'.$res['faddr1'].' '.$res['faddr2'].' '.$res['faddr3'].' '.$res['faddr4'].'</td>
                        </tr>
                        <tr>
                            <td width="29%"><b>Mobile Number</b></td><td width="71%">'.$res['fmobile'].'</td>
                        </tr>
                        <tr>
                            <td width="29%"><b>Email</b></td><td width="71%">'.$res['femail'].'</td>
                        </tr>
                       </table>';

            $pdf->SetX(11);
            $pdf->writeHTML($table1, false, true, false, false, 'L');
            $pdf->ln(10);

            $pdf->SetFont('Times', 'B', 13);
            $pdf->Cell(0, 5,strtoupper('Details of Remuneration Claimed'),0, 1, 'C');
            $pdf->ln(3);
            
            $pdf->SetFont('Times','',11);
            $table2 = '<style>
                        td {padding: 3px; border: 0.5px solid black; text-align: center;}
                        .lable {font-weight: bold;}
                       </style>
                       <table cellpadding="3">
                        <tr>
                            <td width="8%"><b>Sl. No.</b></td>
                            <td width="14%"><b>Program Name</b></td>
                            <td width="36%"><b>Particulars</b></td>
                            <td width="10%"><b>No. of Batches / Scripts</b></td>
                            <td width="10%"><b>Total (a)</b></td>
                            <td width="12%"><b>DA / TA / SA / Postal Charges (b)</b></td>
                            <td width="10%"><b>Total Amount (a + b)</b></td>
                        </tr>';
            $subjectDet = explode(",", $res['fsubname']);
            $marksDet = explode("|", $res['fmaxmarks']);

            $i=1;
            $grandTotal = 0;

            for($i=0; $i<count($subjectDet); $i++){

                $countMarks = explode("*", $marksDet[$i]);

                if($univcode === '030'){
                    $total = 1200 * intval($countMarks[1]);
                    $text = "1200 * ".$countMarks[1];
                }else if($univcode === '051' && $rtype === "Teacher") {
                    if($countMarks[0] >= 50){
                        $total = 900 * intval($countMarks[1]);
                        $text = "900 * ".$countMarks[1];
                    }else if($countMarks[0] >= 20 && $countMarks <=40){
                        $total = 250 * intval($countMarks[1]);
                        $text = "250 * ".$countMarks[1];
                    }else if($countMarks[0] < 20){
                        $total = 100 * intval($countMarks[1]);
                        $text = "100 * ".$countMarks[1];
                    }
                }
                $slno = $i+1;
                $table2.='<tr>
                            <td>'.$slno.'</td>
                            <td>'.$res['fdegree'].'</td>
                            <td style="text-align: initial;">'.$subjectDet[$i].'</td>
                            <td>'.$countMarks[1].'</td>';

                $table2.='<td>'.$text.'</td>';
                $table2.='<td></td>';
                $table2.='<td>'.$total.'</td>
                </tr>';
               
                $grandTotal += $total;
                
            }
            
            $table2 .= '<tr>
                             <td style="text-align: initial;" colspan="6"><b>Grand Total (in words): </b>'.getNumber($grandTotal).'</td>
                             <td>'.$grandTotal.'</td>
                        </tr>';
            $table2 .= '</table>';

            $pdf->SetX(11);
            $pdf->writeHTML($table2, false, true, false, false, 'L');
            $pdf->ln(10);

            $pdf->SetFont('Times', 'B', 13);
            $pdf->Cell(0, 5,strtoupper('Bank Account Details for Neft / Rtgs'),0, 1, 'C');
            $pdf->ln(3);
            $pdf->SetFont('Times','',11);

            $table3 = '<style>
                        td {padding: 3px; border: 0.5px solid black;}
                       </style> 
                       <table cellpadding="3" cellspacing="0">
                        <tr nobr="true">
                            <td width="14%"><b>Name</b></td>
                            <td width="40%" class="border">'.$res['fteachname'].'</td>
                            <td width="13%"><b>IFSC Code</b></td>
                            <td width="37%" class="border">'.$res['FIFSCCODE'].'</td>
                        </tr>
                        <tr nobr="true">
                            <td width="14%"><b>Bank</b></td>
                            <td width="40%" class="border">'.$res['FBANKNAME'].'</td>
                            <td width="13%"><b>Branch</b></td>
                            <td width="37%" class="border"></td>
                        </tr>
                        <tr nobr="true">
                            <td width="14%"><b>Account No.</b></td>
                            <td width="40%"class="border">'.$res['faccno'].'</td>
                            <td width="13%"><b>A / c Type</b></td>
                            <td width="37%" class="border"> </td>
                        </tr>
                        <tr nobr="true">
                            <td width="14%"><b>Pan No. <br/>(Compulsary)</b></td>
                            <td width="40%" class="border">'.$res['fpanno'].'</td>
                            <td width="13%"><b>Amount</b></td>
                            <td width="37%" class="border">'.$grandTotal.'</td>
                        </tr>
                        </table>';

            $pdf->SetX(11);
            $pdf->writeHTML($table3, false, true, false, false, 'L');
            $pdf->ln(10);

            $subject = "Certified that the amount claimed in this bill has not been drawn / claimed in any previous bills";
            $pdf->SetFont('Times', '', 11);
            $pdf->Cell(0, 5, $subject, 0, 1, 'L');

            $pdf->ln(25);
            $pdf->SetFont('Times', 'B', 12);
            $pdf->Cell(0, 5, 'Controller of Examination', 0, 0, 'L');
            $pdf->Cell(0, 5, 'Signature of Examiner', 0, 1, 'R');
        }       

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

    function remunerationReportPdf($aobj_context){
        $univcode = $aobj_context->mobj_data['univcode'];
        $degree = $aobj_context->mobj_data['degree'];
        $ftype = $aobj_context->mobj_data['ftype'];
        $exam = $aobj_context->mobj_data['exam'];
        $semester = $aobj_context->mobj_data['semester'];
        $teacher_data = $aobj_context->mobj_data['teacher'];
        $rtype = $aobj_context->mobj_data['rtype'];
        $fyear = $aobj_context->mobj_data['fyear'];
        $fmode = $aobj_context->mobj_data['fmode'];

        $cnd9 = "";    

        $exam_split = explode("*", $exam);
        $deggrp = $exam_split[0];
        $yearsplit = explode("-", $exam_split[1]);
        // $year = $yearsplit[0];
        // $examtype = $yearsplit[1];
        $year = $fyear;
        $examtype = $fmode;

        $teachArr = explode(",", $teacher_data);
        foreach($teachArr as $key => $val){
            $teach .= "'".$val."',";
        }
        $teachArray = substr_replace($teach ,"",-1);

        $degreeArr = explode(",", $degree);
        foreach($degreeArr as $key => $val){
            if($val != 'All'){
                $fdegree .= "'".$val."',";
            }
        }
        $degArray = substr_replace($fdegree ,"",-1);

        if($degree === "All"){
            $degreeCon = "and s.fdegree in (select fdegree from degree where fdeggrp ='{$deggrp}')";
        }else{
            // $degreeCon = "and s.fdegree = '{$degree}'";
            $degreeCon = "and s.fdegree in ({$degArray})";
        }

         if($semester === "All"){
            $semCon = "";
        }else{
            $semCon = "and s.fexamno='{$semester}'";
        }

        if($teachArray === "'All'"){
            $teachCon = "";
        }else{
            $teachCon = "and q.fteachcode in ({$teachArray})";
        }

        $query1 = "select fexamdate from qpset_deggrp where fdeggrp='{$deggrp}' and fexamtype='{$examtype}' and fyear='{$year}'";
        $res1 = $aobj_context->pobj_db->GetRow($query1);

        if($rtype == 'Teacher'){
            $query = "select fdegree, sum(f100) as f100,sum(f40) as f40,sum(f20) as f20, 
                        m.fteachcode, m.fteachname,concat(m.fteachcode,' - ',m.fteachname) as fteachnamecode,
                        group_concat(concat(q.fsubname,' - ',q.fsubshort) order by q.fsubshort SEPARATOR ', ')as fsubname,
                        sum(qpcnt) as totcnt,ifnull(m.fpanno,'') as fpanno,
                        m.fmobile, m.femail, ifnull(m.faadharno, '')as faadharno,
                        ifnull(m.faccno, '')as faccno, ifnull(m.FIFSCCODE, '')as FIFSCCODE,
                        ifnull(m.faddr1,'') as faddr1,
                        ifnull(m.faddr2,'') as faddr2,
                        ifnull(m.faddr3,'') as faddr3,
                        ifnull(m.faddr4,'') as faddr4,
                        fcollname,
                        group_concat(q.fmaxmarks, '*', qpcnt SEPARATOR '|')as fmaxmarks,
                        ifnull(m.FBANKNAME, '')as FBANKNAME
                        from(select d.fdegree, q.fteachcode,s.fsubname,s.fsubshort,q.fqpcode,fyear,fexamtype, 
                        s.fmaxmarks,
                        if(ifnull(q.fqpcode, '')<> '',1,0) as qpcnt,
                        if(s.fmaxmarks >= '50',if(left(fdeggrp,2) = 'UG',600,900),0)as f100,
                        if(s.fmaxmarks >=20 and s.fmaxmarks <=40,250,0) as f40,
                        if(s.fmaxmarks <20,100,0) as  f20
                        from qpseterdet$cnd9 q 
                        inner join subject s on q.fqpcode = s.fqpcode
                        inner join degree d on d.fdegree = s.fdegree 
                        and d.fexamno = s.fexamno
                        where fyear='{$year}' and fexamtype='{$examtype}'
                        {$degreeCon} {$semCon}
                        and ifnull(fqpfilepath,'') <> ''
                        group by q.fteachcode,q.fqpcode,q.fset) q
                        inner join masteach m on q.fteachcode = m.fteachcode 
                        where q.fyear='{$year}' and q.fexamtype='{$examtype}' 
                        group by q.fteachcode";

        }else{
             $query = "select s.fteachcode, m.fteachname, 
                        group_concat(concat(s.fsubname,' - ',s.fsubshort) SEPARATOR ', ')as fsubname,
                        sum(s.count)as totcnt,ifnull(m.fpanno,'') as fpanno, s.count,
                        concat(m.fteachcode,' - ',m.fteachname) as fteachnamecode,
                        m.fmobile, m.femail, ifnull(m.faadharno, '') as faadharno,
                        ifnull(m.faccno, '')as faccno, ifnull(m.FIFSCCODE, '') as FIFSCCODE,
                        ifnull(m.FBANKNAME, '')as FBANKNAME, sum(s.total) as total
                        from
                        (select mo.fteachcode,s.fsubname, s.fsubshort, mo.fqpcode, 
                        mo.fyear, mo.fexamtype, s.fexamno, s.fdegree,
                        if(mo.fqpcode <> '', 1, 0)as count,
                        if(mo.fqpcode <> '', 700,0)as total
                        from moderator mo inner join subject s on s.fqpcode = mo.fqpcode
                        inner join degree d on d.fdegree = s.fdegree and d.fexamno = s.fexamno
                        inner join qpseterdet$cnd9 q on mo.fqpcode = q.fqpcode 
                        and ifnull(q.fmodqpupd,'') <> ''
                        where  mo.fyear='{$year}' and mo.fexamtype='{$examtype}'
                        {$degreeCon} {$semCon}   
                        group by mo.fteachcode, mo.fqpcode) s
                        inner join masteach m on m.fteachcode = s.fteachcode 
                        where s.fyear='{$year}' and s.fexamtype='{$examtype}'            
                        {$teachCon}
                        group by s.fteachcode";
        }

        // var_dump($query);die();

        $res = $aobj_context->pobj_db->GetAll($query);
        $class_obj = new ReprtObject();
        $class_obj->univcode = $univcode;
        $class_obj->DefaultConstructor($aobj_context);
        foreach($res as $val){
            $class_obj->Report($val, $univcode, $rtype, $res1['fexamdate']);
        }
        $class_obj->SendOutput();
    }