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

$formname = 'Booking Form';
$maindb = 'bookform';
$trandb = 'visaform';
$accdb = 'actran';

$printfile = "bookform_print.php";
$file = 'bookform.php';
$trandbexist = 0;
$keyfld = "vouchno";
//$keycond  = " and tour = '$tour' ";
$source = "BOOK";
$cshsource = "BKCS";
$ord = "3";
$mantcs = $_SESSION["mantcs"];
$admin = $_SESSION["admin_" . $dbname];
$zdb = $_SESSION["zdbyear_" . $dbname];
$myyear = $_SESSION[$myyear];
$compcd = $_SESSION["comp_" . $dbname];
$tourname = $_SESSION['tourname'];
$tourcode = $_SESSION['tourcode'];
$fromdate = $_SESSION['fromdate'];
$todate = $_SESSION['todate'];

$manrd = "readonly";
if ($mantcs > 0) {
    $manrd = "";
}
$tourcond = "AND tourno = '$tourcode'";
//browse($tourcode);
$zyear = right($zdb, 4);
$mfrdate = getzdates($zyear, 'S');
$mtodate = getzdates($zyear, 'E');
$zroot = $_SESSION["zdir"];
$vmcolr = $_SESSION["vmidcolor"];

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

if (isset($_POST["submit"])) {

    $a = 1;
    $qvouch = $_POST["vouchno"];

    foreach ($_POST as $key => $value) {
        $exclude_fld = ["test"];
        if (in_array($key, $exclude_fld)) {
            continue;
        }
        $$key = $value;
        // echo "Field ".htmlspecialchars($key)." is ".htmlspecialchars($value)."<br>";
    }
    $agent = htmlspecialchars($_POST["agent"], ENT_QUOTES, 'UTF-8');

    $rem1 = mysqli_real_escape_string($conn, $_POST["rem1"]);
    $rem2 = mysqli_real_escape_string($conn, $_POST["rem2"]);
    $rem3 = mysqli_real_escape_string($conn, $_POST["rem3"]);
    $add1 = mysqli_real_escape_string($conn, $_POST["add1"]);
    $add2 = mysqli_real_escape_string($conn, $_POST["add2"]);
    $add3 = mysqli_real_escape_string($conn, $_POST["add3"]);
    $sadd1 = mysqli_real_escape_string($conn, $_POST["sadd1"]);
    $sadd2 = mysqli_real_escape_string($conn, $_POST["sadd2"]);
    $sadd3 = mysqli_real_escape_string($conn, $_POST["sadd3"]);
    $refd1 = mysqli_real_escape_string($conn, $_POST["refd1"]);
    $refd2 = mysqli_real_escape_string($conn, $_POST["refd2"]);

    $mvouch = $qvouch;

    if ($a == 1) {
        // mysqli_query($conn, "LOCK TABLES `$maindb` WRITE, `$trandb` WRITE ");

        if ($addflag == 1) {
            $gen1 = mysqli_query($conn, "SELECT vouchno AS maxcode FROM `$maindb` where vouchno != ''order by vouchno desc LIMIT 0,1  ") or die(mysqli_error($conn));
            if (mysqli_num_rows($gen1) > 0) {
                $vvouch = mysqli_fetch_assoc($gen1);
                $qvouch = $vvouch["maxcode"] + 1;
            } else {
                $qvouch = '1';
            }
            $mvouch = $qvouch;

            $gen11 = mysqli_query($conn, "SELECT regnno AS maxreg FROM `$maindb` where regnno != '' AND tourno = '$tourcode' order by regnno desc LIMIT 0,1 ") or die(mysqli_error($conn));
            if (mysqli_num_rows($gen11) > 0) {
                $vvouch11 = mysqli_fetch_assoc($gen11);
                $regnno = $vvouch11["maxreg"] + 1;
            } else {
                $gen2 = mysqli_query($conn, "SELECT startreg  FROM `tour` WHERE code = '$tourcode' ") or die(mysqli_error($conn));
                if (mysqli_num_rows($gen2) > 0) {
                    $fet2 = mysqli_fetch_array($gen2);
                    $regnno = $fet2['startreg'];
                } else {
                    $regnno = '1';
                }
            }
        }

        ############################## MAIN ######################################################
        //        if ($agent != "") { // as said by sir
        $chkagn = mysqli_query($conn, "SELECT accode FROM accmast WHERE name = '$agent'") or die(mysqli_error($conn));
        $mnoa = mysqli_num_rows($chkagn);
        $agrp = '022';
        if ($mnoa > 0) {
            $feta = mysqli_fetch_array($chkagn);
            $agencode = $feta['accode'];
        } else {
            $gena = mysqli_query($conn, "SELECT MAX(accode) AS maxcode FROM `accmast` where accode != '' LIMIT 0,1 ") or die(mysqli_error($conn));
            if (mysqli_num_rows($gena) > 0) {
                $vvoucha = mysqli_fetch_assoc($gena);
                $qvoucha = $vvoucha["maxcode"] + 1;
            } else {
                $qvoucha = '51';
            }
            $agencode = $qvoucha;
            mysqli_query($conn, "INSERT INTO `accmast`(`accode`, `name`, `grpcode`, `init`) 
                    VALUES ('$agencode', '$agent', '022', 'BRK')") or die(mysqli_error($conn));
        }
        //        } else {
        $pgrp = '010';

        $fullname = $haji . " " . $surname;

        //        $chkprt = mysqli_query($conn, "SELECT accode FROM accmast WHERE name = '$fullname' and mobile = '$mobile'") or die(mysqli_error($conn));
        $chkprt = mysqli_query($conn, "SELECT accode FROM accmast WHERE name = '$fullname'") or die(mysqli_error($conn));
        $mnop = mysqli_num_rows($chkprt);

        if ($mnop > 0) {
            $fetp = mysqli_fetch_array($chkprt);
            $usercode = $fetp['accode'];
        } else {
            $gena = mysqli_query($conn, "SELECT MAX(accode) AS maxcode FROM `accmast` where accode != '' LIMIT 0,1 ") or die(mysqli_error($conn));
            if (mysqli_num_rows($gena) > 0) {
                $vvoucha = mysqli_fetch_assoc($gena);
                $qvoucha = $vvoucha["maxcode"] + 1;
            } else {
                $qvoucha = '51';
            }
            $usercode = $qvoucha;
            mysqli_query($conn, "INSERT INTO `accmast`(`accode`, `name`, `grpcode`, `init`, `mobile`, `tour`) 
                    VALUES ('$usercode', '$fullname', '010', 'SDR', '$mobile', '$tourcode')") or die(mysqli_error($conn));
        }
        //        }

        $fname = $fullname;

        $chkadd = mysqli_query($conn, "SELECT accode FROM $zroot.address WHERE name = '$fname'") or die(mysqli_error($conn));
        $mnoad = mysqli_num_rows($chkadd);
        if ($mnoad < 1) {

            mysqli_query($conn, "INSERT INTO $zroot.address(`yearno`, `vouchno`, `tour`, `regnno`, `grpcode`, `accode`, `name`, `nameprin`, 
                                                            `init`, `add1`, `add2`, `add3`, `city`, `pin`,
                                                            `tel`, `mobile`, `email`,`state`) 
                                                    VALUES ('$myyear', '$mvouch', '$tourcode', '$regnno', '010', '$usercode', '$fname', '$fname', 
                                                            'SDR', '$add1', '$add2', '$add3', '$city', '$pin',
                                                            '$tel', '$mobile', '$email', '$state')") or die(mysqli_error($conn));
        }

        if ($sname != "") {
            $chkadd2 = mysqli_query($conn, "SELECT accode FROM $zroot.address WHERE name = '$sname'") or die(mysqli_error($conn));
            $mnoad2 = mysqli_num_rows($chkadd2);
            if ($mnoad2 < 1) {
                $gena2 = mysqli_query($conn, "SELECT MAX(accode) AS maxcode FROM `accmast` where accode != '' LIMIT 0,1 ") or die(mysqli_error($conn));
                if (mysqli_num_rows($gena2) > 0) {
                    $vvoucha2 = mysqli_fetch_assoc($gena2);
                    $qvoucha2 = $vvoucha["maxcode"] + 1;
                } else {
                    $qvoucha2 = '51';
                }
                $usercode2 = $qvoucha2;

                mysqli_query($conn, "INSERT INTO $zroot.address(`yearno`, `vouchno`, `tour`, `regnno`, `grpcode`, `accode`, `name`, `nameprin`, 
                                                            `init`, `add1`, `add2`, `add3`, `city`, `pin`,
                                                            `tel`, `mobile`, `email`,`state`) 
                                                        VALUES ('$myyear', '$mvouch', '$tourcode', '$regnno', '010', '$usercode2', '$sname', '$sname', 
                                                            'SDR', '$sadd1', '$sadd2', '$sadd3', '$city2', '$pin2',
                                                            '$tel2', '$mobile2', '$email2', '$state2')") or die(mysqli_error($conn));
            }
        }

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

            // sale part
            mysqli_query($conn, "INSERT INTO `$accdb`(date, vouchno, source, trnno, accode, grpcode, amount, regnno, tour,ord)
                    VALUES ('$vouchdt', '$mvouch', '$source', '001', '30','005', '$netamt', '$mvouch', '$tourcode', '$ord')") or die(mysqli_error($conn));

            // party part
            mysqli_query($conn, "INSERT INTO `$accdb`(date, vouchno, source, trnno, accode, grpcode, amount, regnno, tour, ord)
                     VALUES ('$vouchdt', '$mvouch', '$source', '002', '$usercode','$pgrp', '$minus_amt', '$mvouch', '$tourcode', '$ord')") or die(mysqli_error($conn));
        }

        mysqli_query($conn, "DELETE FROM `$accdb` WHERE `vouchno`='$mvouch' and source = '$cshsource'") or die(mysqli_error($conn));
        if ($csnettot > 0) {
            $minus_amt = ($csnettot * -1);

            // sale part
            mysqli_query($conn, "INSERT INTO `$accdb`(date, vouchno, source, trnno, accode, grpcode, amount, regnno, tour,ord)
                    VALUES ('$vouchdt', '$mvouch', '$cshsource', '003', '30','005', '$csnettot', '$mvouch', '$tourcode', '4')") or die(mysqli_error($conn));

            // party part
            mysqli_query($conn, "INSERT INTO `$accdb`(date, vouchno, source, trnno, accode, grpcode, amount, regnno, tour, ord)
                     VALUES ('$vouchdt', '$mvouch', '$cshsource', '004', '$usercode','$pgrp', '$minus_amt', '$mvouch', '$tourcode', '4')") or die(mysqli_error($conn));
        }

        if ($agent != "") {

            $tpax = $fullno + $halfno + $childwobno;
            //            $agcomm = $netamt * ($agentcomm / 100);
            $agcomm = $tpax * $agentcomm;

            if ($agcomm > 0) {
                $minus_agcomm = ($agcomm * -1);

                // sale part
                mysqli_query($conn, "INSERT INTO `$accdb`(date, vouchno, regnno, source, trnno, accode, grpcode, amount,tour, ord)
                    VALUES ('$vouchdt','$mvouch', '$regnno', '$source', '003', '$agencode','$pgrp', '$agcomm', '$tourcode', '$ord')") or die(mysqli_error($conn));

                // party part
                mysqli_query($conn, "INSERT INTO `$accdb`(date, vouchno, regnno, source, trnno, accode, grpcode, amount, tour, ord)
                     VALUES ('$vouchdt','$mvouch', '$regnno',  '$source', '002', '4','005', '$minus_agcomm', '$tourcode', '$ord')") or die(mysqli_error($conn));
            }
        }

        $accode = $usercode;

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

        //        Mak hotel insertion start

        if ($makhotel > 0) {

            $mhotcatg = mysqli_query($conn, "SELECT category,city FROM hotels where code='$makhotel'") or die(mysqli_error($conn));
            $thotcatg = mysqli_fetch_array($mhotcatg);
            $hotelcatg = $thotcatg['category']; // hotel category 
            $trcity = $thotcatg['city']; // hotel category 
            //            $mroomcatg = mysqli_query($conn, "SELECT roomcatg FROM tour WHERE code='$tourcode'") or die(mysqli_error($conn));
            //            $troomcatg = mysqli_fetch_array($mroomcatg);
            //            $roomcatg = $troomcatg['roomcatg']; // room category

            $roomcatg = $mkroomcatg;

            $dt1 = date_create($makchkin);
            $dt2 = date_create($makchkout);

            $subtdate = date_diff($dt1, $dt2);
            $mkdays = $subtdate->format('%a');

            $nchkout = date('Y-m-d', strtotime($makchkout . ' - 1 days'));

            if ($mksingle > 0) {
                $roomtype = 1;
                $tcnt4 = $mksingle * $roomtype;
                $act_mk_singlepax = $mk_singlepax * $mksingle;
                $actqty = round($act_mk_singlepax / $tcnt4, 2);

                $bookdate = $makchkin;
                $chk = '1';
                $chko = "";
                $mqty = $actqty * -1;

                for ($r = 0; $r < $mkdays; $r++) {


                    if ($bookdate == $nchkout) {
                        $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', '$makhotel', '$trcity', '$roomview',
                                                                      '$roomcatg', '$roomtype', '$mqty', '0', '$hotelcatg', '','$chk', '$chko' )") or die(mysqli_error($conn));
                    $chk = '';
                    $chko = "";

                    $bookdate = date('Y-m-d', strtotime($bookdate . ' + 1 days'));
                    if ($bookdate > $makchkout) {
                        break;
                    }
                }
            }
            if ($mkdouble > 0) {
                $roomtype = 2;
                $tcnt4 = $mkdouble * $roomtype;
                $act_mk_doublepax = $mk_doublepax * $mkdouble;
                $actqty = round($act_mk_doublepax / $tcnt4, 2);

                $bookdate = $makchkin;
                $chk = '1';
                $chko = "";
                $mqty = $actqty * -1;

                for ($r = 0; $r < $mkdays; $r++) {
                    if ($bookdate == $nchkout) {
                        $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', '$makhotel', '$trcity', '$roomview',
                                                                      '$roomcatg', '$roomtype', '$mqty', '0', '$hotelcatg', '','$chk', '$chko' )") or die(mysqli_error($conn));
                    $chk = '';
                    $chko = "";

                    $bookdate = date('Y-m-d', strtotime($bookdate . ' + 1 days'));
                    if ($bookdate > $makchkout) {
                        break;
                    }
                }
            }
            if ($mktriple > 0) {
                $roomtype = 3;
                $tcnt3 = $mktriple * $roomtype;
                $act_mk_triplepax = $mk_triplepax * $mktriple;
                $actqty = round($act_mk_triplepax / $tcnt3, 2);

                $bookdate = $makchkin;
                $chk = '1';
                $chko = "";
                $mqty = $actqty * -1;

                for ($r = 0; $r < $mkdays; $r++) {

                    if ($bookdate == $nchkout) {
                        $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', '$makhotel', '$trcity', '$roomview',
                                                                      '$roomcatg', '$roomtype', '$mqty', '0', '$hotelcatg', '','$chk', '$chko' )") or die(mysqli_error($conn));
                    $chk = '';
                    $chko = "";

                    $bookdate = date('Y-m-d', strtotime($bookdate . ' + 1 days'));
                    if ($bookdate > $makchkout) {
                        break;
                    }
                }
            }
            if ($mkquad > 0) {
                $roomtype = 4;
                $tcnt = $mkquad * $roomtype;
                $act_mk_quadpax = $mk_quadpax * $mkquad;
                $actqty = round($act_mk_quadpax / $tcnt, 2);

                $bookdate = $makchkin;
                $chk = '1';
                $chko = "";
                $mqty = $actqty * -1;

                for ($r = 0; $r < $mkdays; $r++) {
                    if ($bookdate == $nchkout) {
                        $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', '$makhotel', '$trcity', '$roomview',
                                                                      '$roomcatg', '$roomtype', '$mqty', '0', '$hotelcatg', '','$chk', '$chko' )") or die(mysqli_error($conn));
                    $chk = '';
                    $chko = "";

                    $bookdate = date('Y-m-d', strtotime($bookdate . ' + 1 days'));
                    if ($bookdate > $makchkout) {
                        break;
                    }
                }
            }
            if ($mkquint > 0) {
                $roomtype = 5;
                $tcnt3 = $mkquint * $roomtype;
                $act_mk_quintpax = $mk_quintpax * $mkquint;
                $actqty = round($act_mk_quintpax / $tcnt3, 2);

                $bookdate = $makchkin;
                $chk = '1';
                $chko = "";
                $mqty = $actqty * -1;

                for ($r = 0; $r < $mkdays; $r++) {
                    if ($bookdate == $nchkout) {
                        $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', '$makhotel', '$trcity', '$roomview',
                                                                      '$roomcatg', '$roomtype', '$mqty', '0', '$hotelcatg', '','$chk', '$chko' )") or die(mysqli_error($conn));
                    $chk = '';
                    $chko = "";

                    $bookdate = date('Y-m-d', strtotime($bookdate . ' + 1 days'));
                    if ($bookdate > $makchkout) {
                        break;
                    }
                }
            }
            if ($mksuite > 0) {
                $roomtype = 6;
                $tcnt3 = $mksuite * $roomtype;
                $act_mk_suitepax = $mk_suitepax * $mksuite;
                $actqty = round($act_mk_suitepax / $tcnt3, 2);

                $bookdate = $makchkin;
                $chk = '1';
                $chko = "";
                $mqty = $actqty * -1;

                for ($r = 0; $r < $mkdays; $r++) {

                    if ($bookdate == $nchkout) {
                        $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', '$makhotel', '$trcity', '$roomview',
                                                                      '$roomcatg', '$roomtype', '$mqty', '0', '$hotelcatg', '','$chk', '$chko' )") or die(mysqli_error($conn));
                    $chk = '';
                    $chko = "";

                    $bookdate = date('Y-m-d', strtotime($bookdate . ' + 1 days'));
                    if ($bookdate > $makchkout) {
                        break;
                    }
                }
            }
        }

        //        mak hotel insertion end
        //        med hotel insertion start
        //        Makkah hotel insertion start

        if ($madhotel > 0) {

            $mhotcatg = mysqli_query($conn, "SELECT category,city FROM hotels where code='$madhotel'") or die(mysqli_error($conn));
            $thotcatg = mysqli_fetch_array($mhotcatg);
            $hotelcatg = $thotcatg['category']; // hotel category 
            $trcity = $thotcatg['city']; // hotel category 
            //            $mroomcatg = mysqli_query($conn, "SELECT roomcatg FROM tour WHERE code='$tourcode'") or die(mysqli_error($conn));
            //            $troomcatg = mysqli_fetch_array($mroomcatg);
            //            $roomcatg = $troomcatg['roomcatg']; // room category
            $roomcatg = $mdroomcatg;
            $dt1 = date_create($madchkin);
            $dt2 = date_create($madchkout);

            $subtdate = date_diff($dt1, $dt2);
            $mddays = $subtdate->format('%a');

            $nchkout = date('Y-m-d', strtotime($madchkout . ' - 1 days'));

            if ($mdsingle > 0) {
                $roomtype = 1;
                $tcnt4 = $mdsingle * $roomtype;
                $act_md_singlepax = $md_singlepax * $mdsingle;
                $actqty = round($act_md_singlepax / $tcnt4, 2);

                $bookdate = $madchkin;
                $chk = '1';
                $chko = "";
                $mqty = $actqty * -1;

                for ($r = 0; $r < $mddays; $r++) {


                    if ($bookdate == $nchkout) {
                        $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', '$madhotel', '$trcity', '$roomview',
                                                                      '$roomcatg', '$roomtype', '$mqty', '0', '$hotelcatg', '','$chk', '$chko' )") or die(mysqli_error($conn));
                    $chk = '';
                    $chko = "";

                    $bookdate = date('Y-m-d', strtotime($bookdate . ' + 1 days'));
                    if ($bookdate > $madchkout) {
                        break;
                    }
                }
            }
            if ($mddouble > 0) {
                $roomtype = 2;
                $tcnt4 = $mddouble * $roomtype;
                $act_md_doublepax = $md_doublepax * $mddouble;
                $actqty = round($act_md_doublepax / $tcnt4, 2);

                $bookdate = $madchkin;
                $chk = '1';
                $chko = "";
                $mqty = $actqty * -1;

                for ($r = 0; $r < $mddays; $r++) {
                    if ($bookdate == $nchkout) {
                        $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', '$madhotel', '$trcity', '$roomview',
                                                                      '$roomcatg', '$roomtype', '$mqty', '0', '$hotelcatg', '','$chk', '$chko' )") or die(mysqli_error($conn));
                    $chk = '';
                    $chko = "";

                    $bookdate = date('Y-m-d', strtotime($bookdate . ' + 1 days'));
                    if ($bookdate > $madchkout) {
                        break;
                    }
                }
            }
            if ($mdtriple > 0) {
                $roomtype = 3;
                $tcnt3 = $mdtriple * $roomtype;
                $act_md_triplepax = $md_triplepax * $mdtriple;
                $actqty = round($act_md_triplepax / $tcnt3, 2);

                $bookdate = $madchkin;
                $chk = '1';
                $chko = "";
                $mqty = $actqty * -1;

                for ($r = 0; $r < $mddays; $r++) {

                    if ($bookdate == $nchkout) {
                        $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', '$madhotel', '$trcity', '$roomview',
                                                                      '$roomcatg', '$roomtype', '$mqty', '0', '$hotelcatg', '','$chk', '$chko' )") or die(mysqli_error($conn));
                    $chk = '';
                    $chko = "";

                    $bookdate = date('Y-m-d', strtotime($bookdate . ' + 1 days'));
                    if ($bookdate > $madchkout) {
                        break;
                    }
                }
            }
            if ($mdquad > 0) {
                $roomtype = 4;
                $tcnt = $mdquad * $roomtype;
                $act_md_quadpax = $md_quadpax * $mdquad;
                $actqty = round($act_md_quadpax / $tcnt, 2);

                $bookdate = $madchkin;
                $chk = '1';
                $chko = "";
                $mqty = $actqty * -1;

                for ($r = 0; $r < $mddays; $r++) {
                    if ($bookdate == $nchkout) {
                        $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', '$madhotel', '$trcity', '$roomview',
                                                                      '$roomcatg', '$roomtype', '$mqty', '0', '$hotelcatg', '','$chk', '$chko' )") or die(mysqli_error($conn));
                    $chk = '';
                    $chko = "";

                    $bookdate = date('Y-m-d', strtotime($bookdate . ' + 1 days'));
                    if ($bookdate > $madchkout) {
                        break;
                    }
                }
            }
            if ($mdquint > 0) {
                $roomtype = 5;
                $tcnt3 = $mdquint * $roomtype;
                $act_md_quintpax = $md_quintpax * $mdquint;
                $actqty = round($act_md_quintpax / $tcnt3, 2);

                $bookdate = $madchkin;
                $chk = '1';
                $chko = "";
                $mqty = $actqty * -1;

                for ($r = 0; $r < $mddays; $r++) {
                    if ($bookdate == $nchkout) {
                        $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', '$madhotel', '$trcity', '$roomview',
                                                                      '$roomcatg', '$roomtype', '$mqty', '0', '$hotelcatg', '','$chk', '$chko' )") or die(mysqli_error($conn));
                    $chk = '';
                    $chko = "";

                    $bookdate = date('Y-m-d', strtotime($bookdate . ' + 1 days'));
                    if ($bookdate > $madchkout) {
                        break;
                    }
                }
            }
            if ($mdsuite > 0) {
                $roomtype = 6;
                $tcnt3 = $mdsuite * $roomtype;
                $act_md_suitepax = $md_suitepax * $mdsuite;
                $actqty = round($act_md_suitepax / $tcnt3, 2);

                $bookdate = $madchkin;
                $chk = '1';
                $chko = "";
                $mqty = $actqty * -1;

                for ($r = 0; $r < $mddays; $r++) {

                    if ($bookdate == $nchkout) {
                        $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', '$madhotel', '$trcity', '$roomview',
                                                                      '$roomcatg', '$roomtype', '$mqty', '0', '$hotelcatg', '','$chk', '$chko' )") or die(mysqli_error($conn));
                    $chk = '';
                    $chko = "";

                    $bookdate = date('Y-m-d', strtotime($bookdate . ' + 1 days'));
                    if ($bookdate > $madchkout) {
                        break;
                    }
                }
            }
        }





        //        med hotel insertion end
        //        shifting hotel insertion start
        if ($othhotel > 0) {

            $mhotcatg = mysqli_query($conn, "SELECT category,city FROM hotels where code='$othhotel'") or die(mysqli_error($conn));
            $thotcatg = mysqli_fetch_array($mhotcatg);
            $hotelcatg = $thotcatg['category']; // hotel category 
            $trcity = $thotcatg['city']; // hotel category 
            //            $mroomcatg = mysqli_query($conn, "SELECT roomcatg FROM tour WHERE code='$tourcode'") or die(mysqli_error($conn));
            //            $troomcatg = mysqli_fetch_array($mroomcatg);
            //            $roomcatg = $troomcatg['roomcatg']; // room category
            $roomcatg = $othrmcatg;
            $dt1 = date_create($othchkin);
            $dt2 = date_create($othchkout);

            $subtdate = date_diff($dt1, $dt2);
            $mddays = $subtdate->format('%a');

            $nchkout = date('Y-m-d', strtotime($othchkout . ' - 1 days'));

            if ($mksingle > 0) {
                $roomtype = 1;
                $tcnt4 = $mksingle * $roomtype;
                $act_mk_singlepax = $mk_singlepax * $mksingle;
                $actqty = round($act_mk_singlepax / $tcnt4, 2);

                $bookdate = $othchkin;
                $chk = '1';
                $chko = "";
                $mqty = $actqty * -1;

                for ($r = 0; $r < $mkdays; $r++) {


                    if ($bookdate == $nchkout) {
                        $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', '$othhotel', '$trcity', '$roomview',
                                                                      '$roomcatg', '$roomtype', '$mqty', '0', '$hotelcatg', '','$chk', '$chko' )") or die(mysqli_error($conn));
                    $chk = '';
                    $chko = "";

                    $bookdate = date('Y-m-d', strtotime($bookdate . ' + 1 days'));
                    if ($bookdate > $othchkout) {
                        break;
                    }
                }
            }
            if ($mkdouble > 0) {
                $roomtype = 2;
                $tcnt4 = $mkdouble * $roomtype;
                $act_mk_doublepax = $mk_doublepax * $mkdouble;
                $actqty = round($act_mk_doublepax / $tcnt4, 2);

                $bookdate = $othchkin;
                $chk = '1';
                $chko = "";
                $mqty = $actqty * -1;

                for ($r = 0; $r < $mkdays; $r++) {
                    if ($bookdate == $nchkout) {
                        $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', '$othhotel', '$trcity', '$roomview',
                                                                      '$roomcatg', '$roomtype', '$mqty', '0', '$hotelcatg', '','$chk', '$chko' )") or die(mysqli_error($conn));
                    $chk = '';
                    $chko = "";

                    $bookdate = date('Y-m-d', strtotime($bookdate . ' + 1 days'));
                    if ($bookdate > $othchkout) {
                        break;
                    }
                }
            }
            if ($mktriple > 0) {
                $roomtype = 3;
                $tcnt3 = $mktriple * $roomtype;
                $act_mk_triplepax = $mk_triplepax * $mktriple;
                $actqty = round($act_mk_triplepax / $tcnt3, 2);

                $bookdate = $othchkin;
                $chk = '1';
                $chko = "";
                $mqty = $actqty * -1;

                for ($r = 0; $r < $mkdays; $r++) {

                    if ($bookdate == $nchkout) {
                        $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', '$othhotel', '$trcity', '$roomview',
                                                                      '$roomcatg', '$roomtype', '$mqty', '0', '$hotelcatg', '','$chk', '$chko' )") or die(mysqli_error($conn));
                    $chk = '';
                    $chko = "";

                    $bookdate = date('Y-m-d', strtotime($bookdate . ' + 1 days'));
                    if ($bookdate > $othchkout) {
                        break;
                    }
                }
            }
            if ($mkquad > 0) {
                $roomtype = 4;
                $tcnt = $mkquad * $roomtype;
                $act_mk_quadpax = $mk_quadpax * $mkquad;
                $actqty = round($act_mk_quadpax / $tcnt, 2);

                browse("T" . $tcnt3);
                browse("A" . $actqty);

                $bookdate = $othchkin;
                $chk = '1';
                $chko = "";
                $mqty = $actqty * -1;

                for ($r = 0; $r < $mkdays; $r++) {
                    if ($bookdate == $nchkout) {
                        $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', '$othhotel', '$trcity', '$roomview',
                                                                      '$roomcatg', '$roomtype', '$mqty', '0', '$hotelcatg', '','$chk', '$chko' )") or die(mysqli_error($conn));
                    $chk = '';
                    $chko = "";

                    $bookdate = date('Y-m-d', strtotime($bookdate . ' + 1 days'));
                    if ($bookdate > $othchkout) {
                        break;
                    }
                }
            }
            if ($mkquint > 0) {
                $roomtype = 5;
                $tcnt3 = $mkquint * $roomtype;
                $act_mk_quintpax = $mk_quintpax * $mkquint;
                $actqty = round($act_mk_quintpax / $tcnt3, 2);

                $bookdate = $othchkin;
                $chk = '1';
                $chko = "";
                $mqty = $actqty * -1;

                for ($r = 0; $r < $mkdays; $r++) {
                    if ($bookdate == $nchkout) {
                        $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', '$othhotel', '$trcity', '$roomview',
                                                                      '$roomcatg', '$roomtype', '$mqty', '0', '$hotelcatg', '','$chk', '$chko' )") or die(mysqli_error($conn));
                    $chk = '';
                    $chko = "";

                    $bookdate = date('Y-m-d', strtotime($bookdate . ' + 1 days'));
                    if ($bookdate > $othchkout) {
                        break;
                    }
                }
            }
            if ($mksuite > 0) {
                $roomtype = 6;
                $tcnt3 = $mksuite * $roomtype;
                $act_mk_suitepax = $mk_suitepax * $mksuite;
                $actqty = round($act_mk_suitepax / $tcnt3, 2);

                $bookdate = $othchkin;
                $chk = '1';
                $chko = "";
                $mqty = $actqty * -1;

                for ($r = 0; $r < $mkdays; $r++) {

                    if ($bookdate == $nchkout) {
                        $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', '$othhotel', '$trcity', '$roomview',
                                                                      '$roomcatg', '$roomtype', '$mqty', '0', '$hotelcatg', '','$chk', '$chko' )") or die(mysqli_error($conn));
                    $chk = '';
                    $chko = "";

                    $bookdate = date('Y-m-d', strtotime($bookdate . ' + 1 days'));
                    if ($bookdate > $othchkout) {
                        break;
                    }
                }
            }
        }
        //        shifting hotel insertion end




        $itemstax = $_POST["itemstax"];

        mysqli_query($conn, "DELETE FROM `regncash` WHERE `vouchno` = '$mvouch' ") or die(mysqli_error($conn));

        mysqli_query($conn, "INSERT INTO `regncash`(`vouchno`, `tourno`, `regnno`, `csfull`, `csfullno`, `csfullamt`,
                                                            `cshalf`, `cshalfno`, `cshalfamt`, `cschildwob`, `cschildwobno`, 
                                                            `cschildwobamt`, `csinf`, `csinfno`, `csinfamt`, `csnettot`) 
                                                       VALUES ('$vouchno', '$tourcode', '$regnno', '$csfull', '$csfullno', '$csfullamt',
                                                               '$cshalf', '$cshalfno', '$cshalfamt', '$cschildwob', '$cschildwobno', 
                                                               '$cschildwobamt', '$csinf', '$csinfno', '$csinfamt', '$csnettot')") or die(mysqli_error($conn));

        mysqli_query($conn, "DELETE FROM `regntax` WHERE `vouchno` = '$mvouch' ") or die(mysqli_error($conn));
        $cnt = 0;
        for ($t = 0; $t <= $itemstax; $t++) {
            $cnt++;
            $srno = $_POST["srno_$t"];
            $singamt = $_POST["ppamt_$t"];
            $paxcnt = $_POST["tpax_$t"];
            $gsteach = $_POST["fgst_$t"];
            $tcs1each = $_POST["ftcs1_$t"];
            $tcs2each = $_POST["ftcs2_$t"];
            $totgst = $_POST["ftgst_$t"];
            $tottcs1 = $_POST["fgtcs1_$t"];
            $tottcs2 = $_POST["fgtcs2_$t"];

            if ($singamt > 0) {

                mysqli_query($conn, "INSERT INTO `regntax`(`vouchno`,  `srno`, `singamt`, `paxcnt`, `gsteach`, `tcs1each`, `tcs2each`, `totgst`, `tottcs1`, `tottcs2`) 
                                                       VALUES ('$mvouch', '$cnt', '$singamt', '$paxcnt', '$gsteach', '$tcs1each', '$tcs2each', '$totgst', '$tottcs1', '$tottcs2' )") or die(mysqli_error($conn));
            }
        }




        if ($addflag == 1) {
            mysqli_query($conn, "DELETE FROM `$trandb` WHERE `vregnno` = '$regnno' and tour = '$tourcode'") or die(mysqli_error($conn));
            $count = $_POST["items"];
            browse('No. Of Pax - ' . $count);
            for ($i = 0; $i <= $count; $i++) {
                $suffix = $_POST["suffix_$i"];
                $paxname = $_POST["paxname_$i"];
                $paxgend = $_POST["paxgend_$i"];
                $ticktamt = $_POST["ticktamt_$i"];
                $touramt = $_POST["touramt_$i"];
                $paxpass = $_POST["paxpass_$i"];
                $manualno = $_POST["manualno_$i"];

                if (!empty($paxname)) {
                    $gen2 = mysqli_query($conn, "SELECT IFNULL(MAX(vouchno), 0) AS maxcode FROM `$trandb` where vregnno != '' and tour = '$tourcode' LIMIT 0,1 ") or die(mysqli_error($conn));
                    $vvouch2 = mysqli_fetch_assoc($gen2);
                    if ($vvouch2['maxcode'] > 0) {
                        $qvouch2 = $vvouch2["maxcode"] + 1;
                    } else {
                        $gen23 = mysqli_query($conn, "SELECT startpax  FROM `tour` WHERE code = '$tourcode'  ") or die(mysqli_error($conn));
                        if (mysqli_num_rows($gen23) > 0) {
                            $fet23 = mysqli_fetch_array($gen23);
                            $qvouch2 = $fet23['startpax'];
                        } else {
                            $qvouch2 = '1';
                        }
                    }
                    $paxvouch = $qvouch2;

                    $mname = TRIM($paxname);
                    $sp = explode(" ", $mname);
                    $sp1 = $sp[0];
                    $sp2 = $sp[1];
                    $sp3 = $sp[2];

                    if (strlen($sp1) == strlen($mname)) {
                        $mlastname = $mname;
                        $msurname = $surname;
                        $mmidname = "";
                    } else {
                        $msurname = $surname;
                        if ($sp2 == "") {
                            $mlastname = $sp1;
                            $mmidname = "";
                        } else {
                            $mlastname = $sp1;
                            $mmidname = $sp2;
                        }
                    }
                    //                    $sp3 = explode(" ", $mname, 3);

                    $truuid = generate_uuid();
                    mysqli_query($conn, "INSERT INTO `$trandb`(`vouchno`, `bookvouch`, `vouchdt`, `srno`, `surname`, `name`, `suffix`,
                                                               `midname`, `lastname`, `vregnno`, cmbgender,
                                                               `redypass`, `sex`,  `username`,  `tktamt`, `touramt`,
                                                               `manual`, `mkroom`, `mdroom`, `othroom`, `tour`, `uuid`) 
                                                       VALUES ('$paxvouch', '$mvouch', '$vouchdt', '$ctr', '$msurname', '$mname', '$suffix',
                                                               '$mmidname', '$mlastname', '$regnno', '$paxgend',
                                                               '$paxpass', '$paxgend',  '$username',  '$ticktamt', '$touramt', 
                                                               '$manualno', '$mkroom', '$mdroom', '$othroom', '$tourcode', '$truuid')") or die(mysqli_error($conn));
                }
            }


            $uuid = $_SESSION["uuid"];
            #################################TRAN PART END #################################
            mysqli_query($conn, "INSERT INTO `$maindb`(`vouchno`, regnno, `vouchdt`, `accode`, `haji`, `surname`, `groupno`, `batchno`, `tourno`, `craft`, `sector`, `depdate`, `deptime`, `deppnr`, `depflt`,
                                                       `arrdate`, `arrtime`, `arrpnr`, `arrflt`, `saudiagent`, `agent`, `rem1`, `rem2`, `rem3`, `refd1`, `refd2`, `refd3`, `cancdate`, `passlimit`, `halfpay`, `fullpay`, `discrem`,
                                                       `full`, `full2`, `fullno`, `fullamt`, `full_2`, `full2_2`, `fullno_2`, `fullamt_2`, `full_3`, `full2_3`, `fullno_3`, `fullamt_3`,  `half`, `half2`, `halfno`, `halfamt`, `childwob`, `childwob2`, `childwobno`, `childwobamt`, `inf`, `inf2`, `infno`, `infamt`,
                                                       `visachg`, `visachgno`, `visachgamt`, `airtax`, `airtaxno`, `airtaxamt`, `disc`, `disc2`, `discno`, `discamt`, `amount`, `farediff`, `farediff2`, `farediffno`, `farediffamt`,
                                                       `cancelchg`, `cancelchg2`, `cancelchgno`, `cancelchgamt`, `nettot`, `cgstno`, `cgstamt`, `sgstno`, `sgstamt`, `igstno`, `igstamt`, `tcs`, `tcsamt`, `netamt`, `fname`, `sname`,
                                                       `add1`, `add2`, `add3`, `sadd1`, `sadd2`, `sadd3`, `city`, `city2`, `pin`, `pin2`, `state`, `state2`, `tel`, `tel2`, `mobile`, `tcs2`, `tcsamt2`, `oms`,
                                                       `mobile2`, `email`, `email2`, `mksingle`, `mdsingle`, `mkdouble`, `mddouble`, `mktriple`, `mdtriple`, `mkquad`, `mdquad`, 
                                                       `mkquint`, `mdquint`, `mksuite`, `mdsuite`, `mknobed`, `mdnobed`, `mkroom`, `mdroom`, `othroom`, `busno`, `ziyamk`, `ziyamd`,agentcomm,
                                                       `makhotel`, `madhotel`, `makchkin`, `makchkout`, `madchkin`, `madchkout`,`mk_singlepax`, `mk_doublepax`, `mk_triplepax`, `mk_quadpax`, `mk_quintpax`, `mk_suitepax`,
                                                       `md_singlepax`, `md_doublepax`, `md_triplepax`, `md_quadpax`, `md_quintpax`, `md_suitepax`, mkroomcatg, mdroomcatg, gstno, `othrmcatg`, `othhotel`, `othchkin`, `othchkout`,uuid)
                                               VALUES ('$mvouch', '$regnno', '$vouchdt', '$accode', '$haji', '$surname', '$groupno','$batchno',  '$tour', '$craft', '$sector', '$depdate', '$deptime', '$deppnr', '$depflt',
                                                       '$arrdate', '$arrtime','$arrpnr','$arrflt', '$saudiagent', '$agent', '$rem1', '$rem2', '$rem3', '$refd1', '$refd2', '$refd3', '$cancdate', '$passlimit', '$halfpay', '$fullpay', '$discrem',
                                                       '$full', '$full2', '$fullno', '$fullamt', '$full_2', '$full2_2', '$fullno_2', '$fullamt_2', '$full_3', '$full2_3', '$fullno_3', '$fullamt_3',  '$half', '$half2', '$halfno', '$halfamt', '$childwob', '$childwob2', '$childwobno', '$childwobamt', '$inf', '$inf2', '$infno', '$infamt', 
                                                       '$visachg', '$visachgno', '$visachgamt', '$airtax', '$airtaxno', '$airtaxamt', '$disc', '$disc2', '$discno', '$discamt', '$amount', '$farediff', '$farediff2',  '$farediffno', '$farediffamt',
                                                       '$cancelchg', '$cancelchg2', '$cancelchgno', '$cancelchgamt', '$nettot', '$cgstno', '$cgstamt', '$sgstno', '$sgstamt', '$igstno', '$igstamt', '$tcs', '$tcsamt', '$netamt', '$fname', '$sname',
                                                       '$add1', '$add2', '$add3', '$sadd1', '$sadd2', '$sadd3', '$city', '$city2', '$pin', '$pin2', '$state', '$state2', '$tel', '$tel2', '$mobile','$tcs2', '$tcsamt2','$oms',
                                                       '$mobile2', '$email', '$email2', '$mksingle', '$mdsingle', '$mkdouble', '$mddouble', '$mktriple', '$mdtriple', '$mkquad', '$mdquad',  
                                                       '$mkquint', '$mdquint', '$mksuite', '$mdsuite', '$mknobed', '$mdnobed', '$mkroom', '$mdroom', '$othroom', '$busno', '$ziyamk', '$ziyamd', '$agentcomm', 
                                                       '$makhotel', '$madhotel', '$makchkin', '$makchkout', '$madchkin', '$madchkout','$mk_singlepax', '$mk_doublepax', '$mk_triplepax', '$mk_quadpax', '$mk_quintpax', '$mk_suitepax',
                                                       '$md_singlepax', '$md_doublepax', '$md_triplepax', '$md_quadpax', '$md_quintpax', '$md_suitepax', '$mkroomcatg', '$mdroomcatg', '$gstno', '$othrmcatg', '$othhotel', '$othchkin', '$othchkout', '$uuid')") or die(mysqli_error($conn));
            insmess();
            $mvouch = $qvouch; //1
            header("refresh: 1; $file?$keyfld=$mvouch&mode=edit");
        } else {

            $mvouch = $qvouch; //1
            mysqli_query($conn, "UPDATE `$maindb` SET `vouchdt`='$vouchdt', `accode`='$accode', `haji`='$haji', `surname`='$surname',  `groupno`='$groupno',  `batchno`='$batchno', `tourno`='$tour', `craft`='$craft', `sector`='$sector', `depdate`='$depdate', 
                                         `deptime`='$deptime', `deppnr`='$deppnr',  `depflt`='$depflt',  `arrdate`='$arrdate', `arrtime`='$arrtime', `arrpnr`='$arrpnr', `arrflt`='$arrflt', `saudiagent`='$saudiagent', `agent`='$agent', 
                                         `rem1`='$rem1', `rem2`='$rem2', `rem3`='$rem3', `refd1`='$refd1', `refd2`='$refd2', `refd3`='$refd3', `cancdate`='$cancdate', `passlimit`='$passlimit',  `halfpay`='$halfpay', `fullpay`='$fullpay', `discrem`='$discrem',
                                         `full`='$full', `full2`='$full2', `fullno`='$fullno', `fullamt`='$fullamt', 
                                         `full_2`='$full_2', `full2_2`='$full2_2', `fullno_2`='$fullno_2', `fullamt_2`='$fullamt_2',
                                         `full_3`='$full_3', `full2_3`='$full2_3', `fullno_3`='$fullno_3', `fullamt_3`='$fullamt_3',
                                         `half`='$half',`half2`='$half2', `halfno`='$halfno', `halfamt`='$halfamt', `childwob`='$childwob', `childwob2`='$childwob2', `childwobno`='$childwobno',
                                         `childwobno`='$childwobno', `childwobamt`='$childwobamt', `inf`='$inf', `inf2`='$inf2', `infno`='$infno', `infamt`='$infamt', `visachg`='$visachg', `visachgno`='$visachgno', `visachgamt`='$visachgamt',
                                         `airtax`='$airtax', `airtaxno`='$airtaxno', `airtaxamt`='$airtaxamt', `disc`='$disc', `disc2`='$disc2', `discno`='$discno', `discamt`='$discamt', `amount`='$amount', `farediff`='$farediff', `farediff2`='$farediff2', 
                                         `farediffno`='$farediffno', `farediffamt`='$farediffamt', `cancelchg`='$cancelchg', `cancelchg2`='$cancelchg2', `cancelchgno`='$cancelchgno', `cancelchgamt`='$cancelchgamt', `nettot`='$nettot',
                                         `cgstno`='$cgstno', `cgstamt`='$cgstamt', `sgstno`='$sgstno', `sgstamt`='$sgstamt', `igstno`='$igstno', `igstamt`='$igstamt', `tcs`='$tcs', `tcsamt`='$tcsamt', `netamt`='$netamt', `fname`='$fname', `sname`='$sname', 
                                         `add1`='$add1', `add2`='$add2', `add3`='$add3', `sadd1`='$sadd1', `sadd2`='$sadd2', `sadd3`='$sadd3', `city`='$city', `city2`='$city2', `pin`='$pin', `pin2`='$pin2', `state`='$state', `state2`='$state2',
                                         `tel`='$tel', `tel2`='$tel2', `mobile`='$mobile', `mobile2`='$mobile2', `email`='$email', `email2`='$email2',`tcs2`='$tcs2', `tcsamt2`='$tcsamt2', oms = '$oms',
                                         `mksingle`='$mksingle', `mdsingle`='$mdsingle', `mkdouble`='$mkdouble', `mddouble`='$mddouble', `mktriple`='$mktriple',
                                         `mdtriple`='$mdtriple', `mkquad`='$mkquad', `mdquad`='$mdquad', `mkquint`='$mkquint', `mdquint`='$mdquint',
                                         `mksuite`='$mksuite', `mdsuite`='$mdsuite', `mknobed`='$mknobed', `mdnobed`='$mdnobed', `mkroom`='$mkroom', `mdroom`='$mdroom',
                                         `othroom`='$othroom', `busno`='$busno', `ziyamk`='$ziyamk', `ziyamd`='$ziyamd', agentcomm='$agentcomm', mkroomcatg='$mkroomcatg', mdroomcatg='$mdroomcatg',
                                         `makhotel`='$makhotel', `madhotel`='$madhotel', `makchkin`='$makchkin', `makchkout`='$makchkout', `madchkin`='$madchkin', `madchkout`='$madchkout',
                                         `mk_singlepax`='$mk_singlepax', `mk_doublepax`='$mk_doublepax', `mk_triplepax`='$mk_triplepax', `mk_quadpax`='$mk_quadpax', `mk_quintpax`='$mk_quintpax', `mk_suitepax`='$mk_suitepax',
                                         `md_singlepax`='$md_singlepax', `md_doublepax`='$md_doublepax', `md_triplepax`='$md_triplepax', `md_quadpax`='$md_quadpax', `md_quintpax`='$md_quintpax', `md_suitepax`='$md_suitepax',
                                         `gstno`='$gstno', `othrmcatg`='$othrmcatg', `othhotel`='$othhotel', `othchkin`='$othchkin', `othchkout`='$othchkout' WHERE `vouchno`= '$mvouch' ") or die(mysqli_error($conn));
            updmess();
            header("refresh: 1; $file?$keyfld=$mvouch&mode=edit");
        }

        ################################# MAIN PART END #################################
    }
}

if ($addflag != 1) {
    $getvouch = '';
    if ($addflag == 0) {
        $getvouch = $_GET[$keyfld];
    } else {
        $getvouch = $qvouch;
    }

    $result = mysqli_query($conn, "SELECT * FROM `$maindb` WHERE $keyfld='$getvouch' $tourcond ") or die(mysqli_error($conn));
    $get = mysqli_fetch_array($result);
    $vregnno = $get['regnno'];
    $accode = $get['accode'];
    $agname = htmlspecialchars($get['agent'], ENT_QUOTES, 'UTF-8');

    $mregcs = mysqli_query($conn, "SELECT * FROM regncash WHERE vouchno = '$get[vouchno]'") or die(mysqli_error($conn));
    $tregcs = mysqli_fetch_array($mregcs);

    $mregsk = mysqli_query($conn, "SELECT vouchno FROM visaform WHERE vregnno = '$get[regnno]' AND tour ='$tourcode'") or die(mysqli_error($conn));
    $tregsk = mysqli_fetch_array($mregsk);

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

    $mhotcatg = mysqli_query($conn, "SELECT code,name FROM hotelcatg where code='$get[hotelcatg]'") or die(mysqli_error($conn));
    $thotcatg = mysqli_fetch_array($mhotcatg);

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

    $gettour = mysqli_query($conn, "SELECT code,name FROM tour where code='$get[tourno]'") or die(mysqli_error($conn));
    $fettour = mysqli_fetch_array($gettour);

    $magent = mysqli_query($conn, "SELECT accode,name FROM accmast where accode='$get[agent]'") or die(mysqli_error($conn));
    $lagent = mysqli_fetch_array($magent);

    $getmakhotel = mysqli_query($conn, "SELECT code,hotelnm FROM hotels where code='$get[makhotel]'") or die(mysqli_error($conn));
    $fetmakhotel = mysqli_fetch_array($getmakhotel);

    $getothhotel = mysqli_query($conn, "SELECT code,hotelnm FROM hotels where code='$get[othhotel]'") or die(mysqli_error($conn));
    $fetothhotel = mysqli_fetch_array($getothhotel);

    $getmakrmctg = mysqli_query($conn, "SELECT code,name FROM roomcatg where code='$get[mkroomcatg]'") or die(mysqli_error($conn));
    $fetmakrmctg = mysqli_fetch_array($getmakrmctg);

    $getothrmctg = mysqli_query($conn, "SELECT code,name FROM roomcatg where code='$get[othrmcatg]'") or die(mysqli_error($conn));
    $fetothrmctg = mysqli_fetch_array($getothrmctg);

    $getmadhotel = mysqli_query($conn, "SELECT code,hotelnm FROM hotels where code='$get[madhotel]'") or die(mysqli_error($conn));
    $fetmadhotel = mysqli_fetch_array($getmadhotel);
    $getmadrmctg = mysqli_query($conn, "SELECT code,name FROM roomcatg where code='$get[mdroomcatg]'") or die(mysqli_error($conn));
    $fetmadrmctg = mysqli_fetch_array($getmadrmctg);
}

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

if (isset($_GET["delete"])) {
    $delcond1 = " vouchno = '$_GET[$keyfld]' $tourcond ";
    $delcond1v = " vregnno = '$vregnno' and tour ='$tourcode' ";
    $delcond = " source = '$source' and vouchno = '$_GET[vouchno]' and tour ='$tourcode' ";
    $delcondn = " source = '$cshsource' and vouchno = '$_GET[vouchno]' and tour ='$tourcode' ";
    $delcondr = " source = '$source' and vouchno = '$_GET[vouchno]'  ";

    delnew($zdb, "$maindb", "$delcond1", "$file?mode=last");
    delnew($zdb, "visaform", "$delcond1v", "$file?mode=last");

    delnew($zdb, "$accdb", "$delcond", "$file?mode=last");
    delnew($zdb, "$accdb", "$delcondn", "$file?mode=last");

    delnew($zdb, "roomsacn", "$delcondr", "$file?mode=last");
}

include("includes/linkshead.php");
?>
<style>
    .nav {
        text-transform: uppercase;
        font-weight: bold;
        /* width: 1400px; */
    }

    .skbtnnew {
        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;
    }

    .taxbtn {
        background-image: linear-gradient(135deg, #0096c7 10%, #00b4d8 100%) !important;
        border: 2px solid #2FBFFE !important;
        color: white !important;
        font-weight: bold;
        font-size: 11px;
        border-radius: 10px !important;
        /*width: 110px;*/
        text-align: center;
        align-items: center;
        margin-bottom: 5px;
    }

    .skbtn {
        background-image: linear-gradient(135deg, #09C6F9 10%, #045DE9 100%) !important;
        border: 2px solid #2FBFFE !important;
        color: white !important;
        font-weight: bold;
        font-size: 11px;
        border-radius: 10px !important;
        width: 110px;
        text-align: center;
        align-items: center;
        margin-bottom: 5px;
    }

    .skbtn:hover {
        color: black !important;
    }

    .skbtn4 {
        background-color: white;
        border: 2px solid #2FBFFE !important;
        color: #2FBFFE;
        font-weight: bold;
        font-size: 11px;
        border-radius: 10px !important;
        width: 110px;
        text-align: center !important;
        margin-bottom: 5px;

    }



    .skbtn4:hover {
        background-color: yellow !important;
    }

    .nav>li.active>a,

    .nav>li.active>a:hover,

    .nav>li.active>a:focus {

        background-color: #2fbffe;

        border-bottom-color: transparent;

        border-radius: 10px;

        margin-bottom: 3px;

        margin-top: 2px;

    }

    .makbackcolr{
        background-color: #aceffa;
        margin-left:10px;
    }
    .madbackcolr{
        background-color: rgba(1, 164, 106,0.2);
        margin-left:10px;
    }
    .shiftbackcolr{
        background-color: #fefae0;
        margin-left:10px;
    }

    .skmadfont{
        font-size:14px;
    }

</style>

<script src="MyScript/shortkeys.js?a=2" type="text/javascript"></script>
<script src="MyScript/bookform.js?a=<? mt_rand() ?>" type="text/javascript"></script>
<script src="MyScript/bookform_search.js?a=2" type="text/javascript"></script>
</head>

<body>
    <form action='' method='POST'>
        <!-- Default box -->
        <div>
            <div class="col-lg-12 col-md-10 col-sm-12 col-xs-12  pad">
                <div class="panel panel-default">

                    <div class="panel-footer" style="padding:0px;">
                        <div class="row">
                            <div class="col-lg-1 col-md-7 col-sm-8 col-xs-8 text-left pad" style="margin-top: 6px;padding-left: 1%;width:  10%">
                                <h3 class="panel-title" style="color:inherit"><?php echo $formname; ?></h3>
                            </div>
                            <div class="col-lg-1 col-md-2 col-sm-2 col-xs-2 text-right pad"  style="margin-top: 6px;">
                                <label class="label-control marg">Tour</label>
                            </div>
                            <div class="col-lg-1 col-md-2 col-sm-2 col-xs-2  pad"  style="margin-top: 6px;">
                                <select name="tour" id="tour" class="form-control form tour">
                                    <option value="<?php echo $tourcode; ?>"><?php echo $tourname; ?></option>
                                </select>

                            </div>
                            <div class="col-lg-4 col-md-5 col-sm-8 col-xs-8 text-right pad">
                                <?php include("includes/buttsale.php"); ?>
                            </div>
                            <div class="col-lg-2 col-md-7 col-sm-8 col-xs-8  pad">
                                <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 skbtnnew bkinvprint" href="bookform_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 skbtnnew bkinvprint" href="bookform_print.php?vouchno=<?= $qvouch; ?>&para=<?= $para ?>&image=No" target="_blank">
                                    <i class="fa fa-print"></i>
                                </a>
                                <a id='print' class="btn btn-pad btn-square skbtnnew bkinv" style="width:35%;line-height:1.7">
                                    Invoice
                                </a>
                            </div>
                            <div class="col-lg-2 col-md-7 col-sm-8 col-xs-8  pad">
                                <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 skbtnnew bkvoucherprint" href="bookform_voucher.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 skbtnnew bkvoucherprint" href="bookform_voucher.php?vouchno=<?= $qvouch; ?>&para=<?= $para ?>&image=No" target="_blank">
                                    <i class="fa fa-print"></i>
                                </a>
                                <a id='print' class="btn btn-pad btn-square skbtnnew bkvprint" style="width:35%;line-height:1.7">
                                    Voucher
                                </a>
                            </div>
                        </div>
                    </div>
                    <div class="panel-body">

                        <!--                        <div class="row">
                                                    <div class="col-lg-1 col-md-2 col-sm-2 col-xs-2 text-right pad">
                                                        <label class="label-control marg">Tour</label>
                                                    </div>
                                                    <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2  pad">
                                                        <select name="tour" id="tour" class="form-control form tour select2" style="width:100%">
                                                            <option value="<?php echo $tourcode; ?>"><?php echo $tourname; ?></option>
                                                        </select>
                        
                                                    </div>
                        
                                                </div>-->
                        <div class="row">
                            <div class="col-lg-1  col-md-2 col-sm-2 col-xs-2 text-right pad">
                                <label class="label-control marg">No.</label>
                            </div>
                            <div class="col-lg-1 col-md-1 col-sm-3 col-xs-3 pad">
                                <input type="text" class="form-control text-size form regnno" name="regnno" value="<?php echo ($addflag != 1) ? $get["regnno"] : "NEW"; ?>" tabindex="1" required readonly>
                                <input type="hidden" class="form-control text-size form vouchno" name="vouchno" value="<?php echo ($addflag != 1) ? $get["vouchno"] : "$qvouch"; ?>" tabindex="1">
                                <input type="hidden" class="form-control text-size form accode" name="accode" value="<?php echo ($addflag != 1) ? $get["accode"] : ""; ?>" tabindex="1">
                                <input type="hidden" class="form-control text-size form addflg" value="<?php echo $addflag; ?>">
                                <input type="hidden" class="form-control text-size form tourtype" value="<?php echo $_SESSION["tourtype"]; ?>">
                                <input type="hidden" class="form-control text-size form mantcs" value="<?php echo $_SESSION["mantcs"]; ?>">
                            </div>
                            <div class="col-lg-1 col-md-1 col-sm-3 col-xs-3 text-right pad">
                                <label class="label-control marg">Date</label>
                            </div>
                            <div class="col-lg-1 col-md-1 col-sm-4 col-xs-4 pad">
                                <input type="date" class="form-control form focusfield  vouchdt" name="vouchdt" value="<?php echo ($addflag != 1) ? $get["vouchdt"] : date('Y-m-d'); ?>" tabindex="2" autofocus>
                            </div>


                            <div class="col-lg-1 col-md-2 col-sm-2 col-xs-2 text-right pad">
                                <label class="label-control marg">Name</label>
                            </div>
                            <div class="col-lg-2 col-md-3 col-sm-4 col-xs-4  pad">
                                <input list="haji" name="haji" class="haji form-control form" value="<?php echo ($addflag != 1) ? $get["haji"] : ""; ?>" tabindex="3" autocomplete="off">
                                <datalist id="haji">

                                    <option value=""></option>
                                    <?php
                                    $mitem = mysqli_query($conn, "SELECT name FROM $zroot.`address` group by name order by name") or die(mysqli_error($conn));

                                    while ($trow = mysqli_fetch_array($mitem)) {
                                        $hajiname = $trow['name'];
                                        echo "<option value='$hajiname'>";
                                    }
                                    ?>
                                </datalist>
                            </div>

                            <div class="col-lg-1 col-md-1 col-sm-2 col-xs-2 text-right pad">
                                <label class="label-control marg">Surname</label>
                            </div>
                            <div class="col-lg-2 col-md-3 col-sm-4 col-xs-4  pad">
                                <input list="surname" name="surname" class="surname form-control form" value="<?php echo ($addflag != 1) ? $get["surname"] : ""; ?>" tabindex="4" autocomplete="off">
                                <datalist id="surname">

                                    <option value=""></option>
                                    <?php
                                    $msurname = mysqli_query($conn, "SELECT surname FROM $maindb group by surname order by surname") or die(mysqli_error($conn));

                                    while ($trow2 = mysqli_fetch_array($msurname)) {
                                        $surnamet = $trow2['surname'];
                                        echo "<option value='$surnamet'>";
                                    }
                                    ?>
                                </datalist>
                            </div>
                        </div>

                        <div class="row">

                            <div class="col-lg-1 col-md-2 col-sm-2 col-xs-2 text-right pad">
                                <label class="label-control marg">Pax Group</label>
                            </div>
                            <div class="col-lg-1 col-md-3 col-sm-4 col-xs-4  pad">
                                <input type="text" class="form-control form groupno" name="groupno" value="<?php echo ($addflag != 1) ? $get["groupno"] : ""; ?>" tabindex="5">
                            </div>
                            <div class="col-lg-1 col-md-2 col-sm-2 col-xs-2 text-right pad">
                                <label class="label-control marg">Class No.</label>
                            </div>
                            <div class="col-lg-2 col-md-3 col-sm-4 col-xs-4  pad">
                                <input list="batchno" name="batchno" class="batchno form-control form" value="<?php echo ($addflag != 1) ? $get["batchno"] : ""; ?>" tabindex="6" autocomplete="off">
                                <datalist id="batchno">

                                    <option value=""></option>
                                    <?php
                                    $mbatchno = mysqli_query($conn, "SELECT batchno FROM `$maindb` group by batchno order by batchno") or die(mysqli_error($conn));

                                    while ($tbat = mysqli_fetch_array($mbatchno)) {
                                        $batchnot = $tbat['batchno'];
                                        echo "<option value='$batchnot'>";
                                    }
                                    ?>
                                </datalist>
                            </div>

                            <div class="col-lg-1 col-md-2 col-sm-2 col-xs-2 text-right pad">
                                <label class="label-control marg">Airlines</label>
                            </div>
                            <div class="col-lg-1 col-md-3 col-sm-4 col-xs-4  pad">
                                <input list="craft" name="craft" class="craft form-control form" value="<?php echo ($addflag != 1) ? $get["craft"] : ""; ?>" tabindex="7" autocomplete="off">
                                <datalist id="craft">

                                    <option value=""></option>
                                    <?php
                                    $mcraft = mysqli_query($conn, "SELECT craft FROM `$maindb` group by craft order by craft") or die(mysqli_error($conn));

                                    while ($tct = mysqli_fetch_array($mcraft)) {
                                        $craftt = $tct['craft'];
                                        echo "<option value='$craftt'>";
                                    }
                                    ?>
                                </datalist>
                            </div>
                            <div class="col-lg-1 col-md-2 col-sm-2 col-xs-2 text-right pad">
                                <label class="label-control marg">Sector</label>
                            </div>
                            <div class="col-lg-3 col-md-3 col-sm-4 col-xs-4  pad">
                                <input list="sector" name="sector" class="sector form-control form" value="<?php echo ($addflag != 1) ? $get["sector"] : ""; ?>" tabindex="8" autocomplete="off">
                                <datalist id="sector">

                                    <option value=""></option>
                                    <?php
                                    $msector = mysqli_query($conn, "SELECT sector FROM `$maindb` group by sector order by sector") or die(mysqli_error($conn));

                                    while ($tst = mysqli_fetch_array($msector)) {
                                        $sectort = $tst['sector'];
                                        echo "<option value='$sectort'>";
                                    }
                                    ?>
                                </datalist>
                            </div>
                        </div>



                        <div class="row" style="background-color: rgba(47,191,254,0.4);">

                            <div class="col-lg-1 col-md-2 col-sm-2 col-xs-2 text-right pad">
                                <label class="label-control marg" style="color:#ff6392;font-weight:bold">Dep. Date</label>
                            </div>
                            <div class="col-lg-1 col-md-3 col-sm-4 col-xs-4  pad">
                                <input type="date" style="color:#ff6392" class="form-control form  depdate" name="depdate" value="<?php echo ($addflag != 1) ? $get["depdate"] : ""; ?>" tabindex="9">
                            </div>
                            <div class="col-lg-1 col-md-2 col-sm-2 col-xs-2 text-right pad">
                                <label class="label-control marg">Dep. Time</label>
                            </div>
                            <div class="col-lg-1 col-md-3 col-sm-4 col-xs-4  pad">
                                <input type="time" class="form-control form deptime" name="deptime" value="<?php echo ($addflag != 1) ? $get["deptime"] : ""; ?>" tabindex="10">
                            </div>
                            <div class="col-lg-1 col-md-2 col-sm-2 col-xs-2 text-right pad">
                                <label class="label-control marg">Dep. PNR</label>
                            </div>
                            <div class="col-lg-1 col-md-3 col-sm-4 col-xs-4  pad">
                                <input type="text" class="form-control form deppnr" name="deppnr" value="<?php echo ($addflag != 1) ? $get["deppnr"] : ""; ?>" tabindex="11">
                            </div>
                            <div class="col-lg-1 col-md-2 col-sm-2 col-xs-2 text-right pad">
                                <label class="label-control marg">Dep. Flt.No.</label>
                            </div>
                            <div class="col-lg-1 col-md-3 col-sm-4 col-xs-4  pad"  style="width:4.33%">
                                <input type="text" class="form-control form  depflt" name="depflt" value="<?php echo ($addflag != 1) ? $get["depflt"] : ""; ?>" tabindex="12">
                            </div>
                            <div class="col-lg-1 col-md-2 col-sm-2 col-xs-2 text-right pad"   style="width:6.33%">
                                <label class="label-control marg">Saudi Agent</label>
                            </div>
                            <div class="col-lg-2 col-md-3 col-sm-4 col-xs-4  pad">
                                <input list="saudiagent" name="saudiagent" class="saudiagent form-control form" value="<?php echo ($addflag != 1) ? $get["saudiagent"] : ""; ?>" tabindex="17" autocomplete="off">
                                <datalist id="saudiagent">

                                    <option value=""></option>
                                    <?php
                                    $msaudiagent = mysqli_query($conn, "SELECT saudiagent FROM `$maindb` group by saudiagent order by saudiagent") or die(mysqli_error($conn));

                                    while ($tsa = mysqli_fetch_array($msaudiagent)) {
                                        $saudiagentt = $tsa['saudiagent'];
                                        echo "<option value='$saudiagentt'>";
                                    }
                                    ?>
                                </datalist>
                            </div>
                        </div>

                        <div class="row" style="background-color: rgba(47,191,254,0.4);">

                            <div class="col-lg-1 col-md-2 col-sm-2 col-xs-2 text-right pad">
                                <label class="label-control marg">Arrival Date</label>
                            </div>
                            <div class="col-lg-1 col-md-3 col-sm-4 col-xs-4  pad">
                                <input type="date" class="form-control form arrdate" name="arrdate" value="<?php echo ($addflag != 1) ? $get["arrdate"] : ""; ?>" tabindex="13">
                            </div>
                            <div class="col-lg-1 col-md-2 col-sm-2 col-xs-2 text-right pad">
                                <label class="label-control marg">Arrv. Time</label>
                            </div>
                            <div class="col-lg-1 col-md-3 col-sm-4 col-xs-4  pad">
                                <input type="time" class="form-control form arrtime " name="arrtime" value="<?php echo ($addflag != 1) ? $get["arrtime"] : ""; ?>" tabindex="14">
                            </div>
                            <div class="col-lg-1 col-md-2 col-sm-2 col-xs-2 text-right pad">
                                <label class="label-control marg">Arrv. PNR</label>
                            </div>
                            <div class="col-lg-1 col-md-3 col-sm-4 col-xs-4  pad">
                                <input type="text" class="form-control form arrpnr" name="arrpnr" value="<?php echo ($addflag != 1) ? $get["arrpnr"] : ""; ?>" tabindex="15">
                            </div>
                            <div class="col-lg-1 col-md-2 col-sm-2 col-xs-2 text-right pad">
                                <label class="label-control marg">Arrv. Flt.No.</label>
                            </div>
                            <div class="col-lg-1 col-md-3 col-sm-4 col-xs-4  pad" style="width:4.33%">
                                <input type="text" class="form-control form arrflt" name="arrflt" value="<?php echo ($addflag != 1) ? $get["arrflt"] : ""; ?>" tabindex="16">
                            </div>

                            <!--                        </div>
                            
                                                    <div class="row">-->



                            <div class="col-lg-1 col-md-2 col-sm-2 col-xs-2 text-right pad"   style="width:6.33%">
                                <label class="label-control marg">Agent Name</label>
                            </div>
                            <div class="col-lg-2 col-md-3 col-sm-4 col-xs-4  pad">
<!--                                <input list="agent" name="agent" class="agent form-control form" value="<?php echo ($addflag != 1) ? $get["agent"] : ""; ?>" tabindex="18" autocomplete="off">
                                <datalist id="agent">-->
                                <select class="form-control form agent select2" name="agent" >

                                    <option value="<?php echo ($addflag != 1) ? "$agname" : ""; ?>"><?php echo ($addflag != 1) ? $get["agent"] : ""; ?></option>
                                    <?php
                                    $magenttt = mysqli_query($conn, "SELECT name FROM `accmast` WHERE (grpcode = '022' OR grpcode = '044') group by name order by name") or die(mysqli_error($conn));
                                    while ($tage = mysqli_fetch_array($magenttt)) {
                                        // $agentt = trim(mysqli_real_escape_string($conn,$tage['name']));
                                        $agentt = htmlspecialchars($tage['name'], ENT_QUOTES, 'UTF-8');
                                        echo "<option value='$agentt'>$agentt</option>";
                                    }
                                    ?>
                                </select>
                                <!--</datalist>-->
                            </div>
                            <div class="col-lg-1 col-md-2 col-sm-2 col-xs-2 text-right pad"   style="width:5.33%">
                                <label class="label-control marg">Comission</label>
                            </div>
                            <div class="col-lg-1 col-md-3 col-sm-4 col-xs-4  pad">
                                <input type="text" class="form-control form text-right agentcomm" name="agentcomm" value="<?php echo ($addflag != 1) ? $get["agentcomm"] : ""; ?>" tabindex="19">
                            </div>

                        </div>

                        <!--<br>-->

                        <div class="nav-tabs-custom" style="padding-top:3px">
                            <div class="col-lg-12">
                                <div class="col-lg-1">
                                    <nav class=" sidebar-offcanvas" id="sidebar">

                                        <ul class="nav " align="center">
                                            <li class="nav-item active"> <a class="btn btn-pad btn-square skbtn" href="#tab_1" data-toggle="tab" aria-expanded="true">CHARGES</a></li>
                                            <li class="nav-item" style="margin-left:0px"> <a class="btn btn-pad btn-square skbtn" href="#tab_2" data-toggle="tab" aria-expanded="false">ADDRESS</a></li>
                                            <li class="nav-item"> <a class="btn btn-pad btn-square skbtn" href="#tab_3" data-toggle="tab" aria-expanded="false"><span style="margin-left:-10px">ROOM DETAILS</span></a></li>
                                            <?php if ($tregsk["vouchno"] != 0) { ?>
                                                <li class="nav-item" style="margin-left:0px"> <a class="btn btn-pad btn-square skbtn" id='print' href="paxform.php?vouchno=<?= $tregsk["vouchno"]; ?>&mode=edit" target="_blank">Pax Form</a></li>
                                            <?php } ?>
                                            <?php if ($tregsk["vouchno"] != 0) { ?>
                                                <li class="nav-item" style="margin-left:0px"> <a class="btn btn-pad btn-square skbtn PaxDetails" id='print' href="#">Pax Details</a></li>
                                            <?php } ?>
                                            <?php if ($accode > 0) { ?>
                                                <li class="nav-item" style="margin-left:0px"> <a class="btn btn-pad btn-square skbtn4" id='print' href="ledger_fr.php?accode=<?= $accode; ?>&fdt=<?= $fromdate; ?>&tdt=<?= $todate; ?>&rpt=2&view=view" target="_blank">Ledger</a></li>
                                            <?php } ?>
                                        </ul>
                                    </nav>

                                </div>
                                <div class="col-lg-11">
                                    <div class="tab-content">
                                        <div class="tab-pane active" id="tab_1">

                                            <div class="panel panel-default" style="border:1px solid <?= $vmcolr ?>;">


                                                <div class="row">
                                                    <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 text-right pad">

                                                    </div>
                                                    <div class="col-lg-3 col-md-8 col-sm-8 col-xs-8 pad">

                                                    </div>
                                                    <div class="col-lg-1 col-md-2 col-sm-2 col-xs-2 text-left pad">
                                                        <label class="label-control marg"> </label>
                                                    </div>
                                                    <div class="col-lg-1 col-md-2 col-sm-2 col-xs-2 text-center pad" style="color: #2FBFFE;">
                                                        <label class="label-control marg"><b>Ticket / INR </b></label>
                                                    </div>
                                                    <div class="col-lg-1 col-md-2 col-sm-2 col-xs-2 text-center pad" style="color: #2FBFFE;">
                                                        <label class="label-control marg"><b>Tour / USD</b> </label>
                                                    </div>
                                                    <div class="col-lg-1 col-md-2 col-sm-2 col-xs-2 text-center pad" style="width:20px">
                                                        <label class="label-control marg"> </label>
                                                    </div>
                                                    <div class="col-lg-1 col-md-2 col-sm-2 col-xs-2 text-center pad" style="color: #2FBFFE;">
                                                        <label class="label-control marg"> <b> No. </b> </label>
                                                    </div>
                                                    <div class="col-lg-1 col-md-2 col-sm-2 col-xs-2 text-right pad" style="color: #2FBFFE;">
                                                        <label class="label-control marg"><b> Amount </b></label>
                                                    </div>

                                                </div>
                                                <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">Remarks</label>
                                                    </div>
                                                    <div class="col-lg-3 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="text" class="form-control form rem1" name="rem1" value="<?php echo ($addflag != 1) ? $get["rem1"] : ""; ?>" tabindex="21">
                                                    </div>

                                                    <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                        <label class="label-control marg">Adult 1</label>
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="number" step="any" class="form-control form text-right full" name="full" value="<?php echo ($addflag != 1) ? $get["full"] : "0"; ?>" tabindex="29">
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="number" step="any" class="form-control form text-right full2" name="full2" value="<?php echo ($addflag != 1) ? $get["full2"] : "0"; ?>" tabindex="30">
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 text-center pad" style="width:20px">
                                                        <label class="label-control marg" style="color: #2FBFFE;font-weight:bold"> x </label>
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="number" step="any" class="form-control form text-right fullno" name="fullno" value="<?php echo ($addflag != 1) ? $get["fullno"] : "0"; ?>" tabindex="31">
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="number" step="any" class="form-control form text-right fullamt" name="fullamt" value="<?php echo ($addflag != 1) ? $get["fullamt"] : "0"; ?>" readonly>
                                                    </div>

                                                </div>
                                                <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"></label>
                                                    </div>
                                                    <div class="col-lg-3 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="text" class="form-control form rem2" name="rem2" value="<?php echo ($addflag != 1) ? $get["rem2"] : ""; ?>" tabindex="22">
                                                    </div>

                                                    <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                        <label class="label-control marg">Adult 2</label>
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="number" step="any" class="form-control form text-right full_2" name="full_2" value="<?php echo ($addflag != 1) ? $get["full_2"] : "0"; ?>" tabindex="32">
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="number" step="any" class="form-control form text-right full2_2" name="full2_2" value="<?php echo ($addflag != 1) ? $get["full2_2"] : "0"; ?>" tabindex="33">
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 text-center pad" style="width:20px">
                                                        <label class="label-control marg" style="color: #2FBFFE;font-weight:bold"> x </label>
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="number" step="any" class="form-control form text-right fullno_2" name="fullno_2" value="<?php echo ($addflag != 1) ? $get["fullno_2"] : "0"; ?>" tabindex="34">
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="number" step="any" class="form-control form text-right fullamt_2" name="fullamt_2" value="<?php echo ($addflag != 1) ? $get["fullamt_2"] : "0"; ?>" readonly>
                                                    </div>

                                                </div>
                                                <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"></label>
                                                    </div>
                                                    <div class="col-lg-3 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="text" class="form-control form rem3" name="rem3" value="<?php echo ($addflag != 1) ? $get["rem3"] : ""; ?>" tabindex="22">
                                                    </div>

                                                    <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                        <label class="label-control marg">Adult 3</label>
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="number" step="any" class="form-control form text-right full_3" name="full_3" value="<?php echo ($addflag != 1) ? $get["full_3"] : "0"; ?>" tabindex="35">
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="number" step="any" class="form-control form text-right full2_3" name="full2_3" value="<?php echo ($addflag != 1) ? $get["full2_3"] : "0"; ?>" tabindex="36">
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 text-center pad" style="width:20px">
                                                        <label class="label-control marg" style="color: #2FBFFE;font-weight:bold"> x </label>
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="number" step="any" class="form-control form text-right fullno_3" name="fullno_3" value="<?php echo ($addflag != 1) ? $get["fullno_3"] : "0"; ?>" tabindex="37">
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="number" step="any" class="form-control form text-right fullamt_3" name="fullamt_3" value="<?php echo ($addflag != 1) ? $get["fullamt_3"] : "0"; ?>" readonly>
                                                    </div>

                                                </div>
                                                <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"></label>
                                                    </div>
                                                    <div class="col-lg-3 col-md-8 col-sm-8 col-xs-8 pad">

                                                    </div>

                                                    <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                        <label class="label-control marg">Child wb </label>
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="number" step="any" class="form-control form text-right half" name="half" value="<?php echo ($addflag != 1) ? $get["half"] : "0"; ?>" tabindex="38">
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="number" step="any" class="form-control form text-right half2" name="half2" value="<?php echo ($addflag != 1) ? $get["half2"] : "0"; ?>" tabindex="39">
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 text-center pad" style="width:20px">
                                                        <label class="label-control marg" style="color: #2FBFFE;font-weight:bold"> x </label>
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="number" step="any" class="form-control form text-right halfno" name="halfno" value="<?php echo ($addflag != 1) ? $get["halfno"] : "0"; ?>" tabindex="40">
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="number" step="any" class="form-control form text-right halfamt" name="halfamt" value="<?php echo ($addflag != 1) ? $get["halfamt"] : "0"; ?>" readonly>
                                                    </div>

                                                </div>
                                                <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">Reffered By</label>
                                                    </div>
                                                    <div class="col-lg-3 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="text" class="form-control form refd1" name="refd1" value="<?php echo ($addflag != 1) ? $get["refd1"] : ""; ?>" tabindex="23">
                                                    </div>
                                                    <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                        <label class="label-control marg">Child wob </label>
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="number" step="any" class="form-control form  text-right childwob" name="childwob" value="<?php echo ($addflag != 1) ? $get["childwob"] : "0"; ?>" tabindex="41">
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="number" step="any" class="form-control form  text-right childwob2" name="childwob2" value="<?php echo ($addflag != 1) ? $get["childwob2"] : "0"; ?>" tabindex="42">
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 text-center pad" style="width:20px">
                                                        <label class="label-control marg" style="color: #2FBFFE;font-weight:bold"> x </label>
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="number" step="any" class="form-control form text-right childwobno" name="childwobno" value="<?php echo ($addflag != 1) ? $get["childwobno"] : "0"; ?>" tabindex="43">
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="number" step="any" class="form-control form  text-right childwobamt" name="childwobamt" value="<?php echo ($addflag != 1) ? $get["childwobamt"] : "0"; ?>" readonly>
                                                    </div>
                                                </div>
                                                <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"></label>
                                                    </div>
                                                    <div class="col-lg-3 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="text" class="form-control form  refd2" name="refd2" value="<?php echo ($addflag != 1) ? $get["refd2"] : ""; ?>" tabindex="24">
                                                    </div>
                                                    <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                        <label class="label-control marg">Inf </label>
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="number" step="any" class="form-control form  text-right inf" name="inf" value="<?php echo ($addflag != 1) ? $get["inf"] : "0"; ?>" tabindex="44">
                                                    </div>

                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="number" step="any" class="form-control form  text-right inf2" name="inf2" value="<?php echo ($addflag != 1) ? $get["inf2"] : "0"; ?>" tabindex="45">
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 text-center pad" style="width:20px">
                                                        <label class="label-control marg" style="color: #2FBFFE;font-weight:bold"> x </label>
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="number" step="any" class="form-control form  text-right infno" name="infno" value="<?php echo ($addflag != 1) ? $get["infno"] : "0"; ?>" tabindex="46">
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="number" step="any" class="form-control form  text-right infamt" name="infamt" value="<?php echo ($addflag != 1) ? $get["infamt"] : "0"; ?>" readonly>
                                                    </div>
                                                </div>
                                                <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" style="font-size: 14px;color:red">Cancellation Date </label>
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="date" style="color:red" class="form-control form cancdate" name="cancdate" value="<?php echo ($addflag != 1) ? $get["cancdate"] : ""; ?>" tabindex="25">
                                                    </div>

                                                    <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                        <label class="label-control marg" style="font-size: 14px;">Passport Limit</label>
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="date" class="form-control form passlimit" name="passlimit" value="<?php echo ($addflag != 1) ? $get["passlimit"] : ""; ?>" tabindex="26">
                                                    </div>

                                                    <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                        <label class="label-control marg">Visa </label>
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="number" step="any" class="form-control form  text-right visachg" name="visachg" value="<?php echo ($addflag != 1) ? $get["visachg"] : "0"; ?>" tabindex="47">
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 text-center pad" style="width:20px">
                                                        <label class="label-control marg" style="color: #2FBFFE;font-weight:bold"> x </label>
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="number" step="any" class="form-control form  text-right visachgno" name="visachgno" value="<?php echo ($addflag != 1) ? $get["visachgno"] : "0"; ?>" tabindex="48">
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="number" step="any" class="form-control form  text-right visachgamt" name="visachgamt" value="<?php echo ($addflag != 1) ? $get["visachgamt"] : "0"; ?>" readonly>
                                                    </div>
                                                </div>

                                                <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" style="font-size: 14px;">Half Payment</label>
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="date" class="form-control form halfpay" name="halfpay" value="<?php echo ($addflag != 1) ? $get["halfpay"] : ""; ?>" tabindex="27">
                                                    </div>
                                                    <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                        <label class="label-control marg" style="font-size: 14px;">Full Payment</label>
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="date" class="form-control form fullpay" name="fullpay" value="<?php echo ($addflag != 1) ? $get["fullpay"] : ""; ?>" tabindex="28">
                                                    </div>

                                                    <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                        <label class="label-control marg">Misc. </label>
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="number" step="any" class="form-control form text-right airtax" name="airtax" value="<?php echo ($addflag != 1) ? $get["airtax"] : "0"; ?>" tabindex="49">
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 text-center pad" style="width:20px">
                                                        <label class="label-control marg" style="color: #2FBFFE;font-weight:bold"> x </label>
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="number" step="any" class="form-control form text-right airtaxno" name="airtaxno" value="<?php echo ($addflag != 1) ? $get["airtaxno"] : "0"; ?>" tabindex="50">
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="number" step="any" class="form-control form text-right airtaxamt" name="airtaxamt" value="<?php echo ($addflag != 1) ? $get["airtaxamt"] : "0"; ?>" readonly>
                                                    </div>

                                                </div>


                                                <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">GST 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 gstno" name="gstno" value="<?php echo ($addflag != 1) ? $get["gstno"] : ""; ?>" tabindex="">
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 text-center pad" style="width:20px">
                                                        <label class="label-control marg"> </label>
                                                    </div>
                                                    <div class="col-lg-4 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                        <label class="label-control marg">Amount </label>
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="number" step="any" class="form-control form  text-right amount" name="amount" value="<?php echo ($addflag != 1) ? $get["amount"] : "0"; ?>" readonly>
                                                    </div>
                                                </div>
                                                <div class="row">
                                                    <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 text-right pad">

                                                    </div>
                                                    <div class="col-lg-2 col-md-8 col-sm-8 col-xs-8 pad">

                                                    </div>
                                                    <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                        <label class="label-control marg">Fare Diff. </label>
                                                    </div>

                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="number" step="any" class="form-control form  text-right farediff" name="farediff" value="<?php echo ($addflag != 1) ? $get["farediff"] : "0"; ?>" tabindex="51">
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="number" step="any" class="form-control form  text-right farediff2" name="farediff2" value="<?php echo ($addflag != 1) ? $get["farediff2"] : "0"; ?>" tabindex="52">
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 text-center pad" style="width:20px">
                                                        <label class="label-control marg" style="color: #2FBFFE;font-weight:bold"> x </label>
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="number" step="any" class="form-control form  text-right farediffno" name="farediffno" value="<?php echo ($addflag != 1) ? $get["farediffno"] : "0"; ?>" tabindex="53">
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="number" step="any" class="form-control form  text-right farediffamt" name="farediffamt" value="<?php echo ($addflag != 1) ? $get["farediffamt"] : "0"; ?>" readonly>
                                                    </div>
                                                </div>

                                                <div class="row">
                                                    <div class="col-lg-2 col-md-8 col-sm-8 col-xs-8 text-right pad">
                                                    </div>
                                                    <div class="col-lg-3 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <!--<a class="btn btn-pad btn-square cashbtn form">Cash Calculation</a>-->

                                                    </div>
                                                    <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                        <label class="label-control marg">Cancel </label>
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="number" step="any" class="form-control form  text-right cancelchg" name="cancelchg" value="<?php echo ($addflag != 1) ? $get["cancelchg"] : "0"; ?>" tabindex="54">
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="number" step="any" class="form-control form   text-right cancelchg2" name="cancelchg2" value="<?php echo ($addflag != 1) ? $get["cancelchg2"] : "0"; ?>" tabindex="55">
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 text-center pad" style="width:20px">
                                                        <label class="label-control marg" style="color: #2FBFFE;font-weight:bold"> x </label>
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="number" step="any" class="form-control form  text-right cancelchgno" name="cancelchgno" value="<?php echo ($addflag != 1) ? $get["cancelchgno"] : "0"; ?>" tabindex="56">
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="number" step="any" class="form-control form  text-right cancelchgamt" name="cancelchgamt" value="<?php echo ($addflag != 1) ? $get["cancelchgamt"] : "0"; ?>" readonly>
                                                    </div>
                                                </div>

                                                <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">Discount Remark</label>
                                                    </div>
                                                    <div class="col-lg-3 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="text" class="form-control form  discrem" name="discrem" value="<?php echo ($addflag != 1) ? $get["discrem"] : ""; ?>" tabindex="">
                                                    </div>


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

                                                        <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                            <input type="number" step="any" class="form-control form  text-right disc" name="disc" value="<?php echo ($addflag != 1) ? $get["disc"] : "0"; ?>" tabindex="57">
                                                        </div>
                                                        <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                            <input type="number" step="any" class="form-control form text-right disc2" name="disc2" value="<?php echo ($addflag != 1) ? $get["disc2"] : "0"; ?>" tabindex="58">
                                                        </div>
                                                        <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 text-center pad" style="width:20px">
                                                            <label class="label-control marg" style="color: #2FBFFE;font-weight:bold"> x </label>
                                                        </div>
                                                        <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                            <input type="number" step="any" class="form-control form text-right discno" name="discno" value="<?php echo ($addflag != 1) ? $get["discno"] : "0"; ?>" tabindex="59">
                                                        </div>
                                                        <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                            <input type="number" step="any" class="form-control form text-right discamt" name="discamt" value="<?php echo ($addflag != 1) ? $get["discamt"] : "0"; ?>" readonly>
                                                        </div>
                                                    </div>
                                                </div>

                                                <div class="row">
                                                    <div class="col-lg-5 col-md-8 col-sm-8 col-xs-8 pad">
                                                    </div>
                                                    <div class="col-lg-1 col-md-1 col-sm-3 col-xs-3 text-right pad">
                                                        <label class="label-control marg" style="color:blueviolet">Out of State</label>
                                                    </div>
                                                    <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 pad">
                                                        <input type="checkbox"  style="color:blueviolet" class="form-control form oms" <?php
                                                        if ($get['oms'] == "1") {
                                                            Echo "checked";
                                                        }
                                                        ?> value="1" name="oms">                            
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 text-right pad">
                                                        <a class="btn btn-pad btn-square taxbtn form" style="height: 28px;margin-top: -1px;padding-top: 5px;visibility: hidden;" >Tax Calculation</a>
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 text-center pad" style="width:20px">
                                                        <label class="label-control marg"> </label>
                                                    </div>
                                                    <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                        <label class="label-control marg">Total </label>
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="number" step="any" class="form-control form  text-right nettot" name="nettot" value="<?php echo ($addflag != 1) ? $get["nettot"] : "0"; ?>" readonly>
                                                    </div>
                                                </div>
                                                <div class="row">
                                                    <div class="col-lg-8 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                        <label class="label-control marg">CGST </label>
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="number" step="any" class="form-control form  text-right cgstno" name="cgstno" value="<?php echo ($addflag != 1) ? $get["cgstno"] : "0"; ?>" tabindex="61">
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 text-center pad" style="width:20px">
                                                        <label class="label-control marg" style="color: #2FBFFE;font-weight:bold"> x </label>
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="number" step="any" class="form-control form text-right cgstamt" name="cgstamt" value="<?php echo ($addflag != 1) ? $get["cgstamt"] : "0"; ?>" readonly>
                                                    </div>
                                                </div>
                                                <div class="row">
                                                    <div class="col-lg-7 col-md-8 col-sm-8 col-xs-8 pad">
                                                    </div>
                                                    <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                        <label class="label-control marg">SGST </label>
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="number" step="any" class="form-control form text-right sgstno" name="sgstno" value="<?php echo ($addflag != 1) ? $get["sgstno"] : "0"; ?>" tabindex="62">
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 text-center pad" style="width:20px">
                                                        <label class="label-control marg" style="color: #2FBFFE;font-weight:bold"> x </label>
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="number" step="any" class="form-control form text-right sgstamt" name="sgstamt" value="<?php echo ($addflag != 1) ? $get["sgstamt"] : "0"; ?>" readonly>
                                                    </div>
                                                </div>
                                                <div class="row">
                                                    <div class="col-lg-7 col-md-8 col-sm-8 col-xs-8 pad">
                                                    </div>
                                                    <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                        <label class="label-control marg">IGST </label>
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="number" step="any" class="form-control form text-right igstno" name="igstno" value="<?php echo ($addflag != 1) ? $get["igstno"] : "0"; ?>" tabindex="63">
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 text-center pad" style="width:20px">
                                                        <label class="label-control marg" style="color: #2FBFFE;font-weight:bold"> x </label>
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="number" step="any" class="form-control form text-right igstamt" name="igstamt" value="<?php echo ($addflag != 1) ? $get["igstamt"] : "0"; ?>" readonly>
                                                    </div>
                                                </div>

                                                <div class="row">
                                                    <div class="col-lg-6 col-md-8 col-sm-8 col-xs-8 pad">
                                                    </div>

                                                    <?php if ($mantcs > 0) { ?> 
                                                        <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                            <label class="label-control marg">TCS Amount</label>
                                                        </div>
                                                        <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                            
                                                        </div>
                                                        <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 text-center pad" style="width:20px">
                                                            
                                                        </div>
                                                    <?php } else { ?>
                                                        <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                            <label class="label-control marg">TCS <= 7 Lakhs</label>
                                                        </div>
                                                        <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                            <input type="number" step="any" class="form-control form text-right tcs" name="tcs" value="<?php echo ($addflag != 1) ? $get["tcs"] : "0"; ?>" tabindex="64">
                                                        </div>
                                                        <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 text-center pad" style="width:20px">
                                                            <label class="label-control marg" style="color: #2FBFFE;font-weight:bold"> x </label>
                                                        </div>
                                                    <?php } ?>

                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="number" step="any" class="form-control form text-right tcsamt" name="tcsamt" value="<?php echo ($addflag != 1) ? $get["tcsamt"] : "0"; ?>" <?= $manrd ?>>
                                                    </div>
                                                </div>
                                                <div class="row">
                                                    <div class="col-lg-6 col-md-8 col-sm-8 col-xs-8 pad">
                                                    </div>

                                                    <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                        <label class="label-control marg">TCS > 7 Lakhs</label>
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="number" step="any" class="form-control form text-right tcs2" name="tcs2" value="<?php echo ($addflag != 1) ? $get["tcs2"] : "0"; ?>" tabindex="65">
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 text-center pad" style="width:20px">
                                                        <label class="label-control marg" style="color: #2FBFFE;font-weight:bold"> x </label>
                                                    </div>

                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="number" step="any" class="form-control form text-right tcsamt2" name="tcsamt2" value="<?php echo ($addflag != 1) ? $get["tcsamt2"] : "0"; ?>" readonly>
                                                    </div>
                                                </div>
                                                <div class="row">
                                                    <div class="col-lg-8 col-md-8 col-sm-8 col-xs-8 text-center pad" style="margin-left:20px"></div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 text-right pad" style="background-color: rgba(47,191,254,0.4);width: 140px;margin-left: -22px;">
                                                        <label class="label-control marg">Net Total</label>
                                                    </div>
                                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad" style="background-color: rgba(47,191,254,0.4);">
                                                        <input type="number" step="any" class="form-control form text-right netamt" name="netamt" value="<?php echo ($addflag != 1) ? $get["netamt"] : "0"; ?>" readonly>
                                                    </div>
                                                </div>

                                            </div>
                                        </div>

                                        <!--ADDRESS-->
                                        <div class="tab-pane " id="tab_2">

                                            <div class="panel panel-default">
                                                <div class="row">
                                                    <div class="col-lg-12 col-md-3 col-sm-3 col-xs-3 text-center pad" style="background-color:#2fbffe;width: 981px; margin-left: 16px; border-radius: 4px;">
                                                        <label class="label-control marg" style="color:#ffffff"> ADDRESS </label>
                                                    </div>
                                                </div>
                                                <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">Name </label>
                                                    </div>
                                                    <div class="col-lg-4 col-md-2 col-sm-2 col-xs-2 pad">
                                                        <input type="text" name="fname" class="form-control form fname" value="<?php echo ($addflag != 1) ? $get['fname'] : ""; ?>" tabindex="58">
                                                    </div>
                                                    <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                        <label class="label-control marg">Name</label>
                                                    </div>
                                                    <div class="col-lg-4 col-md-2 col-sm-2 col-xs-2 pad">
                                                        <input type="text" name="sname" class="form-control form sname" value="<?php echo ($addflag != 1) ? $get['sname'] : ""; ?>" tabindex="68">
                                                    </div>
                                                </div>

                                                <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">Address</label>
                                                    </div>
                                                    <div class="col-lg-4 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="text" class="form-control form add1" name="add1" value="<?php echo ($addflag != 1) ? $get["add1"] : ""; ?>" tabindex="59" maxlength="40">
                                                        <input type="text" class="form-control form add2" name="add2" value="<?php echo ($addflag != 1) ? $get["add2"] : ""; ?>" tabindex="60" maxlength="40">
                                                        <input type="text" class="form-control form add3" name="add3" value="<?php echo ($addflag != 1) ? $get["add3"] : ""; ?>" tabindex="61" maxlength="40">
                                                    </div>
                                                    <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                        <label class="label-control marg">Address</label>
                                                    </div>
                                                    <div class="col-lg-4 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="text" class="form-control form sadd1" name="sadd1" value="<?php echo ($addflag != 1) ? $get["sadd1"] : ""; ?>" tabindex="69" maxlength="40">
                                                        <input type="text" class="form-control form sadd2" name="sadd2" value="<?php echo ($addflag != 1) ? $get["sadd2"] : ""; ?>" tabindex="70" maxlength="40">
                                                        <input type="text" class="form-control form sadd3" name="sadd3" value="<?php echo ($addflag != 1) ? $get["sadd3"] : ""; ?>" tabindex="71" maxlength="40">
                                                    </div>
                                                </div>
                                                <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">City</label>
                                                    </div>
                                                    <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 pad">
                                                        <input type="text" class="form-control city form" name="city" value="<?php echo ($addflag != 1) ? $get["city"] : ""; ?>" tabindex="62">
                                                    </div>
                                                    <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                        <label class="label-control marg">Pin</label>
                                                    </div>
                                                    <div class="col-lg-1 col-md-2 col-sm-2 col-xs-2 pad">
                                                        <input type="text" class="form-control form pin" name="pin" value="<?php echo ($addflag != 1) ? $get["pin"] : ""; ?>" tabindex="63">
                                                    </div>
                                                    <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                        <label class="label-control marg">City</label>
                                                    </div>
                                                    <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 pad">
                                                        <input type="text" class="form-control form city2" name="city2" value="<?php echo ($addflag != 1) ? $get["city2"] : ""; ?>" tabindex="72">
                                                    </div>
                                                    <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                        <label class="label-control marg">Pin</label>
                                                    </div>
                                                    <div class="col-lg-1 col-md-2 col-sm-2 col-xs-2 pad">
                                                        <input type="text" class="form-control form " name="pin2" value="<?php echo ($addflag != 1) ? $get["pin2"] : ""; ?>" tabindex="73">
                                                    </div>
                                                </div>

                                                <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">State</label>
                                                    </div>
                                                    <div class="col-lg-2 col-md-4 col-sm-4 col-xs-4 pad">
                                                        <select name="state" class="form-control form state select2" style="width:100%" tabindex="64">
                                                            <option value="<?php echo ($addflag != 1) ? $get['state'] : ""; ?>"><?php echo ($addflag != 1) ? $get['state'] : " "; ?></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-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                        <label class="label-control marg">State</label>
                                                    </div>
                                                    <div class="col-lg-2 col-md-4 col-sm-4 col-xs-4 pad">
                                                        <select name="state2" class="form-control form state2 select2" style="width:100%" tabindex="74">
                                                            <option value="<?php echo ($addflag != 1) ? $get['state2'] : ""; ?>"><?php echo ($addflag != 1) ? $get['state2'] : " "; ?></option>
                                                            <?php
                                                            $mown5 = mysqli_query($conn, "SELECT `code`, `name` FROM `state` ORDER BY name") or die(mysqli_error($conn));
                                                            while ($trow5 = mysqli_fetch_array($mown5)) {
                                                                echo "<option value='$trow5[name]'>$trow5[name]</option>";
                                                            }
                                                            ?>
                                                        </select>
                                                    </div>

                                                </div>


                                                <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">Mobile 1</label>
                                                    </div>
                                                    <div class="col-lg-2 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="text" class="form-control form mobile" name="tel" value="<?php echo ($addflag != 1) ? $get["tel"] : ""; ?>" tabindex="65">
                                                    </div>
                                                    <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                        <label class="label-control marg">Mobile 1</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="tel2" value="<?php echo ($addflag != 1) ? $get["tel2"] : ""; ?>" tabindex="75">
                                                    </div>
                                                </div>

                                                <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">Mobile 2</label>
                                                    </div>
                                                    <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 pad">
                                                        <input type="text" class="form-control form mobile2" name="mobile" value="<?php echo ($addflag != 1) ? $get["mobile"] : ""; ?>" tabindex="66">
                                                    </div>
                                                    <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                        <label class="label-control marg">Mobile 2</label>
                                                    </div>
                                                    <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 pad">
                                                        <input type="text" class="form-control form  " name="mobile2" value="<?php echo ($addflag != 1) ? $get["mobile2"] : ""; ?>" tabindex="76">
                                                    </div>

                                                </div>

                                                <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">Email</label>
                                                    </div>
                                                    <div class="col-lg-4 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="text" class="form-control form email" name="email" value="<?php echo ($addflag != 1) ? $get["email"] : ""; ?>" tabindex="67">
                                                    </div>
                                                    <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                        <label class="label-control marg">Email</label>
                                                    </div>
                                                    <div class="col-lg-4 col-md-8 col-sm-8 col-xs-8 pad">
                                                        <input type="text" class="form-control form email2" name="email2" value="<?php echo ($addflag != 1) ? $get["email2"] : ""; ?>" tabindex="77">
                                                    </div>
                                                </div>

                                            </div>
                                        </div><!-- /.tab_2 -->

                                        <div class="tab-pane " id="tab_3">

                                            <div class="panel panel-default">

                                                <div class="row">

                                                    <div class="panel-body">
                                                        <div class="col-lg-12 col-md-10 col-sm-12 col-xs-12  pad">

                                                            <div class="col-lg-6 col-md-10 col-sm-12 col-xs-12  pad">

                                                                <div class="makbackcolr">

                                                                    <div class="row" style="margin-left: 10px;margin-bottom:4px">
                                                                        <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                                            <label class="label-control marg skmadfont">Room Category</label>
                                                                        </div>
                                                                        <div class="col-lg-6 col-md-6 col-sm-8 col-xs-8 pad">
                                                                            <select name="mkroomcatg" class="form-control form mkroomcatg select2" style="width:100%" tabindex="78">
                                                                                <option value="<?php echo ($addflag != 1) ? $fetmakrmctg['code'] : ""; ?>"><?php echo ($addflag != 1) ? $fetmakrmctg['name'] : " "; ?></option>
                                                                                <option value=""></option>
                                                                                <?php
                                                                                $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>";
                                                                                }
                                                                                ?>
                                                                            </select>
                                                                        </div>
                                                                    </div>


                                                                    <div class="row" style="margin-left: 10px;margin-bottom:4px">
                                                                        <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                                            <label class="label-control marg skmadfont">Makkah Hotel</label>
                                                                        </div>
                                                                        <div class="col-lg-6 col-md-6 col-sm-8 col-xs-8 pad">
                                                                            <select name="makhotel" class="form-control form makhotel select2" style="width:100%" tabindex="79">
                                                                                <option value="<?php echo ($addflag != 1) ? $fetmakhotel['code'] : ""; ?>"><?php echo ($addflag != 1) ? $fetmakhotel['hotelnm'] : " "; ?></option>
                                                                                <option value=""></option>
                                                                                <?php
                                                                                $gmkname = mysqli_query($conn, "SELECT `code`,`hotelnm` FROM `hotels` WHERE  city='2' ORDER BY `hotelnm`") or die(mysqli_error($conn));
                                                                                while ($fmkname = mysqli_fetch_array($gmkname)) {
                                                                                    echo "<option value='$fmkname[code]'>$fmkname[hotelnm]</option>";
                                                                                }
                                                                                ?>
                                                                            </select>
                                                                        </div>
                                                                    </div>

                                                                    <div class="row" style="margin-left: 10px;margin-bottom:20px">
                                                                        <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                                            <label class="label-control marg skmadfont">Check In</label>
                                                                        </div>
                                                                        <div class="col-lg-2 col-md-8 col-sm-8 col-xs-8 pad">
                                                                            <input type="date" class="form-control form makchkin" name="makchkin" value="<?php echo ($addflag != 1) ? $get["makchkin"] : ""; ?>" tabindex="80">
                                                                        </div>

                                                                        <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                                            <label class="label-control marg skmadfont">Check Out</label>
                                                                        </div>
                                                                        <div class="col-lg-2 col-md-8 col-sm-8 col-xs-8 pad">
                                                                            <input type="date" class="form-control form makchkout" name="makchkout" value="<?php echo ($addflag != 1) ? $get["makchkout"] : ""; ?>" tabindex="81">
                                                                        </div>
                                                                    </div>

                                                                </div>

                                                                <div class="madbackcolr">

                                                                    <div class="row" style="margin-left: 10px;margin-bottom:4px">
                                                                        <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                                            <label class="label-control marg skmadfont">Room Category</label>
                                                                        </div>
                                                                        <div class="col-lg-6 col-md-6 col-sm-8 col-xs-8 pad">
                                                                            <select name="mdroomcatg" class="form-control form mdroomcatg select2" style="width:100%" tabindex="82">
                                                                                <option value="<?php echo ($addflag != 1) ? $fetmadrmctg['code'] : ""; ?>"><?php echo ($addflag != 1) ? $fetmadrmctg['name'] : " "; ?></option>
                                                                                <option value=""></option>
                                                                                <?php
                                                                                $git2 = mysqli_query($conn, "SELECT `code`,`name` FROM `roomcatg` ORDER BY `name`") or die(mysqli_error($conn));
                                                                                while ($itm2 = mysqli_fetch_array($git2)) {
                                                                                    echo "<option value='$itm2[code]'>$itm2[name]</option>";
                                                                                }
                                                                                ?>
                                                                            </select>
                                                                        </div>
                                                                    </div>


                                                                    <div class="row" style="margin-left: 10px;margin-bottom:4px">
                                                                        <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                                            <label class="label-control marg skmadfont">Madina Hotel</label>
                                                                        </div>
                                                                        <div class="col-lg-6 col-md-6 col-sm-8 col-xs-8 pad">
                                                                            <select name="madhotel" class="form-control form madhotel select2" style="width:100%;" tabindex="83">
                                                                                <option value="<?php echo ($addflag != 1) ? $fetmadhotel['code'] : ""; ?>"><?php echo ($addflag != 1) ? $fetmadhotel['hotelnm'] : " "; ?></option>
                                                                                <option value=""></option>

                                                                                <?php
                                                                                $gmdname = mysqli_query($conn, "SELECT `code`,`hotelnm` FROM `hotels`  WHERE  city='3' ORDER BY `hotelnm`") or die(mysqli_error($conn));
                                                                                while ($fmdname = mysqli_fetch_array($gmdname)) {
                                                                                    echo "<option value='$fmdname[code]'>$fmdname[hotelnm]</option>";
                                                                                }
                                                                                ?>
                                                                            </select>
                                                                        </div>
                                                                    </div>

                                                                    <div class="row" style="margin-left: 10px;margin-bottom:20px">
                                                                        <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                                            <label class="label-control marg skmadfont">Check In</label>
                                                                        </div>
                                                                        <div class="col-lg-2 col-md-8 col-sm-8 col-xs-8 pad">
                                                                            <input type="date" class="form-control form madchkin" name="madchkin" value="<?php echo ($addflag != 1) ? $get["madchkin"] : ""; ?>" tabindex="84">
                                                                        </div>

                                                                        <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                                            <label class="label-control marg skmadfont">Check Out</label>
                                                                        </div>
                                                                        <div class="col-lg-2 col-md-8 col-sm-8 col-xs-8 pad">
                                                                            <input type="date" class="form-control form madchkout" name="madchkout" value="<?php echo ($addflag != 1) ? $get["madchkout"] : ""; ?>" tabindex="85">
                                                                        </div>
                                                                    </div>

                                                                </div>

                                                                <div class="shiftbackcolr">

                                                                    <div class="row" style="margin-left: 10px;margin-bottom:4px">
                                                                        <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                                            <label class="label-control marg skmadfont">Room Category</label>
                                                                        </div>
                                                                        <div class="col-lg-6 col-md-6 col-sm-8 col-xs-8 pad">
                                                                            <select name="othrmcatg" class="form-control form othrmcatg select2" style="width:100%" tabindex="86">
                                                                                <option value="<?php echo ($addflag != 1) ? $fetothrmctg['code'] : ""; ?>"><?php echo ($addflag != 1) ? $fetothrmctg['name'] : " "; ?></option>
                                                                                <option value=""></option>
                                                                                <?php
                                                                                $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>";
                                                                                }
                                                                                ?>
                                                                            </select>
                                                                        </div>
                                                                    </div>



                                                                    <div class="row" style="margin-left: 10px;margin-bottom:4px">
                                                                        <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                                            <label class="label-control marg skmadfont">Shifting Hotel</label>
                                                                        </div>
                                                                        <div class="col-lg-6 col-md-6 col-sm-8 col-xs-8 pad">
                                                                            <select name="othhotel" class="form-control form othhotel select2" style="width:100%" tabindex="87">
                                                                                <option value="<?php echo ($addflag != 1) ? $fetothhotel['code'] : ""; ?>"><?php echo ($addflag != 1) ? $fetothhotel['hotelnm'] : " "; ?></option>
                                                                                <option value=""></option>
                                                                                <?php
                                                                                $gmkname = mysqli_query($conn, "SELECT `code`,`hotelnm` FROM `hotels` WHERE  city='2' ORDER BY `hotelnm`") or die(mysqli_error($conn));
                                                                                while ($fmkname = mysqli_fetch_array($gmkname)) {
                                                                                    echo "<option value='$fmkname[code]'>$fmkname[hotelnm]</option>";
                                                                                }
                                                                                ?>
                                                                            </select>
                                                                        </div>
                                                                    </div>

                                                                    <div class="row" style="margin-left: 10px;margin-bottom:20px">
                                                                        <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                                            <label class="label-control marg skmadfont">Check In</label>
                                                                        </div>
                                                                        <div class="col-lg-2 col-md-8 col-sm-8 col-xs-8 pad">
                                                                            <input type="date" class="form-control form othchkin" name="othchkin" value="<?php echo ($addflag != 1) ? $get["othchkin"] : ""; ?>" tabindex="88">
                                                                        </div>

                                                                        <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                                            <label class="label-control marg skmadfont">Check Out</label>
                                                                        </div>
                                                                        <div class="col-lg-2 col-md-8 col-sm-8 col-xs-8 pad">
                                                                            <input type="date" class="form-control form othchkout" name="othchkout" value="<?php echo ($addflag != 1) ? $get["othchkout"] : ""; ?>" tabindex="89">
                                                                        </div>
                                                                    </div>

                                                                </div>
                                                            </div>

                                                            <div class="col-lg-6 col-md-10 col-sm-12 col-xs-12  pad" align="left">
                                                                <div class="" style="margin-right: 20px;">
                                                                    <table class="table table-striped table-condensed table-bordered" style="width:100%;">
                                                                        <thead class="mySearchTr">
                                                                            <tr>
                                                                                <th style="width: 5%;text-align: left;">Room Type</th>
                                                                                <th style="width: 4%;text-align: center;">MAKKA</th>
                                                                                <th style="width: 3%;text-align: center;">Pax</th>
                                                                                <th style="width: 4%;text-align: center;">MADINA</th>
                                                                                <th style="width: 3%;text-align: center;">Pax</th>
                                                                                <!-- <th style="width: 5%;text-align: center;">OTHER</th> -->
                                                                            </tr>
                                                                        </thead>
                                                                        <tbody id="tabledata">

                                                                            <tr>
                                                                                <td>Single</td>
                                                                                <td>
                                                                                    <input type="number" step="any" class="form-control form text-center mksingle" name="mksingle" value="<?php echo ($addflag != 1) ? $get["mksingle"] : ""; ?>" tabindex="90">
                                                                                </td>
                                                                                <td>
                                                                                    <input type="number" step="any" style="background-color: rgba(47,191,254,0.5)" class="form-control text-center form mk_singlepax" name="mk_singlepax" value="<?php echo ($addflag != 1) ? $get["mk_singlepax"] : ""; ?>" tabindex="91">
                                                                                </td>
                                                                                <td>
                                                                                    <input type="number" step="any" class="form-control text-center form mdsingle" name="mdsingle" value="<?php echo ($addflag != 1) ? $get["mdsingle"] : ""; ?>" tabindex="92">
                                                                                </td>
                                                                                <td>
                                                                                    <input type="number" step="any" style="background-color: rgba(47,191,254,0.5);" class="form-control text-center form md_singlepax" name="md_singlepax" value="<?php echo ($addflag != 1) ? $get["md_singlepax"] : ""; ?>" tabindex="93">
                                                                                </td>
                                                                                <!-- <td></td> -->
                                                                            </tr>

                                                                            <tr>
                                                                                <td>Double/2 In a Room</td>
                                                                                <td>
                                                                                    <input type="number" step="any" class="form-control text-center form mkdouble" name="mkdouble" value="<?php echo ($addflag != 1) ? $get["mkdouble"] : ""; ?>" tabindex="94">
                                                                                </td>
                                                                                <td>
                                                                                    <input type="number" step="any" style="background-color: rgba(47,191,254,0.5);" class="form-control text-center form mk_doublepax" name="mk_doublepax" value="<?php echo ($addflag != 1) ? $get["mk_doublepax"] : ""; ?>" tabindex="95">
                                                                                </td>
                                                                                <td>
                                                                                    <input type="number" step="any" class="form-control text-center form mddouble" name="mddouble" value="<?php echo ($addflag != 1) ? $get["mddouble"] : ""; ?>" tabindex="96">
                                                                                </td>
                                                                                <td>
                                                                                    <input type="number" step="any" style="background-color: rgba(47,191,254,0.5);" class="form-control text-center form md_doublepax" name="md_doublepax" value="<?php echo ($addflag != 1) ? $get["md_doublepax"] : ""; ?>" tabindex="97">
                                                                                </td>
                                                                                <!-- <td></td> -->
                                                                            </tr>

                                                                            <tr>
                                                                                <td>Triple/3 In a Room</td>
                                                                                <td>
                                                                                    <input type="number" step="any" class="form-control text-center form mktriple" name="mktriple" value="<?php echo ($addflag != 1) ? $get["mktriple"] : ""; ?>" tabindex="98">
                                                                                </td>
                                                                                <td>
                                                                                    <input type="number" step="any" style="background-color: rgba(47,191,254,0.5);" class="form-control text-center form mk_triplepax" name="mk_triplepax" value="<?php echo ($addflag != 1) ? $get["mk_triplepax"] : ""; ?>" tabindex="99">
                                                                                </td>
                                                                                <td>
                                                                                    <input type="number" step="any" class="form-control text-center form mdtriple" name="mdtriple" value="<?php echo ($addflag != 1) ? $get["mdtriple"] : ""; ?>" tabindex="100">
                                                                                </td>
                                                                                <td>
                                                                                    <input type="number" step="any" style="background-color: rgba(47,191,254,0.5);" class="form-control text-center form md_triplepax" name="md_triplepax" value="<?php echo ($addflag != 1) ? $get["md_triplepax"] : ""; ?>" tabindex="101">
                                                                                </td>
                                                                                <!-- <td></td> -->
                                                                            </tr>

                                                                            <tr>
                                                                                <td>Quad/4 In a Room</td>
                                                                                <td>
                                                                                    <input type="number" step="any" class="form-control text-center form mkquad" name="mkquad" value="<?php echo ($addflag != 1) ? $get["mkquad"] : ""; ?>" tabindex="102">
                                                                                </td>
                                                                                <td>
                                                                                    <input type="number" step="any" style="background-color: rgba(47,191,254,0.5);" class="form-control text-center form mk_quadpax" name="mk_quadpax" value="<?php echo ($addflag != 1) ? $get["mk_quadpax"] : ""; ?>" tabindex="103">
                                                                                </td>
                                                                                <td>
                                                                                    <input type="number" step="any" class="form-control text-center form mdquad" name="mdquad" value="<?php echo ($addflag != 1) ? $get["mdquad"] : ""; ?>" tabindex="104">
                                                                                </td>
                                                                                <td>
                                                                                    <input type="number" step="any" style="background-color: rgba(47,191,254,0.5);" class="form-control text-center form md_quadpax" name="md_quadpax" value="<?php echo ($addflag != 1) ? $get["md_quadpax"] : ""; ?>" tabindex="105">
                                                                                </td>
                                                                                <!-- <td></td> -->
                                                                            </tr>

                                                                            <tr>
                                                                                <td>Quint/5 In a Room</td>
                                                                                <td>
                                                                                    <input type="number" step="any" class="form-control text-center form mkquint" name="mkquint" value="<?php echo ($addflag != 1) ? $get["mkquint"] : ""; ?>" tabindex="106">
                                                                                </td>
                                                                                <td>
                                                                                    <input type="number" step="any" style="background-color: rgba(47,191,254,0.5);" class="form-control text-center form mk_quintpax" name="mk_quintpax" value="<?php echo ($addflag != 1) ? $get["mk_quintpax"] : ""; ?>" tabindex="107">
                                                                                </td>
                                                                                <td>
                                                                                    <input type="number" step="any" class="form-control text-center form mdquint" name="mdquint" value="<?php echo ($addflag != 1) ? $get["mdquint"] : ""; ?>" tabindex="108">
                                                                                </td>
                                                                                <td>
                                                                                    <input type="number" step="any" style="background-color: rgba(47,191,254,0.5);" class="form-control text-center form md_quintpax" name="md_quintpax" value="<?php echo ($addflag != 1) ? $get["md_quintpax"] : ""; ?>" tabindex="109">
                                                                                </td>
                                                                                <!-- <td></td> -->
                                                                            </tr>

                                                                            <tr>
                                                                                <td>Suite/6 In a Room</td>
                                                                                <td>
                                                                                    <input type="number" step="any" class="form-control text-center form mksuite" name="mksuite" value="<?php echo ($addflag != 1) ? $get["mksuite"] : ""; ?>" tabindex="110">
                                                                                </td>
                                                                                <td>
                                                                                    <input type="number" step="any" style="background-color: rgba(47,191,254,0.5);" class="form-control text-center form mk_suitepax" name="mk_suitepax" value="<?php echo ($addflag != 1) ? $get["mk_suitepax"] : ""; ?>" tabindex="111">
                                                                                </td>
                                                                                <td>
                                                                                    <input type="number" step="any" class="form-control text-center form mdsuite" name="mdsuite" value="<?php echo ($addflag != 1) ? $get["mdsuite"] : ""; ?>" tabindex="112">
                                                                                </td>
                                                                                <td>
                                                                                    <input type="number" step="any" style="background-color: rgba(47,191,254,0.5);" class="form-control text-center form md_suitepax" name="md_suitepax" value="<?php echo ($addflag != 1) ? $get["md_suitepax"] : ""; ?>" tabindex="113">
                                                                                </td>
                                                                                <!-- <td></td> -->
                                                                            </tr>

                                                                            <tr>
                                                                                <td>No Bed</td>
                                                                                <td>
                                                                                    <input type="number" step="any" class="form-control text-center form mknobed" name="mknobed" value="<?php echo ($addflag != 1) ? $get["mknobed"] : ""; ?>" tabindex="114">
                                                                                </td>
                                                                                <td></td>
                                                                                <td>
                                                                                    <input type="number" step="any" class="form-control text-center form mdnobed" name="mdnobed" value="<?php echo ($addflag != 1) ? $get["mdnobed"] : ""; ?>" tabindex="115">
                                                                                </td>
                                                                                <td></td>
                                                                                <!-- <td></td> -->
                                                                            </tr>

                                                                            <!-- <tr>
    <td>Room No.</td>
    <td>
        <input type="text" class="form-control form mkroom" name="mkroom" value="<?php echo ($addflag != 1) ? $get["mkroom"] : ""; ?>" tabindex="97">
    </td>
    <td></td>
    <td>
        <input type="text" class="form-control form mdroom" name="mdroom" value="<?php echo ($addflag != 1) ? $get["mdroom"] : ""; ?>" tabindex="98">
    </td>
    <td></td>
    <td>
        <input type="text" class="form-control form othroom" name="othroom" value="<?php echo ($addflag != 1) ? $get["othroom"] : ""; ?>" tabindex="99">
    </td>
</tr> -->

                                                                        </tbody>
                                                                    </table>


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

                                                    </div>

                                                </div><!-- /.tab_3 -->

                                            </div><!-- /.tab-content -->
                                        </div><!-- /.tab-pane -->





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

                </div>


                <div class="modal cashModal" tabindex="-1" data-bs-backdrop="static" 
                     aria-hidden="true" 
                     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">Cash Calculation</h4>
                            </div>
                            <div class="modal-body">
                                <div class="row">

                                    <div class="col-lg-3 col-md-2 col-sm-2 col-xs-2 text-left pad">
                                        <label class="label-control marg"> </label>
                                    </div>
                                    <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 text-center pad" style="color: #2FBFFE;">
                                        <label class="label-control marg"><b>Tour</b> </label>
                                    </div>
                                    <div class="col-lg-1 col-md-2 col-sm-2 col-xs-2 text-center pad" style="width:20px">
                                        <label class="label-control marg"> </label>
                                    </div>
                                    <div class="col-lg-1 col-md-2 col-sm-2 col-xs-2 text-center pad" style="color: #2FBFFE;">
                                        <label class="label-control marg"> <b> No. </b> </label>
                                    </div>
                                    <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 text-right pad" style="color: #2FBFFE;">
                                        <label class="label-control marg"><b> Amount </b></label>
                                    </div>

                                </div>
                                <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"></label>
                                    </div>

                                    <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                        <label class="label-control marg">Adult </label>
                                    </div>
                                    <div class="col-lg-2 col-md-8 col-sm-8 col-xs-8 pad">
                                        <input type="number" step="any" class="form-control form text-right csfull" name="csfull" value="<?php echo ($addflag != 1) ? $tregcs["csfull"] : "0"; ?>">
                                    </div>
                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 text-center pad" style="width:20px">
                                        <label class="label-control marg" style="color: #2FBFFE;font-weight:bold"> x </label>
                                    </div>
                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                        <input type="number" step="any" class="form-control form text-right csfullno" name="csfullno" value="<?php echo ($addflag != 1) ? $tregcs["csfullno"] : "0"; ?>">
                                    </div>
                                    <div class="col-lg-2 col-md-8 col-sm-8 col-xs-8 pad">
                                        <input type="number" step="any" class="form-control form text-right csfullamt" name="csfullamt" value="<?php echo ($addflag != 1) ? $tregcs["csfullamt"] : "0"; ?>" readonly>
                                    </div>

                                </div>
                                <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"></label>
                                    </div>
                                    <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                        <label class="label-control marg">Child wb </label>
                                    </div>
                                    <div class="col-lg-2 col-md-8 col-sm-8 col-xs-8 pad">
                                        <input type="number" step="any" class="form-control form text-right cshalf" name="cshalf" value="<?php echo ($addflag != 1) ? $tregcs["cshalf"] : "0"; ?>">
                                    </div>
                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 text-center pad" style="width:20px">
                                        <label class="label-control marg" style="color: #2FBFFE;font-weight:bold"> x </label>
                                    </div>
                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                        <input type="number" step="any" class="form-control form text-right cshalfno" name="cshalfno" value="<?php echo ($addflag != 1) ? $tregcs["cshalfno"] : "0"; ?>">
                                    </div>
                                    <div class="col-lg-2 col-md-8 col-sm-8 col-xs-8 pad">
                                        <input type="number" step="any" class="form-control form text-right cshalfamt" name="cshalfamt" value="<?php echo ($addflag != 1) ? $tregcs["cshalfamt"] : "0"; ?>" readonly>
                                    </div>

                                </div>
                                <div class="row">
                                    <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                    </div>
                                    <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                        <label class="label-control marg">Child wob </label>
                                    </div>
                                    <div class="col-lg-2 col-md-8 col-sm-8 col-xs-8 pad">
                                        <input type="number" step="any" class="form-control form  text-right cschildwob" name="cschildwob" value="<?php echo ($addflag != 1) ? $tregcs["cschildwob"] : "0"; ?>">
                                    </div>
                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 text-center pad" style="width:20px">
                                        <label class="label-control marg" style="color: #2FBFFE;font-weight:bold"> x </label>
                                    </div>
                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                        <input type="number" step="any" class="form-control form text-right cschildwobno" name="cschildwobno" value="<?php echo ($addflag != 1) ? $tregcs["cschildwobno"] : "0"; ?>">
                                    </div>
                                    <div class="col-lg-2 col-md-8 col-sm-8 col-xs-8 pad">
                                        <input type="number" step="any" class="form-control form  text-right cschildwobamt" name="cschildwobamt" value="<?php echo ($addflag != 1) ? $tregcs["cschildwobamt"] : "0"; ?>" readonly>
                                    </div>
                                </div>
                                <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"></label>
                                    </div>
                                    <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                        <label class="label-control marg">Inf </label>
                                    </div>
                                    <div class="col-lg-2 col-md-8 col-sm-8 col-xs-8 pad">
                                        <input type="number" step="any" class="form-control form  text-right csinf" name="csinf" value="<?php echo ($addflag != 1) ? $tregcs["csinf"] : "0"; ?>">
                                    </div>
                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 text-center pad" style="width:20px">
                                        <label class="label-control marg" style="color: #2FBFFE;font-weight:bold"> x </label>
                                    </div>
                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 pad">
                                        <input type="number" step="any" class="form-control form  text-right csinfno" name="csinfno" value="<?php echo ($addflag != 1) ? $tregcs["csinfno"] : "0"; ?>">
                                    </div>
                                    <div class="col-lg-2 col-md-8 col-sm-8 col-xs-8 pad">
                                        <input type="number" step="any" class="form-control form  text-right csinfamt" name="csinfamt" value="<?php echo ($addflag != 1) ? $tregcs["csinfamt"] : "0"; ?>" readonly>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-lg-6 col-md-3 col-sm-3 col-xs-3 text-right pad" style="color:green;font-size: 20px" >
                                        <label class="label-control marg">Total </label>
                                    </div>
                                    <div class="col-lg-1 col-md-8 col-sm-8 col-xs-8 text-center pad" style="width:20px">
                                    </div>

                                    <div class="col-lg-2 col-md-8 col-sm-8 col-xs-8 pad">
                                        <input type="number" step="any" class="form-control form  text-right csnettot" name="csnettot" value="<?php echo ($addflag != 1) ? $tregcs["csnettot"] : "0"; ?>" readonly style="color:green;font-size: 20px">
                                    </div>
                                </div>
                            </div>
                            <div class="modal-footer">
                                <button type="button" id='closecash' value="Close" class="btn btn-pad btn-square" style="background-color:white;border:2px solid #008D4C ; color:#008D4C ">
                                    Close
<!--                                    <i class="fa fa-check-square" style="color:#ffffff"></i>-->
                                </button>
                            </div>
                        </div>
                    </div>
                </div>



                <div class="modal taxModal" tabindex="-1" data-bs-backdrop="static" 
                     aria-hidden="true" 
                     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">Tax Calculation</h4>
                            </div>
                            <div class="modal-body">
                                <div class="table-responsive" style="max-height: 400px;overflow: auto;">
                                    <table id="" class="table-striped table-condensed table-bordered" width="100%">
                                        <thead>
                                            <tr class="mySearchTr">
                                                <th style="width:10%" class="text-right">Per Pax Amount</th>
                                                <th style="width:5%"  class="text-right">Total Pax</th>
                                                <th style="width:10%" class="text-right">GST (Each)</th>
                                                <th style="width:10%" class="text-right">Tcs < 7 Lakhs(Each)</th>
                                                <th style="width:10%" class="text-right">Tcs > 7 Lakhs(Each)</th>
                                                <th style="width:10%" class="text-right">Total GST</th>
                                                <th style="width:10%" class="text-right">Total Tcs < 7 Lakhs</th>
                                                <th style="width:10%" class="text-right">Total Tcs > 7 Lakhs</th>
                                            </tr>
                                        </thead>
                                        <tbody class="taxbody">

                                            <?php
                                            $pxctr = 0;
                                            $gettax = mysqli_query($conn, "Select * from regntax where vouchno = '$mvouch' orde by srno");
                                            while ($rowtx = mysqli_fetch_array($gettax)) {
                                                echo "<tr>";
                                                echo "<td><input type='text' name='ppamt_$pxctr' class='form-control ppiamt text-right' value='$rowtx[singamt]' readonly></td>";
                                                echo "<td><input type='text' name='tpax_$pxctr' class='form-control tinf text-right' value='$rowtx[paxcnt]'></td>";
                                                echo "<td><input type='text' name='fgst_$pxctr' class='form-control ingst text-right' value='$rowtx[gsteach]' readonly></td>";
                                                echo "<td><input type='text' name='ftcs1_$pxctr' class='form-control intcs1 text-right' value='$rowtx[tcs1each]' readonly></td>";
                                                echo "<td><input type='text' name='ftcs2_$pxctr' class='form-control intcs2 text-right' value='$rowtx[tcs2each]' readonly></td>";
                                                echo "<td><input type='text' name='ftgst_$pxctr' class='form-control intgst text-right' value='$rowtx[totgst]' readonly></td>";
                                                echo "<td><input type='text' name='fgtcs1_$pxctr' class='form-control ingtcs1 text-right' value='$rowtx[tottcs1]' readonly></td>";
                                                echo "<td><input type='text' name='fgtcs2_$pxctr' class='form-control ingtcs2 text-right' value='$rowtx[tottcs2]' readonly></td>";
                                                echo "</tr>";
                                                $pxctr++;
                                            }
                                            ?>

                                        <input type="hidden" name="itemstax" value="1" id="itemstax" value="<?php echo $pxctr ?>">
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                            <div class="modal-footer">
                                <button type="button" id='closetax' value="Close" class="btn btn-pad btn-square form" style="background-color:#008D4C;color:white ">
                                    Save Tax Calculation
<!--                                    <i class="fa fa-check-square" style="color:#ffffff"></i>-->
                                </button>
                            </div>
                        </div>
                    </div>
                </div>


                <div class="modal fade paxModal" 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">Pax Entry</h4>
                            </div>
                            <div class="modal-body">
                                <div class="table-responsive" style="max-height: 400px;overflow: auto;">
                                    <table id="" class="table-striped table-condensed table-bordered" width="100%">
                                        <thead>
                                            <tr class="mySearchTr">
                                                <th style="width:10%">Suffix</th>
                                                <th style="width:25%">Pax Name</th>
                                                <th style="width:10%">Gender</th>
                                                <th style="width:10%">Ticket Amt.</th>
                                                <th style="width:10%">Tour Amt.</th>
                                                <th style="width:10%">Passport</th>
                                                <th style="width:10%">Manual No.</th>
                                            </tr>
                                        </thead>
                                        <tbody class="paxbody">
                                            <tr>
                                                <td>
                                                    <select name="suffix_0" id="suffix" class="form-control suffix form select2 fetchpart_0">
                                                        <option></option>
                                                        <?php
                                                        $getsuff = mysqli_query($conn, "Select * from suffix order by name");
                                                        while ($row = mysqli_fetch_array($getsuff)) {
                                                            echo "<option value='$row[name]'>$row[name]</option>";
                                                        }
                                                        ?>
                                                    </select>
                                                </td>
                                                <td><input type="text" name="paxname_0" class="form-control form paxname"></td>
                                                <td>
                                                    <select name="paxgend_0" id="paxgend" class="form-control paxgend form select2 fetchpart_0">
                                                        <option value='M'>Male</option>
                                                        <option value='F'>Female</option>
                                                    </select>
                                                </td>
                                                <td><input type="number" step="any" step='any' name="ticktamt_0" class="form-control form text-right ticktamt"></td>
                                                <td><input type="number" step="any" step='any' name="touramt_0" class="form-control form text-right touramt"></td>
                                                <td><input type="text" name="paxpass_0" class="form-control form paxpass"></td>
                                                <td><input type="text" name="manualno_0" class="form-control form manualno"></td>
                                            </tr>
                                        </tbody>
                                        <input type="hidden" name="items" value="1" id="items">
                                    </table>
                                </div>
                            </div>
                            <div class="modal-footer">
                                <button id='submit' type='submit' name='submit' value="Save" class="btn btn-pad btn-square " style="background-color:#008D4C; ">
                                    <i class="fa fa-check" style="color:#ffffff"></i>
                                </button>
                            </div>
                        </div>
                    </div>
                </div>

                </form>

                <!-- Modal for Pax Member Details Start  -->

                <div class="modal fade paxmemModal" 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">Pax Member Details</h4>
                            </div>
                            <div class="modal-body">
                                <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 style="width:10%">Regn. No.</th>
                                                <th style="width:10%">Pax No.</th>
                                                <th style="width:10%">Date</th>
                                                <th style="width:25%">Pax Name</th>
                                                <th style="width:10%">Gender</th>
                                                <th style="width:10%">Passport</th>
                                                <th style="width:10%">Departure</th>
                                                <!-- <th style="width:10%">Ticket Amt.</th>
                                                                                                <th style="width:10%">Tour Amt.</th> -->
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <?php
                                            $getpaxdetails = mysqli_query($conn, "SELECT * FROM visaform WHERE vregnno = '$get[regnno]' AND tour = '$tourcode' ") or die(mysqli_error($conn));
                                            while ($fetpaxdtl = mysqli_fetch_array($getpaxdetails)) {

                                                if ($fetpaxdtl['cmbgender'] == 'M') {
                                                    $tgender = 'Male';
                                                } else {
                                                    $tgender = 'Female';
                                                }
                                                $paxfullnm = $fetpaxdtl['suffix'] . '. ' . $fetpaxdtl['surname'] . ' ' . $fetpaxdtl['lastname'] . ' ' . $fetpaxdtl['midname'];

                                                $paxvouchdt = date("d-m-Y", strtotime($fetpaxdtl['vouchdt']));
                                                $paxdepdt = date("d-m-Y", strtotime($get['depdate']));

                                                $mctr++;
                                                echo "<tr class='clickable-row2' data-href='paxform.php?vouchno=$fetpaxdtl[vouchno]&mode=edit' data-target='_blank'>";
                                                echo "<td>$fetpaxdtl[vregnno]</td>";
                                                echo "<td>$fetpaxdtl[vouchno]</td>";
                                                echo "<td>$paxvouchdt</td>";
                                                echo "<td>$paxfullnm</td>";
                                                echo "<td>$tgender</td>";
                                                echo "<td>$fetpaxdtl[redypass]</td>";
                                                echo "<td>$paxdepdt</td>";

                                                echo "</tr>";
                                                $ctr++;
                                            }
                                            ?>
                                        </tbody>

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

                        </div>
                    </div>
                </div>
                <!-- Modal for Pax Member Details End  -->


                <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</option>
                                            <option value="2">Date</option>
                                            <option value="3">Name</option>
                                            <option value="4">Surname</option>
                                            <option value="5">Class</option>
                                            <option value="6">Dep. Date</option>
                                            <!-- <option value="7">Tour No.</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</option>
                                            <option value="2">Date</option>
                                            <option value="3">Name</option>
                                            <option value="4">Surname</option>
                                            <option value="5">Class</option>
                                            <option value="6">Dep. Date</option>
                                            <!-- <option value="7">Tour No.</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">
                                </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-striped table-condensed table-bordered" width="100%">
                                        <thead>
                                            <tr class="mySearchTr">
                                                <th style="width:5%">Voucher</th>
                                                <th style="width:8%">Date</th>
                                                <th style="width:15%">Name</th>
                                                <th style="width:10%">Surame</th>
                                                <th style="width:10%">Class</th>
                                                <th style="width:10%">Dep. Date</th>
                                                <th style="width:10%">Tour No.</th>
                                                <th style="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>