<?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 = 'Envelope Print';
$code = $_REQUEST["code"];

$para = $_GET["para"];
$maindb = 'accmast';
$mainqry = mysqli_query($conn, "SELECT * FROM `$maindb` WHERE accode ='$code'")or die(mysqli_error($conn));
$get = mysqli_fetch_object($mainqry);
?>
<html>
    <head>
        <title><?= $formname ?></title>
        <style>
            @page {
                margin-left: 10%;
            }
            body{
                margin-left: 35%;
                width: 220.98mm;
                height: 109.22mm;
            }
            /*            @media print {
                            html, body {
                                margin-left: 19%;
                                width: 220.98mm;
                                height: 109.22mm;
                            }
                             ... the rest of the rules ... 
                        }*/
            /*            .page{
                            height: 109.22mm;
                            width: 220.98mm;
                        }
                                                     @page { size:109.22mm 220.98mm; margin: 2cm }
                                         @page rotated { size : landscape }
                        @media print 
                        {
                            .page{
                                height: 109.22mm;
                                width: 220.98mm;
                            }
                            @page
                            {
                                size: 220.98mm 109.22mm;
                                size: landscape;
                            }
                        }*/

            @media print 
            {
                @page
                {
                    margin-top: 160px;
                    margin-left: 60px;

                    size: 4.0in 8.0in ;
                    size: landscape;
                }
            }
        </style>
    </head>
    <body>
        <div style="margin:auto;border:0px solid;padding-top:30px;" class="page">
            <table>
                <tr>
                    <td>
                        <font style="font-size: 27px;font-weight: bolder"><?= $get->name ?>
                        </font>
                    </td>
                </tr>
                <tr>   
                    <td style="font-size: 20px">
                        <?= $get->add1 ?><br/>
                        <font style="font-size: 20px;font-weight: bold"><?= $get->add2 ?><br/>
                        <?= $get->add3 ?><br/>
                    </td >
                </tr>
                <tr>   
                    <td style="font-size: 19px">
                        <?= $get->station ?>
                        <?= $get->city ?> <?= $get->pin ?>
                    </td>
                </tr>
                <tr>   
                    <td style="font-size: 19px">
                        <?php
                        if (!empty($get->tel)) {
                            echo $get->tel . " / ";
                        }
                        ?>  <?= $get->mobile ?>
                    </td>
                </tr>
                </font>
            </table>
        </div>
    </body>
</html>
