<!-- Main content -->
<?php
ini_set('session.gc_maxlifetime', 30 * 60 * 60 * 60);
session_start();
$_SESSION["brand"] = "";
if ($_SESSION["dev"] == "") {
    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">BATTERY STATUS</h3>
        </div>

        <form role="form" name ="form1" class="form-horizontal" target="_blank" action="battery_status_print.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>  
                    <button><a onclick="print_inv();" class="btn btn-primary btn-sm">
                        <span class="fa fa-print"></span> &nbsp; Print
                    </a></button>
                    
                   
                </div>
                <div id="msg_box"  class="span12 text-center"  ></div>
                 
                <div class="row">
                     <div class="form-group">
                    <label class="col-sm-1 control-label" for="txt_usernm">CUSTOMER CODE</label>
                    <div class="col-sm-2">
                        <input type="text" placeholder="CUSTOMER CODE" id="cuscode" name="cuscode"     class="form-control">
                    </div>
                    <label class="col-sm-1 control-label" for="txt_usernm">CUSTOMER NAME</label>
                    <div class="col-sm-2">
                        <input type="text" placeholder="NAME" id="cusname" name="cusname"   class="form-control">
                    </div> 
                    <div class="col-sm-1">
                        <a onfocus="this.blur()" onclick="NewWindow('customer_search.php', 'mywin', '800', '700', 'yes', 'center');
                        return false" href="">
                        <input type="button" class="btn btn-danger" value="..." id="searchcust" name="searchcust">
                    </a>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-1 control-label" for="txt_usernm">DATE FROM</label>
                    <div class="col-sm-2">
                        <input type="text" id="dtfrom" name="dtfrom"  value="<?php echo date('Y-m-d');?>"   class="form-control dt">
                    </div>
                    <label class="col-sm-1 control-label" for="txt_usernm">DATE TO</label>
                    <div class="col-sm-2">
                        <input type="text"   id="dtto" name="dtto"  value="<?php echo date('Y-m-d');?>"  class="form-control dt">
                    </div>  
                    <div class="col-sm-2">
                       <input type="checkbox"   id="check" name="check"    >
                    </div>  
                    
                </div>
                
                <div class="form-group">
                    <label class="col-sm-1 control-label" for="txt_usernm">TYPE</label>
                    <div class="col-sm-2">
                       <select id="type" name="type" class="form-control input-sm"> 
                            <option value="REMAINING">STORES REMAINING BATTERY</option> 
                            <option value="RISK">RISK LEVEL BATTERY</option>    
                            <option value="DEALERPOINT">DEALER POINT BATTERY</option>     
                        </select>
                    </div>
                     
                </div>
                <div class="form-group">
                   
                    <label class="col-sm-1 control-label" for="txt_usernm">MARETING EX.</label>
                    <div class="col-sm-2">
                       <select id="services" name="services"  class="form-control input-sm"  >
                                <option value="ALL">ALL</option>
                                <?php 
                    if ($_SESSION["MANAGER"] != "") {
                        $sql = "select * from s_salrep where cancel='1' and manager='" . $_SESSION["MANAGER"] . "'order by REPCODE";
                        foreach ($conn->query($sql) as $row) {
                            echo "<option value='" . $row["REPCODE"] . "'>" . $row["REPCODE"] . " " . $row["Name"] . "</option>";
                        }
                    } else if ($_SESSION["CURRENT_REP"] == "") {
                        $sql = "select * from s_salrep where cancel='1' order by REPCODE";
                        foreach ($conn->query($sql) as $row) {
                            echo "<option value='" . $row["REPCODE"] . "'>" . $row["REPCODE"] . " " . $row["Name"] . "</option>";
                        }
                    } else {
                        $sql = "select * from s_salrep where cancel='1' and repcode = '" . $_SESSION["CURRENT_REP"] . "' order by REPCODE";
                        foreach ($conn->query($sql) as $row) {
                            echo "<option value='" . $row["REPCODE"] . "'>" . $row["REPCODE"] . " " . $row["Name"] . "</option>";
                        }
                    }
                    ?>
                            </select>
                    </div>
                      
                </div>
                 
            </div>
                
        </form>
    </div>

</section>
