<?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"];
    $addflg = $_REQUEST["addflg"];
    $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>";
    echo "<input type='text' name='srno[]' id='srno' class='srno form-control form' value='$mctr'>";
    echo "</td>";
    echo "<td>";
    echo "<input type='text' name='paxname[]' class='paxname form-control  form' value='' >";
    echo "</td>";
    echo "<td><i  style='background-color:#4285f4; color:white' class='fa fa-pencil edit1 text-center form-control form'></i></td>";
    echo "<td><a href='pax_pdf.php?myvouch=$get[myvouch]&passport=$row[passport]' target='_blank'><i class='fa fa-file-pdf-o visapdf'  style='font-size:28px'></i></a></td>";
    echo "<td>";
    echo "<select class='form-control sex form' name='sex[]' >";
    echo "<option value=''></option>";
    echo "<option value='M'>M</option>";
    echo "<option value='F'>F</option>";
    echo "</select>";
    echo "</td>";
    echo "<td>";
    echo "<input type='text' name='passport[]'  class='passport form-control  form' value='' >";
    echo "</td>";
    echo "<td>";
    echo "<select class='form-control delvstatus form' name='delvstatus[]' >";
    echo "<option value='$row[delvstatus]'>$dlvstatus</option>";
    echo "<option value='E'>ECR</option>";
    echo "<option value='N'>ECNR</option>";
    echo "</select>";
    echo "</td>";
    if ($addflg != 1) {

        echo "<td><a href='visaapp_pdf.php?myvouch=$get[myvouch]&passport=$row[passport]' target='_blank'><i class='fa fa-cc-visa' style='font-size:28px'> </i></a></td>";
        // echo "<td><a href='undertaking_pdf.php?myvouch=$get[myvouch]&passport=$row[passport]'  target='_blank'><i class='fa fa-file-text'  style='font-size:28px'></i></a></td>";
        echo "<td><a href='license_pdf.php?visano=$get[visano]&paxname=$row[paxname]'  target='_blank'><i class='fa fa-clipboard'  style='font-size:28px'></i></a></td>";
        echo "<td><a href='visa_barcode.php?visano=$get[visano]&mofano=$row[mofano]'  target='_blank'><i class='fa fa-barcode' style='font-size:35px'></i></a></td>";
        echo "<td><i class='fa fa-picture-o imgshow'  style='font-size:28px'></i></td>";
        echo "<td><a href='visa_pdf.php?myvouch=$get[myvouch]&passport=$row[passport]' target='_blank'><i class='fa fa-file-pdf-o visapdf'  style='font-size:28px'></i></a></td>";
    }
    echo "<td><input type='date' name='dob[]' class='dob form-control  form'  value='' style='width:120px;'></td>";
    echo "<td><input type='text' name='religion[]' class='religion form-control  form'  value='Muslim' ></td>";
    echo "<td>";
    echo "<input type='text' name='plbirth[]' class='plbirth form-control  form' value='' >";
    echo "</td>";
    echo "<td>";
    echo "<input type='text' name='issplace[]' class='issplace form-control  form' value=''>";
    echo "</td>";
    echo "<td><input type='text' name='periodstay[]' class='periodstay form-control  form'  value='2 Years'></td>";
    echo "<td><input type='date' name='issdate[]' class='issdate form-control  form'  value=''  style='width:120px;'></td>";
    echo "<td><input type='date' name='doe[]' class='doe form-control  form'  value=''  style='width:120px;'></td>";
    echo "<td><input type='date' name='stampdate[]' class='stampdate form-control  form'  value=''  style='width:120px;'></td>";
    // echo "<td><input type='date' name='releasedt[]' class='releasedt form-control  form'  value=''  style='width:120px;'></td>";
    echo "<td><input type='date' name='submission_date[]' class='submission_date form-control  form'  value=''  style='width:120px;'></td>";
    echo "<td><input type='text' name='mofano[]' class='mofano form-control  form' value='' ></td>";
    echo "<td><input type='text' name='mofano2[]' class='mofano2 form-control  form' value='' ></td>";
    echo "<td><input type='date' name='mofa_date[]' class='mofa_date form-control form'  value=''  style='width:120px;'></td>";
    echo "<td><input type='text' name='category[]' class='category form-control form'  value=''></td>";

    echo "<td>";
    echo "<input list='cateng' name='cateng[]' class='cateng form-control form ' autocomplete='off' value=''> ";
    echo "<datalist id='cateng' char='#'>";
    echo "<option >";
    $mcateng = mysqli_query($conn, "SELECT `name` FROM `catgmast` WHERE code!='' order by `name`") or die(mysqli_error($conn));
    while ($tmcateng = mysqli_fetch_array($mcateng)) {
        $catengname = $tmcateng['name'];
        echo "<option value='$catengname'>";
    }
    echo "</datalist>";
    echo "</td>";

    echo "<td><input type='text' name='mofamt_mod[]' class='mofamt_mod form-control text-right form' value='0' ></td>";
    echo "<td><input type='text' name='stampamt_mod[]' class='stampamt_mod form-control text-right form' value='0' ></td>";
    echo "<td><input type='text' name='imigamt_mod[]' class='imigamt_mod form-control text-right form' value='0' ></td>";
    echo "<td><input type='text' name='mis_mod[]' class='mis_mod form-control text-right form' value='0' ></td>";
    echo "<td><input type='text' name='misc_mod[]' class='misc_mod form-control text-right form' value='0' ></td>";
    echo "<td><input type='text' name='memcash[]' class='memcash form-control text-right form' value='0' ></td>";
    echo "<td><input type='text' name='tremark[]' class='tremark form-control  form' value='' ></td>";
    echo "<td><input type='text' name='tadd[]' class='tadd form-control form' value='' ></td>";

    echo "<td>
                                                        <input type='file' name='tfile[]'  class='form btn btn-primary file' style='padding: 0px;margin: 0px;display:inline;width:93px'>
                                                      </td>";
    echo "<td>
                                                        <input type='file' name='tfile2[]'  class='form btn btn-primary file' style='padding: 0px;margin: 0px;display:inline;width:93px'>
                                                      </td>";
    echo "<td>
                                                        <input type='file' name='tfile3[]'  class='form btn btn-primary file' style='padding: 0px;margin: 0px;display:inline;width:93px'>
                                                      </td>";
    echo "<td>
                                                      <input type='file' name='tfile4[]'  class='form btn btn-primary file' style='padding: 0px;margin: 0px;display:inline;width:93px'>
                                                    </td>";
    //                                                Echo "<td><img class='preview'  style='height:98px;width:98px;display:inline' src='$row[imagepath]?a=" . mt_rand() . "' alt='your image'></td>";
    //                                                Echo "<td><img class='preview'  style='height:98px;width:98px;display:inline' src='$row[imagepath]?a=" . mt_rand() . "' alt='your image'></td>";
    echo "</tr>";
    $ctr++;
} else {
    echo "ERROR";
}
