<?php
ini_set('session.gc_maxlifetime', 30 * 60 * 60 * 60);
include './connection_sql.php';
session_start();
$_SESSION["brand"] = "";
if ($_SESSION["dev"] == "") {
    echo "Invalid User Session";
    exit();
}
?>

<link rel="stylesheet" href="css/themes/redmond/jquery-ui-1.10.3.custom.css" />

<!-- Main content -->
<section class="content">

    <div class="box box-primary">
        <div class="box-header with-border">
            <h3 class="box-title">PROFIT</h3>
        </div>

        <form role="form" name ="form1" class="form-horizontal" target="_blank" action="profit_report.php">
            <div class="box-body">
                <br>               
                <div class="form-group">
                     <a onclick="location.reload()" class="btn btn-default">
                            <span class="fa fa-user-plus"></span> &nbsp; New

                        </a>
                      
                          <input type="submit" class="btn btn-default" value="VIEW" id="button" name="button">

                       
 

                </div>
                <div id="msg_box"  class="span12 text-center"  ></div>
                <div class="form-group">
                    <label class="col-sm-1 control-label" for="invno">DEPARTMENT</label>
                    <div class="col-sm-2">
                       <select id="dep"  name="dep"class="form-control input-sm" >
<option value="ALL">ALL</option>
                            <?php
                            
                            
                             if (!is_numeric($_SESSION["CURRENT_DEP"]))  {							 						
                    $sql="select * from s_stomas  order by CODE";
                    foreach ($conn->query($sql) as $row) {
                        echo "<option value='".$row["CODE"]."'>  ".$row["DESCRIPTION"]."</option>";
                    }
				} else {
                    $sql="select * from s_stomas  where CODE = '" . $_SESSION["CURRENT_DEP"] ."' order by CODE";
					foreach ($conn->query($sql) as $row) {
                    echo "<option value='".$row["CODE"]."'>  ".$row["DESCRIPTION"]."</option>";
                    }
                }
                            
                            
                            
                            ?>
                        </select>
                    </div> 
                

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

                </div> 
                
        </form>
    </div>

</section>

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


<script>
                            function myFunction() {
                                location.reload();
                            }
</script>