<?php
include_once('details.php');

	$compName = $dat['company'];
	$compEmail = $dat['email'];
	$compPhone = $dat['phone'];
	
	$compwatermark = $dat['company']." "." Airtime Contacts";
	
//<img src="images/logo.png" height="100px;">

$html = '
<html>
<head>
<style>
body {font-family: sans-serif;
	font-size: 10pt;
}
p {	margin: 0pt; }
table.items {
	border: 0.1mm solid #000000;
}
td { vertical-align: top; }
.items td {
	border-left: 0.1mm solid #000000;
	border-right: 0.1mm solid #000000;
}
table thead td { background-color: #EEEEEE;
	text-align: center;
	border: 0.1mm solid #000000;
	font-variant: small-caps;
}
.items td.blanktotal {
	background-color: #EEEEEE;
	border: 0.1mm solid #000000;
	background-color: #FFFFFF;
	border: 0mm none #000000;
	border-top: 0.1mm solid #000000;
	border-right: 0.1mm solid #000000;
}
.items td.totals {
	text-align: right;
	border: 0.1mm solid #000000;
}
.items td.cost {
	text-align: "." center;
}
</style>
</head>
<body>

<!--mpdf
<htmlpageheader name="myheader">
<table  width="100%" style="font-size: 12pt;"  >
<tr>
<td width="15%">
<img src="'.$photo.'" height="100px;" style="margin-right:30px;">
</td>
<td width="100%" class="headerData" ><h2>'.$compName.'</h2><br> Email: '.$compEmail.' <br>Tel: '.$compPhone.'<br>
<td>
</tr>
<tr> <td></td><td></td> </tr>
<tr><td></td>   <td><strong>Airtime Contacts</strong></td></tr>
</table>
</htmlpageheader>

<htmlpagefooter name="myfooter">
<div style="border-top: 1px solid #000000; font-size: 10pt; text-align: center; padding-top: 3mm; ">
Page {PAGENO} of {nb}
</div>
</htmlpagefooter>

<sethtmlpageheader name="myheader" value="on" show-this-page="1" />
<sethtmlpagefooter name="myfooter" value="on" />
mpdf-->



<table class="items" width="100%" style="font-size: 10pt; border-collapse: collapse; margin-left: 20px;" cellpadding="8">
<thead>
<tr>
<td width="8%"> No.</td>
<td width="20%">Name</td>
<td width="10%">Contact</td>
<td width="30%">Group</td>
</tr>
</thead>
<tbody>
<!-- ITEMS HERE -->
';

 $num = 0; 
          $sql = mysql_query("select * from airtime_contacts where customer_id = '$session_id' order by contact_id ASC ");
                                                   	
					if(mysql_num_rows($sql) > 0 ){
						
  while($dt=mysql_fetch_array($sql))
                
			  { 
			  $num++;
			    $gid = $dt['group_id'];	
				$grup = "";
				if($dt['group_id'] == 0 ){
					$grup = "Not Allocated";
				}else{
					$s2 = mysql_query("select * from airtime_groups where group_id = '$gid' and customer_id = '$session_id' ");
					$rw= mysql_fetch_array($s2);
					$grup = $rw['name'];
				}
			  
$html .= '
<tr>
<td align="center">'.$num.'</td>
<td>'.$dt['fname'].'</td>
<td >'. $dt['contact'].' </td>
<td>'.$grup.'</td>

</tr>
';
}}
$html .= '


<!-- END ITEMS HERE -->


</tbody>
</table>





</body>
</html>
';
//==============================================================
//==============================================================
//==============================================================
//==============================================================
//==============================================================
//==============================================================

define('_MPDF_PATH','/');
include("mpdf.php");

$mpdf=new mPDF('c','A4-P','','',10,15,48,25,10,10); 

$mpdf->allow_charset_conversion=true;
$mpdf->charset_in='ISO-8859-2';
$mpdf->SetProtection(array('print'));
$mpdf->SetTitle("".$compwatermark."");
$mpdf->SetAuthor("".$compwatermark."");
$mpdf->SetWatermarkText("".$compwatermark."");
$mpdf->showWatermarkText = true;
$mpdf->watermark_font = 'DejaVuSansCondensed';
$mpdf->watermarkTextAlpha = 0.1;
$mpdf->SetDisplayMode('fullpage');
$mpdf->WriteHTML($html);


$mpdf->Output();

exit;

?>