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

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

$formname = "Sale Register";
$action   = "salereg_fr.php";

mysqli_select_db($conn, $zdb);
include("includes/linkshead.php");
?>
</head>
<body>
<form method="POST" action="<?= $action ?>">
    <div class="col-lg-5 col-md-10 col-sm-12 col-xs-12 pad">
        <div class="panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title"><?= $formname ?></h3>
            </div>
            <div class="panel-body">

                <!-- Party -->
                <div class="row">
                    <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                        <label class="label-control marg">Party Name</label>
                    </div>
                    <div class="col-lg-7 col-md-7 col-sm-8 col-xs-8 pad">
                        <select class="form-control select2" name="supplier">
                            <option value="">-- All Parties --</option>
                            <?php
                            $gsupl = mysqli_query($conn,
                                "SELECT accode, name FROM `accmast` where grpcode = '010' ORDER BY name"
                            ) or die(mysqli_error($conn));
                            while ($supl = mysqli_fetch_array($gsupl)):
                            ?>
                            <option value="<?= $supl['accode'] ?>"><?= htmlspecialchars($supl['name']) ?></option>
                            <?php endwhile; ?>
                        </select>
                    </div>
                </div>

                <!-- Pay Type -->
<!--                <div class="row">
                    <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                        <label class="label-control marg">Pay Type</label>
                    </div>
                    <div class="col-lg-3 col-md-4 col-sm-5 col-xs-5 pad">
                        <select class="form-control select2" name="ptype">
                            <option value="">All</option>
                            <option value="C">Cash</option>
                            <option value="R">Credit</option>
                        </select>
                    </div>
                </div>-->

                <!-- From Date -->
                <div class="row">
                    <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                        <label class="label-control marg">From Date</label>
                    </div>
                    <div class="col-lg-4 col-md-4 col-sm-6 col-xs-6 pad">
                        <input type="date" name="frmdt" class="form-control" value="<?= $mfrdate ?>">
                    </div>
                </div>

                <!-- To Date -->
                <div class="row">
                    <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                        <label class="label-control marg">To Date</label>
                    </div>
                    <div class="col-lg-4 col-md-4 col-sm-6 col-xs-6 pad">
                        <input type="date" name="todt" class="form-control" value="<?= $mtodate ?>">
                    </div>
                </div>

                <!-- Report Type -->
                <div class="row">
                    <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                        <label class="label-control marg">Report Type</label>
                    </div>
                    <div class="col-lg-3 col-md-3 col-sm-5 col-xs-5 pad">
                        <select name="dtype" class="form-control select2">
                            <option value="1">Summary</option>
                            <option value="2">Detail</option>
                        </select>
                    </div>
                </div>

            </div><!-- panel-body -->
            <div class="panel-footer text-center">
                <?php include("includes/but_rep.php"); ?>
            </div>
        </div>
    </div>
</form>
<?php include("includes/linksfoot.php"); ?>
</body>
</html>
