<?php
session_start();
  	if(!isset($_SESSION["adminname"]) && !isset($_SESSION["username"]))
	{
		header("Location: index.php");
	}
include('config.php');
 $invid=$_GET['id'];

$result=mysql_query("select * from report where id=$invid");


if (mysql_num_rows($result) > 0) {
  // output data of each row
  while($row = mysql_fetch_assoc($result)) {
  //  echo "id: " . $row["id"]. " - Name: " . $row["tenant_id"]. " " . $row["amount"]. "<br>";
    $address1=$row["address1"];
    $address2=$row["address2"];
    $address3=$row["address3"];
    $address4=$row["address4"];
    
     $invoiceno=$row["invoiceno"];
    $orderno=$row["orderno"];
    $dcno=$row["dcno"];
    $tinno=$row["tinno"];
    
   $dateTime = new DateTime($cdate);
    
    // Format the date
    $formattedDate = $dateTime->format('d/m/Y');
    
    
     $date=$row["date"];
    $dat1=$row["dat1"];
    $dat2=$row["dat2"];
    
     $adescription=$row["adescription"];
    $aquantity=$row["aquantity"];
     $aunitprice=$row["aunitprice"];
      $aamount=$row["aamount"];
    
     $a1l=$row["a1l"];
    $a5l=$row["a5l"];
    $a50l=$row["a50l"];
    $aquantity=$row["aquantity"];
    $aunitprice=$row["aunitprice"];
    $aamount1=$row["aamount1"];
    
    
     $remarks=$row["remarks"];
    $sgst=$row["sgst"];
    $sgstamount=$row["sgstamount"];
     $cgst=$row["cgst"];
      $cgstamount=$row["cgstamount"];
       $igst=$row["igst"];
        $igstamount=$row["igstamount"];
         $taxamount=$row["taxamount"];
     
     
     
   
  }
} else {
  echo "0 results";
}	
?>

<html>
<head>
    <title>QuotationPDF</title>
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta charset="utf-8" />
<style>
    @media print {
  #printPageButton {
    display: none;
  }
}
</style>
    <style>@page { margin: 25px; }
        table, tr, th {
            border: 0px solid black;
            border-collapse: collapse;
        }
        #hidelines2 {
            border-right: 1px solid #FFF;
            border-top: 1px solid #fff;
            border-bottom: 1px solid #fff;
        }
        #hidelines1 {
            border-left: 1px solid #FFF;
            border-top: 1px solid #fff;
            border-bottom: 1px solid #fff;
        }
        #hidelines {
            border-left: 1px solid #FFF;
            border-right: 1px solid #FFF;
            border-top: 1px solid #fff;
            border-bottom: 1px solid #fff;
        }
        .hide_line {
            border: 0px;
        }
        .bor {
            margin-top: 20px;
            font-size: 12pt;
        }
        .databord, td {
            
            font-size: 12pt;
        }
        .wid table, tr {
            width: 100%;
            font-size: 12px;
            font-weight: bold;
        }
        .dis {
            text-align: right;
        }
        .tos {
            border: 0px;
            margin-top: 20px;
            font-size: 12pt;
        }
    </style>
</head>
<body style="margin: 0;">
    <input type="button" id="printPageButton" value="Print this page" onClick="window.print()">
<div id="p1" style="overflow: hidden; position: relative; background-color: white; width: 909px; height: 1286px;">
    <h2 style="text-align: center; font-size: 14pt;"><b><u>DELIVERY CHALLAN</u></b></h2>
    
    <table style="width:100%;">
        <tr>
            <td width="50%" style="border-right: 1px solid black;">
                <div>
                    <p>GSTIN: 34AAMFB9946N1ZO</p>
                    <p><h2>BM BIO ENERGY</h2></p>
                    <p>T.S.No.12/7, No.66, Perungalur Village,</p>
                    <p>Puducherry-605 007.</p>
                </div>
            </td>
            <td width="50%" style="text-align: left;">
                <div>
                    <p>M/S:</p>
                    <p style="padding-left: 40px;"><?php echo $address1; ?></p>
                    <p style="padding-left: 40px;"><?php echo $address2; ?></p>
                    <p style="padding-left: 40px;"><?php echo $address3; ?></p>
                    <p style="padding-left: 40px;"><?php echo $address4; ?></p>
                    <p>DC No: <?php echo $dcno; ?></p>
                    <p>Date: <?php echo $formattedDate;  ?></p>
                </div>
            </td>
        </tr>
    </table>

    <table class="head" style="width:100%; height:300px;border: 1px solid black;">
        <thead style="border: 1px solid black;">
            <tr>
                <td class="databord" style="text-align: center;border: 1px solid black;">S.No</td>
                <td class="databord" style="text-align: center;border: 1px solid black;">DESCRIPTION</td>
                <td class="databord" style="text-align: center;border: 1px solid black;">Quantity</td>
                <td class="databord" style="text-align: center;border: 1px solid black;">REMARKS</td>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td style="text-align: top;border: 1px solid black;border: 1px solid black;">1</td>
                <td style="text-align: top;border: 1px solid black;"><?php echo $adescription; ?></td>
                <td style="text-align: top;border: 1px solid black;border: 1px solid black;"><?php echo $aquantity; ?></td>
                <td style="text-align: top;border: 1px solid black;"></td>
            </tr>
        </tbody>
    </table>

    <table style="width:100%;">
        <tr>
            <td width="50%">Received the goods in good condition</td>
            <td width="50%" style="text-align: right;">For <b>BM BIO ENERGY</b></td>
        </tr>
    </table>

    <br><br>
    
    <table style="width:100%;border: 0px;">
        <tr>
            <td width="50%">Received Signature</td>
            <td width="50%" style="text-align: right;"></td>
        </tr>
    </table>
    
    </div>
</body>
</html>
