<?php
include ('class.ezpdf.php');
include 'includes/config.php';
include 'defs.php';
$pdf = new Cezpdf('A4','landscape');
$pdf->selectFont('fonts/Times-Roman.afm');
$pdf->addJpegFromFile('images/logo1.jpg',30,500,70);
//$pdf->addText(18,750,9,"MIS GENERATED REPORT");
$date1=Date("j-n-Y");
//$pdf->ezStartPageNumbers(526, 16, 10, 'right', '', 1);
$pdf->setColor(0.72, 0.72, 0.72);
$pdf->filledRectangle(220, 770, 160, 30, 'rgb');
$pdf->setColor(0,0,0);
//$pdf->addText(265,500,13,"<b>(GLAKB)</b>");
$pdf->addText(20,480,12,"<b>(CUSTOMER DETAILS - Dated:      $date1)</b>");
$pdf->ezSetDy(-100);






$header = $pdf->openObject();
$pdf->addText(20, 16, 10, "<b>Contact us @</b> Sabzal Road - Block No 3, STN Colony, Near Spini Road, Quetta (+92 81 2873538)");
$pdf->addText(20, 30, 10, "<b>________________________________________________________________________________________________________________</b>");

$pdf->closeObject();
$pdf->addObject($header, "all");


    //$pdf->addText(3,700,15,"___________________________________________________________________________________________________");

$date1=Date("j-n-Y");
//$pdf->addText(260,740,11,"<b>(As on $date1)</b>");

$nResult = MySQLi_Query($link, "Select * from acc_heads where M_Head='Customer' order by A_Id ");

$count=0;
$one=1;
$bal=0;
$tdeb=0;
$tcre=0;
while($rstRow = mysqli_fetch_array($nResult))
                {
$rp=$rstRow['R_Price'];
$ucart=$rstRow['Carton_Qty'];
$lit=$rstRow['Unit_Liter'];
$tpl=$rp*$lit;
$tpc=$tpl*$ucart;

$tpl1=number_format($tpl, 0);        
$tpc1=number_format($tpc, 0);        
$rp1=number_format($rp, 0);        

$count=$one+$count;

$data[] = array('num'=>$count,'fname'=>$rstRow['A_Id'],'name'=>$rstRow['Name'],'cty'=>$rstRow['City'],'prov'=>$rstRow['Province'],'dued'=>$rstRow['Dued'],'tpl'=>$rstRow['Warehouse'],'tpc'=>$rstRow['C_Limit'],'sman'=>$rstRow['Salesman'],'tc'=>$rstRow['Ctype']);
}

$cols = array('num'=>'<b>S. No</b>','fname'=>'<b>Customer ID</b>','name'=>'<b>Name</b>','cty'=>'<b>City</b>','prov'=>'<b>Province</b>','dued'=>'<b>Due Days</b>','tpl'=>'<b>Target Warehouse</b>','tpc'=>'<b>Credit Limit</b>','sman'=>'<b>Salesman</b>','tc'=>'<b>Cust-Type</b>');

$pdf->ezTable($data,$cols,'',
        array('xPos'=>20,'xOrientation'=>'right','fontSize' => 9,'width'=>680,'showHeadings'=>1,'shaded'=>0, 'showLines'=>2,'cols'=>array(
                'num'=>array('justification'=>'center','width'=>38),
                 'fname'=>array('justification'=>'left','width'=>80),
                  'name'=>array('justification'=>'left','width'=>180),
                 'cty'=>array('justification'=>'center','width'=>90),
                 
                 'prov'=>array('justification'=>'center','width'=>80),
                 'dued'=>array('justification'=>'center','width'=>60),
                'tpl'=>array('justification'=>'center','width'=>60),
                   
                 'tpc'=>array('justification'=>'right','width'=>70),
                   'sman'=>array('justification'=>'left','width'=>85),
                     'tc'=>array('justification'=>'center','width'=>70)
                     
                 
             )));



$pdf->ezSetDy(-20);


//$pdf->ezText("<b>****GLAKB has Exclusive Rights to change the Price with / without Prior Notice.</b>", 12, array("justification" => 'left'));

          
$pdf->ezSetDy(-40);





$pdf->ezText("<b>Owner GLAKB</b>", 12, array("justification" => 'right'));

ob_clean();
$pdf->ezStream();
?>



