<?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"];
    $prodtype = $_REQUEST["prodtype"];
    $addflag = $_REQUEST["addflag"];
    $hide_var = "";

    if ($hide == 0) {
        $hide_var = 'style="display:none;"';
    }
    $mctr = $ctr;
    $mctr++;
//    $ctr--;
    echo "<tr>";
                                                                                    echo "<td><i class='fa fa-close remove' style=''></i></td>";

    echo "<td><input type='text' class='form-control form' name='srno_$ctr' id='srno' value='$mctr' readonly></td>";
    echo "<td>";
    echo "<select class='form-control form saleexec' name='saleexec_$ctr' id='saleexec' style='width:100%'>";
    echo "<option value=''></option>";
    $getcomp = mysqli_query($conn, "Select accode,name from accmast where grpcode = '040' order by name") or die(mysqli_error($conn));
    while ($fetcomp = mysqli_fetch_array($getcomp)) {
        echo "<option value='$fetcomp[accode]'>$fetcomp[name]</option>";
    }

    echo "</select>";
    echo "</td>";
    echo "<td><input type='number' step='any' name='openbal_$ctr' class='form-control form text-right numeric openbal' value='$fetopen[openbal]'/></td>";
    echo "<td><input type='text' maxlength='1' name='opendc_$ctr' class='form-control form opendc'  value='$fetopen[dc]'/></td>";
    echo "</tr>";
    $ctr++;
} else {
    echo "ERROR";
}
?>
 