<?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];

if (isset($_REQUEST["item"])) {
    $item = $_REQUEST["item"];
    $vouchdt = $_REQUEST["vouchdt"];

    $ctr = 0;

    $getexpense = mysqli_query($conn, "SELECT a.*,b.accode as vendorcode, b.name FROM `expvendortran` a
                                       LEFT JOIN accmast b ON a.vendor = b.accode         
                                       WHERE a.`accode` = '$item' ") or die(mysqli_error($conn));
    
    while ($gtpt = mysqli_fetch_array($getexpense)) {
        $ctr++;
        echo "<option value='$gtpt[vendorcode]'>$gtpt[name]</option>";
    }

} else {
    echo "<tr><td colspan='4' style='text-align:center;'>ERROR: Missing parameters</td></tr>";
}
?>