<?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"];
    $hide_var = "";
    if ($hide == 0) {
        $hide_var = 'style="display:none;"';
    }
    $mctr = $ctr;
    $mctr++;

    Echo "<tr>";
    Echo "<td><i class='fa fa-close remove' style=''></i></td>";
    Echo "<td><input type='text' class='form-control form text-right srno'    name='srno_$ctr'     value='$mctr'></td>";
    Echo "<td><input type='date' class='form-control form checkin'        name='checkin_$ctr' value=''></td>";
    Echo "<td><input type='date' class='form-control form checkout'        name='checkout_$ctr' value=''></td>";
    Echo "<td><input type='number' class='form-control form tet-right nonights'        name='nonights_$ctr' value=''></td>";

    Echo "<td>";
    Echo "<select class='form-control form roomcatg select2 fetchpart_$ctr' name='roomcatg_$ctr' style='width:100%'  required>";
    Echo "<option value=''></option>";
    $git = mysqli_query($conn, "SELECT `code`,`name` FROM `roomcatg` ORDER BY `name`")or die(mysqli_error($conn));
    while ($itm = mysqli_fetch_array($git)) {
        Echo "<option value='$itm[code]'>$itm[name]</option>";
    }
    Echo "</select>";
    Echo "</td>";
    Echo "<td>";
    Echo "<select class='form-control form roomtype select2 fetchpart_$ctr' name='roomtype_$ctr' style='width:100%'  required>";
    Echo "<option value=''></option>";
    $git2 = mysqli_query($conn, "SELECT `code`,`name` FROM `roomtype` ORDER BY `name`")or die(mysqli_error($conn));
    while ($itm2 = mysqli_fetch_array($git2)) {
        Echo "<option value='$itm2[code]'>$itm2[name]</option>";
    }

    Echo "</select>";
    Echo "</td>";
    Echo "<td><input type='text' class='form-control form text-right qty'    name='qty_$ctr'  value='0'></td>";
    Echo "<td><input type='text' class='form-control form text-right rate'    name='rate_$ctr'  value='0'></td>";
    Echo "<td><input type='text' class='form-control form text-right amount'  name='amount_$ctr'  value='0' readonly ></td>";
    Echo "<td><input type='text' class='form-control form remarks'  name='remarks_$ctr'  value='' ></td>";
    Echo "</tr>";
    $ctr++;
} else {
    echo "ERROR";
}
?>
 