AnonSec Shell
Server IP : 172.67.216.113  /  Your IP : 104.23.243.33   [ Reverse IP ]
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/Invoice/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /home/cp648411/www/ilawasia.onnud20.com/Invoice/ExportPdf.php
<?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
 */
  // Include the main TCPDF library (search for installation path).
  require_once('tcpdf_include.php');

  $Load = $invoice_db->ExportPdf($_GET['Id']);

  $data = $Load['Data'][0];
  $data2 = $Load['Data2'];
  $data3 = $Load['Data3'][0];

  $Set_title = $data['InvoiceNo'];
  $Set_filename = 'InvoiceNo.pdf';
  /*
  echo "<pre>";
  print_r($Load);
  echo "</pre>";
  exit();
  */

$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor($Set_title);
$pdf->SetTitle($Set_title);
$pdf->SetSubject($Set_title);
$pdf->SetKeywords($Set_title);

// 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();

// define some HTML content with style
header('Content-type: text/plain');
$request = array(
  'StartDate' => @$_GET['StartDate'],
  'EndDate' => @$_GET['EndDate'],
  'CustomerId' => @$_GET['CustomerId'],
);

$image = "../Assets/logo_blue-01.png";
//$image = "public_html/corporatemodule/Assets/logo_blue-01.png";

$template = file_get_contents('Pdf/_Export.html', r);
//echo $template;

$temp1 = explode("style>", $template);
$temp1 = str_replace("</","", $temp1[1]);

$temp2 = explode("<body>", $template);
$temp2 = explode("</body>", $temp2[1]);
$temp2 = $temp2[0];

$content = ""; $content2 = "";
$total = 0; $totalExcludeVat = 0;
$vatAmount=0; $netTotal=0;
$isConsultService=($data['IsConsultService']==1)?1:0;
if(!@$isConsultService){ //0

  if(count($Load['Data2'])>0){
    foreach ($data2 as $key => $value) {
      $txt_Remark = ($value['Remark']=='')? $value['Description']:$value['Remark'];
      $borderedbottom  = "";
      $co = count($Load['Data2'])-1;
      if($key == $co){
        $borderedbottom = "bordered-bottom";
      }
      $content .= '<tr>'.
                '<td class="bordered-left '.$borderedbottom.'" colspan="2" style="width:80%; ">'.$txt_Remark.'</td>'.
                '<td class="bordered-left-right '.$borderedbottom.'" style="text-align: right;width:20%;">'.number_format($value['Amount'],2).'</td>'.
                '</tr>';

      $total_txt = ($total==0)?"Charged Total" : "";
      $content2 .= '<tr>'.
                '<td class="bordered0" style="width: 20%;"><strong> '. $total_txt .'</strong></td>'.
                '<td class="bordered0" style="width: 55%;"><strong> '. $txt_Remark .'</strong></td>'.
                '<td class="bordered0" style="width: 15%;text-align: right;"><strong> '. number_format($value['Amount'],2) .'</strong></td>'.
                '<td class="bordered0" style="width: 10%;text-align: right;"><strong> '. strtoupper($data['Currency']) .'</strong></td>'.
                '</tr>';

      if($value['IsExcludeVat']!=1){
        $total = floatval($total) + floatval($value['Amount']);
      }else{
        $totalExcludeVat = floatval($totalExcludeVat) + floatval($value['Amount']);
      }
    }

  }else {
    $content .= '<tr>'.
              '<td class="bordered0 no-top no-bottom" colspan="2" style="border: 0px solid transparent;width:80%;"></td>'.
              '<td class="bordered0 no-left no-top no-bottom" style=" text-align: right;border: 0px solid transparent;width:20%;">0.00</td>'.
              '</tr>';

    $content2 .= '<tr>'.
              '<td class="bordered0" style="width: 15%;"><strong></strong></td>'.
              '<td class="bordered0" style="width: 40%;"><strong> </strong></td>'.
              '<td class="bordered0" style="width: 15%;text-align: right;"><strong></strong></td>'.
              '<td class="bordered0" style="width: 30%;text-align: right;"><strong> </strong></td>'.
              '</tr>';
  }



}else {
  foreach ($data2 as $key => $value) {
    $ActionDate = (@$value["ActionDate"]=='')?'':@$value["ActionDate"];
    $txt_Remark = ($value['Remark']=='')? $value['Description']:$value['Remark'];
    if($ActionDate!=''){
      $ActionDate = $util_class->date_chang_2($ActionDate);
    }
    if($value['CaseDisburseId']!=0){
      $sql = array('table' => 'ct_case_disbursement', 'where'=> 'CaseDisburseId = "'.$value['CaseDisburseId'].'"');

    }
    if($value['CaseExpenseId']!=0){
      $sql = array('table' => 'ct_case_expense', 'where'=> 'CaseExpenseId = "'.$value['CaseExpenseId'].'"');

    }
    $view = $view_db->view($sql);
    $result = $view_db->q_re($view);
    $result_num = $view_db->q_nr($result);
    if($result_num>0){
      $row = $view_db->q($view);
      $Category =$row['Category'];
    }



    $content2 .='<tr>'.
                '<td style="border: none;width: 15%;">'. $ActionDate .'</td>'.
                '<td style="border: none;width: 15%;">'. $Category .'</td>'.
                '<td style="border: none;width: 40%;">'. $value['Description'] .' '. $value['Remark'] .'</td>'.
                '<td style="border: none;text-align:right;none;width: 30%;" colspan="2" ><strong>'. number_format($value['Amount'],2) .'</strong ></td>'.
              '</tr>';


      if($value['IsExcludeVat']!=1){
        $total = floatval($total) + floatval($value['Amount']);
      }else{
        $totalExcludeVat = floatval($totalExcludeVat) + floatval($value['Amount']);
      }
      $total_n = floatval($total) + floatval($totalExcludeVat);

      /*
      if(count($Load['Data2']) <= 16 ){
        $content .= '<tr>'.
        '<td class="bordered0 no-top no-bottom" colspan="2" style="border: 1px solid rgb(82, 86, 89);width:80%;">'.$txt_Remark.'</td>'.
        '<td class="bordered0 no-left no-top no-bottom" style=" text-align: right;border: 1px solid rgb(82, 86, 89);width:20%;">'.number_format($value['Amount'],2).'</td>'.
        '</tr>';

      }
      */
  }

  $content .= '<tr>' .
  '<td class="bordered no-top no-bottom" colspan="2" style="border: 1px solid rgb(180,180,180,.5);width:80%;">Expense (See Billing Details) :</td>' .
  '<td class="bordered no-left no-top no-bottom" style=" text-align: right;border: 1px solid rgb(180,180,180,0.5);width:20%;">' . number_format($total_n,2) . '</td>' .
  '</tr>';
  /*
  if(count($Load['Data2']) > 16 ){
  }
  */
    /*
    $content .= '<tr>' .
    '<td class="bordered no-top no-bottom" colspan="2" style="border: 1px solid rgb(180,180,180,.5);width:80%;">'. $value['Description'] .'</td>' .
    '<td class="bordered no-left no-top no-bottom" style=" text-align: right;border: 1px solid rgb(180,180,180,0.5);width:20%;">' . number_format($total_n,2) . '</td>' .
    '</tr>';

*/

}

$cusName=$data['NamesName'];
$address=$data['PostalAddress'];
$taxID=$data['TaxID'];
$docNo=$data['InvoiceNo'];
$qouNo=$data['QuotationNo'];
$matNo=$data3['CaseNumber'];
$webUrl = "..";
if($data['UpdateDateTime']!=''){
  $date=date_create($data['UpdateDateTime']);
  $date_new_format = date_format($date,"F j, Y");
}else{
  $date=date_create($data['CreateDateTime']);
  $date_new_format = date_format($date,"F j, Y");
}
/*
echo $date_new_format;
exit();
*/
$template = str_replace("[webUrl]",$webUrl, $temp2 );
$template = str_replace("[docNo]",$docNo, $template );
$template = str_replace("[qouNo]",$qouNo, $template );
$template = str_replace("[matNo]",$matNo, $template );
//$template = str_replace("[date]",$date_format, $template );
$template = str_replace("[date]",$date_new_format, $template );
$template = str_replace("[cusName]",$cusName, $template );
$template = str_replace("[address]",$address, $template );
$template = str_replace("[taxID]",$taxID, $template );
$template = str_replace("[currency]",strtoupper($data['Currency']), $template );

$vat = $data['Vat'];
$vatAmount = $total * ($data['Vat'] / 100);
$netTotal = $total + $vatAmount + $totalExcludeVat;

//echo $netTotal;
//exit();
$template = str_replace("[total]",number_format($total,2), $template );
$template = str_replace("[vat]",$vat, $template );
$template = str_replace("[vatAmount]",number_format($vatAmount,2), $template );
//$template = str_replace("[netTotal]",number_format($netTotal,2), $template );

$whTax = "";
$moneyText = "";
//$net = $netTotal;
if($data['Currency'] == 'thb'){
  if($data['IsWitholdingTax'] != '' && $data['IsWitholdingTax']==1){
    $Tax_manual = $data['Tax'];
    if($data['Tax']=='' || $data['Tax']==0){
      $Tax_manual = 3;
    }
    $tax = ($total * $Tax_manual ) / 100;
    $net = $netTotal - $tax;

    $whTax = "ภาษีหัก ณ ที่จ่าย ". number_format($tax,2) ." THB --- สุทธิ " . number_format($net) ." THB ---";
    $vatAmountN = '<tr>
        <td class="bordered no-bottom no-top" style="width:124px;text-align:right;">Witholding Tax '.$Tax_manual.'%:</td>
        <td class="bordered no-bottom no-top no-left" style="width: 20%; text-align: right;">'.number_format($tax,2).'</td>
    </tr>';
  }else {
    $net = $netTotal;
    $template = str_replace("[netTotal]",number_format($net,2), $template );
  }
  $moneyText = $core_db->ThaiBahtText2(number_format($net,2,".",""));
  if($data['Lbilling']==2){
    $moneyText = $core_db->bahtEng(number_format($net,2,".",""));
  }

}else {
  if($data['IsWitholdingTax']!="" && $data['IsWitholdingTax']==1){
    $Tax_manual = $data['Tax'];
    if($data['Tax']=='' || $data['Tax']==0){
      $Tax_manual = 3;
    }
    $tax = ($total * $Tax_manual) / 100;
    $net = $netTotal - $tax;

    $whTax = "Witholding Tax " . number_format($tax,2) . " USD --- Net " . number_format($net,2) . " USD ---";
    $vatAmountN = '<tr>
        <td class="bordered no-bottom no-top" style="width:124px;text-align:right;">Witholding Tax '.$Tax_manual.'%:</td>
        <td class="bordered no-bottom no-top no-left" style="width: 20%; text-align: right;">'.number_format($tax,2).'</td>
    </tr>';

  }else {
    $net = $netTotal;
    $template = str_replace("[netTotal]",number_format($net,2), $template );
  }
  //$eng_b = $net;
  $eng_b = number_format($net,2,".","");

  //$moneyText = $core_db->EngBahtText($eng_b);
  $moneyText = $core_db->dollarsEng($eng_b);
  $netString = number_format($net,2);

}
$bank ="";
$whTax = "";

$template = str_replace("[witholding]",$whTax, $template );
$template = str_replace("[moneyText]",$moneyText, $template );
$template = str_replace("[vatAmountN]",$vatAmountN, $template );
$template = str_replace("[bank]",$bank, $template );

$template = str_replace("[content]",$content, $template );
$template = str_replace("[content2]",$content2, $template );
$template = str_replace("[netTotal]",number_format($net,2), $template );
//echo $content;

$html = <<<EOF
<!-- EXAMPLE OF CSS STYLE -->
<style>
  $temp1
</style>
  $template
EOF;
/*

echo $html;
echo number_format($net,2,".","");
echo "<br>";
echo $eng_b;
echo $moneyText;
echo "<br>";
echo $moneyText2 ;
exit();
*/

// output the HTML content
$pdf->writeHTML($html, true, false, true, false, '');

$pdf->AddPage();
$template2 = file_get_contents('Pdf/_Export2.html', r);
$temp3 = explode("style>", $template2);
$temp3 = str_replace("</","", $temp3[1]);

$temp4 = explode("<body>", $template2);
$temp4 = explode("</body>", $temp4[1]);
$temp4 = $temp4[0];
$template2 = $temp4;

//echo $isConsultService;
if(@$isConsultService==1){
  $template2 = file_get_contents('Pdf/_Export2_Disbursement.html', r);

  $temp3 = explode("style>", $template2);
  $temp3 = str_replace("</","", $temp3[1]);

  $temp4 = explode("<body>", $template2);
  $temp4 = explode("</body>", $temp4[1]);
  $temp4 = $temp4[0];
  $template2 = $temp4;

  $template2 = str_replace("[total]",number_format($total,2), $template2 );

}else {
  $template2 = str_replace("[billDetail]",$data['BillDetail'], $template2 );
}
$template2 = str_replace("[invNo]",$data['InvoiceNo'], $template2 );
$template2 = str_replace("[content]",$content2, $template2 );
$template2 = str_replace("[netTotal]",number_format($net,2), $template2 );

$template2 = str_replace("[currency]",strtoupper($data['Currency']), $template2 );


/*
//$template = '<h1 style="text-align: center;">No data found</h1>';
echo $temp1;
echo $template;
exit();
*/




$Set_filename=$data['InvoiceNo'].'.pdf';
$Set_filename= str_replace("/","_",$Set_filename);

$html2 = <<<EOF
<!-- EXAMPLE OF CSS STYLE -->
<style>
  $temp3
</style>
  $template2
EOF;

/*
echo $html2;
exit();
*/
// output the HTML content
$pdf->writeHTML($html2, 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
//============================================================+

Anon7 - 2022
AnonSec Team