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

$formname = 'Flat Transfer Receipt';
$maindb = 'transfer';
$file = 'flattran_fr.php';
$source = "FT";

$zdb = $_SESSION["zdbyear_" . $dbname];
mysqli_select_db($conn, $zdb);

$mht = 'height:20px;';

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


$vouchno = $_GET["vouchno"];
$mvouch = $_GET["mvouch"];

if ($vouchno != '') {
    $vouchcond = "vouchno = '$vouchno'";
} elseif ($mvouch != '') {
    $vouchcond = "vouchno = '$mvouch' ";
}

$zroot = $_SESSION["zdir"];
$society = $_SESSION["society_" . $dbname];
$getcomp = mysqli_query($conn, "SELECT * FROM $zroot.`company` WHERE `code` = '$society'") or die(mysqli_error($conn));
$company = mysqli_fetch_array($getcomp);


$mainqry = mysqli_query($conn, "SELECT *, DATE_FORMAT(`vouchdt`, '%d-%m-%Y') AS vouchdt FROM `$maindb`
                        WHERE $vouchcond AND `series` = $society ") or die(mysqli_error($conn));
$getmdata = mysqli_fetch_array($mainqry) or die(mysqli_error($conn));
$amount = $getmdata[amount];
$socchrg = $getmdata[socchrg];
$othfee = $getmdata[othfee];
$totamt = $amount + $socchrg + $othfee;
$getmember = mysqli_query($conn, "SELECT `accode`,`name`,`flatno`,`wing` FROM `accmast` WHERE `grpcode` = '010' and `accode`='$getmdata[accode]' and `series` = '$society' ")or die(mysqli_error($conn));
$member = mysqli_fetch_array($getmember);

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


</head>
<style>
    body {
        width: 100%;
        height: 100%;
        margin: 0;
        padding: 0;
        font-style: normal;
        /*background-color: #FAFAFA;*/
        font: 12pt "Tahoma";
    }
    * {
        box-sizing: border-box;
        -moz-box-sizing: border-box;
    }
    .page {
        width: 210mm;
        min-height: 140mm;
        padding: 4mm;
        margin: 10mm auto;
        border: 1px #D3D3D3 solid;
        border-radius: 5px;
        /*background: white;*/

    }
    .subpage {
        padding: 0cm;
        /*        border: 1px solid;*/
        height: 288mm;
        outline: 2cm #ffffff solid;
    }
    .box{
        width:130px;
        height:100px;
        border:1px solid black;
    }
    .border{
        border-right-style:solid; 
        border-bottom-style:none;
        border-left-style: solid; 
        border-top-style: solid;
        border-width: 1px ;
    }
    .border2{
        border-right-style:solid; 
        border-bottom-style:solid;
        border-left-style: solid; 
        border-top-style: solid;
        border-width: 1px ;
    }
    td{
        padding: 5px;
    }
    .center{
        text-align: center;
    }
    .left{
        text-align: left;
    }
    .right{
        text-align: right;
    }
    .padd{
        padding: 5px 5px 5px 20px;
    }

    @page {
        size: A4;
        margin: 0;
    }
    @media print {
        html, body {
            width: 210mm;
            height: 297mm;        
        }
        .page {
            margin: 0;
            border: initial;
            border-radius: initial;
            width: initial;
            min-height: initial;
            box-shadow: initial;
            background: initial;
            page-break-after: always;
        }
    }

</style>
<body id="main_container">
    <div class="book">
        <div class="page">
            <div class="subpage">
                <!--   ************Header************  -->
                <div style="">
                    <table width="100%" class="border">
                        <tr><td class="center" style='font-size:25px'><strong><?php echo $company[compname]; ?></strong></td></tr>
                        <tr><td class="center" ><?php echo $company[gstno]; ?></td></tr>
                        <tr><td class="center"><?php echo $company[address]; ?></td></tr>
                        <tr><td class="center"><?php echo $company[city] . " " . $company[pin]; ?></td></tr>
                        <!--<tr><td>&nbsp;</td></tr>-->
                    </table>

                    <table class="border" width="100%">
                        <tr>
                            <td width="65%" class="right"><b><u>FLAT TRANSFER RECEIPT</u></b></td>
                            <td width="45%"></td>
                        </tr>
                        <tr>
                            <td width="55%" class="padd"><b>Transfer No. - </b><?php echo $getmdata[vouchno]; ?></td>
                            <td width="45%" class="right padd"><b>Transfer Date :&nbsp;</b><?php echo $getmdata[vouchdt] ?></td>
                        </tr>

                    </table>

                    <table width="100%" class="border2">
                        <tr>
                            <!--<td class='padd'><lable>thanks from <b><?php // echo $member[name];  ?></b></lable></td>-->
                        </tr>
                        <tr>
                            <td class='padd'><lable>Received with the sum of &nbsp;<u><i class="fa fa-inr"></i><b>Rs. <?php echo $totamt ?>/-</b></u>(Given below)
                            </tr>
                            <tr>
                                <td class='padd'><lable>in words&nbsp;Rs.<u><i class="fa fa-inr"></i><b><?php echo rsword(round($totamt)); ?></b></u></lable></td>
                            </tr>
                            <?php
                            if ($getmdata['unit'] == 'F') {
                                $unit = "Sq. Ft.";
                            } else {
                                $unit = "Sq. Mtr.";
                            }
                            ?>
                            <tr>
                                <td class='padd'><lable>Against Transfer of the Flat No.&nbsp;<strong><?php echo " " . $getmdata[flatno] ?> </strong> at <strong><?php echo " " . $getmdata[floor] . " " ?></strong>Floor, Wing &nbsp;<strong><?php echo " " . $getmdata[wing] . "," ?> </strong>  Block &nbsp;<strong><?php echo " " . $getmdata[block] ?> </strong> and Area <strong><?php echo " " . $getmdata[area] . " " . $unit ?></strong> </lable></td>
                            </tr>
                            
                            <tr>
                                <td class='padd'><lable>From &nbsp; &nbsp;<strong><?php echo strtoupper($getmdata[tranname]) . "/" . strtoupper($getmdata[tranname2]) ?></strong></lable></td>
                        </tr>
                        <tr>
                            <td class='padd'>
                                <table width='100%'>
                                    <tr>
                                        <td width='10%'>Amount</td>
                                        <td width='25%' style='border:1px solid black; padding:10px'>Rs.<?php echo $getmdata[amount] ?>/-</td>
                                        <td width='5%'></td>
                                        <td width='15%' style="text-align: right">Society Charges</td>
                                        <td width='20%' style='border:1px solid black; padding:10px'>Rs.<?php echo $getmdata[socchrg] ?>/-</td>
                                        <td width='20%' style="text-align: right">Other Fees</td>
                                        <td width='20%' style='border:1px solid black; padding:10px'>Rs.<?php echo $getmdata[othfee] ?>/-</td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        <tr>
                            <td class="right padd"><lable><strong>For&nbsp;<?php echo $company[compname] ?></strong></lable></td>
                        </tr>
                        <tr>
                            <td class='padd'>
                                *Subject to realisation of cheque(s)
                            </td>
                        </tr>
                        <tr>
                            <td class="right padd"><b>SECRETARY</b></td>
                        </tr>
                    </table>

                </div>
            </div>

            <?php
            include("includes/linksfoot.php");
            ?>
            <script>
                $(function () {
                    formGeneral();
                });
            </script>
            </body>
            </html>
