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

$formname = "Credit Note Register";
$action = "crednotereg_fr.php";
$fuser = $_SESSION["usertype"];
$fseries = $_SESSION["series_" . $dbname];
$zroot = $dbname;

$admin = $_SESSION["admin_" . $dbname];
$zdb = $_SESSION["zdbyear_" . $dbname];

$zyear = right($zdb, 4);
$mfrdate = getzdates($zyear, 'S');
$mtodate = getzdates($zyear, 'E');
//$zroot = "cepheisy_cism_root";

$myyear = $_SESSION[$myyear];
mysqli_select_db($conn, $zdb);

include("includes/linkshead.php");
?>

<script type="text/javascript">
    $(document).ready(function () {

        series();
        function series() {
            var sseries = $(".sseries").val(),
                    suser = $(".suser").val();

            if (suser != "1") {
                $(".series").val(sseries).trigger("change");
                $(".seriesdiv").css("display", "none");
                $(".staffdiv").css("display", "none");
            }
        }
    });
</script>
</head>
<body>
    <form method='POST' action="<?= $action; ?>">
        <!-- Default box -->
        <div class="col-lg-6 col-md-62 col-sm-12 col-xs-12  pad">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title" style="color:#0098DA;"><?php Echo $formname; ?></h3>
                </div>

                <div class="panel-body">
                    <div class="row">
                        <div class="col-lg-3 col-md-3 col-sm-4 col-xs-4 text-right pad">
                            <label class="label-control marg">Party Name</label>
                        </div>
                        <div class="col-lg-6 col-md-7 col-sm-8 col-xs-8 pad">
                            <select name="party" class="form-control select2" autofocus>
                                <option></option>
                                <?php
                                $mown = mysqli_query($conn, "SELECT `name`,`accode` 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 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-5 col-sm-8 col-xs-8 pad">
                            <select name="dtype" class="form-control select2">
                                <option value="1">Summary</option>
                                <option value="2">Detail</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 marg">From Date</label>
                        </div>
                        <div class="col-lg-4 col-md-3 col-sm-3 col-xs-3 pad">
                            <input type="date" class="form-control" name="fdate" value="<? echo $mfrdate; ?>" required >
                        </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 marg ">To Date</label>
                        </div>
                        <div class="col-lg-4 col-md-3 col-sm-3 col-xs-3 pad">
                            <input type="date" class="form-control" name="tdate" value="<? echo $mtodate; ?>" required >
                        </div>
                    </div>
                    
                </div>
                <div class="panel-footer text-center">
                    <?php include("includes/but_rep.php"); ?>
                </div>

            </div>
        </div>

    </form>
    <?php include("includes/linksfoot.php"); ?>
</body>
</html>
