<?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 ($_REQUEST["ctr"]) {
    $ctr = $_REQUEST["ctr"];
    $hide = $_REQUEST["hide"];
    $hide_var = "";
    if ($hide == 0) {
        $hide_var = 'style="display:none;"';
    }
    $mctr = $ctr;
    $mctr++;

    echo "<tr>";
    echo "<td align='center' valign='top'><span class='remove fa fa-times' name='remove' value='remove' $hide_var></span></td>";
    Echo "<td><input type='text' style='text-align:center;' value='$mctr'  name='srno_$ctr'  class='srno form-control form' readonly ></td>";
    // Echo "<td><input type='text' value=''   name='supcode_$ctr'  class='form-control form supcode'></td>";

    Echo "<td>";
    Echo "<select class='form-control form supcode select2 fetchpart_$ctr' name='supcode_$ctr' style='width:100%'>";
    Echo "<option value=''></option>";
    $gitem = mysqli_query($conn, "SELECT `accode`,`name` FROM `accmast` WHERE grpcode = '009' order by name")or die(mysqli_error($conn));
        while ($item = mysqli_fetch_array($gitem)) {
    Echo "<option value='$item[accode]'>$item[name]</option>";
    }
    Echo "</select>";
    Echo "</td>";

    Echo "<td><input type='text' value=''   name='suptype_$ctr'  class='form-control form suptype' readonly></td>";
    Echo "<td><input type='number' value=''   name='cost_$ctr'  class='form-control form cost' style='text-align:right;' ></td>";
    Echo "<td><input type='date' value=''   name='vouchdt_$ctr'  class='form-control form vouchdt'  ></td>";
    Echo "</tr>";
    $ctr++;
} else {
    echo "ERROR";
}
