<?php include('./security.php');   
?>
<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">Price Control</h3>
        </div>
        <form role="form" name ="form1" class="form-horizontal">
            <div class="box-body">

                <div class="form-group">
                    
                     <a onclick="new_inv();" class="btn btn-default btn-sm">
                        <span class="fa fa-user-plus"></span> &nbsp; New
                    </a>
                       <?php 
				$sql_userp="select * from view_userpermission where username='".$_SESSION["UserName"]."' and docname='PRICE CONTROL' 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){
            	   
            	    } 
            	    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){
            	       
            	    }
            	     
			    										
                }
            	?>	
                </div>
                <div id="msg_box"  class="span12 text-center"  ></div>

                <input type="hidden" id="tmpno" class="form-control">
                <input type="hidden" id="item_count" class="form-control">


                <div class="form-group">
                    <label for="firstname_hidden" class="col-sm-1 control-label">Brand</label>
                    <div class="col-sm-1">
                        <select id="brand" onclick="load_items();" class="form-control input-sm"  >

                            <?php
                            if (($_SESSION["CURRENT_DEP"] != "") and (!is_numeric($_SESSION["CURRENT_DEP"]))) {
                                $sql = "select * from brand_mas where act ='1' and costcenter='" . $_SESSION["CURRENT_DEP"] . "' and barnd_name !='Dag CustomeDag Customerr' and barnd_name !='Dag Custormer' and barnd_name !='Rebuild Customer' and barnd_name !='Dag Sale' and barnd_name !='rebuild sale' and barnd_name !='Dag Customer' order by barnd_name";
                            } else {
                                $sql = "select * from brand_mas where act ='1' and barnd_name !='Dag CustomeDag Customerr' and barnd_name !='Dag Custormer' and barnd_name !='Rebuild Customer' and barnd_name !='Dag Sale' and barnd_name !='rebuild sale' and barnd_name !='Dag Customer' 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>
                    <label for="firstname_hidden" class="col-sm-1 control-label">Category</label>
                    <div class="col-sm-1">
                        <select id="category" onclick="load_items();" class="form-control input-sm"  >
                            <option value='ALL'>ALL</option>
                            <?php
                           
                            $sql = "select * from s_mas_category ";
                             
                            $result = mysqli_query($GLOBALS['dbinv'], $sql);
                            while ($row = mysqli_fetch_array($result)) {
                                echo "<option value='" . $row["name"] . "'>" . $row["name"] . "</option>";
                            }
                            ?>
                        </select>
                    </div>
                     <label for="firstname_hidden" class="col-sm-1 control-label">Group</label>
                    <div class="col-sm-1">
                        <select id="group" onclick="load_items();" class="form-control input-sm"  >
                            <option value='ALL'>ALL</option>
                            <?php
                           
                            $sql = "select * from s_mas_group ";
                             
                            $result = mysqli_query($GLOBALS['dbinv'], $sql);
                            while ($row = mysqli_fetch_array($result)) {
                                echo "<option value='" . $row["name"] . "'>" . $row["name"] . "</option>";
                            }
                            ?>
                        </select>
                    </div>
                    <label for="firstname_hidden" class="col-sm-1 control-label">Retail Dis%</label>
                    <div class="col-sm-1">
                        <input type="number" name="retail_dis" id="retail_dis" placeholder="Retail Dis%"   class="form-control input-sm" onchange="dis_up_inv();" onkeyup="dis_up_inv();">    
                    </div>
                    <label for="firstname_hidden" class="col-sm-1 control-label">Dealer Dis%</label>
                    <div class="col-sm-1">
                        <input type="number" name="dealer_dis" id="dealer_dis" placeholder="Dealer Dis%"   class="form-control input-sm" onchange="dis_up_inv();" onkeyup="dis_up_inv();">    
                    </div>
                    <label for="firstname_hidden" class="col-sm-1 control-label">Distributer Dis%</label>
                    <div class="col-sm-1">
                        <input type="number" name="distri_dis" id="distri_dis" placeholder="Distributer Dis%"   class="form-control input-sm" onchange="dis_up_inv();" onkeyup="dis_up_inv();">    
                    </div>
                </div>


                <div class="col-sm-12">


                    <div id="itemdetails" class="col-sm-12" >

                    </div>
                </div>


            </div>

    </div>

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

    </div>

</form>
</div>

</section>

<script src="js/price_control.js"></script>
<script src="js/common.js"></script>
<script src="js/jquery-1.9.1.js"></script>
<script src="js/jquery-ui.custom.js"></script>
<script src="js/common.js"></script>
<script  type="text/javascript" src="js/jquery-1.6.1.min.js"></script>
<script  type="text/javascript" src="js/jquery-ui-1.8.14.custom.min.js"></script>

