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

$formname = 'Flat Transfer';
$maindb = 'transfer';

$file = 'flattran.php';
$grid = '';
$source = 'FT';
$keyfld = "vouchno";
$trandbexist = 0;
$focusfld = "name";
$printfile = 'flattran_fr.php';
$society = $_SESSION["society_" . $dbname];
$zdb = $_SESSION["zdbyear_" . $dbname];
$zroot = $_SESSION["zdir"];
$usertype = $_SESSION["usertype_" . $dbname];
$series = $_SESSION["society_" . $dbname];

$adduser = $_SESSION['username_' . $dbname];
date_default_timezone_set("Asia/Kolkata");
$adddate = date("Y-m-d");
$addtime = date("h:i:sa");


if (empty($society)) {
    browse("Invalid Society Credentials Forced Logout.");
    print '<script type="text/javascript">';
    print " top.window.location = 'index.php'";
    PRINT '</script>';
}

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

$zyear = right($zdb, 4);

//$fseries = $_SESSION["soceity_" . $dbname];
$keycond = "and `series`= '$society'";

$zStartDate = getzdates($zyear, 'S');
$zEndDate = getzdates($zyear, 'E');
mysqli_select_db($conn, $zdb);

include("includes/vouchno_generate.php");
include("includes/prev&next.php");

if (isset($_POST["submit"])) {

    $a = 1;

    $vouchdt = $_POST['vouchdt'];
    $flatno = $_POST['flatno'];
    $name = $_POST['name'];
    $name2 = $_POST['name2'];
    $block = $_POST['block'];
    $wing = $_POST['wing'];
    $floor = $_POST['floor'];
    $unit = $_POST['unit'];
    $area = $_POST['area'];
    $tranname = $_POST['tranname'];
    $tranname2 = $_POST['tranname2'];
    $amount = $_POST['amount'];
    $socchrg = $_POST['socchrg'];
    $othfee = $_POST['othfee'];


    // browse($qvouch);
    $mvouch = $qvouch;

    if ($vouchdt == "") {
        $a = 0;
        browse("Date Cannot Be Empty");
        if ($addflag == 1) {
            header("location:javascript://history.go(-1)");
        } else {
            header("refresh: ; $file?vouchno=$_GET[$keyfld]");
        }
    }

    if ($amount == "") {
        $a = 0;
        browse("Amount Cannot Be Empty");
        if ($addflag == 1) {
            header("location:javascript://history.go(-1)");
        } else {
            header("refresh: ; $file?vouchno=$_GET[$keyfld]");
        }
    }


    if ($a == 1) {
        mysqli_query($conn, "LOCK TABLES `$maindb` WRITE, `accmast` WRITE") or die(mysqli_error($conn));

        if ($addflag == 1) {
            $gen1 = mysqli_query($conn, "SELECT MAX($keyfld) AS maxcode FROM `$maindb` where $keyfld != '' $keycond LIMIT 0,1 ") or die(mysqli_error($conn));
            if (mysqli_num_rows($gen1) > 0) {
                $vvouch = mysqli_fetch_assoc($gen1);
                $qvouch = $vvouch["maxcode"] + 1;
            } else {
                $qvouch = '1';
            }
            $mvouch = $qvouch;
        }
//        browse($mvouch);

        $maccode = mysqli_query($conn, "SELECT * FROM `accmast` where grpcode = '010' AND `flatno`='$flatno' AND `series` = '$society' ") or die(mysqli_error($conn));
        $faccode = mysqli_fetch_array($maccode);
        $party = $faccode['accode'];
        $area = $faccode['area'];


        if ($addflag == 1) {
            $getm = mysqli_query($conn, "SELECT `name` FROM accmast WHERE `name`='$tranname' AND `grpcode`='010' $keycond")or die(mysqli_error($conn));
            if (mysqli_num_rows($getm) > 0) {
                browse("Member Already Exist");
                header("refresh: 1; $file?$keyfld=$mvouch&mode=last");
                return false;
            } else {
                $genaccode = mysqli_query($conn, "SELECT MAX(accode) AS maxcode FROM `accmast` where accode != '' $keycond LIMIT 0,1 ") or die(mysqli_error($conn));
                if (mysqli_num_rows($genaccode) > 0) {
                    $vaccode = mysqli_fetch_assoc($genaccode);
                    $gaccode = $vaccode["maxcode"] + 1;
                } else {
                    $gaccode = '51';
                }
                $increvouch = $gaccode;
                $qaccode = $series . $gaccode;

                mysqli_query($conn, "INSERT INTO `accmast`(accode, `increcode`, `grpcode`, `series`,`name`, `flatno`, `area`, `active`)
                                        VALUES('$qaccode', '$increvouch', '010', '$series','$tranname', '$flatno', '$area', '1')") or die(mysqli_error($conn));
            }


//            mysqli_query($conn, "UPDATE `accmast` SET  `active`='0', `flatno`='' where `accode`='$party' $keycond") or die(mysqli_error($conn));
            mysqli_query($conn, "UPDATE `accmast` SET  `active`='0' where `accode`='$party' $keycond") or die(mysqli_error($conn));
        }

        if ($addflag == 1) {
            mysqli_query($conn, "INSERT INTO `$maindb`( vouchno , series, `vouchdt`, `source`, `accode`, `flatno`, `name`, `name2`, `block`,`wing`,
                                                `floor`, `unit`, `area`, `tranname`, `tranname2`, `amount`, `socchrg`, `othfee`, adduser, adddate, addtime)
                                       Values ('$mvouch', '$society', '$vouchdt', '$source', '$party', '$flatno', '$name', '$name2', '$block','$wing',
                                    '$floor', '$unit', '$area', '$tranname', '$tranname2', '$amount', '$socchrg', '$othfee','$adduser', '$adddate', '$addtime')") or die(mysqli_error($conn));
            insmess();
            $mvouch = $qvouch;

            header("refresh: 1; $file?$keyfld=$mvouch&mode=last");
        } else {
            $mvouch = $qvouch;
            $editdate = date("Y-m-d");
            $edittime = date("h:i:sa");
            mysqli_query($conn, "UPDATE `$maindb` SET  vouchdt='$vouchdt', tranname='$tranname', tranname2='$tranname2',
                    amount='$amount', `socchrg`='$socchrg', `othfee`='$othfee',`edituser`='$adduser',`edittime`='$edittime',`editdate`='$editdate'  where vouchno = '$mvouch' $keycond") or die(mysqli_error($conn));
            updmess();

            header("refresh: 1; $file?$keyfld=$mvouch&mode=last");
        }
        mysqli_query($conn, "UNLOCK TABLES");
    }
}

if ($addflag != 1) {
    $getvouch = '';
    if ($addflag == 0) {
        $getvouch = $_GET[$keyfld];
    } else {
        $getvouch = $qvouch;
    }


    $result = mysqli_query($conn, "SELECT *,DATE_FORMAT(`editdate`,'%d-%m-%Y') as editdate, DATE_FORMAT(`adddate` ,'%d-%m-%Y')AS adddate     FROM `$maindb` WHERE $keyfld='$getvouch' $keycond") or die(mysqli_error($conn));
    $get = mysqli_fetch_array($result);
}

$senable = "";
$cenable = "";

if (isset($_GET["delete"])) {
    mysqli_query($conn, "LOCK TABLES `$maindb` WRITE, `accmast` WRITE") or die(mysqli_error($conn));


//    $delsett = " source = '$source' AND bnkvouch = '$_GET[$keyfld]' and series = '$society'";
//    delnew($zdb, "billsett", "$delsett", "$file?mode=last");
//    $delcond = " source = '$source' and vouchno = '$_GET[$keyfld]' and series = '$society'";
    $rresult = mysqli_query($conn, "SELECT * FROM `$maindb` WHERE $keyfld='$_GET[$keyfld]' $keycond") or die(mysqli_error($conn));
    $gget = mysqli_fetch_array($rresult);
    $nname = $gget['name'];
    $nname2 = $gget['name2'];
    $nflatno = $gget['flatno'];

    mysqli_query($conn, "UPDATE `accmast` SET  `name`='$nname', `name2`='$nname2'  where `flatno`= '$nflatno' $keycond") or die(mysqli_error($conn));



    $delcond2 = " vouchno = '$_GET[$keyfld]' and series = '$society'";

    delnew($zdb, "$maindb", "$delcond2", "$file?mode=last");


//    delnew($zdb, "$accdb", "$delcond", "$file?mode=last");


    mysqli_query($conn, "UNLOCK TABLES");
}

include("includes/linkshead.php");
?>
<script src="MyScript/flattran.js" type="text/javascript"></script>
<script src="MyScript/flattran_search.js" type="text/javascript"></script>
<script src="MyScript/checkdate.js" type="text/javascript"></script>
<!--<script src="MyScript/shortkeys.js" type="text/javascript"></script>-->
</head>
<body>
    <!--    <div id="preloader" class="col-lg-12 text-center">
            <h3 class="text-center">Loading</h3>
            <div id="status">&nbsp;</div>
        </div>-->
    <form action='' method='POST'>
        <!-- Default box -->
        <div class="row">
            <div class="col-lg-6">
                <div class="panel panel-default">
                    <div class="row" style="background-color:#F5F5F5">
                        <div class="col-lg-3" style="color:#64CCFC"><h4><?php Echo $formname; ?></h4></div>
                        <?php if ($usertype == 1) { ?>

                            <div class="col-lg-3"><label class=" marg" style="color:green;font-size: 14px">&nbsp;<?php Echo $get["adduser"]; ?></label><br>
                                <?php if ($get["edituser"] != '') { ?>
                                    <label class="marg" style="color:red;font-size: 14px"><?php Echo $get["edituser"]; ?></label>
                                <? } ?>
                            </div>
                            <div class="col-lg-2"><label class=" marg" style="color:green;font-size: 14px"><?php Echo $get["adddate"]; ?></label>
                                <?php if ($get["editdate"] != '00-00-0000') { ?>
                                    <label class="marg" style="color:red;font-size: 14px"><?php Echo $get["editdate"]; ?></label>
                                <? } ?>
                            </div>
                            <div class="col-lg-1"><label class="marg" style="color:green;font-size: 14px"><?php Echo $get["addtime"]; ?></label>
                                <?php if ($get["edittime"] != '00:00:00') { ?>
                                    <label class=" marg" style="color:red;font-size: 14px"><?php Echo $get["edittime"]; ?></label>
                                <? } ?>
                            </div>
                        <? } ?>

                    </div>
                    <input type="hidden" value="<?= $zStartDate ?>" style="width: 1px;border: none" class="zstdate">
                    <input type="hidden" value="<?= $zEndDate ?>" style="width: 1px;border: none" class="zenddate">
                    <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 marg">Transfer No</label>
                            </div>
                            <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 pad">
                                <input type="text" class="form-control form vouchno" id="vouchno"  name="vouchno" value="<?php Echo ($addflag != 1) ? $get["vouchno"] : " $qvouch"; ?>"  readonly>
                                <input type="hidden" class="form-control form trnflag" name="trnflag" value="<?php Echo ($addflag != 1) ? $get["trnflag"] : ""; ?>" >
                            </div>
                            <div class="col-lg-1 col-md-2 col-sm-2 col-xs-2 text-right pad">
                            </div>
                            <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 text-right pad">
                                <label class="label-control marg">Date</label>
                            </div>
                            <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 pad">
                                <input type="date" class="form-control form vouchdt focusfield" name="vouchdt" id="vouchdt" value="<?php Echo ($addflag != 1) ? $get["vouchdt"] : date("Y-m-d"); ?>"  autofocus>
                            </div>
                            <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 pad">
                                <!--<a class="btn btn-primary" href="bankr_voucher.php?vouchno=<?php // echo $qvouch;              ?>" target="_blank">Voucher</a>-->
                            </div>
                        </div> <br>
                        <!--                        <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">Receipt No.</label>
                                                    </div>
                                                    <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 pad">
                                                        <input type="text" name="recpno" value="<?php // echo ($addflag != 1) ? $get['recpno'] : "";                           ?>" class="form-control form" >                                    
                                                    </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">Flat No.</label>
                            </div>
                            <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 pad">
                                <select  name="flatno" id="flatno" class="select2 form-control form flatno">
                                    <option value="<?php echo ($addflag != 1) ? $get['flatno'] : ""; ?>"><?php echo ($addflag != 1) ? $get['flatno'] : ""; ?></option>
                                    <?php
                                    $mflat = mysqli_query($conn, "SELECT * FROM `accmast` where `active`='1' and grpcode = '010' and
                                                         `series` = '$society' order by `flatno` ") or die(mysqli_error($conn));
                                    while ($tflat = mysqli_fetch_array($mflat)) {
                                        echo "<option value='$tflat[flatno]'>$tflat[flatno]</option>";
                                    }
                                    ?>
                                </select>
                            </div>
                        </div>
                        <div class="row" style="background-color: #CBCBCB">
                            <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                <label class="label-control marg">Name</label>
                            </div>
                            <div class="col-lg-8 col-md-8 col-sm-8 col-xs-8 pad">
                                <input type="text" class="form-control text-uppercase form name" style="margin-top: 4px; margin-bottom: 4px;" name="name" value="<?php Echo ($addflag != 1) ? $get["name"] : ""; ?>" readonly autofocus>
                                <input type="text" class="form-control text-uppercase form name2" name="name2" style="margin-bottom: 4px;"  value="<?php Echo ($addflag != 1) ? $get["name2"] : ""; ?>" readonly>
                            </div>
                        </div>
                        <div class="row" style="background-color: #CBCBCB">
                            <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                <label class="label-control marg">Block</label>
                            </div>
                            <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 pad">
                                <input type="text" class="form-control form block" name="block" value="<?php Echo ($addflag != 1) ? $get["block"] : ""; ?>" readonly>
                            </div>
                            <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                <label class="label-control marg">Wing</label>
                            </div>
                            <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 pad">
                                <input type="text"  class="form-control form wing" name="wing" value="<?php Echo ($addflag != 1) ? $get["wing"] : ""; ?>" readonly>
                            </div>
                        </div>
                        <div class="row" style="background-color: #CBCBCB">
                            <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                <label class="label-control marg">Floor</label>
                            </div>
                            <div class="col-lg-3 col-md-2 col-sm-2 col-xs-2 pad">
                                <input type="text" class="form-control form floor" name="floor" value="<?php Echo ($addflag != 1) ? $get["floor"] : ""; ?>" readonly>
                            </div>
                            <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 text-right pad">
                                <label class="label-control marg">Area</label>
                            </div>
                            <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3  pad">
                                <input type="text" class="form-control form text-right area" name="area" value="<?php Echo ($addflag != 1) ? $get["area"] : ""; ?>" readonly>
                            </div>
                        </div>
                        <div class="row" style="background-color: #CBCBCB">                            

                            <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                <label class="label-control marg">Unit</label>
                            </div>
                            <div class="col-lg-3 col-md-2 col-sm-2 col-xs-2 text-right pad">
                                <select name="unit" class="form-control form unit" id="unit">
                                    <option></option>
                                    <option value="F" <?php
                                    if ($get['unit'] == 'F') {
                                        echo 'selected="selected"';
                                    }
                                    ?>>Sq. Ft.</option>
                                    <option value="M"  <?php
                                    if ($get['unit'] == 'M') {
                                        echo 'selected="selected"';
                                    }
                                    ?>>Sq. Mtr.</option>
                                </select>
                            </div>
                        </div>
                        <hr>
                        <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">Transfer To</label>
                            </div>
                            <div class="col-lg-8 col-md-8 col-sm-8 col-xs-8 pad">
                                <input type="text" class="form-control text-uppercase form tranname" style="margin-top: 4px; margin-bottom: 4px;" name="tranname" value="<?php Echo ($addflag != 1) ? $get["tranname"] : ""; ?>" >
                                <input type="text" class="form-control text-uppercase form " name="tranname2" style="margin-bottom: 4px;"  value="<?php Echo ($addflag != 1) ? $get["tranname2"] : ""; ?>">
                            </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">Amount</label>
                            </div>
                            <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 pad">
                                <input type="text" name="amount" id="amount"  style="font-weight: bold;font-size: 18px"  value="<?php echo ($addflag != 1) ? $get['amount'] : ''; ?>" class="form-control form amount  numeric text-right" >
                            </div>
                        </div>
                        <hr>
                        <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">Society Charges</label>
                            </div>
                            <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 pad">
                                <input type="text" name="socchrg" id="socchrg"  style="font-weight: bold;font-size: 18px"  value="<?php echo ($addflag != 1) ? $get['socchrg'] : ''; ?>" class="form-control form socchrg  numeric text-right" >
                            </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">Other Fees</label>
                            </div>
                            <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 pad">
                                <input type="text" name="othfee" id="othfee"  style="font-weight: bold;font-size: 18px"  value="<?php echo ($addflag != 1) ? $get['othfee'] : ''; ?>" class="form-control form othfee  numeric text-right" >
                            </div>
                        </div>
                    </div>

                    <!--Button-->
                    <div class="panel-footer">
                        <div style="overflow: auto; ">
                            <table class="table-condensed" style="margin: 0 auto;">
                                <tr>
                                    <td class=" buttonform tooltip-bottom " id="hprevious" style="display: <? Echo $pdisabled ?>" data-toggle="tooltip" data-placement="top" title="" data-original-title="Previous">
                                        <button id='previous' type="button" class="btn btn-pad btn-square btn-square prevBtn hvr-float-shadow" style="background-color:#B38A6C; "  onClick="window.location.href = '<?= $file . "?mode=edit&$keyfld=$prevvouch" . $para; ?>'" <? Echo $pdisabled1 ?>>
                                            <i class="fa fa-chevron-left" style="color:#ffffff"></i>
                                        </button>
                                    </td>
                                    <td class=" buttonform tooltip-bottom" id="hnext" style="display: <? Echo $ndisabled ?>" data-toggle="tooltip" data-placement="top" title="" data-original-title="Next">
                                        <button id='next' type="button" class="btn btn-pad btn-square nextBtn hvr-float-shadow" style="background-color:#F89693;  " onClick="window.location.href = '<?= $file . "?mode=edit&$keyfld=$nextvouch" . $para; ?>'" <? Echo $ndisabled1 ?>>
                                            <i class="fa fa-chevron-right" style="color:#ffffff"></i>    
                                        </button>
                                    </td>
                                    <td class=" buttonform tooltip-bottom" id="hsearch" style="display: <? Echo $searchdisabled ?>" data-toggle="tooltip" data-placement="top" title="" data-original-title="Search">
                                        <button id="search" type="button" class="btn btn-pad btn-square " style="background-color:#B19CD9; " data-toggle="modal" data-target=".bs-example-modal-lg" >
                                            <i class="fa fa-search" style="color:#ffffff"></i>
                                        </button>
                                    </td>
                                    <td class=" buttonform tooltip-bottom" id="hprint" style="display: <? Echo $printdisabled ?>" data-toggle="tooltip" data-placement="top" title="" data-original-title="Print">
                                        <a id='print' class="btn btn-pad btn-square " style="background-color:#5BC0DE;" href="<?= $printfile ?>?vouchno=<?= $qvouch . $para; ?>" target="_blank">
                                            <i class="fa fa-print" style="color:#ffffff"></i>
                                        </a>
                                    </td>
                                    <td class=" buttonform tooltip-bottom" id="hadd" style="display: <? Echo $adddisabled ?>" data-toggle="tooltip" data-placement="top" title="" data-original-title="Add Record" >
                                        <button id='add' type="button" class="btn btn-pad btn-square " style="background-color:#C0CA33; " onclick="window.location.href = '<?= $file . "?mode=true" . $para; ?>'">
                                            <i class="fa fa-plus" style="color:#ffffff"></i>    
                                        </button>
                                    </td>
                                    <td class=" buttonform tooltip-bottom" id="hedit" style="display: <? Echo $editdisabled ?>" data-toggle="tooltip" data-placement="top" title="" data-original-title="Edit Record">
                                        <button id='edit' type="button" style="background-color:#F0AD4E; " class="btn btn-pad btn-square">
                                            <i class="fa fa-pencil" style="color:#ffffff"></i>
                                        </button>
                                    </td>
                                    <td class=" buttonform tooltip-bottom" id="hdelete" style="display: <? Echo $deletedisabled ?>" data-toggle="tooltip" data-placement="top" title="" data-original-title="Delete Record">
                                        <a id='delete' class="btn btn-pad btn-square delete-entry" href="?delete&<?= $keyfld . "=" . $qvouch . "&series=$zseries" . "&source='$msource'" ?>"  onClick="return confirm('Confrim Delete?');" style="background-color:#D9534F;">
                                            <i class="fa fa-trash" style="color:#ffffff"></i>
                                        </a>
                                    </td>
                                    <td class=" buttonform tooltip-bottom" id="hexit" style="display: <? Echo $exitdisabled ?>" data-toggle="tooltip" data-placement="top" title="" data-original-title="Exit">
                                        <button id='exit' type="button" class="btn btn-pad btn-square " style="background-color:#cccccc; "  onClick="window.location.href = '<?= 'default.php' ?>'">
                                            <i class="fa fa-power-off" style="color:red"></i>
                                        </button>
                                    </td>
                                    <td class=" buttonform tooltip-bottom" id="ssubmit" style="display: <? Echo $savedisabled ?>" data-toggle="tooltip" data-placement="top" title="" data-original-title="Save Record">
                                        <button id='submit' type='submit' name='submit' value='<?php echo ($addflag == 0) ? "Update" : "Save"; ?>' class="btn btn-pad btn-square " style="background-color:#008D4C; ">
                                            <i class="fa fa-check" style="color:#ffffff"></i>
                                        </button>
                                    </td>
                                    <td class=" buttonform tooltip-bottom" id="scancel" style="display: <? Echo $canceldisabled ?>" data-toggle="tooltip" data-placement="top" title="" data-original-title="Cancel Record">
                                        <button id='cancel' type="button" class="btn btn-pad btn-square " style="background-color:#39CCCC; "  onClick="window.location.href = '<?= $file . "?mode=last" . $para; ?>'">
                                            <i class="fa fa-times" style="color:#ffffff"></i>
                                        </button>
                                    </td>
                                    <!--<td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td>-->
<!--                                    <td class=" buttonform tooltip-bottom" id="" style="display: <? ?>" data-toggle="tooltip" data-placement="top" title="" data-original-title="Multiple Print">
                                        <button id='' type="button" class="btn btn-pad btn-lg " data-toggle="modal" data-target="#myModal" style="background-color:#F58484; ">
                                            Multiple Print
                                        </button>
                                    </td>-->
                                </tr>
                            </table>
                        </div>                        
                    </div>
                    <!--End of Button-->
                </div>
            </div>
        </div>
    </form>

    <!-- Modal start -->
    <form action='bankrecp_mult_fr.php' target="_blank" method='POST'>
        <div class="modal fade" id="myModal" role="dialog">
            <div class="modal-dialog">

                <!-- Modal content-->
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal">&times;</button>
                        <h4 class="modal-title text-center">Multiple Prints</h4>
                    </div>
                    <div class="modal-body primarymodal">
                        <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"  name="frmdate" class="form-control mfrmdt fmdate" value="<?php Echo Date("Y-m-d"); ?>" /> 
                            </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" name="todt" class="form-control todate" value="<?php Echo Date("Y-m-d"); ?>" /> 
                            </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">Bank</label>
                            </div>
                            <div class="col-lg-5 col-md-5 col-sm-3 col-xs-3 pad">
                                <?php
//                                $compbank = mysqli_query($conn, "SELECT `defbank` FROM $zroot.`company` where `code` = '$society' ")or die(mysqli_error($conn));
//                                $fbank = mysqli_fetch_array($compbank);
//
//                                $getbank = mysqli_query($conn, "SELECT `accode`,`name` FROM `accmast` where `accode` = '$fbank[defbank]' ")or die(mysqli_error($conn));
//                                $bank = mysqli_fetch_array($getbank);
                                ?>
                                <!--<input type="text" id="defbank" name="" class="form-control form " value="<?php Echo $bank['name']; ?>" >--> 
                            </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">Print Narration</label>
                            </div>
                            <div class="col-lg-2 col-md-2 col-sm-3 col-xs-3 pad">
                                <select class="form-control narr select2" name="narration">
                                    <option value=""></option>
                                    <option value="1">Yes</option>
                                </select> 
                            </div>
                        </div>
                        <br>
                        <div class="row ">  
                            <div class="col-lg-3">
                            </div>
                            <div class="col-lg-6">
                                <button type="button" class="btn btn-default text-center proceed" >Proceed</button>
                                <button type="button" class="btn btn-default text-center" data-dismiss="modal">Close</button>
                            </div>
                            <div class="col-lg-3">
                            </div>
                        </div>
                    </div>

                    <!--2nd modal-->
                    <div class="modal-body secondrymodal">
                        <div class="mprint " style="max-height: 400px;overflow: auto;">



                        </div>
                        <br>
                        <div class="row ">  
                            <div class="col-lg-3">
                                <input type="hidden" class="form-control fdate" name="mfrmdate" value="">
                                <input type="hidden" class="form-control tdate" name="mtodate" value="">
                            </div>
                            <div class="col-lg-6">
                                <input type="submit"  target='_blank'  class="btn text-center proceed2" value="Proceed">
                                <button type="button" class="btn btn-default text-center" data-dismiss="modal">Close</button>
                            </div>
                            <div class="col-lg-3">
                            </div>
                        </div>
                    </div>
                    <!--2nd Modal End-->

                    <div class="modal-footer">
                    </div>
                </div>
            </div>
        </div> 
    </form>
    <div class="modal fade LedgerModal" tabindex="" id="settmodal" role="dialog" aria-labelledby="myLargeModalLabel">
        <div class="modal-dialog modal-lg">
            <div class="modal-content">
                <div class="modal-header">
                    <button class="close" data-dismiss="modal"><span>&times;</span></button>
                    <h4 class="modal-title" id="myLargeModalLabel">Ledger View</h4>
                </div>
                <div class="modal-body">
                    <form action="ledger_fr.php" target="_blank" method="post"> 
                        <input type="hidden" class="form-control legderparty" name="party">
                        <div class="row pad">
                            <div class="col-lg-4 col-md-4 col-sm-3 col-xs-3 text-right">
                                <label class="label-control"><b>From Date</b></label>
                            </div>
                            <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
                                <input type="date" id="invdt" name="frmdt" class="form-control" value="<?php echo $zStartDate; ?>" />  
                            </div>
                        </div>
                        <div class="row pad">
                            <div class="col-lg-4 col-md-4 col-sm-3 col-xs-3 text-right">
                                <label class="label-control"><b>To Date</b></label>
                            </div>
                            <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
                                <input type="date" id="invdt" name="todt" class="form-control" value="<?php echo $zEndDate; ?>" />
                            </div>
                        </div>
                        <div class="row pad">
                            <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 text-right">
                                <button id='view' type='submit' name='view' class="btn btn-pad btn-square" 
                                        style="background-color:#05B2EA; ">
                                    Proceed
                                </button>
                            </div>
                        </div>
                    </form>
                </div>    
            </div>
            <div class="modal-footer"></div>
        </div>
    </div>
    <div class="modal fade bs-example-modal-lg searchModal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
        <div class="modal-dialog modal-lg">
            <div class="modal-content">
                <div class="modal-header">
                    <button class="close" data-dismiss="modal"><span>&times;</span></button>
                    <h4 class="modal-title" id="myLargeModalLabel">Search <? Echo $formname; ?></h4>
                </div>
                <div class="modal-body">
                    <div class="row">
                        <div class="col-lg-2">
                            <select class="form-control sfield">
                                <option value="1">Receipt No.</option>
                                <option value="2">Member</option>
                                <option value="3">Member2</option>
                                <option value="4">Transfer To</option>
                                <option value="5">Transfer To2</option>
                                <option value="6">Flat No.</option>
                            </select>
                        </div>
                        <div class="col-lg-2">
                            <select class="form-control soperator">
                                <option value="">Type of Search</option>
                                <option value="%">Like</option>
                                <option value="=">Exactly</option>
                            </select>
                        </div>
                        <div class="col-lg-2">
                            <select class="form-control sortBy">
                                <option value="">Sort By</option>
                                <option value="1">Receipt No.</option>
                                <option value="2">Member</option>
                                <option value="3">Member2</option>
                                <option value="4">Transfer To</option>
                                <option value="5">Transfer To2</option>
                                <option value="6">Flat No.</option>

                            </select>  
                        </div>
                        <div class="col-lg-2">
                            <select class="form-control orderAs">
                                <option value="asc">Asc</option>
                                <option value="desc">Desc</option>
                            </select>
                        </div>
                        <div class="col-lg-2">
                            <input type="text" value="" class="form-control ssearch" placeholder="Search Here">
                        </div>
                        <div class="col-lg-2">
                            <input type="button" style="color: black; background-color:#F17B25;" class="btn btn-primary sload" value="Search" >
                        </div>
                    </div>
                    <div class="col-lg-12 sloader text-center">
                        <!--<img src="images/search.gif" alt="loading">-->       
                    </div>
                    <div class="col-lg-12 snoRecord text-center">
                        <h3>NO RECORDS FOUND</h3>
                    </div>
                    <div class="table-responsive" style="max-height: 400px;overflow: auto;">
                        <table id="" class="table table-striped table-condensed table-bordered" width="100%">
                            <thead>
                                <tr style="background-color:#EFE4B0;">
                                    <th style="color: black;" width="10%">Sr No.</th>
                                    <th style="color: black;" width="10%">Receipt No.</th>
                                    <th style="color: black;" width="15%">Member</th>
                                    <th style="color: black;" width="15%">Member2</th>
                                    <th style="color: black;" width="15%">Transfer To</th>
                                    <th style="color: black;" width="15%">Transfer To2</th>
                                    <th style="color: black;" width="10%">Flat No.</th>
                                    <th style="color: black;" width="10%">Action</th>
                                </tr>
                            </thead>
                            <tbody class="sTbody">
                            </tbody>
                        </table>
                    </div>
                    <div class="row">
                        <div class="col-xs-12 text-right search-action-bar">
                            <input type="button" style="color: black; background-color:#EFE4B0;"  class="btn btn-primary sprev" value="Previous">
                            <input type="button" style="color: black; background-color:#EFE4B0;"  class="btn btn-primary snext" value="Next">
                        </div>
                    </div>
                </div>
                <div class="modal-footer"></div>
            </div>
        </div>
    </div>

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