<?php
ini_set('session.gc_maxlifetime', 30 * 60 * 60 * 60);
session_start();
$_SESSION["brand"] = "";
if ($_SESSION["CURRENT_USER"] == "") {
    echo "Please Loging Again !!!";
    exit();
}

if ($_SESSION["company"] == "") {
    echo "Invalid User Session";
    exit();
}
?>
 
<!-- Main content -->
<section class="content">

    <div class="box box-primary">
        <div class="box-header with-border">
            <h3 class="box-title">Labour Master</h3>
            <b style="margin-top: -10px;"><p style="float: right; color: black" id="time"></p></b> 
        </div>

        <form role="form" name ="form1" class="form-horizontal">
            <div class="box-body">
                <br>               
                <div class="form-group">
                    <a onclick="new_inv();" class="btn btn-default">
                        <span class="fa fa-user-plus"></span> &nbsp; New

                    </a>
                     <?php 
				$sql_userp="select * from view_userpermission where username='".$_SESSION["UserName"]."' and docname='LABOUR MASTER' and grp='Master Files' ";
            	$result_userp = $conn->query($sql_userp);
                if ($row_userp = $result_userp->fetch()) {
            	    
            	    if($row_userp['doc_feed']==1){
            	       echo" <a onclick='save_inv();' class='btn btn-success btn-sm'>
                            <span class='fa fa-save'></span> &nbsp; Save
                        </a> ";
            	    } 
            	      if($row_userp['doc_view']==1){
            	       echo" <a onclick=\"NewWindow('labour_search.php', 'mywin', '800', '700', 'yes', 'center'); return false\" class='btn btn-info btn-sm'>
                            <span class='fa fa-search'></span> &nbsp; Search
                        </a> ";
            	    } 
            	    if($row_userp['doc_mod']==1){
            	       echo" <a onclick='update_inv();' class='btn btn-warning btn-sm'>
                            <span class='fa fa-save'></span> &nbsp; Update
                        </a> ";
            	    }
            	     if($row_userp['doc_print']==1){
            	       echo" <a onclick='print_inv();' class='btn btn-default btn-sm'>
                            <span class='fa fa-print'></span> &nbsp; Print
                        </a> ";
            	    }
            	    
            	    if($row_userp['doc_cancel']==1){
            	       echo" <a onclick='cancel_inv();' class='btn btn-danger btn-sm'>
                            <span class='fa fa-trash'></span> &nbsp; Cancel
                        </a> ";
            	    }
            	     
			    										
                }
            	?>	
                </div>
                <div id="msg_box"  class="span12 text-center"  ></div>
                <div class="form-group">
                	<label class="col-sm-1 control-label talign" for="invno">Ref No</label>
                    <div class="col-sm-2">
                        <input type="text"  class="form-control input-sm"  disabled="" id="refno">
                    </div>

                    <label class="col-sm-1 control-label" for="sdate">Date</label>
                    <div class="col-sm-2">
                        <input type="text" name="sdate" disabled=""   id="sdate" value="<?php echo date('yy-m-d')?>"  class="form-control dt input-sm">
                    </div>
                </div>

                <div class="form-group">  
                    <label class="col-sm-1 control-label talign" for="invno">Name</label>
                    <div class="col-sm-4">
                        <input type="text"  class="form-control input-sm"     id="name">
                    </div>
                    
                 </div>
                <div class="form-group">
                    <label class="col-sm-1 control-label talign" for="invno">Type</label>
                    <div class="col-sm-4">
                        <select class="form-control" id="type" >
                            <option value="">Select Type</option>
                            <option value="Labour">Labour</option>
                            <option value="Driver">Driver</option>
                            <option value="Vehicle">Vehicle</option>
                        </select>
                    </div>

                </div>
                <div class="form-group">
                    <label class="col-sm-1 control-label talign" for="invno">Company</label>
                    <div class="col-sm-4">
                       <select id="company" name="company" class="form-control input-sm" >

                    <?php
                        $sql="select * from invpara  ";
                        $result = mysqli_query($GLOBALS['dbinv'], $sql);
                        while ($row = mysqli_fetch_array($result)) {
                            echo "<option value='" . $row["flag"] . "'>" . $row["flag"] . " - " . $row["COMPANY"] . " - " . $row["COMPANY1"] . "</option>";
                        }
                    // }
                    ?>
                </select>
                    </div> 
                 </div> 
                

                 

        </form>
    </div>

</section>

<script src="js/labour.js"></script>


<script> 
         new_inv();
                            
</script> 