<?php session_start();
if(empty($_SESSION['id'])):
header('Location:../index.php');
endif;
if(empty($_SESSION['branch'])):
header('Location:../index.php');
endif;
?>
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Receipt | <?php include('../dist/includes/title.php');?></title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <!-- Bootstrap 3.3.5 -->
    <link rel="stylesheet" href="../bootstrap/css/bootstrap.min.css">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="../plugins/datatables/dataTables.bootstrap.css">
    <link rel="stylesheet" href="../dist/css/AdminLTE.min.css">
    <link rel="stylesheet" href="../plugins/select2/select2.min.css">
    <!-- AdminLTE Skins. Choose a skin from the css/skins
         folder instead of downloading all of them to reduce the load. -->
    <link rel="stylesheet" href="../dist/css/skins/_all-skins.min.css">
    
    <style type="text/css">
      tr td{
        padding-top:-10px!important;
        border: 1px solid #000;
      }
      @media print {
          .btn-print {
            display:none !important;
          }
      }
    </style>
 </head>
  <!-- ADD THE CLASS layout-top-nav TO REMOVE THE SIDEBAR. -->
  <body class="hold-transition skin-blue layout-top-nav">
    <div class="wrapper">
      
      <!-- Full Width Column -->
      <div class="content-wrapper">
        <div class="container">

          <section class="content">
            <div class="row">
	      <div class="col-md-12">
              <div class="col-md-12">

              </div>
                
                <div class="box-body">

                  <!-- Date range -->
                  <form method="post" action="">
<?php
include('../dist/includes/dbcon.php');
$id=$_SESSION['id'];
  
        
?>			
                 
<?php

    $branch=$_SESSION['branch'];
	$sales_id=$_REQUEST['sid'];
    $query=mysqli_query($con,"select * from sales where sales_id='$sales_id'")or die(mysqli_error($con));
        $row=mysqli_fetch_array($query);
        $branch=$row['branch_id'];
        $sales_id=$row['sales_id'];
		$cust_id=$row['cust_id'];
		$delivery=$row['delivery'];
		  $queryb=mysqli_query($con,"select * from branch where branch_id='$branch'")or die(mysqli_error());
  
        $rowb=mysqli_fetch_array($queryb);
		
		 $queryk=mysqli_query($con,"select * from customer where cust_id='$cust_id'")or die(mysqli_error($con));
        $rowk=mysqli_fetch_array($queryk);
		
		
        $last=$rowk['cust_last'];
        $first=$rowk['cust_first'];
        $address=$rowk['cust_address'];
        $contact=$rowk['cust_contact'];
        $sid=$row['sales_id'];
        $due=$row['amount_due'];
       $discount=$row['discko'];
		$discounttotal=$row['discount'];
        $grandtotal=$due-$discount;
        $tendered=$row['cash_tendered'];
        $change=$row['cash_change'];
		 $partial1=$row['partial1'];

        $query1=mysqli_query($con,"select * from payment where sales_id='$sales_id'")or die(mysqli_error($con));
      
        $row1=mysqli_fetch_array($query1);

?>    
         
		 
		 
		 

                   <table class="table">
                    <thead>
					
					 <tr>
            
				  <th colspan="5"><p style="font-size:24px;">CITIBUILDERS AND SUPPLY </p>
				  <p>0168 PUROK 1 DIVERSION RD. BRGY KINAMALIGAN MASBATE CITY </p>
				   <p>TM: 0967-937-2550 / SMART 0919-839-4967 </p>
				    <p>Email Address: citibuilders42@yahoo.com </p>
				   </th>
				   <th></th>
				     <th></th>
					  
				    <th colspan="2"> <img src="logo.jpg" alt="logo" style="min-width:300px;height:130px;border-radius:90%;"/>
                            
				  </th>
                      </tr>
					
                      <tr>
                        <th colspan="4"><h3><b>GLASS & ROOFING DEPARTMENT</b></h3></th>
						<th></th>
				       <th></th>
					     <th></th>
					   <th></th>
					
                        <th style="min-width:400px;"><h2><u>ACKNOWLEDGEMENT RECEIPT</u></h2></th>
                      </tr>
                    </thead>
                    <thead>

                      <tr>
                        <th>CUSTOMER:</th>
                        <th colspan="4" style="font-weight: bold;width:600px;font-family: Arial, Helvetica, sans-serif;font-size:16px;margin:0;padding:0;" ><u><?php echo $last.", ".$first;?></u></th>
						
                        <th colspan="3" >Trans Date:</th>
                        <th style="font-weight: bold;font-family: Arial, Helvetica, sans-serif;font-size:14px;margin:0;padding:0;"><u><?php echo date("M d, Y");?> Time <?php echo date("h:i A");?></u></th>
                      </tr>
                     
                    </thead>
                  </table>
                  <table class="table">
                    <thead>
                        
                      <tr >
                        <th style="border: solid 2px #000">SALE#</th>
                        <th style="border: solid 2px #000">AMOUNT</th>
                      
                      </tr>
					  <tr >
                        <th style="border: solid 2px #000">SALES NUMBER: SN00<?php echo $sales_id;?></th>
                        <th style="border: solid 2px #000"><?php echo $partial1; ?></th>
                      
                      </tr>
					  
					    <tr >
                        <th style="border: solid 2px #000">BANK:N/A</th>
                        <th style="border: solid 2px #000">SUBTOTAL : <?php echo $partial1; ?></th>
                      
                      </tr>
					   <tr >
                        <th style="border: solid 2px #000">CHECK#: N/A:</th>
                        <th style="border: solid 2px #000">WHTAX : 00.00</th>
                      
                      </tr>
					  <tr >
                        <th style="border: solid 2px #000">CHECKDATE: N/A:</th>
                        <th style="border: solid 2px #000">LOYALTY PAID : 00.00</th>
                      
                      </tr>
					  <tr >
                        <th style="border: solid 2px #000">BALANCE:<?php echo $rowk['balance'];?></th>
                        <th style="border: solid 2px #000">TOTAL AMOUNT : <?php echo $partial1; ?></th>
                      
                      </tr>
                    </thead>
                    <tbody>


</tbody>
</table>

	 <div style="margin-left:50px;margin-top:0px;width:300px;position:fixed">
	  <p style="font-weight:bold;">Confirmed By: </p> 
						<center>  <p>_____________________________________</p>
						  <p style="font-weight:bold;">Customer Signature over printed name</p>  </center>
						  </div>
<br></br>
<br></br>
<br></br>
						  <h5 style="font-weight:bold;color:#DAA520	">BANK NAME: METROBANK  &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp     &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp   &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp GCASH</h5>
						  <h5 style="font-weight:bold; color:#DAA520	">ACCOUNT # 369-7369-010-766  &nbsp &nbsp &nbsp &nbsp &nbsp  &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp  &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp     &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp ACCOUNT NAME: ERROL JOHNSON SIA</h5>
						   <h5 style="font-weight:bold; color:#DAA520	">ACCOUNT NAME:  CITIBUILDERS AND SUPPLY  &nbsp &nbsp &nbsp &nbsp  &nbsp  &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp  &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp     &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp ACCOUNT NO: 0947-243-9867</h5>
						  
						
						  	
                </div><!-- /.box-body -->
				</div>  
				</form>	
                </div><!-- /.box-body -->
                <a class = "btn btn-success btn-print" href = "" onclick = "window.print()"><i class ="glyphicon glyphicon-print"></i> Print</a>
                <a class = "btn btn-primary btn-print" href = "home.php"><i class ="glyphicon glyphicon-arrow-left"></i> Back to Homepage</a>
              </div><!-- /.box -->
            </div><!-- /.col (right) -->
           
          </div><!-- /.row -->
	  
             
          </section><!-- /.content -->
        </div><!-- /.container -->
      </div><!-- /.content-wrapper -->
     
    </div><!-- ./wrapper -->
	
	
	<script type="text/javascript" src="autosum.js"></script>
    <!-- jQuery 2.1.4 -->
    <script src="../plugins/jQuery/jQuery-2.1.4.min.js"></script>
	<script src="../dist/js/jquery.min.js"></script>
    <!-- Bootstrap 3.3.5 -->
    <script src="../bootstrap/js/bootstrap.min.js"></script>
    <script src="../plugins/select2/select2.full.min.js"></script>
    <!-- SlimScroll -->
    <script src="../plugins/slimScroll/jquery.slimscroll.min.js"></script>
    <!-- FastClick -->
    <script src="../plugins/fastclick/fastclick.min.js"></script>
    <!-- AdminLTE App -->
    <script src="../dist/js/app.min.js"></script>
    <!-- AdminLTE for demo purposes -->
    <script src="../dist/js/demo.js"></script>
    <script src="../plugins/datatables/jquery.dataTables.min.js"></script>
    <script src="../plugins/datatables/dataTables.bootstrap.min.js"></script>
   
  </body>
</html>
