Skip to content

Instantly share code, notes, and snippets.

@nixon1333
Created January 4, 2016 07:50
Show Gist options
  • Save nixon1333/9c29827cee2eedc27bde to your computer and use it in GitHub Desktop.
Save nixon1333/9c29827cee2eedc27bde to your computer and use it in GitHub Desktop.
print page demo
<style>
body {
}
table
{
width: 100%;
}
table,th,td
{
border-collapse: collapse;
text-align: center;
}
th{
text-align: center;
}
td,th {
padding: 3px;
font-size: 14px;
}
p {
font-size: 14px;
}
.wow {
font-size: 16px;
text-align: center;
font-weight: 700;
}
.padd-top{
margin-top: 12px;
}
td,th {
border: solid 2px lightgrey;
}
table {
border-collapse: collapse;
}
#ls1{
border: 2px solid lightgrey;
}
/* @page {
width: 10em;
height: 2cm;
}*/
body {
margin: 0;
padding: 0;
width: 10cm;
height: 10cm;
}
#print-area {
position: relative;
top: 1cm;
left: 1cm;
width: 35cm;
height: 10cm;
font-size: 10px;
font-family: Arial;
page-break-after: always;
}
</style>
<div class="tab-content" id="print-area">
<div class="tab-pane box active">
<div id="ls1">
<div style="margin: 0px;padding: 0px;clear: both;margin-top: 5px;">
<div style="height:170px;float: left;margin-left: 5px;width: 15%;">
<img style="text-align: center; max-height:170px; max-width: 100%;"
src="<?php echo base_url();?>assets/images/adarsha-logo.png"
alt="PHOTO">
</div>
<div style="float: left;width: 67%;text-align: center;margin-left: 5px;">
<div style="text-align: center;">
<span style="font-size: 20px;width:100%;"><strong>Adarsha School Narayanganj</strong></span>
<br/>
<h3><?php echo $system_name; ?></h3>
</div>
<div>
<span><strong style="text-decoration: underline;"><?php echo get_phrase('yearly_result') . ' - ' . date('Y'); ?></strong></span>
</div>
</div>
<div style="float: right;width: 16%;border: 1px solid #000000;text-align: center;margin-right: 6px;">
<table style="width: 100%; border-collapse:collapse;font-size: 11px;" cellspacing="0" cellpadding="0">
<tr>
<td style="font-size: 11px;border: 1px solid black;">Marks Range</td>
<td style="font-size: 11px;border: 1px solid black;">LG</td>
<td style="font-size: 11px;border: 1px solid black;">GP</td>
</tr>
<tr>
<td style="font-size: 11px;border: 1px solid black;" >80-100</td>
<td style="font-size: 11px;border: 1px solid black;">A+</td>
<td style="font-size: 11px;border: 1px solid black;">5.00</td>
</tr>
<tr>
<td style="font-size: 11px;border: 1px solid black;">70-79</td>
<td style="font-size: 11px;border: 1px solid black;">A</td>
<td style="font-size: 11px;border: 1px solid black;">4.00</td>
</tr>
<tr>
<td style="font-size: 11px;border: 1px solid black;">60-69</td>
<td style="font-size: 11px;border: 1px solid black;">A-</td>
<td style="font-size: 11px;border: 1px solid black;">3.50</td>
</tr>
<tr>
<td style="font-size: 11px;border: 1px solid black;">50-59</td>
<td style="font-size: 11px;border: 1px solid black;">B</td>
<td style="font-size: 11px;border: 1px solid black;">3.00</td>
</tr>
<tr>
<td style="font-size: 11px;border: 1px solid black;">45-49</td>
<td style="font-size: 11px;border: 1px solid black;">C</td>
<td style="font-size: 11px;border: 1px solid black;">2.00</td>
</tr>
<tr>
<td style="font-size: 11px;border: 1px solid black;">40-44</td>
<td style="font-size: 11px;border: 1px solid black;">D</td>
<td style="font-size: 11px;border: 1px solid black;">1.00</td>
</tr>
<tr>
<td style="font-size: 11px;border: 1px solid black;">0-39</td>
<td style="font-size: 11px;border: 1px solid black;">F</td>
<td style="font-size: 11px;border: 1px solid black;">0.00</td>
</tr>
</table>
</div>
</div>
<table border="1">
<tr>
<th colspan="3" style="text-align:center; padding: 15px;">
Students Name: <?php echo ucfirst($student_info[0]['name']); ?>
</th>
<th colspan="2" style="text-align:center">
Adarsha(Class): <?php echo $this->crud_model->get_class_name_from_number($student_info[0]['cl_id']); ?>
</th>
<th style="text-align:center">
Section: <?php echo $section_name;?>
</th>
<th style="text-align:center">
Division: <?php if($division!=""){echo $division; }else{echo "N/A";} ?>
</th>
<th colspan="3" style="text-align:center">
Roll No: <?php echo $student_info[0]['roll']; ?>
</th>
</tr>
<tr>
<th rowspan="2">
Subject
</th>
<th rowspan="2" colspan="2">
Total
</th>
<th colspan="2">
Half Yearly
</th>
<th colspan="2">
Yearly
</th>
<th colspan="3">
Final Assessment
</th>
</tr>
<tr>
<td>OBT</td>
<td>Highest</td>
<td>OBT</td>
<td>Highest</td>
<td>Total OBT</td>
<td>Final GPA</td>
<td>GPA GRADE</td>
</tr>
<?php
$i = 0;
$sub1 = 0;
$sub2 = 0;
$p1 = 0;
$p1 = 0;
$finalk1 = 0;
$finalk2 = 0;
$lGpsas = 0;
$suCount = 0;
foreach ($subjects as $sub):
if(($student_info[0]['sex'] == 'male') && $sub['subject_name'] == 'Home Science'){
$i++;
continue;
}
if(($student_info[0]['sex'] != 'male') && $sub['subject_name'] == 'Agriculture Studies'){
$i++;
continue;
}
if($division != 'science'){
if($sub['is_selectable'] == 1){
if($student_info[0]['fourth_subject_id'] != $sub['class_wise_subject_id'])
{
$i++;
continue;
}
}
}
?>
<tr>
<?php
$isfouth = fourthSubjectChecker($studentId, $sub['class_wise_subject_id'], $student_info[0]['class_id']);
if(!$isfouth){
$suCount++;
}
$specialC = 0;
if($sub['subjective_total_mark'] > 0 ){
$specialC++;
}
if($sub['objective_total_mark'] > 0 ){
$specialC++;
}
if($sub['sba_mark'] > 0 ){
$specialC++;
}
if($sub['practical_total_mark'] > 0 ){
$specialC++;
}
$this->db->where('exam_id', $exam_id1);
$this->db->where('student_id', $studentId);
$this->db->where('class_wise_subject_id', $sub['class_wise_subject_id']);
$p = $this->db->get('mark')->row();
$this->db->where('exam_id', $exam_id11);
$this->db->where('student_id', $studentId);
$this->db->where('class_wise_subject_id', $sub['class_wise_subject_id']);
$pp1 = $this->db->get('mark')->row();
$tot = 0;
$fCount = 0;
//full of bugs for now!
//todo: need to fix this
$lal = $sub['class_wise_subject_id'];
$sql = "select written + mcq + practical as ItemSum,student_id from mark"
. " WHERE created_datetime > ".(date("Y")-1)." AND (exam_id = $exam_id1 AND class_wise_subject_id = $lal )";
$res = $this->db->query ($sql)->result_array();
$lall = array();
foreach ($res as $r){
$this->db->where('exam_id', $exam_id11);
$this->db->where('student_id', $r['student_id']);
$this->db->where('class_wise_subject_id', $lal);
$hul = $this->db->get('mark')->row()->sba_mark;
$lall[] = $r['ItemSum'] + $hul;
}
if($lall){
$vals = max($lall);
}else{
$vals = 'N/A';
}
//another bugss
$lal = $sub['class_wise_subject_id'];
$sql = "select written + mcq + practical as ItemSum,student_id from mark"
. " WHERE created_datetime > ".(date("Y")-1)." AND (exam_id = $exam_id2 AND class_wise_subject_id = $lal )";
$res = $this->db->query ($sql)->result_array();
$lall = array();
foreach ($res as $r){
$this->db->where('exam_id', $exam_id21);
$this->db->where('student_id', $r['student_id']);
$this->db->where('class_wise_subject_id', $lal);
$hul = $this->db->get('mark')->row()->sba_mark;
$lall[] = $r['ItemSum'] + $hul;
}
if($lall){
$valso = max($lall);
}else{
$valso = 'N/A';
}
$this->db->where('exam_id', $exam_id2);
$this->db->where('student_id', $studentId);
$this->db->where('class_wise_subject_id', $sub['class_wise_subject_id']);
$po = $this->db->get('mark')->row();
$this->db->where('exam_id', $exam_id21);
$this->db->where('student_id', $studentId);
$this->db->where('class_wise_subject_id', $sub['class_wise_subject_id']);
$pop1 = $this->db->get('mark')->row();
$toto = 0;
$fCounto = 0;
?>
<th rowspan="<?php echo $specialC;?>" style="text-align:center"><?php echo $sub['subject_name']?></th>
<?php if($sub['objective_total_mark'] > 0):?>
<th><?php echo $sub['objective_total_mark'] ;?></th>
<th>Obj</th>
<?php
$cal = '';
$pass = floor($sub['objective_total_mark']* 0.33);
$curMark = $p->mcq?$p->mcq:0;
if($curMark < $pass){
$cal = 'fail';
$fCount++;
}
?>
<td class="<?php echo $cal; ?>"><?php echo $curMark; ?></td>
<td>
<?php echo getHigestMark('mcq', $exam_id1, $sub['class_wise_subject_id']);?>
</td>
<?php
$cal = '';
$pass = floor($sub['objective_total_mark']* 0.33);
$curMark = $po->mcq?$po->mcq:0;
if($curMark < $pass){
$cal = 'fail';
$fCounto++;
}
?>
<td class="<?php echo $cal; ?>">
<?php echo $curMark; ?>
</td>
<td>
<?php echo getHigestMark('mcq', $exam_id2, $sub['class_wise_subject_id'])?>
</td>
<?php else:?>
<th><?php echo $sub['subjective_total_mark'] ;?></th>
<th>Sub</th>
<?php
$cal = '';
$pass = floor($sub['subjective_total_mark']* 0.33);
$curMark = $p->written?$p->written:0;
if($curMark < $pass){
$cal = 'fail';
$fCount++;
}
?>
<td class="<?php echo $cal; ?>"><?php echo $curMark; ?></td>
<td>
<?php echo getHigestMark('written', $exam_id1, $sub['class_wise_subject_id']);?>
</td>
<?php
$cal = '';
$pass = floor($sub['subjective_total_mark']* 0.33);
$curMark = $po->written?$po->written:0;
if($curMark < $pass){
$cal = 'fail';
$fCounto++;
}
?>
<td class="<?php echo $cal; ?>">
<?php echo $curMark; ?>
</td>
<td>
<?php echo getHigestMark('written', $exam_id2, $sub['class_wise_subject_id'])?>
</td>
<?php endif;?>
<?php
$frst = 0;
$frst += $p->written?$p->written:0;
$frst += $p->mcq?$p->mcq:0;
$frst += $p->practical?$p->practical:0;
$frst += $pp1->sba_mark?$pp1->sba_mark:0;;
$secnd = 0;
$secnd += $po->written?$po->written:0;
$secnd += $po->mcq?$po->mcq:0;
$secnd += $po->practical?$po->practical:0;
$secnd += $pop1->sba_mark?$pop1->sba_mark:0;
//$finalk1 += $frst;
//implementing 4th subject rule here
$total = $sub['subjective_total_mark'] + $sub['objective_total_mark']
+ $sub['sba_mark'] + $sub['practical_total_mark'] ;
if($isfouth){
$removal = ((49*$total)/100);
$frst = $frst-$removal;
if($frst < 0){
$frst = 0.00;
}
$finalk1 += $frst;
}else{
$finalk1 += $frst;
}
//$finalk2 += $secnd;
//implementing 4th subject rule here
if($isfouth){
$removal = ((49*$total)/100);
$secnd = $secnd-$removal;
if($secnd < 0){
$secnd = 0.00;
}
$finalk2 += $secnd;
}else{
$finalk2 += $secnd;
}
$mainFinale = ($frst + $secnd)/2;
?>
<td rowspan="<?php echo $specialC?>"> <?php echo $mainFinale?></td>
<?php
$total = $sub['subjective_total_mark'] + $sub['objective_total_mark']
+ $sub['sba_mark'] + $sub['practical_total_mark'] ;
?>
<td rowspan="<?php echo $specialC?>">
<?php
$fCount = 0;
if($fCount > 0){
echo '0.00';
}else{
//$isfouth = fourthSubjectChecker($studentId, $sub['class_wise_subject_id'], $student_info[0]['class_id']);
$convertedMark = ($mainFinale*100)/$total;
$tmpGpa = 0.00;
if($convertedMark >= 80){
echo ' 5.00';
$tmpGpa = 5.00;
}elseif(($convertedMark<80) && ($convertedMark>69)){
echo '4.00';
$tmpGpa = 4.00;
}elseif(($convertedMark<70) && ($convertedMark>59)){
echo '3.50';
$tmpGpa = 3.50;
}elseif(($convertedMark<60) && ($convertedMark>49)){
echo '3.00';
$tmpGpa = 3.00;
}elseif(($convertedMark<50) && ($convertedMark>39)){
echo '2.00';
$tmpGpa = 2.00;
}elseif(($convertedMark<40) && ($convertedMark>32)){
echo '1.00';
$tmpGpa = 1.00;
}elseif($convertedMark<33){
echo '0.00';
$tmpGpa = 0.00;
}
if($isfouth){
$tmpGpa = $tmpGpa - 2.00;
if($tmpGpa < 0){
$tmpGpa = 0.00;
}
$lGpsas += $tmpGpa;
}else{
$lGpsas += $tmpGpa;
}
}
?>
</td>
<td rowspan="<?php echo $specialC?>">
<?php
if($fCount > 0){
echo 'F';
}else{
$convertedMark = ($mainFinale*100)/$total;
if($convertedMark >= 80){
echo 'A+';
}elseif(($convertedMark<80) && ($convertedMark>69)){
echo 'A';
}elseif(($convertedMark<70) && ($convertedMark>59)){
echo 'A-';
}elseif(($convertedMark<60) && ($convertedMark>49)){
echo 'B';
}elseif(($convertedMark<50) && ($convertedMark>39)){
echo 'C';
}elseif(($convertedMark<40) && ($convertedMark>32)){
echo 'D';
}elseif($convertedMark<33){
echo 'F';
}
}
?>
</td>
</tr>
<?php
if($sub['objective_total_mark'] > 0){
$cal = '';
$pass = floor($sub['subjective_total_mark']* 0.33);
$curMark = $p->written?$p->written:0;
if($curMark < $pass){
$cal = 'fail';
$fCount++;
}
?>
<tr>
<th>
<?php echo $sub['subjective_total_mark'];?>
</th>
<th>
Sub
</th>
<td class="<?php echo $cal; ?>">
<?php echo $curMark; ?>
</td>
<td>
<?php echo getHigestMark('written', $exam_id1, $sub['class_wise_subject_id']);?>
</td>
<?php
$cal = '';
$pass = floor($sub['subjective_total_mark']* 0.33);
$curMark = $po->written?$po->written:0;
if($curMark < $pass){
$cal = 'fail';
$fCounto++;
}
?>
<td class="<?php echo $cal; ?>">
<?php echo $curMark; ?>
</td>
<td>
<?php echo getHigestMark('written', $exam_id2, $sub['class_wise_subject_id']);?>
</td>
</tr>
<?php }?>
<?php
if($sub['practical_total_mark'] > 0){
if($sub['practical_total_mark']<=0){
$cal = '';
}else{
$cal = '';
$pass = floor($sub['practical_total_mark']* 0.33);
$curMark = $p->practical?$p->practical:0;
if($curMark < $pass){
$cal = 'fail';
$fCount++;
}
}
?>
<tr>
<th><?php echo $sub['practical_total_mark'];?></th>
<th>PRAC</th>
<td class="<?php echo $cal; ?>">
<?php
$tot += $curMark;
echo $curMark;
?>
</td>
<td>
<?php echo getHigestMark('practical', $exam_id1, $sub['class_wise_subject_id']); ?></td>
<?php
if($sub['practical_total_mark']<=0){
$cal = '';
}else{
$cal = '';
$pass = floor($sub['practical_total_mark']* 0.33);
$curMark = $po->practical?$po->practical:0;
if($curMark < $pass){
$cal = 'fail';
$fCounto++;
}
}
?>
<td class="<?php echo $cal; ?>">
<?php
$toto += $curMark;
echo $curMark;
?>
</td>
<td><?php
echo getHigestMark('practical', $exam_id2, $sub['class_wise_subject_id']);
//echo $valso; ?></td>
<!--<td></td>-->
</tr>
<?php }?>
<?php if($sub['sba_mark'] > 0){?>
<?php
if($sub['sba_mark']<=0){
$cal = '';
}else{
$cal = '';
$pass = floor($sub['sba_mark']* 0.33);
$curMark = $pp1->sba_mark?$pp1->sba_mark:0;
if($curMark < $pass){
$cal = 'fail';
$fCount++;
}
}
?>
<tr>
<th><?php echo $sub['sba_mark'];?></th>
<th>SBA</th>
<td class="<?php echo $cal; ?>">
<?php
echo $curMark;
?>
</td>
<td><?php
echo getHigestMark('sba_mark', $exam_id11, $sub['class_wise_subject_id']);
//echo $vals; ?></td>
<?php
if($sub['sba_mark']<=0){
$cal = '';
}else{
$cal = '';
$pass = floor($sub['sba_mark']* 0.33);
$curMark = $pop1->sba_mark?$pop1->sba_mark:0;
if($curMark < $pass){
$cal = 'fail';
$fCount++;
}
}
?>
<td class="<?php echo $cal; ?>">
<?php
echo $curMark;
?>
</td>
<td><?php
echo getHigestMark('sba_mark', $exam_id21, $sub['class_wise_subject_id']);
// /echo $valso; ?></td>
<!--<td></td>-->
</tr>
<?php }?>
<?php
$i++;
endforeach;?>
<tr>
<th style="text-align:center" colspan="3">Total Obtained Number</th>
<td colspan="2" ><?php echo $finalk1;?></td>
<td colspan="2" ><?php echo $finalk2;?></td>
<td><?php echo (($finalk1 + $finalk2)/2); ?></td>
<td colspan="2" ><?php echo sprintf('%0.2f',$lGpsas);?></td>
</tr>
<tr rowspan="3">
<th colspan="3" style="text-align:center">Merit Position</th>
<td colspan="7" class="wow"><?php echo $student_info[0]['new_pos']; ?></td>
</tr>
<tr rowspan="3">
<th colspan="3" style="text-align:center">CGPA</th>
<td colspan="7" class="wow">
<?php
$mains = ($lGpsas/$suCount);
echo sprintf('%0.2f',$mains)
?>
</td>
</tr>
<tr rowspan="3">
<?php
if ($mains >= 1.00) {
$resultStatus = 'PASS';
$cal = '';
} else{
$resultStatus = 'FAIL';
$cal = 'fail';
}
?>
<th style="text-align: center" colspan="3" style="text-align:left">Result Status</th>
<td style="text-align: center" colspan="7" class="wow <?php echo $cal;?>">
<?php
echo $resultStatus;
?>
</td>
</tr>
<!-- Assessemnts -->
<tr>
<th colspan="10">Class Teacher's Comment</th>
</tr>
<tr>
<td rowspan="" colspan="2">
<table>
<colgroup>
<col style="padding: 3px;">
<col style="padding: 3px;">
</colgroup>
<tr>
<th colspan="2">Half Yearly</th>
</tr>
<tr>
<th style="float: left;">Starts From: </th>
<th style="float: left;margin-left: 40%;">To: </th>
</tr>
<tr>
<th colspan="2" style="float: left;">Total Classes: </th>
</tr>
<tr>
<th colspan="2" style="float: left;">Present: <?php echo $fst_attendence;?></th>
</tr>
<tr>
<th colspan="2"style="float: left;">Comments: </th>
</tr>
<tr>
<th colspan="2" style="float: left;">Result</th>
</tr>
<tr>
<td colspan="2">Signature: </td>
</tr>
<tr>
<td colspan="2">Principal: </td>
</tr>
<tr>
<td colspan="2">Guardians: </td>
</tr>
</table>
</td>
<td rowspan="" colspan="4">
<table>
<colgroup>
<col style="padding: 3px;">
<col style="padding: 3px;">
</colgroup>
<tr>
<th colspan="2">Yearly</th>
</tr>
<tr>
<th style="float: left;">Starts From: </th>
<th style="float: left;margin-left: 40%;">To: </th>
</tr>
<tr>
<th colspan="2" style="float: left;">Total Classes: </th>
</tr>
<tr>
<th colspan="2" style="float: left;">Present: <?php echo $snd_attendence;?></th>
</tr>
<tr>
<th colspan="2"style="float: left;">Comments: </th>
</tr>
<tr>
<th colspan="2" style="float: left;">Result</th>
</tr>
<tr>
<td colspan="2">Signature: </td>
</tr>
<tr>
<td colspan="2">Principal: </td>
</tr>
<tr>
<td colspan="2">Guardians: </td>
</tr>
</table>
</td>
<td rowspan="" colspan="4">
<table>
<colgroup>
<col style="padding: 3px;">
<col style="padding: 3px;">
</colgroup>
<tr>
<th colspan="2">Final Assessment</th>
</tr>
<tr>
<th style="float: left;">Starts From: </th>
<th style="float: left;margin-left: 40%;">To: </th>
</tr>
<tr>
<th colspan="2" style="float: left;">Total Classes: </th>
</tr>
<tr>
<th colspan="2" style="float: left;">Present: <?php echo ($thrd_attendence + $fst_attendence); ?></th>
</tr>
<tr>
<th colspan="2"style="float: left;">Comments: </th>
</tr>
<tr>
<th colspan="2" style="float: left;">Result</th>
</tr>
<tr>
<td colspan="2">Signature: </td>
</tr>
<tr>
<td colspan="2">Principal: </td>
</tr>
<tr>
<td colspan="2">Guardians: </td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment