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

$zdb = $_SESSION["zdbyear_" . $dbname];
$zyear = right($zdb, 4);
$mfrdate = getzdates($zyear, 'S');
$mtodate = getzdates($zyear, 'E');

$formname = "Stock (Raw Materials)";
mysqli_select_db($conn, $zdb);

$action = 'stockrw_fr.php';
?>
<?php include("includes/files.php");
include("includes/combo2.php");

?> 
    <form class="form-horizontal" action='<?= $action ?>' method='POST'>
        <div class="row">
            <div class="col-lg-12">
                <div class="box">
                    <header>
                        <div class="icons">
                            <i class="fa fa-edit"></i>
                        </div>
                        <h5><?= $formname ?></h5>
                        <div class="toolbar">
                            <ul class="nav pull-right">
                                <li>
                                   <input id="submit" type='submit' name='view' value='View' class="btn btn-success">
                                </li>
                                <li>
                                    <a class="minimize-box" data-toggle="collapse" href="#div-4">
                                        <i class="fa fa-chevron-up"></i>
                                    </a>
                                </li>
                            </ul>
                        </div><!-- /.toolbar -->
                    </header>
                    <div id="div-4" class="accordion-body collapse in body">

<!--                        <div class="form-group">
                            <label class="control-label col-lg-3">Barcode</label>
                            <div class="col-lg-5">
                                <div class="input-group">
                                    <input type="text" size="40" name="barcode" class="form-control" />                      
                                </div>
                            </div>
                        </div>-->
                        <div class="form-group">
                            <label class="control-label col-lg-3">Name</label>
                            <div class="col-lg-5">
                                <div class="input-group">
                                    <input type="text" size="40" name="name" class="form-control" />                      
                                </div>
                            </div>
                        </div>
<!--                        <div class="form-group">
                            <label class="control-label col-lg-3">Group</label>
                            <div class="col-lg-5">
                                <div class="input-group">
                                    <select class='form-control' name='itemgrp' id="itemgrp" class="itemgrp" style="width:297px;height:33px;">
                                        <option value=""></option>
                                        <?php
//                                        $mown = mysqli_query($conn, "SELECT code, `name` FROM `itemgrp` 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>-->
                        <div class="form-group">
                            <label class="control-label col-lg-3">Godown</label>
                            <div class="col-lg-2">
                                <div class="input-group">
                                    <select class='godown form-control' name='godown' id="cmbgodown" style="height:33px;">
                                        <option value=""></option>
                                        <?php
                                        $mown1 = mysqli_query($conn, "SELECT code, `gdcode` FROM `godown` ORDER BY `gdcode`") or die(mysqli_error($conn));
                                        while ($trow1 = mysqli_fetch_array($mown1)) {
                                            echo "<option value='$trow1[code]'>$trow1[gdcode]</option>";
                                        }
                                        ?>
                                    </select>

                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-lg-3">From Date</label>
                            <div class="col-lg-5">
                                <div class="input-group">
<!--                                    <input type="date" id="invdt" name="frmdt" class="form-control" value="<?php echo date("Y-m-d"); ?>" />   -->
                                    <input type="date" id="invdt" name="frmdt" class="form-control" value="<?php echo $mfrdate; ?>" />  
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-lg-3">As on Date</label>
                            <div class="col-lg-5">
                                <div class="input-group">
                                    <input type="date" id="invdt" name="todt" class="form-control" value="<?php echo $mtodate; ?>" />  
                                </div>
                            </div>
                        </div>
<!--                        <div class="form-group">
                            <label class="control-label col-lg-3">Order By</label>
                            <div class="col-lg-5">
                                <div class="input-group">
                                    <select name="orderby" class="form-control" style="height:33px;width:108px;">
                                        <option value="1">Barcode</option>
                                        <option value="2">Name</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-lg-3">Cost From</label>
                            <div class="col-lg-5">
                                <div class="input-group">
                                    <select name="dtype" class="form-control" style="height:33px;width:150px;">
                                        <option value="1">Last Purchased</option>
                                        <option value="2">Master</option>
                                    </select>
                                </div>
                            </div>
                        </div>-->
<!--                        <div class="form-group">
                            <label class="control-label col-lg-3">Print Image</label>
                            <div class="col-lg-5">
                                <div class="input-group">
                                    <select name="img" class="form-control" style="height:33px;">
                                        <option value="0">No</option>
                                        <option value="1">Yes</option>
                                    </select>
                                </div>
                            </div>
                        </div>-->

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