<?php
ob_start();
require("../includes/check_auth_user.php");
require("../includes/dbconnect.php");
include('../includes/function.php');

$formname = "Stock";
$action = "stock_fr.php";

$admin = $_SESSION["admin_" . $dbname];
$zdb = $_SESSION["zdbyear_" . $dbname];
$myyear = $_SESSION[$myyear];
mysqli_select_db($zdb);

include("../includes/linkshead.php");
?>
<!--<script>
    $(document).ready(function () {

        $(".itemname").change(function () {
            var item = $(".itemname").val();
            $(".itemcode").val(item);
        });

        $(".itemcode").change(function () {
            var itemcode = $(".itemcode").val();
            $(".itemname").val(itemcode).trigger("change");
        });

    });
</script>-->
<script>
    $(document).ready(function () {

        $("#subpdf").hide();
        $("#excel").hide();
    });
</script> 
</head>
<body>
    <form method='POST' action="<?= $action; ?>">
        <!-- Default box -->

        <div class="col-lg-5 col-md-12 col-sm-12 col-xs-12  pad">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title"><?php Echo $formname; ?></h3>

                </div>
                <div class="panel-body">
                    <div class="row">
                        <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                            <label class="label-control">Category</label>
                        </div>
                        <div class="col-lg-5 col-md-5 col-sm-8 col-xs-8 pad">
                            <select class='form-control select2' name='type'>
                                <option value=""></option>
                                <?php
                                $gettype = mysqli_query($conn, "SELECT `code`, `name` FROM `type` order by `name`") or die(mysqli_error($conn));
                                while ($type = mysqli_fetch_array($gettype)) {
                                    echo "<option value='$type[code]'>$type[name]</option>";
                                }
                                ?>
                            </select>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                            <label class="label-control">Sub-Category</label>
                        </div>
                        <div class="col-lg-5 col-md-5 col-sm-8 col-xs-8 pad">
                            <select class='form-control select2' name='subtype'>
                                <option value=""></option>
                                <?php
                                $getsubtype = mysqli_query($conn, "SELECT `code`, `name` FROM `subtype` order by `name`") or die(mysqli_error($conn));
                                while ($subtype = mysqli_fetch_array($getsubtype)) {
                                    echo "<option value='$subtype[code]'>$subtype[name]</option>";
                                }
                                ?>
                            </select>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                            <label class="label-control">Product</label>
                        </div>
                        <div class="col-lg-5 col-md-5 col-sm-8 col-xs-8 pad">
                            <select class='form-control select2' name='product'>
                                <option value=""></option>
                                <?php
                                $mown = mysqli_query($conn, "SELECT code, `name` FROM `product` order by `name`") or die(mysqli_error($conn));
                                while ($trow = mysqli_fetch_array($mown)) {
                                    echo "<option value='$trow[code]'>$trow[name]</option>";
                                }
                                ?>
                            </select>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                            <label class="label-control">Size</label>
                        </div>
                        <div class="col-lg-2 col-md-2 col-sm-4 col-xs-4 pad">
                            <select class='form-control select2' name='size'>
                                <option value=""></option>
                                <?php
                                $msize = mysqli_query($conn, "SELECT `code`, `name` FROM `size` order by `name`") or die(mysqli_error($conn));
                                while ($size = mysqli_fetch_array($msize)) {
                                    echo "<option value='$size[code]'>$size[name]</option>";
                                }
                                ?>
                            </select>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                            <label class="label-control ">As on Date</label>
                        </div>
                        <div class="col-lg-5 col-md-5 col-sm-8 col-xs-8 pad">
                            <input type="date" id="mtodt" name="todt" class="form-control" value="<?php echo date("Y-m-d"); ?>" />  
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                            <label class="label-control">Print Zero Stock</label>
                        </div>
                        <div class="col-lg-2 col-md-2 col-sm-8 col-xs-8 pad">
                            <select name="zerostk" class="form-control select2" style="height:33px;">
                                <option value="1">No</option>
                                <option value="2">Yes</option>
                            </select>
                        </div>
                    </div>

                    <!--                    <div class="row">
                                            <div class="col-lg-3 col-md-3 col-ms-3 col-xs-3 text-right pad">
                                                <label class="label-control">Print Value</label>
                                            </div>
                                            <div class="col-lg-2 col-md-2 col-sm-8 col-lg-8 pad">                          
                                                <select name="prnval" class="form-control select2" style="height:33px;">
                                                    <option value="1">No</option>
                                                    <option value="2">Yes</option>
                                                </select>
                                            </div>
                                        </div>-->
                </div>
                <div class="panel-footer">
                    <?php include("../includes/but_rep.php"); ?>
                </div>
            </div>
        </div>
    </form>
    <?php include("../includes/linksfoot.php"); ?>
</body>
</html>
