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

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

if ($_GET["para"] == "R") {
    $formname = " Outstanding Receivable";
    $action = "osbill_fr2.php";
    $hgrp = "R";
    $group = "010";
} else {
    $formname = " Outstanding Payable";
    $action = "osbill_fr2.php";
    $group = "009";
    $hgrp = "P";
}

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

$mfrdate = '0000-00-00' ;
mysqli_select_db($conn, $zdb);

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

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

<style>
    .align{
        margin-left: -15px;
    }
</style>
</head>
<body>
    <div class="panel col-lg-6" >
        <div class="forms">
            <div class="form-grids widget-shadow" data-example-id="basic-forms"> 
                <div class="form-title">
                    <h4><?php echo $formname ?> </h4>
                </div>
                <form name="" class="validation" action="<?= $action ?>" method="post">
                    <div class="row">
                        <div class="form-body">
                            <div class="row">
                                <div class="col-lg-3 col-md-2 col-sm-3 col-xs-3 text-right pad">
                                    <label class="label-control marg" style="color: #6082BF;">Code</label>
                                </div>
                                <div class="col-lg-2 col-md-2 col-sm-8 col-xs-8 pad">
                                    <select class="form-control select2 custcode"  name="custcode[]" id="custcode" multiple>
                                        <option value=""></option>
                                        <?php
                                        $gcustcode = mysqli_query($conn, "SELECT custcode,accode FROM `accmast` where `grpcode`='010' order by custcode")or die(mysqli_error($conn));
                                        while ($fcustcode = mysqli_fetch_array($gcustcode)) {
                                            $custcode = $fcustcode['custcode'];
                                            Echo "<option value='$fcustcode[custcode]'>$custcode</option>";
                                        }
                                        ?>
                                    </select>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
                                </div>
                                <div class="col-lg-6 col-md-6 col-sm-8 col-xs-8 pad">
                                    <div style='color:red;font-size: 12px'>Note: (Press Enter to Select Multiple Options)</div>
                                </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" style="color: #6082BF;">School</label>
                                </div>
                                <div class="col-lg-6 col-md-6 col-sm-8 col-xs-8 pad">
                                    <select class="form-control select2 acname school"  name="acname[]" id ='acname' multiple>
                                        <option value=""></option>
                                        <?php
                                        $gschl = mysqli_query($conn, "SELECT * FROM `accmast` where `grpcode`='$group' order by name")or die(mysqli_error($conn));
                                        while ($fschl = mysqli_fetch_array($gschl)) {
                                            Echo "<option value='$fschl[accode]'>$fschl[name]</option>";
                                        }
                                        ?>
                                    </select>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
                                </div>
                                <div class="col-lg-6 col-md-6 col-sm-8 col-xs-8 pad">
                                    <div style='color:red;font-size: 12px'>Note: (Press Enter to Select Multiple Options)</div>
                                </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">Medium</label>
                                </div>
                                <div class="col-lg-4 col-md-6 col-sm-8 col-xs-8 pad">
                                    <select class="form-control select2 school" name="medium" >
                                        <option></option>
                                        <?php
                                        $gschl = mysqli_query($conn, "SELECT * FROM `medium`  order by name") or die(mysqli_error($conn));
                                        while ($sschl = mysqli_fetch_array($gschl)) {
                                            echo"<option value='$sschl[code]'>$sschl[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">Exam</label>
                                </div>
                                <div class="col-lg-4 col-md-5 col-sm-5 col-xs-5 pad">
                                    <select class="form-control select2" name="exam" >
                                        <option></option>
                                        <?php
                                        $gexam = mysqli_query($conn, "SELECT `code`,`name` FROM `exam` order by name")or die(mysqli_error($conn));
                                        while ($dexam = mysqli_fetch_array($gexam)) {
                                            $examcode = $dexam['code'];
                                            $exam = $dexam['name'];
                                            Echo "<option value='$examcode'>$exam</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">Section</label>
                                </div>
                                <div class="col-lg-4 col-md-5 col-sm-5 col-xs-5 pad">
                                    <select name="section" class="form-control select2">
                                        <option value=""></option>
                                        <option value="P">Primary</option>
                                        <option value="S">Secondary</option>
                                        <option value="M">Prelims</option>
                                    </select>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-lg-3 text-right"><label class="control-label">From Date</label></div>

                                <div class="col-lg-3 col-sm-3 pad">
                                    <input type="date" id="frmdt" name="frmdt" class="form-control" style='height:33px;' value="<?= $mfrdate;?>" />  
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-lg-3 text-right"><label class="control-label">To Date</label></div>
                                <div class="col-lg-3 col-sm-3 pad">
                                    <input type="date" id="todt" name="todt" class="form-control" style='height:33px;' value="<?php echo date("Y-m-d"); ?>" />  
                                </div>
                            </div>


                            <div class="row">
                                <div class="col-lg-3 text-right"><label class="control-label">Report Type</label></div>
                                <div class="col-lg-3 col-sm-4 pad">
                                    <select name="dtype" class="form-control" style="height:33px;">
                                        <option value="1">Summary</option>
                                        <option value="2">Detail</option>
                                    </select>
                                </div>
                            </div>
                            <div class="row">
                                <div class="row">
                                    <label class="col-sm-2 control-label"></label>
                                    <div class="col-sm-9">
                                        <div class="col-sm-3 align">
                                            <input type="hidden" name="hiddenval" class="form-control" value="<?= $hgrp ?>">
                                        </div>
                                    </div>
                                </div>
                            </div>

                        </div>
                    </div>
                    <div class="row">
                        <?php include("includes/but_rep.php"); ?>
                    </div>
                </form> 
            </div>
        </div>
    </div>            
    <!--//grids-->
    <!--<script type="text/javascript">
    
        $(document).ready(function(){
        $('.date').mask('00/00/0000');
                $('.time').mask('00:00:00');
                $('.date_time').mask('00/00/0000 00:00:00');
                $('.cep').mask('00000-000');
                $('.mobile').mask('0000-0000');
                $('.phone_with_ddd').mask('(00) 0000-0000');
                $('.phone_us').mask('(000) 000-0000');
                $('.mixed').mask('AAA 000-S0S');
                $('.cpf').mask('000.000.000-00', {reverse: true});
                $('.money').mask('000.000.000.000.000,00', {reverse: true});
                $('.money2').mask("#.##0,00", {reverse: true});
                $('.ip_address').mask('0ZZ.0ZZ.0ZZ.0ZZ', {
        translation: {
        'Z': {
        pattern: /[0-9]/, optional: true
        }
        }
        });
                $('.ip_address').mask('099.099.099.099');
                $('.percent').mask('##0,00%', {reverse: true});
                $('.clear-if-not-match').mask("00/00/0000", {clearIfNotMatch: true});
                $('.placeholder').mask("00/00/0000", {placeholder: "__/__/____"});
                $('.fallback').mask("00r00r0000", {
        translation: {
        'r': {
        pattern: /[\/]/,
                fallback: '/'
        },
                placeholder: "__/__/____"
        }
        });
                $('.selectonfocus').mask("00/00/0000", {selectOnFocus: true});
                );
    </script>-->
    <!--//validator js-->
    <?php
    include("includes/linksfoot.php");
    ?>
</body>
</html>
