ok

Mini Shell

Direktori : /proc/self/root/proc/self/root/home/ngwcolle/public_html/mis/admin/
Upload File :
Current File : //proc/self/root/proc/self/root/home/ngwcolle/public_html/mis/admin/letterpdf.php

<?php
include('includes/dbconnection.php');
require("vendor/fpdf186/fpdf.php");
// check_login();
error_reporting(E_ALL);



                // <!-- pdf section -->

                // $id=$_GET['id'];
                // $id=$_GET['id'];
                $id=36;
$selectcomp=$dbh->prepare("select * from tblletter where id=$id");
$selectcomp->execute();
$rowcomp=$selectcomp->fetch(PDO::FETCH_OBJ);
// $select=$pdo->prepare("select * from tbl_invoice where invoice_id=$id");
// $select->execute();
// $row=$select->fetch(PDO::FETCH_OBJ);
// $pdf = new FPDF ('P','mm',array(80,145));

class PDF_HTML extends FPDF
{
    var $B=0;
    var $I=0;
    var $U=0;
    var $HREF='';
    var $ALIGN='';

    function WriteHTML($html)
    {
        //HTML parser
        $html=str_replace("\n",' ',$html);
        $a=preg_split('/<(.*)>/U',$html,-1,PREG_SPLIT_DELIM_CAPTURE);
        foreach($a as $i=>$e)
        {
            if($i%2==0)
            {
                //Text
                if($this->HREF)
                    $this->PutLink($this->HREF,$e);
                elseif($this->ALIGN=='center')
                    $this->Cell(0,5,$e,0,1,'C');
                else
                    $this->Write(5,$e);
            }
            else
            {
                //Tag
                if($e[0]=='/')
                    $this->CloseTag(strtoupper(substr($e,1)));
                else
                {
                    //Extract properties
                    $a2=explode(' ',$e);
                    $tag=strtoupper(array_shift($a2));
                    $prop=array();
                    foreach($a2 as $v)
                    {
                        if(preg_match('/([^=]*)=["\']?([^"\']*)/',$v,$a3))
                            $prop[strtoupper($a3[1])]=$a3[2];
                    }
                    $this->OpenTag($tag,$prop);
                }
            }
        }
    }

    function OpenTag($tag,$prop)
    {
        //Opening tag
        if($tag=='B' || $tag=='I' || $tag=='U')
            $this->SetStyle($tag,true);
        if($tag=='A')
            $this->HREF=$prop['HREF'];
        if($tag=='BR')
            $this->Ln(5);
        if($tag=='P')
            $this->ALIGN=$prop['ALIGN'];
        if($tag=='HR')
        {
            if( !empty($prop['WIDTH']) )
                $Width = $prop['WIDTH'];
            else
                $Width = $this->w - $this->lMargin-$this->rMargin;
            $this->Ln(2);
            $x = $this->GetX();
            $y = $this->GetY();
            $this->SetLineWidth(0.4);
            $this->Line($x,$y,$x+$Width,$y);
            $this->SetLineWidth(0.2);
            $this->Ln(2);
        }
    }

    function CloseTag($tag)
    {
        //Closing tag
        if($tag=='B' || $tag=='I' || $tag=='U')
            $this->SetStyle($tag,false);
        if($tag=='A')
            $this->HREF='';
        if($tag=='P')
            $this->ALIGN='';
    }

    function SetStyle($tag,$enable)
    {
        //Modify style and select corresponding font
        $this->$tag+=($enable ? 1 : -1);
        $style='';
        foreach(array('B','I','U') as $s)
            if($this->$s>0)
                $style.=$s;
        $this->SetFont('',$style);
    }

    function PutLink($URL,$txt)
    {
        //Put a hyperlink
        $this->SetTextColor(0,0,255);
        $this->SetStyle('U',true);
        $this->Write(5,$txt,$URL);
        $this->SetStyle('U',false);
        $this->SetTextColor(0);
    }
}

class PDF extends FPDF
{
// Page header
function Header()
{
    // Logo
    $this->Image('img/logo/ngwc.jpeg',10,6,180);
    // Arial bold 15
    // $this->SetFont('Arial','B',15);
    // Move to the right
    // $this->Cell(80);
    // Title
    // $this->Cell(30,10,'Title',1,0,'C');
    // Line break
    $this->Ln(2);
    $this->Line(7,28,200,28);
}

// Page footer
function Footer()
{
    // Position at 1.5 cm from bottom
    $this->SetY(-15);
    // Arial italic 8
    $this->SetFont('Arial','I',8);
    // Page number
    $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
}
}
$pdf = new PDF ();
// $pdf->AliasNbPages();
$pdf->SetMargins(8,2,8);
$pdf->AddPage();
$pdf->SetFont('Arial','B',12);
// $pdf->SetFont('Arial','B',16);
// $pdf-> Image('img/logo/ngwc.jpeg',100,15,35,35);
// $pdf->Cell(60,8,$rowcomp->letterno,1,1,'L');
$pdf->SetFont('Arial','B',12);
// $pdf->Cell(60,5,$rowcomp->letterno,0,1,'C');
// $pdf->MultiCell(100,55,'No: '. $rowcomp->letterno." /NGWC",0,1,'L','FALSE');
// $pdf->MultiCell(100,0,'No: '. $rowcomp->letterno." /NGWC",0,1,'R');
// $pdf->Cell(60,5,'E-mail Address :'. $rowcomp->letterno,0,1,'C');
// $pdf->Cell(60,5,'GST No:-'. $rowcomp->letterno,0,1,'C');
$lineHeight=4;
$pdf->multicell(120, 55, 'No: ' . $rowcomp->letterno." /NGWC", 0, 'l', false);
$x = $pdf->GetX();
$y = $pdf->GetY();
$pdf->SetXY($x + 120, $y);
$pdf->Cell(60, -55, 'Date:  ' .date("d-m-Y", strtotime($rowcomp->issuedate)), '', 0, 'R', false);
// $pdf->Cell(60,5,'fb.com/ammadmaf',0,1,'C');
//Line(x1,y1,x2,y2);
// $pdf->Line(7,37,72,37);
// $pdf->SetDash(4,2);
//Line break
$pdf->Ln();
$pdf->SetFont('Arial','',12);
$pdf->Cell(20,65,'To',0,0,'L');
$pdf->Ln(35);
// $pdf->GetX();
$pdf->SetX(20);
// $pdf->SetFont('Arial','',12);
// $pdf->MultiCell(100,75,$dbh->quote($rowcomp->letterto),0,0,'L');
$pdf->multicell(200, 5,$rowcomp->letterto, 0, 'l', false);
$pdf->Ln(-10);
$pdf->multicell(200,25, 'Sub: ', 0, 'l', false);
$x = $pdf->GetX();
$y = $pdf->GetY();
$pdf->SetXY($x, $y);
$pdf->Cell(59,-25,$rowcomp->subject, '', 0, 'R', false);
// $pdf->SetFont('Arial','BI',8);
// $pdf->Cell(10,4,$row->customer_name,0,1,'');
// $pdf->SetFont('Arial','BI',8);
$pdf->Ln(-8);
if(!empty($rowcomp->reference))
{
$pdf->multicell(200, 4,'Ref: ', 0, 'l', false);
$x = $pdf->GetX();
$y = $pdf->GetY();
$pdf->SetXY($x+12, $y);
$pdf->Cell(200,-4,$rowcomp->reference, '', 0, 'L', false);
}
$pdf->Ln(2);
$pdf->multicell(200, 5,'Sir/Madam, ', 0, 'l', false);
$pdf->Ln(2);
$pdf->multicell(200, 5,$rowcomp->content,  0, 'l', false);
// $pdf->SetFont('Arial','BI',8);
// $pdf->Cell(40,4,$row->invoice_id,0,1,'');
// $pdf->SetFont('Arial','BI',8);
// //$pdf->Cell(20,4,'Date : ',0,0,'');
// $pdf->Cell(8,4,'Date : ',0,0,'');
// //$pdf->SetFont('Arial','BI',8);
// $pdf->Cell(20,4,$row->order_date,0,0,'');
// //$pdf->SetFont('Arial','BI',8);
// $pdf->Cell(10,4,'Time : ',0,0,'');

// $pdf->SetFont('Arial','BI',8);
// $pdf->Cell(20,4,$row->order_time,0,1,'');

/////////////////////////
// $pdf->SetX(4);
// $pdf->SetFont('Courier','B',8);
// $pdf->SetFillColor(208,208,208);
// $pdf->Cell(34,4,'PRODUCT',1,0,'C'); //100
// $pdf->Cell(11,4,'QTY',1,0,'C');
// $pdf->Cell(12,4,'RATE',1,0,'C');
// $pdf->Cell(13,4,'AMOUNT',1,1,'C');
// $select=$pdo->prepare("select * from table_invoice_details where invoice_id=$id");
// $select->execute();
//$item=$select->fetch(PDO::FETCH_OBJ)
    
    
//     while($item=$select->fetch(PDO::FETCH_OBJ)){
        
//      $pdf->SetX(4);   
// $pdf->SetFont('Helvetica','B',7);
// $pdf->Cell(34,4,$item->product_name,1,0,'L'); //100
// $pdf->Cell(11,4,$item->qty,1,0,'C');
// $pdf->Cell(12,4,$item->price,1,0,'C');
// $pdf->Cell(13,4,$item->price*$item->qty,1,1,'C');     
//     }











// //product table code

// $pdf->SetX(4);
// $pdf->SetFont('courier','B',8);
// $pdf->Cell(20,4,'',0,0,'L'); //100
// //$pdf->Cell(20,4,'',0,0,'C');
// $pdf->Cell(25,4,'SUBTOTAL',1,0,'C');
// $pdf->Cell(25,4,$row->subtotal,1,1,'C');

// $pdf->SetX(4);
// $pdf->SetFont('courier','B',8);
// $pdf->Cell(20,4,'',0,0,'L'); //100
// //$pdf->Cell(20,4,'',0,0,'C');
// $pdf->Cell(25,4,'Tax Amount',1,0,'C');
// $pdf->Cell(25,4,$row->tax,1,1,'C');

// //$pdf->SetX(7);
// //$pdf->SetFont('courier','B',8);
// //$pdf->Cell(20,5,'',0,0,'L'); //100
// ////$pdf->Cell(20,5,'',0,0,'C');
// //$pdf->Cell(25,5,'TAX',1,0,'C');
// //$pdf->Cell(20,5,$row->tax,1,1,'C');



// $pdf->SetX(4);
// $pdf->SetFont('courier','B',8);
// $pdf->Cell(20,4,'',0,0,'L'); //100
// //$pdf->Cell(20,4,'',0,0,'C');
// $pdf->Cell(25,4,'DISCOUNT',1,0,'C');
// $pdf->Cell(25,4,$row->discount,1,1,'C');




// $pdf->SetX(4);
// $pdf->SetFont('courier','B',10);
// $pdf->Cell(20,4,'',0,0,'L'); //100
// //$pdf->Cell(20,4,'',0,0,'C');
// $pdf->Cell(25,4,'GRAND TOTAL',1,0,'C');
// $pdf->Cell(25,4,$row->total,1,1,'C');


// //$pdf->SetX(7);
// //$pdf->SetFont('courier','B',8);
// //$pdf->Cell(20,5,'',0,0,'L'); //100
// ////$pdf->Cell(20,5,'',0,0,'C');
// //$pdf->Cell(25,5,'PAID',1,0,'C');
// //$pdf->Cell(20,5,$row->paid,1,1,'C');



// //$pdf->SetX(7);
// //$pdf->SetFont('courier','B',8);
// //$pdf->Cell(20,5,'',0,0,'L'); //100
// ////$pdf->Cell(20,5,'',0,0,'C');
// //$pdf->Cell(25,5,'DUE',1,0,'C');
// //$pdf->Cell(20,5,$row->due,1,1,'C');


// $pdf->SetX(4);
// $pdf->SetFont('courier','B',8);
// $pdf->Cell(20,4,'',0,0,'L'); //100
// //$pdf->Cell(20,4,'',0,0,'C');
// $pdf->Cell(25,4,'PAYMENT TYPE',1,0,'C');
// $pdf->Cell(25,4,$row->payment_type,1,1,'C');


// //$pdf->Cell(60,5,'Invoice',0,1,'C');

// //$pdf->SetFont('Arial','',8);
// //$pdf->Cell(85,5,'Invoice :' .$row->invoice_id,0,1,'R');
// //
// //$pdf->SetFont('Arial','',8);
// //$pdf->Cell(87,5,'Date : '.$row->order_date,0,1,'R');





// $pdf->Cell(20,4,'',0,1,'');

// $pdf->SetX(4);
// $pdf->SetFont('Courier','B',8);
// $pdf->Cell(65,4,'Thankyou for Shopping',0,1,'C');//100


// // $pdf->SetX(3);
// // $pdf->SetFont('Courier','B',12);
// // $pdf->Cell(75,5,'AmmadMaf POS',0,1,'C');



// // $pdf->SetX(3);
// // $pdf->SetFont('Courier','B',12);
// // $pdf->Cell(75,5,"Hope you liked it",0,1,'C');

// $pdf->SetX(4);
// $pdf->Cell(32,7,'---------------------------------------',0,1,'');




// $pdf->SetX(4);
// $pdf->SetFont('Courier','BI',8);
// $pdf->Cell(75,3,'Terms & Conditions',0,1,'');


// $pdf->SetX(4);
// $pdf->SetFont('Courier','BI',7);
// $pdf->Cell(75,3,'Subject to Nayagarh Jurisdiction Only',0,1,'');
// $pdf->Cell(75,3,'Contact at : +92 3222563301',0,1,'');
// $pdf->Cell(75,3,'Contact at : +92 3222563301',0,1,'');
// $pdf->Cell(75,3,'Contact at : +92 3222563301',0,1,'');



$pdf->Output();
?>
                <!-- pdf sectione ends -->
              </div>
            </div>
          </div>
          <!--Row-->

          <!-- Modal Logout -->
          <?php include('includes/modal.php'); ?>

        </div>
        <!---Container Fluid-->
      </div>

      <!-- Footer -->
      <?php include('includes/footer.php'); ?>
      <!-- Footer -->
    </div>
  </div>

  <!-- Scroll to top -->
  <a class="scroll-to-top rounded" href="#page-top">
    <i class="fas fa-angle-up"></i>
  </a>

  <script src="vendor/jquery/jquery.min.js"></script>
  <script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
  <script src="vendor/jquery-easing/jquery.easing.min.js"></script>
  <script src="js/ruang-admin.min.js"></script>
  <!-- Page level plugins -->
  <script src="vendor/datatables/jquery.dataTables.min.js"></script>
  <script src="vendor/datatables/dataTables.bootstrap4.min.js"></script>

  <!-- Page level custom scripts -->
  <script>
    $(document).ready(function() {
      $('#dataTable').DataTable(); // ID From dataTable 
      $('#dataTableHover').DataTable(); // ID From dataTable with Hover
    });
  </script>

</body>

</html>

Zerion Mini Shell 1.0