| Server IP : 172.67.216.113 / Your IP : 104.23.243.33 [ Web Server : Apache System : Linux cpanel01wh.bkk1.cloud.z.com 2.6.32-954.3.5.lve1.4.59.el6.x86_64 #1 SMP Thu Dec 6 05:11:00 EST 2018 x86_64 User : cp648411 ( 1354) PHP Version : 7.2.34 Disable Function : NONE Domains : 0 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/cp648411/www/ilawasia.onnud20.com/Report/ |
Upload File : |
<?php
//============================================================+
// File name : example_061.php
// Begin : 2010-05-24
// Last Update : 2014-01-25
//
// Description : Example 061 for TCPDF class
// XHTML + CSS
//
// Author: Nicola Asuni
//
// (c) Copyright:
// Nicola Asuni
// Tecnick.com LTD
// www.tecnick.com
// [email protected]
//============================================================+
/**
* Creates an example PDF TEST document using TCPDF
* @package com.tecnick.tcpdf
* @abstract TCPDF - Example: XHTML + CSS
* @author Nicola Asuni
* @since 2010-05-25
*/
$Set_title='QuotationRetainerClient';
$Set_filename='QuotationRetainerClient.pdf';
// Include the main TCPDF library (search for installation path).
require_once('tcpdf_include.php');
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor($Set_title);
$pdf->SetTitle($Set_title);
$pdf->SetSubject($Set_title);
$pdf->SetKeywords($Set_title);
// set default header data
//$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 061', 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));
// remove default header/footer
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// 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);
}
// ---------------------------------------------------------
// set font
//$pdf->SetFont('helvetica', '', 10);
define('TH_REGULAR', TCPDF_FONTS::addTTFfont('../fonts/THSarabunNew.ttf', 'TrueTypeUnicode'));
define('TH_BOLD', TCPDF_FONTS::addTTFfont('../fonts/TH Sarabun New Bold.ttf', 'TrueTypeUnicode'));
$pdf->SetFont(TH_REGULAR, '', 14);
// add a page
$pdf->AddPage('L', 'A4');
/* NOTE:
* *********************************************************
* You can load external XHTML using :
*
* $html = file_get_contents('/path/to/your/file.html');
*
* External CSS files will be automatically loaded.
* Sometimes you need to fix the path of the external CSS.
* *********************************************************
*/
// define some HTML content with style
header('Content-type: text/plain');
//header('Content-type: text/html');
//header('Content-type: application/json');
$request = array(
'StartDate' => @$_GET['StartDate'],
'EndDate' => @$_GET['EndDate'],
'CustomerId' => @$_GET['CustomerId']
);
$data = $report_db->QuotationRetainerClientExcelandPdf($request);
$arrayData = $data;
$totalRow = count($data);
$columnName = ["Date","Client","Receipt No.","Reference No.","Net","Tax","Gross"];
$CaseId='';
$ct = 0;
$mms = "TaskDate(Start): ".@$_REQUEST['StartDate']." , TaskDate(End): ".@$_REQUEST['EndDate']." , Customer: - ";
$image = "../Assets/logo_blue-01.png";
//$image = "public_html/corporatemodule/Assets/logo_blue-01.png";
$template = file_get_contents('Pdf/_QuotationRetainerClient.html', r);
$temp1 = explode("style>", $template);
$temp1 = str_replace("</","", $temp1[1]);
$temp2 = explode("<body>", $template);
$temp2 = explode("</body>", $temp2[1]);
$temp2 = $temp2[0];
//$temp2 = str_replace("</","", $temp2[1]);
/*
echo strlen($Load['Data']);
echo count($Load['Data']);
echo $temp2 ;
echo count($data['Data']);
echo "<pre>";
print_r($month_en_shot);
echo "</pre>";
*/
if(count($data['Data']) > 1){
$customerName = "-"; $stDate = "-"; $nDate = "-";
$stDate = $_GET['StartDate'];
$nDate = $_GET['EndDate'];
if(@$_GET['CustomerId']){
$customerName = $customer_db->Index($request);
$customerName =$customerName['Data'][0]['NamesName'];
}
foreach ($data['Data'] as $key => $value) {
$monthName = $util_class->month_shotc($value['Month']);
//$monthName = $value['Month'];
$groupHead = $monthName . " ". $value['Year'];
if($lastMonth != $groupHead){
$content .= "<tr><td colspan='4'><b>" . $groupHead . "</b></td></tr>";
$lastMonth = $groupHead;
}
$content .= "<tr>".
"<td style='text-align:center;'>" . $value['QuotationNo'] . "</td>".
"<td style='text-align:center;'>" . $value['CaseNumber'] . "</td>".
"<td style='text-align:left;'>" . $value['CaseDescription'] . "</td>".
"<td style='text-align:center;'>" . $value['CustomerCode'] . "-" . $value['CustomerName'] . "</td>".
"</tr>";
}
$template = str_replace("[startDate]",$stDate, $temp2 );
$template = str_replace("[endDate]",$nDate, $template );
$template = str_replace("[customer]",$customerName, $template );
$template = str_replace("[content]",$content, $template );
}else {
$template = '<h1 style="text-align: center;">No data found</h1>';
}
//echo $temp1;
//exit();
$html = <<<EOF
<!-- EXAMPLE OF CSS STYLE -->
<style>
$temp1
</style>
$template
EOF;
//echo $html;
//exit();
// output the HTML content
$pdf->writeHTML($html, true, false, true, false, '');
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// reset pointer to the last page
$pdf->lastPage();
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output($Set_filename, 'I');
//============================================================+
// END OF FILE
//============================================================+