<?php

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

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

if ($_REQUEST["vouchno"]) {
    $vouchno = $_REQUEST["vouchno"];

    $gettran = mysqli_query($conn, "SELECT * FROM `kottran` WHERE `vouchno`='$vouchno'order by `srno`")or die(mysqli_error($conn));
    $ctr = 1;
    echo "<td colspan='4'>";
    echo "<table class='table table-bordered' style='font-style:italic;font-size:22px'>";
    echo "<tr style='background-color:grey;color:white'>";
    echo "<td>Sr.</td>";
    echo "<td>Item</td>";
    echo "<td>Qty.</td>";
    echo "</tr>";
    while ($row = mysqli_fetch_array($gettran)) {
        $getitem = mysqli_query($conn, "Select code, name from item where code='$row[item]'") or die(mysqli_error($conn));
        $ftitem = mysqli_fetch_array($getitem);
        echo "<tr>";
        Echo "<td>$row[srno]</td>";
        Echo "<td>";
        Echo "$ftitem[name]";
        Echo "</td>";
        Echo "<td>$row[qty]</td>";
        echo "</tr>";
        $ctr++;
    }
    echo "</table>";
    echo "</td>";
    $ctr++;
}
?>