<?php
ob_start();
require("includes/check_auth_user.php");
require("includes/dbconnect.php");
include('includes/function.php');
$formname = "Bill Generation";
$action = "genbill_fr.php";

$admin = $_SESSION["admin_" . $dbname];
$zdb = $_SESSION["zdbyear_" . $dbname];
$zroot = $_SESSION["zdir"];
$zyear = right($zdb, 4);
$mfrdate = getzdates($zyear, 'S', $conn);
$mtodate = getzdates($zyear, 'E', $conn);
$fryear = left($mfrdate, 4,$conn);
$toyear = left($mtodate, 4,$conn);
mysqli_select_db($conn,$zdb);


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

<!--<script src="MyScript/genbill.js" type="text/javascript"></script>-->
<script src="MyScript/monfromtodt.js" type="text/javascript"></script>

<body>
    <form method='POST' action="<?= $action; ?>">  
        <!-- Default box -->        <div>      
            <div class="col-lg-6 col-md-6 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">Month</label>                            
                            </div>
                            <div class="col-lg-3 col-md-3 col-sm-4 col-xs-4 pad">
                                <select class="form-control monthno focusfield" name="monthno" required autofocus>
                                    <option value="01">January</option>
                                    <option value="02">February</option>
                                    <option value="03">March</option>
                                    <option value="04">April</option>
                                    <option value="05">May</option>
                                    <option value="06">June</option>
                                    <option value="07">July</option>
                                    <option value="08">August</option>
                                    <option value="09">September</option>
                                    <option value="10">October</option>
                                    <option value="11">November</option>
                                    <option value="12">December</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">Party</label>
                            </div>
                            <div class="col-lg-7 col-md-7 col-sm-8 col-xs-8 pad">
                                <select class="form-control cmbparty party select2" id="party" name="party">
                                    <option value=""></option>
                                    <?php
                                    $gparty = mysqli_query($conn,"SELECT `accode`,`name` FROM `accmast` WHERE `grpcode`='010' order by name")or die(mysqli_error($conn));
                                    while ($party = mysqli_fetch_array($gparty)) {
                                        Echo "<option value='$party[accode]'>$party[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">Invoice Date</label>
                            </div>
                            <div class="col-lg-3 col-md-3 col-sm-8 col-xs-8 pad">
                                <input type="date" id="invdate" name="invdate" class="form-control invdate" value="" required> 
                                <input type="hidden" class="form-control fryear" name="fyear" value="<?= $fryear ?>" style="display:none">
                                <input type="hidden" class="form-control toyear" name="tyear" value="<?= $toyear ?>" style="display:none">
                            </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-3 col-md-3 col-sm-8 col-xs-8 pad">
                                <input type="date" class="form-control fdate" name="fdate" value="" readonly >  
                            </div>
                            <div class="col-lg-1 col-md-2 col-sm-3 col-xs-3 text-right pad">
                                <label class="label-control marg">To Date</label>
                            </div>
                            <div class="col-lg-3 col-md-3 col-sm-8 col-xs-8 pad">
                                <input type="date" class="form-control tdate" name="tdate" value="" readonly>
                            </div>
                        </div> 
                    </div>         
                    <div class="panel-footer text-center pad">
                        <input type="submit" name="submit" value="Proceed" class="btn btn-pad btn-square" id="submit" style="background-color:#0098DA;color: white" >
                        <button  type="reset" class="btn btn-pad btn-square" style="background-color:red;color: white;" onclick="window.location.href = 'default.php'">
                            Exit
                        </button>
                    </div>     
                </div>          
            </div>            
        </div>       
    </form>  
    <?php include("includes/linksfoot.php"); ?>
</body></html>