<?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>";
    if ($hide == 0) {
        $hide_var = 'style="display:none;"';
    }
    echo "<td align='center' valign='top'><input type='image' src='delbut.png' name='remove' value='remove' class='remove' $hide_var/></td>";
    echo "<td align='left' valign='top'><input type='text' size='6' maxlength='6' name='srno_$ctr' class='sno form-control' style='height:33px;' value='$mctr'/></td>";
    echo "<td align='center' style='height:30px;' valign='center'><input type='text' size=''  name='barcode_$ctr' class='barcode form-control' style='height:29px;text-align:left;' value='' /></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' style='height:29px;text-align:right;' value='0'/></td>";
    echo "<td style='height:30px;' align='center' valign='center'><input type='text' size=''  name='rate_$ctr' class='rate form-control' style='height:29px;text-align:right;' value='0'/></td>";
    echo "<td style='height:30px;' align='center' valign='center'><input type='text' size=''  name='amt_$ctr' class='amt form-control' style='height:29px;text-align:right;' value='0'  readonly/></td>";
//    echo "<td style='height:30px;' align='center' valign='center'><input type='text' size=''  name='discperc_$ctr' class='discperc form-control' style='height:29px;text-align:right;' value='0'/></td>";
//    echo "<td style='height:30px;' align='center' valign='center'><input type='text' size=''  name='discamt_$ctr' class='discamt form-control' style='height:29px;text-align:right;' value='0'/></td>";
    echo "<td style='height:30px;' align='center' valign='center'><input type='text' size=''  name='final_$ctr' class='final form-control' style='height:29px;text-align:right;' value='0'  readonly/></td>";
//    echo "<td style='height:30px;' align='center' valign='center'><input type='text' size=''  name='mrp_$ctr' class='mrp form-control' style='height:29px;text-align:right;' value='0'/></td>";


    echo "</tr>";
} else {
    echo "ERROR";
}
?>
