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

$zdb = $_SESSION["zdbyear_" . $dbname];
mysqli_select_db($conn, $zdb);

//browse("$_POST[dtype]");
    $cond = "";
   
    if (!empty($_POST["name"])) {
        $pname = trim($_POST["name"]);
        $cond = "AND `name` LIKE '%$pname%'";
    }

    $get = mysqli_query($conn, "SELECT * FROM `godown` WHERE `name`!='' $cond ORDER by `name`") or die(mysqli_error($conn));
    $getno = mysqli_num_rows($get);

    /* Normal Browser View Part */
    ?>    
    <!DOCTYPE HTML>
    <?php
include("includes/files.php");
    ?>
        </head>
        <body>

             <?php
                require("includes/dbconnect.php");
              $comp = mysqli_query($conn, "SELECT * FROM `company`") or die(mysql_errno());
              $zcomp = mysqli_fetch_assoc($comp);
              echo "<font size='4px'><b>$zcomp[compname]</font></b></font><br />";
              echo "<font size='2px'><b> $zcomp[add1]. $zcomp[add2].  $zcomp[add3] </b></font><br /><br />";
              echo "<b><font>Godown List &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font size='3px'>Date : ".date("M-d-Y") . "</b><br />";
              echo "<b>"."Total Customer - $getno</b><br />";
              echo "<br />"; 
            ?>

            <table class="table table-bordered sortableTable responsive-table" width="100%">

                <thead>
                    <tr>
                        <th style="text-align:left;" scope="col" width="6"><b>Sr.No</b></th>
                        <th style="text-align:left;" scope="col" width="8"><b>Code</b></th>
                        <th style="text-align:left;" scope="col" width="30"><b>Name</b></th>
                        <th style="text-align:left;" scope="col" width=25"><b>ADDRESS1</b></th>
                        <th style="text-align:left;" scope="col" width="25"><b>ADDRESS2</b></th>
                        <th style="text-align:left;" scope="col" width="25"><b>ADDRESS3</b></th>
                    </tr>
                </thead>
                <tbody>
                    <?php
                    $ctr = 0;
                    while ($city = mysqli_fetch_assoc($get)) {
                        $ctr++;
                        echo "<tr> \n";
                        echo "<td style=\"text-align:left;\" width=\"6\" valign='top'> \n <span> $ctr </span> \n </td> \n";
                            echo "<td style=\"text-align:left;\" width=\"180\" valign='top'> \n <span><b> $city[code]</b> </span> \n<br/>";
                            echo "<td style=\"text-align:left;\" width=\"180\" valign='top'> \n <span><b> $city[name]</b> </span> \n<br/>";
                            echo "<td style=\"text-align:left;\" width=\"180\" valign='top'> \n <span><b> $city[add1]</b> </span> \n<br/>";
                            echo "<td style=\"text-align:left;\" width=\"180\" valign='top'> \n <span><b> $city[add2]</b> </span> \n<br/>";
                            echo "<td style=\"text-align:left;\" width=\"180\" valign='top'> \n <span><b> $city[add3]</b> </span> \n<br/>";
                    }
                    ?>
                </tbody>
                
            </table>
        <?php
include("includes/files_footer.php");
?>
        <script>
            $(function() {
                metisTable();
                metisSortable();
            });
        </script>
    </body>
    </html>