<?php

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


$admin = $_SESSION["admin_" . $dbname];
$zdb = $_SESSION["zdbyear_" . $dbname];
$myyear = $_SESSION[$myyear];
mysqli_select_db($zdb);

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><i class='fa fa-close remove'></i></td>";
    Echo "<td><input type='text' class='form-control form text-right srno'   name='srno_$ctr' value='$mctr'></td>";

    Echo "<td>";
    Echo "<select class='form-control form select2 item' name='item_$ctr' style='width:100%'>";
    Echo "<option value=''></option>";
    $gitem = mysqli_query($conn, 'SELECT * FROM `product` order by name')or die(mysqli_error($conn));
    while ($item = mysqli_fetch_array($gitem)) {
        Echo "<option value='$item[code]'>$item[name]</option>";
    }
    Echo "</select>";
    Echo "</td>";

    Echo "<td>";
    Echo "<select class='form-control form select2 size' name='size_$ctr' style='width:100%'>";
    Echo "<option value=''></option>";
//    $getsize = mysql_query("SELECT * FROM `size` ORDER BY name")or die(mysql_error());
//    while ($size = mysql_fetch_array($getsize)) {
//        Echo "<option value='$size[code]'>$size[name]</option>";
//    }
    Echo "</select>";
    Echo "</td>";

    Echo "<td><input type='text' class='form-control form text-right trqty'  name='trqty_$ctr'  value='0'></td>";
    Echo "<td><input type='number' class='form-control form text-right trrate'  name='trrate_$ctr'  value='0'></td>";
    Echo "<td><input type='number' class='form-control form text-right tramount'  name='tramount_$ctr'  value='0'></td>";
    Echo "</tr >";
    $ctr++;
} else {
    echo "ERROR";
}
?>
 