<?php
ob_start();
tcpdf();
$date= date("D-M-Y ");

$obj_pdf = new TCPDF('P', PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$obj_pdf->SetCreator(PDF_CREATOR);
$title =   "Statement ".$date;
$obj_pdf->SetTitle($title);
//$obj_pdf->SetHeaderData(null, PDF_HEADER_LOGO_WIDTH, $title, NULL);
$obj_pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$obj_pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
$obj_pdf->SetDefaultMonospacedFont('helvetica');
$obj_pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$obj_pdf->SetFooterMargin(PDF_MARGIN_FOOTER);

$obj_pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);


$obj_pdf->SetMargins(PDF_MARGIN_LEFT, 3, PDF_MARGIN_RIGHT);


$obj_pdf->SetFont('helvetica', '', 8);
$obj_pdf->setFontSubsetting(false);
   $obj_pdf->setFontSubsetting(true); 
  $obj_pdf->SetHeaderData(false);
	 $obj_pdf->setPrintHeader(false);
    $obj_pdf->setFooterData(array(0,64,0), array(0,64,128));    
  $obj_pdf->SetFont('dejavusans', '', 8, '', true); 
$obj_pdf->AddPage();
$data['invoice'] = $this->accomodationmodel->getstatement($plotno,$status,$fromdate,$todate);
$data['other'] = $this->accomodationmodel->getotherstatement($plotno,$status,$fromdate,$todate);


$data['expenditure'] = $this->accomodationmodel->getexpenditure($plotno,$plotstatus,$fromdate,$todate);

	$data['tenant'] = $this->accomodationmodel->gettenantid($plotno,$houseno);
		$data['charges'] = $this->accomodationmodel->getplotcharges($plotno,$houseno);
    // we can have any view part here like HTML, PHP etc
			$data['vacant'] = $this->accomodationmodel->getvacanthouse($plotno);

	$data['fromdate']= $fromdate;
		$data['todate']=$todate;
		$data['status']=$status;
	
	
	
	
	$content=$this->load->view('pmsdata/statementemplate',$data);
   //$content = "robert";
$content = ob_get_contents();
ob_end_clean();
$obj_pdf->writeHTML($content, true, false, true, false, '');
header("Content-type:application/pdf");
$obj_pdf->Output($title.'.pdf', 'I');

exit;
?>