Posisition Absolute on Mpdf Kartik not working - php

Continue from the question Yii2 mPdf Kartik: Set Height and Width Paper
I have problem width position absolute on page footer.
I have set it up position: absolute; and bottom: 0;
But page footer not in actual position.
The position should be like this:
this is my html code:
<?php
$pages = 1;
$pageof = 1;
$totalPageof = ceil(count($model->details) /10);
$index = 0;
?>
<?php if(count($details) > 0) : ?>
<div class="page-wrapper">
<?php foreach($details as $detail) :
$index += 1;
?>
<?php if($pages == 1) : ?>
<div class="page-layout">
<!-- HEADER -->
<div class="page-header">
<table class="table-header">
<tbody>
<tr>
<td class="font12" width="250"><strong>COMPANY NAME</strong></td>
<td class="font14" width="250"><strong>PROFORMA INVOICE</strong></td>
<td>
<table>
<tr>
<td class="font11" width="80">NO. PO</td>
<td class="font11" width="10">:</td>
<td class="font11"><?=$model->no_po?></td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="font11" width="250">
<p>COMPANY ADDRESS</p>
</td>
<td class="font14" width="250"><?=$model->no_rorder?></td>
<td>
<table>
<tr>
<td class="font10" width="80"><?=(!empty($model->tgl_po)) ? date('d-M-Y', strtotime($model->tgl_po)) : NULL ?></td>
<td class="font10"><?=(!empty($model->tgl_tempo)) ? 'DUE DATE '. date(' d-M-Y', strtotime($model->tgl_tempo)) : 'DUE DATE -' ?></td>
</tr>
</table>
</td>
</tr>
<tr>
<td style="padding: 0;">
<table>
<tr>
<td class="font12" colspan="3">COMPANY PHONE</td>
</tr>
<tr>
<td class="font10" width="60">NPWP</td>
<td class="font10" width="10"></td>
<td class="font10"><?=isset($model->distributor) ? $model->distributor->npwp : '-' ?></td>
</tr>
<tr>
<td class="font10" width="60">SALESMAN</td>
<td class="font10" width="10">:</td>
<td class="font11"><?=isset($model->sales) ? (isset($model->sales->code)) ? $model->sales->code.'-'.$model->sales->name : $model->sales->name : '-' ?></td>
</tr>
<tr>
<td class="font10" width="60">NOTICE</td>
<td class="font10" width="10">:</td>
<td class="font10"><?=isset($model->salesType) ? $model->salesType->name : '-' ?></td>
</tr>
</table>
</td>
<td colspan="2">
<table>
<tbody>
<tr>
<td rowspan="2" class="font12 grid-1">Kepada YTH</td>
<td class="grid-2">
<p class="font12"><?=isset($model->outlet) ? $model->outlet_code.' - '.$model->outlet->name : '-' ?></p>
<p class="font12"><?=isset($model->outlet) ? $model->outlet->address : '-' ?></p>
</td>
</tr>
<tr>
<td>
<table>
<tr>
<td class="font10 text-left" style="padding-left:180px;" colspan="2">
<span>
Phone <?=isset($model->outlet) ? $model->outlet->phone_1 : '-' ?>
</span>
</td>
</tr>
<tr>
<td class="font10" width="200"><?=isset($model->outlet) ? $model->outlet->npwp : '-'?></td>
<td class="font10"><?='Page '. $pageof++ .' Of '. $totalPageof ?></td>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
<!-- /HEADER -->
<?php endif; ?>
<!-- /endif pages header -->
<!-- CONTENT -->
<?php if($pages == 1) : ?>
<div class="page-content">
<table class="table-content">
<thead>
<tr>
<th>KODE#</th>
<th>PRODUK</th>
<th colspan="5">QUANTITY</th>
<th>PRICE</th>
<th>DISC</th>
<th>SUB TOTAL</th>
</tr>
</thead>
<tbody>
<?php endif; ?>
<!-- /endif pages content -->
<tr>
<td class="text-right"><?=(isset($detail['typeproduct'])) ? '*'. $detail['product_code'] : $detail['product_code']?></td>
<td><?=$detail['product_name']?></td>
<td><?=($detail['comp_1'] && $detail['zqty_1'] != 0) ? number_format($detail['zqty_1']).'.'.$detail['comp_1'] : ''?></td>
<td><?=($detail['comp_2'] && $detail['zqty_2'] != 0) ? number_format($detail['zqty_2']).'.'.$detail['comp_2'] : ''?></td>
<td><?=($detail['comp_3'] && $detail['zqty_3'] != 0) ? number_format($detail['zqty_3']).'.'.$detail['comp_3'] : ''?></td>
<td><?=($detail['comp_4'] && $detail['zqty_4'] != 0) ? number_format($detail['zqty_4']).'.'.$detail['comp_4'] : ''?></td>
<td><?=($detail['comp_5'] && $detail['zqty_5'] != 0) ? number_format($detail['zqty_5']).'.'.$detail['comp_5'] : ''?></td>
<td class="text-right"><?=(!is_null($detail['zsprice_1'])) ? number_format($detail['zsprice_1'], 0, ',', '.') : ''?></td>
<td class="text-right"></td>
<td class="text-right"><?=(!is_null($detail['zjum_j'])) ? number_format($detail['zjum_j'], 0, ',', '.') : ''?></td>
</tr>
<!-- COUNTER ITEM -->
<?php if($pages == 10 || $index == count($details)) : ?>
</tbody>
</table>
</div>
<!-- /CONTENT -->
<!-- FOOTER -->
<?php if($totalPageof == ($pageof-1)) : ?>
<div class="page-footer">
<table class="table-footer">
<tbody>
<tr>
<td class="grid-1">
<p class="font9"><?=(!empty($model->keterangan)) ? '<i>##</i>'. $model->keterangan : NULL ?></p>
</td>
<td class="grid-2 text-right" width="200">
<p class="font12"><strong><?=(!$model->post) ? '' : '### PENCETAKAN ULANG ##' ?></strong></p>
<table>
<tbody>
<tr>
<td class="font9" width="60">Cetakan ke</td>
<td class="font9">:</td>
<td class="font9 text-right"><?= (!empty($model->post)) ? $model->print : 0 ?></td>
<td></td>
<td class="font9" width="60">Sub Total</td>
<td class="font9">:</td>
<td class="font9 text-right"><?=number_format($realJumlah['total_j'], 0, ',', '.')?></td>
</tr>
<tr>
<td class="font9" width="60">Total Pcode</td>
<td class="font9">:</td>
<td class="font9 text-right"><?= count($details) ?></td>
<td></td>
<td class="font9" width="60">Disc Inv</td>
<td class="font9">:</td>
<td class="font9 text-right"><?=number_format($realJumlah['disc_percent'], 0, ',', '.')?></td>
</tr>
<tr>
<td class="font9" width="60">Point</td>
<td class="font9">:</td>
<td class="font9 text-right"><?=number_format($realJumlah['disc_point'], 0, ',', '.')?></td>
<td></td>
<td class="font9" width="60">DPP</td>
<td class="font9">:</td>
<td class="font9 text-right"><?=number_format($realJumlah['dpp'], 0, ',', '.')?></td>
</tr>
<tr>
<td colspan="4"></td>
<td class="font9" width="60">PPN</td>
<td class="font9">:</td>
<td class="font9 text-right"><?=number_format($realJumlah['ppn'], 0, ',', '.')?></td>
</tr>
<tr>
<td colspan="4"></td>
<td class="font10" width="60"><strong>TOTAL</strong></td>
<td class="font10">:</td>
<td class="font10 text-right"><strong><?=number_format($realJumlah['inv'], 0, ',', '.')?></strong></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td class="grid-1"></td>
<td class="grid-2 font10 money text-justify"><?=$realJumlah['terbilang']?></td>
</tr>
<tr>
<td class="grid-1">
<p class="font10">Admin SPV Gudang Pengirim Outlet</p>
<p class="font10">Produck yang sudah diterima harap diperiksa kembali</p>
<p class="color-white">----------------------------------------------------</p>
<p>----------------------------------------------------</p>
</td>
<td class="grid-2" style="padding-left: 80px;">
<table>
<tbody>
<tr>
<td class="font9">User</td>
<td class="font9">:</td>
<td class="font9"><?=Yii::$app->user->identity->profile->user->username?></td>
</tr>
<tr>
<td class="font9">Printed</td>
<td class="font9">:</td>
<td class="font9"><?= date('H:i:s', time()) ?></td>
</tr>
<tr>
<td class="font9">on</td>
<td class="font9">:</td>
<td class="font9"><?=date('d/m/Y')?></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
<?php endif; ?>
<!-- /FOOTER -->
<?php endif; ?>
<!-- /COUNTER ITEM -->
</div>
<?php
$pages++;
if($pages > 10)
$pages = 1;
endforeach;
?>
<!-- /endforeach -->
</div>
<?php endif; ?>
<!-- /endif count -->
And this my css code:
/** page layout */
.page-wrapper {
height: 13.6cm;
width: 21.2cm;
}
.page-layout {
height: 13.6cm;
width: 21.2cm;
}
.page-footer {
bottom: 0;
position: absolute;
}
/** end page layout */
/** table style */
.table-header {
width: 100%;
}
.table-header tbody tr td {
padding-bottom: 0;
padding-top: 0;
vertical-align: text-bottom;
}
.table-header tbody tr td p {
margin: 0;
}
.table-header tbody tr td table {
width: 100%;
}
.table-header tbody tr td table tbody tr td.grid-1 {
width: 20%;
}
.table-header tbody tr td table tbody tr td.grid-2 {
width: 80%;
}
.table-content {
font-family: 'Couriere';
width: 100%;
}
.table-content thead tr th {
border-bottom: 1px dashed #000;
font-size: 12px;
font-weight: 300;
text-align: center;
}
.table-content tbody tr td {
font-size: 12px;
padding-bottom: 0;
padding-top: 0;
}
.table-footer {
width: 100%;
}
.table-footer tbody tr td {
padding-bottom: 0;
padding-top: 0;
position: relative;
}
.table-footer tbody tr td p {
margin: 0;
}
.table-footer tbody tr td.grid-1 {
vertical-align: text-bottom;
width: 70%;
}
.table-footer tbody tr td.grid-2 {
width: 30%;
}
.table-footer tbody tr td.money {
padding-left: 40px;
}
.table-footer tbody tr td table {
width: 100%;
}
/** end table style */
/** custom child */
.font9 {
font-size: 9px;
}
.font10 {
font-size: 10px;
}
.font11 {
font-size: 11px;
}
.font12 {
font-size: 12px;
}
.font14 {
font-size: 14px;
}
.text-right {
text-align: right;
}
.text-justify {
text-align: justify;
}
.color-white {
color: #fff;
}
/** end custom child */
May be someone has experienced it, hopefully it can be helped.

Related

How do I use Page Break in Dompdf laravel 5.5?

I'm having trouble designing the pdf of my system. here's a pic of my pdf:
What I want to do is to limit the number of items in the table by 10 items after that the rest goes to the next page with the same header and footer which is fixed already. just like this:
Purchase Request PDF
Here's my code:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>PDF</title>
<link href="{{ asset('css/bootstrap.min.css') }}" rel="stylesheet">
<style>
#items tr{border:1px solid #000000;}
#items tbody tr td{border:1px solid #000000;}
#items thead td{background-color:#231F20;color:#FFFFFF;}
.header { position: fixed; left: 0px; top: -40px; right: 0px;}
.footer { position: fixed; left: 0px; bottom: 200px; right: 0px;}
</style>
<link rel="stylesheet" href="{{ asset('css/lato.css') }}">
<link href="https://fonts.googleapis.com/css?family=Libre+Barcode+128" rel="stylesheet">
</head>
<body>
<div class="container-fluid">
<div class="header">
<div class="row">
<div class="col-xs-3" style="font-family: 'Libre Barcode 128', cursive; font-size: 35px;padding: 10px 0px 0px 0px;">{{$pr->pr_form_no}}</div>
<div class="col-xs-9">
<table cellspacing='0' cellpadding='5' style="border-width: 0 !important;padding:0px 0px 0px 60px;">
<tr>
<td style="padding: 10px;"><img src="{{asset('images/sfclogo.png')}}" width="50px" height="50px"></td>
<td>
<table style="text-align: center;style='width:45%'">
<tr><td>REPUBLIC OF THE PHILIPPINES</td></tr>
<tr><td>PROVINCE OF LA UNION</td></tr>
<tr><td>CITY OF SAN FERNANDO</td></tr>
</table>
</td>
<th style="padding-top: 10px;padding-left: 10px"><p style="background-color: #000;color: #FFF; text-align: center;padding: 10px;">PR</p></th>
</tr>
</table>
</div>
</div>
<div class="row">
<div class="col-md-12" style="text-align: center;color: white;background-color: black; font-size: 18px">
PURCHASE REQUEST
</div><br>
</div>
<div class="row">
<table style='width:100%;border:1px solid #000000;font-size:11pt;' cellspacing='0' cellpadding='5' class='font1'>
<tr>
<td style='width:40%'>
<table style='width:90%;padding-right: 0px;' cellpadding='0' cellspacing='0'>
<tr>
<td style='width:100%;padding:1px;padding-left:10px;' colspan='2'>DEPARTMENT:</td>
</tr>
<tr>
<td style='width:100%;padding:0px;padding-left:10px;' colspan='2'>{{$dept->office_name}}<hr style='color:#000000;height:1px;margin-bottom:3px;margin-top:0px;padding-left:10px;' /></td>
</tr>
<tr>
<td style='width:15%;padding:1px;padding-left:10px;'>SECTION:</td>
<td style='width:75%;padding:0px;padding-left:0px;'>{{$section->office_name}}<hr style='color:#000000;height:1px;margin-bottom:3px;margin-top:0px;' /></td>
</tr>
</table>
</td>
<td style='width:30%;'>
<table style='width:90%;' cellpadding='0' cellspacing='0'>
<tr>
<td style='width:20%;padding:1px;'>PR No.</td>
<td style='width:70%;padding:0px;border-bottom:1px solid #000000;'>{{$pr->pr_form_no}}</td>
</tr>
<tr>
<td style='width:20%;padding:1px;'>SAI No.</td>
<td style='width:70%;padding:0px;border-bottom:1px solid #000000;'></td>
</tr>
<tr>
<td style='width:20%;padding:1px;'>ObR No.</td>
<td style='width:70%;padding:0px;border-bottom:1px solid #000000;'></td>
</tr>
</table>
</td>
<td style='width:30%'>
<table style='width:95%;' cellpadding='0' cellspacing='0'>
<tr>
<td style='width:15%;padding:1px;'>Date</td>
<td style='width:70%;padding:0px;border-bottom:1px solid #000000;'> {{$dt->toFormattedDateString()}}</td>
</tr>
<tr>
<td style='width:15%;padding:1px;'>Budget</td>
<td style='width:70%;padding:0px;border-bottom:1px solid #000000;'><strong> PHP {{number_format($pr->budget_alloc,2)}}</strong></td>
</tr>
<tr>
<td style='width:15%;padding:1px;'>Supplier</td>
<td style='width:70%;padding:0px;border-bottom:1px solid #000;'> {{$pr->supplier_type}}</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</div>
<div class="footer">
<div class="row">
<table style='width:100%;border:1px solid #000000;font-size:12px;margin-left:auto;margin-right:auto;margin-top:40px;' cellspacing='0' cellpadding='3' class='font1'>
<tr>
<td style='width:39%; font-weight:bold;text-align:left;border:1px solid #000000;'>
REQUESTING OFFICE<br/><br/><br/><br/>
</td>
<td style='width:60%;border:1px solid #000000;vertical-align:top;font-weight:bold;' colspan='2' rowspan='3'>
PURPOSE<br/>
<div style='width:100%;text-align:center;font-weight:normal;font-size:11pt;' class='font1'>
{{$pr->purpose}}
</div>
</td>
</tr>
<tr>
<td style='border:1px solid #000000;height:19px;text-align:center;text-transform:uppercase;font-weight:bold;'>
{{$pr->requestor_name}}
</td>
</tr>
<tr>
<td style='text-align:center;border:1px solid #000000;text-transform:uppercase;height:19px;font-weight:bold'>
{{$pr->requestor_position}}
</td>
</tr>
<tr>
<td colspan='3' style='background-color:#000000;height:20px;'>
</tr>
<tr>
<td style='width:33%; font-weight:bold;text-align:left;border:1px solid #000000;'>
APPROPRIATION AVAILABLE
</td>
<td style='width:33%; font-weight:bold;text-align:left;border:1px solid #000000;'>
FUNDS AVAILABLE
</td>
<td style='width:33%; font-weight:bold;text-align:left;border:1px solid #000000;'>
APPROVED
</td>
</tr>
<tr>
<td style='border:1px solid #000000;height:25px;text-align:center;text-transform:uppercase;font-weight:bold;'>
</td>
<td style='border:1px solid #000000;height:25px;text-align:center;text-transform:uppercase;font-weight:bold;'>
</td>
<td style='border:1px solid #000000;height:25px;text-align:center;text-transform:uppercase;font-weight:bold;'>
</td>
</tr>
<tr>
<td style='width:33%; font-weight:bold;text-align:center;border:1px solid #000000;text-transform:uppercase;'>
{{$aa->name}}<br/>
{{$aa->position}}
</td>
<td style='width:33%; font-weight:bold;text-align:center;border:1px solid #000000;text-transform:uppercase;'>
{{$c->name}}<br/>
{{$c->position}}
</td>
<td style='width:33%; font-weight:bold;text-align:center;border:1px solid #000000;text-transform:uppercase;'>
{{$approval->name}}<br/>
{{$approval->position}}
</td>
</tr>
</table>
</div>
<div class="row">
<div style='float:left;font-weight:normal;font-style:italic;font-size:7pt;width:40%;text-align:left;'>{{$created_code}}</div>
</div>
</div>
<div class="content" >
<div class="row">
<table style='width:100%;font-size:14px;text-align:center;border:1px solid #000000;' id='items' cellpadding='0' cellspacing='0'>
<thead>
<tr>
<td style='width:7%;font-weight:bold;'>ITEM NO.</td>
<td style='width:7%;font-weight:bold;'>QTY</td>
<td style='width:7%;font-weight:bold;'>UNIT</td>
<td style='width:49%;font-weight:bold;'>DESCRIPTION</td>
<td style='width:15%;font-weight:bold;'>ESTIMATED UNIT OF</td>
<td style='width:15%;font-weight:bold;'>ESTIMATED COST</td>
</tr>
</thead>
<tbody >
#foreach($list as $indexKey => $list)
<tr>
<td>{{$indexKey}}</td>
<td>{{$list->pr_qty}}</td>
<td>{{$list->pr_unit}}</td>
<td>{{$list->pr_description}}</td>
<td style='text-align: right;'>{{$list->pr_cost_per_unit}}</td>
<td style='text-align: right;'>{{$list->pr_estimated_cost}}</td>
</tr>
#if($indexKey >= 9)
#break
#endif
#endforeach
#for($i = $count; $i < 10; $i++)
<tr><td> </td><td> </td> <td> </td><td> </td><td> </td><td> </td></tr>
#endfor
</tbody>
<tfoot>
<tr style="background-color: #b0b1b2;">
<td colspan="5" style="text-align: right; font-weight: bold;">GRAND TOTAL</td>
<td style="text-align: right; font-weight: bold;">
{{number_format($grand_total,2)}}
</td>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
<script src="{{ asset('js/jquery.min.js') }}"></script>
<script src="{{ asset('js/bootstrap.min.js') }}"></script>
</body>
</html>
I already attempted to use the break function of the blade to stop the loop when the items shown is already 10.
*Also sorry if the code looks like hell.
you can use some css styling for it just like below:
<style>
.page-break {
page-break-after: always;
}
</style>
<h1>page</h1>
<div class="page-break"></div>
<h1>Someother Page</h1>
if you want to make a page break after for example 5 divs then you can do something like this:
#php $check=0 #endphp
#foreach($array as $item)
#php $check++ #endphp
<!-- your code or something like divs -->
#if( $check % 5 == 0 )
#php echo '<div class="page-break"></div>'; #endphp ....
#endif
#endforeach
Hope you will get the idea from it.

How to create horizontal scroller inside table?

I have create a table where I have retrieve data from database and put into table. I have a column in my database which is duration. for example duration is 10 so, number of weeks are week1,week2,week3 and so on in the table format. Now, I want to give horizontal scroller of weeks. So, How can I do this ?Please help me.
code:
<table class="table table-bordered">
<thead>
<th>A1</th>
<th>A2</th>
<th>A3</th>
<th>A4</th>
<?php
foreach ($prop as $row)
{
$duration = $row['duration'];
for($i=1; $i<=$duration; $i++)
{
echo "<th>week".$i."</th>";
}
}
?>
<th>A5</th>
<th>Total</th>
</thead>
<tbody>
<?php
foreach ($prop as $row)
{
$duration = $row['duration'];
$role = explode(",", $row['role']);
foreach ($role as $key)
{
$this->db->select('*');
$this->db->from('designation_master');
$where = "id = '".$key."'";
$this->db->where($where);
$sql = $this->db->get();
$res = $sql->result_array();
foreach ($res as $rows)
{
$rol = $rows['designation_name'];
}
?>
<tr>
<td id="s-some"><?php echo $rol; ?></td>
<td id="s-some"></td>
<td id="s-some"></td>
<td id="s-some"></td>
<?php
$duration = $row['duration'];
for($i=1; $i<=$duration; $i++)
{
echo "<td>
<input type='text' name='a' id='a".$i."' style='width: 40px;'/>
</td>";
}
?>
<td id="s-some"></td>
<td id="s-some"></td>
</tr>
<?php
}
}
?>
</tbody>
</table>
Thank You
You can make a holder for your table. and place your table inside.
Use overflow and place the table inside an holder. You can check the code below for reference.
.table-box{
max-width: 100px;
overflow-x: scroll;
}
.table-holder{
overflow: hidden;
}
/* Not important -> table styling */
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
}
td, th {
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
}
tr:nth-child(even) {
background-color: #dddddd;
}
<div class="table-holder">
<div class="table-box">
<table >
<tr>
<th>Company</th>
<th>Contact</th>
<th>Country</th>
</tr>
<tr>
<td>Alfreds Futterkiste</td>
<td>Maria Anders</td>
<td>Germany</td>
</tr>
<tr>
<td>Centro comercial Moctezuma</td>
<td>Francisco Chang</td>
<td>Mexico</td>
</tr>
<tr>
<td>Ernst Handel</td>
<td>Roland Mendel</td>
<td>Austria</td>
</tr>
<tr>
<td>Island Trading</td>
<td>Helen Bennett</td>
<td>UK</td>
</tr>
<tr>
<td>Laughing Bacchus Winecellars</td>
<td>Yoshi Tannamuri</td>
<td>Canada</td>
</tr>
<tr>
<td>Magazzini Alimentari Riuniti</td>
<td>Giovanni Rovelli</td>
<td>Italy</td>
</tr>
</table>
</div>
</div>

dompdf Image overlapping text pdf generating issue

I am trying to generate pdf using dom pdf
But in header part of pdf, image and text are overlapping.
Couldn't identify what exactly is wrong in my code?
CodeIgniter controller function:
$dompdf = new Dompdf();
$dompdf->set_option('enable_css_float', true);
$contxt = stream_context_create([
'ssl' => [
'verify_peer' => FALSE,
'verify_peer_name' => FALSE,
'allow_self_signed'=> TRUE
]
]);
$options = new Options();
$dompdf->setHttpContext($contxt);
$dompdf->set_option('isRemoteEnabled', true);
$dompdf->set_option('debugKeepTemp', true);
$dompdf->set_option('isHtml5ParserEnabled', true);
$dompdf->loadHtml($pdfdata);
// (Optional) Setup the paper size and orientation
$dompdf->setPaper('A4', 'portrait');
// Render the HTML as PDF
$dompdf->render();
$output = $dompdf->output();
Codeigniter View
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!--[if IE]><meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'><![endif]-->
<link rel="stylesheet" href="<?php echo CSS_PATH_BACKEND; ?>bootstrap.min.css">
<style>
#page { margin: 20px 30px; }
.table>tbody>tr>td, .table>tbody>tr>th, .table>tfoot>tr>td, .table>tfoot>tr>th, .table>thead>tr>td, .table>thead>tr>th{padding:6px;}
.table-bordered{border:2px solid #000;}
.table-bordered>tbody>tr>td, .table-bordered>tbody>tr>th, .table-bordered>tfoot>tr>td, .table-bordered>tfoot>tr>th, .table-bordered>thead>tr>td, .table-bordered>thead>tr>th{border:2px solid #000;}
.list-inline>li{ display: inline-block;
padding-right: 35px;
padding-left: 35px;
padding-top: 10px;
font-weight: 700;}
body{font-size:13px;}
.table>tbody>tr>td, .table>tbody>tr>th, .table>tfoot>tr>td, .table>tfoot>tr>th, .table>thead>tr>td, .table>thead>tr>th{padding:5px 0 5px 10px;}
.goods-table td{border:2px solid #000; }
thead:before, thead:after { display: none; }
tbody:before, tbody:after { display: none; }
tbody:before, tbody:after { display: none; }
.invoice tr td{}
.product_invoice td{padding:4px 5px !important;}
li{padding: 10px 0;}
li:before{content:''; font-size:60px; line-height:20px; vertical-align:middle;}
</style>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-xs-12">
<table class="table goods-table" style="margin-bottom: 0; font-size: 13px; border-collapse: collapse;">
<tbody>
<tr>
<td>
<div class="invoice-title">
<?php
$seg = $this->uri->segment(2);
if ($seg == "preview") {
?>
<img src="http://www.example.com/images/backend/logo_pdf.png" style="margin: 0 auto;display: block;" width="380px" height="76px" class="text-center" alt="logo"/>
<?php
} else {
?>
<img src="http://www.example.com/images/backend/logo_pdf.png" style="margin: 0 auto;display: block;width:380px;height:76px;" width="380px" height="76px" class="text-center" alt="logo"/>
<?php } ?>
<p style="padding: 5px 0 0 0;margin: 0;font-size: 13px;text-align: center;" class="text-center">Corporate Office: Some address</p>
<p style="padding: 0;margin: 0;font-size: 13px;text-align: center;" class="text-center">Phone: 87945456 Cell: 321456789 Email: info#example.com Website: www.example.com</p>
</div>
<div class="invoice-title">
<span class="text-center" style="margin: 5px 0 0 0;font-weight:700;text-align: center;display: block;font-size: 18px;">TAX INVOICE CUM CHALLAN</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="">
<div class="">
<div class="table-responsive">
<!--<table class="table table-condensed">-->
<table class="table goods-table" style="margin-bottom: 0; font-size: 13px; border-collapse: collapse;">
<tbody>
<tr style="border:2px solid #000;">
<td rowspan="4" style="width:40%;" colspan="2">
<!--StartFragment-->
<p style="padding: 0;margin: 0;font-size: 13px;"><span >To,</span></p>
<p style="padding: 0;margin: 0;font-weight: 700;font-size: 13px;"><span ><?php echo $customer['name']; ?></span></p>
<p style="padding: 0;margin: 0;font-size: 13px;"><span ><?php echo $customer['address']; ?></span></p>
<p style="padding: 0;margin: 0;font-size: 13px;"><span ><?php echo $customer['address1']; ?></span></p>
<p style="padding: 0;margin: 0;font-size: 13px;"><span ><?php echo $customer['city']; ?></span></p>
<p style="padding: 0;margin: 0;font-size: 13px;"><span >Phone No: <?php echo $customer['contact_no']; ?></span></p>
</td>
<td style="vertical-align:middle;width:30%;border:2px solid #000;">Invoice No: <span style="font-weight: 700;"><?php echo $invoice['invoice_no']; ?></span></td>
<td style="vertical-align:middle;width:30%;border:1px solid #000;" colspan="3" >Contact Person: <span style="font-weight: 700;"><?php echo ucwords($customer['contact_person_name']); ?></span></td>
</tr>
<tr style="border:2px solid #000;">
<td style="vertical-align:middle;">Date: <span style="font-weight: 700;"><?php echo date('d M Y', strtotime($invoice['created_date'])); ?></span></td>
<td style="vertical-align:middle;" colspan="3">Mobile No: <span style="font-weight: 700;"><?php echo ucwords($customer['contact_person_no']); ?></span></td>
</tr>
<tr style="border:2px solid #000;">
<td style="line-height: 1;vertical-align:middle;" rowspan="2">RIN No: <span style="font-weight: 700;">87455454</span></td>
</tr>
<tr style="border:2px solid #000;">
<td style="line-height: 1;vertical-align:middle;" colspan="3"> VAT No: <span style="font-weight: 700;"></span></td>
</tr>
<tr style="border:2px solid #000;">
<!--<td >Company Executive: <?php echo ucwords($user['fname'] . ' ' . $user['lname']); ?></td>-->
<td colspan="1">Date of Activation: <span style="font-weight: 700;"><?php echo date('d M Y', strtotime($invoice['activation_date'])); ?></span></td>
<td colspan="3">Next Renewal: <span style="font-weight: 700;"><?php echo date('d M Y', strtotime($invoice['renewal_date'])); ?></span></td>
</tr>
</tbody>
</table>
<table width="100%" class="table goods-table invoice" style="margin-bottom: 0; font-size: 12px; border-top: 1px solid #202020; ">
<tbody>
<tr>
<td style="font-weight: 700;font-size: 13px;width:10%;">Sr. No</td>
<td style="font-weight: 700;font-size: 13px;width:15%;">Software ID</td>
<td style="font-weight: 700;font-size: 13px;width:35%;">Description</td>
<td style="font-weight: 700;font-size: 13px;width:10%;">Quantity</td>
<td style="font-weight: 700;font-size: 13px;width:15%;">Unit Price (<img src="http://i.stack.imgur.com/nGbfO.png" width="8" height="10">)</td>
<td style="font-weight: 700;font-size: 13px;width:15%" colspan="2">Total Price (<img src="http://i.stack.imgur.com/nGbfO.png" width="8" height="10">)</td>
</tr>
<?php
$cnt = 1;
foreach ($product_invoice as $key => $value) {
?> <tr <?php
if (count($product_invoice) < 9) {
echo 'class';
} else {
echo 'class="product_invoice"';
}
?>>
<td
<?php if (count($product_invoice) == 1) { ?> style="height:650px;"<?php } ?>
<?php if (count($product_invoice) == 2 && ($key == (count($product_invoice)) - 1)) { ?> style="height:590px;"<?php } ?>
<?php if (count($product_invoice) == 3 && ($key == (count($product_invoice)) - 1)) { ?> style="height:180px;"<?php } ?>
<?php if (count($product_invoice) == 4 && ($key == (count($product_invoice)) - 1)) { ?> style="height:160px;"<?php } ?>
<?php if (count($product_invoice) == 5 && ($key == (count($product_invoice)) - 1)) { ?> style="height:110px;"<?php } ?>
<?php if (count($product_invoice) == 6 && ($key == (count($product_invoice)) - 1)) { ?> style="height:50px;"<?php } ?>
<?php if (count($product_invoice) == 7 && ($key == (count($product_invoice)) - 1)) { ?> style="height:0px;"<?php } ?>
<?php if (count($product_invoice) == 8 && ($key == (count($product_invoice)) - 1)) { ?> style="height:0px;"<?php } ?>
<?php if (count($product_invoice) == 9 && ($key == (count($product_invoice)) - 1)) { ?> style="height:0px;"<?php } ?>
<?php if (count($product_invoice) == 10 && ($key == (count($product_invoice)) - 1)) { ?> style="height:0px;"<?php } ?>>
<?php echo $cnt++; ?></td>
<td><?php echo $value['software_id']; ?></td>
<td><?php echo $value['description']; ?></td>
<td><?php echo $value['qty']; ?></td>
<td colspan="2"><?php echo $value['unit_price']; ?></td>
<td><?php echo $value['total_price']; ?></td>
</tr>
<?php } ?>
</tbody>
</table>
<table width="100%" class="table goods-table" style="margin-bottom: 0; font-size: 13px; padding: 15px 5px; ">
<tbody>
<tr>
<td colspan="2" rowspan="6" style="font-weight: 700;width:70%; padding: 10px 15px;">
<span style="font-weight:700;">Comments: </span>
</td>
<td style="width:15%;height:10px;">Sub Total</td>
<td style="width:25%;height:10px;" colspan="2"><img src="http://i.stack.imgur.com/nGbfO.png" width="8" height="10"> <?php echo $invoice['sub_total']; ?></td>
</tr>
<tr>
<td style="height:10px;">Other</td>
<td style="height:10px;"colspan="2"><img src="http://i.stack.imgur.com/nGbfO.png" width="8" height="10"> <?php echo $invoice['other']; ?></td>
</tr>
<tr>
<td style="height:10px;">VAT</td>
<td style="height:10px;" colspan="2"><img src="http://i.stack.imgur.com/nGbfO.png" width="8" height="10"> <?php echo $invoice['vat']; ?></td>
</tr>
<tr >
<td style="font-weight: 700;height:10px;font-size: 14px;">Grand Total</td>
<td style="font-weight: 700;height:10px;" colspan="2"><img src="http://i.stack.imgur.com/nGbfO.png" width="8" height="10"> <?php echo $invoice['total_price']; ?></td>
</tr>
<tr>
<td style="height:10px;">Mode Of Payment</td>
<td style="height:10px;" colspan="2"><?php
if ($invoice['paymode_mode'] == 1) {
echo 'Cash';
}
if ($invoice['paymode_mode'] == 2) {
echo 'Cheque';
}
if ($invoice['paymode_mode'] == 3) {
echo 'Cash and Cheque';
}
?></td>
</tr>
<tr>
<td colspan="3" >In Words: <?php echo ucwords(convert_number_to_words($invoice['total_price'])); ?> Rupees Only</td>
</tr>
<tr>
<td colspan="2">Installation Done<br>
<br><br><br>
Receiver's Signature with Seal
</td>
<td style="text-align: center;" colspan="3"><span style="font-weight: 700;font-size: 14px;">For </span><span style="font-weight: 700;font-size: 14px;">oft</span>
<?php if ($seg == "preview") {
?>
<img src="<?php echo IMAGE_PATH_BACKEND; ?>test.png" style="margin: 0 auto;display: block;" class="text-center" alt="logo"/>
<?php
} else {
?>
<img src="http://example.com/images/backend/test.png" style="margin: 0 auto;display: block;" class="text-center" alt="logo"/>
<?php } ?>
Authorized Signatory
</td>
</tr>
</tbody>
</table>
<table width="100%" class="table " style="margin-bottom: 0; font-size: 13px; border-bottom: 2px solid #000; border-left: 2px solid #000; border-right: 2px solid #000;">
<tbody>
<tr>
<td style="border-right: 2px solid #000;font-weight: 700;width: 100px;">Branches</td>
<td style="border-right: 2px solid #000;font-weight: 700;text-align: center;width: 100px;">sddsa</td>
<td style="border-right: 2px solid #000;font-weight: 700;text-align: center;width: 100px;">ewew</td>
<td style="border-right: 2px solid #000;font-weight: 700;text-align: center;width: 132px;">ewewq</td>
</tr>
<tr>
<td colspan="5" style="border : 2px solid #000;text-align: center;"><span style="font-weight:700;font-size: 13px;">Note: Computer generated Invoice and requires no signature.</span><br></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
There's a bug in Dompdf (current release 0.8.0) where styling an image with auto margins will cause it to no longer take up any vertical space in the layout.
Luckily your layout is such that working around the issue is fairly simple. Change the code around your image to the following:
<div class="text-center">
<?php
$seg = $this->uri->segment(2);
if ($seg == "preview") {
?>
<img src="http://www.example.com/images/backend/logo_pdf.png" width="380px" height="76px" alt="logo"/>
<?php
} else {
?>
<img src="http://www.example.com/images/backend/logo_pdf.png" width="380px" height="76px" class="text-center" alt="logo"/>
<?php } ?>
</div>
Also of note: don't modify the display styling of images. Currently dompdf requires a special styling to render these correctly and if you change the styling (e.g. to display: block;) you may get unexpected results.

Print Report only 6 data for 1 page

i create a report. i try print preview this report.
but i want show 6 data/page page size a4 (landscape).
i already try loop 24 data. and try print preview in google chrome
there 1 data must be down to page 2
see my picture
[![enter image description here][1]][1]
then i check page 2 already same.
this page 2
[![enter image description here][2]][2]
How to fix this, i want report show only 6 data/page
this is my full code, you can try in localhost.
<style>
#caption
{
color:white;
font-weight:bold;
text-align:center;
background-color: #4CAF50;
}
table
{
border-collapse: collapse;
}
th, td
{
padding: 0px;
font-family:arial;
font-size:13px
}
tr:nth-child(even){background-color: #f2f2f2}
th {
background-color: #4CAF50;
color: white;
}
</style>
<table align="center" width="100%" border="1">
<tr>
<td colspan="7" style="vertical-align: top;" id="caption"><font size="3">Data Pendaftar</font></td>
</tr>
<?php
$x = 1;
while($x <= 24)
{
?>
<tr>
<td id="caption">Foto Siswa/i</td>
<td id="caption">Nama Lengkap Siswa/i</td>
<td id="caption">Tempat Lahir</td>
<td id="caption">Tanggal Lahir</td>
<td id="caption">Usia</td>
<td id="caption">L/P</td>
<td id="caption">Agama</td>
</tr>
<tr>
<td align="center" rowspan="3">
<img border="1" src="https://akphoto4.ask.fm/769/854/890/910003014-1s093lj-dc47ceo09kenpt5/original/avatar.jpg"style="width:80px;height:80px;">
</td>
<td align="center">Vasco Da Gama</td>
<td align="center">Spain</td>
<td align="center">01 February 1800</td>
<td align="center">79</td>
<td align="center">L</td>
<td align="center">Kristen</td>
</tr>
<tr>
<td id="caption" colspan="2">Alamat</td>
<td id="caption" colspan="2">No. Telpon | No. Hp </td>
<td id="caption" >Tanggal Daftar</td>
<td id="caption">Status</td>
</tr>
<tr>
<td colspan="2">Spain</td>
<td colspan="2" align="center">0800000000</td>
<td >07 Februari 2000 13:15:33</td>
<td align="center">Pending</td>
</tr>
<?php
$x++;
}
?>
</table>
In this situation, you could create a separate table per page with only 6 rows. Only display the "Data Pendaftar" on the first page, add class="break" to every table except the table on the last page and add a CSS rule table.break{page-break-after:always}. I added a <br /> after each table, so it looks good in the browser before it prints. This will always print 6 rows per page, even when you're accidentally in portrait mode...
<style>
#caption{color:white;font-weight:bold;text-align:center;background-color:#4CAF50}
table{border-collapse:collapse}
th, td{padding: 0px;font-family:arial;font-size:13px}
tr:nth-child(even){background-color:#f2f2f2}
th{background-color:#4CAF50;color:white}
table.break{page-break-after:always}
</style>
<?php $i = 1; while ($i <= 4) { ?>
<table align="center" width="100%" border="1"<?php if ($i < 4) { ?> class="break" <? } ?>>
<?php if ($i == 1) { ?>
<tr>
<td colspan="7" style="vertical-align: top;" id="caption"><font size="3">Data Pendaftar</font></td>
</tr>
<?php } $x = 1; while ($x <= 6) { ?>
<tr>
<td id="caption">Foto Siswa/i</td>
<td id="caption">Nama Lengkap Siswa/i</td>
<td id="caption">Tempat Lahir</td>
<td id="caption">Tanggal Lahir</td>
<td id="caption">Usia</td>
<td id="caption">L/P</td>
<td id="caption">Agama</td>
</tr>
<tr>
<td align="center" rowspan="3">
<img border="1" src="https://akphoto4.ask.fm/769/854/890/910003014-1s093lj-dc47ceo09kenpt5/original/avatar.jpg"style="width:80px;height:80px;">
</td>
<td align="center">Vasco Da Gama</td>
<td align="center">Span</td>
<td align="center">01 Feb 1800</td>
<td align="center">79</td>
<td align="center">L</td>
<td align="center">Kristen</td>
</tr>
<tr>
<td id="caption" colspan="2">Alamat</td>
<td id="caption" colspan="2">No. Telpon | No. Hp </td>
<td id="caption" >Tanggal Daftar</td>
<td id="caption">Status</td>
</tr>
<tr>
<td colspan="2">Spain</td>
<td colspan="2" align="center">021000000 | 0800000000</td>
<td >07 Februari 2000 13:15:33</td>
<td align="center">Pending</td>
</tr>
<?php $x++; } ?>
</table>
<br />
<?php $i++; } ?>

Internal Server on a dynamic php script that works well on other options

I have a php script that generates report sheet of a class in a school. With other school classes selected the report sheet script works just fine but when you select this particular class it shows Internal Server Error
Peep the code be
<?php
session_start();
ob_flush();
include('server_func.inc');
//ini_set('max_execution_time', '600');
//ini_set('memory_limit', '-1');
ini_set('max_execution_time', '60000');
ini_set('memory_limit','12560M');
//set_time_limit('60000');
ini_set('mysql.connect_timeout','-1');
error_reporting(E_ALL);
ini_set('display_errors', '1');
$session = $_GET['session'];
$term = $_GET['term'];
//$classID = $_GET['classID'];
$config = system_config('TEST');
if(isset($_REQUEST['session']))
{
$session = $_REQUEST['session'];
}
else
{
echo 'No session selected';
exit;
}
if(isset($_REQUEST['term']))
{
$term = $_REQUEST['term'];
}
else
{
echo 'No term selected';
exit;
}
if(isset($_REQUEST['classID']))
{
$classID = $_REQUEST['classID'];
$class_list = class_list_view($session,$classID,'');
}
if(isset($_REQUEST['StudentID']))
{
$StudentID = $_REQUEST['StudentID'];
$classID = getStudentClass($session,$StudentID);
$class_list = class_list_view($session,$classID,$StudentID);
//if($_SESSION['school_id']==8)
//{
//echo "Check back later";
//break;
//}
}
else
{
$StudentID = '';
}
$cAverage = 0.0;
$totalScore = 0.0;
$fAverage = 0.0;
$hAverage = 0.0;
$lAverage = 0.0;
$current_session = current_session();
//$q1 = mysql_query("SELECT s1.StudentID, s2.StudentID FROM sch_student s1 INNER JOIN sch_student_list ON s1.StudentID = s2.StudentID WHERE ClassID = '$classID' AND Session ='$session'");
//$allstudents = mysql_num_rows($q1);
//$class_list = class_list_view($session,$classID,'');
//$class_list3 =classList_search($classID,'',$session);
//$class_list2 = class_list_view($session,$classID,$StudentID);
$noClass = count($class_list);
//echo $noClass;
$student = student_view_1('','');
$classview = class_view($classID);
$classRoom = $classview[0];
$timetable = timeTable_view_s($classID);
$subjects = subject_view_1('');
$sectionID = $classRoom->getSectionID();
$format_view = array();
//$subjectID = '';
//$StudentID = '';
$section = section_display($sectionID);
$assessment = assessment_display($section->getAssessmentID());
$grading = grading_display($section->getGradingID());
if($grading != null)
$grading_format_view = grading_format_view($grading->getGradingID(),'');
$assessment = section_assessment_view($sectionID,$session,$term);
$ass_id = $assessment[0]['assessment_format_id'];
if(count($assessment)<1){
echo "No Assessment chosen for this section";
}
else {
$format_view = assessment_format_view_clone($ass_id);
}
$scores = scores_view('');
//$result_view = result_view($subjectID,$StudentID,$classID);
$result_view = result_view_students($class_list,$session,$term);
$stud = getSubjectResults($result_view,$format_view,$scores);
$traits_view_section = traits_view_section($sectionID);
$traits = traits_view_s($session,$term,$section->getSectionID());
$staff_view = staff_display($classRoom->getFormTeacher(),'');
$rs = getFormattedStudent($result_view,$format_view,$scores);
$divider = 'ByClass';
$timetable_viewnew = timeTable_view($classID,'');
$check[] = '';
for($i=0;$i<count($timetable_viewnew);$i++)
{
$subjectID1 = $timetable_viewnew[$i]->getSubjectID();
$tag1 = $timetable_viewnew[$i]->getTag();
//if($tag=='Ancillary')
$check[] = $tag1;
}
if(in_array("Ancillary",$check)){
$divider = 'ByStudent';
}
//$html = '
?>
<style type="text/css">
* {
}
.page {
width: 21cm;
min-height: 26cm;
margin: 0.2cm auto;
}
.subpage {
padding: 0.1cm;
}
#page {
size: A4;
margin: 0;
}
#media print {
.page {
margin: 0;
width: initial;
min-height: initial;
page-break-after: always;
}
}
.rsBox
{
width: 100%;
margin-right: auto;
margin-left: auto;
border: 1px solid #666666;
border-image:url(img/border.png) 30 30 round;
-moz-border-image:url(img/border.png) 30 30 round; /* Firefox */
-webkit-border-image:url(img/border.png) 30 30 round; /* Safari and Chrome */
-o-border-image:url(img/border.png) 30 30 round; /* Opera */
padding:5px;
overflow:hidden;
}
.block
{
width: 95%;
margin-right: auto;
margin-left: auto;
border-top-width: 1px;
border-top-style: solid;
border-top-color: #666666;
}
.seperator
{
height: 20px;
}
.name
{
height: 43px;
width: 100%;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 15px;
font-weight:bolder;
padding-top: 5px;
padding-bottom: 5px;
text-transform:uppercase;
}
.motto
{
height: 20px;
width: 100%;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 16px;
padding-top: 5px;
padding-bottom: 5px;
}
.address
{
height: 20px;
width: 95%;
font-family: Verdana, Arial, Helvetica, sans-serif;
padding-top: 0px;
font-size: 12px;
padding-bottom: 2px;
}
.session
{
height: 20px;
width: 100%;
font-family: Verdana, Arial, Helvetica, sans-serif;
padding-top: 5px;
font-size: 12px;
padding-bottom: 5px;
}
.over_border
{
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: #333333;
}
.section1 td
{
font-size: 14px;
font-family: Arial, Helvetica, sans-serif;
border:1px solid #999;
}
.overview td
{
border-right-width: 1px;
border-right-style: solid;
border-right-color: #333333;
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: #333333;
}
.trait .td
{
border-width: 1px;
border-style: solid;
border-color: #333333;
}
.ob
{
font-size: 12px;
font-family: Arial, Helvetica, sans-serif;
}
.tob
{
font-size: 12px;
font-family: Arial, Helvetica, sans-serif;
}
.obs
{
font-size: 11px;
font-family: Arial, Helvetica, sans-serif;
}
.subjectsDiv {
-ms-transform: rotate(-90deg); /* IE 9 */
-webkit-transform: rotate(-90deg); /* Chrome, Safari, Opera */
transform: rotate(-90deg);
width:100px;
height:100%;
text-align:left;
padding:0px;
background:#FFF;
}
.subjectsDivTd {
height:100px;
max-width:20px;
min-width:20px;
border:1px solid;
overflow:hidden;
margin:0px;
padding:0px;
background:#000;
}
</style>
<div class="book">
<?php
$newsletter = '';
$data = newsletter_view('',$sectionID,$session,$term);
for($i=0; $i<count($data); $i++){
$newsletter = $data[$i]['content'];
}
$i = 0;
if(empty($class_list)){
echo "No class member";
}
else
foreach($class_list as $std):
//$i++;
//if($i>10)
//break;
$StudentID = $std->getStudentID();
if($student[$StudentID]==NULL){
continue;
}
$cAverage = 0.0;
$totalScore = 0.0;
$fAverage = 0.0;
$hAverage = 0.0;
$lAverage = 0.0;
$index = 0;
$results = $result_view[$std->getStudentID()];
$index = 0;
$noSubjects = 0;
if(!empty($results))
foreach($results as $result)
{
$resultID = $result->getResultID();
$mark = 0;
$totality = 0;
$subjectID = trim($result->getSubjectID());
if(!empty($stud[$subjectID]))
$subject = $stud[$subjectID];
if(!empty($format_view)):
foreach($format_view as $format):
if(isset($scores[$resultID][$format->getFormatID()]))
{
$score = $scores[$resultID][$format->getFormatID()];
$mark = $score->getScore();
$totalScore += $mark;
}
endforeach;
endif;
$index++;
$cAverage += getSubjectAverage($subject,$noClass);
}
if(!empty($cAverage))
$cAverage /= $index;
if(!empty($fAverage))
$fAverage = $totalScore / $index;
$formatting = getGradeFormat($grading_format_view,round($fAverage,0));
$grade = 'N/A';
if($formatting != null)
$grade = $formatting->getDescriptor();
//$html .=
$comment = comment_view($StudentID,$session,$term);
for($l=0; $l<count($comment); $l++){
$cc = $comment[$l];
$formteacher_comment = $cc->getFormteacher();
$principal_comment = $cc->getPrincipal();
}
$bscores = count($results);
$cscores = $bscores * 100;
if(!empty($totalScore))
//$percentage = round($totalScore/$cscores * 100,0)."%";
echo $cscores;
$percentage = round($totalScore/$cscores * 100,2);
if($divider=="ByStudent") {
$percentage = round($totalScore/$cscores * 100,2);
}
else {
$percentage = round($totalScore/count($timetable_viewnew),2);
};
//$totalScore/$cscores * 100;
?>
<a href='#' onclick='window.print()'><img src='images/print_icon.jpg' width='50' height='30' /></a>
<div class="page">
<div class="subpage">
<div class="rsBox">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr style="height:auto;">
<td height="" align="center" >
<div style="width:auto; height:auto; overflow:auto; border-bottom:1px solid;">
<div style="border:0px solid; width:10%; height:100px; float:left; padding-top:10px;padding-bottom:10px; ">
<img src="<?php echo $config->getLogo(); ?>" style="width:100%; height:100%;" />
</div>
<div style="border:0px solid; width:78%; float:left;">
<h4 style="margin-bottom:0px; margin-top:0px;">ARCHDIOCESE OF ONITSHA</h4>
<div class="name"><?php echo $config->getSchoolname(); ?></div>
<div class="address"><?php echo $config->getAddress(); ?></div>
<div class="session"> REPORT SHEET FOR <?php echo $term . ', ' . $session ; ?> ACADEMIC SESSION</div>
</div>
<div style="border:0px solid; width:10%; height:100px; float:left; padding-top:10px;padding-bottom:10px; ">
<img src="images/micolos.jpg" style="width:100%; height:100%;" />
</div>
</div>
</td>
</tr>
<tr>
<td><table width="95%" border="0" align="center" cellpadding="0" cellspacing="2" class="section1">
<tr>
<td width="19%" align="left" style="font-weight:bold;">NAME::</td>
<td width="1%" align="right"> </td>
<td width="43%"><?php echo $student[$StudentID]->getFirstname(). ' ' .$student[$StudentID]->getMiddlename().' '. $student[$StudentID]->getLastname(); ?></td>
<td width="20%" align="left" style="font-weight:bold;">Mark Obtainable: </td>
<td width="1%" align="right"> </td>
<td width="16%"><?php echo $cscores ;?></td>
</tr>
<tr>
<td align="left" style="font-weight:bold;">CLASS::</td>
<td align="right"> </td>
<td><?php echo $classRoom->getLevel() . ' ' . $classRoom->getPrefix(); ?></td>
<td align="left" style="font-weight:bold;">Total:: </td>
<td align="right"> </td>
<td><?php echo $totalScore; ?></td>
</tr>
<tr>
<td align="left" style="font-weight:bold;">Admission No:: </td>
<td align="right"> </td>
<td><?php echo $student[$StudentID]->getRegno(); ?></td>
<td align="left" style="font-weight:bold;">Average:</td>
<td align="right"> </td>
<td><?php if(!empty($percentage)) echo $percentage; ?> </td>
</tr>
<tr>
<td align="left" style="font-weight:bold;">Session::</td>
<td align="right"> </td>
<td><?php echo $session; ?></td>
<td align="left" style="font-weight:bold;">Position:</td>
<td align="right"> </td>
<td> <?php
echo getTermPosition($rs,$StudentID);
$pos = getTermPosition($rs,$StudentID);
if($pos == '11'){
echo 'th';
}
elseif($pos == 12){
echo 'th';
}
elseif($pos == 13){
echo 'th';
}
elseif(substr($pos, -1)=='1') { echo 'st'; }
else if(substr($pos, -1)=='2') { echo 'nd'; }
else if(substr($pos, -1)=='3') { echo 'rd'; }
else { echo 'th'; }
?></td>
</tr>
<tr>
<td align="left" style="font-weight:bold;">Term:</td>
<td align="right"> </td>
<td><?php echo $term; ?></td>
<td align="left" style="font-weight:bold;"> </td>
<td align="right"> </td>
<td> </td>
</tr>
<tr>
<td align="left" style="font-weight:bold;">Next Term Begins</td>
<td align="right"> </td>
<td><?php echo $current_session->getNextTerm(); ?></td>
<td align="left" style="font-weight:bold;"> </td>
<td align="right"> </td>
<td> </td>
</tr>
</table></td>
</tr>
<tr>
<td>
<div class="block"><span style="font-weight:bold;">No. in Class :: <?php echo $noClass; ?></span></div>
</td>
</tr>
<tr>
<td>
<div class="block">
GRADE: <br />
<?php
foreach($grading_format_view as $b) {
$desc = $b->getDescriptor();
$start = $b->getStart();
$end = $b->getEnd();
echo '<b>'.$desc.'</b>'.'='.$start.'-'.$end.','.' ';
}
?>
</div>
</td>
</tr>
<tr>
<td>
<div class="block">
<table border="0" width="100%" cellspacing="0" class="overview">
<tr class="ob">
<td align="center" width="25%">SUBJECT</td>
<?php
if(!empty($format_view)):
foreach($format_view as $format):
?>
<!-- // $html .= -->
<td valign="bottom" align="center"> <?php echo $format->getShortName(); ?><br>
<?php echo '('. $format->getPercentage() . '%)'; ?></td>
<?php
endforeach;
endif;
// $html .=
?>
<td valign="bottom" align="center">TOTAL</td>
<!-- <td valign="bottom" align="center">POSITION</td>-->
<td valign="bottom" align="center">GRADE </td>
<td align="center" valign="bottom" style="width:120px;">COMMENT</td>
<td valign="bottom" align="center">Subject Master Signature</td>
</tr>
<?php
if(!empty($results))
foreach($results as $result)
{
$subjectID = $result->getSubjectID();
//if($timetable[$subjectID]->getTag()!='Compulsory')
//{
//continue;
//}
$subject = $stud[$subjectID];
arsort($subject);
$noSubjects++;
$index++;
$resultID = $result->getResultID();
$mark = "";
$totality = 0;
//$html .=
?>
<tr class="obs">
<td align="left"> <?php if(!empty($subjects[$subjectID])) { echo $subjects[$subjectID]->getTitle(); } else { echo $subjectID; } ?> </td>
<?php
$mark = '-';
if(!empty($format_view)):
foreach($format_view as $format):
if(isset($scores[$resultID][$format->getFormatID()]))
{
$score = $scores[$resultID][$format->getFormatID()];
if(empty($score)){
$mark = '-';
}
else {
$mark = $score->getScore();
}
$totality += $mark;
$totalScore += $mark;
}
?>
<!-- // $html .= -->
<td align="center"> <?php echo $mark; ?> </td>
<?php
endforeach;
endif;
$formatter = getGradeFormat($grading_format_view,$totality);
// $html .=
?>
<td align="center"><?php echo $totality; ?></td>
<!-- <td align="center"><?php //echo getSubjectPosition($subject,$resultID) ; ?></td>-->
<td align="center"><?php echo $formatter->getDescriptor(); ?></td>
<td align="center"><?php echo $formatter->getComment(); ?></td>
<td>.</td>
</tr>
<?php
}
if(!empty($totalScore))
$average = $totalScore/ $noSubjects;
//$html .=
?>
</table>
</div></td></tr>
<tr><td>
<div class="block">
<table width="100%" align="center" cellpadding="0" cellspacing="0" class="trait" style="float:left; border:0px;">
<tr>
<td style="border:0px;">
<!-- Rating Details::-->
<?php
$trait_rating_view = view_section_traits(view_section_trait_rating_format($sectionID));
//echo $trait_rating_view;
for($j=0; $j<(count($trait_rating_view)); $j++){
$trait_rating_s = $trait_rating_view[$j];
?>
<b>
<?php
//echo $trait_rating_view[$j]['rating'];?></b><!--=--><?php //echo $trait_rating_view[$j]['description'].','.' '; ?>
<?php
}
?>
</td>
</tr>
<tr class="tob" style="border:0px;" >
<td style="border:0px;">
<table>
<tr>
<td >
<?php
if(!empty($traits))
foreach($traits as $format):
?>
<div style="min-width:180px; min-height:80px; border:0px solid; float:left; position:relative; margin-right:4px;" >
<table border="1" style="max-width:180px; border:1px solid #CCC;">
<tr>
<td style="font-size:11px; font-weight:bold; text-transform:uppercase;"><?php echo $format->getTraitDesc(); ?></td> <?php
$t_format_view = traits_definition_view($format->getTriatID());
if(!empty($t_format_view)):
for($u=0; $u<count($t_format_view); $u++):
$t_format = $t_format_view[$u];
// $traits_rating_format =
//$rating = get_student_trait_rating($StudentID,$t_format->getTraitID(),$t_format->getTraitDefinitionID())
?>
<td style="font-size:11px;" class="subjectsDivTd"><div class="subjectsDiv"> <?php echo $t_format->getDefinition(); ?></div> </td>
<?php
endfor;
endif;
?>
</tr>
<tr>
<td style="font-size:11px; font-weight:bold; text-transform:uppercase;">Rating</td><?php
$t_format_view = traits_definition_view($format->getTriatID());
if(!empty($t_format_view)):
for($u=0; $u<count($t_format_view); $u++):
$t_format = $t_format_view[$u];
// $traits_rating_format =
//$rating = get_student_trait_rating($StudentID,$t_format->getTraitID(),$t_format->getTraitDefinitionID())
?>
<td><?php
if(get_student_trait_rating($StudentID,$t_format->getTraitID(),$t_format->getTraitDefinitionID(),$session,'Third Term')==NULL){ echo " ";}
else { get_student_trait_rating($StudentID,$t_format->getTraitID(),$t_format->getTraitDefinitionID(),$session,'Third Term'); } ?> </td>
<?php
endfor;
endif;
?>
</tr>
</table>
</div>
<?php
endforeach;
?>
</td>
</tr>
</table></td></tr></table></div>
<tr>
<td>
<div class="rsBox">
<table width="100%" align="center" cellpadding="0" cellspacing="0" class="trait" style="float:left;" border="1">
<tr class="tob">
<td style="max-width:80px;"><strong>Class Manager:</strong></td>
<td colspan="4" align="center"><?php if(!empty($staff_view)){echo $staff_view->getTitle().' '.$staff_view->getFirstname().' '.$staff_view->getMiddlename().' '.$staff_view->getLastname();} else { echo ".";} ?></td>
</tr>
<tr class="tob">
<td style="max-width:80px;"><strong>Class Manager Remark:</strong></td>
<td colspan="4" align="center"><?php if(!empty($formteacher_comment)){ echo $formteacher_comment; } else { echo ".";} ?></td>
</tr>
<tr class="tob">
<td style="max-width:80px;"><strong>School Head Remark</strong>:</td>
<td colspan="4" align="center"><?php if(!empty($principal_comment)) { echo $principal_comment; } else { echo ".";} ?></td>
</tr>
<tr class="tob">
<td style="max-width:80px;"><strong>School Head/Principal</strong>:</td>
<td colspan="4" align="center"><?php echo
$section->getSectionHead(); ?></td>
</tr>
<tr class="tob">
<td style="max-width:80px;"><strong>School Head/Principal Signature</strong>:</td>
<td colspan="4" align="center"><img src="<?php echo $section->getSectionHeadSignature(); ?>" width="120" height="40" /></td>
</tr>
</table>
</div>
</td></tr>
</table>
</div>
</div>
</div>
<div class="seperator"></div>
<?php
if($newsletter==""){
continue;
}
else {
?>
<div class="book">
<div class="page" style="height:300xp;">
<div class="subpage">
<div class="rsBox">
<?php
echo $newsletter;
?>
</div>
</div>
</div>
<?php
}
?>
</div>
<?php
endforeach;
//$html .=
?>
</div>
<?php
/*if($_REQUEST['op'] == 'PDF' )
{
require_once("dompdf/dompdf_config.inc.php");
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
$dompdf->stream($classRoom->getLevel() .' ' . $classRoom->getPrefix() . ' ' . "result.pdf");
}
else
{
echo $html;*/
?>
<?php
//}
?>
<script type="javascript">
window.print();
</script>

Categories