<?PHP

ob_start();

session_start();

include 'connect.php';

if(isset($_SESSION['adminemail']))

{

$user=$_SESSION['adminemail'];



$gtp=mysqli_query($conn,"select * from admin where username='$user'");

$gtp1=mysqli_fetch_assoc($gtp);



include 'top.php';

?>






<div id="page-wrapper" >
          <div id="page-inner">
<div class="main-content">

				<div class="main-content-inner">

					<div class="breadcrumbs ace-save-state" id="breadcrumbs">

						<ul class="breadcrumb">

							<li>

								<i class="ace-icon fa fa-home home-icon"></i>

								<a href="#">Home</a>

							</li>

							<li class="active">Imprest</li>

						</ul><!-- /.breadcrumb -->

					</div>



					<div class="page-content">

			



						<div class="page-header">

                        

							<?php



$aca=mysqli_query($conn,"select * from financial where user='$user' order by ID desc");

$aca1=mysqli_fetch_assoc($aca);



$financial=$aca1['financial'];



?>                        

                        

							<table style="width:100%;">

                        

                        <tr><td style="width:50%;">

                        

							<h1>

								Imprest

							</h1>

                            

                            </td>

                            

                            <td style="width:50%; text-align:right; padding-right:15px; font-size:15px;">

                            

                            <i class="fa fa-calendar"></i>&nbsp; <?php echo $financial; ?>

                            

                            </td></tr></table>

                            

						</div><!-- /.page-header -->

<br />



						<div class="row">

							<div class="col-xs-12">

                            

								<!-- PAGE CONTENT BEGINS -->

                                

<script src="assets/js/jquery.js"></script>

<script>

	

jQuery(function($){

		   

	// simple jQuery validation script

	$('#work').submit(function(){

		

		var valid = true;

		var errormsg = 'This field is required!';

		var errorcn = 'error';

		

		$('.' + errorcn, this).remove();			

		

		$('#required', this).each(function(){

			var parent = $(this).parent();

			if( $(this).val() == '' ){

				var msg = $(this).attr('title');

				msg = (msg != '') ? msg : errormsg;

				$('<span style="font-size:13px;color:#FF0000; padding-left:3px;" class="'+ errorcn +'">'+ msg +'</span>')

					.appendTo(parent)

					.fadeIn('fast')

					.click(function(){ $(this).remove(); });

				valid = false;

			};

		});

		

		return valid;

	});

	

});	



</script>

								



<?php



	



if(isset($_GET['id']))

{



$id=$_GET['id'];	



$sel=mysqli_query($conn,"select * from imprest where ID='$id'");

$sel1=mysqli_fetch_assoc($sel);



$sup=mysqli_query($conn,"select * from factory where ID='$sel1[factory]'");

$sup1=mysqli_fetch_assoc($sup);



echo"<table style='margin:auto;'>



<tr><td><b>Entry No.</b></td><td style='padding:0 7px;'>:</td><td>".$id."</td><td style='width:450px;'></td><td><b>Date</b></td><td style='padding:0 7px;'>:</td><td>".date('d-m-Y',strtotime($sel1['date']))."</td></tr>



<tr><td><b>Factory</b></td><td style='padding:0 7px;'>:</td><td>".$sup1['factory']."</td><td style='width:250px;'></td><td></td><td></td><td></td></tr>



</table><br /><br />";





echo"<table class='table table-striped table-bordered table-condensed' style='width:65%; margin:auto;'>



<thead><tr><th>Description</th><th>Amount</th></tr></thead>



<tr><td>".$sel1['description']."</td><td style='text-align:right;'>".$sel1['amount']."</td></tr>



</table><br />";



?>







<script type="text/javascript">



// Popup window code



function newPopup(url) {



	popupWindow = window.open(



		url,'popUpWindow','height=700,width=1000,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=no,onscreendisplay=yes,menubar=no,location=no,directories=no,status=yes')



}



</script>







<!-- <br /><br /><center><a href="JavaScript:newPopup('printreceipt.php?id=<?php echo $id; ?>');"><button class="btn btn-white btn-primary"><i class="fa fa-print"></i> Print</button></a></center> -->







<?php







echo"<br /><br /><center><a href='viewimprest.php'>Back</a></center>";







}



	



?>

                            

                               

								



								<!-- PAGE CONTENT ENDS -->

							</div><!-- /.col -->

						</div><!-- /.row -->

					



</div><!-- /.page-content -->

				</div>

			</div><!-- /.main-content -->
			</div><!-- /.main-content -->
			</div><!-- /.main-content -->





<?php

include 'bottom.php';

}

else

{



 header("location:login.php");

}

ob_flush();

?>