
<?php 
session_start();
 if(!isset($_SESSION['aid']))
 {
   	echo '<script>location.href="../index.php"</script>';
 }

include "../connection/config.php";

$clquery="select * from company";
$clex=mysqli_query($con,$clquery);
$clf=mysqli_fetch_assoc($clex);
$company=$clf['company'];
$phone=$clf['phone'];
$address=$clf['address'];

$saleid=$_GET['saleid'];
$billno=$_GET['billno'];

$sql=mysqli_query($con,"select * from sales_reg1 where saleid='$saleid'");
$fetch=mysqli_fetch_assoc($sql);
$date=$fetch['date'];
$cuid=$fetch['cuid'];

$stusql=mysqli_query($con,"select * from customer where cuid='$cuid'");
$stufet=mysqli_fetch_assoc($stusql);
$name=$stufet['name'];
$regno=$stufet['regno'];
$class=$stufet['class'];
$div=$stufet['division'];
$mob=$stufet['mob'];
?>
<!DOCTYPE html>
<html>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<head>
	<title></title>
	<meta http-equiv="content-type" content="text/html; charset=utf-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta name="" content="" />
	<link href="public/assets/css/bootstrap.min.css" rel="stylesheet">
	<link href="public/assets/css/main.css" rel="stylesheet" media="all">
	<link href="public/assets/css/responsive.css" rel="stylesheet" media="all">
<style>

</style>    
</head>
<body>
	<div class="container">
        <div class="row">
            <div class="col-md-8 col-sm-8 col-xs-12 col-lg-6 main1">
                           <div class="receipt-main">
                               <div class="row">
                                   <div class="receipt-header">
                                       <div class="col-xs-6 col-sm-6 col-md-6">
                                           <div class="receipt-left">
                                               <img class="img-responsiv" alt="" src="public/assets/images/<?php echo $clf['logo']; ?>" width="250px">
                                           </div>
                                       </div>
                                       <div class="col-xs-6 col-sm-6 col-md-6 text-right">
                                           <div class="receipt-right">
                                               <h5 style="font-size: 15px;"><?php echo $company; ?></h5>
                                               <p><i class="fa fa-phone">Ph : <?php echo $phone; ?></i></p>
                                               
                                           </div>
                                       </div>
                                   </div>
                               </div>
                               
                                <div class="row" style="margin-top:-20px;">
                                   <div class="receipt-header receipt-header-mid">
                                       <div class="col-xs-8 col-sm-8 col-md-4 text-left">
                                           <div class="receipt-right">
                                            
                                               <!-- <p><b>order No:</b></p> -->
                                               <p><b>Date :</b> <?php echo date('d-m-Y', strtotime($date)); ?></p>
                                               <p><b>To:</b><?php echo $name; ?>,<br><b>Regno:</b><?php echo $regno; ?></p>
                                               <p><b>Div:</b><?php echo $class; echo $div; ?>,<b>Mob:</b><?php echo $mob; ?></p>
                                           </div>
                                       </div>

                                       <div class="col-xs-8 col-sm-8 col-md-4 text-center">
                                        <div class="receipt-right">
                                            <h5 class="element">PERFORMA / INVOICE </h5>
                                        </div>
                                    </div>


                                       <div class="col-xs-4 col-sm-4 col-md-4 text-right">
                                        <div class="receipt-left">
                                            <p style="font-size: 10px;" class="ori"><b>Original</p>
                                                  <p>Order # :  </p>
                                                <p>Invoice # :<?php echo $billno; ?></p>
                                        </div>
                                       </div>
                                   </div>
                               </div>
                               
                               <div style="margin-top:-20px;">
                                   <table class="table table-bordered" style="text-align: right;">
                                       <thead>
                                           <tr>
                                            <th>#</th>
                                                <th style="text-align:left;">Description</th>
                            <th style="text-align:center;">Qty</th>
                            <th style="text-align:center;">Rate</th>
                            <th style="text-align:center;">Amount</th>
                                           </tr>
                                       </thead>
                                       <tbody>
                                       <?php 
include "config1.php";
$sqli = "SELECT * FROM sales_reg1 INNER JOIN sales_reg2 ON sales_reg1.saleid = sales_reg2.saleid where sales_reg2.saleid='$saleid'";
$stmt = $pdo->query($sqli);
$data = $stmt->fetchAll();
// Initialize counter
$serial = 1;
  
foreach ($data as $billfetch) { 
    $billno = $billfetch['sales_billno'];
    $iid=$billfetch['iid'];
    $iisql=mysqli_query($con,"select * from item_details where iid='$iid'");
    $iifet=mysqli_fetch_assoc($iisql);
    $itemname=$iifet['item_name'];
?>
                                           <tr>
                                               <td class="col-md-1"><?php echo  $serial++ ?> </td>
                                               <td class="col-md-6" style="text-align: left;"><i class="fa fa-inr"></i> <?php echo  $itemname; ?> </td>
                                               <td class="col-md-1"  style="text-align: center;"><i class="fa fa-inr"></i> <?php echo  $billfetch['quantity']; ?></td>
                                               <td class="col-md-2" style="text-align: center;"><i class="fa fa-inr"></i>  <?php echo  $billfetch['price']; ?> </td>
                                               <td class="col-md-2" style="text-align: center;"><i class="fa fa-inr"></i>  <?php echo  $billfetch['total']; ?> </td>
                                           </tr>
                                        <?php } ?>

                                          <tr>
                                                <td colspan="1"><b></b></td>
                                                     <td colspan="1"><b></b></td>
                                                          <td colspan="1"><b></b></td>
                                            <td style=" text-align: right;"><b>Total:</b></td>
                                            
                                            <td style=" text-align: center;"><b> <?php echo  $billfetch['net_amount']; ?> </b></td>
                                          </tr>
                                           
                                       
                                       </tbody>
                                   </table>
                               </div>
                               
                               <div class="row" style="margin-top:-20px;">
                                   <div class="receipt-header receipt-header-mid receipt-footer" style="margin:-10px 0px 0px 0px;">
                                       <div class="col-xs-8 col-sm-8 col-md-8 text-left">
                                           <div class="receipt-right">
                                               <p>I here by confirm that all materials are receied in good condition.Recevied by:</p>
                                               <!-- <p>material Recevied by:</p> -->
                                           </div>
                                       </div>
                                       <div class="col-xs-4 col-sm-4 col-md-4 text-right">
                                           <div class="receipt-left">
                                            <p>For <?php echo $company; ?></p>
                                           </div>
                                       </div>
                                   </div>
                               </div>




          
                               <div class="row" style="margin-top:-10px;">
                                <div class="receipt-header receipt-header-mid receipt-footer">
                                    <div class="col-xs-8 col-sm-8 col-md-8 text-left">
                                        <div class="receipt-right">
                                            <p>-------------------------</p>
                                            
                                        </div>
                                    </div>
                                    <div class="col-xs-4 col-sm-4 col-md-4 text-right" style="margin-top:0px;">
                                        <div class="receipt-left">
                                         <p>(Authorised Signatory)</p>
                                        </div>
                                    </div>
                                </div>
                            </div>




<div style="bottom: 0;position: fixed;">
                             <div >
                                <div class="receipt-header receipt-header-mid receipt-footer">
                                    <div class=" text-center">
                                        <div class="receipt-right" style=" text-align:justify;   border: 1px solid #ddd; padding: 10px;">
                                            <h5><u>Product Return policy</u> : </h5>
                                            <p style="font-size:8px;"><b>*</b> The uniform must be returned within the specified time frame, usually within 3 working days of purchase.<br>
                                            <b>*</b> The uniform must be unworn and in its original packaging with all tags attached.<br>
                                            <b>*</b> Proof of purchase , such as a receipt or order confirmation, must be presented at the time of return.<br>
                                            <b>*</b> If the uniform was customized or altered in any way , it may not be eligible for return.</p>
                                        </div>
                                    </div>
                                
                                </div>
                            </div>





                            <div class="row" style="margin-top:0px;">
                                <div class="receipt-header receipt-header-mid receipt-footer" style="margin: 0px 0px 0px 0px;">
                                    <div class="col-xs-8 col-sm-8 col-md-12 text-center">
                                        <div class="receipt-right">
                                            <p>Sharjah Media City,Sharjah,United Arab Emirates,Mob:+971566774393 </p>
                                            
                                        </div>
                                    </div>
                                
                                </div>
                            </div>


                              
                           </div>    
                      
                  
    </div></div>
<!--------------------------------------------------------------------------------2nd-------------------------------------------------------------------------->

    <div class="col-md-8 col-sm-8 col-xs-12 col-lg-6 main2">
        <div class="receipt-main">
            <div class="row">
                <div class="receipt-header">
                    <div class="col-xs-6 col-sm-6 col-md-6">
                        <div class="receipt-left">
                            <img class="img-responsiv" alt="" src="public/assets/images/<?php echo $clf['logo']; ?>" width="250px">
                        </div>
                    </div>
                    <div class="col-xs-6 col-sm-6 col-md-6 text-right">
                        <div class="receipt-right">
                            <h5 style="font-size: 15px;"><?php echo $company; ?></h5>
                            <p><i class="fa fa-phone">Ph : <?php echo $phone; ?></i></p>
                            
                        </div>
                    </div>
                </div>
            </div>
            
                    <div class="row" style="margin-top:-20px;">
                <div class="receipt-header receipt-header-mid">
                    <div class="col-xs-8 col-sm-8 col-md-4 text-left">
                        <div class="receipt-right">
                         
                        <!-- <p><b>order No:</b></p> -->
                        <p><b>Date :</b> <?php echo date('d-m-Y', strtotime( $date)); ?></p>
                        <p><b>To:</b><?php echo $name; ?>,<br><b>Regno:</b><?php echo $regno; ?></p>
                        <p><b>Div:</b><?php echo $class; echo $div; ?>,<b>Mob:</b><?php echo $mob; ?></p>
                        </div>
                    </div>

                    <div class="col-xs-8 col-sm-8 col-md-4 text-center">
                     <div class="receipt-right">
                         <h5 class="element">PERFORMA / INVOICE </h5>
                     </div>
                 </div>


                    <div class="col-xs-4 col-sm-4 col-md-4 text-right">
                     <div class="receipt-left">
                         <p style="font-size: 10px;"><b>Duplicate</p>
                            <p>Order # :  </p>

                             <p>Invoice  No:<?php echo $billno; ?></p>
                     </div>
                    </div>
                </div>
            </div>
            
            <div style="margin-top:-20px;">
                <table class="table table-bordered" style="text-align: right;">
                    <thead>
                        <tr>
                         <th>#</th>
                               <th style="text-align:left;">Description</th>
                            <th style="text-align:center;">Qty</th>
                            <th style="text-align:center;">Rate</th>
                            <th style="text-align:center;">Amount</th>
                        </tr>
                    </thead>
                    <tbody>
<?php
$sqli = "SELECT * FROM sales_reg1 INNER JOIN sales_reg2 ON sales_reg1.saleid = sales_reg2.saleid where sales_reg2.saleid='$saleid'";
$stmt = $pdo->query($sqli);
$data = $stmt->fetchAll();
// Initialize counter
$serial = 1;
  
foreach ($data as $billfetch) { 
    $billno = $billfetch['sales_billno'];
    $iid=$billfetch['iid'];
    $iisql=mysqli_query($con,"select * from item_details where iid='$iid'");
    $iifet=mysqli_fetch_assoc($iisql);
    $itemname=$iifet['item_name'];
?>
                                           <tr>
                                               <td class="col-md-1"><?php echo  $serial++ ?> </td>
                                               <td class="col-md-6" style="text-align: left;"><i class="fa fa-inr"></i> <?php echo  $itemname; ?> </td>
                                               <td class="col-md-1" style="text-align: center;"><i class="fa fa-inr"></i> <?php echo  $billfetch['quantity']; ?></td>
                                               <td class="col-md-2" style="text-align: center;"><i class="fa fa-inr"></i>  <?php echo  $billfetch['price']; ?> </td>
                                               <td class="col-md-2" style="text-align: center;"><i class="fa fa-inr"></i>  <?php echo  $billfetch['total']; ?> </td>
                                           </tr>
                                        <?php } ?>
                      
                       <tr>
                     
                         <td colspan="1"><b></b></td>
                              <td colspan="1"><b></b></td>
                                   <td colspan="1"><b></b></td>
                             <td style="text-align:left; "><b>Total:</b></td>
                         <td style="text-align:left;"><b><?php echo  $billfetch['net_amount']; ?></b></td>
                       </tr>
                        
                    
                    </tbody>
                </table>
            </div>
            
            <div class="row" style="margin-top:-20px;">
                <div class="receipt-header receipt-header-mid receipt-footer" style="margin:-10px 0px 0px 0px;">
                    <div class="col-xs-8 col-sm-8 col-md-8 text-left">
                        <div class="receipt-right">
                            <p>I here by confirm that all materials are receied in good condition.Recevied by:</p>
                            <!-- <p>material Recevied by:</p> -->
                        </div>
                    </div>
                    <div class="col-xs-4 col-sm-4 col-md-4 text-right">
                        <div class="receipt-left">
                         <p>For <?php echo $company; ?></p>
                        </div>
                    </div>
                </div>
            </div>





            <div class="row" style="margin-top:-10px;">
             <div class="receipt-header receipt-header-mid receipt-footer">
                 <div class="col-xs-8 col-sm-8 col-md-8 text-left">
                     <div class="receipt-right">
                         <p>-------------------------</p>
                         
                     </div>
                 </div>
                 <div class="col-xs-4 col-sm-4 col-md-4 text-right" style="margin-top:0px;">
                     <div class="receipt-left">
                      <p>(Authorised Signatory)</p>
                     </div>
                 </div>
             </div>
         </div>




<div style="bottom: 0;position: fixed;">
        <div >
                                <div class="receipt-header receipt-header-mid receipt-footer">
                                    <div class=" text-center">
                                        <div class="receipt-right" style=" text-align:justify;   border: 1px solid #ddd; padding: 10px;">
                                            <h5><u>Product Return policy</u> : </h5>
                                            <p style="font-size:8px;"><b>*</b> The uniform must be returned within the specified time frame, usually within 3 working days of purchase.<br>
                                            <b>*</b> The uniform must be unworn and in its original packaging with all tags attached.<br>
                                            <b>*</b> Proof of purchase , such as a receipt or order confirmation, must be presented at the time of return.<br>
                                            <b>*</b> If the uniform was customized or altered in any way , it may not be eligible for return.</p>
                                        </div>
                                    </div>
                                
                                </div>
                            </div>






         <div class="row" style="margin-top:0px;">
             <div class="receipt-header receipt-header-mid receipt-footer" style="margin: 0px 0px 0px 0px;">
                 <div class="col-xs-8 col-sm-8 col-md-12 text-center">
                     <div class="receipt-right">
                         <p>Sharjah Media City,Sharjah,United Arab Emirates,Mob:+971566774393 </p>
                         
                     </div>
                 </div>
             
             </div>
         </div>





            
        </div> </div>   
   
<style type="text/css">
    @media print {
  @page {
    size: A4 landscape;
  }
  .container{
    width: 100%;
    padding-left: 0;
    padding-right: 0;
  }
.row{
    margin-left: -1px;
    margin-right: -1px;
}
.col-lg-1, .col-lg-10, .col-lg-11, .col-lg-12, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-md-1, .col-md-10, .col-md-11, .col-md-12, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-sm-1, .col-sm-10, .col-sm-11, .col-sm-12, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-xs-1, .col-xs-10, .col-xs-11, .col-xs-12, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9 {
   
    padding-right: 2px;
    padding-left: 2px;
}
.receipt-main {
   
    padding: 0px 30px !important;
   margin-top: 0;
   
}
.col-md-12 {
    width: 100%;
    text-align: left;
}
.main1{
    width: 50%;
}
.main2{
    width: 50%;
}
.col-md-1{

}

.receipt-right p{
font-size: 8px;
}
.receipt-left p{
    font-size: 8px;
}
.ori{
    font-size: 10px;
}


    .element {
    border: 1px solid #ddd;
    color: #767676;
    padding: 5px;
 
}
.col-md-4 {
    width: 33.33333333%;
}

}
</style>

<style type="text/css">
    .element {
    border: 1px solid #ddd;
    color: #767676;
    padding: 10px;
}
 .element h5{
  font-size: 15px;
}
</style>



</div>


    </div> 
    </div>




</body>
</html>