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


Current Path : /var/www/html/rcub/Report_details/
Upload File :
Current File : /var/www/html/rcub/Report_details/report_practical_marks_details.php

<?php

$main_src = substr($_SERVER['SCRIPT_FILENAME'], 0, strlen($_SERVER['SCRIPT_FILENAME']) - 7);
$pdf_writer_class = $main_src . "/tarka_pdf_latest/fpdf.php";
require_once($pdf_writer_class);
class practical_marks_detail_report extends FPDF
{
    public $aobj_context;
    public $college_name;
    public $town;
    public $address;
    public $degree_name;

    function Default_construstor($aobj_context)
    {
        require_once($aobj_context->main_src . 'src/format.php');
        $this->aobj_context = $aobj_context;
        $this->collcode = $_SESSION['collcode'];
        include($this->pdf_writer_class);
        session_start();
        $this->report_id = $aobj_context->mobj_data["report_id"];
        $this->ip = $_SERVER["REMOTE_ADDR"];
        $this->degree = $aobj_context->mobj_data['degree'];
        $this->degree_name = $aobj_context->mobj_data['degree_name'];
        $this->exam = $aobj_context->mobj_data['exam'];
        $this->subject   = $aobj_context->mobj_data["sub"];
        $this->sub_name   = $aobj_context->mobj_data["sub_name"];
        $this->from_qp_code =  $aobj_context->mobj_data["from_qp_code"];
        $this->to_qp_code =  $aobj_context->mobj_data["to_qp_code"];
        $this->batch_no =  $aobj_context->mobj_data["batch_no"];
        $this->date_value =  $aobj_context->mobj_data["date_value"];
        $this->time_value =  $aobj_context->mobj_data["time"];
        $this->batch_no = str_pad($this->batch_no, 2, "0", STR_PAD_LEFT);
        $this->fs_sub_name =  $aobj_context->mobj_data["fs_sub_name"];
        $this->freeze_status = " (Verification Pending)";
        $this->pdf =  new FPDF();
        $this->pdf = $this;
        $this->GetSubjectLoops();
        $getnumword = $aobj_context->main_src . "/src/getnumword.php";
        include($getnumword);
        $get_date_time = "SELECT DATE_FORMAT(now(),'%d-%b-%Y %H:%m %r') as dt";
        $ob_dt = $this->aobj_context->mobj_db->GetRow($get_date_time);
        $this->date_time = $ob_dt[dt];
    }

    function Header()
    {
        session_start();
        $FUNIVCODE = $_SESSION['FUNIVCODE'];
        $page_header_college = "select FUNIVADD1 as address,FUNIVNAME as college_name ,
								pdf_logo_path as pdf_logo_path from control ";

        $lobj_page_header_college = $this->aobj_context->mobj_db->GetRow($page_header_college);
        $this->coll_name = $lobj_page_header_college['college_name'];
        $this->address = $lobj_page_header_college['address'];
        $this->pdf_logo_path = $this->aobj_context->main_src . "/" . $lobj_page_header_college['pdf_logo_path'];
        $get_college_name = "select  concat(FCOLLNAME,', ',FTOWN) as col_name from college where FCOLLCODE='{$this->collcode}'";
        $this->lobj_get_college_name = $this->aobj_context->mobj_db->GetRow($get_college_name);
        $this->col_name = $this->lobj_get_college_name['col_name'];

        $get_exam_date = "select FDESCPN,FEXAMDATE as exam_date,FEXAMNAME from degree 
						where FDEGREE='{$this->degree}'
						and FEXAMNO='{$this->exam}'";
        $this->lobj_get_exam_date = $this->aobj_context->mobj_db->GetRow($get_exam_date);
        $this->exam_date = $this->lobj_get_exam_date['exam_date'];
        $this->FEXAMNAME = $this->lobj_get_exam_date['FEXAMNAME'];
        $this->degr_name = $this->lobj_get_exam_date['FDESCPN'];

        $this->pdf->SetFont('Times', 'B', 14);
        $this->pdf->Cell(190, 6, $this->coll_name, 0, 1, 'C');
        $this->pdf->SetFont('Times', '', 8);
        $this->pdf->Cell(190, 6, $this->address, 0, 1, 'C');
        $this->pdf->SetFont('Times', 'B', 11);
        $this->pdf->Cell(190, 6, $this->collcode . " - " . $this->col_name, 0, 1, 'C');
        $this->pdf->SetFont('Times', 'BU', 12);
        $this->pdf->Cell(190, 6, 'PRACTICAL MARKS LIST' . $this->freeze_status, 0, 1, 'C');
        $this->pdf->SetFont('Times', 'B', 11);
        $this->pdf->Cell(190, 6, "[" . $this->degree . "] " . $this->degr_name . " {$this->FEXAMNAME} - " . $this->exam_date, 0, 1, 'C');
        $this->pdf->Cell(190, 6, "Subject : " . " " . $this->subject . " - " . $this->sub_name . " (" . $this->fs_sub_name . ")", 0, 1, 'C');
        $this->pdf->Ln(2);
        $new_y = $this->pdf->GetY();
        $this->pdf->Line(5, $new_y, 203, $new_y);
        $this->pdf->Ln(2);
        $this->pdf->SetFont('Times', 'B', 12);
        $this->pdf->Cell(190, 6, 'Batch : ' . $this->batch_no . '                Date : ' . $this->date_value . '               Time :  ' . $this->time_value, 0, 1, 'C');
        if (file_exists($this->pdf_logo_path)) {
            $this->pdf->Image($this->pdf_logo_path, 7, 7, 20);
        }
        $this->pdf->Ln(2);
        $this->pdf->SetFont('Times', '', 11);
    }

    function GetSubjectLoops()
    {
        $get_loops = " select FCSUBCODE,concat(FSUBNAME) as sub_name from subject
		where  FDEGREE='{$this->degree}'
		and FEXAMNO='{$this->exam}'
		and FCSUBCODE>='{$this->from_qp_code}' and FCSUBCODE<='{$this->to_qp_code}'";
        $this->lobj_get_loops = $this->aobj_context->mobj_db->GetAll($get_loops);
    }
    function GetQuery()
    {
        session_start();
        $FUNIVCODE = $_SESSION['FUNIVCODE'];

        foreach ($this->lobj_get_loops as $sk => $sv) {
            $pdf->page_present_count = 0;
            $pdf->total_absent_count = 0;
            $pdf->total_absent_count = 0;
            $FCSUBCODE = $sv[FCSUBCODE];

            $get_frezed_data = " select count(*) as f_cnt from practical_entry_freeze
							where FCOLLCODE='{$this->collcode}'
							and FDEGREE='{$this->degree}' and 
							FEXAM='{$this->exam}' and 
							FCSUBCODE='{$FCSUBCODE}'  and 
							lpad(FBATCH,2,'0')='{$this->batch_no}' and FFREEZED='T' ";

            $obj_get_frezed_data = $this->aobj_context->mobj_db->GetRow($get_frezed_data);

            $this->freeze_status = " (Verification Pending)";
            if ($obj_get_frezed_data[f_cnt] > 0) {
                $this->freeze_status = " (Verified)";
            }

            $get_p_frezed_data = " select count(*) as fp_cnt from practical_entry_freeze
							where FCOLLCODE='{$this->collcode}'
							and FDEGREE='{$this->degree}' and 
							FEXAM='{$this->exam}' and 
							FCSUBCODE='{$FCSUBCODE}'  and 
							lpad(FBATCH,2,'0')='{$this->batch_no}' and ifnull(PRINTFREEZED,'F')='T' ";
            $obj_get_frezed_data = $this->aobj_context->mobj_db->GetRow($get_p_frezed_data);
            $fp_cnt = $obj_get_frezed_data['fp_cnt'];

            $sub_name = $sv[sub_name];
            $this->lobj_get_practical_records = array();
            $this->lobj_get_viva_records = array();
            $this->viva_marks_arr = array();
            $this->ii_details_arr = array();

            $get_practical_records = "select sub.FCSUBCODE,sub.FSUBNAME,stu.FREGNO, stu.FNAME, 
			if(mak.FMARKS11>0,right(concat('000',mak.FMARKS11),3),if(mak.FMARKS11=-2,'ABSENT',
			if(mak.FMARKS11=0,0,''))) as FMARKS, 
			IFNULL(mak.FBATCH, '') AS FBATCH,FSUBNAME,FSSUBNAME
			FROM student stu inner join marks_pr mak ON stu.FREGNO=mak.FREGNO 
			and mak.Fdegree='{$this->degree}' and mak.Fexamno='{$this->exam}' and mak.FCOLLCODE='{$this->collcode}'
			inner join subject sub on sub.FCSUBCODE = mak.FSUBCODE 
			and sub.FCSUBCODE='{$FCSUBCODE}' and lpad(mak.FBATCH,2,'0')='{$this->batch_no}'
			and sub.FDEGREE='{$this->degree}' and sub.FEXAMNO='{$this->exam}'					 
			WHERE stu.FREGNO != ''    and mak.FMARKS11<>-1    #and mak.FMARKS11<>''
			group by stu.FREGNO,sub.FCSUBCODE  order by IFNULL(mak.FBATCH, ''),stu.FREGNO";

            $this->lobj_get_practical_records = $this->aobj_context->mobj_db->GetAll($get_practical_records);
            $this->sub_code = $this->lobj_get_practical_records[0][FCSUBCODE];
            $this->sub_name = $this->lobj_get_practical_records[0][FSUBNAME];
            $this->fs_sub_name = $this->lobj_get_practical_records[0][FSSUBNAME];

            $count_practical_records = "select FCSUBCODE,count(distinct(stu.FREGNO)) as cnt
			FROM student stu inner join marks_pr mak ON stu.FREGNO=mak.FREGNO 
			and mak.Fdegree='{$this->degree}' and mak.Fexamno='{$this->exam}' and mak.FCOLLCODE='{$this->collcode}'
			inner join subject sub on sub.FCSUBCODE = mak.FSUBCODE 
			and sub.FCSUBCODE='{$FCSUBCODE}'  and lpad(mak.FBATCH,2,'0')='{$this->batch_no}'
			and sub.FDEGREE='{$this->degree}' and sub.FEXAMNO='{$this->exam}'					 
			WHERE stu.FREGNO != ''    and mak.FMARKS11=-2   and mak.FMARKS11<>''
			group by sub.FCSUBCODE  order by IFNULL(mak.FBATCH, ''),stu.FREGNO";

            $this->lobj_count_practical_records = $this->aobj_context->mobj_db->GetAll($count_practical_records);
            foreach ($this->lobj_count_practical_records as $k => $v) {
                $this->ii_details_arr[$v[FCSUBCODE]] = $v[cnt];
            }

            $get_viva_details = " select FVVCODE from  practical_master where 
								FDEGREE = '{$this->degree}'
								and FEXAMNO = '{$this->exam}' and FPRCODE = '{$FCSUBCODE}'";

            $lobj_get_viva_details = $this->aobj_context->mobj_db->GetRow($get_viva_details);
            $FVVCODE = $lobj_get_viva_details[FVVCODE];

            if (!empty($FVVCODE)) {
                $get_viva_records = "select sub.FCSUBCODE,sub.FSUBNAME,stu.FREGNO, stu.FNAME, 
				if(mak.FMARKS11>=0,right(concat('000',mak.FMARKS11),3),if(mak.FMARKS11=-2,'ABSENT','')) as FMARKS, 
				IFNULL(mak.FBATCH, '') AS FBATCH
				FROM student stu inner join marks_pr mak ON stu.FREGNO=mak.FREGNO 
				and mak.Fdegree='{$this->degree}' and mak.Fexamno='{$this->exam}' and mak.FCOLLCODE='{$this->collcode}'
				inner join subject sub on sub.FCSUBCODE = mak.FSUBCODE 
				and sub.FCSUBCODE='{$FVVCODE}' and lpad(mak.FBATCH,2,'0')='{$this->batch_no}'
				and sub.FDEGREE='{$this->degree}' and sub.FEXAMNO='{$this->exam}'					 
				WHERE stu.FREGNO != '' 
				group by stu.FREGNO,sub.FCSUBCODE  order by IFNULL(mak.FBATCH, ''),stu.FREGNO";
                $this->lobj_get_viva_records = $this->aobj_context->mobj_db->GetAll($get_viva_records);

                foreach ($this->lobj_get_viva_records as $vk => $vv) {
                    $this->viva_marks_arr[$vv[FREGNO]] = $vv[FMARKS];
                }
            }

            $this->header_subject = $FCSUBCODE;
            $this->header_sub_name = $sub_name;
            $this->pdf->SetMargins(12, 12);
            $this->pdf->AddPage();
            // $this->pdf->Rect(4,03,200,280);
            $this->pdf->SetMargins(12, 12);
            $this->_intital_x_pos = $this->pdf->GetX();
            $this->pdf->SetX($this->_intital_x_pos + 22);
            $this->pdf->Cell(15, 6, '', "LRT", 0, 'C');
            $this->pdf->Cell(30, 6, '', "LRT", 0, 'C');

            $this->pdf->SetFont('Times', 'B', '12');

            $this->pdf->Cell(50, 6, 'Practical', "LRT", 1, 'C');
            $this->get_x_pos = $this->pdf->GetX();
            $this->get_y_pos = $this->pdf->GetY();


            $this->pdf->SetX($this->_intital_x_pos + 22);
            $this->pdf->Cell(15, 6, 'Sl. No.', "LRB", 0, 'C');
            $this->pdf->Cell(30, 6, 'Reg. No.', "LRB", 0, 'C');
            $this->pdf->Cell(15, 6, 'Marks', "1", 0, 'C');
            $this->pdf->Cell(35, 6, 'Remarks', "1", 1, 'C');

            if (!empty($this->viva_marks_arr)) {

                $this->pdf->SetXY($this->get_x_pos + 119, $this->get_y_pos - 6);

                if ($FUNIVCODE == '029') {
                    $this->pdf->Cell(50, 6, 'Viva', "LRT", 1, 'C');
                } elseif ($FUNIVCODE == '027') {
                    $this->pdf->Cell(50, 6, 'Viva', "LRT", 1, 'C');
                } else {
                    $this->pdf->Cell(50, 6, 'Record', "LRT", 1, 'C');
                }

                $this->pdf->SetXY($this->get_x_pos + 119, $this->get_y_pos);
                $this->pdf->Cell(15, 6, 'Marks', "1", 0, 'C');
                $this->pdf->Cell(35, 6, 'Remarks', "1", 1, 'C');
            }
            $sl = 1;
            $lin1 = 1;
            $this->pdf->SetFont('Times', '', '11');
            if ($fp_cnt > 0) {
                $this->lobj_get_practical_records = null;
                $this->pdf->Ln(10);
                $this->pdf->SetFont('Times', 'B', 12);
                $this->pdf->Cell(0, 6, 'Report is print freezed', "", 1, 'C');
            }

            foreach ($this->lobj_get_practical_records as $pk => $pv) {
                $this->FCSUBCODE = $pv[FCSUBCODE];

                $FREGNO = $pv[FREGNO];
                $FNAME = $pv[FNAME];
                $pr_marks = $pv[FMARKS];

                if ($lin1 == 35) {
                    $this->pdf->AddPage();
                    $lin1 = 1;
                }
                $this->pdf->SetFont('Times', '', 12);
                $this->pdf->SetX($this->_intital_x_pos + 22);
                $this->pdf->Cell(15, 6, $sl, "1", 0, 'C');
                $this->pdf->Cell(30, 6, $FREGNO, "1", 0, 'C');

                if ($pr_marks == 'ABSENT') {
                    $this->page_absent_count++;
                    $this->pdf->Cell(15, 6, 'AB', '1 ', 0, 'C');
                    $this->pdf->Cell(35, 6, $pr_marks, '1', 1, 'L');
                } else {
                    $this->pdf->Cell(15, 6, $pr_marks, "1", 0, 'C');
                    $cell_val = GetNumToSeperateWord(floatval($pr_marks));
                    $cell_val = empty($cell_val) ? 0 : $cell_val;
                    $this->pdf->Cell(35, 6, $cell_val, "1", 1, 'L');
                    $this->page_present_count++;
                }

                $get_x_pos1 = $this->pdf->GetX();
                $get_y_pos1 = $this->pdf->GetY();

                if (!empty($this->viva_marks_arr)) {
                    $viva_marks = $this->viva_marks_arr[$FREGNO];
                    $this->pdf->SetXY($get_x_pos1 + 119, $get_y_pos1 - 6);
                    if ($viva_marks == 'ABSENT') {
                        $this->pdf->Cell(15, 6, 'AB', '1', 0, 'C');
                        $this->pdf->Cell(35, 6, $viva_marks, '1', 1, 'L');
                    } else {
                        $this->pdf->Cell(15, 6, $viva_marks, "1", 0, 'C');
                        $this->pdf->Cell(35, 6, GetNumToSeperateWord(floatval($viva_marks)), "1", 1, 'L');
                    }
                }
                $sl++;
                $lin1++;
            }
        }

        $this->pdf->Ln(10);
        $this->pdf->SetFont('Times', '', 10);
        $this->pdf->Cell(35, 6, '', "", 0, 'C');
        $this->pdf->Cell(60, 6, 'Examiner - 01', "", 0, 'C');
        $this->pdf->Cell(60, 6, 'Examiner - 02', "", 1, 'C');

        $this->pdf->Cell(25, 6, 'Name', "", 0, 'L');
        $this->pdf->Cell(3, 6, ':', "", 1, 'C');

        $this->pdf->Cell(25, 6, 'College / Dept', "", 0, 'L');
        $this->pdf->Cell(3, 6, ':', "", 1, 'C');

        $this->pdf->Cell(25, 6, 'Signature', "", 0, 'L');
        $this->pdf->Cell(3, 6, ':', "", 1, 'C');

        $this->pdf->Cell(25, 6, 'Date & Time', "", 0, 'L');
        $this->pdf->Cell(3, 6, ':', "", 0, 'C');
        $this->pdf->Cell(50, 3, $pdf->date_time, '0', 1, 'L');
    }
    function Footer()
    {
        $this->SetY(-20);
        $this->SetFont('Times', '', 9);
        $new_y = $this->pdf->GetY();
        $this->pdf->Line(5, $new_y, 203, $new_y);
        $this->Cell(140, 6, 'Printed - IP Address : ' . $this->ip . ", Date " . date('d/m/Y h:i:s A'), '0', 0, 'L');
        $this->Cell(50, 6, 'Page ' . $this->PageNo() . ' of {nb}', 0, 1, 'R');
    }

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

function GeneratePracticalMarksReports($aobj_context)
{
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
    $class_obj = new practical_marks_detail_report();
    $class_obj->AliasNbPages();
    $class_obj->Default_construstor($aobj_context);
    $class_obj->GetQuery();
    $class_obj->SendOutput();
}