<?php
	include("includes/dbconfig.php");
	$pagetitle = "Add staff allowance";
	require('includes/applicationtop.php');
	require('includes/applicationmenu.php');//newexpanse.php
	
	
?>
			<!-- Content Wrapper. Contains page content -->
			<div class="content-wrapper">
				<!-- Content Header (Page header) -->
				<section class="content-header">
					 
					<ol class="breadcrumb">
					</ol>
				</section>

				<!-- Main content -->
				<section class="content">
					<!-- Default card -->
					<?php
						if($_SESSION["connectedusergroup"] == 3 || $_SESSION["connectedusergroup"] == 4 || $_SESSION["connectedusergroup"] == 1)
						{
					?>
					 

                    
				
					<div class="row">
						<div class="col-md-12"  id="customerdetails">
						
						 <!-- general form elements -->
            <div class="card card-primary">
              <div class="card-header">
                <h3 class="card-title">Add Advances</h3>
              </div>
              <!-- /.card-header -->
              <!-- form start -->
              <form role="form" action='staffallowances.php' method='post'>
                <div class="card-body">
				 <div class="form-group">
                        <label>Branch</label>
                        <select class="custom-select" required name='branch'>
				  
				  <?php
										$shopsalesdata = DB::query("SELECT id, full_name from shop ");
										
									 
										
										foreach($shopsalesdata as $row)
										{
											
											$branch = $_SESSION["connecteduserbranch"];
											if($row['id']== $branch){
												
										 
										 
											echo ' <option value='.$row['id'].'>'.$row['full_name'].'</option>';
												 
											}
										}
											foreach($shopsalesdata as $row)
										{
											
											 
										 
										 
											echo ' <option value='.$row['id'].'>'.$row['full_name'].'</option>';
											 
									?>
									
										 
									<?php
										}
									?>
									</select>
									</div>
				
				<div class="form-group">
                        <label>Type (Selected)  </label>
                       
                         <select class="custom-select" required name='expanse'>
							
				  
				  <?php
										$shopsalesdata = DB::query("SELECT *from expanse_types ");
										
									 
										
										foreach($shopsalesdata as $row)
										{
											if($row['eid'] ==2){
										 
										 
											echo ' <option value='.$row['eid'].'>'.$row['expanse_type'].'</option>';
											}
									?>
									
										 
									<?php
										}
									?>
									 
                        </select>
                      </div>
					  
                  <div class="form-group">
                    <label for="amount">Amount</label>
                    <input type="number" class="form-control" name='amount' id="amount" required  placeholder="Enter Amount">
                  </div>
				 
				 <div class="form-group">
                    <label for="employee">Staff</label> 
					<?php 
				 $personels =  DB::query(' SELECT *FROM personnel_details where role >1');
			 
				 ?>
					 <select class="custom-select" required name='employee'>
					 <option > Select</option>
					<?php 
					 
				 foreach($personels as $row){
					 echo ' <option value='.$row['id'].'>'.$row['display_name'].'</option>';
				 }
				 
				 ?>
				 </select>
				 
				 
                  </div>
				  
				 
				  
				  <div class="form-group">
                        <label>Notes</label>
                        <textarea class="form-control" rows="3"  name='notes' required placeholder="Enter ..."  ></textarea>
                      </div>
                   
                </div>
                <!-- /.card-body -->

                <div class="card-footer">
                  <button type="submit" class="btn btn-primary">Submit</button>
                </div>
              </form>
            </div>
            <!-- /.card -->
							 
						
						
					</div>
					<?php
						}
						else
						{
					?>
					<div class="alert alert-danger alert-dismissable">
						<i class="fa fa-ban-circle"></i>
						Limited Access
					</div>
					<?php
						}
					?>
				</section><!-- /.content -->
			</div><!-- /.content-wrapper -->

			 
		</div><!-- ./wrapper -->
		
		
		
		<?php include ('includes/general_footer.php')?>
		
		<script src="plugins/bert/jquery.price_format.min.js" type="text/javascript"></script>
		<script src="plugins/bert/storepos.js" type="text/javascript"></script>
		<script src="plugins/bert/cashsalesregister.js" type="text/javascript"></script>
	</body>
</html>