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

$formname = 'Discount Given';
$maindb = 'discgive';
$file = 'discgive.php';
$zdb = $_SESSION["zdbyear_" . $dbname];
$zroot = $_SESSION["zdir"];

mysqli_select_db($conn,$zdb);
$mht = 'height:20px;';

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

$mainqry = mysqli_query($conn,"SELECT * FROM $maindb WHERE `vouchno` = '$vouchno' ")or die(mysqli_error($conn));
$getdata = mysqli_fetch_array($mainqry);
?>

<!DOCTYPE HTML>
<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: 120mm;
        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: 240mm;        
        }
        .page {

            width: 310mm;
            min-height: 160mm;
            padding: 4mm;
            margin: 10mm auto;
            border: 1px #D3D3D3 solid;
            border-radius: 5px;
        }
    }
    .border{
        border: 1px solid;
    }
</style>

<body id="main_container">
    <div class="book">
        <div class="page">
            <div class="col-md-12" >
                <?php
                $comp = mysqli_query($conn,"SELECT * FROM $zroot.`company`")or die(mysqli_error($conn));
                $zcomp = mysqli_fetch_array($comp);
                ?>
                <b><center><?php echo $zcomp['name']; ?></center></b>
                <h5><center><?php echo $formname; ?></center></h5>
            </div>
            <hr style="border-top: dotted 1px;" />
            <?php
            mysqli_select_db($conn,$zdb);
            ?>
            <table width="100%">
                <tr style="height:40px">
                    <td style="text-align: left;">
                        <b>Receipt.No:</b>
                        <?php echo "$getdata[vouchno]"; ?> 
                    </td>
                    <td style="text-align: center;">
                        <b>Date:</b>
                        <?php 
                        $vouchdt = $getdata['vouchdt'];
                        
                        $vouchdt = date("d-m-Y", strtotime($vouchdt));
                        
                        ?>
                        
                        <?php echo "$vouchdt"; ?> 
                    </td>
                </tr>
                <?php
                $getparty = mysqli_query($conn,"SELECT name FROM accmast WHERE accode = '$getdata[name]'")or die(mysqli_error($conn));
                $fparty = mysqli_fetch_array($getparty);
                $party = $fparty[name];
                ?>


                <tr style="height:40px">
                    <td colspan="2">Received with thanks from&nbsp&nbsp
                        <b><?php echo "$party"; ?> </b>
                    </td>
                </tr>
                <tr style="height:40px">
                    <td  colspan="2">a amount of <b><? echo "Rs. $getdata[amount]"; ?>
                            (<?php echo rsword(round($getdata["amount"])); ?>) </b>
                    </td>
                </tr>
                <tr></tr>
                <tr style="height:40px">
                    <td  colspan="2">
                        <? echo "$getdata[remark1]"; ?>    
                    </td>
                </tr>
                <tr style="height:40px">
                    <td>
                        <div></div>
                        </br>
                        </br>
                        </br>

                    </td>
                </tr>
                <tr>
                    <td style="text-align: left; width:50%;">
                        <hr   align="left" style="border: 1px solid black; width:50%"/>
                        <b>Authorised Signatory</b>
                    </td>
                    <td style="text-align: center; width:50%;">
                        <hr style="border: 1px solid black; width:70%"/>
                        <b>Received By/Account Holder</b>
                    </td>
                </tr>  
            </table>
            </table>
        </div>  
    </div>
    <?php
    include("includes/linksfoot.php");
    ?>
    <script>
        $(function () {
            formGeneral();
        });
    </script>
</body>
</html>
