<?php
ini_set('session.gc_maxlifetime', 30 * 60 * 60 * 60);
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">CUSTOMER SUMMERY</h3>
        </div>

        <form role="form" name ="form1" class="form-horizontal" target="_blank" action="cussummery_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>
                      
                          <input type="submit" class="btn btn-default" value="PRINT" 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">Code</label>
                    <div class="col-sm-1">
                        <input type="text"  class="form-control input-sm  "   name="Txtcusco" id="Txtcusco">
                    </div>

                    <div class="col-sm-3">
                        <input type="text" class="form-control input-sm  " disabled="disabled" id="txtcusname" name="txtcusname" />
                    </div>
                    
                    <div class="col-sm-1">
                        <a href=""  class="btn btn-danger btn-sm " onClick="NewWindow('../serach_customer.php?stname=ret_cheque_entry', 'mywin', '800', '700', 'yes', 'center');
                                return false" onFocus="this.blur()">
                            ...
                        </a>
                    </div>
              
                

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

                </div> 
                
                 <div class="form-group">
                     <label class="col-sm-1 control-label" for="sdate">Brand</label>
                    <div class="col-sm-4">
                         <select id="brand" name="brand"   class="form-control input-sm" onblur="brandsession();" >
                                     <option value="ALL">ALL</option>
                                <?php
                                 
                                // $sql = "select * from brand_mas where act ='1' order by barnd_name";
                                
                                // $result = mysqli_query($GLOBALS['dbinv'], $sql);
                                // while ($row = mysqli_fetch_array($result)) {
                                //     echo "<option value='" . $row["barnd_name"] . "'>" . $row["barnd_name"] . "</option>";
                                // }
                                ?>
                            </select>
                    
                    </div>
                 </div> 
                 
                 
                 
                 <div class="form-group">
            <label class="col-sm-1 control-label talign" for="invno">Sales Ex</label>

            <div class="col-sm-4">
                <select id="salesrep" name="salesrep" class="form-control input-sm" >
  <option value="ALL">ALL</option>
                    <?php
                    require_once("connectioni.php");
                    // if ($_SESSION["MANAGER"] != "") {
                        
                    //     $sql = "select * from s_salrep where cancel='1' and manager='" . $_SESSION["MANAGER"] . "'order by REPCODE";
                    //     $result = mysqli_query($GLOBALS['dbinv'], $sql);
                    //     while ($row = mysqli_fetch_array($result)) {
                    //         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";
                    //     $result = mysqli_query($GLOBALS['dbinv'], $sql);
                    //     while ($row = mysqli_fetch_array($result)) {
                    //         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";
                         $sql="select * from s_salrep where cancel='0' and SCODE = '" . $_SESSION["company"] ."' order by REPCODE";
                        $result = mysqli_query($GLOBALS['dbinv'], $sql);
                        while ($row = mysqli_fetch_array($result)) {
                            echo "<option value='" . $row["REPCODE"] . "'>" . $row["REPCODE"] . " " . $row["Name"] . "</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
                    require_once("connectioni.php");
                    // if ($_SESSION["MANAGER"] != "") {
                        
                    //     $sql = "select * from s_salrep where cancel='1' and manager='" . $_SESSION["MANAGER"] . "'order by REPCODE";
                    //     $result = mysqli_query($GLOBALS['dbinv'], $sql);
                    //     while ($row = mysqli_fetch_array($result)) {
                    //         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";
                    //     $result = mysqli_query($GLOBALS['dbinv'], $sql);
                    //     while ($row = mysqli_fetch_array($result)) {
                    //         echo "<option value='" . $row["REPCODE"] . "'>" . $row["REPCODE"] . " " . $row["Name"] . "</option>";
                    //     }
                    // } else {
                    
                     if ( $_SESSION['User_Type'] == "0") {
                          $sql="select * from invpara where flag = '" . $_SESSION["company"] ."' ";
                     }else{
                         $sql="select * from invpara  ";
                           echo "<option value='ALL'>ALL</option>";
                     }
                         
                        $result = mysqli_query($GLOBALS['dbinv'], $sql);
                        while ($row = mysqli_fetch_array($result)) {
                            echo "<option value='" . $row["flag"] . "'>" . $row["COMPANY"] . " " . $row["COMPANY1"] . " " . $row["ADD1"] . "</option>";
                        }
                    // }
                    ?>
                </select>
            </div>
            </div> 
            
             </div>
            
        </form>
    </div>

</section>

 

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