<?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 = "Itemwise Sale Register";
$action = "itemwise_sale_fr.php";
mysqli_select_db($conn, $zdb);

include("includes/linkshead.php");
//include("includes/combo.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>
                                <li><input id="submit" type='submit' name='view' value='View' class="btn btn-primary"></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">Item Name</label>
                            <div class="col-lg-5">
                                <div class="input-group">
                                    <select class='form-control' name='name' class="item" style="width:297px;height:33px;" required>
                                        <option value=""></option>
                                        <?php
                                        $getitem = mysqli_query($conn, "SELECT code, `name` FROM `item` ORDER BY `name`") or die(mysqli_error($conn));
                                        while ($iget = mysqli_fetch_array($getitem)) {
                                            echo "<option value='$iget[code]'>$iget[name]</option>";
                                        }
                                        ?>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                        <label class="control-label col-lg-3">Party Name</label>
                        <div class="col-lg-5">
                          <div class="input-group">
                            <select class='form-control' name='pname' class="party" style="width:297px;height:33px;">
                            <option value=""></option>
                            <?php
                            $mown = mysqli_query($conn, "SELECT accode, `name` FROM `accmast` WHERE `grpcode`='010' ORDER BY `name`") or die(mysqli_error($conn));
                            while ($trow = mysqli_fetch_array($mown)) {
                                echo "<option value='$trow[accode]'>$trow[name]</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="mfrdt" name="frmdt" class="form-control" value="<?php echo $mfrdate; ?>" />  
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-lg-3">To Date</label>
                            <div class="col-lg-5">
                                <div class="input-group">
                                    <input type="date" id="mtodt" name="todt" class="form-control" value="<?php echo $mtodate; ?>" />  
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
</form>