<?php

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

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

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

    $getsale = mysqli_query($conn, "Select party from salemain where vouchno = '$autovouch' ") or die(mysqli_error($conn));
    $fetsale = mysqli_fetch_array($getsale);
    
    $getpart = mysqli_query($conn, "Select accode,name from accmast where accode = '$fetsale[party]'") or die(mysqli_error($conn));
    $fetpart = mysqli_fetch_array($getpart);

    echo "<select  name='party' class='form-control form party' style='height:33px;' >";
    echo "<option value='$fetpart[accode]'>$fetpart[name]</option>";
    $mitem = mysqli_query($conn, "SELECT * FROM `accmast` where grpcode = '010' ORDER BY `name`") or die(mysqli_error($conn));
    while ($trow1 = mysqli_fetch_array($mitem)) {
        echo "<option value='$trow1[accode]'>$trow1[name]</option>";
    }
    echo "</select>";
} else {
    echo "ERROR";
}
?>
