<?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">Outstanding Aging report</h3>


            <form role="form" name ="form1" action="aging_data.php"  target="_blank" method="GET" class="form-horizontal">

                <br>               
                <div style="margin-left: 10px;"class="form-group">
                    <a onclick="new_inv1();" class="btn btn-default">
                        <span class="fa fa-user-plus"></span> &nbsp; New

                    </a>
                    <!--                        <a onfocus="this.blur()" onclick="NewWindow('search_tourPlan.php', 'mywin', '800', '700', 'yes', 'center');
                                                    return false" href="">
                                                <input type="button" class="btn btn-find" value="Find" id="searchcust" name="searchcust">
                                            </a>-->

                </div>
                <div id="msg_box"  class="span12 text-center"  ></div>
                <div class="form-group">
                    <div class="col-sm-12">
                        <label class="col-sm-1 control-label" for="invno">Customer</label>
                        <div class="col-sm-2">
                            <input  type="text" placeholder="Code" id="c_code" name='c_code' class="form-control input-sm ">
                        </div>
                        <div class="col-sm-2">
                            <input  type="text" placeholder="Name" id="c_name"   class="form-control input-sm ">
                        </div>
                         <div class="col-sm-1">
                        <a onfocus="this.blur()" onclick="NewWindow('serach_customer_rep.php', 'mywin', '800', '700', 'yes', 'center');
                                return false" href="">
                            <input type="button" class="btn btn-default btn-sm" value="..." id="searchcust" name="searchcust">
                        </a>
                    </div>
                        <!--<div class="col-sm-1">-->
                        <!--    <input type="checkbox" name="customerchk"    id="customerchk">-->
                        <!--</div>-->
                        <div class="col-sm-3 form-group-sm"> 
                            <?php
                             require_once("connectioni.php");
                            echo"<select id = \"rep_name\" name = \"rep_name\"  class =\"form-control input-sm\">";
                            if ($_SESSION["CURRENT_REP"] == "") {
                                echo "<option value='All'>All</option>";
                                $sql = "select * from s_salrep  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";
//                                echo $sql;
                                $result = mysqli_query($GLOBALS['dbinv'], $sql);
                                while ($row = mysqli_fetch_array($result)) {
                                    echo "<option value='" . $row["REPCODE"] . "'>" . $row["REPCODE"] . " " . $row["Name"] . "</option>";
                                }
                            }
                            echo"</select>";
                            ?>
                        </div>
                        <!--<div class="col-sm-1">-->

                        <!--    <input type="checkbox" name="ref_chk"    id="ref_chk">-->
                        <!--</div>   -->
                    </div>
                </div>

                <div class="form-group">
                <div class="col-sm-12" >
                    <label class="col-sm-1 control-label" for="invdate">Address</label>
                    <div class="col-sm-4">
                        <input type="text" placeholder="Address" name="address" id="address" class="form-control input-sm">  
                    </div>

                    <!--<label class="col-sm-1 control-label" for="invdate">From</label>-->
                    <!--<div class="col-sm-2">-->
                    <!--    <input type="text" value="<?php echo date('Y-m-d'); ?>" name="from_date" id="from_date" class="form-control dt input-sm">  -->
                    <!--</div> -->
                    <!--<label class="col-sm-1 control-label" for="invdate">To</label>-->
                    <!--<div class="col-sm-2">-->
                    <!--    <input type="text" value="<?php echo date('Y-m-d'); ?>" name="to_date" id="to_date" class="form-control dt input-sm">  -->
                    <!--</div>-->
                    <!--<div class="col-sm-1">-->
                    <!--    <input type="checkbox" name="date_chk"   id="date_chk"> -->
                    <!--</div>-->
                </div>
                </div>
                   <div class="form-group"></div>
                <!--<div class="form-group">-->
                <!--    <div class="col-sm-12">-->
                <!--        <label class="col-sm-1 control-label" for="invno">Days Over</label>-->
                <!--        <div class="col-sm-2">-->
                <!--            <input  type="text" placeholder="Days Over" id="days_over" name="days_over" class="form-control input-sm ">-->
                <!--        </div>    -->
                <!--    </div>-->
                <!--</div>-->
                <div class="form-group"></div>
                <div class="form-group">
                    <div class="col-sm-12">
                        <!--<label class="col-sm-1 control-label" for="invno">Days Below</label>-->
                        <!--<div class="col-sm-2">-->
                        <!--    <input  type="text" placeholder="Days Below" id="days_below"  name="days_below" class="form-control input-sm ">-->
                        <!--</div>-->
                        <!--<label class="col-sm-1 control-label" for="invno">As At Date</label>-->
                    <!--    <div class="col-sm-2">-->
                    <!--    <input type="text" value="<?php echo date('Y-m-d'); ?>" name="asAt_date" id="asAt_date" class="form-control dt input-sm">  -->
                    <!--</div>-->
                    <!--<div class="col-sm-1">-->
                    <!--    <input type="checkbox" name="asat_date_chk"   id="asat_date_chks"> -->
                    <!--</div>    -->
                    </div>


                </div>


                <div><br></div>


                <div  class='space' >
                    <br>&nbsp;

                </div>
                <input style="margin-left: 500px;" type="submit" name="button" id="button" value="View"   class="btn btn-primary">

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

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