GIF89a php
Current File : /home/hencockfreshchic/public_html/invoice2.php
<?php
ob_start();
ini_set('error_reporting', E_STRICT);
include("connect.php");
include("libs.php");
mysqli_set_charset($conn,'utf8');
date_default_timezone_set('Asia/Kolkata');

if($_COOKIE["user_id"]=="")
{
  echo '<script>window.location.href="login.php";</script>';
}

if($_GET['sr']=="" || $_GET['prod_id']=="")
{
  echo '<script>window.location.href="order-complete.php";</script>';
}


$html = "

<style>
.top_rw{ background-color:#f4f4f4; }
.td_w{ }
button{ padding:5px 10px; font-size:14px;}
.invoice-box {
max-width: 890px;
margin: auto;
padding:10px;
border: 1px solid #eee;
box-shadow: 0 0 10px rgba(0, 0, 0, .15);
font-size: 14px;
line-height: 24px;
font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;
color: #555;
}
.invoice-box table {
width: 100%;
line-height: inherit;
text-align: left;
border-bottom: solid 1px #ccc;
}
.invoice-box table td {
padding: 5px;
vertical-align:middle;
}
.invoice-box table tr td:nth-child(2) {
text-align: right;
}
.invoice-box table tr.top table td {
padding-bottom: 20px;
}
.invoice-box table tr.top table td.title {
font-size: 45px;
line-height: 45px;
color: #333;
}
.invoice-box table tr.information table td {
padding-bottom: 40px;
}
.invoice-box table tr.heading td {
background: #eee;
border-bottom: 1px solid #ddd;
font-weight: bold;
font-size:12px;
}
.invoice-box table tr.details td {
padding-bottom: 20px;
}
.invoice-box table tr.item td{
border-bottom: 1px solid #eee;
}
.invoice-box table tr.item.last td {
border-bottom: none;
}
.invoice-box table tr.total td:nth-child(2) {
border-top: 2px solid #eee;
font-weight: bold;
}
@media only screen and (max-width: 600px) {
.invoice-box table tr.top table td {
width: 100%;
display: block;
text-align: center;
}
.invoice-box table tr.information table td {
width: 100%;
display: block;
text-align: center;
}
}
/** RTL **/
.rtl {
direction: rtl;
font-family: Tahoma, 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;
}
.rtl table {
text-align: right;
}
.rtl table tr td:nth-child(2) {
text-align: left;
}
.logo_section
{
margin-bottom: 20px;
}
</style>";

$datee=orderDetail($conn,$_GET['sr'],"datee");
$order_id=orderDetail($conn,$_GET['sr'],"order_id");

$html .= '
<div class="invoice-box">
  
  <table cellpadding="0" cellspacing="0">
    <tr class="logo_section text-center">
      <img src="https://weblook.co.in/Leather2/images/logo.png" style="height: 80px;">
    </tr>
    <tr class="top_rw mt-3">
      <td colspan="2">
        <h2 style="margin-bottom: 0px;"> Tax invoice</h2>
        <span style=""> Invoice No: ';echo $order_id; $html .= 'Date: ';echo $datee; $html .= ' </span>
      </td>
      <td  style="width:30%; margin-right: 10px;">
        Order Id: <?php echo $order_id; ?>
      </td>
    </tr>
    <tr class="top">
      <td colspan="3">
        <table>
          <tr>
            <td>
              <b> Sold By: Good Leather Garments </b> <br>
              Shop no. A-44 ram mandir wali gali <br>Mohammadpur near Bhikaji cama place <br>south Delhi 1100662 <br>
              
              GSTIN: 07BYHPA0360H1ZV <br>
            </td>
            <td>
              <b> Support </b> <br>
              <b>Phone No :</b> 6397652448<br>
              <b>Email Id :</b> goodleather52@gmail.com<br>
              <b>Website :</b> https://goodleathergarments.in
            </td>
          </tr>
        </table>
      </td>
    </tr>
    <tr class="information">
      <td colspan="3">
        <table>
          <tr>
            <td colspan="2">
              <b> Shipping Address: </b> <br>
              '; echo shpAddByOrderID($conn,$_COOKIE["user_id"],$order_id,"uname","1").","; $html .= '<br>';
              echo shpAddByOrderID($conn,$_COOKIE["user_id"],$order_id,"bill_adds","1").","; $html .= '<br>';
              echo shpAddByOrderID($conn,$_COOKIE["user_id"],$order_id,"cityy","1")."(".shpAddByOrderID($conn,$_COOKIE["user_id"],$order_id,"state","1").")"; $html .= '<br>';
              echo "Landmark: ".shpAddByOrderID($conn,$_COOKIE["user_id"],$order_id,"bill_land","1").","; $html .= '<br>';
              echo shpAddByOrderID($conn,$_COOKIE["user_id"],$order_id,"mobb","1").","; $html .= '<br>';
              echo shpAddByOrderID($conn,$_COOKIE["user_id"],$order_id,"uemail","1").","; $html .= '<br>';
              echo "Pincode:".shpAddByOrderID($conn,$_COOKIE["user_id"],$order_id,"pincode","1").","; $html .= '<br>
            </td>
            <td> <b> Billing Address:</b><br>
              '; echo shpAddByOrderID($conn,$_COOKIE["user_id"],$order_id,"uname","0").","; $html .= '<br>';
              echo shpAddByOrderID($conn,$_COOKIE["user_id"],$order_id,"bill_adds","0").","; $html .= '<br>';
               echo shpAddByOrderID($conn,$_COOKIE["user_id"],$order_id,"cityy","0")."(".shpAddByOrderID($conn,$_COOKIE["user_id"],$order_id,"state","0").")"; $html .= '<br>';
               echo "Landmark: ".shpAddByOrderID($conn,$_COOKIE["user_id"],$order_id,"bill_land","0").","; $html .= '<br>';
               echo shpAddByOrderID($conn,$_COOKIE["user_id"],$order_id,"mobb","0").","; $html .= '<br>';
               echo shpAddByOrderID($conn,$_COOKIE["user_id"],$order_id,"uemail","0").","; $html .= '<br>';
               echo "Pincode:".shpAddByOrderID($conn,$_COOKIE["user_id"],$order_id,"pincode","0").","; $html .= '<br>
            </td>
          </tr>
        </table>
      </td>
    </tr>
    <td colspan="3">
      <table cellspacing="0px" cellpadding="2px">
        <tr class="heading">
          <td style="width:25%;">
            ITEM
          </td>
          <td style="width:10%; text-align:center;">
            QTY.
          </td>
          <td style="width:10%; text-align:right;">
            PRICE (INR)
          </td>
          <td style="width:15%; text-align:right;">
            TAX RATE & TYPE
          </td>
          <td style="width:15%; text-align:right;">
            TAX AMOUNT (INR)
          </td>
          <td style="width:15%; text-align:right;">
            TOTAL AMOUNT (INR)
          </td>
        </tr>
        ';
          $sqlO="SELECT * FROM `incoming_order` WHERE `sr`='".$_GET['sr']."'";
          $rsO=mysqli_query($conn,$sqlO);
          $rowO=mysqli_fetch_assoc($rsO);

          $sqlP="SELECT * FROM `products` WHERE `sr`='".$rowO["prod_id"]."'";
          $rsP=mysqli_query($conn,$sqlP);
          $rowP=mysqli_fetch_assoc($rsP);

          $amount=$rowO["prod_price"];
          $gst=($amount*18)/100;
          $shp=$rowP["ship_chrg"];
          $pure_amount=$amount-$gst-$shp;
        
        $html .= '
        <tr class="item">
          <td style="width:25%;">
            '; echo $rowP["p_name"]; $html .= '
            HSN Code :'; echo $rowO["prod_code"]; $html .= '          
          </td>
          <td style="width:10%; text-align:center;">
            '; echo $rowO["prod_qty"]; $html .= ' 
          </td>
          <td style="width:10%; text-align:right;">
            '; echo $pure_amount; $html .= '
          </td>
          <td style="width:15%; text-align:right;">
            18% GST(Included)
          </td>
          <td style="width:15%; text-align:right;">
            '; echo $gst."(GST) +".$shp."(Shipping Charge)"; $html .= '
          </td>
          <td style="width:15%; text-align:right;">
            '; echo $amount; $html .= ' 
          </td>
        </tr>
        <tr class="item">
          <td style="width:25%;"> <b> Grand Total </b> </td>
          <td style="width:10%; text-align:center;">
            '; echo $rowO["prod_qty"]; $html .= '
          </td>
          <td style="width:10%; text-align:right;">
            '; echo $pure_amount; $html .= '
          </td>
          <td style="width:15%; text-align:right;">
          </td>
          <td style="width:15%; text-align:right;">
            '; echo $gst+$shp; $html .= '
          </td>
          <td style="width:15%; text-align:right;">
            '; echo $amount; $html .= ' 
          </td>
        </tr>
      </td>
    </table>
    <tr class="total">
      <td colspan="3" align="right">  Total Amount :  <b> '; echo $amount; $html .= '  </b> </td>
    </tr>
    <tr>
      <td colspan="3">
        <table cellspacing="0px" cellpadding="2px">
          <tr>
            
            <td colspan="2">
              * This is a computer generated invoice and does not
              require a physical signature
            </td>
          </tr>
          <tr>
            <td width="50%">
            </td>
            <td>
              <b> Authorized Signature </b>
              <br>
              <br>
              ...................................
              <br>
              <br>
              <br>
            </td>
          </tr>
        </table>
      </td>
    </tr>
  </table>
</div>';

//1  = Download
//0 = Preview
header("Content-Type: application/pdf");
		header("Content-Disposition: attachment; filename=download.pdf");
		echo $html;

?>