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

$zdb = $_SESSION["zdbyear_" . $dbname];
mysqli_select_db($conn, $zdb);
$formname = 'Cheque Print';
$vouchno = $_GET["vouchno"];
$maindb = 'bankpay';

$mainqry = mysqli_query($conn, "SELECT *,DATE_FORMAT(`chqdate`, '%d %m %Y')as chqdate FROM `$maindb` WHERE `vouchno` = '$vouchno'") or die(mysqli_error($conn));
$get = mysqli_fetch_array($mainqry);

$gparty = mysqli_query($conn, "SELECT `accode`, `name` FROM `accmast` WHERE `grpcode` > '002' and `accode` = '$get[party]'") or die(mysqli_error($conn));
$party = mysqli_fetch_array($gparty);
include("includes/linkshead.php");
$d1 = substr("$get[chqdate]", 0, -9);
$d2 = substr("$get[chqdate]", 1, -8);
$ss = substr("$get[chqdate]", 2, -7);
$m1 = substr("$get[chqdate]", 3, -6);
$m2 = substr("$get[chqdate]", 4, -5);
$ss2 = substr("$get[chqdate]", 5, -4);
$y1 = substr("$get[chqdate]", 6, -3);
$y2 = substr("$get[chqdate]", 7, -2);
$y3 = substr("$get[chqdate]", 8, -1);
$y4 = substr("$get[chqdate]", 9);


include("includes/linkshead.php");
?>
<!--<link href="MyStyle/rep_format.css" rel="stylesheet">-->


<head>
    <title><?= $formanme ?></title>
    <style>

        .page {
            width: 240.568mm;
            min-height: 85.2mm;
            padding: 1mm;
            margin: 0mm 0mm 0mm 4mm;
            border: 1px #D3D3D3 solid;
            border-radius: 5px;
            background: white;

        }
        .subpage {
            padding-right   : 0.5cm;
            padding-left    : 0.5cm;
            padding: 0cm; 
            /*border: 1px solid;*/
            height: 105.2mm;
            outline: 2cm #ffffff solid;
        }

        body{
            font-size: 23px;

        }
        td{
            font-size: 17px;
        }
        .table>tbody>tr>td{
            border-top: 0px solid #ddd;
        }
        @media print{@page {size: landscape}}

    </style>
</head>
<!--<body onload="window.print();">-->
<body >
    <div class="page">
        <div class="subpage">
            <div style="width:100%;border:0px solid;padding-top:15px;">
                <table class="" style="">
                    <!--Date-->
                    <tr>
                        <td style='height:0px;padding-top:20px; padding-bottom:0px;'><b>&nbsp;<span style="padding-right: 719px"></span>
                                <?php
                                echo $d1 . "&nbsp;" . "&nbsp;" . "&nbsp;" . "&nbsp;" . "&nbsp;" . $d2 . "&nbsp;" . "&nbsp;" .
                                "&nbsp;" . "&nbsp;" . "&nbsp;" . "&nbsp;" . $m1 . "&nbsp;" . "&nbsp;" .
                                "&nbsp;" . "&nbsp;" ."&nbsp;" . $m2 . "&nbsp;" . "&nbsp;" . "&nbsp;" . "&nbsp;" . "&nbsp;" . "&nbsp;" .
                                $y1 . "&nbsp;" . "&nbsp;" . "&nbsp;" . "&nbsp;" . "&nbsp;" . $y2 .
                                "&nbsp;" . "&nbsp;" . "&nbsp;" . "&nbsp;" . "&nbsp;" . $y3 . "&nbsp;" . "&nbsp;" .
                                "&nbsp;" . "&nbsp;" . "&nbsp;" . "&nbsp;" . $y4;
                                ?></b></td>
                    </tr>

                    <!--Name-->
                    <tr>
                        <td style="padding-bottom:0px;padding-top:40px;font-size:15px"><b>&nbsp;
                                <span style="padding-right: 85px"></span><?php echo $party['name']; ?></b></td>
                    </tr>

                    <!--Amount in Words-->
                    <tr>
                        <td style="padding-top:9px;font-size:15px"><b>&nbsp;<span style="padding-right: 134px"></span>
                                <?php echo rsword($get['amount']); ?>&nbsp;Only.</b></td>
                    </tr>
                    <!--Amount in Number-->
                    <tr>
                        <td style="padding-top: 14px;font-size:15px"><b>&nbsp;<span style="padding-right: 725px"></span>
                                &nbsp;<?php echo number_format($get['amount']); ?>/-</b></td>
                    </tr>
                </table>
            </div>
        </div>
    </div>
</body>
</html> 