<?php
ob_start();
require("includes/check_auth_user.php");
require("includes/dbconnect.php");
include('includes/function.php');

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

if ($_REQUEST["ctr"]) {
    $ctr    = $_REQUEST["ctr"];
    $mctr = $ctr;
    $mctr++;

    echo "<tr>";
    echo "<td><i class='fa fa-close remove'></td>";
    echo "<td><input type='text' class='form-control form text-right srno'  name='srno_$ctr' value='$mctr' readonly tabindex='-1'></td>";
    echo "<td><input type='text' class='form-control form lineitem' name='lineitem_$ctr' value=''></td>";
    echo "<td><input type='text' class='form-control form weight' name='weight_$ctr' value=''></td>";
    echo "<td><select class='form-control select2 form fetchpart_$ctr' name='pouch_$ctr' style='width:100%;'>";
    echo "<option value=''></option>";
    $ggetunit = mysqli_query($conn, "SELECT * FROM product WHERE code != '' AND pouchflag = 1 ORDER BY name") or die(mysqli_error($conn));
    while ($ffetunit = mysqli_fetch_array($ggetunit)) {
        echo "<option value='$ffetunit[code]'>$ffetunit[name]</option>";
    }
    echo "</select>";
    echo "</td>";
    echo "</tr>";
    $ctr++;
} else {
    echo "ERROR";
}
