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

$formname = 'FIT Entry';
$maindb = 'pax';
$accdb = 'actran';
$fooddb = 'foodent';
$launddb = 'laundent';
$visadb = 'visaent';
$tiktdb = 'tiktent';
$transdb = 'transent';
$transfltdet = 'transfltdet';
$tranpurchdb = 'tranpurch';

$printfile = "pax_quote_print.php";
$file = 'fit_ent.php';
$trandbexist = 0;
$salecode = 15;
$source = 'SL';

$usertype = $_SESSION["usertype"];
if ($usertype < 3) {
    $curdate = "";
} else {
    $curdate = date("Y-m-d");
}

$acdate = strtotime(date("Y-m-d", strtotime($curdate)) . "+8 month");
$plusdate = date("Y-m-d", $acdate);

$grid = '';
$keyfld = "paxid";
$focusfield = "code";
$mgrpcode = '';
$keycond = "";
$myyear = $_SESSION["tit_" . $dbname];

$admin = $_SESSION["admin_" . $dbname];
$zdb = $_SESSION["zdbyear_" . $dbname];
$username = $_SESSION["username_" . $dbname];
$zroot = $_SESSION["zdir"];
$zcono = $_SESSION["comp_" . $dbname];
$modet = $_GET["mode"];

$yearalpha1 = substr($myyear, 0, 1);
$nyear = substr($myyear, -4);

$yearalpha = strtoupper($yearalpha1);

$getcominvno = mysqli_query($conn, "SELECT autogeninv FROM $zroot.`company` WHERE code = '$zcono'  ") or die(mysqli_error($conn));
$fetcominvno = mysqli_fetch_array($getcominvno);
$autoginv = $fetcominvno["autogeninv"];

mysqli_select_db($conn, $zdb);
include("includes/vouchno_generate.php");
include("includes/prev&next.php");

if (isset($_POST["submit"])) {
    $a = 1;

    foreach ($_POST as $k => $v) {
        $$k = $v;
    }

    /// main post ///////
    $optdate = $_POST["optdate"];
    $invdate = $_POST["invdate"];
    $hajino = $_POST["hajino"];
    $regno = $_POST["regno"];
    $date = $_POST["date1"];
    $deptdate = $_POST["deptdate"];
    $arrdate = $_POST["arrdate"];
    $visitingfor = $_POST["visitingfor"];
    $familyhead = $_POST["familyhead"];
    $suffix = $_POST["suffix"];
    $name = $_POST["name"];
    $roomtype = $_POST["roomtype"];
    $surname = $_POST["surname"];
    $midname = $_POST["midname"];
    $relation = $_POST["relation"];
    $gender = $_POST["gender"];
    $dob = $_POST["dob"];
    $pob = $_POST["pob"];
    $caste = $_POST["caste"];
    // $nationality = $_POST["nationality"];
    $address = $_POST["address"];
    $city = $_POST["mcity"];
    $pin = $_POST["pin"];
    $pstate = $_POST["pstate"];
    $pstatecode = $_POST["pstatecode"];
    $gstno = $_POST["gstno"];
    $taluka = $_POST["taluka"];
    $district = $_POST["district"];
    $state = $_POST["state"];
    $countcode = $_POST["countcode"];
    $mobile = $_POST["mobile"];
    $bloodgroup = $_POST["bloodgroup"];
    $saudimobno = $_POST["saudimobno"];
    $telno = $_POST["telno"];
    $email = $_POST["email"];
    $disease = $_POST["disease"];
    $occupation = $_POST["occupation"];
    $whatsno = $_POST["whatsno"];
    $pilgdays = $_POST["pilgdays"];
    $marital = $_POST["marital"];
    $agent = $_POST["agent"];
    $nationality = $_POST["nationality"];
    $transtype = $_POST["transtype"];
    $fltdate = $_POST["fltdate"];
    $flttime = $_POST["flttime"];
    $fltsector = $_POST["fltsector"];
    $fltno = $_POST["fltno"];

    ////////////////////////////////////////////////////////////////
    //    ********* mehram *****
    $mehram_no = $_POST["mehram_no"];
    $mehram_relation_code = $_POST["mehram_relation_code"];
    //    passport ready
    $passportno = $_POST["passportno"];
    $issuedate = $_POST["issuedate"];
    $expirydate = $_POST["expirydate"];
    $plusdate = $_POST["plusdate"];
    $issueplace = $_POST["issueplace"];
    $passport_ready = $_POST["passport_ready"];
    $recparty = $_POST["recparty"];
    $sentvisa = $_POST["sentvisa"];
    $recdvisa = $_POST["recdvisa"];
    $panno = $_POST["panno"];
    $aadhaarno = $_POST["aadhaarno"];
    $paxpassport = $_POST["paxpassport"];
    //    passport not ready    
    $webno = $_POST["webno"];
    $fileno = $_POST["fileno"];
    $nrdate = $_POST["nrdate"];
    $passport_office = $_POST["passport_office"];

    //    airline details
    $visano = $_POST["visano"];
    $mofa = $_POST["mofa"];
    $visaisspl = $_POST["visaisspl"];
    $batchno = $_POST["batchno"];
    $class = $_POST["class"];

    $ticketamt = $_POST["ticketamt"];
    $touramt = $_POST["touramt"];
    $moulimamt = $_POST["moulimamt"];
    $currencyamt = $_POST["currencyamt"];
    $otherexp = $_POST["otherexp"];
    $commission = $_POST["commission"];
    $subtotal = $_POST["subtotal"];
    $discamt = $_POST["discamt"];
    $tcsamt = $_POST["tcsamt"];
    $cancelamt = $_POST["cancel_amt"];
    $netamt = $_POST["netamt"];
    $aircount = $_POST["items"];

    //***********PAYMENT DETAILS*************
    $pname = $_POST["pay_pax_name"];
    $sname = $_POST["pay_send_name"];
    $relname = $_POST["pay_relation"];
    $accno = $_POST["pay_accno"];
    $bankname = $_POST["pay_bank"];
    $branch = $_POST["pay_branch"];
    $date_pay = $_POST["pay_date"];
    $ifsc = $_POST["pay_ifsc"];
    $drawbank = $_POST["pay_drawbank"];
    $pay_city = $_POST["pay_city"];
    $chequeno = $_POST["pay_chequeno"];
    $utrno = $_POST["pay_utrno"];
    $ddno = $_POST["pay_ddno"];
    $payat = $_POST["pay_payat"];
    $pmodeval = $_POST["pmode"];
    $roe = $_POST["roe"];
    $foodpax = $_POST["foodpax"];
    $foodnights = $_POST["foodnights"];
    $foodamt = $_POST["foodamt"];
    $laundpax = $_POST["laundpax"];
    $laundnights = $_POST["laundnights"];
    $laundamt = $_POST["laundamt"];

    $visapax = $_POST["visapax"];
    $visaamt = $_POST["visaamt"];

    $tiktpax = $_POST["tiktpax"];
    $tiktamt = $_POST["tiktamt"];
    $tiktsubtot = $_POST["tiktsubtot"];
    $tiktgstperc = $_POST["tiktgstperc"];
    $tiktgstamt = $_POST["tiktgstamt"];
    $tikthandchg = $_POST["tikthandchg"];

    $transpax = $_POST["transpax"];
    $transveh = $_POST["transveh"];
    $transamt = $_POST["transamt"];
    $hotelamt = $_POST["hotelamt"];

    $foodaprov = $_POST["foodaprov"];
    $transaprov = $_POST["transaprov"];
    $hotelaprov = $_POST["hotelaprov"];
    $visaaprov = $_POST["visaaprov"];
    $tiktaprov = $_POST["tiktaprov"];
    $laundaprov = $_POST["laundaprov"];

    //    visa purchase

    $tiktsupp = $_POST["tiktsupp"];
    $tiktpuramt = $_POST["tiktpuramt"];
    $tiktinvno = $_POST["tiktinvno"];
    $tiktinvdt = $_POST["tiktinvdt"];

    $visasupp = $_POST["visasupp"];
    $visarate = $_POST["visarate"];
    $visainvno = $_POST["visainvno"];
    $visainvdt = $_POST["visainvdt"];
    $visapuramt = $_POST["visapuramt"];

    $transsupp = $_POST["transsupp"];
    $transrate = $_POST["transrate"];
    $transinvno = $_POST["transinvno"];
    $transinvdt = $_POST["transinvdt"];
    $transpuramt = $_POST["transpuramt"];

    $hotelsupp = $_POST["hotelsupp"];
    $hotelrate = $_POST["hotelrate"];
    $hotelinvno = $_POST["hotelinvno"];
    $hotelinvdt = $_POST["hotelinvdt"];
    $hotelpuramt = $_POST["hotelpuramt"];

    $laundsupp = $_POST["laundsupp"];
    $laundrate = $_POST["laundrate"];
    $laundinvno = $_POST["laundinvno"];
    $laundinvdt = $_POST["laundinvdt"];
    $laundpuramt = $_POST["laundpuramt"];

    $foodsupp = $_POST["foodsupp"];
    $foodrate = $_POST["foodrate"];
    $foodinvno = $_POST["foodinvno"];
    $foodinvdt = $_POST["foodinvdt"];
    $foodpuramt = $_POST["foodpuramt"];

    $invno = $_POST["invno"];

    $inrtotalamt = $_POST["inrtotalamt"];
    $discountinr = $_POST["discountinr"];
    $netinramt = $_POST["netinramt"];

    $mvouch = $qvouch;

    $barcode = $mvouch . $yearalpha . $nyear;

    $accountname = $surname . ' ' . $name . ' ' . $midname;

    if ($roe == "") {
        $roe = 0;
    }

    if ($a == 1) {

        if ($addflag == 1) {
            $gen1 = mysqli_query($conn, "SELECT IFNULL(MAX(vouchno),0) AS maxcode FROM `$maindb` ") or die(mysqli_error($conn));
            $vvouch = mysqli_fetch_assoc($gen1);

            if ($vvouch['maxcode'] > 0) {
                $qvouch = $vvouch["maxcode"] + 1;
            } else {
                $gen11 = mysqli_query($conn, "SELECT startfit AS maxreg FROM $zroot.`company` WHERE code = '$zcono'  ") or die(mysqli_error($conn));
                if (mysqli_num_rows($gen11) > 0) {
                    $vvouch11 = mysqli_fetch_assoc($gen11);
                    $qvouch = $vvouch11["maxreg"];
                } else {
                    $qvouch = '1';
                }
            }
            $mvouch = $qvouch;
        }


        if ($autoginv == "Y") {

            if ($addflag == 1) {

                $genInvno = mysqli_query($conn, "SELECT MAX(invno) AS maxcode FROM `$maindb` LIMIT 0,1 ") or die(mysqli_error($conn));
                if (mysqli_num_rows($genInvno) > 0) {
                    $fetinvno = mysqli_fetch_assoc($genInvno);
                    $newinvno = $fetinvno["maxcode"] + 1;
                } else {
                    $newinvno = '1';
                }

                $invno = $newinvno;
                //                browse($qinvno . "Autogen Invno");
            }

            $invdate = $date;

            if ($visaamt > 0) {
                $visaaprov = 1;
            }
            if ($tiktamt > 0) {
                $tiktaprov = 1;
            }
            if ($hotelinramt > 0) {
                $hotelaprov = 1;
            }
            if ($transinramt > 0) {
                $transaprov = 1;
            }
            if ($laundinramt > 0) {
                $laundaprov = 1;
            }
            if ($foodinramt > 0) {
                $foodaprov = 1;
            }
        }

        //        Creating Account in accmast and Address book
        //        if ($familyhead == 'T') {
        //           Address book
        $resacc1 = mysqli_query($conn, "SELECT * FROM $zroot.`address` WHERE `name` = '$accountname'") or die(mysqli_error($conn));
        if (mysqli_num_rows($resacc1) > 0) {

            $fetacc1 = mysqli_fetch_array($resacc1);
            $maccode1 = $fetacc1['accode'];
            mysqli_query($conn, "UPDATE $zroot.`address` set `name`='$accountname', `address`='$address',`city`='$city',`pin`='$pin',
                                `mobile`='$mobile',`tel`='$telno',`email`='$email',`category`='10', 
                                `hajyear`='$myyear',`district`='$district' where accode = '$fetacc1[accode]' ") or die(mysqli_error($conn));
        } else {
            $gen11 = mysqli_query($conn, "SELECT MAX(accode) AS maxcode FROM $zroot.`address` LIMIT 0,1 ") or die(mysqli_error($conn));
            if (mysqli_num_rows($gen11) > 0) {
                $vaccode1 = mysqli_fetch_assoc($gen11);
                $qaccode1 = $vaccode1["maxcode"] + 1;
            } else {
                $qaccode1 = '1';
            }

            $maccode1 = $qaccode1;
            mysqli_query($conn, "INSERT INTO $zroot.`address`(`accode`,`name`, `address`, `city`, `pin`, `mobile`, `tel`,  `email`,`category`, `hajyear`,`district`)
                                        VALUES('$maccode1', '$accountname', '$address', '$city', '$pin', '$mobile', '$telno', '$email', '10', '$myyear', '$district')") or die(mysqli_error($conn));
        }
        //  }
        //  Accmast

        if ($hotelaprov == 1 || $tiktaprov == 1 || $transaprov == 1 || $laundaprov == 1 || $foodaprov == 1 || $visaaprov == 1) {

            $accode = $_POST["accode"];

            $add11 = substr($address, 0, 50);
            $add12 = substr($address, 51, 50);
            $add13 = substr($address, 101, 50);

            $add1 = mysqli_real_escape_string($conn, $add11);
            $add2 = mysqli_real_escape_string($conn, $add12);
            $add3 = mysqli_real_escape_string($conn, $add13);

            //            $resacc = mysqli_query($conn, "SELECT * FROM `accmast` WHERE `accode`= '$accode'") or die(mysqli_error($conn));

            $resacc = mysqli_query($conn, "SELECT * FROM `accmast` WHERE `name`= '$accountname' and mobile='$mobile'") or die(mysqli_error($conn));
            if (mysqli_num_rows($resacc) > 0) {

                $fetacc = mysqli_fetch_array($resacc);
                $maccode = $fetacc['accode'];
                mysqli_query($conn, "UPDATE `accmast` SET `name`='$accountname',  mobile='$mobile', fname='$name', midname='$midname',surname='$surname',
                                                          `init`='SDR', email='$email', city='$city', pin='$pin', add1='$add1', add2='$add2', add3='$add3'
                                                           where accode = '$fetacc[accode]' ") or die(mysqli_error($conn));
            } else {
                $gen1 = mysqli_query($conn, "SELECT MAX(accode) AS maxcode FROM `accmast` LIMIT 0,1 ") or die(mysqli_error($conn));
                if (mysqli_num_rows($gen1) > 0) {
                    $vaccode = mysqli_fetch_assoc($gen1);
                    $qaccode = $vaccode["maxcode"] + 1;
                } else {
                    $qaccode = '51';
                }

                $maccode = $qaccode;
                mysqli_query($conn, "INSERT INTO `accmast`(accode, `name`, `init`, `grpcode`, fname, midname, surname, mobile,email,city,pin, add1, add2, add3)
                                        VALUES('$maccode', '$accountname', 'SDR', '010', '$name', '$midname', '$surname', '$mobile', '$email', '$city', '$pin', '$add1', '$add2', '$add3')") or die(mysqli_error($conn));
            }
        }

        ########################################Image Part End  ########################################
        //        Food part start
        mysqli_query($conn, "Delete from `$fooddb` where `vouchno`='$mvouch'") or die(mysqli_error($conn));
        $fcnt = 0;
        $foodcnt = $_POST["foodcnt"];
        for ($i = 0; $i <= $foodcnt; $i++) {
            $srno = $_POST["srno_$i"];
            $fcheckin = $_POST["fcheckin_$i"];
            $fcheckout = $_POST["fcheckout_$i"];
            $fnopax = $_POST["fnopax_$i"];
            $fnonights = $_POST["fnonights_$i"];
            $frate = $_POST["frate_$i"];
            $famount = $_POST["famount_$i"];
            $fmeal = $_POST["fmeal_$i"];
            $fhotel = $_POST["fhotel_$i"];

            if ($famount > 0) {
                $finramt = round($roe * $famount, 0);
            }

            if ($fhotel != "") {
                $fcnt++;
                mysqli_query($conn, "INSERT INTO `$fooddb`(`vouchno`, `srno`, `checkin`, `checkout`, `hotel`, `nopax`, `nonights`, `rate`, `amount`, `roe`, `inramt`,`meal`)
                                    VALUES('$mvouch', '$fcnt', '$fcheckin', '$fcheckout', '$fhotel', '$fnopax', '$fnonights', '$frate', '$famount', '$roe', '$finramt','$fmeal')") or die(mysqli_error($conn));
            }
        }

        mysqli_query($conn, "Delete from `$launddb` where `vouchno`='$mvouch'") or die(mysqli_error($conn));
        $lcnt = 0;
        $laundcnt = $_POST["laundcnt"];
        for ($l = 0; $l <= $laundcnt; $l++) {
            $srno = $_POST["lsrno_$l"];
            $lcheckin = $_POST["lcheckin_$l"];
            $lcheckout = $_POST["lcheckout_$l"];
            $lnopax = $_POST["lnopax_$l"];
            $lnonights = $_POST["lnonights_$l"];
            $lrate = $_POST["lrate_$l"];
            $lamount = $_POST["lamount_$l"];
            $lhotel = $_POST["lhotel_$l"];

            if ($lamount > 0) {
                $linramt = round($roe * $lamount, 0);
            }

            if ($lhotel != "") {
                $lcnt++;
                mysqli_query($conn, "INSERT INTO `$launddb`(`vouchno`, `srno`, `checkin`, `checkout`, `hotel`, `nopax`, `nonights`, `rate`, `amount`, `roe`, `inramt`)
                                    VALUES('$mvouch', '$lcnt', '$lcheckin', '$lcheckout', '$lhotel', '$lnopax', '$lnonights', '$lrate', '$lamount', '$roe', '$linramt')") or die(mysqli_error($conn));
            }
        }

        //        Visa part start
        mysqli_query($conn, "Delete from `$visadb` where `vouchno`='$mvouch'") or die(mysqli_error($conn));
        $vcnt = 0;
        $visacnt = $_POST["visacnt"];
        for ($v = 0; $v <= $visacnt; $v++) {
            $srno = $_POST["vsrno_$v"];
            $vnopax = $_POST["vnopax_$v"];
            $vrate = $_POST["vrate_$v"];
            $vamount = $_POST["vamount_$v"];
            $vcountry = $_POST["vcountry_$v"];
            $vvalidity = $_POST["vvalidity_$v"];
            $vtype = $_POST["vtype_$v"];
            $vgroupcode = $_POST["vgroupcode_$v"];
            $vtraveldt = $_POST["vtraveldt_$v"];

            if ($vamount > 0) {
                $vinramt = round($roe * $vamount, 0);
            }

            if ($vcountry != "") {
                $vcnt++;
                mysqli_query($conn, "INSERT INTO `$visadb`(`vouchno`, `srno`, `country`, `nopax`, `rate`, `amount`, `roe`, `inramt`, `type`, `validity`, `groupcode`, `vtraveldt`)
                                    VALUES('$mvouch', '$vcnt', '$vcountry', '$vnopax', '$vrate', '$vamount', '$roe', '$vinramt', '$vtype', '$vvalidity', '$vgroupcode', '$vtraveldt')") or die(mysqli_error($conn));
            }
        }


        //        Transport Flight part start
        mysqli_query($conn, "Delete from `$transfltdet` where `vouchno`='$mvouch'") or die(mysqli_error($conn));
        $tfctr = 0;
        $tfcnt = $_POST["tfcnt"];

        for ($tf = 0; $tf <= $tfcnt; $tf++) {
            //            $srno = $_POST["vsrno_$v"];
            $rfcnfno = $_POST["rfcnfno_$tf"];
            $rftype = $_POST["rftype_$tf"];
            $rflttime = $_POST["rflttime_$tf"];
            $rfsector = $_POST["rfsector_$tf"];
            $rfltno = $_POST["rfltno_$tf"];

            if ($rftype != "") {
                $tfctr++;
                mysqli_query($conn, "INSERT INTO `$transfltdet`(`vouchno`, `srno`, `fltno`, `flttype`, `flttime`, `cnfno`, `sector`)
                                    VALUES('$mvouch', '$tfctr', '$rfltno', '$rftype', '$rflttime', '$rfcnfno', '$rfsector')") or die(mysqli_error($conn));
            }
        }

        //        Ticket part start
        mysqli_query($conn, "Delete from `$tiktdb` where `vouchno`='$mvouch'") or die(mysqli_error($conn));
        $tcnt = 0;
        $tiktcnt = $_POST["tiktcnt"];
        for ($t = 0; $t <= $tiktcnt; $t++) {
            $srno = $_POST["tsrno_$t"];
            $tfrom = $_POST["tfrom_$t"];
            $tto = $_POST["tto_$t"];
            $tairline = $_POST["tairline_$t"];
            $tticketno = $_POST["tticketno_$t"];
            $tflightno = $_POST["tflightno_$t"];
            $tpnr = $_POST["tpnr_$t"];
            $ttravdate = $_POST["ttravdate_$t"];
            $tnopax = $_POST["tnopax_$t"];
            $tnopaxchild = $_POST["tnopaxchild_$t"];
            $tnopaxinf = $_POST["tnopaxinf_$t"];
            $tadult = $_POST["tadult_$t"];
            $tchild = $_POST["tchild_$t"];
            $tinfant = $_POST["tinfant_$t"];
            $tamount = $_POST["tamount_$t"];

            if ($tamount > 0) {
                $tinramt = round($roe * $tamount, 0);
            }

            if ($tfrom != "") {
                $tcnt++;
                mysqli_query($conn, "INSERT INTO `$tiktdb`(`vouchno`, `srno`,  `fromdes`, `todes`, `airline`, `nopax`, noinf, nochild,
                                                           `flightno`, `amount`, `roe`, `inramt`, `ticketno`, `pnrno`, `travdate`, `adult`, `child`, `infant`)
                                    VALUES('$mvouch', '$tcnt',  '$tfrom', '$tto', '$tairline', '$tnopax', '$tnopaxinf', '$tnopaxchild',
                                       '$tflightno', '$tamount', '$roe', '$tinramt', '$tticketno', '$tpnr', '$ttravdate', '$tadult', '$tchild', '$tinfant')") or die(mysqli_error($conn));
            }
        }




        mysqli_query($conn, "Delete from `paxdtfit` where `vouchno`='$mvouch'") or die(mysqli_error($conn));
        $pxctr = 0;
        $paxctr = $_POST["paxctr"];
        for ($px = 0; $px < $paxctr; $px++) {
            $tsuffix = $_POST["tsuffix_$px"];
            $tsurname = $_POST["tsurname_$px"];
            $tname = $_POST["tname_$px"];
            $tmidname = $_POST["tmidname_$px"];
            $tgender = $_POST["tgender_$px"];
            $tpaxpassport = $_POST["tpaxpassport_$px"];
            $taadhaarno = $_POST["taadhaarno_$px"];
            $tpanno = $_POST["tpanno_$px"];

            $pxctr++;
            if ($tname != "") {
                mysqli_query($conn, "INSERT INTO `paxdtfit`(`vouchno`, `srno`,  `tsuffix`, `tsurname`, `tname`, `tmidname`, `tgender`, `tpaxpassport`, `taadhaarno`, `tpanno`)
                                                  VALUES('$mvouch', '$pxctr', '$tsuffix', '$tsurname', '$tname', '$tmidname', '$tgender', '$tpaxpassport', '$taadhaarno', '$tpanno')") or die(mysqli_error($conn));
            }
        }



        //        Transport part start
        mysqli_query($conn, "Delete from `$transdb` where `vouchno`='$mvouch'") or die(mysqli_error($conn));
        $rcnt = 0;
        $transcnt = $_POST["transcnt"];
        for ($r = 0; $r <= $transcnt; $r++) {
            $srno = $_POST["rsrno_$r"];
            $rfrom = $_POST["rfrom_$r"];
            $rto = $_POST["rto_$r"];
            $rvehicle = $_POST["rvehicle_$r"];
            $rpickuptime = $_POST["rpickuptime_$r"];
            $rnoveh = $_POST["rnoveh_$r"];
            $rdescrip = $_POST["rdescrip_$r"];
            $rcnfno = $_POST["rcnfno_$r"];
            $rnopax = $_POST["rnopax_$r"];
            $rrate = $_POST["rrate_$r"];
            $ramount = $_POST["ramount_$r"];
            $picktype = $_POST["picktype_$r"];

            if ($ramount > 0) {
                $rinramt = round($roe * $ramount, 0);
            }

            if ($rfrom != "") {
                $rcnt++;
                mysqli_query($conn, "INSERT INTO `$transdb`(`vouchno`, `srno`,   `fromplace`, `toplace`, `pickuptime`, picktype,
                                            `nopax`, `vehicle`, `rate`, `amount`, `roe`, `inramt`, descrip, noveh, cnfno)
                                    VALUES('$mvouch', '$rcnt',  '$rfrom', '$rto', '$rpickuptime', '$picktype', '$rnopax', 
                                       '$rvehicle', '$rrate', '$ramount', '$roe', '$rinramt', '$rdescrip','$rnoveh','$rcnfno')") or die(mysqli_error($conn));
            }
        }

        ///// Purchase part start ////

        mysqli_query($conn, "DELETE FROM `$tranpurchdb` WHERE `vouchno`='$mvouch'") or die(mysqli_error($conn));
        mysqli_query($conn, "DELETE FROM `roomsacn` WHERE `vouchno`='$mvouch' and source = '$source' ") or die(mysqli_error($conn));

        $srl = 0;
        $batch = date("Y-m-d") . $mvouch;
        $cnt = 0;

        $purchcnt = $_POST["purchcnt"];

        for ($i = 0; $i <= $purchcnt; $i++) {

            $srno = $_POST["srno_$i"];
            $trcity = $_POST["city_$i"];
            $hotelnm = $_POST["hotelnm_$i"];
            $checkin = $_POST["checkin_$i"];
            $checkout = $_POST["checkout_$i"];
            $nonights = $_POST["nonights_$i"];
            $hotelpax = $_POST["hotelpax_$i"];
            $roomcatg = $_POST["roomcatg_$i"];
            $roomview = $_POST["roomview_$i"];
            $roomtype = $_POST["roomtype_$i"];
            $qty = $_POST["qty_$i"];
            $rate = $_POST["rate_$i"];
            $amount = $_POST["amount_$i"];
            $trmealtype = $_POST["mealtype_$i"];
            $cnfno = $_POST["cnfno_$i"];
            $prncomp = $_POST["prncomp_$i"];
            $remarks = mysqli_real_escape_string($conn, $_POST["remarks_$i"]);

            $nigctr = $nonights;
            $bckdate = date('Y-m-d', strtotime($checkout . ' - 1 days'));

            if (!empty($checkin)) {
                $srl++;
                mysqli_query($conn, "INSERT INTO `$tranpurchdb`(`vouchno`, `vouchdt`, `srno`, `checkin`, `checkout`, `nonights`, `roomcatg`, `roomtype`,  roomview, 
                                                            `qty`, `rate`, `amount`, `remarks`, `city`, `hotelnm`, `mealtype`, `cnfno`, prncomp, hotelpax) 
                                                    VALUES('$mvouch', '$vouchdt', '$srl', '$checkin', '$checkout', '$nonights', '$roomcatg', '$roomtype', '$roomview',
                                                           '$qty', '$rate', '$amount', '$remarks', '$trcity', '$hotelnm', '$trmealtype', '$cnfno','$prncomp', '$hotelpax' )") or die(mysqli_error($conn));
                $bookdate = $checkin;
                if ($hotelaprov == 1) {
                    $chk = '1';
                    $chko = '';
                    for ($r = 0; $r < $nigctr; $r++) {
                        $mhotcatg = mysqli_query($conn, "SELECT category FROM hotels where code='$hotelnm' ") or die(mysqli_error($conn));
                        $thotcatg = mysqli_fetch_array($mhotcatg);
                        $hotelcatg = $thotcatg['category'];

                        $mqty = $qty * -1;
                        if ($bookdate == $bckdate) {
                            $chko = '1';
                        }
                        mysqli_query($conn, "INSERT INTO `roomsacn`(`source`, `vouchno`, `bookdate`, `hotel`, `city`, roomview,
                                                                      `roomcatg`, `roomtype`, `qty`, `rate`, `hotelcatg`, `mealtype`,checkin, checkout)
                                                      VALUES('$source', '$mvouch', '$bookdate', '$hotelnm', '$trcity', '$roomview',
                                                                      '$roomcatg', '$roomtype', '$mqty', '$rate', '$hotelcatg', '$trmealtype','$chk','$chko' )") or die(mysqli_error($conn));
                        $chk = '';
                        $bookdate = date('Y-m-d', strtotime($bookdate . ' + 1 days'));

                        if ($bookdate > $checkout) {
                            break;
                        }
                    }
                }
            }
        }

        if ($invno > 0) {

            //purchase bill amount
            $purcode = 12;
            mysqli_query($conn, "DELETE FROM `$accdb` WHERE `vouchno` = '$mvouch' AND `source` = 'PUVS'") or die(mysqli_error($conn));
            mysqli_query($conn, "DELETE FROM `$accdb` WHERE `vouchno` = '$mvouch' AND `source` = 'PUTK'") or die(mysqli_error($conn));
            mysqli_query($conn, "DELETE FROM `$accdb` WHERE `vouchno` = '$mvouch' AND `source` = 'PUHO'") or die(mysqli_error($conn));
            mysqli_query($conn, "DELETE FROM `$accdb` WHERE `vouchno` = '$mvouch' AND `source` = 'PULN'") or die(mysqli_error($conn));
            mysqli_query($conn, "DELETE FROM `$accdb` WHERE `vouchno` = '$mvouch' AND `source` = 'PUTR'") or die(mysqli_error($conn));

            if ($visaaprov == 1) {
                if ($visapuramt > 0) {

                    $samtmin = $visapuramt * -1;

                    // purchase part
                    mysqli_query($conn, "INSERT INTO `$accdb`(date, vouchno, source, trnno, accode, grpcode, amount, ord)
                    VALUES ('$date','$mvouch', 'PUVS', '001', '$purcode','004', '$samtmin', '11')") or die(mysqli_error($conn));
                    // party part
                    mysqli_query($conn, "INSERT INTO `$accdb`(date, vouchno, source, trnno, accode, grpcode, amount, ord)
                     VALUES ('$date','$mvouch', 'PUVS', '002', '$visasupp','009', '$visapuramt', '11')") or die(mysqli_error($conn));
                }
                $avisaamt = $visaamt;
            } else {
                $avisaamt = 0;
            }

            if ($tiktaprov == 1) {
                if ($tiktpuramt > 0) {

                    $samtmin = $tiktpuramt * -1;

                    // purchase part
                    mysqli_query($conn, "INSERT INTO `$accdb`(date, vouchno, source, trnno, accode, grpcode, amount, ord)
                    VALUES ('$date','$mvouch', 'PUTK', '001', '$purcode','004', '$samtmin', '12')") or die(mysqli_error($conn));
                    // party part
                    mysqli_query($conn, "INSERT INTO `$accdb`(date, vouchno, source, trnno, accode, grpcode, amount, ord)
                     VALUES ('$date','$mvouch', 'PUTK', '002', '$tiktsupp','009', '$tiktpuramt', '12')") or die(mysqli_error($conn));
                }
                $atiktamt = $tiktamt;
            } else {
                $atiktamt = 0;
            }


            if ($hotelaprov == 1) {
                if ($hotelpuramt > 0) {
                    $samtmin = $hotelpuramt * -1;

                    // purchase part
                    mysqli_query($conn, "INSERT INTO `$accdb`(date, vouchno, source, trnno, accode, grpcode, amount, ord)
                    VALUES ('$date','$mvouch', 'PUHO', '001', '$purcode','004', '$samtmin', '13')") or die(mysqli_error($conn));
                    // party part
                    mysqli_query($conn, "INSERT INTO `$accdb`(date, vouchno, source, trnno, accode, grpcode, amount, ord)
                     VALUES ('$date','$mvouch', 'PUHO', '002', '$hotelsupp','009', '$hotelpuramt', '13')") or die(mysqli_error($conn));
                }
                $ahotelinramt = $hotelinramt;
            } else {
                $ahotelinramt = 0;
            }


            if ($transaprov == 1) {
                if ($transpuramt > 0) {

                    $samtmin = $transpuramt * -1;

                    // purchase part
                    mysqli_query($conn, "INSERT INTO `$accdb`(date, vouchno, source, trnno, accode, grpcode, amount, ord)
                    VALUES ('$date','$mvouch', 'PUTR', '001', '$purcode','004', '$samtmin', '14')") or die(mysqli_error($conn));
                    // party part
                    mysqli_query($conn, "INSERT INTO `$accdb`(date, vouchno, source, trnno, accode, grpcode, amount, ord)
                     VALUES ('$date','$mvouch', 'PUTR', '002', '$transsupp','009', '$transpuramt', '14')") or die(mysqli_error($conn));
                }
                $atransinramt = $transinramt;
            } else {
                $atransinramt = 0;
            }


            if ($laundaprov == 1) {
                if ($laundpuramt > 0) {

                    $samtmin = $laundpuramt * -1;

                    // purchase part
                    mysqli_query($conn, "INSERT INTO `$accdb`(date, vouchno, source, trnno, accode, grpcode, amount, ord)
                    VALUES ('$date','$mvouch', 'PULN', '001', '$purcode','004', '$samtmin', '15')") or die(mysqli_error($conn));
                    // party part
                    mysqli_query($conn, "INSERT INTO `$accdb`(date, vouchno, source, trnno, accode, grpcode, amount, ord)
                     VALUES ('$date','$mvouch', 'PULN', '002', '$laundsupp','009', '$laundpuramt', '15')") or die(mysqli_error($conn));
                }
                $alaundinramt = $laundinramt;
            } else {
                $alaundinramt = 0;
            }

            if ($foodaprov == 1) {
                // $foodinramt = $foodinramt;
                if ($foodpuramt > 0) {

                    $samtmin = $foodpuramt * -1;

                    // purchase part
                    mysqli_query($conn, "INSERT INTO `$accdb`(date, vouchno, source, trnno, accode, grpcode, amount, ord)
                    VALUES ('$date','$mvouch', 'PUFD', '001', '$purcode','004', '$samtmin', '18')") or die(mysqli_error($conn));
                    // party part
                    mysqli_query($conn, "INSERT INTO `$accdb`(date, vouchno, source, trnno, accode, grpcode, amount, ord)
                     VALUES ('$date','$mvouch', 'PUFD', '002', '$foodsupp','009', '$foodpuramt', '18')") or die(mysqli_error($conn));
                }
                $afoodinramt = $foodinramt;
            } else {
                $afoodinramt = 0;
            }

            //            sale bill amount
            $netamt = $afoodinramt + $alaundinramt + $avisaamt + $atransinramt + $atiktamt + $ahotelinramt - $discountinr;

            if ($agent > 0) {
                $agecode = $agent;
            } else {
                $agecode = $maccode;
            }

            mysqli_query($conn, "DELETE FROM `$accdb` WHERE `vouchno` = '$mvouch' AND `source`='SL'") or die(mysqli_error($conn));
            if ($netamt > 0) {
                $salecode = 15;
                $minus_amt = $netamt * -1;

                // sale part
                mysqli_query($conn, "INSERT INTO `$accdb`(date, vouchno, source, trnno, accode, grpcode, amount, ord)
                    VALUES ('$invdate','$mvouch', 'SL', '001', '$salecode','005', '$netamt', '4')") or die(mysqli_error($conn));
                // party part
                mysqli_query($conn, "INSERT INTO `$accdb`(date, vouchno, source, trnno, accode, grpcode, amount, ord)
                     VALUES ('$invdate','$mvouch', 'SL', '002', '$agecode', '010', '$minus_amt', '4')") or die(mysqli_error($conn));
            }
        }


        if ($addflag == 1) {

            $uuid = $_SESSION["uuid"];

            mysqli_query($conn, "INSERT INTO `$maindb`(`vouchno`, `paxid`, `hajino`, `invno`, `invdate`, `regno`, `date`, `visitingfor`, `batchno`, `class`, optdate, `deptdate`,`arrdate`, `barcode`,roe,
                                        `familyhead`, `roomtype`, `suffix`, `fullname`,  `name`, `surname`, `midname`, `relation`, `gender`, `dob`, partycode,
                                        `pob`, `caste`, `nationality`, `address`, `city`, `pin`, `taluka`, `district`, `gstno`,
                                        `state`, `countcode`, `mobile`, `bloodgroup`, `saudimobno`, `telno`, `email`, `disease`, 
                                        `occupation`, `whatsno`, `paximage`, `mehram_no`, `mehram_relation_code`, `passportno`, `issueplace`,
                                        `issuedate`, `expirydate`, `plusdate`, `passport_ready`, `pass_img`,`mofa`, `visano`, `visaisspl`, `married`,`company`,`remark`,`agent`,
                                        `recparty`, `sentvisa`, `recdvisa`, `panno`, `aadhaarno`,`adduser`, pilgdays, `marital`, `accomppax`,
                                        `mobver`, emailver, mobotp,emailotp, `foodpax`, `foodnights`, `foodamt`, `laundpax`, `laundnights`, `laundamt`,`visapax`, `visaamt`,
                                        `tiktpax`, `tiktamt`, transpax, transveh, transamt, hotelamt, `foodaprov`, `transaprov`, `tiktaprov`, `laundaprov`, `visaaprov`, `hotelaprov`,
                                        `visapuramt`, visasupp, visarate, visainvno, visainvdt, tiktpuramt, tiktsupp, tiktinvno, `tiktinvdt`,
                                        `transsupp`, transrate, transinvno, transinvdt, transpuramt, hotelsupp, hotelrate, hotelinvno, hotelinvdt, hotelpuramt,
                                        laundsupp, laundrate, laundinvno, laundinvdt, laundpuramt, foodsupp, foodrate, foodinvno, foodinvdt, foodpuramt, `transtype`, `fltdate`, `flttime`, `fltsector`, `fltno`,
                                        hotelinramt, foodinramt, laundinramt, transinramt, netamt, tiktsubtot, tikthandchg, tiktgstperc, tiktgstamt, pstate, pstatecode, `paxpassport`, 
                                        inrtotalamt, discountinr, netinramt, uuid)
                                 VALUES('$qvouch', '$qvouch', '$hajino',  '$invno', '$invdate', '$regno', '$date', '$visitingfor',  '$batchno', '$class', '$optdate', '$deptdate','$arrdate', '$barcode','$roe',
                                       '$familyhead', '$roomtype', '$suffix', '$accountname', '$name', '$surname', '$midname','$relation', '$gender', '$dob', '$maccode',
                                       '$pob', '$caste','$nationality', '$address', '$city', '$pin', '$taluka','$district', '$gstno',
                                       '$state', '$countcode', '$mobile', '$bloodgroup', '$saudimobno','$telno', '$email', '$disease', 
                                       '$occupation','$whatsno', '$img_file', '$mehram_no', '$mehram_relation_code', '$passportno', '$issueplace', 
                                       '$issuedate', '$expirydate', '$plusdate', '$passport_ready','$img_file2','$mofa', '$visano', '$visaisspl', '$chkmarried','$siscono','$remark','$agent',
                                       '$recparty', '$sentvisa', '$recdvisa', '$panno', '$aadhaarno','$username', '$pilgdays', '$marital', '$accomppax',
                                       '$mobver', '$emailver', '$mobotp','$emailotp', '$foodpax', '$foodnights', '$foodamt', '$laundpax', '$laundnights', '$laundamt','$visapax', '$visaamt',
                                       '$tiktpax', '$tiktamt', '$transpax', '$transveh', '$transamt', '$hotelamt', '$foodaprov', '$transaprov', '$tiktaprov', '$laundaprov', '$visaaprov', '$hotelaprov',
                                       '$visapuramt', '$visasupp', '$visarate', '$visainvno', '$visainvdt', '$tiktpuramt', '$tiktsupp', '$tiktinvno', '$tiktinvdt',
                                       '$transsupp', '$transrate', '$transinvno', '$transinvdt', '$transpuramt', '$hotelsupp', '$hotelrate', '$hotelinvno', 
                                       '$hotelinvdt', '$hotelpuramt', '$laundsupp', '$laundrate', '$laundinvno', '$laundinvdt', '$laundpuramt', '$foodsupp', '$foodrate', '$foodinvno', '$foodinvdt', '$foodpuramt',
                                       '$transtype', '$fltdate', '$flttime', '$fltsector', '$fltno', '$hotelinramt', '$foodinramt', '$laundinramt', '$transinramt', '$netamt',
                                       '$tiktsubtot', '$tikthandchg', '$tiktgstperc', '$tiktgstamt', '$pstate', '$pstatecode', '$paxpassport', 
                                       '$inrtotalamt', '$discountinr', '$netinramt', '$uuid')") or die(mysqli_error($conn));

            $mvouch = $_GET["vouchno"];
        } else {

            mysqli_query($conn, "UPDATE `$maindb` SET `hajino`='$hajino', `regno`='$regno', `edituser`='$username',  `batchno`='$batchno', `class`='$class', `deptdate`='$deptdate',`arrdate`='$arrdate',
                                              `date`='$date', `suffix`='$suffix', `fullname`='$accountname',  `visitingfor`='$visitingfor', `familyhead`='$familyhead', `barcode`='$barcode',roe='$roe',
                                              `surname`='$surname', `name`='$name',  `midname`='$midname', `relation`='$relation', `roomtype`='$roomtype',partycode='$maccode',
                                              `gender`='$gender', `dob`='$dob', `pob`='$pob', `caste`='$caste', `nationality`='$nationality', optdate='$optdate',
                                              `address`='$address', `city`='$city', `pin`='$pin', `taluka`='$taluka', `district`='$district', `gstno`='$gstno',
                                              `state`='$state', `countcode`='$countcode', `mobile`='$mobile', `bloodgroup`='$bloodgroup', `saudimobno`='$saudimobno',
                                              `telno`='$telno', `disease`='$disease', `occupation`='$occupation', `whatsno`='$whatsno',`paximage`='$imgppp1',
                                              `mehram_relation_code`='$mehram_relation_code', `mehram_no`='$mehram_no',`passportno`='$passportno',
                                              `issueplace`='$issueplace',`issuedate`='$issuedate',`expirydate`='$expirydate',`plusdate`='$plusdate',`passport_ready`='$passport_ready',
                                              `pass_img`='$img_file2',`mofa`='$mofa', `visano`='$visano' , `visaisspl`='$visaisspl', `married`='$chkmarried',
                                              `company`='$siscono',`remark`='$remark',`agent`='$agent', `recparty`='$recparty', `sentvisa`='$sentvisa', `accomppax`='$accomppax',
                                              `recdvisa`='$recdvisa', `panno`='$panno',`aadhaarno`='$aadhaarno', pilgdays='$pilgdays', `marital`='$marital',
                                              `mobver`='$mobver', `emailver`='$emailver', `mobotp`='$mobotp',`emailotp`='$emailotp',`foodpax`='$foodpax', `foodnights`='$foodnights', `foodamt`='$foodamt',
                                              `laundpax`='$laundpax',  `laundnights`='$laundnights', `laundamt`='$laundamt',`visapax`='$visapax', `visaamt`='$visaamt',
                                              `tiktpax`='$tiktpax', `tiktamt`='$tiktamt', transpax='$transpax', transveh='$transveh', transamt='$transamt', hotelamt='$hotelamt',
                                              `foodaprov`='$foodaprov', `transaprov`='$transaprov', `tiktaprov`='$tiktaprov', `laundaprov`='$laundaprov', `visaaprov`='$visaaprov', `hotelaprov`='$hotelaprov',
                                               visapuramt='$visapuramt', visasupp='$visasupp', visarate='$visarate', `visainvno`='$visainvno', `visainvdt`='$visainvdt',
                                               tiktpuramt='$tiktpuramt', tiktsupp='$tiktsupp', tiktinvno='$tiktinvno', `tiktinvdt`='$tiktinvdt',
                                               `transsupp` ='$transsupp', `transrate` ='$transrate', `transinvno` ='$transinvno', `transinvdt` ='$transinvdt',
                                               `transpuramt` ='$transpuramt',  hotelsupp='$hotelsupp', hotelrate ='$hotelrate', hotelinvno ='$hotelinvno',
                                               hotelinvdt ='$hotelinvdt', hotelpuramt ='$hotelpuramt', laundsupp ='$laundsupp', laundrate ='$laundrate', laundinvno ='$laundinvno',
                                               laundinvdt ='$laundinvdt', laundpuramt ='$laundpuramt',invdate ='$invdate', 
                                               foodsupp ='$foodsupp', foodrate ='$foodrate', foodinvno ='$foodinvno', foodinvdt ='$foodinvdt', foodpuramt ='$foodpuramt',
                                               `transtype`='$transtype', `fltdate`='$fltdate', `flttime`='$flttime', `fltsector`='$fltsector', `fltno`='$fltno', 
                                               hotelinramt='$hotelinramt', foodinramt='$foodinramt', laundinramt='$laundinramt', transinramt='$transinramt', netamt='$netamt',
                                               `tiktsubtot`='$tiktsubtot', `tikthandchg`='$tikthandchg', `tiktgstperc`='$tiktgstperc', `tiktgstamt`='$tiktgstamt',
                                               `pstate`='$pstate', `pstatecode`='$pstatecode', `paxpassport`='$paxpassport', 
                                               inrtotalamt='$inrtotalamt',`discountinr`='$discountinr', netinramt='$netinramt'  where vouchno = '$mvouch' ") or die(mysqli_error($conn));
        }

        if ($addflag == 1) {
            insmess();
            $mvouch = $qvouch;
            header("refresh: 1; $file?$keyfld=$mvouch&mode=edit");
        } else {
            updmess();
            header("refresh: 1; $file?$keyfld=$mvouch&mode=edit");
        }
    }
}


if ($addflag != 1) {

    $getvouch = '';
    if ($addflag == 0) {
        $getvouch = $_GET[$keyfld];
    } else {
        $getvouch = $qvouch;
    }
    $result = mysqli_query($conn, "SELECT *, date_format(`date`,'%d-%m-%Y') as mydt FROM `$maindb` WHERE $keyfld='$getvouch'") or die(mysqli_error($conn));
    $get = mysqli_fetch_array($result);
    if ($get['plusdate'] != '0000-00-00') {
        $plsdate = $get['plusdate'];
    } else {
        $ftcurdate = $get["date"];
        $acdate = strtotime(date("Y-m-d", strtotime($ftcurdate)) . " +8 month");
        $plsdate = date("Y-m-d", $acdate);
    }

    $passportimg = $get['pass_img'];
    if ($passportimg != '') {
        $imgpath2 = $get['pass_img'];
    } else {
        $imgpath2 = "";
    }


    $getagent = mysqli_query($conn, "SELECT accode,name FROM `accmast` WHERE accode='$get[agent]'") or die(mysqli_error($conn));
    $fetagent = mysqli_fetch_array($getagent);

    $getvsupp = mysqli_query($conn, "SELECT accode,name FROM `accmast` WHERE accode='$get[visasupp]'") or die(mysqli_error($conn));
    $fetvsupp = mysqli_fetch_array($getvsupp);

    $gettksupp = mysqli_query($conn, "SELECT accode,name FROM `accmast` WHERE accode='$get[tiktsupp]'") or die(mysqli_error($conn));
    $fettksupp = mysqli_fetch_array($gettksupp);

    $gettrsupp = mysqli_query($conn, "SELECT accode,name FROM `accmast` WHERE accode='$get[transsupp]'") or die(mysqli_error($conn));
    $fettrsupp = mysqli_fetch_array($gettrsupp);

    $gethsupp = mysqli_query($conn, "SELECT accode,name FROM `accmast` WHERE accode='$get[hotelsupp]'") or die(mysqli_error($conn));
    $fethsupp = mysqli_fetch_array($gethsupp);

    $getldsupp = mysqli_query($conn, "SELECT accode,name FROM `accmast` WHERE accode='$get[laundsupp]'") or die(mysqli_error($conn));
    $fetldsupp = mysqli_fetch_array($getldsupp);

    $getfdsupp = mysqli_query($conn, "SELECT accode,name FROM `accmast` WHERE accode='$get[foodsupp]'") or die(mysqli_error($conn));
    $fetfdsupp = mysqli_fetch_array($getfdsupp);

    if ($pimg == '') {
        $imgpathview = $simg;
        $showimage = $imgpathview;
    } else {
        $imgpath = $pimg;
        $showimage = $imgpath;
    }
    $curdate = $get['vouchdt'];
}

$senable = "";
$cenable = "";

if (isset($_GET["delete"])) {


    delete($zdb, "$maindb", "$keyfld", $_GET[$keyfld], "$file?mode=last");
    delete($zdb, "$fooddb", "vouchno", $_GET[$keyfld], "$file?mode=last");
    delete($zdb, "$launddb", "vouchno", $_GET[$keyfld], "$file?mode=last");
    delete($zdb, "$visadb", "vouchno", $_GET[$keyfld], "$file?mode=last");
    delete($zdb, "$tiktdb", "vouchno", $_GET[$keyfld], "$file?mode=last");
    delete($zdb, "$transdb", "vouchno", $_GET[$keyfld], "$file?mode=last");
    delete($zdb, "$transfltdet", "vouchno", $_GET[$keyfld], "$file?mode=last");
    delete($zdb, "$tranpurchdb", "vouchno", $_GET[$keyfld], "$file?mode=last");

    $delcond = " source = '$source' and vouchno = '$_GET[$keyfld]' ";
    delnew($zdb, "$accdb", "$delcond", "$file?mode=last");
    delnew($zdb, "roomsacn", "$delcond", "$file?mode=last");
}

include("includes/linkshead.php");
?>

<!-- <script src="https://kit.fontawesome.com/3ada711723.js" crossorigin="anonymous"></script> -->
<script src="MyScript/fit_ent.js?a=<?= mt_rand() ?>" type="text/javascript"></script>
<script src="MyScript/fit_ent_search.js?v=<?= mt_rand() ?>" type="text/javascript"></script>
<script src="MyScript/existuser_search.js?b=<?= mt_rand() ?>" type="text/javascript"></script>
<style rel="stylesheet" src="styles/tab_pane.css"></style>
<style>
    /* CSS */
    .button-29 {
        align-items: center;
        appearance: none;
        background: rgb(47, 191, 254);
        background: linear-gradient(104deg, rgba(47, 191, 254, 1) 60%, rgba(255, 255, 255, 1) 100%);
        border: 0;
        border-radius: 6px;
        box-shadow: rgba(45, 35, 66, .4) 0 2px 4px, rgba(45, 35, 66, .3) 0 7px 13px -3px, rgba(58, 65, 111, .5) 0 -3px 0 inset;
        box-sizing: border-box;
        color: #fff;
        cursor: pointer;
        display: inline-flex;
        font-family: "JetBrains Mono", monospace;
        height: 48px;
        justify-content: center;
        line-height: 1;
        list-style: none;
        overflow: hidden;
        padding-left: 16px;
        padding-right: 16px;
        position: relative;
        text-align: left;
        text-decoration: none;
        transition: box-shadow .15s, transform .15s;
        user-select: none;
        -webkit-user-select: none;
        touch-action: manipulation;
        white-space: nowrap;
        will-change: box-shadow, transform;
        font-size: 18px;
    }

    .button-29:focus {
        box-shadow: #3c4fe0 0 0 0 1.5px inset, rgba(45, 35, 66, .4) 0 2px 4px, rgba(45, 35, 66, .3) 0 7px 13px -3px, #3c4fe0 0 -3px 0 inset;
    }

    .button-29:hover {
        box-shadow: rgba(45, 35, 66, .4) 0 4px 8px, rgba(45, 35, 66, .3) 0 7px 13px -3px, #3c4fe0 0 -3px 0 inset;
        transform: translateY(-2px);
    }

    .button-29:active {
        box-shadow: #3c4fe0 0 3px 7px inset;
        transform: translateY(2px);
    }

    .sksahil {
        border-radius: 10px;
        /* background: linear-gradient(91.9deg, rgb(82, 82, 155) 6.3%, rgb(179, 179, 242) 98.9%); */
        background: rgb(47, 191, 254);
        background: linear-gradient(104deg, rgba(47, 191, 254, 1) 60%, rgba(255, 255, 255, 1) 100%);
        margin-left: 1%;
    }

    .sksahil2 {
        border-radius: 10px;
        background-color: #fff;
        /* background-color:  rgb(192,192,192,0.1); */
        margin-top: 5px;
        margin-bottom: 5px;
    }

    .sksahil2new {
        border-radius: 10px;
        /* background-color: #fff; */
        /* background-color:  rgb(192,192,192,0.1); */
        margin-top: 5px;
        margin-bottom: 5px;
    }

    .skbtn {
        background-image: linear-gradient(135deg, #FFFEFF 10%, #D7FFFE 100%) !important;
        border: 1px solid #09C6F9 !important;
        /* background-color: white; */
        border: 2px solid #2FBFFE;
        color: #2A2A72;
        font-weight: bold;
        border-radius: 10px;
    }

    .skk {
        border-bottom: 1px solid grey !important;
        color: white;
    }

    .slk {
        background: black !important;
    }

    .txtt {
        color: whitesmoke;
        text-transform: uppercase;
        font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif
    }

    .adjcol {
        width: 4.33333333%;
    }

    .adjcolh {
        width: 5.33333333%;
    }

    .adjcol2 {
        width: 6.33333333%;
    }

    .adjcolh2 {
        width: 10.33333333%;
    }

    .adjcolh3 {
        width: 12.333333%;
    }

    .adjcolh1_5 {
        width: 8.7%;
    }

    .adjcola {
        width: 20%;
    }

    .adjcol3 {
        width: 25.9999999%;
    }

    /* .panel.with-nav-tabs .panel-heading {
        padding: 5px 5px 0 5px;
    } */

    .panel.with-nav-tabs .nav-tabs {
        border-bottom: none;
    }

    .panel.with-nav-tabs .nav-justified {
        margin-bottom: -1px;
    }

    .nav-tabs>li {
        margin-bottom: -1px;
        width: 150px;
    }

    .with-nav-tabs.panel-primary .nav-tabs>li>a,
    .with-nav-tabs.panel-primary .nav-tabs>li>a:hover,
    .with-nav-tabs.panel-primary .nav-tabs>li>a:focus {
        color: #fff;
    }

    .with-nav-tabs.panel-primary .nav-tabs>.open>a,
    .with-nav-tabs.panel-primary .nav-tabs>.open>a:hover,
    .with-nav-tabs.panel-primary .nav-tabs>.open>a:focus,
    .with-nav-tabs.panel-primary .nav-tabs>li>a:hover,
    .with-nav-tabs.panel-primary .nav-tabs>li>a:focus {
        color: #fff;
        background-color: #3071a9;
        border-color: transparent;
    }

    .with-nav-tabs.panel-primary .nav-tabs>li.active>a,
    .with-nav-tabs.panel-primary .nav-tabs>li.active>a:hover,
    .with-nav-tabs.panel-primary .nav-tabs>li.active>a:focus {
        color: #428bca;
        background-color: #fff !important;
        border-color: #428bca !important;
        border-bottom-color: transparent !important;
    }

    .with-nav-tabs.panel-primary .nav-tabs>li.dropdown .dropdown-menu {
        background-color: #428bca;
        border-color: #3071a9;
    }

    .with-nav-tabs.panel-primary .nav-tabs>li.dropdown .dropdown-menu>li>a {
        color: #fff;
    }

    .with-nav-tabs.panel-primary .nav-tabs>li.dropdown .dropdown-menu>li>a:hover,
    .with-nav-tabs.panel-primary .nav-tabs>li.dropdown .dropdown-menu>li>a:focus {
        background-color: #3071a9;
    }

    .with-nav-tabs.panel-primary .nav-tabs>li.dropdown .dropdown-menu>.active>a,
    .with-nav-tabs.panel-primary .nav-tabs>li.dropdown .dropdown-menu>.active>a:hover,
    .with-nav-tabs.panel-primary .nav-tabs>li.dropdown .dropdown-menu>.active>a:focus {
        background-color: #4a9fe9;

    }

    .purch {
        font-size: 12px;
    }

    .sknewbtn {
        background-image: linear-gradient(135deg, #09C6F9 10%, #045DE9 100%) !important;
        color: white !important;
    }

    .btn:hover {
        background-color: transparent;
    }

    .colramt {
        color: green;
        font-weight: bold;
    }

    .SKtable>tbody>tr>td {
        padding-right: 15px;
        padding-left: 15px;
    }

    input[type=text]:focus {
        background-color: transparent;
    }

    input[type=number]:focus {
        background-color: transparent;
    }

    input[type=date]:focus {
        background-color: transparent;
    }

    .skfontcolr {
        color: #2FBFFE;
        font-weight: bold;
        font-size: 17px;
    }


    .nav-tabs {
        border-bottom: none;
    }

    .nav-tabs>li>a {
        border-radius: 10px;
        box-shadow: 0 2px 4px 0 rgba(227, 242, 253, 1), 0 3px 7px 3px rgba(227, 242, 253, 2);
    }

    .nav-tabs>li>a:hover {
        border: 2px solid #2fbffe;
        border-radius: 10px;
    }
</style>
</head>

<body>
    <form action='' method='POST' enctype="multipart/form-data">
        <div class="col-lg-2 pad text-center" id="overlay_form" style="display:none;z-index:999;">
            <button type="button" id="close_form" style="float: right;font-weight: bold;font-size: 18px;color:red;"><i
                    class="fa fa-close"></i></button>
            <div class="normotp">
                <div class="ratemspless">
                    <!--<input type="button" name="genotp" class="form-control genotp" style="color:red;border: none" value="Click here to Generate OTP">-->
                    <div class="row">
                        <div class="col-lg-4 text-right"><label class="label-control">Enter OTP</label></div>
                        <div class="col-lg-4">
                            <input type="text" name="otprecv" id="otprecv" class="form-control otprecv"
                                   style="background-color: white;color: green;">
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-lg-4 text-right"></div>
                        <div class="col-lg-4 ">
                            <input type="button" name="subotp" id="subotp" class="form-control form subotp"
                                   style="color: blue;background-color: whitesmoke" value="Submit OTP">
                            <input type="button" name="subemail" id="subemail" class="form-control form subemail"
                                   style="color: blue;background-color: whitesmoke" value="Submit OTP">
                        </div>
                    </div>
                    <input type="hidden" name="otpsucs" id="otpsucs" class="form-control otpsucs">
                </div>
            </div>
        </div>
        <!-- Default box -->
        <div class="row">
            <div class="col-lg-12">

                <div class="panel panel-default">
                    <div class="panel-heading">
                        <?php
                        if ($get["edituser"] != '') {
                            $user = strtoupper($get["edituser"]);
                        } else {
                            $user = strtoupper($get["adduser"]);
                        }
                        ?>
                        <h5 class="panel-title" style="font-size:14px"><?php echo $formname; ?>
                            <p style="float:right;font-size:14px"> <?php echo $user; ?></p>
                        </h5>
                        <!--<h3 class="pull-right" style="padding:0px"></h3>-->
                    </div>
                    <div class="panel-body">
                        <div class="row">
                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad ">
                                <label class="label-control marg">Voucher No.</label>
                            </div>
                            <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 pad adjcol">
                                <input type="hidden" class="form-control form addflag"
                                       value="<?php echo ($addflag != 1) ? "2" : $addflag; ?>">
                                <input type="hidden" class="form-control form accode" name="accode"
                                       value="<?php echo ($addflag != 1) ? $get['partycode'] : ""; ?>">
                                <input type="hidden" name="invno" class="form-control form invno"
                                       value="<?php echo ($addflag != 1) ? $get['invno'] : ""; ?>">
                                <input type="text" class="form-control vouchno" name="vouchno"
                                       value="<?php echo ($addflag != 1) ? $get["vouchno"] : "NEW"; ?>" readonly required>
                            </div>

                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad adjcol">
                                <label class="label-control marg">Date</label>
                            </div>
                            <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 pad" style="width:8.55%;">
                                <input type="date" class="form-control form vouchdt" name="date1" min="<?= $curdate ?>"
                                       value="<?php echo ($addflag != 1) ? $get["date"] : date("Y-m-d"); ?>">
                            </div>
                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad " style="width: 3.333333%;">
                                <label class="label-control marg">For</label>
                            </div>
                            <div class="col-lg-1 col-md-6 col-sm-6 col-xs-6 pad" style="width:10.55%;">
                                <select name="visitingfor" class="visitingfor form-control focusfield select2 form"
                                        required>
                                    <option value="<?php echo ($addflag != 1) ? $get["visitingfor"] : "" ?>">
                                        <?php echo ($addflag != 1) ? $get["visitingfor"] : "" ?></option>
                                    <?php
                                    $gvisit = mysqli_query($conn, "SELECT `name` FROM $zroot.vistingfor ORDER BY NAME") or die(mysqli_error($conn));
                                    while ($mvisit = mysqli_fetch_array($gvisit)) {
                                        echo "<option value='$mvisit[name]'>$mvisit[name]</option>";
                                    }
                                    ?>
                                </select>
                            </div>



                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad" style="width: 6.333333%;">
                                <label class="label-control marg">Nationality</label>
                            </div>
                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 pad ">
                                <select name="nationality" id="nationality" class="nationality form-control form">
                                    <?php
                                    $mitem = mysqli_query($conn, "SELECT nationality, callingcode FROM $zroot.`nationalities_and_calling_codes` GROUP BY nationality ORDER BY nationality") or die(mysqli_error($conn));

                                    while ($trow = mysqli_fetch_assoc($mitem)) {
                                        $selected = (($addflag != 1 && $get["nationality"] == $trow['nationality']) ||
                                                ($addflag == 1 && $trow['nationality'] == 'Indian')) ? 'selected' : '';
                                        ?>
                                        <option value="<?= htmlspecialchars($trow['nationality']) ?>"
                                                data-code="<?= htmlspecialchars($trow['callingcode']) ?>"
                                                <?= $selected ?>>
                                                    <?= htmlspecialchars($trow['nationality']) ?>
                                        </option>
                                        <?php
                                    }
                                    ?>
                                </select>
                            </div>

                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad" style="width: 3.333333%;">
                                <label class="label-control marg" style="color:red">ROE</label>
                            </div>

                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad adjcol">
                                <input type="number" class="form-control form text-right roe" name="roe"
                                       value="<?php echo ($addflag != 1) ? $get["roe"] : ""; ?>" step='any'>
                            </div>


                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad" style="width: 4.333333%;">
                                <label class="label-control marg">Agent</label>
                            </div>
                            <div class="col-lg-2  col-md-3 col-sm-3 col-xs-3 text-right pad ">
                                <select name="agent" class="agent form-control  select2 form">
                                    <option value="<?php echo ($addflag != 1) ? $fetagent["accode"] : "" ?>"><?php echo ($addflag != 1) ? $fetagent["name"] : "" ?></option>
                                    <?php
                                    echo "<option value=''></option>";
                                    $gvisit = mysqli_query($conn, "SELECT `accode`,`name` FROM accmast WHERE grpcode = '044'  ORDER BY NAME") or die(mysqli_error($conn));
                                    while ($mvisit = mysqli_fetch_array($gvisit)) {
                                        echo "<option value='$mvisit[accode]'>$mvisit[name]</option>";
                                    }
                                    ?>
                                </select>
                            </div>

                            <?php if ($autoginv != "Y") { ?>
                                <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad" style="width: 4.633333%;">
                                    <label class="label-control marg" style="color:green">Valid Till</label>
                                </div>
                                <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 pad ">
                                    <input type="date" class="form-control form optdate" name="optdate"
                                           value="<?php echo ($addflag != 1) ? $get["optdate"] : ""; ?>" required
                                           style="color:green">
                                </div>
                            <?php } ?>
                        </div>
                    </div>

                    <div class="col-lg-12 skbackcolor">
                        <div class="with-nav-tabs ">
                            <div class="">
                                <ul class="nav nav-tabs sksahil2new">
                                    <?php $inrtotamt = $get['tiktamt'] + $get['hotelinramt'] + $get['foodinramt'] + $get['laundinramt'] + $get['transinramt'] + $get['visaamt'] - $get['discountinr']; ?>

                                    <?php
                                    // define tab structure
                                    $tabs = [
                                        "tab1default" => ["Personal Details", "&nbsp;"],
                                        "tab4default" => ["Ticket & Airline", "₹ " . round($get['tiktamt'], 0)],
                                        "tab9default" => ["Hotel", "₹ " . round($get['hotelinramt'], 0)],
                                        "tab2default" => ["Food", "₹ " . round($get['foodinramt'], 0)],
                                        "tab3default" => ["Laundry", "₹ " . round($get['laundinramt'], 0)],
                                        "tab6default" => ["Transportation", "₹ " . round($get['transinramt'], 0)],
                                        "tab5default" => ["Visa", "₹ " . round($get['visaamt'], 0)],
                                        "tab11default" => ["INR Discount", "₹ " . round($get['discountinr'], 0)],
                                    ];

                                    $i = 0;
                                    foreach ($tabs as $id => $tab) {
                                        $active = $i === 0 ? ' class="active"' : ''; // first tab active
                                        $margin = $i > 0 ? ' style="margin-left:10px;"' : ''; // margin for all except first
                                        echo '<li' . $margin . $active . '>';
                                        echo '<a href="#' . $id . '" data-toggle="tab">';
                                        echo "<b style='font-size:15px;'>$tab[0] <br> $tab[1] </b>";
                                        echo '</a></li>';
                                        $i++;
                                    }
                                    ?>

                                    <li style="width:180px;margin-left:10px;">
                                        <label class="label-control marg" style="font-weight:bold;color:#2FBFFE;font-size: 17px;">
                                            Total INR : <?= number_format($inrtotamt, 2); ?>
                                        </label>
                                        <label class="label-control marg invvis" style="color:green;font-weight:bold;font-size: 17px;">
                                            Invoice No. <?= $get['invno']; ?>
                                        </label>
                                        <input type="hidden" class="invno" value="<?= $get['invno']; ?>">
                                    </li>

                                </ul>
                            </div>

                            <div class="panel-body">
                                <div class="tab-content">
                                    <div class="tab-pane fade  in active" id="tab1default">
                                        <div class="row ">

                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad"
                                                 style="width:11.333333%">
                                                <label class="label-control marg">Mobile</label>
                                            </div>

                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 pad " style="width:4.333333%">
                                                <input type="text" class="form-control form countcode" 
                                                       name="countcode"
                                                       value="<?php echo ($addflag != 1) ? $get["countcode"] : "+91"; ?>"
                                                       style="color:red;font-size:18px" required>
                                            </div>
                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 pad ">
                                                <input type="number" class="form-control form mobile" 
                                                       name="mobile" 
                                                       value="<?php echo ($addflag != 1) ? $get["mobile"] : ""; ?>"
                                                       style="background-color:#FFE89E;color:red;font-size:18px" required>
                                            </div>
                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 pad adjcol">
                                                <label class="label-control marg"
                                                       style="color:red;font-size: 20px">*</label>
                                            </div>
                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-center pad adjcol">
                                                <label class="label-control marg verifiedmob" style="display:none"><i
                                                        class="fa fa-check-circle fa-2x" aria-hidden="true"
                                                        style="color:green;"></i></label>
                                                <input type="hidden" name="mobotp" class="mobotp"
                                                       value="<?php echo ($addflag != 1) ? $get["mobotp"] : ""; ?>">
                                                <input type="hidden" name="mobver" class="mobver"
                                                       value="<?php echo ($addflag != 1) ? $get["mobver"] : ""; ?>">
                                            </div>
                                            <?php
                                            if ($addflag == 1) {
                                                ?>
                                                <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 pad ">
                                                    <button type="button" class="btn btn-pad sknewbtn  form existuser"
                                                            style="width: 127px;height: 31px;">Existing Client</button>
                                                </div>
                                            <?php } ?>
                                        </div>


                                        <div class="row">

                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3  adjcolh2">
                                            </div>

                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3  adjcolh2">
                                                <label class="label-control marg skfontcolr">Suffix</label>
                                            </div>
                                            <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3  adjcolh3">
                                                <label class="label-control marg skfontcolr">Surname</label>
                                            </div>
                                            <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3  adjcolh3">
                                                <label class="label-control marg skfontcolr">Name</label>
                                            </div>
                                            <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3  adjcolh3">
                                                <label class="label-control marg skfontcolr">Middle Name</label>
                                            </div>
                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3  adjcolh2">
                                                <label class="label-control marg skfontcolr">Gender</label>
                                            </div>
                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3  adjcolh2">
                                                <label class="label-control marg skfontcolr">Passport</label>
                                            </div>
                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3  adjcolh2">
                                                <label class="label-control marg skfontcolr">Aaadhaar No.</label>
                                            </div>
                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 ">
                                                <label class="label-control marg skfontcolr">PAN No.</label>
                                            </div>
                                        </div>


                                        <div class="row">
                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right adjcolh2">
                                            </div>

                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 adjcolh2">
                                                <select name="suffix" class="form-control form select2 suffix">
                                                    <option value="<?php echo ($addflag != 1) ? $get["suffix"] : "" ?>">
                                                        <?php echo ($addflag != 1) ? $get["suffix"] : "" ?></option>
                                                    <option value="Mr">Mr</option>
                                                    <option value="Mrs">Mrs</option>
                                                    <option value="Miss">Miss</option>
                                                    <option value="Master">Master</option>
                                                    <option value="Chd">Chd</option>
                                                    <option value="Inf">INF</option>
                                                </select>
                                            </div>

                                            <div class="col-lg-2 col-md-8 col-sm-8 col-xs-8 adjcolh3">
                                                <input type="text" class="form-control form  surname" name="surname"
                                                       value="<?php echo ($addflag != 1) ? $get["surname"] : ""; ?>">
                                            </div>
                                            <div class="col-lg-2 col-md-8 col-sm-8 col-xs-8 adjcolh3">
                                                <input type="text" class="form-control form  name" name="name"
                                                       value="<?php echo ($addflag != 1) ? $get["name"] : ""; ?>" required>
                                            </div>

                                            <div class="col-lg-2 col-md-8 col-sm-8 col-xs-8 adjcolh3">
                                                <input type="text" class="form-control form  midname" name="midname"
                                                       value="<?php echo ($addflag != 1) ? $get["midname"] : ""; ?>">
                                            </div>

                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 adjcolh2">
                                                <select name="gender" class="form-control form select2 gender">
                                                    <option value="<?php echo ($addflag != 1) ? $get["gender"] : "" ?>">
                                                        <?php echo ($addflag != 1) ? $get["gender"] : "" ?></option>
                                                    <option value="Male">Male</option>
                                                    <option value="Female">Female</option>
                                                </select>
                                            </div>

                                            <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 adjcolh2">
                                                <input type="text" class="form-control form paxpassport"
                                                       name="paxpassport"
                                                       value="<?php echo ($addflag != 1) ? $get["paxpassport"] : ""; ?>">
                                            </div>

                                            <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 adjcolh2">
                                                <input type="text" class="form-control form aadhaarno" name="aadhaarno"
                                                       value="<?php echo ($addflag != 1) ? $get["aadhaarno"] : ""; ?>">
                                            </div>

                                            <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 adjcolh2">
                                                <input type="text" class="form-control form panno" name="panno"
                                                       value="<?php echo ($addflag != 1) ? $get["panno"] : ""; ?>">
                                            </div>
                                        </div>


                                        <div class="fitpaxbody">
                                            <?php
                                            if ($addflag != 1) {
                                                $paxctr = 0;
                                                $mctr = 0;
                                                $tqty = 0;
                                                $tamt = 0;
                                                $gettranpx = mysqli_query($conn, "SELECT * FROM `paxdtfit` WHERE `vouchno`='$get[vouchno]' ORDER BY `srno`") or die(mysqli_error($conn));
                                                while ($tranpx = mysqli_fetch_array($gettranpx)) {
                                                    $paxctr++;
                                                    ?>
                                                    <div class="row pxrw_<?= $mctr ?>" style="padding-top: 5px;">
                                                        <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right adjcolh2">
                                                            <i class='fa fa-close rmfitPax norem' id="<?= $mctr ?>"
                                                               style="display: none;"></i>
                                                        </div>

                                                        <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 adjcolh2">
                                                            <select name="tsuffix_<?= $mctr; ?>"
                                                                    class="form-control form select2 suffix">
                                                                <option value="<?= $tranpx["tsuffix"] ?>">
                                                                    <?= $tranpx["tsuffix"] ?></option>
                                                                <option value="Mr">Mr</option>
                                                                <option value="Mrs">Mrs</option>
                                                                <option value="Miss">Miss</option>
                                                                <option value="Master">Master</option>
                                                                <option value="Chd">Chd</option>
                                                                <option value="Inf">INF</option>
                                                            </select>
                                                        </div>

                                                        <div class="col-lg-2 col-md-8 col-sm-8 col-xs-8 adjcolh3">
                                                            <input type="text" class="form-control form  tsurname"
                                                                   name="tsurname_<?= $mctr; ?>"
                                                                   value="<?= $tranpx["tsurname"]; ?>">
                                                        </div>
                                                        <div class="col-lg-2 col-md-8 col-sm-8 col-xs-8 adjcolh3">
                                                            <input type="text" class="form-control form  tname"
                                                                   name="tname_<?= $mctr; ?>" value="<?= $tranpx["tname"]; ?>"
                                                                   required>
                                                        </div>

                                                        <div class="col-lg-2 col-md-8 col-sm-8 col-xs-8 adjcolh3">
                                                            <input type="text" class="form-control form  tmidname"
                                                                   name="tmidname_<?= $mctr; ?>"
                                                                   value="<?= $tranpx["tmidname"]; ?>">
                                                        </div>

                                                        <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 adjcolh2">
                                                            <select name="tgender_<?= $mctr; ?>"
                                                                    class="form-control form select2 tgender">
                                                                <option value="<?= $tranpx["tgender"]; ?>">
                                                                    <?= $tranpx["tgender"]; ?></option>
                                                                <option value="Male">Male</option>
                                                                <option value="Female">Female</option>
                                                            </select>
                                                        </div>

                                                        <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 adjcolh2">
                                                            <input type="text" class="form-control form tpaxpassport"
                                                                   name="tpaxpassport_<?= $mctr ?>"
                                                                   value="<?= $tranpx["tpaxpassport"]; ?>">
                                                        </div>

                                                        <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 adjcolh2">
                                                            <input type="text" class="form-control form taadhaarno"
                                                                   name="taadhaarno_<?= $mctr ?>"
                                                                   value="<?= $tranpx["taadhaarno"]; ?>">
                                                        </div>

                                                        <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 adjcolh2">
                                                            <input type="text" class="form-control form tpanno"
                                                                   name="tpanno_<?= $mctr ?>" value="<?= $tranpx["tpanno"]; ?>">
                                                        </div>
                                                    </div>
                                                    <?php
                                                    $mctr++;
                                                }
                                            }
                                            ?>
                                            <input type="hidden" id="paxctr" name="paxctr"
                                                   value="<?php echo ($addflag != 1) ? $paxctr : 1; ?>" />
                                        </div>


                                        <div class="row">
                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right "
                                                 style="width: 11.133333%;">
                                                <button type="button" class="btn btn-primary btn-square form"
                                                        id="addtrpax">
                                                    <i class="fa fa-plus" data-toggle='tooltip' title='Add Row'></i>
                                                </button>
                                            </div>
                                        </div>

                                        <div class="row">
                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad adjcol">
                                                <label class="label-control marg">Address</label>
                                            </div>
                                            <div class="col-lg-3 col-md-8 col-sm-8 col-xs-8 pad adjcola">
                                                <textarea rows="5" cols="60" class="form-control form  address"
                                                          style="resize:none;"
                                                          name="address"><?php echo ($addflag != 1) ? $get["address"] : ""; ?></textarea>
                                            </div>
                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3  text-right pad adjcol">
                                                <label class="label-control marg">City</label>
                                            </div>
                                            <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad adjcolh2">
                                                <input type="text" class="form-control form  city" name="mcity"
                                                       value="<?php echo ($addflag != 1) ? $get["city"] : ""; ?>">
                                            </div>
                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3  text-right pad"
                                                 style="width:7.333333%">
                                                <label class="label-control marg">Pin</label>
                                            </div>
                                            <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad adjcolh2">
                                                <input type="text" class="form-control form  pin" name="pin"
                                                       value="<?php echo ($addflag != 1) ? $get["pin"] : ""; ?>">
                                            </div>

                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad adjcol">
                                                <label class="label-control marg">State</label>
                                            </div>
                                            <div class="col-lg-2 col-md-8 col-sm-8 col-xs-8 pad">
                                                <select name="pstate" class="form-control form pstate select2">
                                                    <option
                                                        value="<?php echo ($addflag != 1) ? $get['pstate'] : ""; ?>">
                                                        <?php echo ($addflag != 1) ? $get['pstate'] : " "; ?></option>
                                                    <?php
                                                    $mown4 = mysqli_query($conn, "SELECT `code`, `name` FROM `state` ORDER BY name") or die(mysqli_error($conn));
                                                    while ($trow4 = mysqli_fetch_array($mown4)) {
                                                        echo "<option value='$trow4[name]'>$trow4[name]</option>";
                                                    }
                                                    ?>
                                                </select>
                                            </div>
                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3  text-right pad adjcolh">
                                                <label class="label-control marg">Statecode</label>
                                            </div>
                                            <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad adjcol">
                                                <input type="text" class="form-control form  pstatecode"
                                                       name="pstatecode"
                                                       value="<?php echo ($addflag != 1) ? $get["pstatecode"] : ""; ?>"
                                                       readonly>
                                            </div>
                                        </div>

                                        <div class="row">
                                            <div class="">
                                                <?php if ($autoginv != "Y") { ?>
                                                    <div class="col-lg-1 text-right pad adjcol">
                                                        <label class="label-control marg invdthide"
                                                               style="color:red">Invoice </label>
                                                    </div>
                                                    <div class="col-lg-1 pad ">
                                                        <input type="date" class="form-control form invdthide invdate"
                                                               style="color:green;background-color:white" name="invdate"
                                                               value="<?php echo ($addflag != 1) ? $get["invdate"] : ""; ?>">
                                                    </div>
                                                    <div class="col-lg-1 pad invdthide2">
                                                        <button class="form-control btn geninv2 invdthide"
                                                                style="background-color:green;color: white">Confirm</button>
                                                    </div>
                                                <?php } else { ?>
                                                    <div class="col-lg-3 pad "></div>
                                                <?php } ?>
                                                <!-- <div class="col-lg-1 text-right pad adjcol">
                                                    <label class="label-control marg invdthide" style="color:red">Invoice </label>
                                                </div>
                                                <div class="col-lg-1 pad ">
                                                    <input type="date" class="form-control form invdthide invdate" style="color:green;background-color:white" name="invdate" value="<?php echo ($addflag != 1) ? $get["invdate"] : ""; ?>">
                                                </div>
                                                <div class="col-lg-1 pad invdthide2">
                                                    <button class="form-control btn geninv2 invdthide" style="background-color:green;color: white">Confirm</button>
                                                </div> -->
                                            </div>

                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad adjcol">
                                            </div>

                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad"
                                                 style="width: 11.533333%;">
                                                <label class="label-control marg">Email</label>
                                            </div>
                                            <div class="col-lg-2 col-md-8 col-sm-8 col-xs-8 pad ">
                                                <input type="text" class="form-control form  pemail" name="email"
                                                       value="<?php echo ($addflag != 1) ? $get["email"] : ""; ?>">
                                            </div>
                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad adjcolh">
                                                <label class="label-control marg">GST No.</label>
                                            </div>
                                            <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad adjcolh2s"
                                                 style="width:12.333333%">
                                                <input type="text" class="form-control form gstno" name="gstno"
                                                       value="<?php echo ($addflag != 1) ? $get["gstno"] : ""; ?>">
                                            </div>

                                        </div>

                                    </div>

                                    <div class="tab-pane fade" id="tab2default">
                                        <div class="row hidtabpane">

                                            <div class="row" style="padding-left:2%">
                                                <table class="table table-bordered" style="width: 80%">
                                                    <thead>
                                                        <tr class="mySearchTr">
                                                            <th style="width:5%"></th>
                                                            <th style="width:5%">Sr.</th>
                                                            <th style="width:10%">Check In</th>
                                                            <th style="width:10%">Check Out</th>
                                                            <th style="width:30%">Hotel</th>
                                                            <th style="width:10%">Meal Type</th>
                                                            <th style="width:10%" class='text-right'>No. Nights</th>
                                                            <th style="width:10%" class='text-right'>No. Pax</th>
                                                            <th style="width:10%" class='text-right'>Rate</th>
                                                            <th style="width:10%" class='text-right'>Amount</th>
                                                        </tr>

                                                    </thead>
                                                    <tbody class="foodbody">
                                                        <?php
                                                        if ($addflag != 1) {
                                                            $fctr = 0;
                                                            $getfooddtl = mysqli_query($conn, "Select * from `$fooddb` where vouchno ='$get[vouchno]' order by srno") or die(mysqli_error($conn));
                                                            while ($fetfood = mysqli_fetch_array($getfooddtl)) {
                                                                $getho = mysqli_query($conn, "SELECT `code`,`hotelnm` FROM `hotels` where code='$fetfood[hotel]'") or die(mysqli_error($conn));
                                                                $fetho = mysqli_fetch_array($getho);

                                                                $getmeal = mysqli_query($conn, "SELECT `code`,`name` FROM $zroot.`mealtype` where code='$fetfood[meal]'") or die(mysqli_error($conn));
                                                                $fetmeal = mysqli_fetch_array($getmeal);

                                                                echo "<tr>";
                                                                echo "<td style='text-align:center'><i class='fa fa-close remove' style='display:none;'></i></td>";

                                                                echo "<td><input type='text' name='fsrno_$fctr' value='$fetfood[srno]' class='form-control form'></td>";
                                                                echo "<td><input type='date' name='fcheckin_$fctr' value='$fetfood[checkin]'   min='$curdate'  class='form-control form fcheckin'></td>";
                                                                echo "<td><input type='date' name='fcheckout_$fctr' value='$fetfood[checkout]' min='$curdate'  class='form-control form fcheckout'></td>";
                                                                echo "<td>";
                                                                echo "<select class='form-control form fhotel select2' name='fhotel_$fctr' style='width:100%'  >";
                                                                echo "<option value='$fetho[code]'>$fetho[hotelnm]</option>";
                                                                $git = mysqli_query($conn, "SELECT `code`,`hotelnm` FROM `hotels` ORDER BY `hotelnm`") or die(mysqli_error($conn));
                                                                while ($itm = mysqli_fetch_array($git)) {
                                                                    echo "<option value='$itm[code]'>$itm[hotelnm]</option>";
                                                                }

                                                                echo "</select>";
                                                                // food section 
                                                                echo "</td>";
                                                                echo "<td>";
                                                                echo "<select class='form-control form fmeal select2' name='fmeal_$fctr' style='width:100%'  >";
                                                                echo "<option value='$fetmeal[code]'>$fetmeal[name]</option>";
                                                                $gmeal = mysqli_query($conn, "SELECT `code`,`name` FROM $zroot.`mealtype` ORDER BY `name`") or die(mysqli_error($conn));
                                                                while ($fmeal = mysqli_fetch_array($gmeal)) {
                                                                    echo "<option value='$fmeal[code]'>$fmeal[name]</option>";
                                                                }
                                                                echo "</select>";
                                                                echo "</td>";
                                                                echo "<td><input type='number' name='fnonights_$fctr' value='$fetfood[nonights]' class='form-control form fnonights  text-right' readonly></td>";
                                                                echo "<td><input type='number' name='fnopax_$fctr' value='$fetfood[nopax]' class='form-control form fnopax text-right'></td>";
                                                                echo "<td><input type='number' name='frate_$fctr' value='$fetfood[rate]' class='form-control form frate text-right'></td>";
                                                                echo "<td><input type='number' name='famount_$fctr' value='$fetfood[amount]' class='form-control form famount text-right' readonly>"
                                                                . "<input type='hidden' name='froe_$fctr' value='$fetfood[roe]' class='form-control form froe text-right'>"
                                                                . "<input type='hidden' name='finramt_$fctr' value='$fetfood[inramt]' class='form-control form finramt text-right'></td>";
                                                                echo "</tr>";
                                                                $fctr++;
                                                            }
                                                        } else {
                                                            echo "<tr>";
                                                            echo "<td style='text-align:center'><i class='fa fa-close remove' ></i></td>";

                                                            echo "<td><input type='text' name='fsrno_0' value='1' class='form-control form'></td>";
                                                            echo "<td><input type='date' name='fcheckin_0' value='' min='$curdate'  class='form-control form fcheckin'></td>";
                                                            echo "<td><input type='date' name='fcheckout_0' value='' min='$curdate'  class='form-control form fcheckout'></td>";
                                                            echo "<td>";
                                                            echo "<select class='form-control form fhotel select2' name='fhotel_0' style='width:100%'  >";
                                                            echo "<option value=''></option>";
                                                            $git = mysqli_query($conn, "SELECT `code`,`hotelnm` FROM `hotels` ORDER BY `hotelnm`") or die(mysqli_error($conn));
                                                            while ($itm = mysqli_fetch_array($git)) {
                                                                echo "<option value='$itm[code]'>$itm[hotelnm]</option>";
                                                            }
                                                            echo "</select>";
                                                            echo "</td>";
                                                            echo "<td>";
                                                            echo "<select class='form-control form fmeal select2' name='fmeal_0' style='width:100%'  >";
                                                            echo "<option value=''></option>";
                                                            $gmeal = mysqli_query($conn, "SELECT `code`,`name` FROM $zroot.`mealtype` ORDER BY `name`") or die(mysqli_error($conn));
                                                            while ($fmeal = mysqli_fetch_array($gmeal)) {
                                                                echo "<option value='$fmeal[code]'>$fmeal[name]</option>";
                                                            }
                                                            echo "</select>";
                                                            echo "</td>";
                                                            echo "<td><input type='number' name='fnonights_0' value='0' class='form-control form fnonights text-right' readonly></td>";
                                                            echo "<td><input type='number' name='fnopax_0' value='0' class='form-control form fnopax text-right'></td>";
                                                            echo "<td><input type='number' name='frate_0' value='0' class='form-control form frate text-right'></td>";
                                                            echo "<td><input type='number' name='famount_0' value='0' class='form-control form famount text-right' readonly>"
                                                            . "<input type='hidden' name='froe_0' value='0' class='form-control form froe text-right'>"
                                                            . "<input type='hidden' name='finramt_0' value='0' class='form-control form finramt text-right'></td>";
                                                            echo "</tr>";
                                                        }
                                                        ?>
                                                    <input type="hidden" name="foodcnt" id="foodcnt"
                                                           value="<?php echo ($addflag != 1) ? $fctr : 1 ?>">
                                                    </tbody>

                                                </table>

                                            </div>

                                            <button type="button" class="btn btn-primary btn-square form" id="addfood">
                                                <i class="fa fa-plus" data-toggle='tooltip' title='Add Row'></i>
                                            </button>
                                        </div>
                                        <div class="row">
                                            <div class="col-lg-1 col-md-1 col-sm-3 col-xs-3 text-right pad">
                                                <label class="label-control marg"
                                                       style="color:#2FBFFE;font-weight:bold">Approve</label>
                                            </div>
                                            <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 pad">
                                                <input type="checkbox" class="form-control form foodaprov" <?php
                                                if ($get['foodaprov'] == "1") {
                                                    echo "checked";
                                                }
                                                ?> value="1"
                                                       name="foodaprov">
                                            </div>
                                            <div class="col-lg-4 text-right pad" style="width:32%">
                                                <label class="label-control marg">Total</label>
                                            </div>
                                            <div class="col-lg-1">
                                                <input type="text" class="form-control form text-right foodnights"
                                                       name="foodnights"
                                                       value="<?php echo ($addflag != 1) ? $get["foodnights"] : ""; ?>"
                                                       readonly>
                                            </div>
                                            <div class="col-lg-1">
                                                <input type="text" class="form-control form text-right  foodpax"
                                                       name="foodpax"
                                                       value="<?php echo ($addflag != 1) ? $get["foodpax"] : ""; ?>"
                                                       readonly>
                                            </div>
                                            <div class="col-lg-1 text-right">
                                                <label class="label-control marg">FE</label>

                                            </div>
                                            <div class="col-lg-1">
                                                <input type="text" class="form-control form text-right  foodamt"
                                                       name="foodamt"
                                                       value="<?php echo ($addflag != 1) ? $get["foodamt"] : ""; ?>"
                                                       readonly>
                                            </div>
                                            <div class="col-lg-1 text-right pad" style='width:20px;color: blue'>
                                                <label class="label-control marg"><b>INR</b></label>
                                            </div>
                                            <div class="col-lg-1">
                                                <input type="text" class="form-control form text-right  foodinramt"
                                                       name="foodinramt"
                                                       value="<?php echo ($addflag != 1) ? $get["foodinramt"] : ""; ?>"
                                                       readonly style="width:150px;color: blue">
                                            </div>
                                        </div>


                                        <div style="background-color:#E3F2E1;width: 50%;display:none" class="pfood">

                                            <div class="row">
                                                <div class="col-lg-3 text-right pad">
                                                    <label class="label-control marg" style="color:red">Supplier</label>
                                                </div>
                                                <div class="col-lg-6 adjcolj pad">
                                                    <select name="foodsupp" class="form-control form pad foodsupp"
                                                            style="color:red;background-color:white;">
                                                        <option
                                                            value="<?php echo ($addflag != 1) ? $get["foodsupp"] : ""; ?>">
                                                                <?php echo ($addflag != 1) ? $fetfdsupp["name"] : ""; ?>
                                                        </option>
                                                        <?php
                                                        $gfdrr = mysqli_query($conn, "SELECT `accode`,`name` FROM `accmast` where grpcode = '009' ORDER BY `name`") or die(mysqli_error($conn));
                                                        while ($fdspr = mysqli_fetch_array($gfdrr)) {
                                                            echo "<option value='$fdspr[accode]'>$fdspr[name]</option>";
                                                        }
                                                        ?>

                                                    </select>
                                                </div>
                                            </div>

                                            <div class="row">
                                                <div class="col-lg-3 text-right pad">
                                                    <label class="label-control marg" style="color:red">Invoice
                                                        No.</label>
                                                </div>
                                                <div class="col-lg-2 adjcolj pad">
                                                    <input type="text" class="form-control form text-right foodinvno"
                                                           style="color:red;background-color:white" name="foodinvno"
                                                           value="<?php echo ($addflag != 1) ? $get["foodinvno"] : ""; ?>">
                                                </div>
                                                <div class="col-lg-2 text-right pad">
                                                    <label class="label-control marg" style="color:red">Invoice
                                                        Date</label>

                                                </div>
                                                <div class="col-lg-2 text-right pad">
                                                    <input type="date" class="form-control form text-right foodinvdt"
                                                           style="color:red;background-color:white" name="foodinvdt"
                                                           value="<?php echo ($addflag != 1) ? $get["foodinvdt"] : ""; ?>">
                                                </div>
                                            </div>

                                            <div class="row">
                                                <div class="col-lg-3 text-right pad">
                                                    <label class="label-control marg" style="color:red">Rate</label>
                                                </div>
                                                <div class="col-lg-2 adjcolj pad">
                                                    <input type="text" class="form-control form text-right foodrate"
                                                           style="color:red;background-color:white" name="foodrate"
                                                           value="<?php echo ($addflag != 1) ? $get["foodrate"] : ""; ?>">
                                                </div>
                                                <div class="col-lg-2 text-right pad">
                                                    <label class="label-control marg" style="color:red">Amount</label>

                                                </div>
                                                <div class="col-lg-2 text-right pad">
                                                    <input type="text" class="form-control form text-right  foodpuramt"
                                                           style="color:red;background-color:white" name="foodpuramt"
                                                           value="<?php echo ($addflag != 1) ? $get["foodpuramt"] : ""; ?>">
                                                </div>
                                            </div>
                                        </div>

                                        <div>
                                            <button type="button" align="left" id='print'
                                                    class="btn btn-pad btn-square sknewbtn foodpurch"
                                                    style="margin-right: 65%;">
                                                Food Purchase
                                            </button>

                                            <a align="right" id='print' class="btn btn-pad btn-square skbtn foodprint"
                                               href="foodent_print.php?vouchno=<?= $qvouch; ?>&para=<?= $para ?>&image=Yes"
                                               target="_blank"
                                               style="display: none;background-image: linear-gradient(135deg, #3C8CE7 10%, #00EAFF 100%) !important;color:white !important;">
                                                <i class="fa fa-image"></i>
                                            </a>
                                            <a align="right" id='print' class="btn btn-pad btn-square skbtn foodprint"
                                               href="foodent_print.php?vouchno=<?= $qvouch; ?>&para=<?= $para ?>&image=No"
                                               target="_blank"
                                               style="display: none;background-image: linear-gradient(135deg, #3C8CE7 10%, #00EAFF 100%) !important;color:white !important;">
                                                <i class="fa fa-print"></i>
                                            </a>
                                            <a align="right" id='print' class="btn btn-pad btn-square skbtn foodvouch"
                                               href="#">
                                                Food Voucher
                                            </a>
                                        </div>
                                    </div>

                                    <div class="tab-pane fade " id="tab3default">

                                        <div class="row hidtabpane">

                                            <div class="row" style="padding-left:2%">

                                                <table class="table table-bordered" style="width: 80%">
                                                    <thead>
                                                        <tr class="mySearchTr">
                                                            <th style="width:5%"></th>
                                                            <th style="width:5%">Sr.</th>
                                                            <th style="width:10%">Check In</th>
                                                            <th style="width:10%">Check Out</th>
                                                            <th style="width:30%">Hotel</th>
                                                            <th style="width:10%" class='text-right'>No. Nights</th>
                                                            <th style="width:10%" class='text-right'>No. Pax</th>
                                                            <th style="width:10%" class='text-right'>Rate</th>
                                                            <th style="width:10%" class='text-right'>Amount</th>
                                                        </tr>

                                                    </thead>

                                                    <!-- Laundry section starts from here -->

                                                    <tbody class="laundbody">
                                                        <?php
                                                        if ($addflag != 1) {
                                                            $fctr = 0;
                                                            $getlaunddtl = mysqli_query($conn, "Select * from `$launddb` where vouchno ='$get[vouchno]' order by srno") or die(mysqli_error($conn));
                                                            while ($fetlaund = mysqli_fetch_array($getlaunddtl)) {
                                                                $getho = mysqli_query($conn, "SELECT `code`,`hotelnm` FROM `hotels` where code='$fetlaund[hotel]'") or die(mysqli_error($conn));
                                                                $fetho = mysqli_fetch_array($getho);
                                                                echo "<tr>";
                                                                echo "<td style='text-align:center'><i class='fa fa-close remove' style='display:none;'></i></td>";

                                                                echo "<td><input type='text' name='lsrno_$fctr' value='$fetlaund[srno]' class='form-control form'></td>";
                                                                echo "<td><input type='date' name='lcheckin_$fctr' value='$fetlaund[checkin]'   min='$curdate' class='form-control form lcheckin'></td>";
                                                                echo "<td><input type='date' name='lcheckout_$fctr' value='$fetlaund[checkout]' min='$curdate' class='form-control form lcheckout'></td>";
                                                                echo "<td>";
                                                                echo "<select class='form-control form lhotel select2' name='lhotel_$fctr' style='width:100%'  >";
                                                                echo "<option value='$fetho[code]'>$fetho[hotelnm]</option>";
                                                                $git = mysqli_query($conn, "SELECT `code`,`hotelnm` FROM `hotels` ORDER BY `hotelnm`") or die(mysqli_error($conn));
                                                                while ($itm = mysqli_fetch_array($git)) {
                                                                    echo "<option value='$itm[code]'>$itm[hotelnm]</option>";
                                                                }

                                                                echo "</select>";

                                                                echo "</td>";
                                                                echo "<td><input type='number' name='lnonights_$fctr' value='$fetlaund[nonights]' class='form-control form lnonights text-right' readonly ></td>";
                                                                echo "<td><input type='number' name='lnopax_$fctr' value='$fetlaund[nopax]' class='form-control form lnopax text-right'></td>";
                                                                echo "<td><input type='number' name='lrate_$fctr' value='$fetlaund[rate]' class='form-control form lrate text-right'></td>";
                                                                echo "<td><input type='number' name='lamount_$fctr' value='$fetlaund[amount]' class='form-control form lamount text-right' readonly>"
                                                                . "<input type='hidden' name='lroe_$fctr' value='$fetlaund[roe]' class='form-control form lroe text-right'>"
                                                                . "<input type='hidden' name='linramt_$fctr' value='$fetlaund[inramt]' class='form-control form linramt text-right'></td>";
                                                                echo "</tr>";
                                                                $fctr++;
                                                            }
                                                        } else {
                                                            echo "<tr>";
                                                            echo "<td style='text-align:center'><i class='fa fa-close remove'></i></td>";

                                                            echo "<td><input type='text' name='lsrno_0' value='1' class='form-control form'></td>";
                                                            echo "<td><input type='date' name='lcheckin_0' value=''  min='$curdate' class='form-control form lcheckin'></td>";
                                                            echo "<td><input type='date' name='lcheckout_0' value='' min='$curdate' class='form-control form lcheckout'></td>";
                                                            echo "<td>";
                                                            echo "<select class='form-control form lhotel select2' name='lhotel_0' style='width:100%'  >";
                                                            echo "<option value=''></option>";
                                                            $git = mysqli_query($conn, "SELECT `code`,`hotelnm` FROM `hotels` ORDER BY `hotelnm`") or die(mysqli_error($conn));
                                                            while ($itm = mysqli_fetch_array($git)) {
                                                                echo "<option value='$itm[code]'>$itm[hotelnm]</option>";
                                                            }
                                                            echo "</select>";
                                                            echo "</td>";
                                                            echo "<td><input type='number' name='lnonights_0' value='0' class='form-control form lnonights text-right' readonly></td>";
                                                            echo "<td><input type='number' name='lnopax_0' value='0' class='form-control form lnopax text-right'></td>";
                                                            echo "<td><input type='number' name='lrate_0' value='0' class='form-control form lrate text-right'></td>";
                                                            echo "<td><input type='number' name='lamount_0' value='0' class='form-control form lamount text-right' readonly>"
                                                            . "<input type='hidden' name='lroe_0' value='0' class='form-control form lroe text-right'>"
                                                            . "<input type='hidden' name='linramt_0' value='0' class='form-control form linramt text-right'></td>";
                                                            echo "</tr>";
                                                        }
                                                        ?>
                                                    <input type="hidden" name="laundcnt" id="laundcnt"
                                                           value="<?php echo ($addflag != 1) ? $fctr : 1 ?>">
                                                    </tbody>

                                                </table>

                                            </div>

                                            <button type="button" class="btn btn-primary btn-square form" id="addlaund">
                                                <i class="fa fa-plus" data-toggle='tooltip' title='Add Row'></i>
                                            </button>
                                        </div>

                                        <div class="row">
                                            <div class="col-lg-1 col-md-1 col-sm-3 col-xs-3 text-right pad">
                                                <label class="label-control marg"
                                                       style="color:#2FBFFE;font-weight:bold">Approve</label>
                                            </div>
                                            <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 pad">
                                                <input type="checkbox" class="form-control form laundaprov" <?php
                                                if ($get['laundaprov'] == "1") {
                                                    echo "checked";
                                                }
                                                ?> value="1"
                                                       name="laundaprov">
                                            </div>
                                            <div class="col-lg-4 text-right pad" style="width:32%">
                                                <label class="label-control marg">Total</label>
                                            </div>
                                            <div class="col-lg-1">
                                                <input type="text" class="form-control form text-right laundnights"
                                                       name="laundnights"
                                                       value="<?php echo ($addflag != 1) ? $get["laundnights"] : ""; ?>"
                                                       readonly>
                                            </div>
                                            <div class="col-lg-1">
                                                <input type="text" class="form-control form text-right  laundpax"
                                                       name="laundpax"
                                                       value="<?php echo ($addflag != 1) ? $get["laundpax"] : ""; ?>"
                                                       readonly>
                                            </div>
                                            <div class="col-lg-1 text-right ">
                                                <label class="label-control  marg">FE</label>
                                            </div>
                                            <div class="col-lg-1 ">
                                                <input type="text" class="form-control form text-right  laundamt"
                                                       name="laundamt"
                                                       value="<?php echo ($addflag != 1) ? $get["laundamt"] : ""; ?>"
                                                       readonly>
                                            </div>

                                            <div class="col-lg-1 text-right pad" style='width:20px;color: blue'>
                                                <label class="label-control marg"><b>INR</b></label>
                                            </div>

                                            <div class="col-lg-1">
                                                <input type="text" class="form-control form text-right  laundinramt"
                                                       name="laundinramt"
                                                       value="<?php echo ($addflag != 1) ? $get["laundinramt"] : ""; ?>"
                                                       readonly style="width:170px;color: blue">
                                            </div>
                                        </div>


                                        <div style="background-color:#E3F2E1;width: 50%;display:none" class="plaund">

                                            <div class="row">
                                                <div class="col-lg-3 text-right pad">
                                                    <label class="label-control marg" style="color:red">Supplier</label>
                                                </div>
                                                <div class="col-lg-6 adjcolj pad">
                                                    <select name="laundsupp" class="form-control form pad laundsupp"
                                                            style="color:red;background-color:white;">
                                                        <option
                                                            value="<?php echo ($addflag != 1) ? $get["laundsupp"] : ""; ?>">
                                                                <?php echo ($addflag != 1) ? $fetldsupp["name"] : ""; ?>
                                                        </option>
                                                        <?php
                                                        $gnrr = mysqli_query($conn, "SELECT `accode`,`name` FROM `accmast` where grpcode = '009' ORDER BY `name`") or die(mysqli_error($conn));
                                                        while ($fnspr = mysqli_fetch_array($gnrr)) {
                                                            echo "<option value='$fnspr[accode]'>$fnspr[name]</option>";
                                                        }
                                                        ?>

                                                    </select>
                                                </div>
                                            </div>

                                            <div class="row">
                                                <div class="col-lg-3 text-right pad">
                                                    <label class="label-control marg" style="color:red">Invoice
                                                        No.</label>
                                                </div>
                                                <div class="col-lg-2 adjcolj pad">
                                                    <input type="text" class="form-control form text-right  laundinvno"
                                                           style="color:red;background-color:white" name="laundinvno"
                                                           value="<?php echo ($addflag != 1) ? $get["laundinvno"] : ""; ?>">
                                                </div>
                                                <div class="col-lg-2 text-right pad">
                                                    <label class="label-control marg" style="color:red">Invoice
                                                        Date</label>

                                                </div>
                                                <div class="col-lg-2 text-right pad">
                                                    <input type="date" class="form-control form text-right  laundinvdt"
                                                           style="color:red;background-color:white" name="laundinvdt"
                                                           value="<?php echo ($addflag != 1) ? $get["laundinvdt"] : ""; ?>">
                                                </div>
                                            </div>

                                            <div class="row">
                                                <div class="col-lg-3 text-right pad">
                                                    <label class="label-control marg" style="color:red">Rate</label>
                                                </div>
                                                <div class="col-lg-2 adjcolj pad">
                                                    <input type="text" class="form-control form text-right  laundrate"
                                                           style="color:red;background-color:white" name="laundrate"
                                                           value="<?php echo ($addflag != 1) ? $get["laundrate"] : ""; ?>">
                                                </div>
                                                <div class="col-lg-2 text-right pad">
                                                    <label class="label-control marg" style="color:red">Amount</label>

                                                </div>
                                                <div class="col-lg-2 text-right pad">
                                                    <input type="text" class="form-control form text-right  laundpuramt"
                                                           style="color:red;background-color:white" name="laundpuramt"
                                                           value="<?php echo ($addflag != 1) ? $get["laundpuramt"] : ""; ?>">
                                                </div>
                                            </div>
                                        </div>

                                        <div>
                                            <button type="button" align="left" id='print'
                                                    class="btn btn-pad btn-square sknewbtn laundpurch"
                                                    style="margin-right: 63%;">
                                                Laundry Purchase
                                            </button>
                                            <a align="right" id='print'
                                               style="display: none;background-image: linear-gradient(135deg, #3C8CE7 10%, #00EAFF 100%) !important;color:white !important;"
                                               class="btn btn-pad btn-square skbtn laundprint"
                                               href="laundryent_print.php?vouchno=<?= $qvouch; ?>&para=<?= $para ?>&image=Yes"
                                               target="_blank">
                                                <i class="fa fa-image"></i>
                                            </a>
                                            <a align="right" id='print'
                                               style="display: none;background-image: linear-gradient(135deg, #3C8CE7 10%, #00EAFF 100%) !important;color:white !important;"
                                               class="btn btn-pad btn-square skbtn laundprint"
                                               href="laundryent_print.php?vouchno=<?= $qvouch; ?>&para=<?= $para ?>&image=No"
                                               target="_blank">
                                                <i class="fa fa-print"></i>
                                            </a>
                                            <a align="right" id='print' class="btn btn-pad btn-square skbtn laundvouch"
                                               href="#">
                                                Laundry Voucher
                                            </a>
                                        </div>

                                    </div>
                                    <div class="tab-pane fade" id="tab4default">

                                        <div class="row">
                                            <table class="table table-striped table-condensed table-bordered"
                                                   width="130%">
                                                <thead class="mySearchTr">
                                                    <tr>
                                                        <th style="width: 2%"></th>
                                                        <th style="width: 3%">Sr.</th>
                                                        <th style="width: 7%">From</th>
                                                        <th style="width: 7%;">To</th>
                                                        <th style="width: 10%;">Airline</th>
                                                        <th style="width: 8%;">Ticket No.</th>
                                                        <th style='width: 7%'>Flight No.</th>
                                                        <th style='width: 7%'>PNR</th>
                                                        <th style='width: 7%'>Date</th>
                                                        <th style='width: 4%' class="text-right">No.<br> Adult</th>
                                                        <th style='width: 4%' class="text-right">No.<br> Child</th>
                                                        <th style='width: 4%' class="text-right">No.<br> Inf.</th>
                                                        <th style='width: 7%' class="text-right">Adult</th>
                                                        <th style='width: 7%' class="text-right">Child</th>
                                                        <th style='width: 7%' class="text-right">Infant</th>
                                                        <th style='width: 10%' class="text-right">Total</th>
                                                    </tr>
                                                </thead>
                                                <tbody class="tiktbody">
                                                    <?php
                                                    if ($addflag != 1) {
                                                        $tctr = 0;
                                                        $gettiktdtl = mysqli_query($conn, "Select * from `$tiktdb` where vouchno ='$get[vouchno]' order by srno") or die(mysqli_error($conn));
                                                        while ($fettikt = mysqli_fetch_array($gettiktdtl)) {
                                                            $getho = mysqli_query($conn, "SELECT `code`,`name` FROM `airline` where code='$fettikt[airline]'") or die(mysqli_error($conn));
                                                            $fetho = mysqli_fetch_array($getho);
                                                            echo "<tr>";
                                                            echo "<td style='text-align:center'></td>";
                                                            echo "<td><input type='text' name='tsrno_$tctr' value='$fettikt[srno]' class='form-control form'></td>";
                                                            // echo "<td><input type='text' name='tfrom_$tctr' value='$fettikt[fromdes]' class='form-control form lcheckin'></td>";
                                                            // echo "<td><input type='text' name='tto_$tctr' value='$fettikt[todes]' class='form-control form lcheckout'></td>";

                                                            echo "<td>";
                                                            echo "<select class='form-control form lcheckin select2 fetchpart_$tctr' name='tfrom_$tctr' style='width:100%'>";
                                                            echo "<option value='$fettikt[fromdes]'>$fettikt[fromdes]</option>";
                                                            $gfrm = mysqli_query($conn, "SELECT `code`,`name` FROM `sector` ORDER BY `name`") or die(mysqli_error($conn));
                                                            while ($ifrm = mysqli_fetch_array($gfrm)) {
                                                                echo "<option value='$ifrm[name]'>$ifrm[name]</option>";
                                                            }
                                                            echo "</select>";
                                                            echo "</td>";

                                                            echo "<td>";
                                                            echo "<select class='form-control form lcheckout select2 fetchpart_$tctr' name='tto_$tctr' style='width:100%'>";
                                                            echo "<option value='$fettikt[todes]'>$fettikt[todes]</option>";

                                                            $gto = mysqli_query($conn, "SELECT `code`,`name` FROM `sector` ORDER BY `name`") or die(mysqli_error($conn));
                                                            while ($ito = mysqli_fetch_array($gto)) {
                                                                echo "<option value='$ito[name]'>$ito[name]</option>";
                                                            }
                                                            echo "</select>";
                                                            echo "</td>";
                                                            echo "<td>";
                                                            echo "<select class='form-control form tairline select2' name='tairline_$tctr' style='width:100%'  >";
                                                            echo "<option value='$fetho[code]'>$fetho[name]</option>";
                                                            $git = mysqli_query($conn, "SELECT `code`,`name` FROM `airline` 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><input type='text' name='tticketno_$tctr' value='$fettikt[ticketno]' class='form-control form tticketno '></td>";
                                                            echo "<td><input type='text' name='tflightno_$tctr' value='$fettikt[flightno]' class='form-control form tflightno'></td>";
                                                            echo "<td><input type='text' name='tpnr_$tctr' value='$fettikt[pnrno]' class='form-control form tpnr'></td>";
                                                            echo "<td><input type='date' name='ttravdate_$tctr' value='$fettikt[travdate]' min='$curdate' class='form-control form ttravdate'></td>";
                                                            echo "<td><input type='number' name='tnopax_$tctr' value='$fettikt[nopax]' class='form-control form tnopax text-right'></td>";
                                                            echo "<td><input type='number' name='tnopaxchild_$tctr' value='$fettikt[nochild]' class='form-control form tnopaxchild text-right'></td>";
                                                            echo "<td><input type='number' name='tnopaxinf_$tctr' value='$fettikt[noinf]' class='form-control form tnopaxinf text-right'></td>";
                                                            echo "<td><input type='number' name='tadult_$tctr' value='$fettikt[adult]' class='form-control form tadult text-right'></td>";
                                                            echo "<td><input type='number' name='tchild_$tctr' value='$fettikt[child]' class='form-control form tchild text-right'></td>";
                                                            echo "<td><input type='number' name='tinfant_$tctr' value='$fettikt[infant]' class='form-control form tinfant text-right'></td>";
                                                            echo "<td><input type='number' name='tamount_$tctr' value='$fettikt[amount]' class='form-control form tamount text-right' readonly>"
                                                            . "<input type='hidden' name='troe_$tctr' value='$fettikt[roe]' class='form-control form troe text-right'>"
                                                            . "<input type='hidden' name='tinramt_$tctr' value='$fettikt[inramt]' class='form-control form tinramt text-right'></td>";
                                                            echo "</tr>";
                                                            $tctr++;
                                                        }
                                                    } else {
                                                        echo "<tr>";
                                                        echo "<td style='text-align:center'><i class='fa fa-close remove' ></i></td>";

                                                        echo "<td><input type='text' name='tsrno_0' value='1' class='form-control form'></td>";
                                                        echo "<td>";
                                                        echo "<select class='form-control form lcheckin select2 fetchpart_$ctr' name='tfrom_0' style='width:100%'>";
                                                        echo "<option value=''></option>";
                                                        $gfrm = mysqli_query($conn, "SELECT `code`,`name` FROM `sector` ORDER BY `name`") or die(mysqli_error($conn));
                                                        while ($ifrm = mysqli_fetch_array($gfrm)) {
                                                            echo "<option value='$ifrm[name]'>$ifrm[name]</option>";
                                                        }
                                                        echo "</select>";
                                                        echo "</td>";

                                                        echo "<td>";
                                                        echo "<select class='form-control form lcheckout select2 fetchpart_$ctr' name='tto_0' style='width:100%'>";
                                                        echo "<option value=''></option>";
                                                        $gto = mysqli_query($conn, "SELECT `code`,`name` FROM `sector` ORDER BY `name`") or die(mysqli_error($conn));
                                                        while ($ito = mysqli_fetch_array($gto)) {
                                                            echo "<option value='$ito[name]'>$ito[name]</option>";
                                                        }
                                                        echo "</select>";
                                                        echo "</td>";
                                                        echo "<td>";
                                                        echo "<select class='form-control form tairline select2' name='tairline_0' style='width:100%'  >";
                                                        echo "<option value=''></option>";
                                                        $git = mysqli_query($conn, "SELECT `code`,`name` FROM `airline` 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><input type='text' name='tticketno_0' value='' class='form-control form tticketno '></td>";
                                                        echo "<td><input type='text' name='tflightno_0' value='' class='form-control form tflightno'></td>";
                                                        echo "<td><input type='text' name='tpnr_0' value='' class='form-control form tpnr'></td>";
                                                        echo "<td><input type='date' name='ttravdate_0' value='' min='$curdate' class='form-control form ttravdate'></td>";
                                                        echo "<td><input type='number' name='tnopax_0' value='0' class='form-control form tnopax text-right'></td>";
                                                        echo "<td><input type='number' name='tnopaxchild_0' value='0' class='form-control form tnopaxchild text-right'></td>";
                                                        echo "<td><input type='number' name='tnopaxinf_0' value='0' class='form-control form tnopaxinf text-right'></td>";
                                                        echo "<td><input type='number' name='tadult_0' value='0' class='form-control form tadult text-right'></td>";
                                                        echo "<td><input type='number' name='tchild_0' value='0' class='form-control form tchild text-right'></td>";
                                                        echo "<td><input type='number' name='tinfant_0' value='0' class='form-control form tinfant text-right'></td>";
                                                        echo "<td><input type='number' name='tamount_0' value='0' class='form-control form tamount text-right' readonly>"
                                                        . "<input type='hidden' name='troe_0' value='0' class='form-control form troe text-right'>"
                                                        . "<input type='hidden' name='tinramt_0' value='0' class='form-control form tinramt text-right'></td>";
                                                        echo "</tr>";
                                                    }
                                                    ?>
                                                <input type="hidden" name="tiktcnt" id="tiktcnt"
                                                       value="<?php echo ($addflag != 1) ? $tctr : 1 ?>">
                                                </tbody>

                                            </table>

                                        </div>

                                        <button type="button" class="btn btn-primary btn-square form" id="addtikt">
                                            <i class="fa fa-plus" data-toggle='tooltip' title='Add Row'></i>
                                        </button>

                                        <div class="row">
                                            <div class="col-lg-1 col-md-1 col-sm-3 col-xs-3 text-right pad">
                                                <label class="label-control marg"
                                                       style="color:#2FBFFE;font-weight:bold">Approve</label>
                                            </div>
                                            <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 pad">
                                                <input type="checkbox" class="form-control form tiktaprov" <?php
                                                if ($get['tiktaprov'] == "1") {
                                                    echo "checked";
                                                }
                                                ?> value="1"
                                                       name="tiktaprov">
                                            </div>
                                            <div class="col-lg-7 text-right pad">
                                            </div>
                                            <div class="col-lg-1 adjcol">
                                            </div>
                                            <div class="col-lg-1 text-right pad">
                                                <label class="label-control marg">Subtotal</label>
                                            </div>
                                            <div class="col-lg-1 pad adjcolh2" style="margin-left: 10px;">
                                                <input type="text" class="form-control form text-right  tiktsubtot"
                                                       name="tiktsubtot"
                                                       value="<?php echo ($addflag != 1) ? $get["tiktsubtot"] : "0"; ?>"
                                                       readonly>
                                            </div>
                                        </div>


                                        <div class="row pad">
                                            <div class="col-lg-1 adjcol">
                                            </div>
                                            <div class="col-lg-10 text-right pad">
                                                <label class="label-control marg">Handling Charges</label>
                                            </div>
                                            <div class="col-lg-1 pad adjcolh2" style="margin-left: 10px;">
                                                <input type="text" class="form-control form text-right  tikthandchg"
                                                       name="tikthandchg"
                                                       value="<?php echo ($addflag != 1) ? $get["tikthandchg"] : "0"; ?>">
                                            </div>
                                        </div>
                                        <div class="row pad">
                                            <div class="col-lg-1 ">
                                            </div>
                                            <div class="col-lg-9 text-right pad">
                                                <label class="label-control marg">GST %</label>
                                            </div>
                                            <div class="col-lg-1 text-right pad adjcol">
                                                <input type="text" maxlength="2"
                                                       class="form-control form text-right  tiktgstperc" name="tiktgstperc"
                                                       value="<?php echo ($addflag != 1) ? $get["tiktgstperc"] : "0"; ?>">
                                            </div>
                                            <div class="col-lg-1 pad adjcolh2" style="margin-left: 10px;">
                                                <input type="text" class="form-control form text-right  tiktgstamt"
                                                       name="tiktgstamt"
                                                       value="<?php echo ($addflag != 1) ? $get["tiktgstamt"] : "0"; ?>"
                                                       readonly>
                                            </div>
                                        </div>

                                        <div class="row" style="margin-bottom: 20px;">
                                            <div class="col-lg-1 adjcol">
                                            </div>
                                            <div class="col-lg-10 text-right pad">
                                                <label class="label-control marg">Final Amount</label>
                                            </div>
                                            <div class="col-lg-1 pad adjcolh2" style="margin-left: 10px;">
                                                <input type="text" class="form-control form text-right  tiktamt"
                                                       name="tiktamt"
                                                       value="<?php echo ($addflag != 1) ? $get["tiktamt"] : "0"; ?>"
                                                       readonly>
                                            </div>
                                        </div>

                                        <div style="background-color:#E3F2E1;width: 50%;display: none;" class="ptikt">

                                            <div class="row">
                                                <div class="col-lg-3 text-right pad">
                                                    <label class="label-control marg" style="color:red">Supplier</label>
                                                </div>
                                                <div class="col-lg-6 adjcolj pad">
                                                    <select name="tiktsupp" class="form-control form pad tiktsupp"
                                                            style="color:red;background-color:white;">
                                                        <option
                                                            value="<?php echo ($addflag != 1) ? $get["tiktsupp"] : ""; ?>">
                                                                <?php echo ($addflag != 1) ? $fettksupp["name"] : ""; ?>
                                                        </option>
                                                        <?php
                                                        $gtk = mysqli_query($conn, "SELECT `accode`,`name` FROM `accmast` where grpcode = '009' ORDER BY `name`") or die(mysqli_error($conn));
                                                        while ($ftk = mysqli_fetch_array($gtk)) {
                                                            echo "<option value='$ftk[accode]'>$ftk[name]</option>";
                                                        }
                                                        ?>

                                                    </select>
                                                </div>
                                            </div>
                                            <div class="row">
                                                <div class="col-lg-3 text-right pad">
                                                    <label class="label-control marg" style="color:red">Invoice
                                                        No.</label>
                                                </div>
                                                <div class="col-lg-2 adjcolj pad">
                                                    <input type="text" class="form-control form text-right  tiktinvno"
                                                           style="color:red;background-color:white" name="tiktinvno"
                                                           value="<?php echo ($addflag != 1) ? $get["tiktinvno"] : ""; ?>">
                                                </div>
                                                <div class="col-lg-2 text-right pad">
                                                    <label class="label-control marg" style="color:red">Invoice
                                                        Date</label>
                                                </div>
                                                <div class="col-lg-2 text-right pad">
                                                    <input type="date" class="form-control form text-right  tiktinvdt"
                                                           style="color:red;background-color:white" name="tiktinvdt"
                                                           value="<?php echo ($addflag != 1) ? $get["tiktinvdt"] : ""; ?>">
                                                </div>
                                            </div>

                                            <div class="row">
                                                <div class="col-lg-3 text-right pad">
                                                    <label class="label-control marg" style="color:red">Amount</label>

                                                </div>
                                                <div class="col-lg-2 text-right pad">
                                                    <input type="text" class="form-control form text-right  tiktpuramt"
                                                           style="color:red;background-color:white" name="tiktpuramt"
                                                           value="<?php echo ($addflag != 1) ? $get["tiktpuramt"] : ""; ?>">
                                                </div>
                                            </div>
                                        </div>

                                        <div>
                                            <button type="button" align="left" id='print'
                                                    class="btn btn-pad btn-square sknewbtn tiktpurch"
                                                    style="margin-right: 63%;">
                                                Ticket & Airline Purchase
                                            </button>

                                            <a align="right" id='print'
                                               style="display: none;background-image: linear-gradient(135deg, #3C8CE7 10%, #00EAFF 100%) !important;color:white !important;"
                                               class="btn btn-pad btn-square skbtn tiktprint"
                                               href="tickairent_print.php?vouchno=<?= $qvouch; ?>&para=<?= $para ?>&image=Yes"
                                               target="_blank">
                                                <i class="fa fa-image"></i>
                                            </a>
                                            <a align="right" id='print'
                                               style="display: none;background-image: linear-gradient(135deg, #3C8CE7 10%, #00EAFF 100%) !important;color:white !important;"
                                               class="btn btn-pad btn-square skbtn tiktprint"
                                               href="tickairent_print.php?vouchno=<?= $qvouch; ?>&para=<?= $para ?>&image=No"
                                               target="_blank">
                                                <i class="fa fa-print"></i>
                                            </a>
                                            <a align="right" id='print' class="btn btn-pad btn-square skbtn tiktvouch"
                                               href="#">
                                                Ticket & Airline Voucher
                                            </a>
                                        </div>

                                    </div>

                                    <div class="tab-pane fade" id="tab5default">

                                        <div class="row" style="padding-left:2%">

                                            <table class="table table-bordered" style="width: 90%">
                                                <thead>
                                                    <tr class="mySearchTr">
                                                        <th style="width:2%"></th>
                                                        <th style="width:3%">Sr.</th>
                                                        <th style="width:20%">Country</th>
                                                        <th style="width:5%" class='text-right'>No. Pax</th>
                                                        <th style="width:5%" class='text-right'>Rate</th>
                                                        <th style="width:7%" class='text-right'>Amount</th>
                                                        <th style="width:10%">Visa Type</th>
                                                        <th style="width:15%">Validity</th>
                                                        <th style="width:15%">Group Code</th>
                                                        <th style="width:10%">Visa Travel Date</th>
                                                    </tr>

                                                </thead>
                                                <tbody class="visabody">
                                                    <?php
                                                    if ($addflag != 1) {
                                                        $vctr = 0;
                                                        $getvisadtl = mysqli_query($conn, "SELECT * FROM `$visadb` WHERE vouchno ='$get[vouchno]' order by srno") or die(mysqli_error($conn));
                                                        while ($fetvisa = mysqli_fetch_array($getvisadtl)) {
                                                            $getho = mysqli_query($conn, "SELECT `code`,`country` FROM `visamain` WHERE code='$fetvisa[country]'") or die(mysqli_error($conn));
                                                            $fetho = mysqli_fetch_array($getho);
                                                            echo "<tr>";
                                                            echo "<td style='text-align:center'><i class='fa fa-close remove' style='display:none;'></i></td>";

                                                            echo "<td><input type='text' name='vsrno_$vctr' value='$fetvisa[srno]' class='form-control form'></td>";
                                                            echo "<td>";
                                                            echo "<select class='form-control form vcountry select2' name='vcountry_$vctr' style='width:100%'  >";
                                                            echo "<option value='$fetho[code]'>$fetho[country]</option>";
                                                            echo "<option value=''></option>";
                                                            $git = mysqli_query($conn, "SELECT `code`,`country` FROM `visamain` ORDER BY `country`") or die(mysqli_error($conn));
                                                            while ($itm = mysqli_fetch_array($git)) {
                                                                echo "<option value='$itm[code]'>$itm[country]</option>";
                                                            }

                                                            echo "</select>";

                                                            echo "</td>";
                                                            echo "<td><input type='number' name='vnopax_$vctr' value='$fetvisa[nopax]' class='form-control form vnopax text-right'></td>";
                                                            echo "<td><input type='number' name='vrate_$vctr' value='$fetvisa[rate]' class='form-control form vrate text-right'></td>";
                                                            echo "<td><input type='number' name='vamount_$vctr' value='$fetvisa[amount]' class='form-control form vamount text-right' readonly>"
                                                            . "<input type='hidden' name='vroe_$vctr' value='$fetvisa[roe]' class='form-control form vroe text-right'>"
                                                            . "<input type='hidden' name='vinramt_$vctr' value='$fetvisa[inramt]' class='form-control form vinramt text-right'></td>";
                                                            echo "<td><input type='text' name='vtype_$vctr' value='$fetvisa[type]' class='form-control form vtype'>";
                                                            echo "<td><input type='text' name='vvalidity_$vctr' value='$fetvisa[validity]' class='form-control form vvalidity'>";
                                                            echo "<td><input type='text' name='vgroupcode_$vctr' value='$fetvisa[groupcode]' maxlength='15' class='form-control form vgroupcode'>";
                                                            echo "<td><input type='date' name='vtraveldt_$vctr' value='$fetvisa[vtraveldt]'  class='form-control form vtraveldt'>";
                                                            echo "</tr>";
                                                            $vctr++;
                                                        }
                                                    } else {
                                                        echo "<tr>";
                                                        echo "<td style='text-align:center'><i class='fa fa-close remove' ></i></td>";

                                                        echo "<td><input type='text' name='vsrno_0' value='1' class='form-control form'></td>";
                                                        echo "<td>";
                                                        echo "<select class='form-control form vcountry select2' name='vcountry_0' style='width:100%'  >";
                                                        echo "<option value=''></option>";
                                                        $git = mysqli_query($conn, "SELECT `code`,`country` FROM `visamain` ORDER BY `country`") or die(mysqli_error($conn));
                                                        while ($itm = mysqli_fetch_array($git)) {
                                                            echo "<option value='$itm[code]'>$itm[country]</option>";
                                                        }
                                                        echo "</select>";
                                                        echo "</td>";

                                                        echo "<td><input type='number' name='vnopax_0' value='0' class='form-control form vnopax text-right'></td>";
                                                        echo "<td><input type='number' name='vrate_0' value='0' class='form-control form vrate text-right'></td>";
                                                        echo "<td><input type='number' name='vamount_0' value='0' class='form-control form vamount text-right' readonly>"
                                                        . "<input type='hidden' name='vroe_0' value='0' class='form-control form vroe text-right'>"
                                                        . "<input type='hidden' name='vinramt_0' value='0' class='form-control form vinramt text-right'></td>";
                                                        echo "<td><input type='text' name='vtype_0' value='' class='form-control form vtype' >";
                                                        echo "<td><input type='text' name='vvalidity_0' value='' class='form-control form vvalidity' >";
                                                        echo "<td><input type='text' name='vgroupcode_0' value='' maxlength='15' class='form-control form vgroupcode' >";
                                                        echo "<td><input type='date' name='vtraveldt_0' value='' maxlength='15' class='form-control form vtraveldt' >";
                                                        echo "</tr>";
                                                    }
                                                    ?>
                                                <input type="hidden" name="visacnt" id="visacnt"
                                                       value="<?php echo ($addflag != 1) ? $vctr : 1 ?>">
                                                </tbody>

                                            </table>

                                        </div>

                                        <button type="button" class="btn btn-primary btn-square form" id="addvisa">
                                            <i class="fa fa-plus" data-toggle='tooltip' title='Add Row'></i>
                                        </button>
                                        <div class="row">
                                            <div class="col-lg-1 col-md-1 col-sm-3 col-xs-3 text-right pad">
                                                <label class="label-control marg"
                                                       style="color:#2FBFFE;font-weight:bold">Approve</label>
                                            </div>
                                            <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 pad">
                                                <input type="checkbox" class="form-control form visaaprov" <?php
                                                if ($get['visaaprov'] == "1") {
                                                    echo "checked";
                                                }
                                                ?> value="1"
                                                       name="visaaprov">
                                            </div>
                                            <div class="col-lg-1  pad">
                                                <label class="label-control marg">Total</label>
                                            </div>

                                            <div class="col-lg-1" style="margin-left: -52px;">
                                                <input type="text" class="form-control form text-right  visapax"
                                                       name="visapax"
                                                       value="<?php echo ($addflag != 1) ? $get["visapax"] : ""; ?>"
                                                       readonly>
                                            </div>

                                            <div class="col-lg-2" style="width:14%;margin-left: 115px;">
                                                <input type="text" class="form-control form text-right  visaamt"
                                                       name="visaamt"
                                                       value="<?php echo ($addflag != 1) ? $get["visaamt"] : ""; ?>"
                                                       readonly>
                                            </div>
                                        </div>
                                        <div style="background-color:#E3F2E1;width: 50%;display: none;" class="pvisa">

                                            <div class="row">
                                                <div class="col-lg-3 text-right pad">
                                                    <label class="label-control marg" style="color:red">Supplier</label>
                                                </div>
                                                <div class="col-lg-6 adjcolj pad">
                                                    <select name="visasupp" class="form-control form pad visasupp"
                                                            style="color:red;background-color:white;">
                                                        <option
                                                            value="<?php echo ($addflag != 1) ? $get["visasupp"] : ""; ?>">
                                                                <?php echo ($addflag != 1) ? $fetvsupp["name"] : ""; ?>
                                                        </option>
                                                        <?php
                                                        $gnm = mysqli_query($conn, "SELECT `accode`,`name` FROM `accmast` where grpcode = '009' ORDER BY `name`") or die(mysqli_error($conn));
                                                        while ($fnm = mysqli_fetch_array($gnm)) {
                                                            echo "<option value='$fnm[accode]'>$fnm[name]</option>";
                                                        }
                                                        ?>

                                                    </select>
                                                </div>
                                            </div>
                                            <div class="row">
                                                <div class="col-lg-3 text-right pad">
                                                    <label class="label-control marg" style="color:red">Invoice
                                                        No.</label>
                                                </div>
                                                <div class="col-lg-2 adjcolj pad">
                                                    <input type="text" class="form-control form text-right  visainvno"
                                                           style="color:red;background-color:white" name="visainvno"
                                                           value="<?php echo ($addflag != 1) ? $get["visainvno"] : ""; ?>">
                                                </div>
                                                <div class="col-lg-2 text-right pad">
                                                    <label class="label-control marg" style="color:red">Invoice
                                                        Date</label>

                                                </div>
                                                <div class="col-lg-2 text-right pad">
                                                    <input type="date" class="form-control form text-right  visainvdt"
                                                           style="color:red;background-color:white" name="visainvdt"
                                                           value="<?php echo ($addflag != 1) ? $get["visainvdt"] : ""; ?>">
                                                </div>
                                            </div>
                                            <div class="row">
                                                <div class="col-lg-3 text-right pad">
                                                    <label class="label-control marg" style="color:red">Rate</label>
                                                </div>
                                                <div class="col-lg-2 adjcolj pad">
                                                    <input type="text" class="form-control form text-right  visarate"
                                                           style="color:red;background-color:white" name="visarate"
                                                           value="<?php echo ($addflag != 1) ? $get["visarate"] : ""; ?>">
                                                </div>
                                                <div class="col-lg-2 text-right pad">
                                                    <label class="label-control marg" style="color:red">Amount</label>
                                                </div>
                                                <div class="col-lg-2 text-right pad">
                                                    <input type="text" class="form-control form text-right  visapuramt"
                                                           style="color:red;background-color:white" name="visapuramt"
                                                           value="<?php echo ($addflag != 1) ? $get["visapuramt"] : ""; ?>">
                                                </div>
                                            </div>
                                        </div>

                                        <div>
                                            <button type="button" align="left" id='print'
                                                    class="btn btn-pad btn-square sknewbtn visapurch"
                                                    style="margin-right: 36%">
                                                Visa Purchase
                                            </button>
                                            <a align="right" id='print' class="btn btn-pad btn-square skbtn visaprint"
                                               href="visaent_print.php?vouchno=<?= $qvouch; ?>&para=<?= $para ?>&image=Yes"
                                               target="_blank"
                                               style="display: none;background-image: linear-gradient(135deg, #3C8CE7 10%, #00EAFF 100%) !important;color:white !important;">
                                                <i class="fa fa-image"></i>
                                            </a>
                                            <a align="right" id='print' class="btn btn-pad btn-square skbtn visaprint"
                                               href="visaent_print.php?vouchno=<?= $qvouch; ?>&para=<?= $para ?>&image=No"
                                               target="_blank"
                                               style="display: none;background-image: linear-gradient(135deg, #3C8CE7 10%, #00EAFF 100%) !important;color:white !important;">
                                                <i class="fa fa-print"></i>
                                            </a>
                                            <a align="right" id='print' class="btn btn-pad btn-square skbtn visavouch"
                                               href="#">
                                                Visa Voucher
                                            </a>
                                        </div>
                                    </div>

                                    <!--</div>-->
                                    <div class="tab-pane fade " id="tab6default">

                                        <div class="row" style="padding-left:2%">

                                            <table class="table table-bordered" style="width: 99%">
                                                <thead>
                                                    <tr class="mySearchTr">
                                                        <th style="width:2%"></th>
                                                        <th style="width:3%">Sr.</th>
                                                        <th style="width:7%">Type</th>
                                                        <th style="width:13%">From</th>
                                                        <th style="width:13%">To</th>
                                                        <th style="width:10%">Pick Up Time</th>
                                                        <th style="width:10%">Vehicle</th>
                                                        <th style="width:5%" class='text-right'>No. Pax</th>
                                                        <th style="width:7%" class='text-right'>No. Vehicle</th>
                                                        <th style="width:6%" class='text-right'>Rate</th>
                                                        <th style="width:8%" class='text-right'>Amount</th>
                                                        <th style="width:8%" class='text-right'>CNF No.</th>
                                                        <th style="width:25%">Description</th>
                                                    </tr>

                                                </thead>
                                                <tbody class="transbody">
                                                    <?php
                                                    $mintranscurdate = date("Y-m-d\TH:i");

                                                    if ($addflag != 1) {
                                                        $rctr = 0;
                                                        $gettransdtl = mysqli_query($conn, "Select * from `$transdb` where vouchno ='$get[vouchno]' order by srno") or die(mysqli_error($conn));
                                                        while ($fettrans = mysqli_fetch_array($gettransdtl)) {


                                                            if ($fettrans['picktype'] == "D") {
                                                                $flttypen = "Departure";
                                                            } elseif ($fettrans['picktype'] == "A") {
                                                                $flttypen = "Arrival";
                                                            } elseif ($fettrans['picktype'] == "I") {
                                                                $flttypen = "Internal";
                                                            } else {
                                                                $flttypen = "";
                                                            }


                                                            // Transportation section starts from here
                                                            $getveh = mysqli_query($conn, "SELECT `code`,`vehtype` FROM `vehicle` where code='$fettrans[vehicle]'") or die(mysqli_error($conn));
                                                            $fetveh = mysqli_fetch_array($getveh);
                                                            echo "<tr>";
                                                            echo "<td style='text-align:center'><i class='fa fa-close remove' style='display:none;'></i></td>";

                                                            echo "<td><input type='text' name='rsrno_$rctr' value='$fettrans[srno]' class='form-control form'></td>";
                                                            echo "<td>";
                                                            echo "<select class='form-control form picktype select2' name='picktype_$rctr' style='width:100%'  >";
                                                            echo "<option value='$fettrans[picktype]'>$flttypen</option>";
                                                            echo "<option value='A'>Arrival</option>";
                                                            echo "<option value='I'>Internal</option>";
                                                            echo "<option value='D'>Departure</option>";

                                                            echo "</select>";
                                                            echo "</td>";
                                                            echo "<td>";
                                                            echo "<input list='rfrom' name='rfrom_$rctr' class='rfrom form-control form ' autocomplete='off' value='$fettrans[fromplace]'> ";
                                                            echo "<datalist id='rfrom' char='#'>";
                                                            echo "<option>";

                                                            $msi = mysqli_query($conn, "SELECT `fromplace` FROM `transent` group by fromplace") or die(mysqli_error($conn));

                                                            while ($tsi = mysqli_fetch_array($msi)) {
                                                                $szname = $tsi['fromplace'];
                                                                echo "<option value='$szname'>";
                                                            }
                                                            echo "</datalist>";
                                                            echo "</td>";
                                                            echo "<td>";
                                                            echo "<input list='rto' name='rto_$rctr' class='rto form-control form ' autocomplete='off' value='$fettrans[toplace]'> ";
                                                            echo "<datalist id='rto' char='#'>";
                                                            echo "<option>";

                                                            $msi2 = mysqli_query($conn, "SELECT `toplace` FROM `transent` group by toplace") or die(mysqli_error($conn));

                                                            while ($tsi2 = mysqli_fetch_array($msi2)) {
                                                                $szname2 = $tsi2['toplace'];
                                                                echo "<option value='$szname2'>";
                                                            }
                                                            echo "</datalist>";
                                                            echo "</td>";
                                                            echo "<td><input type='datetime-local' name='rpickuptime_$rctr' value='$fettrans[pickuptime]' class='form-control form rpickuptime'></td>";
                                                            echo "<td>";
                                                            echo "<select class='form-control form rvehicle select2' name='rvehicle_$rctr' style='width:100%'  >";
                                                            echo "<option value='$fetveh[code]'>$fetveh[vehtype]</option>";
                                                            $git = mysqli_query($conn, "SELECT `code`,`vehtype` FROM `vehicle` ORDER BY `vehtype`") or die(mysqli_error($conn));
                                                            while ($itm = mysqli_fetch_array($git)) {
                                                                echo "<option value='$itm[code]'>$itm[vehtype]</option>";
                                                            }
                                                            echo "</select>";
                                                            echo "</td>";
                                                            echo "<td><input type='number' name='rnopax_$rctr' value='$fettrans[nopax]' class='form-control form rnopax text-right'></td>";
                                                            echo "<td><input type='number' name='rnoveh_$rctr' value='$fettrans[noveh]' class='form-control form rnoveh text-right'></td>";
                                                            echo "<td><input type='number' name='rrate_$rctr' value='$fettrans[rate]' class='form-control form rrate text-right'></td>";
                                                            echo "<td><input type='number' name='ramount_$rctr' value='$fettrans[amount]' class='form-control form ramount text-right' readonly>"
                                                            . "<input type='hidden' name='rroe_$rctr' value='$fettrans[roe]' class='form-control form rroe text-right'>"
                                                            . "<input type='hidden' name='rinramt_$rctr' value='$fettrans[inramt]' class='form-control form rinramt text-right'></td>";
                                                            echo "<td><input type='text' name='rcnfno_$rctr' value='$fettrans[cnfno]' class='form-control form rcnfno'></td>";
                                                            echo "<td><input type='text' name='rdescrip_$rctr' value='$fettrans[descrip]' class='form-control form rdescrip'></td>";

                                                            echo "</tr>";
                                                            $rctr++;
                                                        }
                                                    } else {
                                                        echo "<tr>";
                                                        echo "<td style='text-align:center'><i class='fa fa-close remove' ></i></td>";

                                                        echo "<td><input type='text' name='rsrno_0' value='1' class='form-control form'></td>";
                                                        echo "<td>";
                                                        echo "<select class='form-control form picktype select2' name='picktype_0' style='width:100%'  >";
                                                        echo "<option value=''></option>";
                                                        echo "<option value='A'>Arrival</option>";
                                                        echo "<option value='I'>Internal</option>";
                                                        echo "<option value='D'>Departure</option>";

                                                        echo "</select>";
                                                        echo "</td>";
                                                        echo "<td>";
                                                        echo "<input list='rfrom' name='rfrom_0' class='rfrom form-control form ' autocomplete='off' value=''> ";
                                                        echo "<datalist id='rfrom' char='#'>";
                                                        echo "<option>";

                                                        $msi = mysqli_query($conn, "SELECT `fromplace` FROM `transent` group by fromplace") or die(mysqli_error($conn));

                                                        while ($tsi = mysqli_fetch_array($msi)) {
                                                            $szname = $tsi['fromplace'];
                                                            echo "<option value='$szname'>";
                                                        }
                                                        echo "</datalist>";
                                                        echo "</td>";
                                                        echo "<td>";
                                                        echo "<input list='rto' name='rto_0' class='rto form-control form ' autocomplete='off' value=''> ";
                                                        echo "<datalist id='rto' char='#'>";
                                                        echo "<option>";

                                                        $msi2 = mysqli_query($conn, "SELECT `toplace` FROM `transent` group by toplace") or die(mysqli_error($conn));

                                                        while ($tsi2 = mysqli_fetch_array($msi2)) {
                                                            $szname2 = $tsi2['toplace'];
                                                            echo "<option value='$szname2'>";
                                                        }
                                                        echo "</datalist>";
                                                        echo "</td>";
                                                        echo "<td><input type='datetime-local' name='rpickuptime_0' value=''  class='form-control form rpickuptime'></td>";
                                                        echo "<td>";
                                                        echo "<select class='form-control form rvehicle select2' name='rvehicle_0' style='width:100%'  >";
                                                        echo "<option value=''></option>";
                                                        $git = mysqli_query($conn, "SELECT `code`,`vehtype` FROM `vehicle` ORDER BY `vehtype`") or die(mysqli_error($conn));
                                                        while ($itm = mysqli_fetch_array($git)) {
                                                            echo "<option value='$itm[code]'>$itm[vehtype]</option>";
                                                        }
                                                        echo "</select>";
                                                        echo "</td>";
                                                        echo "<td><input type='number' name='rnopax_0' value='0' class='form-control form rnopax text-right'></td>";
                                                        echo "<td><input type='number' name='rnoveh_0' value='0' class='form-control form rnoveh text-right'></td>";
                                                        echo "<td><input type='number' name='rrate_0' value='0' class='form-control form rrate text-right'></td>";
                                                        echo "<td><input type='number' name='ramount_0' value='0' class='form-control form ramount text-right' readonly>"
                                                        . "<input type='hidden' name='rroe_0' value='0' class='form-control form rroe text-right'>"
                                                        . "<input type='hidden' name='rinramt_0' value='0' class='form-control form rinramt text-right'></td>";
                                                        echo "<td><input type='text' name='rcnfno_$rctr' value='$fettrans[cnfno]' class='form-control form rcnfno'></td>";

                                                        echo "<td><input type='text' name='rdescrip_0' value='' class='form-control form rdescrip'></td>";

                                                        echo "</tr>";
                                                    }
                                                    ?>
                                                </tbody>
                                                <input type="hidden" name="transcnt" id="transcnt"
                                                       value="<?php echo ($addflag != 1) ? $rctr : 1 ?>">

                                            </table>

                                        </div>

                                        <button type="button" class="btn btn-primary btn-square form" id="addtrans">
                                            <i class="fa fa-plus" data-toggle='tooltip' title='Add Row'></i>
                                        </button>


                                        <div class="row">
                                            <div class="col-lg-1 col-md-1 col-sm-3 col-xs-3 text-right pad">
                                                <label class="label-control marg"
                                                       style="color:#2FBFFE;font-weight:bold">Approve</label>
                                            </div>
                                            <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 pad">
                                                <input type="checkbox" class="form-control form transaprov" <?php
                                                if ($get['transaprov'] == "1") {
                                                    echo "checked";
                                                }
                                                ?> value="1"
                                                       name="transaprov">
                                            </div>

                                            <div class="col-lg-4 text-right pad">
                                                <label class="label-control marg">Total</label>
                                            </div>
                                            <div class="col-lg-1 adjcol2">
                                                <input type="text" class="form-control form text-right  transpax"
                                                       name="transpax"
                                                       value="<?php echo ($addflag != 1) ? $get["transpax"] : ""; ?>"
                                                       readonly>
                                            </div>
                                            <div class="col-lg-1">
                                                <input type="text" class="form-control form text-right transveh"
                                                       name="transveh"
                                                       value="<?php echo ($addflag != 1) ? $get["transveh"] : ""; ?>"
                                                       readonly>
                                            </div>
                                            <div class="col-lg-1 text-right">
                                                <label class="label-control marg">FE</label>
                                            </div>

                                            <div class="col-lg-1 adjcolh2" style="">
                                                <input type="text" class="form-control form text-right  transamt"
                                                       name="transamt"
                                                       value="<?php echo ($addflag != 1) ? $get["transamt"] : ""; ?>"
                                                       readonly>
                                            </div>

                                            <div class="col-lg-1 text-right pad" style='width:20px;color: blue'>
                                                <label class="label-control marg"><b>INR</b></label>
                                            </div>

                                            <div class="col-lg-1 adjcolh2">
                                                <input type="text" class="form-control form text-right  transinramt"
                                                       name="transinramt"
                                                       value="<?php echo ($addflag != 1) ? $get["transinramt"] : ""; ?>"
                                                       readonly style="width:170px;color: blue">
                                            </div>
                                        </div>

                                        <br>
                                        <div class="row">
                                            <table class="table table-bordered" style="width:50%">
                                                <thead>
                                                    <tr class="mySearchTr2">
                                                        <th style="width:10%">CNF No.</th>
                                                        <th style="width:15%">Type</th>
                                                        <th style="width:15%">Flight Arrival/Departure</th>
                                                        <th style="width:10%">Flight Sector</th>
                                                        <th style="width:10%">Flight No.</th>
                                                    </tr>
                                                </thead>
                                                <tbody class="ftldetbody">
                                                    <?php
                                                    if ($addflag != 1) {
                                                        $rfctr = 0;
                                                        $gettransfltdtl = mysqli_query($conn, "Select * from `$transfltdet` where vouchno ='$get[vouchno]' order by srno") or die(mysqli_error($conn));
                                                        while ($fettransflt = mysqli_fetch_array($gettransfltdtl)) {

                                                            if ($fettransflt['flttype'] == "D") {
                                                                $flttype = "Departure";
                                                            } elseif ($fettransflt['flttype'] == "A") {
                                                                $flttype = "Arrival";
                                                            } else {
                                                                $flttype = "";
                                                            }
                                                            echo "<tr>";
                                                            echo "<td><input type='text' name='rfcnfno_$rfctr' value='$fettransflt[cnfno]' class='form-control form'></td>";
                                                            echo "<td>";
                                                            echo "<select class='form-control form rftype select2' name='rftype_$rfctr' style='width:100%'  >";
                                                            echo "<option value='$fettransflt[flttype]'>$flttype</option>";
                                                            echo "<option value='A'>Arrival</option>";
                                                            echo "<option value='D'>Departure</option>";

                                                            echo "</select>";
                                                            echo "</td>";

                                                            echo "<td><input type='datetime-local' name='rflttime_$rfctr' value='$fettransflt[flttime]' class='form-control form rflttime'></td>";
                                                            echo "<td><input type='text' name='rfsector_$rfctr' value='$fettransflt[sector]' class='form-control form rfsector'></td>";
                                                            echo "<td><input type='text' name='rfltno_$rfctr' value='$fettransflt[fltno]' class='form-control form rfltno'></td>";

                                                            echo "</tr>";
                                                            $rfctr++;
                                                        }
                                                    } else {
                                                        echo "<tr>";
                                                        echo "<td><input type='text' name='rfcnfno_0' value='' class='form-control form'></td>";
                                                        echo "<td>";
                                                        echo "<select class='form-control form rftype select2' name='rftype_0' style='width:100%'  >";
                                                        echo "<option value=''></option>";
                                                        echo "<option value='A'>Arrival</option>";
                                                        echo "<option value='D'>Departure</option>";

                                                        echo "</select>";
                                                        echo "</td>";

                                                        echo "<td><input type='datetime-local' name='rflttime_0' value='' class='form-control form rflttime'></td>";
                                                        echo "<td><input type='text' name='rfsector_0' value='' class='form-control form rfsector'></td>";
                                                        echo "<td><input type='text' name='rfltno_0' value='' class='form-control form rfltno'></td>";

                                                        echo "</tr>";
                                                    }
                                                    ?>
                                                </tbody>
                                                <input type="hidden" name="tfcnt" id="tfcnt"
                                                       value="<?php echo ($addflag != 1) ? $rctr : 1 ?>">

                                            </table>

                                        </div>

                                        <button type="button" class="btn btn-primary btn-square form" id="addtransflt">
                                            <i class="fa fa-plus" data-toggle='tooltip' title='Add Row'></i>
                                        </button>


                                        <div style="background-color:#E3F2E1;width: 50%;display:none" class="trans">

                                            <div class="row">
                                                <div class="col-lg-3 text-right pad">
                                                    <label class="label-control marg" style="color:red">Supplier</label>
                                                </div>
                                                <div class="col-lg-6 adjcolj pad">
                                                    <select name="transsupp" class="form-control form pad transsupp"
                                                            style="color:red;background-color:white;">
                                                        <option
                                                            value="<?php echo ($addflag != 1) ? $get["transsupp"] : ""; ?>">
                                                                <?php echo ($addflag != 1) ? $fettrsupp["name"] : ""; ?>
                                                        </option>
                                                        <?php
                                                        $gnm = mysqli_query($conn, "SELECT `accode`,`name` FROM `accmast` where grpcode = '009' ORDER BY `name`") or die(mysqli_error($conn));
                                                        while ($fnm = mysqli_fetch_array($gnm)) {
                                                            echo "<option value='$fnm[accode]'>$fnm[name]</option>";
                                                        }
                                                        ?>

                                                    </select>
                                                </div>
                                            </div>
                                            <div class="row">
                                                <div class="col-lg-3 text-right pad">
                                                    <label class="label-control marg" style="color:red">Invoice
                                                        No.</label>
                                                </div>
                                                <div class="col-lg-2 adjcolj pad">
                                                    <input type="text" class="form-control form text-right  transinvno"
                                                           style="color:red;background-color:white" name="transinvno"
                                                           value="<?php echo ($addflag != 1) ? $get["transinvno"] : ""; ?>">
                                                </div>
                                                <div class="col-lg-2 text-right pad">
                                                    <label class="label-control marg" style="color:red">Invoice
                                                        Date</label>

                                                </div>
                                                <div class="col-lg-2 text-right pad">
                                                    <input type="date" class="form-control form text-right  transinvdt"
                                                           style="color:red;background-color:white" name="transinvdt"
                                                           value="<?php echo ($addflag != 1) ? $get["transinvdt"] : ""; ?>">
                                                </div>
                                            </div>
                                            <div class="row">
                                                <div class="col-lg-3 text-right pad">
                                                    <label class="label-control marg" style="color:red">Rate</label>
                                                </div>
                                                <div class="col-lg-2 adjcolj pad">
                                                    <input type="text" class="form-control form text-right  transrate"
                                                           style="color:red;background-color:white" name="transrate"
                                                           value="<?php echo ($addflag != 1) ? $get["transrate"] : ""; ?>">
                                                </div>
                                                <div class="col-lg-2 text-right pad">
                                                    <label class="label-control marg" style="color:red">Amount</label>

                                                </div>
                                                <div class="col-lg-2 text-right pad">
                                                    <input type="text" class="form-control form text-right  transpuramt"
                                                           style="color:red;background-color:white" name="transpuramt"
                                                           value="<?php echo ($addflag != 1) ? $get["transpuramt"] : ""; ?>">
                                                </div>
                                            </div>
                                        </div>

                                        <div>
                                            <button type="button" align="left" id='print'
                                                    class="btn btn-pad btn-square sknewbtn transpurch"
                                                    style="margin-right: 63%;">
                                                Transportation Purchase
                                            </button>
                                            <a align="right" id='print'
                                               style="display: none;background-image: linear-gradient(135deg, #3C8CE7 10%, #00EAFF 100%) !important;color:white !important;"
                                               class="btn btn-pad btn-square skbtn transprint"
                                               href="transportent_print.php?vouchno=<?= $qvouch; ?>&para=<?= $para ?>&image=Yes"
                                               target="_blank">
                                                <i class="fa fa-image"></i>
                                            </a>
                                            <a align="right" id='print'
                                               style="display: none;background-image: linear-gradient(135deg, #3C8CE7 10%, #00EAFF 100%) !important;color:white !important;"
                                               class="btn btn-pad btn-square skbtn transprint"
                                               href="transportent_print.php?vouchno=<?= $qvouch; ?>&para=<?= $para ?>&image=No"
                                               target="_blank">
                                                <i class="fa fa-print"></i>
                                            </a>
                                            <a align="right" id='print' class="btn btn-pad btn-square skbtn transvouch"
                                               href="#">
                                                Transportation Voucher
                                            </a>
                                        </div>
                                    </div>

                                    <div class="tab-pane fade " id="tab7default">

                                        <div class="row marrchk">
                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                <label class="label-control marg">Married</label>
                                            </div>

                                            <div class="col-lg-1 adjcol">
                                                <input type="checkbox" class="form  chkmarried" id="chkmarried"
                                                       name="chkmarried" style="opacity: 1; height:15px; width:15px"
                                                       value="T" <?
                                                       if ($get['married'] == 'T') {
                                                           echo "checked";
                                                       }
                                                       ?>>
                                            </div>
                                        </div>
                                        <div class="row marrcol">
                                            <div class="col-lg-1 text-right col-md-3 col-sm-3 col-xs-3 ">
                                                <label class="label-control marg">Surname</label>
                                            </div>
                                            <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad ">
                                                <input type="text" class="form-control form " name="married_surname"
                                                       value="<?php echo ($addflag != 1) ? $famdet["surname"] : ""; ?>">
                                            </div>
                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right">
                                                <label class="label-control marg">Name</label>
                                            </div>
                                            <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad ">
                                                <input type="text" class="form-control form " name="married_name"
                                                       value="<?php echo ($addflag != 1) ? $famdet["name"] : ""; ?>">
                                            </div>
                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3  text-right pad">
                                                <label class="label-control marg">Middle Name</label>
                                            </div>
                                            <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad ">
                                                <input type="text" class="form-control form " name="married_midname"
                                                       value="<?php echo ($addflag != 1) ? $famdet["midname"] : ""; ?>">
                                            </div>
                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad ">
                                                <label class="label-control marg">Relation</label>
                                            </div>
                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 pad ">

                                                <select name="married_relation" class="form-control form pad ">
                                                    <option
                                                        value="<?php echo ($addflag != 1) ? $famdet["relation"] : ""; ?>">
                                                            <?php echo ($addflag != 1) ? $famdet["relation"] : ""; ?>
                                                    </option>
                                                    <option value="Husband">Husband</option>
                                                    <option value="Wife">Wife</option>

                                                </select>
                                            </div>
                                        </div>

                                        <div class="row not_married">
                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right">
                                                <label class="label-control marg">Surname</label>
                                            </div>
                                            <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad ">
                                                <input type="text" class="form-control form " name="not_married_surname"
                                                       value="<?php echo ($addflag != 1) ? $famdet1["surname"] : ""; ?>">
                                            </div>
                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right">
                                                <label class="label-control marg">Name</label>
                                            </div>
                                            <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad ">
                                                <input type="text" class="form-control form " name="not_married_name"
                                                       value="<?php echo ($addflag != 1) ? $famdet1["name"] : ""; ?>">
                                            </div>
                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3  text-right pad">
                                                <label class="label-control marg">Middle Name</label>
                                            </div>
                                            <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad ">
                                                <input type="text" class="form-control form " name="not_married_midname"
                                                       value="<?php echo ($addflag != 1) ? $famdet1["midname"] : ""; ?>">
                                            </div>
                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad ">
                                                <label class="label-control marg">Relation</label>
                                            </div>
                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 pad ">

                                                <select name="not_married_relation" class="form-control form pad ">
                                                    <option
                                                        value="<?php echo ($addflag != 1) ? $famdet1["relation"] : ""; ?>">
                                                            <?php echo ($addflag != 1) ? $famdet1["relation"] : ""; ?>
                                                    </option>
                                                    <option value="Father">Father</option>
                                                </select>
                                            </div>
                                        </div>

                                        <div class="row not_married">
                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right">
                                                <label class="label-control marg">Surname</label>
                                            </div>
                                            <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad ">
                                                <input type="text" class="form-control form "
                                                       name="not_married_surname2"
                                                       value="<?php echo ($addflag != 1) ? $fd2["surname"] : ""; ?>">
                                            </div>
                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right">
                                                <label class="label-control marg">Name</label>
                                            </div>
                                            <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad ">
                                                <input type="text" class="form-control form " name="not_married_name2"
                                                       value="<?php echo ($addflag != 1) ? $fd2["name"] : ""; ?>">
                                            </div>
                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3  text-right pad">
                                                <label class="label-control marg">Middle Name</label>
                                            </div>
                                            <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad ">
                                                <input type="text" class="form-control form "
                                                       name="not_married_midname2"
                                                       value="<?php echo ($addflag != 1) ? $fd2["midname"] : ""; ?>">
                                            </div>
                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad ">
                                                <label class="label-control marg">Relation</label>
                                            </div>
                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 pad ">

                                                <select name="not_married_relation2" class="form-control form pad ">
                                                    <option
                                                        value="<?php echo ($addflag != 1) ? $fd2["relation"] : ""; ?>">
                                                        <?php echo ($addflag != 1) ? $fd2["relation"] : ""; ?></option>
                                                    <option value="Mother">Mother</option>
                                                </select>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="tab-pane fade " id="tab8default">

                                        <div class="row">
                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right">
                                                <label class="label-control marg">Pax Name</label>
                                            </div>
                                            <div class="col-lg-2 col-md-8 col-sm-8 col-xs-8 pad ">
                                                <input type="text" class="form-control form  pay_pax_name"
                                                       name="pay_pax_name"
                                                       value="<?php echo ($addflag != 1) ? $fpd["pname"] : ""; ?>"
                                                       readonly>
                                            </div>
                                            <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 text-right">
                                                <label class="label-control marg">Account Holder Name</label>
                                            </div>
                                            <div class="col-lg-2  col-md-8 col-sm-8 col-xs-8 pad ">
                                                <input type="text" class="form-control form " name="pay_send_name"
                                                       value="<?php echo ($addflag != 1) ? $fpd["sname"] : ""; ?>">
                                            </div>
                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad adjcolh2">
                                                <label class="label-control marg">Relation</label>
                                            </div>
                                            <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad adjcolh2">

                                                <select name="pay_relation" class="form-control form nominee_relation ">
                                                    <option
                                                        value="<?php echo ($addflag != 1) ? $fetpdrela["code"] : ""; ?>">
                                                            <?php echo ($addflag != 1) ? $fetpdrela["name"] : ""; ?>
                                                    </option>
                                                    <?php
                                                    $qpdrela = mysqli_query($conn, "SELECT `code`,`name` FROM $zroot.relation ORDER BY NAME") or die(mysqli_error($conn));
                                                    while ($fpdrela = mysqli_fetch_array($qpdrela)) {
                                                        echo "<option value='$fpdrela[code]'>$fpdrela[name]</option>";
                                                    }
                                                    ?>
                                                </select>
                                            </div>
                                        </div>

                                        <div class="row">
                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right">
                                                <label class="label-control marg">Account No.</label>
                                            </div>
                                            <div class="col-lg-2 col-md-8 col-sm-8 col-xs-8 pad ">
                                                <input type="text" class="form-control form " name="pay_accno"
                                                       value="<?php echo ($addflag != 1) ? $fpd["accno"] : ""; ?>">
                                            </div>

                                            <div class="col-lg-2 col-md-2 col-sm-2 col-xs-3 text-right ">
                                                <label class="label-control marg">Branch</label>
                                            </div>
                                            <div class="col-lg-2 col-md-8 col-sm-8 col-xs-8 pad">
                                                <input type="text" class="form-control form " name="pay_branch"
                                                       value="<?php echo ($addflag != 1) ? $fpd["branch"] : ""; ?>">
                                            </div>
                                        </div>

                                        <div class="row">
                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right">
                                                <label class="label-control marg">Date</label>
                                            </div>
                                            <div class="col-lg-2 col-md-4 col-sm-4 col-xs-4 pad">
                                                <input type="date" class="form-control form " name="pay_date"
                                                       value="<?php echo ($addflag != 1) ? $nrpass["date"] : ""; ?>">
                                            </div>
                                            <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 text-right">
                                                <label class="label-control marg">IFSC Code</label>
                                            </div>
                                            <div class="col-lg-2 col-md-8 col-sm-8 col-xs-8 pad ">
                                                <input type="text" class="form-control form " name="pay_ifsc"
                                                       value="<?php echo ($addflag != 1) ? $fpd["ifsc"] : ""; ?>">
                                            </div>
                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right adjcolh2">
                                                <label class="label-control marg">Pax Bank</label>
                                            </div>
                                            <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 pad ">
                                                <input type="text" class="form-control form " name="pay_drawbank"
                                                       value="<?php echo ($addflag != 1) ? $fpd["drawbank"] : ""; ?>">
                                            </div>
                                        </div>

                                        <div class="row">
                                            <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                Payment Mode
                                            </div>
                                            <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                <input type="radio" class="form-control form " name="pmode" <?php
                                                if ($fpd["pmode"] == '1') {
                                                    echo "checked";
                                                }
                                                ?> value="1"
                                                       style="height: 19px">
                                            </div>
                                            <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                One Time
                                            </div>
                                            <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                <input type="radio" class="form-control form " name="pmode" <?php
                                                if ($fpd["pmode"] == '2') {
                                                    echo "checked";
                                                }
                                                ?> value="2"
                                                       style="height: 19px">
                                            </div>
                                            <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                Installment
                                            </div>
                                        </div>

                                        <div class="row">
                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right">&nbsp;
                                            </div>
                                        </div>
                                        <div class="row">
                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right">
                                            </div>
                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right">
                                                <button type="button" id="chq" class="btn btn-default cheque"
                                                        style="padding-top:3px;" name="pay_cheque">
                                                    <h5>Cheque </h5>
                                                </button>
                                            </div>
                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right">
                                            </div>
                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right">
                                                <button type="button" id="rtgs" class="btn btn-default"
                                                        style="padding-top:3px;" name="pay_rtgs">
                                                    <h5>RTGS</h5>
                                                </button>
                                            </div>
                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right">
                                            </div>
                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right">
                                                <button type="button" id="dd" class="btn btn-default"
                                                        style="padding-top:3px;" name="pay_dd">
                                                    <h5>DD </h5>
                                                </button>
                                            </div>
                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right">
                                            </div>
                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right">
                                                <button type="button" id="rec" class="btn btn-default"
                                                        style="padding-top:3px;" name="pay_rec">
                                                    <h5>Received Details</h5>
                                                </button>
                                            </div>


                                        </div>
                                        <div class="row">
                                            <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right">&nbsp;
                                            </div>
                                        </div>
                                        <div id="chq_mod">
                                            <div class="row">
                                                <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right">
                                                    <label class="label-control marg">Cheque No.</label>
                                                </div>
                                                <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad ">
                                                    <input type="text" class="form-control form " name="pay_chequeno"
                                                           value="<?php echo ($addflag != 1) ? $fpd["chequeno"] : ""; ?>">
                                                </div>

                                            </div>
                                        </div>
                                        <div id="rtgs_mod">
                                            <div class="row">
                                                <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right">
                                                    <label class="label-control marg">UTR No.</label>
                                                </div>
                                                <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad ">
                                                    <input type="text" class="form-control form " name="pay_utrno"
                                                           value="<?php echo ($addflag != 1) ? $fpd["utrno"] : ""; ?>">
                                                </div>

                                            </div>
                                        </div>
                                        <div id="dd_mod">
                                            <div class="row">
                                                <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right">
                                                    <label class="label-control marg">DD No.</label>
                                                </div>
                                                <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad ">
                                                    <input type="text" class="form-control form " name="pay_ddno"
                                                           value="<?php echo ($addflag != 1) ? $fpd["ddno"] : ""; ?>">
                                                </div>
                                                <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right">
                                                    <label class="label-control marg">Payable At</label>
                                                </div>
                                                <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad ">
                                                    <input type="text" class="form-control form " name="pay_payat"
                                                           value="<?php echo ($addflag != 1) ? $fpd["payat"] : ""; ?>">
                                                </div>
                                            </div>
                                        </div>
                                        <div id="rec_mod">
                                            <div class="row">
                                                <table class="table table-bordered " style="width:60%;">
                                                    <tr style="color:black" class="mySearcTr">
                                                        <th width='3%' style="color:black;text-align: right"><b>Sr.</b>
                                                        </th>
                                                        <th width='20%' style="color:black"><b>Bank</b></th>
                                                        <th width='15%' style="color:black"><b>RTGS/Draft/Cheque No</b>
                                                        </th>
                                                        <th width='10%' style="color:black" class=""><b>Receipt No.</b>
                                                        </th>
                                                        <th width='10%' style="color:black" class=""><b>Dated</b></th>
                                                        <th width='13%' style="color:black;text-align: right">
                                                            <b>Received Amount</b></th>

                                                    </tr>
                                                    <?php
                                                    $totamt = 0;
                                                    $bctr = $totbamt = $bal = 0;
                                                    ?>

                                                    <tr>
                                                        <td style='font-size: 14px'></td>
                                                        <td style='font-size: 14px'></td>
                                                        <td style='font-size: 14px;'></td>
                                                        <td style='font-size: 14px;'></td>
                                                        <td><b>Total</b></td>
                                                        <td style='font-size: 14px; text-align: right'>
                                                            <b><?= $totamt ?></b></td>
                                                    </tr>

                                                    <tr>
                                                        <td style='font-size: 14px'></td>
                                                        <td style='font-size: 14px'></td>
                                                        <td style='font-size: 14px;'></td>
                                                        <td style='font-size: 14px;'></td>
                                                        <td style='font-size: 14px; text-align: right;color:red'>
                                                            <b>Balance</b></td>
                                                        <td style='font-size: 14px; text-align: right;color:red'>
                                                            <b><?= $bal ?></b></td>
                                                    </tr>

                                                </table>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="tab-pane fade" id="tab9default">
                                        <div class="row hidetabpane">

                                            <div class="row table-responsive" style="margin-bottom:1%" align="center">
                                                <div class="col-md-2 sksahil">
                                                    <label class="txtt"><b>City</b></label>

                                                    <?php
                                                    echo "<select name='city' class='scity skk  select2' style='width:100%' autocomplete='off'> ";
                                                    echo "<option value=''></option>";

                                                    $gcity = mysqli_query($conn, "SELECT `code`,`name` FROM `city` ORDER BY `name`") or die(mysqli_error($conn));
                                                    while ($icity = mysqli_fetch_array($gcity)) {
                                                        echo "<option value='$icity[code]'>$icity[name]</option>";
                                                    }

                                                    echo "</select>";
                                                    ?>
                                                </div>

                                                <div class="col-md-2  sksahil">
                                                    <label class="txtt"><b>Hotel Name</b></label>

                                                    <?php
                                                    echo "<select name='hotelnm' class='shotelnm skk  select2' style='width:100%' autocomplete='off' > ";

                                                    echo "<option value=''></option>";
                                                    $mhotl = mysqli_query($conn, "SELECT code,hotelnm FROM hotels  order by hotelnm ") or die(mysqli_error($conn));
                                                    while ($thotl = mysqli_fetch_array($mhotl)) {
                                                        echo "<option value='$thotl[code]'>$thotl[hotelnm]</option>";
                                                    }
                                                    echo "</select>";
                                                    ?>
                                                </div>

                                                <div class="col-md-2  sksahil">
                                                    <label class="txtt"><b>Room Category</b></label>
                                                    <?php
                                                    echo "<select class='roomcatg skk select2' name='roomcatg' style='width:100%'>";
                                                    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>";
                                                    ?>
                                                </div>

                                                <div class="col-md-1 sksahil" style="width:10%">
                                                    <label class="txtt"><b>Check In</b></label>
                                                    <input type='date' min="<?= $curdate ?>"
                                                           name='mcheckin' class='mcheckin skk' style="color:white">
                                                </div>

                                                <div class="col-md-1 sksahil" style="width:10%">
                                                    <label class="txtt"><b>Check Out</b></label>
                                                    <input type='date' name='mcheckout'
                                                           min="<?= $curdate ?>" class='mcheckout skk'
                                                           style="color:white">
                                                </div>

                                                <div class="col-md-1 ">
                                                    <button class="button-29 sksearch" type="button">Search</button>
                                                </div>
                                            </div>

                                            <div class="row" style="padding-left:1%">
                                                <table class="table table-bordered" style="width: 100%">
                                                    <thead class="mySearchTr">
                                                        <tr>
                                                            <!--<th width="2%"><input type="checkbox" id="del_all" class=" form" style="height: 25px;width: 25px;margin-top: -9px;margin-left: -3px;"></th>-->
                                                            <th width="2%"></th>
                                                            <th width="2%"></th>
                                                            <th width="3%" class='text-center'>Sr.</th>
                                                            <th width="8%">City</th>
                                                            <th width="10%">Hotel Name</th>
                                                            <th width="5%">Check In</th>
                                                            <th width="5%">Check Out</th>
                                                            <th width="5%" class="text-center">No. Nights</th>
                                                            <th width="4%" class="text-center">No. Pax</th>
                                                            <th width="15%">Room Category</th>
                                                            <th width="10%">Room View</th>
                                                            <th width="7%">Type</th>
                                                            <th width="5%" class='text-right'>Qty.</th>
                                                            <th width="5%" class='text-right'>Rate</th>
                                                            <th width="5%" class='text-right'>Amount</th>
                                                            <th width="15%">Meal Type</th>
                                                            <th width="10%">CNF No.</th>
                                                            <th width="15%">Remarks</th>
                                                        </tr>
                                                    </thead>
                                                    <tbody class="purchbody">
                                                        <?php
                                                        if ($addflag != 1) {
                                                            $ctr = 0;
                                                            $mctr = 0;
                                                            $tqty = 0;
                                                            $tamt = 0;

                                                            $gettran = mysqli_query($conn, "SELECT * FROM `$tranpurchdb` WHERE `vouchno`='$get[vouchno]' ORDER BY `srno`") or die(mysqli_error($conn));
                                                            while ($tran = mysqli_fetch_array($gettran)) {
                                                                $mhotcatg = mysqli_query($conn, "SELECT code,name FROM roomcatg WHERE code='$tran[roomcatg]'") or die(mysqli_error($conn));
                                                                $thotcatg = mysqli_fetch_array($mhotcatg);

                                                                $mroomview = mysqli_query($conn, "SELECT code,name FROM roomview WHERE code='$tran[roomview]'") or die(mysqli_error($conn));
                                                                $troomview = mysqli_fetch_array($mroomview);

                                                                $mrtype = mysqli_query($conn, "SELECT code,name FROM roomtype WHERE code='$tran[roomtype]'") or die(mysqli_error($conn));
                                                                $trtype = mysqli_fetch_array($mrtype);

                                                                $mhotcity = mysqli_query($conn, "SELECT code,name FROM city WHERE code='$tran[city]'") or die(mysqli_error($conn));
                                                                $thotcity = mysqli_fetch_array($mhotcity);

                                                                $mhotel = mysqli_query($conn, "SELECT code,hotelnm FROM hotels WHERE code ='$tran[hotelnm]'") or die(mysqli_error($conn));
                                                                $thotel = mysqli_fetch_array($mhotel);

                                                                $mmeal = mysqli_query($conn, "SELECT code,name FROM $zroot.mealtype WHERE code ='$tran[mealtype]'") or die(mysqli_error($conn));
                                                                $tmeal = mysqli_fetch_array($mmeal);
                                                                $checked = "";
                                                                if ($tran['prncomp'] == "1") {
                                                                    $checked = "checked";
                                                                }

                                                                $mctr++;
                                                                echo "<tr>";
                                                                echo "<td><input type='checkbox' style='border:none;position: inherit;height:25px;width:25px;' align='center' name= 'prncomp_$ctr' value='1' class='form-control form' $checked></td>";
                                                                echo "<td><i class='fa fa-close remove' style='display:none'></i></td>";
                                                                echo "<td><input type='text' class='form-control form text-center srno'    name='srno_$ctr'     value='$mctr'></td>";

                                                                echo "<td>";
                                                                echo "<select class='form-control form city select2' name='city_$ctr' style='width:100%'  >";
                                                                echo "<option value='$thotcity[code]'>$thotcity[name]</option>";
                                                                $gcity = mysqli_query($conn, "SELECT `code`,`name` FROM `city` ORDER BY `name`") or die(mysqli_error($conn));
                                                                while ($icity = mysqli_fetch_array($gcity)) {
                                                                    echo "<option value='$icity[code]'>$icity[name]</option>";
                                                                }
                                                                echo "</select>";
                                                                echo "</td>";

                                                                echo "<td>";
                                                                echo "<select class='form-control form hotelnm select2' name='hotelnm_$ctr' style='width:100%'>";
                                                                echo "<option value='$thotel[code]'>$thotel[hotelnm]</option>";
                                                                $mhotl = mysqli_query($conn, "SELECT code,hotelnm FROM hotels  order by hotelnm ") or die(mysqli_error($conn));
                                                                while ($thotl = mysqli_fetch_array($mhotl)) {
                                                                    echo "<option value='$thotl[code]'>$thotl[hotelnm]</option>";
                                                                }
                                                                echo "</select>";
                                                                echo "</td>";

                                                                echo "<td><input type='date' class='form-control form checkin'  min='$curdate' name='checkin_$ctr' value='$tran[checkin]'></td>";
                                                                echo "<td><input type='date' class='form-control form checkout' min='$curdate' name='checkout_$ctr' value='$tran[checkout]'></td>";
                                                                echo "<td><input type='number' class='form-control text-center form nonights'  name='nonights_$ctr' value='$tran[nonights]'></td>";
                                                                echo "<td><input type='number' class='form-control text-center form hotelpax'  name='hotelpax_$ctr' value='$tran[hotelpax]'></td>";

                                                                echo "<td>";
                                                                echo "<select class='form-control form roomcatg select2' name='roomcatg_$ctr' style='width:100%'  >";
                                                                echo "<option value='$thotcatg[code]'>$thotcatg[name]</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 roomview select2' name='roomview_$ctr' style='width:100%'  >";
                                                                echo "<option value='$troomview[code]'>$troomview[name]</option>";
                                                                $gitr = mysqli_query($conn, "SELECT `code`,`name` FROM `roomview` ORDER BY `name`") or die(mysqli_error($conn));
                                                                while ($itr = mysqli_fetch_array($gitr)) {
                                                                    echo "<option value='$itr[code]'>$itr[name]</option>";
                                                                }
                                                                echo "</select>";
                                                                echo "</td>";

                                                                echo "<td>";
                                                                echo "<select class='form-control form roomtype select2' name='roomtype_$ctr' style='width:100%'  >";
                                                                echo "<option value='$tran[roomtype]'>$trtype[name]</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='$tran[qty]'></td>";
                                                                echo "<td><input type='text' class='form-control form text-right rate'    name='rate_$ctr'  value='$tran[rate]'></td>";
                                                                echo "<td><input type='text' class='form-control form text-right hamount'  name='amount_$ctr'  value='$tran[amount]'readonly ></td>";

                                                                echo "<td>";
                                                                echo "<select class='form-control form mealtype select2' name='mealtype_$ctr' style='width:100%'  >";
                                                                echo "<option value='$tran[mealtype]'>$tmeal[name]</option>";
                                                                $gmeal2 = mysqli_query($conn, "SELECT `code`,`name` FROM $zroot.`mealtype` ORDER BY `name`") or die(mysqli_error($conn));
                                                                while ($imeal2 = mysqli_fetch_array($gmeal2)) {
                                                                    echo "<option value='$imeal2[code]'>$imeal2[name]</option>";
                                                                }
                                                                echo "</select>";
                                                                echo "</td>";

                                                                echo "<td><input type='text' class='form-control form cnfno'  name='cnfno_$ctr'  value='$tran[cnfno]' ></td>";
                                                                echo "<td><input type='text' class='form-control form remarks'  name='remarks_$ctr'  value='$tran[remarks]' ></td>";
                                                                echo "</tr>";
                                                                $ctr++;
                                                            }
                                                        } else {
                                                            echo "<tr>";
                                                            echo "<td><input type='checkbox' style='border:none;position: inherit;height:25px;width:25px;' align='center' name= 'prncomp_0' value='1' class='prncomp form-control form'></td>";
                                                            echo "<td><i class='fa fa-close remove' style=''></i></td>";
                                                            echo "<td><input type='text' class='form-control form text-center' srno'    name='srno_0'     value='1'></td>";

                                                            echo "<td>";
                                                            echo "<select class='form-control form city select2' name='city_0' style='width:100%'  >";
                                                            echo "<option value=''></option>";
                                                            $gcity = mysqli_query($conn, "SELECT `code`,`name` FROM `city` ORDER BY `name`") or die(mysqli_error($conn));
                                                            while ($icity = mysqli_fetch_array($gcity)) {
                                                                echo "<option value='$icity[code]'>$icity[name]</option>";
                                                            }
                                                            echo "</select>";
                                                            echo "</td>";

                                                            echo "<td>";
                                                            echo "<select class='form-control form hotelnm select2' name='hotelnm_0' style='width:100%'  >";
                                                            echo "<option value=''></option>";
                                                            $mhotl = mysqli_query($conn, "SELECT code,hotelnm FROM hotels  order by hotelnm ") or die(mysqli_error($conn));
                                                            while ($thotl = mysqli_fetch_array($mhotl)) {
                                                                echo "<option value='$thotl[code]'>$thotl[hotelnm]</option>";
                                                            }
                                                            echo "</select>";
                                                            echo "</td>";

                                                            echo "<td><input type='date' class='form-control form checkin'  min='$curdate' name='checkin_0' value='$tran[checkin]'></td>";
                                                            echo "<td><input type='date' class='form-control form checkout' min='$curdate' name='checkout_0' value='$tran[checkout]'></td>";
                                                            echo "<td><input type='number' class='form-control text-center form nonights'        name='nonights_0' value='$tran[nonights]'></td>";
                                                            echo "<td><input type='number' class='form-control text-center form hotelpax'        name='hotelpax_0' value='$tran[hotelpax]'></td>";

                                                            echo "<td>";
                                                            echo "<select class='form-control form roomcatg select2' name='roomcatg_0' style='width:100%'  >";
                                                            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 roomview select2' name='roomview_0' style='width:100%'  >";
                                                            echo "<option value=''></option>";
                                                            $gitr = mysqli_query($conn, "SELECT `code`,`name` FROM `roomview` ORDER BY `name`") or die(mysqli_error($conn));
                                                            while ($itr = mysqli_fetch_array($gitr)) {
                                                                echo "<option value='$itr[code]'>$itr[name]</option>";
                                                            }
                                                            echo "</select>";
                                                            echo "</td>";
                                                            echo "<td>";
                                                            echo "<select class='form-control form roomtype select2' name='roomtype_0' style='width:100%'  >";
                                                            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_0'  value='0'></td>";
                                                            echo "<td><input type='text' class='form-control form text-right rate'    name='rate_0'  value='0'></td>";
                                                            echo "<td><input type='text' class='form-control form text-right hamount'  name='amount_0'  value='0' readonly ></td>";
                                                            echo "<td>";
                                                            echo "<select class='form-control form mealtype select2' name='mealtype_0' style='width:100%'  >";
                                                            echo "<option value=''></option>";
                                                            $gmeal2 = mysqli_query($conn, "SELECT `code`,`name` FROM $zroot.`mealtype` ORDER BY `name`") or die(mysqli_error($conn));
                                                            while ($imeal2 = mysqli_fetch_array($gmeal2)) {
                                                                echo "<option value='$imeal2[code]'>$imeal2[name]</option>";
                                                            }
                                                            echo "</select>";
                                                            echo "</td>";
                                                            echo "<td><input type='text' class='form-control form cnfno'  name='cnfno_0'  value='' ></td>";
                                                            echo "<td><input type='text' class='form-control form remarks'  name='remarks_0'  value='' ></td>";

                                                            echo "</tr>";
                                                        }
                                                        ?>
                                                    <input type="hidden" name="purchcnt" id="purchcnt" value="<?php echo ($addflag != 1) ? $ctr : 1 ?>">
                                                    </tbody>
                                                </table>
                                            </div>

                                            <button type="button" class="btn btn-primary btn-square form" id="addpurch">
                                                <i class="fa fa-plus" data-toggle='tooltip' title='Add Row'></i>
                                            </button>

                                            <div class="row">

                                                <div class="col-lg-1 col-md-1 col-sm-3 col-xs-3 text-right pad">
                                                    <label class="label-control marg"
                                                           style="color:#2FBFFE;font-weight:bold">Approve</label>
                                                </div>
                                                <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 pad">
                                                    <input type="checkbox" class="form-control form hotelaprov" <?php
                                                    if ($get['hotelaprov'] == "1") {
                                                        echo "checked";
                                                    }
                                                    ?> value="1"
                                                           name="hotelaprov">
                                                </div>

                                                <div class="col-lg-7 text-right pad">
                                                    <label class="label-control marg"><b>FE</b></label>
                                                </div>

                                                <div class="col-lg-1">
                                                    <input type="text" class="form-control form text-right  hotelamt"
                                                           name="hotelamt"
                                                           value="<?php echo ($addflag != 1) ? $get["hotelamt"] : ""; ?>"
                                                           readonly>
                                                </div>
                                                <div class="col-lg-1 text-right pad" style='width:20px;color: blue'>
                                                    <label class="label-control marg"><b>INR</b></label>
                                                </div>

                                                <div class="col-lg-1">
                                                    <input type="text" class="form-control form text-right  hotelinramt"
                                                           name="hotelinramt"
                                                           value="<?php echo ($addflag != 1) ? $get["hotelinramt"] : ""; ?>"
                                                           readonly style="width:170px;color: blue">
                                                </div>
                                            </div>

                                        </div>

                                        <div style="background-color:#E3F2E1;width: 50%;display: none;" class="photel">

                                            <div class="row">
                                                <div class="col-lg-3 text-right pad">
                                                    <label class="label-control marg" style="color:red">Supplier</label>
                                                </div>
                                                <div class="col-lg-6 adjcolj pad">
                                                    <select name="hotelsupp" class="form-control form pad hotelsupp"
                                                            style="color:red;background-color:white;">
                                                        <option
                                                            value="<?php echo ($addflag != 1) ? $get["hotelsupp"] : ""; ?>">
                                                                <?php echo ($addflag != 1) ? $fethsupp["name"] : ""; ?>
                                                        </option>
                                                        <?php
                                                        $gnsp = mysqli_query($conn, "SELECT `accode`,`name` FROM `accmast` where grpcode = '009' ORDER BY `name`") or die(mysqli_error($conn));
                                                        while ($fnsp = mysqli_fetch_array($gnsp)) {
                                                            echo "<option value='$fnsp[accode]'>$fnsp[name]</option>";
                                                        }
                                                        ?>

                                                    </select>
                                                </div>
                                            </div>
                                            <div class="row">
                                                <div class="col-lg-3 text-right pad">
                                                    <label class="label-control marg" style="color:red">Invoice
                                                        No.</label>
                                                </div>
                                                <div class="col-lg-2 adjcolj pad">
                                                    <input type="text" class="form-control form text-right  hotelinvno"
                                                           style="color:red;background-color:white" name="hotelinvno"
                                                           value="<?php echo ($addflag != 1) ? $get["hotelinvno"] : ""; ?>">
                                                </div>
                                                <div class="col-lg-2 text-right pad">
                                                    <label class="label-control marg" style="color:red">Invoice
                                                        Date</label>

                                                </div>
                                                <div class="col-lg-2 text-right pad">
                                                    <input type="date" class="form-control form text-right  hotelinvdt"
                                                           style="color:red;background-color:white" name="hotelinvdt"
                                                           value="<?php echo ($addflag != 1) ? $get["hotelinvdt"] : ""; ?>">
                                                </div>
                                            </div>
                                            <div class="row">
                                                <div class="col-lg-3 text-right pad">
                                                    <label class="label-control marg" style="color:red">Rate</label>
                                                </div>
                                                <div class="col-lg-2 adjcolj pad">
                                                    <input type="text" class="form-control form text-right  hotelrate"
                                                           style="color:red;background-color:white" name="hotelrate"
                                                           value="<?php echo ($addflag != 1) ? $get["hotelrate"] : ""; ?>">
                                                </div>
                                                <div class="col-lg-2 text-right pad">
                                                    <label class="label-control marg" style="color:red">Amount</label>

                                                </div>
                                                <div class="col-lg-2 text-right pad">
                                                    <input type="text" class="form-control form text-right  hotelpuramt"
                                                           style="color:red;background-color:white" name="hotelpuramt"
                                                           value="<?php echo ($addflag != 1) ? $get["hotelpuramt"] : ""; ?>">
                                                </div>
                                            </div>
                                        </div>

                                        <div>
                                            <button type="button" align="left" id='print'
                                                    class="btn btn-pad btn-square sknewbtn hotelpurch"
                                                    style="margin-right: 70%;">
                                                Hotel Purchase
                                            </button>

                                            <a align="right" id='print' class="btn btn-pad btn-square skbtn hotelprint"
                                               href="hotelsent_print.php?vouchno=<?= $qvouch; ?>&para=<?= $para ?>&image=Yes"
                                               target="_blank"
                                               style="display: none;background-image: linear-gradient(135deg, #3C8CE7 10%, #00EAFF 100%) !important;color:white !important;">
                                                <i class="fa fa-image"></i>
                                            </a>
                                            <a align="right" id='print' class="btn btn-pad btn-square skbtn hotelprint"
                                               href="hotelsent_print.php?vouchno=<?= $qvouch; ?>&para=<?= $para ?>&image=No"
                                               target="_blank"
                                               style="display: none;background-image: linear-gradient(135deg, #3C8CE7 10%, #00EAFF 100%) !important;color:white !important;">
                                                <i class="fa fa-print"></i>
                                            </a>
                                            <a align="right" id='print' class="btn btn-pad btn-square skbtn hotelvouch"
                                               href="#">
                                                Hotel Voucher
                                            </a>
                                        </div>

                                        <!-- Modal Part Start -->
                                        <div class="modal fade" id="modelWindow" role="dialog">
                                            <div class="modal-dialog modal-lg vertical-align-center">
                                                <div class="modal-content" style="width:150%;margin-left:-210px;">
                                                    <div class="modal-header">
                                                        <button type="button" class="close"
                                                                data-dismiss="modal">&times;</button>
                                                        &nbsp;
                                                    </div>
                                                    <div class="modal-body">
                                                        <div class="table-responsive hoteldetail">


                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <!-- Modal Part End -->
                                    </div>

                                    <div class="tab-pane fade " id="tab10default">
                                        <div class="row">
                                            <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                <label class="label-control marg">Remark</label>
                                            </div>
                                            <div class="col-lg-3 col-md-8 col-sm-8 col-xs-8 pad ">
                                                <textarea rows="5" cols="60" class="form-control form  remark"
                                                          style="resize:none;background-color: whitesmoke"
                                                          name="remark"><?php echo ($addflag != 1) ? $get["remark"] : ""; ?></textarea>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="tab-pane fade" id="tab11default">
                                        <div class="row">
                                            <div class="col-lg-8 col-md-8 col-sm-8 col-xs-8 text-right pad"></div>
                                            <div class="col-lg-1 col-md-1 col-sm-3 col-xs-3 text-right pad">
                                                <label class="label-control marg">Total</label>
                                            </div>
                                            <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 pad ">
                                                <input class="form-control form text-right inrtotalamt" name="inrtotalamt" value="<?php echo ($addflag != 1) ? rajnumformat($get['inrtotalamt']) : 0; ?>" readonly tabindex="-1">
                                            </div>
                                        </div>
                                        <div class="row">
                                            <div class="col-lg-8 col-md-8 col-sm-8 col-xs-8 text-right pad"></div>
                                            <div class="col-lg-1 col-md-1 col-sm-3 col-xs-3 text-right pad">
                                                <label class="label-control marg">Discount</label>
                                            </div>
                                            <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 pad">
                                                <input class="form-control form text-right discountinr" name="discountinr"  value="<?php echo ($addflag != 1) ? $get['discountinr'] : 0; ?>">
                                            </div>
                                        </div>
                                        <div class="row">
                                            <div class="col-lg-8 col-md-8 col-sm-8 col-xs-8 text-right pad"></div>
                                            <div class="col-lg-1 col-md-1 col-sm-3 col-xs-3 text-right pad">
                                                <label class="label-control marg">Final Amount</label>
                                            </div>
                                            <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 pad ">
                                                <input class="form-control form text-right netinramt" name="netinramt" value="<?php echo ($addflag != 1) ? rajnumformat($get['netinramt']) : ''; ?>" readonly tabindex="-1">
                                            </div>
                                        </div>

                                    </div>

                                </div>
                            </div>
                        </div>
                    </div>

                    <div class=" panel-footer col-lg-12">


                        <div class="col-lg-1 col-md-2 col-sm-2 col-xs-2 text-center invprn">
                            <button type="button"
                                    style="font-size:11px;width:140px;background-image: linear-gradient(135deg, #76a23f 10%, #0bb15c 100%) !important;"
                                    class="btn btn-pad btn-square sknewbtn">
                                Invoice
                            </button>
                        </div>

                        <div class="col-lg-2 text-left ">
                            <div style="overflow: auto;">
                                <table class="table-condensed" style="margin: 0 auto;">
                                    <tr>
                                        <?php if ($get['tiktgstperc'] == 0) { ?>
                                            <td class=" buttonform tooltip-bottom normalinv">
                                                <button type="button"
                                                        style="background-image: linear-gradient(135deg, #3C8CE7 10%, #00EAFF 100%) !important;color:white !important;"
                                                        class="btn btn-pad btn-square skbtn"
                                                        onclick="window.open('fit_invoice_print.php?vouchno=<?= $qvouch; ?>', 'popUponclickWindow', 'height=600,width=970,left=20,top=20, resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no, status=yes');">
                                                    <i class="fa fa-print"></i>
                                                </button>
                                            </td>
                                        <?php } else { ?>

                                            <td class=" buttonform tooltip-bottom normalinv">
                                                <button type="button" class="btn btn-pad btn-square "
                                                        style="background-image: linear-gradient(135deg, #3C8CE7 10%, #00EAFF 100%) !important;color:white !important;"
                                                        onclick="window.open('fit_invoice_print.php?vouchno=<?= $qvouch; ?>&gst=Yes', 'popUponclickWindow', 'height=600,width=970,left=20,top=20, resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no, status=yes');">
                                                    GST
                                                </button>
                                            </td>
                                        <?php } ?>
                                        <td class=" buttonform tooltip-bottom normalinv">
                                            <button type="button" class="btn btn-pad btn-square "
                                                    style="background-image: linear-gradient(135deg, #3C8CE7 10%, #00EAFF 100%) !important;color:white !important;"
                                                    onclick="window.open('fit_invoice_print.php?vouchno=<?= $qvouch; ?>&paxdtl=Yes', 'popUponclickWindow', 'height=600,width=970,left=20,top=20, resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no, status=yes');">
                                                Pax Detail
                                            </button>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </div>

                        <div class="col-lg-2 text-center invgen">
                            <?php if ($autoginv != "Y") { ?>
                                <button type="button" href="#" class="btn btn-pad btn-square geninv skbtn "
                                        style="background-image: linear-gradient(135deg, #09C6F9 10%, #045DE9 100%) !important;color:white">Generate
                                    Invoice</button>
                            <?php } ?>
                        </div>

                        <div class="col-lg-4 text-right pad">
                            <?php include("includes/buttons.php"); ?>
                        </div>

                        <div class="col-lg-4 col-md-2 col-sm-2 col-xs-2 pad text-left ">
                            <a align="right" id='print' class="btn btn-pad btn-square skbtn combprint"
                               href="combvouch_print.php?vouchno=<?= $qvouch; ?>&para=<?= $para ?>&image=Yes"
                               target="_blank"
                               style="display: none;background-image: linear-gradient(135deg, #3C8CE7 10%, #00EAFF 100%) !important;color:white !important;">
                                <i class="fa fa-image"></i>
                            </a>
                            <a align="right" id='print' class="btn btn-pad btn-square skbtn combprint"
                               href="combvouch_print.php?vouchno=<?= $qvouch; ?>&para=<?= $para ?>&image=No"
                               target="_blank"
                               style="display: none;background-image: linear-gradient(135deg, #3C8CE7 10%, #00EAFF 100%) !important;color:white !important;">
                                <i class="fa fa-print"></i>
                            </a>
                            <a align="right" id='print' class="btn btn-pad btn-square skbtn combprint"
                               href="combvouch_print.php?vouchno=<?= $qvouch; ?>&para=<?= $para ?>&image=Yes&paxdtl=Yes"
                               target="_blank"
                               style="display: none;background-image: linear-gradient(135deg, #3C8CE7 10%, #00EAFF 100%) !important;color:white !important;">
                                Pax Detail
                            </a>
                            <a align="right" id='print' class="btn btn-pad btn-square skbtn combvouch" href="#">
                                Combine Voucher
                            </a>
                            <a align="right" id='print' class="btn btn-pad btn-square skbtn"
                               href="quote_inr_print.php?vouchno=<?= $qvouch; ?>&para=<?= $para ?>"
                               target="_blank"
                               style="background-image: linear-gradient(135deg, #3C8CE7 10%, #00EAFF 100%) !important;color:white !important;">
                                Quote for Pax
                            </a>
                        </div>

                    </div>
                </div>
            </div>
    </form>
    <div class="modal fade custModal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
        <div class="modal-dialog modal-lg">
            <div class="modal-content">
                <div class="modal-header">
                    <button class="close" data-dismiss="modal"><span>&times;</span></button>
                    <h4 class="modal-title" id="myLargeModalLabel">Search <? echo $formname; ?></h4>
                </div>
                <div class="modal-body">
                    <input type="hidden" value="<?php // Echo $fseries  
                            ?>" class="form-control series">
                    <input type="hidden" value="<?php echo $get['vouchno']; ?>" class="form-control vouchno">
                    <input type="hidden" value="<?php echo $file ?>" class="form-control file">

                    <div class="row">
                        <div class="col-lg-1"></div>
                        <div class="col-lg-2">
                            <select class="form-control  ifield" style="border: 2px solid #2FBFFE;border-radius:7px">
                                <option value="1">Name</option>
                                <option value="2">Surname</option>
                                <option value="3">Mobile</option>
                            </select>
                        </div>
                        <div class="col-lg-2">
                            <select class="form-control  ioperator" style="border: 2px solid #2FBFFE;border-radius:7px">
                                <option value="">Search Type</option>
                                <option value="%">Like</option>
                                <option value="=">Exactly</option>
                            </select>
                        </div>
                        <div class="col-lg-4">
                            <input type="text" value="" class="form-control isearch"
                                   style="border: 2px solid #2FBFFE;border-radius:7px">
                        </div>
                        <div class="col-lg-2">
                            <input type="button" class="btn btn-primary iload" value="Search"
                                   style="height: 30px;border: 2px solid #2FBFFE">
                        </div>
                    </div>

                    <div class="col-lg-12 iloader text-center">
                        <img src="images/search.gif" alt="loading">
                    </div>
                    <div class="col-lg-12 inoRecord text-center">
                        <h3>NO RECORDS FOUND</h3>
                    </div>
                    <div class="table-responsive" style="max-height: 400px;overflow: auto;">
                        <table id="" class="table table-striped table-condensed table-bordered" width="100%">
                            <thead>
                                <tr class="mySearchTr">
                                    <th width="23%">Full Name</th>
                                    <th width="10%">Surname</th>
                                    <th width="12%">City</th>
                                    <th width="8%">Mobile</th>
                                    <th width="10%">Aadhaar </th>
                                    <th width="10%">PAN</th>
                                </tr>
                            </thead>
                            <tbody class="iTbody">
                            </tbody>
                        </table>
                    </div>
                    <div class="row">
                        <div class="col-xs-12 text-right search-action-bar">
                            <input type="button" class="btn btn-primary iprevious" value="Previous">
                            <input type="button" class="btn btn-primary inext" value="Next">
                        </div>
                    </div>
                </div>
                <div class="modal-footer"></div>
            </div>
        </div>
    </div>


    <div class="modal fade bs-example-modal-lg searchModal" tabindex="-1" role="dialog"
         aria-labelledby="myLargeModalLabel">
        <div class="modal-dialog modal-lg">
            <div class="modal-content">
                <div class="modal-header">
                    <button class="close" data-dismiss="modal"><span>&times;</span></button>
                    <h4 class="modal-title" id="myLargeModalLabel">Search <? echo $formname; ?></h4>
                </div>
                <div class="modal-body">
                    <div class="row">
                        <div class="col-lg-2">
                            <select class="form-control sfield">
                                <option value="1">Voucher No</option>
                                <option value="2">Date</option>
                                <option value="3">For</option>
                                <option value="6">Agent</option>
                                <option value="4">Name</option>
                                <option value="5">Mobile</option>
                            </select>
                        </div>
                        <div class="col-lg-2">
                            <select class="form-control soperator">
                                <option value="">Type of Search</option>
                                <option value="%">Like</option>
                                <option value="=">Exactly</option>
                            </select>
                        </div>
                        <div class="col-lg-2">
                            <select class="form-control sortBy">
                                <option value="">Sort By</option>
                                <option value="1">Voucher No</option>
                                <option value="2">Date</option>
                                <option value="6">Agent</option>
                                <option value="3">For</option>
                                <option value="4">Name</option>
                                <option value="5">Mobile</option>
                            </select>
                        </div>
                        <div class="col-lg-2">
                            <select class="form-control orderAs">
                                <option value="desc">Desc</option>
                                <option value="asc">Asc</option>
                            </select>
                        </div>
                        <div class="col-lg-2">
                            <input type="text" value="" class="form-control ssearch" placeholder="Search Here">
                        </div>
                        <div class="col-lg-2">
                            <input type="button" class="btn btn-primary sload" value="Search">
                        </div>
                    </div>
                    <div class="col-lg-12 sloader text-center">
                        <!--<img src="images/search.gif" alt="loading">-->
                    </div>
                    <div class="col-lg-12 snoRecord text-center">
                        <h3>NO RECORDS FOUND</h3>
                    </div>
                    <div class="table-responsive" style="max-height: 400px;overflow: auto;">
                        <table id="" class="table table-striped table-condensed table-bordered" width="100%">
                            <thead>
                                <tr class="mySearchTr">
                                    <th width="7%">Voucher</th>
                                    <th width="8%">Date</th>
                                    <th width="10%">For</th>
                                    <th width="15%">Agent</th>
                                    <th width="20%">Name</th>
                                    <th width="8%">Mobile</th>
                                    <th width="14%">Entries</th>
                                    <th width="5%">Action</th>
                                </tr>
                            </thead>
                            <tbody class="sTbody">
                            </tbody>
                        </table>
                    </div>
                    <div class="row">
                        <div class="col-xs-12 text-right search-action-bar">
                            <input type="button" class="btn btn-primary sprev" value="Previous">
                            <input type="button" class="btn btn-primary snext" value="Next">
                        </div>
                    </div>

                </div>
                <div class="modal-footer"></div>
            </div>
        </div>
    </div>
    <?php include("includes/linksfoot.php"); ?>
</body>

</html>