<?php
error_reporting(0);
	$this->mypdf_class->tcpdf();

	global $cm_data_pdf;
	global $ct_data_pdf;
	global $yy;
	global $inc;

	$cm_data_pdf = $cm_data;
	$ct_data_pdf = $ct_data;
	$inc = 1;

	class MYPDF extends TCPDF
	{
		public function Header()
		{
			global $cm_data_pdf;
			$tbl_header 	= "";
			$customer		= $cm_data_pdf[0]['customer'] == '' ? '-' : strtoupper($cm_data_pdf[0]['customer']);
			$customer_gst	= $cm_data_pdf[0]['customer_gst'] == '' ? '' : '('.strtoupper($cm_data_pdf[0]['customer_gst']).')';
			$qbc_no = $cm_data_pdf[0]['qbc_no'] == '' ? '' : '-'.strtoupper($cm_data_pdf[0]['qbc_no']);
			if($qbc_no == ""){
			    $customer_mobile= $cm_data_pdf[0]['customer_mobile'] == '' ? '' : '-'.strtoupper($cm_data_pdf[0]['customer_mobile']);
			}else{ $customer_mobile=""; }
			
			$broker			= $cm_data_pdf[0]['broker'] == '' ? '-' : strtoupper($cm_data_pdf[0]['broker']);
			$broker_pan		= $cm_data_pdf[0]['broker_pan'] == '' ? '' : '('.strtoupper($cm_data_pdf[0]['broker_pan']).')';
			$broker_mobile	= $cm_data_pdf[0]['broker_mobile'] == '' ? '' : '-'.strtoupper($cm_data_pdf[0]['broker_mobile']);
			$broker_detail	= substr($broker.' '.$broker_mobile, 0, 65);

			$bank_rate 		= $cm_data_pdf[0]['bank_rate'] == '' ? '0.00' : $cm_data_pdf[0]['bank_rate'];
			$through		= substr(strtoupper($cm_data_pdf[0]['cm_through']), 0, 20);

			$entry_no		= $cm_data_pdf[0]['cm_entry_no'];
			$entry_date		= date('d-m-Y', strtotime($cm_data_pdf[0]['cm_entry_date']));
			$entry_time		= date('h:i a');
			$image      	= assets('img/logo_new.png');
			
			$tm      	= assets('img/tradem.png');
			$logo      		= assets('img/logo_new.png');
			
            $address =  isset($cm_data_pdf[0]['acc_address']) ? ', '.$cm_data_pdf[0]['acc_address'] : "";

			$this->SetFont('Times', '', 8);
			$tbl_header .= <<<EOD
				<table style="border-bottom:1px dashed black;">
					<tr>
						<td align="left" width="35%">
							<table border="0" cellpadding="8">
								<tr>
									<td>
										<u><b>REG. OFFICE ADD:- </b></u>
										<br>RUCHITA GEMS
										<br>D-8, ROOM NO.3, BHADRAN NAGAR, 
										<br>ROAD NO.1, BEHIND N.L.COLLEGE,
										<br>MALAD WEST, MUMBAI - 400064
										<br><b>TEL</b>   : xxxx .
										<b>QBC</b>   : xxx,
										<br><b>Mob</b>   : 9152094424 / 9869768852,
										<br><b>Email</b> : xxxxx@gmail.com
									</td>
								</tr>
							</table>
						</td>
						<td align="center" width="35%">
							<table border="0" cellpadding="1">
								<tr>
									<td>
										<img src="$logo" style="width:600%;height:600%;" />
										
									</td>
								</tr>
								<tr>
									<td>
										<table border="0" cellpadding="1">
											<tr>
												<td width="100%">
													<b style="font-size:18px;">RUCHITA GEMS </b><img src="$tm" style="width:150%;height:150%;" />
												</td>
											</tr>
										</table>
										<br/>
										<u style="font-size:12px;">DELIVERY CHALLAN</u>
									</td>
								</tr>
							</table>
						</td>
						<td align="right" width="30%">
							<table border="0" cellpadding="8">
								<tr>
									<td align="left" style="font-size:10px;">
										<b>
										<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GST NO
										&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- xxxxxxxx
										<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;HSN CODE &nbsp;- xxxxx
										</b>
									</td>
								</tr>
							</table>
						</td>
					</tr>
				</table>

EOD;
			$tbl_header .= <<<EOD
				<table border="0" cellpadding="0" cellspacing="2" style="font-size:11px;">
					<tr>
						<td width="85%" align="left">
							&nbsp;&nbsp;<b>Party,</b>&nbsp;&nbsp;&nbsp;<u>$customer $qbc_no $customer_mobile $customer_gst $address</u>
						</td>
						<td width="15%" align="left">
							<b></b>&nbsp;&nbsp;&nbsp;<u></u>
						</td>
					</tr>
					<tr>
						<td width="85%" align="left">
							&nbsp;&nbsp;<b>Broker</b>&nbsp;<u>$broker_detail</u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
							<b>Through</b>&nbsp;&nbsp;&nbsp;<u>$through</u>
						</td>
						<td width="15%" align="left">
							<b>Date:-</b>&nbsp;&nbsp;<u>$entry_date</u>
						</td>
					</tr>
					<tr>
						<td width="85%" align="left">
							&nbsp;&nbsp;Dear Sir,
						</td>
						<td width="15%" align="left">
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<u>$entry_time</u>
						</td>
					</tr>
					<tr>
						<td width="80%" align="left">
							&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
							Please receive the following cut & Polished Diamonds on approval for  sales &  assortment.
						</td>
						<td width="20%" align="left">
						</td>
					</tr>
				</table>

				<table border="1" cellpadding="1">
						<tr>
						<td width="5%" align="center"><br>SR No</td>
						<td width="8%" align="center"><br>Stock ID</td>
						<td width="7%" align="center"><br>Shape</td>
						<td width="7%" align="center"><br>Weight</td>
						<td width="6%" align="center"><br>Color</td>
						<td width="6%" align="center"><br>Clarity</td>
						<td width="6%" align="center"><br>Lab</td>
						<td width="7%" align="center"><br>Disc.</td>
						<td width="10%" align="center"><br>Rapaport ($)</td>						
						<td width="9%" align="center"><br>Price/CT</td>
						<td width="10%" align="center"><br>Amt</td>
						<td width="19%" align="center"><br>Notes</td>
					</tr>
				</table>
EOD;
// 			$this->writeHTMLCell(199, 139, 4, 4, $tbl_header, 1, 0, 0, true, 'L', true);
            $this->writeHTMLCell(197, 140, 4, 10, $tbl_header, 1, 0, 0, true, 'L', true);
            
			// $this->SetTopMargin(3);
				$yy = $this->GetY();
			$yy = $yy + 55.5;
			$this->line(13.9,$yy,13.9,109);
			$this->line(29.6,$yy,29.6,109);
			$this->line(43.5,$yy,43.5,109);
			$this->line(57.3,$yy,57.3,109);
			$this->line(69.2,$yy,69.2,109);
			$this->line(80.9,$yy,80.9,109);
			$this->line(92.8,$yy,92.8,109);
			$this->line(106.6,$yy,106.6,109);
			$this->line(126.2,$yy,126.2,109);
			$this->line(143.9,$yy,143.9,109);
			$this->line(163.5,$yy,163.5,109);

			$this->SetTopMargin($yy + 4);
		}

		public function Footer()
    	{
    		global $cm_data_pdf;
    		global $ct_data_pdf;
    		global $inc;
    		$cnt 			= count($ct_data_pdf)/10+1;
    		$cnt 			= explode('.', $cnt);
    		// echo "<pre>"; print_r($cnt);exit();
    		$cnt 			= $cnt[0];
    		$cnt1 			= $cnt + $cnt;
    		$tbl_footer 	= "";
    		$total_qty 		= $cm_data_pdf[0]['cm_total_qty'];
    		$total_amt 		= round($cm_data_pdf[0]['cm_total_amt']);
    		
    		$words			= number_to_word($total_amt);
    		
    		$total_rapnet 	= 0;
    		$avg_rapnet 	= 0;
    		$avg_rapnet1 	= '';
    		$avg_disc 		= 0;
    		$avg_disc1 		= '';
    		$total_weight 	= 0;
    		$total_disc_per	= 0;
    		$total_disc 	= 0;
    		$total_amt 		= 0;
    		$gst_per 		= '';
    		$gst_amt 		= '';
    		$gst_amt1 		= '';
            
            $tot_amt1 = 0; $total_disc1 = 0; $total_cert = 0; 
            
            
    		
    		//this is done rohit date 19-10-2022 
    		    $rapnet = 0;
    		    $total_ct_disc = 0;
        		$tot_amt_doller = 0;
        		$avr_tot_amt_doller =0;
        		$tot_wt_dm = 0;
    		//this is done rohit date 19-10-2022 
    		
    		if($inc == $cnt || $inc == $cnt1)
    		{
    			foreach ($ct_data_pdf as $key => $value)
				{
					$total_rapnet 	= $total_rapnet + $value['dm_rap'];
					$total_weight 	= $total_weight + $value['dm_wt'];
					$sub_amt 		= $value['dm_wt'] * $value['dm_rap'];
					$disc 			= $value['ct_dm_disc'];
	                $disc_amt 		= ($sub_amt * $disc)/100; // -1054
	                $total_disc 	= $total_disc + $disc_amt;
	                $total_disc_per = $total_disc_per + $disc; // -5
					$total_weight1 	= number_format($total_weight, 2);
					$total_amt 		= $total_amt + $value['ct_total_amt'];
					$total_amt1		= number_format($total_amt, 2);
					
					$wt             = $value['dm_wt'];
					$rapnet        += $value['dm_rap'] * $wt;
					$total_rap      = $value['dm_rap'];
                    
                    $total_cert = $total_rap*(100+($disc)) / 100;
                    $tot_amt1 += round(($total_cert * $wt), 2);
                    
                    //this is done rohit date 19-10-2022 
                        $tot_wt_dm += $value['ct_dm_wt'];
                        $per = $value['ct_dm_rap'] * ($value['ct_dm_disc']/100);
                        $ppc1 = $value['ct_dm_rap'] + $per;
                        $ppc = round($ppc1, 2);
                        
                        $dollar1 = round($ppc1 * $value['ct_dm_wt']);
                        $tot_amt_doller += round($dollar1, 2);
                    //this is done rohit date 19-10-2022 
				}
				
				//this is done rohit date 19-10-2022 
                  $avr_tot_amt_doller =  round(($tot_amt_doller/$tot_wt_dm),2);
                
				  $fdisc = (100 - (($tot_amt_doller/$rapnet)*100));
                //this is done rohit date 19-10-2022 
                
				// $fdisc = (1 - ($tot_amt1/$total_rapnet))*100;
				$fdisc = number_format($fdisc, 2);
				 
				if($cm_data_pdf[0]['acc_type'] == 1)
	    		{
	    			$gst_per = '(cgst & sgst : 0.125%)';
	    			$cgst_amt = number_format((($total_amt * 0.125) / 100), 2);
	    			$sgst_amt = number_format((($total_amt * 0.125) / 100), 2);

	    			$gst_amt1 = '('.$cgst_amt.' + '.$sgst_amt.')';


	    		}
	    		else if($cm_data_pdf[0]['acc_type'] == 2)
	    		{
	    			$gst_per = '(igst 0.25%)';
	    			$igst_amt = number_format((($total_amt * 0.25) / 100), 2);
	    			$gst_amt1 = '('.$igst_amt.')';
	    		}
	    		else
	    		{
	    			$gst_per = '';
	    			$gst_amt1 = '';
	    		}

	    		$avg_rapnet = ($total_weight > 0) ? $total_rapnet / $total_weight : 0;
	    		$avg_rapnet1= number_format($avg_rapnet, 2);

	    		$avg_disc = $total_disc_per / count($ct_data_pdf);
	    		// $avg_disc1= number_format($avg_disc, 0).'%';
	    		$avg_disc1= $avg_disc < 0 ? ceil($avg_disc).'%' : floor($avg_disc).'%' ;


				$tbl_footer .= <<<EOD
    			<table style="border-top:1px solid black;" cellpadding="3">
    				<tr>
    				    <td width="17.5%"  align="center" style="border-bottom:1px solid black;"><b>TOTAL</b></td>
    					<td width="8%" align="right" style="border-bottom:1px solid black;">
    						<b style="font-size:9px;">$total_weight1</b>
    					</td>
    					<td width="3%" align="left" style="border-bottom:1px solid black;">
    					
    					</td>
    					<td width="36%" align="center" style="border-bottom:1px solid black;">
    						<b style="font-size:9px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Avg. $fdisc</b>
    					</td>
    					<td width="11%" align="center" style="border-bottom:1px solid black;">
    						<b style="font-size:9px;">Avg. $avr_tot_amt_doller</b>
    					</td>
    					<td width="23%" align="left" style="border-bottom:1px solid black;">
    						<b style="font-size:9px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $tot_amt_doller</b>
    					</td>
    				</tr>
					<tr>
						<td width="70%">
							<b style="font-size:8px;">
							ACKNOWLEDGEMENT OF ENTRUSTMENT
							</b>

							<br>
							<small>
								We hereby entrust to you the following goods for manufacturing/ inspection on approval basis with the following conditions
								<br>
								&nbsp;
								1. The goods remain our property
								<br>
								&nbsp;
								2. You will not sale or pledge or mortgage the said goods or otherwise deal with them in any manner which is prejudicial to our rights.
								<br>
								&nbsp;
								3. The goods will be returned to us forthwith on demand
								<br>
								&nbsp;
								4. The goods will be held while in your custody at your risk in all aspects
								<br>
								&nbsp;
								5. You will be responsible for the said goods in the same condition in which it was given to you or polished if it was given for manufacturing as per particular description
								<br>
								&nbsp;
								6. Subject to MUMBAI JURISDICTION.
							</small>
						</td>
						<td width="30%">
							<b>Terms & Condition</b><br/>
							<span>1. Goods damaged will be considered sold.<br>2. Challan valid in Mumbai city only.<br>3. Challan valid for 7 Days only.</span><br/>
							<b style="text-align:center">For RUCHITA GEMS</b>
						</td>
					</tr>
					<tr>
						<td></td>
					</tr>
					<tr>
						<td width="40%" align="center">
							------------------------------------
							<b style="font-size:8px;">Reciever Signature</b>
						</td>
						<td width="40%" align="left">
							------------------------------------
							<b style="font-size:8px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Through Sign</b>
						</td>
						<td width="20%"><b>DIRECTOR</b></td>
					</tr>
				</table>
EOD;
    		}
    		else
    		{
    			$tbl_footer .= <<<EOD
    			<table style="border-top:1px solid black;" cellpadding="3">
    				<tr>
    				<td width="98.5%" style="border:1px solid black;">   </td>
    				</tr>
					<tr>
						<td width="70%">
							<b style="font-size:8px;">
							ACKNOWLEDGEMENT OF ENTRUSTMENT
							</b>
							<small>
								We hereby entrust to you the following goods for manufacturing/ inspection on approval basis with the following conditions
								<br>
								&nbsp;
								1. The goods remain our property
								<br>
								&nbsp;
								2. You will not sale or pledge or mortgage the said goods or otherwise deal with them in any manner which is prejudicial to our rights.
								<br>
								&nbsp;
								3. The goods will be returned to us forthwith on demand
								<br>
								&nbsp;
								4. The goods will be held while in your custody at your risk in all aspects
								<br>
								&nbsp;
								5. You will be responsible for the said goods in the same condition in which it was given to you or polished if it was given for manufacturing as per particular description
								<br>
								&nbsp;
								6. Subject to MUMBAI JURISDICTION.
							</small>
						</td>
						<td width="30%">
							<b>For RUCHITA GEMS</b><br/>
							<span>1. Goods damaged will be considered sold.<br>2. Challan valid in Mumbai city only.<br>3. Challan valid for 7 Days only.</span><br/>
							<b style="text-align:center">For V-DIAM GEMS PVT LTD</b>
						</td>
					</tr>
					<tr>
						<td></td>
					</tr>
					<tr>
						<td width="40%" align="center">
							------------------------------------
							<b style="font-size:8px;">Reciever Signature</b>
						</td>
						<td width="40%" align="left">
							------------------------------------
							<b style="font-size:8px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Through Sign</b>
						</td>
						<td width="20%"><b>DIRECTOR</b></td>
					</tr>
				</table>
EOD;
    		}


		  //	$this->writeHTMLCell(199, 139, 4, 101, $tbl_footer, 0, 0, 0, true, 'L', true);
		  	$this->writeHTMLCell(200, 140, 4, 109, $tbl_footer, 0, 0, 0, true, 'L', true);
        	// Set font
        // 	$this->SetFont('helvetica', 'I', 6);
        	// $this->startPageGroup();
        	// Page number
        // 	$this->Cell(1, 90, 'Page '.$this->getAliasNumPage().'/'.$this->getAliasNbPages(), 0, false, 'C', 0, '', 0, false, 'T', 'M');
        	$inc++;
    	}
	}

	// create new PDF document
	$pdf = new MYPDF('L', PDF_UNIT, array(205, 155), true, 'UTF-8', false);
	// set document information
	$pdf->SetCreator(PDF_CREATOR);
	$pdf->SetAuthor('Imran Khan');
	$pdf->SetTitle('JANGAD ISSUE Pdf');
	$pdf->SetSubject('JANGAD ISSUE Pdf');

	// set default header data
	$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING);

	// set header and footer fonts
	$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
	$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));

	// set default monospaced font
	$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);

	// set margins
	$pdf->SetMargins(7, 5, 5);
	$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
// 	$pdf->SetFooterMargin(50);

	// set auto page breaks
	$pdf->SetAutoPageBreak(TRUE, 45);

	// set image scale factor
	$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);

	// set some language-dependent strings (optional)
	if (@file_exists(dirname(__FILE__).'/lang/eng.php'))
	{
	    require_once(dirname(__FILE__).'/lang/eng.php');
	    $pdf->setLanguageArray($l);
	}


	$pdf->SetFont('Helvetica', '', 7.5);
	$tbl = "";

	$pdf->AddPage('L');

	$tbl .= <<<EOD
			<table cellpadding="1">
EOD;
            $notes	= $cm_data_pdf[0]['cm_notes'] == '' ? '' : strtoupper($cm_data_pdf[0]['cm_notes']);
			$total_weight = 0;
			$total_amt = 0;
			foreach ($ct_data_pdf as $key => $value)
			{
				$sr_no 		= $key + 1;
				$code 		= strtoupper($value['dm_code']);
				$sh 		= strtoupper($value['dm_sh']);
				$wt 		= strtoupper($value['dm_wt']);
				$col 		= strtoupper($value['dm_col']);
				$cla 		= strtoupper($value['dm_cla']);
				// $cut 		= strtoupper($value['dm_cut']);
				// $pol 		= strtoupper($value['dm_pol']);
				// $sym 		= strtoupper($value['dm_sym']);
				// $fl 		= strtoupper($value['dm_fl']);
				$lab 		= strtoupper($value['dm_lab']);
				$disc 		= $value['ct_dm_disc'] > 0 ? "+".$value['ct_dm_disc'] : $value['ct_dm_disc'];
				$disc1 		= $disc < 1 ? $disc.'%' : $disc.'%' ;
				$rap 		= strtoupper($value['dm_rap']);
				$amt 		= strtoupper($value['ct_total_amt']);
				$total_weight = $total_weight + $value['dm_wt'];
				
				$discount = str_replace("-","",$value['dm_disc']);
				
                $total_rap = $value['dm_rap'];
                $total_cert = round($total_rap*(100 - $discount) / 100);
                $tot_amt = round($total_cert * $wt);
                
                $per = $value['ct_dm_rap'] * ($value['ct_dm_disc']/100);
                $ppc1 = $value['ct_dm_rap'] + $per;
                $ppc = round($ppc1, 2);
                
                $dollar1 = round($ppc1 * $value['ct_dm_wt']);
                $dollar = round($dollar1, 2);
                
				$tbl .= <<<EOD
					<tr>
						<td width="4%" align="left" >$sr_no</td>
						<td width="8%" align="left">$code</td>
						<td width="7%" align="center">$sh</td>
						<td width="8%" align="left">&nbsp;&nbsp;&nbsp; $wt</td>
						<td width="5%" align="center">$col</td>
						<td width="6%" align="center">&nbsp;&nbsp;$cla</td>
						<td width="6%" align="center">&nbsp;&nbsp;$lab</td>
						<td width="7%" align="center">&nbsp;&nbsp;&nbsp;$disc1</td>
						<td width="10%" align="center">&nbsp;&nbsp;$rap</td>
						<td width="9%" align="center">&nbsp;&nbsp;&nbsp;&nbsp;$ppc</td>
						<td width="10%" align="center">&nbsp;&nbsp;&nbsp;&nbsp;$dollar</td>
						<td width="19%" align="center">$notes</td>
					</tr>
EOD;
			}

	$tbl .= <<<EOD
				</table>
EOD;
	$pdf->writeHTML($tbl, true, false, false, false, '');

$tbl = "";

	$pdf->AddPage('L');

	$tbl .= <<<EOD
			<table cellpadding="1">
EOD;
			$total_weight = 0;
			foreach ($ct_data_pdf as $key => $value)
			{
				$sr_no 		= $key + 1;
				$code 		= strtoupper($value['dm_code']);
				$sh 		= strtoupper($value['dm_sh']);
				$wt 		= strtoupper($value['dm_wt']);
				$col 		= strtoupper($value['dm_col']);
				$cla 		= strtoupper($value['dm_cla']);
				// $cut 		= strtoupper($value['dm_cut']);
				// $pol 		= strtoupper($value['dm_pol']);
				// $sym 		= strtoupper($value['dm_sym']);
				// $fl 		= strtoupper($value['dm_fl']);
				$lab 		= strtoupper($value['dm_lab']);
				$disc 		= $value['ct_dm_disc'] > 0 ? "+".$value['ct_dm_disc'] : $value['ct_dm_disc'];
				$disc1 		= $disc < 1 ? $disc.'%' : $disc.'%' ;
				$rap 		= strtoupper($value['dm_rap']);
				$amt 		= strtoupper($value['ct_total_amt']);
				$total_weight = $total_weight + $value['dm_wt'];
				
				$discount = str_replace("-","",$value['dm_disc']);
                $total_rap = $value['dm_rap'];
                $total_cert = round(($total_rap*(100-$discount)) / 100);
                $tot_amt = round($total_cert * $wt);
                
                $per = $value['ct_dm_rap'] * ($value['ct_dm_disc']/100);
                $ppc1 = $value['ct_dm_rap'] + $per;
                $ppc = round($ppc1, 2);
                
                $dollar1 = round($ppc1 * $value['ct_dm_wt']);
                $dollar = round($dollar1, 2);
				$tbl .= <<<EOD
					<tr>
						<td width="4%" align="left" >$sr_no</td>
						<td width="8%" align="left">$code</td>
						<td width="7%" align="center">$sh</td>
						<td width="8%" align="left">&nbsp;&nbsp;&nbsp; $wt</td>
						<td width="5%" align="center">$col</td>
						<td width="6%" align="center">&nbsp;&nbsp;$cla</td>
						<td width="6%" align="center">&nbsp;&nbsp;$lab</td>
						<td width="7%" align="center">&nbsp;&nbsp;&nbsp;$disc1</td>
						<td width="10%" align="center">&nbsp;&nbsp;$rap</td>
						<td width="9%" align="center">&nbsp;&nbsp;&nbsp;&nbsp;$ppc</td>
						<td width="10%" align="center">&nbsp;&nbsp;&nbsp;&nbsp;$dollar</td>
						<td width="19%" align="center">$notes</td>
					</tr>
EOD;
			}

	$tbl .= <<<EOD
				</table>
EOD;
	$pdf->writeHTML($tbl, true, false, false, false, '');

	// $pdf->writeHTMLCell(188, 150, 6, 134, $tbl, 0, 0, 0, true, 'P', true);
	$pdf->IncludeJS("print();");
	// ---------------------------------------------------------

	//Close and output PDF document
	ob_end_clean();
	$pdf->Output('JANGAD ISSUE.pdf', 'I');
	//============================================================+
	// END OF FILE
	//============================================================+
