<?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["ctr"]) {
    $ctr = $_REQUEST["ctr"];
    $hide = $_REQUEST["hide"];
    $hide_var = "";
    $mctr = $ctr;
    $mctr++;
    echo "<tr>";
    echo '<td style="height:30px;" align="center" valign="top"><input type="image" src="delbut.png" name="remove"  value="remove" class="remove"/></td>';
    echo "<td style='height:30px;' align='left' valign='center'><input type='text' size='6' maxlength='6' name='srno_" . $ctr . "' class='srno form-control form' style='height:29px;' value='$row[srno]'/></td>";
    echo "<td style='height:30px;' align='center' valign='center'><input type='text' size=''  name='barcode_$ctr' class='barcode form-control  form' style='height:29px;text-align:left;' value='$row[barcode]'/></td>";

    echo "<td style='height:30px;' align='left' valign='center'>";
    echo "<select name='item_$ctr' style='height:29px;width:100%' class='item form-control form fetchpart_$ctr'>";
    echo "<option value='$geti[name]'>$geti[name]</option>";
    $mitem = mysqli_query($conn, "SELECT * FROM `item` ORDER BY `name`") or die(mysqli_error($conn));
    while ($trow1 = mysqli_fetch_array($mitem)) {
        echo "<option value='$trow1[name]' >$trow1[name]</option>";
    }
    echo "</select>";
    echo "</td>";
    echo "<td style='height:30px;' align='center' valign='center'><input type='text' size=''  name='qty_$ctr' class='qty form-control form' style='height:29px;text-align:right;' value='$row[qty]'/></td>";
    echo "<td style='height:30px;' align='center' valign='center'><input type='text' size=''  name='rate_$ctr' class='rate form-control form' style='height:29px;text-align:right;' value='$row[rate]'/></td>";
    echo "<td style='height:30px;' align='center' valign='center'><input type='text' size=''  name='amt_$ctr' class='amt form-control form' style='height:29px;text-align:right;' value='$row[amt]'  readonly/></td>";
    echo "<td style='height:30px;' align='center' valign='center'><input type='text' size=''  name='discperc_$ctr' class='discperc form-control form' style='height:29px;text-align:right;' value='$row[discperc]'/></td>";
    echo "<td style='height:30px;' align='center' valign='center'><input type='text' size=''  name='discamt_$ctr' class='discamt form-control form' style='height:29px;text-align:right;' value='$row[discamt]' readonly/></td>";
    echo "<td style='height:30px;' align='center' valign='center'><input type='text' size=''  name='final_$ctr' class='final form-control form' style='height:29px;text-align:right;' value='$row[totamt]'  readonly/></td>";
    echo "<td style='height:30px;' align='center' valign='center'><input type='text' size=''  name='mrp_$ctr' class='mrp form-control form' style='height:29px;text-align:right;' value='$row[mrp]'/></td>";
    echo "</tr>";
} else {
    echo "ERROR";
}
?>

