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

$formname = 'Nb-Metric Print';
$maindb = 'nbmetric';

$zdb = $_SESSION["zdbyear_" . $dbname];
mysqli_select_db($conn,$zdb);
$zroot = $_SESSION['zdbroot'];
$admin = $_SESSION["admin_" . $dbname];

$mainqry = mysqli_query($conn,"SELECT * FROM $zroot.`$maindb` WHERE code !='' ORDER BY code") or die(mysqli_error($conn));


$atype = $get['active'];
include("includes/linkshead.php");
?>
<style>
    body {
        width: 100%;
        height: 100%;
        margin: 0;
        padding: 0;
        font: 12pt "Tahoma";
    }
    * {
        box-sizing: border-box;
        -moz-box-sizing: border-box;
    }
    .page {
        width: 210mm;
        min-height: 148mm;
        padding: 2mm;
        margin: 6mm auto;
        /*border: 1px #D3D3D3 solid;*/
        border-radius: 2px;
        background: white;

    }
    .subpage {
        padding: 0cm;
        /*        border: 1px solid;*/
        height: 150mm;
        /*outline: 2cm #ffffff solid;*/
    }

    @page {
        size: A5;
        margin: 0;
    }
    @media print {
        html, body {
            width: 210mm;
            height: 148mm;        
        }
        .page {
            margin: 0;
            border: initial;
            border-radius: initial;
            width: 150%;
            min-height: initial;
            box-shadow: initial;
            background: initial;
            page-break-after: always;
            /*margin-left: 10%;*/ 
       }
    }
    .border{
        border: 1px solid;
    }
</style>
</head>


<body id="main_container">
    <div class="book">
        
        <div class="page">
            <div class="row">
                <div class="col-md-12 text-center">
                    <?php
                    require("includes/dbconnect.php");
                    $comp = mysqli_query($conn,"SELECT * FROM `company`") or die(mysqli_errno());
                    $zcomp = mysqli_fetch_assoc($comp);
                    ?>
                    <b><?php echo $zcomp[name]; ?></b><br>
                    <?php echo $zcomp[add1] . ' ' . $zcomp[add2] . ' ' . $zcomp[add3]; ?><br>
                    <b><?php echo $formname; ?></b>
                </div>
            </div>
            
            <br>

            <table class="table-bordered" align='center' style="height:35%;width:90%;border:1px solid black;">
                <thead style="border:1px solid black; background-color: #64ccfc;">
                <th style="width:5%;border-right:1px solid black;">Sr.</th>
                <th style="width:10%;border-right:1px solid black;">Nb Inch</th>
                <th style="width:10%;border-right:1px solid black;">MM</th>
                <th style="width:10%;border-right:1px solid black;">Sch</th>
                <th style="width:10%;border-right:1px solid black;">Sch.MM</th>
                </thead>
                <?php
                $ctr = 0;
                ?>
                <tbody>
                        <?php
                        while ($get = mysqli_fetch_array($mainqry)){
                        $ctr++;
                        echo "<tr>";
                        echo "<tr style='font-weight: bold;'>";
                        echo "<td align='left' style='border-right:1px solid black;'>$get[srno]</td>";
                        echo "<td align='left' style='border-right:1px solid black;'>$get[nbinch]</td>";
                        echo "<td align='left' style='border-right:1px solid black;'>$get[sch]</td>";
                        echo "<td align='left' style='border-right:1px solid black;'>$get[mm]</td>";
                        echo "<td align='center' style='border-center:1px solid black;'>$get[schmm]</td>";
                        echo "</tr>";
                        }
                        ?>



                </tbody>
            </table>

            <br><br><br><br>

            
            <!--            </div>-->

        </div>  
        <!--</div>-->
    </div>

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