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

$formname = 'Bank Receipt';
$maindb = 'prevbkrecp';
$file = 'prevbkrecp_fr.php';
$source = "BRPV";

$zdb = $_SESSION["zdbyear_" . $dbname];
mysqli_select_db($conn, $zdb);
$myyear = $_SESSION[$myyear];
$mht = 'height:20px;';
$zroot = $_SESSION["zdbroot"];
$admin = $_SESSION["admin_" . $dbname];
$vouchno = $_REQUEST["vouchno"];
$mainqry = mysqli_query($conn, "SELECT *, DATE_FORMAT(`vouchdt`, '%d-%m-%Y') AS vouchdt FROM `$maindb` WHERE vouchno='$vouchno'") or die(mysqli_error($conn));
$getmdata = mysqli_fetch_array($mainqry) or die(mysqli_error($conn));
$paytype = $getmdata['paytype'];
if($paytype == 'C'){
    $chqdisp = 'Cheque No.';
}else{
    $chqdisp = 'DD No.';
}
$gexam = mysqli_query($conn, "SELECT `code`,`name` FROM `exam` WHERE `code` = '$getmdata[examcode]'") or die(mysqli_error($conn));
$exam = mysqli_fetch_array($gexam);

require("includes/dbconnect.php");
$comp = mysqli_query($conn, "SELECT * FROM `company`") or die(mysql_errno());
$zcomp = mysqli_fetch_assoc($comp);

if ($getmdata['chqdate'] == '0000-00-00') {
    $chqdate = '' ;
} else {
    $chqdate = date("d-m-Y", strtotime($getmdata['chqdate']));
}
?>



<html lang="en-US">

</head>
<style>
    body {
        width: 100%;
        height: 100%;
        margin: 0;
        padding: 0;
        /*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;
    }

    @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;
        }
    }
    .border{
        border-top-style: none;
        border-bottom-style: solid;
        border-right-style: solid;
        border-left-style: solid;
        border-width:1px;
    }
    .border2{
        border-top-style: solid;
        border-bottom-style: solid;
        border-right-style: solid;
        border-left-style: solid;
        border-width:1px;
    }
    .border3{
        border-top-style: none;
        border-bottom-style: solid;
        border-right-style: solid;
        border-left-style: solid;
        border-width:1px;
    }
    table td{
        font-family: serif;
    }
</style>

<body id="main_container">
    <div class="book">
        <div class="page">
            <?php
            for ($i = 0; $i <= 1; $i++) {
                ?>
                <!--<div class="subpage">-->
                <!--   ************Header************  -->
                <table width="100%" style="border:1px solid black;padding:5px">
                    <tr>
                        <td style="font-size:17px;padding:3px;font-family: serif"><b><center><?php echo $zcomp['compname']; ?></center></b></td>
                    </tr>
                    <tr>
                        <td style="font-size:12px"><center>
                        REG.NO. BOMBAY P.T.ACT 1950/F 17203 PUNE /SOCIETY'S REG.ACT 1860 MAHARASHTRA/ 330 - 2000/ PUNE
                    </center></td>
                    </tr>
                    <tr>
                        <td style="font-size:13px;font-family: serif;padding-top: 5px"><center><?php echo $zcomp['add1'] . $zcomp['add2']; ?></center></td>
                    </tr>
                    <tr>
                        <td style="font-size:13px;font-family: serif"><center><?php echo $zcomp['add3'] . "&nbsp;" . "&nbsp;" . "&nbsp;" . $zcomp['tel']; ?></center></td>
                    </tr>
                </table>

                <?php
                mysqli_select_db($conn, $zdb);

                $gcust = mysqli_query($conn, "SELECT * FROM `accmast` WHERE `accode`=$getmdata[party]") or die(mysqli_error($conn));
                $cust = mysqli_fetch_array($gcust);
                ?>
                <table width="100%" class="border" style="padding:0px 0px 0px 55px" >
                    <tr>
                        <td colspan="4" style="font-size:21px;font-family: serif"><center><b><?php echo $formname; ?></b></center></td>
                    </tr>
                    <tr>
                        <td  colspan="2" style="text-align: left;font-family: serif">
                            <b>Receipt No. :</b>
                            <?php echo "$getmdata[vouchno]" . '/' . $myyear; ?> 
                        </td>
                        <td  colspan="2" style="text-align: center;font-family: serif">
                            Date: 
                            <b><?php echo "$getmdata[vouchdt]"; ?> 
                        </td>                                
                    </tr>
                    <tr>

                        <td  style="text-align: left;font-family:serif" colspan="4">
                            Received with thanks from &nbsp;<b><?php echo "$cust[custcode]" . "-" . "$cust[name]"; ?></b>
                        </td>
                    </tr>                            
                    <tr>
                        <td colspan="4" style="text-align: center;">
                            <span style="padding-right:185px"></span><?php echo "$cust[city]" . "-" . "$cust[pin]"; ?>
                        </td>
                    </tr>                            
                    <tr>                      
                        <td style="text-align:left;font-family: serif" colspan="4">
                            <br>The Sum of <b>&nbsp;Rs.&nbsp;<?php echo "$getmdata[amount]"; ?>
                                <i>(Rupees <?php echo rsword(round($getmdata["amount"])); ?>&nbsp;Only)</i></b>
                        </td>
                    </tr>    
                    <tr>                      
                        <td style="text-align: left;font-family: serif" colspan="4">
                            <br>vide <?= $chqdisp ?> &nbsp;-&nbsp;<b><?php echo $getmdata['chqno']; ?></b> 
                            <span style="padding-right: 30px;"></span>Dated&nbsp;:&nbsp;<b><?php echo "$chqdate"; ?></b>
                            <span style="padding-right: 30px;"></span>Drawn On &nbsp;-&nbsp;<b><?php echo $getmdata['drawbank']; ?></b> 
                        </td>                                
                    </tr>
                    <tr>
                        <td colspan="4" style='font-family: serif'>Branch&nbsp;:-<b>&nbsp;<?php echo $getmdata['branch']; ?></b></td>
                    </tr>

                    <tr>
                        <td style="text-align:left;font-family: serif" colspan='4'><?php echo $getmdata['remark1']; ?>
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align:left;font-family: serif" colspan='4'><?php echo $getmdata['remark2']; ?>
                        </td>
                    </tr>
                    <tr>
                        <td width="44%">
                            <table>

                                <tr>
                                    <td style="text-align:left;font-family: serif">Exam&nbsp;:- &nbsp;<b><?php echo $exam['name']; ?></b>
                                    </td>
                                </tr>
                                <tr>
                                    <td>&nbsp;</td>
                                </tr>
                                <tr>
                                    <td>&nbsp;</td>
                                </tr>
                                <tr>
                                    <td>&nbsp;</td>
                                </tr>
                                <tr>
                                    <td>&nbsp;</td>
                                </tr>
                            </table>
                        </td>
                        <td width="21%" >
                        </td>
                        <td width="15%" style="border:1px solid black">
                        </td>
                        <td width="20%" >

                        </td>
                    </tr>

                    <tr>
                        <td colspan="1" style="text-align:left; width:40%;">
                            <!--<hr   align="left" style="border: 1px solid white; width:70%"/>-->
                            Valid Subject To Realisation Of Cheque
                        </td>
                        <td colspan="3" style="font-size:12px; padding-left: 58px;width:60%;">
                            MAHARASHTRA BHARATEEYA SHIKSHAN MANDAL
                        </td>
                    </tr>                    
                    <tr>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                    </tr>                    

                    <?php if ($i == 0) { ?>
                        <tr>
                            <td colspan="4" style='font-family: serif'><b>School Copy</b></td>
                        </tr>
                    <?php } elseif ($i == 1) { ?>
                        <tr>
                            <td colspan="4" style='font-family: serif'><b>Office Copy</b></td>
                        </tr>
                    <?php } ?>
                </table>

                <?php if ($i == 0) { ?>
                    <hr style="border :dotted 1px ;margin:18px 0px 18px 0px">

                    <?php
                }
            }
            ?>

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