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

$maindb = 'profexmain';
$trandb = 'profextran';
$accdb = '';
$stkdb = '';
$printfile = "profinvexp_prin.php";
$file = 'profinvoexp.php';
$trandbexist = 1;
$source = "";
$keyfld = "vouchno";
$myyear = $_SESSION["tit_" . $dbname];
$zroot = $_SESSION['zdir'];

date_default_timezone_set('Asia/Kolkata');
$time = date('H:i:s');

$usertype = $_SESSION["usertype"];
$username = $_SESSION["username_" . $dbname];


$formname = 'INVOICE EXPORT';

$admin = $_SESSION["admin_" . $dbname];
$zdb = $_SESSION["zdbyear_" . $dbname];
$zyear = right($zdb, 4);
$zroot = $_SESSION["zdbroot"];
$zStartDate = getzdates($zyear, 'S');
$zEndDate = getzdates($zyear, 'E');

mysqli_select_db($conn, $zdb);

include("includes/vouchno_generate.php");
include("includes/prev&next.php");


if (isset($_POST["cancbtn"])) {
    $mcancvouch = $_POST['cancvouch'];
    $mcashvouch2 = $_POST['cashvouch2'];
    $cancdate = $_POST['cancdate'];

//    browse($cancdate);
    if ($cancdate != '' || $cancdate != '0000-00-00') {


        mysqli_query($conn, "Update `$maindb` set `cancdate`='$cancdate', cancuser='$username', canc_flag='C' where vouchno = '$mcancvouch'") or die(mysqli_error($conn));
        mysqli_query($conn, "Update `$trandb` set canc='C' where vouchno = '$mcancvouch'") or die(mysqli_error($conn));
        browse('Bill Cancelled');
    }
    header("refresh: 1; $file?mode=edit&$keyfld=$mcancvouch&form=$form");
}

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

    $a = 1;
    $owner = mysqli_real_escape_string($conn, trim($_POST["owner"]));
    $voucher = trim($_POST["voucher"]);
    $mono = $_POST["monno"];
    $invno = trim($_POST["invno"]);
    $invdate = trim($_POST["invdate"]);
    $godown = trim($_POST["godown"]);
    $ordno = trim($_POST["ordno"]);
    $orddt = trim($_POST["orddt"]);
    $party = trim($_POST["party"]);
    $vessel = trim($_POST["vessel"]);
    $pol = trim($_POST["cmbpol"]);
    $pod = trim($_POST["cmbpod"]);
    $find = trim($_POST["cmbfin_d"]);
    $country = trim($_POST["country"]);
    $grossamt = trim($_POST["grossamt"]);
    $freight = trim($_POST["freight"]);
    $taxes = trim($_POST["taxes"]);
    $totbillamt = trim($_POST["totbillamt"]);
    $totdiscamt = trim($_POST["totdiscamt"]);
    $consignee = trim($_POST["consignee"]);
    $conadd = trim($_POST["conadd"]);
    $buyconsign = trim($_POST["buyconsign"]);
    $buyconadd = trim($_POST["buyconadd"]);
    $exptype = trim($_POST["exptype"]);
    $portcode = trim($_POST["portcode"]);
    $currency = trim($_POST["curr"]);
    $roe = trim($_POST["roe"]);
    $igstrate = trim($_POST["igstrate"]);
    $igstamt = trim($_POST["igstamt"]);
    $taxableamt = trim($_POST["taxableamt"]);
    $discamt = trim($_POST["discamt"]);
    $inramt = trim($_POST["inramt"]);
    $netweight = trim($_POST["netweight"]);
    $grossweight = trim($_POST["grossweight"]);
    $tctns = trim($_POST["tctns"]);
    $dimension = trim($_POST["dimension"]);
    $blno = trim($_POST["blno"]);
    $sbno = trim($_POST["sbno"]);
    $sbdate = trim($_POST["sbdate"]);
    $topay = trim($_POST["topay"]);
    $totcbm = trim($_POST["totcbm"]);

    $marksnos1 = trim($_POST["marksnos1"]);
    $marksnos2 = trim($_POST["marksnos2"]);
    $marksnos3 = trim($_POST["marksnos3"]);
    $marksnos4 = trim($_POST["marksnos4"]);

    $kindpack1 = trim($_POST["kindpack1"]);
    $kindpack2 = trim($_POST["kindpack2"]);
    $kindpack3 = trim($_POST["kindpack3"]);
    $kindpack4 = trim($_POST["kindpack4"]);

    $descgood1 = trim($_POST["descgood1"]);
    $descgood2 = trim($_POST["descgood2"]);
    $descgood3 = trim($_POST["descgood3"]);
    $descgood4 = trim($_POST["descgood4"]);


    $ci = isset($_POST["ci"]) ? $_POST["ci"] : 0;

    $rem1 = '';
    $rem2 = '';

    $count = $_POST["items"];
    $mvouch = $qvouch;
    $purcode = '30';

    if ($consignee == "") {
        browse("Consignee Cannot Be Empty");
        $a = 0;
    }


    if ($a == 1) {

        mysqli_query($conn, "LOCK TABLES `$maindb` WRITE, `$trandb` WRITE, `product` WRITE, `$stkdb` WRITE, `$accdb` WRITE, `cashrecp` WRITE, `accmast` WRITE ");

        if ($addflag == 1) {
            $gen1 = mysqli_query($conn, "SELECT MAX(vouchno+0) AS maxcode FROM `$maindb` where vouchno != '' $keycond 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;
        }


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


        $cnt = 0;

        for ($i = 0; $i < $count; $i++) {
            $cnt++;
            $msrno = $_POST["srno_$i"];
            $mbarcode = $_POST["barcode_$i"];
            $mitemcode = $_POST["itemcode_$i"];
            $gram = $_POST["gram_$i"];
            $hsncode = $_POST["hsncode_$i"];
            $unit = $_POST["unit_$i"];
            $mrp = $_POST["mrp_$i"];
            $batch = $_POST["batch_$i"];
            $dzn = $_POST["dzn_$i"];
            $qty = $_POST["qty_$i"];
            $rate = $_POST["rate_$i"];
            $amt = $_POST["amount_$i"];
            $l = $_POST["l_$i"];
            $b = $_POST["b_$i"];
            $h = $_POST["h_$i"];
            $cbm = $_POST["cbm_$i"];
            $mqty = $qty * -1;

            $netamt = $amt * $roe;

            $group = $source . $mvouch;

            if (!empty($mbarcode)) {

                mysqli_query($conn, "INSERT INTO `$trandb`(`srno`,vouchno, vouchdt, itemcode, `barcode`, `gram`, hsncode, mrp,
                                                   unit, batch, dzn, qty, rate, amount, l, b, h, cbm, roetran, amtcurr)
                                    VALUES('$cnt', '$mvouch', '$invdate', '$mitemcode', '$mbarcode', '$gram', '$hsncode','$mrp',
                                           '$unit', '$batch', '$dzn', '$qty', '$rate', '$amt', '$l', '$b', '$h', '$cbm', '$roe', '$netamt')") or die(mysqli_error($conn));
            }
        }


        if ($addflag == 1) {
            mysqli_query($conn, "INSERT INTO `$maindb`(vouchno, `invoice`, `invdate`, `owner`, `partyname`, vessel, orderno, orddate, portofloading, portofdischarge,
                                               finaldestination, country, grossamt, freight, taxes, billamt, flight, `rem1`, `rem2`, consignee,
                                               `conadd`, discount, ci,`marksnos1`, `marksnos2`, `marksnos3`, `marksnos4`, `voucher`,`monno`,
                                               `kindpack1`, `kindpack2`, `kindpack3`, `kindpack4`,`descgood1`, `descgood2`, `descgood3`,
                                               `descgood4`,`godown`,`exptype`,`igstrate`,`igstamt`,`taxableamt`,`discamt`,`portcode`,`curr`, `roe`,`inramt`,`netweight`
                                               ,`grossweight`,`tctns`,`dimension`,`blno`,`sbno`, `sbdate`, `topay`, totcbm, `username`)
                        VALUES('$qvouch', '$invno', '$invdate', '$owner', '$party', '$vessel', '$ordno','$orddt', '$pol','$pod',
                               '$find', '$country', '$grossamt', '$freight', '$taxes', '$totbillamt', '$flight', '$rem1', '$rem2', '$consignee',
                               '$conadd', '$totdiscamt','$ci','$marksnos1', '$marksnos2', '$marksnos3', '$marksnos4', '$voucher', '$mono', 
                               '$kindpack1', '$kindpack2', '$kindpack3', '$kindpack4', '$descgood1', '$descgood2', '$descgood3',
                               '$descgood4','$godown','$exptype','$igstrate','$igstamt','$taxableamt','$discamt','$portcode','$currency', '$roe', '$inramt','$netweight',
                               '$grossweight','$tctns','$dimension','$blno','$sbno', '$sbdate', '$topay', '$totcbm', '$username')") or die(mysqli_error($conn));
        } else {

            mysqli_query($conn, "UPDATE `$maindb` SET  invoice='$invno', `invdate`='$invdate', `owner` = '$owner', totcbm='$totcbm', `partyname`='$party', vessel='$vessel', orderno='$ordno', `orddate`='$orddt',
                                               country='$country', portofloading='$pol', portofdischarge='$pod', finaldestination='$find',
                                               `grossamt`='$grossamt', freight='$freight', taxes='$taxes', billamt='$totbillamt', flight='$flight',
                                               `rem1`='$rem1', `rem2`='$rem2', consignee='$consignee', `conadd` ='$conadd', discount ='$totdiscamt',
                                               `ci`='$ci',`marksnos1`='$marksnos1', `marksnos2`='$marksnos2', `marksnos3`='$marksnos3', `marksnos4`='$marksnos4',
                                               `kindpack1`='$kindpack1', `kindpack2`='$kindpack2', `kindpack3`='$kindpack3', `kindpack4`='$kindpack4',
                                               `descgood1`='$descgood1', `descgood2`='$descgood2', `descgood3`='$descgood3', `descgood4`='$descgood4',
                                               `godown`='$godown', `voucher`='$voucher', `monno`='$mono',`portcode`='$portcode', `exptype`='$exptype',   
                                               `taxableamt`='$taxableamt',`discamt`='$discamt',`igstrate`='$igstrate', `igstamt`='$igstamt',`curr`='$currency', `roe`='$roe',
                                            `inramt`='$inramt',`netweight`='$netweight',`grossweight`='$grossweight',`tctns`='$tctns',`dimension`='$dimension',
                                            `blno`='$blno',`sbno`='$sbno', `sbdate`='$sbdate',`topay`='$topay', `username`='$username' WHERE vouchno = '$mvouch' ") or die(mysqli_error($conn));
        }
        mysqli_query($conn, "UNLOCK TABLES");
        if ($addflag == 1) {
//            browse($fseries); 
            insmess();
            header("refresh: 1; $file?mode=edit&$keyfld=$mvouch&form=$form");
        } else {
            updmess();
//            header("refresh: 1; $file?mode=edit&$keyfld=$mvouch&series=$fseries");
        }
    }
}


if ($addflag != 1) {

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

    $result = mysqli_query($conn, "SELECT * FROM `$maindb` WHERE $keyfld='$getvouch'") or die(mysqli_error($conn));
    $get = mysqli_fetch_array($result);

    $getconsg = mysqli_query($conn, "SELECT `accode`,`name` FROM `accmast` WHERE `accode`= '$get[consignee]' and grpcode = '010'") or die(mysqli_error($conn));
    $lconsg = mysqli_fetch_array($getconsg);

    $getparty = mysqli_query($conn, "SELECT `accode`,`name` FROM `accmast` WHERE `accode`= '$get[partyname]' and grpcode = '010'") or die(mysqli_error($conn));
    $lparty = mysqli_fetch_array($getparty);

    $getgodown = mysqli_query($conn, "SELECT * FROM `godown` WHERE `code`= '$get[godown]'") or die(mysqli_error($conn));
    $getgd = mysqli_fetch_array($getgodown);
}

if (isset($_GET["delete"])) {
    mysqli_query($conn, "LOCK TABLES `$maindb` WRITE, `$trandb` WRITE")or die(mysqli_error($conn));

    $delcond = " source = '$source' and vouchno = '$_GET[vouchno]'";
    $delcond2 = " vouchno = '$_GET[vouchno]'";

    delnew($zdb, "$maindb", "$delcond2", "$file?mode=last");
    delnew($zdb, "$trandb", "$delcond2", "$file?mode=last");
    
    mysqli_query($conn, "UNLOCK TABLES");
}

$getcomp = mysqli_query($conn, "SELECT `deeminv` FROM `$zroot`.`company` WHERE `code`!=''") or die(mysqli_error($conn));
$fcomp = mysqli_fetch_array($getcomp);
$compinvno = $fcomp['deeminv'];

include("includes/linkshead.php");
?>
<script src="MyScript/invoexp.js" type="text/javascript"></script>
<script src="MyScript/search_item.js?A=<?= mt_rand(); ?>" type="text/javascript"></script>
<script src="MyScript/invoexp_search.js" type="text/javascript"></script>
<script src="MyScript/checkdate.js" type="text/javascript"></script>

</head>
<body>
    <form action='' method='POST'>
        <div class="col-lg-3 pad text-center" id="overlay_form" style="display:none;z-index:999;">
            <button type="button" id="close_form" style="float: right;font-weight: bold;font-size: 18px;color:red;" ><i class="fa fa-close"></i></button>
            <div style='width:100%;' id='browdata'>
            </div>
        </div>
        <!-- Default box -->
        <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12  pad">
            <div class="panel panel-default">
                <div class="panel-heading" style="height:40px">
                    <div class="col-lg-10 col-md-10 col-sm-10  col-xs-10">
                        <h3 class="panel-title" style="color:#78909C"><a class="myPrint"><?php echo $formname; ?></a></h3>

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

                        <h4 class="panel-title" style="float:right"><b><?php echo $get['username'] ?></b></h4>
                    </div>

                </div>
                <div class="panel-body">
                    <div class="row">
                        <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad">
                            <label class="label-control marg">Voucher</label>
                        </div>
                        <div class="col-lg-2 col-md-1 col-sm-1 col-xs-1 pad">
                            <input type="text" name="voucher" class="form-control form voucher" value="<?php echo ($addflag != 1) ? $get['vouchno'] : '' ?>" tabindex="-1" readonly>
                            <input type="hidden" name="monno" class="form-control form monno" value="<?php echo ($addflag != 1) ? $get['monno'] : '' ?>" >
                            <input type="hidden" name="vouchno" class="form-control form vouchno" value="<?php echo ($addflag != 1) ? $get['vouchno'] : $qvouch ?>" >
                            <input type="hidden" class="form-control form canc_flag" value="<?php echo ($addflag != 1) ? $get['canc_flag'] : "" ?>" >
                            <input type="date" value="<?= $zStartDate ?>" style="width: 1px;border: none" class="zstdate">
                            <input type="date" value="<?= $zEndDate ?>" style="width: 1px;border: none" class="zenddate">
                        </div>

                        <div class="col-lg-1 pad text-right">
                            <label class="label-control marg">Notify Party</label>
                        </div>
                        <div class="col-lg-2 col-md-2 col-sm-1 col-xs-8 pad">
                            <select class="form-control form cmbparty select2" name="party" style="width: 100%">
                                <option value="<?php Echo ($addflag != 1) ? $lparty["accode"] : ""; ?>"><?php Echo ($addflag != 1) ? $lparty["name"] : ""; ?></option>
                                <?php
                                $gparty = mysqli_query($conn, "SELECT `accode`,`name` FROM `accmast` WHERE `grpcode`='010' order by name")or die(mysqli_error($conn));
                                while ($party = mysqli_fetch_array($gparty)) {
                                    Echo "<option value='$party[accode]'>$party[name]</option>";
                                }
                                ?>
                            </select>
                        </div>

                        <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad">
                            <label class="label-control marg">Vessel</label>
                        </div>
                        <div class="col-lg-2 col-md-2 col-sm-1 col-xs-8 pad">
                            <input type="text"  class="form-control form vessel" name="vessel" value="<?php Echo ($addflag != 1) ? $get["vessel"] : ""; ?>" >                            
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-lg-1 pad text-right">
                            <label class="label-control marg">Consignee</label>
                        </div>
                        <div class="col-lg-2 pad">
                            <select class="form-control form cmbparty select2 consignee" name="consignee" style="width: 100%">
                                <option value="<?php Echo ($addflag != 1) ? $lconsg["accode"] : ""; ?>"><?php Echo ($addflag != 1) ? $lconsg["name"] : ""; ?></option>
                                <?php
                                $gparty2 = mysqli_query($conn, "SELECT `accode`,`name` FROM `accmast` WHERE `grpcode`='010' order by name")or die(mysqli_error($conn));
                                while ($party = mysqli_fetch_array($gparty2)) {
                                    Echo "<option value='$party[accode]'>$party[name]</option>";
                                }
                                ?>
                            </select>
                        </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-2 col-md-8 col-sm-8 col-xs-8 pad">
                            <textarea rows="4" cols="60" class="form-control form add" style="resize:none;" name="conadd"><?php Echo ($addflag != 1) ? $get["conadd"] : ""; ?></textarea>
                        </div>
                        <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad">
                            <label class="label-control marg">Invoice</label>
                        </div>
                        <div class="col-lg-2 col-md-1 col-sm-1 col-xs-1 pad">
                            <!--<input type="text" name="invno" class="form-control form invno" value="<?php echo ($addflag != 1) ? $get['invoice'] : $compinvno . "/" . $zyear . "/" . "EXP" . $qvouch; ?>">-->
                            <input type="text" name="invno" class="form-control form invno" value="<?php echo ($addflag != 1) ? $get['invoice'] : "EXP-" . $qvouch; ?>">
                        </div>
                        <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad">
                            <label class="label-control marg">Invoice Date.</label>
                        </div>
                        <div class="col-lg-2 col-md-2 col-sm-1 col-xs-8 pad">
                            <input type="date" class="form-control form vouchdt" name="invdate"  value="<?php Echo ($addflag != 1) ? $get["invdate"] : date("Y-m-d"); ?>" autofocus>
                        </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">Order No.</label>
                        </div>
                        <div class="col-lg-2 col-md-1 col-sm-1 col-xs-1 pad">
                            <input type="text" name="ordno" class="form-control form ordno" value="<?php echo ($addflag != 1) ? $get['orderno'] : $qvouch; ?>" tabindex="-1" readonly>
                        </div>
                        <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad">
                            <label class="label-control marg">Order Date.</label>
                        </div>
                        <div class="col-lg-2 col-md-2 col-sm-1 col-xs-8 pad">
                            <input type="date" class="form-control form orddt" name="orddt"  value="<?php Echo ($addflag != 1) ? $get["orddate"] : date("Y-m-d"); ?>" autofocus>
                        </div>
                        <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad">
                            <label class="label-control marg">Port of Loading</label>
                        </div>
                        <div class="col-lg-2 col-md-2 col-sm-1 col-xs-8 pad">
                            <input type="text"  class="form-control form cmbpol" name="cmbpol" value="<?php Echo ($addflag != 1) ? $get["portofloading"] : ""; ?>" >                            
                        </div>
                        <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad">
                            <label class="label-control marg">Port of Discharge</label>
                        </div>
                        <div class="col-lg-2 col-md-2 col-sm-1 col-xs-8 pad">
                            <input type="text"  class="form-control form cmbpod" name="cmbpod" value="<?php Echo ($addflag != 1) ? $get["portofdischarge"] : ""; ?>" >                            
                        </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">Final Destination</label>
                        </div>
                        <div class="col-lg-2 col-md-2 col-sm-1 col-xs-8 pad">
                            <input type="text"  class="form-control form cmbfin_d" name="cmbfin_d" value="<?php Echo ($addflag != 1) ? $get["finaldestination"] : ""; ?>" >                            
                        </div>
                        <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad">
                            <label class="label-control marg">Country</label>
                        </div>
                        <div class="col-lg-2 col-md-2 col-sm-1 col-xs-8 pad">
                            <input type="text"  class="form-control form country" name="country" value="<?php Echo ($addflag != 1) ? $get["country"] : ""; ?>" >                            
                        </div>
                        <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad">
                            <!--<label class="label-control marg">Godown</label>-->
                        </div>
                        <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 pad">
<!--                            <select name="godown" class="form-control form godown select2" required>
                                <option value="<?php // echo ($addflag != 1) ? $getgd['code'] : " "; ?>"><?php // echo ($addflag != 1) ? $getgd['gcode'] : " "; ?></option>
                                <?php
//                                $mown = mysqli_query($conn, "SELECT * FROM `godown`") or die(mysqli_error($conn));
//                                while ($trow = mysqli_fetch_array($mown)) {
//                                    echo "<option value=$trow[code]>$trow[gcode]</option>";
//                                }
                                ?>
                            </select>-->
                        </div>
                        <div class="col-lg-2 pad text-right">
                            <label class="label-control marg">Export Type</label>
                        </div>
                        <div class="col-lg-2 col-md-2 col-sm-1 col-xs-8 pad">
                            <select class="form-control form exptype select2" name="exptype" style="width: 100%">
                                <option value=""></option>
                                <option <?php
                                if ($get['exptype'] == 'di')
                                    echo "selected=selected";
                                ?> value="di">Direct</option>
                                <!--                                <option <?php
//                                if ($get['exptype'] == 'de')
//                                    echo "selected=selected";
                                ?>value="de">Deemed</option>-->
                                <option
                                <?php
                                if ($get['exptype'] == 'ze')
                                    echo "selected=selected";
                                ?> value="ze">Zero</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">Port Code</label>
                        </div>
                        <div class="col-lg-2 col-md-2 col-sm-1 col-xs-8 pad">
                            <input type="text"  class="form-control form portcode" name="portcode" value="<?php Echo ($addflag != 1) ? $get["portcode"] : ""; ?>" >                            
                        </div>
                        <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 ">
                        </div>
                        <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 ">
                        </div>

                        <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad">
                            <label class="label-control marg">Currency</label>
                        </div>
                        <div class="col-lg-1 col-md-2 col-sm-1 col-xs-8 pad">
                            <select name="curr" class="form form-control currency select2">
                                <option value=""></option>
                                <option <?php
                                if ($get['curr'] == 'R')
                                    echo "selected = selected";
                                ?>value="R">Rupees</option>
                                <option <?php
                                if ($get['curr'] == 'E')
                                    echo "selected = selected";
                                ?>value="E">Euro</option>
                                <option <?php
                                if ($get['curr'] == 'P')
                                    echo "selected = selected";
                                ?>value="P">Pound</option>
                                <option <?php
                                if ($get['curr'] == 'U')
                                    echo "selected = selected";
                                ?>value="U">USD</option>
                            </select>
                        </div>
                        <div class="col-lg-2 col-md-3 col-sm-3 col-xs-3 text-right pad">
                            <label class="label-control marg">R.O.E</label>
                        </div>
                        <div class="col-lg-2 col-md-2 col-sm-1 col-xs-8 pad">
                            <input type="text"  class="form-control form roe" name="roe" value="<?php Echo ($addflag != 1) ? $get["roe"] : "1"; ?>" >                            
                        </div>
                    </div>
                    <table border="0" class="table table-bordered">
                        <tr>
                            <td style ="width:320px;text-align:center;">
                                <label class="">Marks & Nos./Container Nos.</label>
                            </td>
                            <td>
                                <label class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
                            </td>
                            <td style ="width:400px;text-align:center;">
                                <label class="">No. & Kind Of Packages</label>
                            </td>
                            <td>
                                <label class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
                            </td>
                            <td style ="width:500px;text-align:center;">
                                <label class="">Description Of Goods</label>
                            </td>
                        </tr>

                        <tr>
                            <td>
                                <input type="text"  id='marksnos1' name="marksnos1" value="<?php echo ($addflag != 1) ? $get['marksnos1'] : ""; ?>" class="form-control form" />                    
                            </td>
                            <td>
                                <label class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
                            </td>
                            <td>
                                <input type="text"  id='kindpack1' name="kindpack1" value="<?php echo ($addflag != 1) ? $get['kindpack1'] : ""; ?>" class="form-control form" />                    
                            </td>
                            <td>
                                <label class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
                            </td>
                            <td>
                                <input type="text"  id='descgood1' name="descgood1" value="<?php echo ($addflag != 1) ? $get['descgood1'] : ""; ?>" class="form-control form" />                    
                            </td>
                        </tr>

                        <tr>
                            <td>
                                <input type="text"  id='marksnos2' name="marksnos2" value="<?php echo ($addflag != 1) ? $get['marksnos2'] : ""; ?>" class="form-control form" />                    
                            </td>
                            <td>
                                <label class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
                            </td>
                            <td>
                                <input type="text"  id='kindpack2' name="kindpack2" value="<?php echo ($addflag != 1) ? $get['kindpack2'] : ""; ?>" class="form-control form" />                    
                            </td>
                            <td>
                                <label class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
                            </td>
                            <td>
                                <input type="text"  id='descgood2' name="descgood2" value="<?php echo ($addflag != 1) ? $get['descgood2'] : ""; ?>" class="form-control form" />                    
                            </td>
                        </tr>

                        <tr>
                            <td>
                                <input type="text"  id='marksnos3' name="marksnos3" value="<?php echo ($addflag != 1) ? $get['marksnos3'] : ""; ?>" class="form-control form" />                    
                            </td>
                            <td>
                                <label class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
                            </td>
                            <td>
                                <input type="text"  id='kindpack3' name="kindpack3" value="<?php echo ($addflag != 1) ? $get['kindpack3'] : ""; ?>" class="form-control form" />                    
                            </td>
                            <td>
                                <label class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
                            </td>
                            <td>
                                <input type="text"  id='descgood3' name="descgood3" value="<?php echo ($addflag != 1) ? $get['descgood3'] : ""; ?>" class="form-control form" />                    
                            </td>
                        </tr>

                        <tr>
                            <td>
                                <input type="text"  id='marksnos4' name="marksnos4" value="<?php echo ($addflag != 1) ? $get['marksnos4'] : ""; ?>" class="form-control form" />                    
                            </td>
                            <td>

                                <?php
//                                        browse($get['canc_flag']);
                                if ($get['canc_flag'] != '') {
                                    ?>
                                    <img src="images/cancel.jpg" alt="Cancelled Bill" style="width:100%;height:100%">
                                <?php } ?>

                                <!--<label class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>-->
                            </td>
                            <td>
                                <input type="text"  id='kindpack4' name="kindpack4" value="<?php echo ($addflag != 1) ? $get['kindpack4'] : ""; ?>" class="form-control form" />                    
                            </td>
                            <td>
                                <label class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
                            </td>
                            <td>
                                <input type="text"  id='descgood4' name="descgood4" value="<?php echo ($addflag != 1) ? $get['descgood4'] : ""; ?>" class="form-control form" />                    
                            </td>
                        </tr>
                    </table>
                    <br>
                    <br>

                    <table class="table-striped table-condensed table-bordered tab" style="width: 100%">
                        <thead  class="mySearchTr">
                            <tr>
                                <th style="width: 1%"></th>
                                <th style="width: 2%">Sr.</th>
                                <th style="width: 4%;">Barcode</th>
                                <th style="width: 4%;display:none">Item code</th> 
                                <th style="width: 14%;">Product Name</th> 
                                <th style='width: 4%'>Hsncode</th>
                                <th style='width: 4%'>Gram</th>
                                <th style='width: 3%'>Unit</th>
                                <th style='width: 4%' class="text-right">Mrp</th>
                                <th style='width: 3%' class="">Batch</th>
                                <th style='width: 4%' class="">L</th>
                                <th style='width: 4%' class="">B</th>
                                <th style='width: 4%' class="">H</th>
                                <th style='width: 4%' class="">CBM</th>
                                <th style='width: 3%' class="text-right">Dzn.Qty.</th>
                                <th style='width: 4%' class="text-right">Qty.</th>
                                <th style='width: 3%' class="text-right">Rate</th>
                                <th style='width: 5%' class="text-right">Amount</th>
                            </tr>
                        </thead>
                        <tbody class="tbody">
                            <?php
                            if ($addflag != 1) {
                                $qry = mysqli_query($conn, "SELECT * FROM `$trandb` WHERE vouchno='$getvouch' ORDER BY srno") or die(mysqli_error($conn));
                                $ctr = 0;
                                while ($row = mysqli_fetch_array($qry)) {
                                    $gitemname = mysqli_query($conn, "SELECT `code`,`name` FROM `product` WHERE `prodcode`='$row[itemcode]'")or die(mysqli_error($conn));
                                    $fitemname = mysqli_fetch_array($gitemname);

                                    Echo "<tr>";
                                    Echo "<input type='hidden' name='itemcode_$ctr' class='itemcode form-control form' value='$geti[code]'>";
                                    Echo "<td><i class='fa fa-close remove' style='display:none;'></i></td>";
                                    Echo "<td><input type='text' name='srno_$ctr' class='srno form-control  form'  value='$row[srno]'></td>";
                                    Echo "<td>";
                                    Echo "<input type='text' name='barcode_$ctr' class='barcode form-control form' value='$row[barcode]' required>";
                                    Echo "</td>";
                                    Echo "<td style='display:none'>";
                                    Echo "<input type='text' name='itemcode_$ctr' required='true' class='itemcode form-control  form' value='$row[itemcode]' readonly required>";
                                    Echo "</td>";
                                    Echo "<td>";
                                    Echo "<input type='text' name='itemname_$ctr' required='true' class='itemname form-control  form' value='$fitemname[name]' readonly required>";
                                    Echo "</td>";
                                    Echo "<td>";
                                    Echo "<input type='text' name='hsncode_$ctr' required='true' class='hsncode form-control  form' value='$row[hsncode]' readonly required>";
                                    Echo "</td>";
                                    Echo "<td><input type='text' name='gram_$ctr' class='gram form-control  form' value='$row[gram]' readonly></td>";
                                    Echo "<td><input type='text' name='unit_$ctr' class='unit form-control  form' value='$row[unit]' readonly></td>";
                                    Echo "<td><input type='text' name='mrp_$ctr' class='mrp form-control text-right  form' value='$row[mrp]' readonly></td>";
                                    Echo "<td><input type='text' name='batch_$ctr' class='batch form-control   form' value='$row[batch]' ></td>";
                                    Echo "<td><input type='text' name='l_$ctr' class='l form-control   form' value='$row[l]' ></td>";
                                    Echo "<td><input type='text' name='b_$ctr' class='b form-control   form' value='$row[b]' ></td>";
                                    Echo "<td><input type='text' name='h_$ctr' class='h form-control   form' value='$row[h]' ></td>";
                                    Echo "<td><input type='text' name='cbm_$ctr' class='cbm form-control   form' value='$row[cbm]' style='color:red' readonly></td>";
                                    Echo "<td><input type='number' name='dzn_$ctr' class='dzn form-control  text-right form' step='any' value='$row[dzn]' ></td>";
                                    Echo "<td><input type='number' name='qty_$ctr' class='qty form-control  text-right form' step='any' value='$row[qty]' ></td>";
                                    Echo "<td><input type='number' step='any' name='rate_$ctr' class='rate form-control text-right  form'  value='$row[rate]' ></td>";
                                    Echo "<td><input type='number' step='any' name='amount_$ctr' class='amount form-control text-right  form' tabindex='-1' value='$row[amount]' readonly></td>";
                                    Echo "</tr>";
                                    $ctr++;
                                }
                            } else {
                                ?>
                                <tr>                                    
                                    <td><i class='fa fa-close remove'></i></td>
                                    <td><input type='text' name='srno_0' class='srno form-control form' value='1'></td>
                                    <td><input type='text' name='barcode_0' class='barcode  form-control form' value='' required></td> 
                                    <td style='display:none'>
                                        <input type='text' name='itemcode_0' required='true' class='itemcode form-control  form' value='' readonly required>
                                    </td>
                                    <td>
                                        <input type='text' name='itemname_0' required='true' class='itemname form-control  form' value='' readonly required>
                                    </td>
                                    <td>
                                        <input type='text' name='hsncode_0' required='true' class='hsncode form-control  form' value='' readonly required>
                                    </td>
                                    <td><input type='text' name='gram_0' class='gram form-control  form' value='' readonly></td>
                                    <td><input type='text' name='unit_0' class='unit form-control  form' value='' readonly></td>
                                    <td><input type='text' name='mrp_0' class='mrp text-right form-control   form' value='' readonly></td>
                                    <td><input type='text' name='batch_0' class='batch form-control   form' value='' ></td>
                                    <td><input type='text' name='l_0' class='l form-control   form' value='0' ></td>
                                    <td><input type='text' name='b_0' class='b form-control   form' value='' ></td>
                                    <td><input type='text' name='h_0' class='h form-control   form' value='' ></td>
                                    <td><input type='text' name='cbm_0' class='cbm form-control   form' value='0' style="color:red;" readonly></td>
                                    <td><input type='number' name='dzn_0' class='dzn form-control  text-right form' step="any" value='0.00' ></td>
                                    <td><input type='number' name='qty_0' class='qty form-control  text-right form' step="any" value='0.00' ></td>
                                    <td><input type="number" step="any" name='rate_0' class='rate form-control text-right form zero'  value='0' ></td> 
                                    <td><input type="number" step="any" name='amount_0' class='amount text-right form-control form zero' value='0' tabindex='-1' readonly></td> 
                                </tr>
                                <?php
                            }
                            ?>
                        </tbody>
                    </table>
                    <button type="button" class="btn btn-primary btn-square form"  id="addnew">
                        <i class="fa fa-plus" data-toggle='tooltip' title='Add Row'></i>    
                    </button>
                    <input type="hidden" id="items" name="items" value="<?php Echo ($addflag != 1) ? $ctr : 1; ?>">  
                    <input type="hidden" class="mandatoryId" name="manId" value="">  

                    <div class="col-lg-12 col-xs-12 pad">
                        <div class="col-lg-6 col-xs-12 pad">
                            <div class="row">
                                <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                    <label class="label-control ">Terms Of Payment</label>
                                </div>
                                <div class="col-lg-4 col-md-2 col-sm-1 col-xs-8 pad">
                                    <select name="topay" class="form form-control topay select2">
                                        <option value=""></option>
                                        <option <?php
                                        if ($get['topay'] == 'C&F')
                                            echo "selected = selected";
                                        ?>value="C&F">C&F</option>
                                        <option <?php
                                        if ($get['topay'] == 'FOB')
                                            echo "selected = selected";
                                        ?>value="FOB">FOB</option>
                                        <option <?php
                                        if ($get['topay'] == 'CIF')
                                            echo "selected = selected";
                                        ?>value="CIF">CIF</option>
                                    </select>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                    <label class="label-control ">Net Weight</label>
                                </div>
                                <div class="col-lg-4 col-md-2 col-sm-1 col-xs-8 pad">
                                    <input type="text"  class="form-control form netweight" name="netweight" value="<?php Echo ($addflag != 1) ? $get["netweight"] : ""; ?>" >                            
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                    <label class="label-control ">Gross Weight</label>
                                </div>
                                <div class="col-lg-4 col-md-2 col-sm-1 col-xs-8 pad">
                                    <input type="text"  class="form-control form grossweight" name="grossweight" value="<?php Echo ($addflag != 1) ? $get["grossweight"] : ""; ?>" >                            
                                </div>

                            </div>
                            <div class="row">
                                <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                    <label class="label-control ">Total CTNS</label>
                                </div>
                                <div class="col-lg-4 col-md-2 col-sm-1 col-xs-8 pad">
                                    <input type="text"  class="form-control form tctns" name="tctns" value="<?php Echo ($addflag != 1) ? $get["tctns"] : ""; ?>" >                            
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                    <label class="label-control ">Dimension (IN CMS)</label>
                                </div>
                                <div class="col-lg-4 col-md-2 col-sm-1 col-xs-8 pad">
                                    <input type="text"  class="form-control form dimension" name="dimension" value="<?php Echo ($addflag != 1) ? $get["dimension"] : ""; ?>" >                            
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                    <label class="label-control ">BL No.</label>
                                </div>
                                <div class="col-lg-4 col-md-2 col-sm-1 col-xs-8 pad">
                                    <input type="text"  class="form-control form blno" name="blno" value="<?php Echo ($addflag != 1) ? $get["blno"] : ""; ?>" >                            
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                    <label class="label-control ">SB No.</label>
                                </div>
                                <div class="col-lg-4 col-md-2 col-sm-1 col-xs-8 pad">
                                    <input type="text"  class="form-control form sbno" name="sbno" value="<?php Echo ($addflag != 1) ? $get["sbno"] : ""; ?>" >                            
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                    <label class="label-control ">SB Date</label>
                                </div>
                                <div class="col-lg-4 col-md-2 col-sm-1 col-xs-8 pad">
                                    <input type="date"  class="form-control form sbdate" name="sbdate" value="<?php Echo ($addflag != 1) ? $get["sbdate"] : ""; ?>" >                            
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-lg-4 pad">
                                    &nbsp;
                                </div>

                            </div>

                            <div class="row">
                                <div class="col-lg-4 pad" style="width:21.33%">
                                    <?php
                                    if ($addflag != 1) {

                                        echo '<input class="btn btn-primary" type="button" id="ssubmit" name="printt" value="Packing List Print" onclick="window.open(\'packlstinv_prin.php?vouchno=' . $getvouch . '\',\'popUpWindow\',\'height=800,width=950,left=100,top=100,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no, status=yes\');" style="width:130px;"/>';
                                    }
                                    ?>
                                </div>
                                <div class="col-lg-4 pad" style="width:21.33%">
                                    <?php
                                    if ($addflag != 1) {

                                        echo '<input class="btn btn-primary" type="button" id="submit" name="print" value="Custom Invoice" onclick="window.open(\'custinv_prin.php?vouchno=' . $getvouch . '\',\'popUpWindow\',\'height=800,width=950,left=100,top=100,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no, status=yes\');" style="width:130px;"/>';
                                    }
                                    ?>
                                </div>
                                <div class="col-lg-4 pad" style="width:21.33%">
                                    <?php
                                    if ($addflag != 1) {

                                        echo '<input class="btn btn-primary" type="button" id="submit" name="print" value="Tax Invoice" onclick="window.open(\'taxinvexp_prin.php?vouchno=' . $getvouch . '\',\'popUpWindow\',\'height=800,width=950,left=100,top=100,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no, status=yes\');" style="width:130px;"/>';
                                    }
                                    ?>
                                </div>
                            </div>

                        </div>
                        <div class="col-lg-6 col-xs-12 pad">
                            <div class="col-lg-12 col-xs-12 pad">

                            </div>
                            <div class="col-lg-12 col-xs-12 pad">
                                <div class="col-lg-4 pad text-right">Total CBM</div>
                                <div class="col-lg-2 pad">
                                    <input type="number" step="any" name="totcbm" class="form-control form text-right totcbm" value="<?php Echo ($addflag != 1) ? $get['totcbm'] : "0"; ?>" readonly tabindex="-1">

                                </div>
                                <!--<div class="col-lg-1 pad"></div>-->
                                <div class="col-lg-3 pad text-right">
                                    <label class="label-control marg">Subtotal</label>
                                </div>
                                <div class="col-lg-3 pad">
                                    <input type="number" step="any" name="grossamt" class="form-control form text-right grossamt" value="<?php Echo ($addflag != 1) ? $get['grossamt'] : "0"; ?>" readonly tabindex="-1">
                                </div>
                            </div>
                            <!--                            <div class="col-lg-12 col-xs-12 pad">
                                                            <div class="col-lg-9 pad text-right">
                                                                <label class="label-control marg">Disc. Amount</label>
                                                            </div>
                                                            <div class="col-lg-3 pad">
                                                                <input type="number" step="any" name="totdiscamt" class="form-control form text-right totdiscamt" value="<?php Echo ($addflag != 1) ? $get['discount'] : "0"; ?>">
                                                            </div>
                                                        </div>-->
                            <div class="col-lg-12 col-xs-12 pad">
                                <div class="col-lg-12 col-xs-12 pad">
                                    <div class="col-lg-3 pad"></div>
                                    <div class="col-lg-3 pad"></div>
                                    <div class="col-lg-3 pad text-right">
                                        <label class="label-control marg">Taxable Value</label>
                                    </div>
                                    <div class="col-lg-3 pad">
                                        <input type="number" step="any" name="taxableamt" class="form-control form text-right taxableamt" value="<?php Echo ($addflag != 1) ? $get['taxableamt'] : "0"; ?>">
                                    </div>
                                </div>
                                <div class="col-lg-12 col-xs-12 pad">
                                    <div class="col-lg-3 pad"></div>
                                    <div class="col-lg-3 pad"></div>
                                    <div class="col-lg-3 pad text-right">
                                        <label class="label-control marg">Discount</label>
                                    </div>
                                    <div class="col-lg-3 pad">
                                        <input type="number" step="any" name="discamt" class="form-control form text-right mdiscamt" value="<?php Echo ($addflag != 1) ? $get['discamt'] : "0"; ?>">
                                    </div>
                                </div>
                                <!--                                <div class="col-lg-12 col-xs-12 pad">
                                                                    <div class="col-lg-3 pad"></div>
                                                                    <div class="col-lg-3 pad text-right">IGST Rate</div>
                                                                    <div class="col-lg-1 pad">-->
                                <input type="text" style="display: none" step="any" name="igstrate" class="form-control form text-right igstrate" value="<?php Echo ($addflag != 1) ? $get['igstrate'] : "0"; ?>">
                                <!--                                    </div>
                                
                                                                    <div class="col-lg-2 pad text-right">
                                                                        <label class="label-control marg">IGST Amount</label>
                                                                    </div>
                                                                    <div class="col-lg-3 pad">-->
                                <input type="text" style="display: none" step="any" name="igstamt" class="form-control form text-right igstamt" value="<?php Echo ($addflag != 1) ? $get['igstamt'] : "0"; ?>" readonly>
                                <!--                                    </div>
                                                                </div>-->
                                <div class="col-lg-12 col-xs-12 pad">
                                    <div class="col-lg-3 pad"></div>
                                    <div class="col-lg-3 pad"></div>
                                    <div class="col-lg-3 pad text-right">
                                        <label class="label-control marg">Net Amount</label>
                                    </div>
                                    <div class="col-lg-3 pad">
                                        <input type="number" step="any" name="totbillamt" required="true" class="form-control form text-right totbillamt" value="<?php Echo ($addflag != 1) ? $get['billamt'] : "0"; ?>" readonly tabindex="-1">
                                    </div>
                                </div>
                                <div class="col-lg-12 col-xs-12 pad">
                                    <div class="col-lg-3 pad"></div>
                                    <div class="col-lg-3 pad"></div>
                                    <div class="col-lg-3 pad text-right">
                                        <label class="label-control marg" style="color: red">INR Amount</label>
                                    </div>
                                    <div class="col-lg-3 pad">
                                        <input type="number" step="any" name="inramt" style="color: red" required="true" class="form-control form text-right inramt" value="<?php Echo ($addflag != 1) ? $get['inramt'] : "0"; ?>" readonly tabindex="-1">
                                    </div>
                                </div>




                            </div>

                        </div>
                    </div>
                </div>
                <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 pad">
                    <div class="panel panel-default">
                        <div class="panel-body">
                            <?php include("includes/buttsale.php"); ?>
                        </div>
                    </div>
                </div>
            </div>
    </form>
    <div class="modal fade" id="cancmodel" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="col-lg-11">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title" id="myModalLabel">Cancel Bill</h4>
                    </div>
                    <div class="modal-body">
                        <div class="row">
                            <div class="col-lg-12 upload">
                                <form id="upload_form" method="post">

                                    <div class="row pad">
                                        <input type="hidden" name="cancvouch" id="cancvouch" value='<?php Echo ($addflag != 1) ? $get['vouchno'] : "$qvouch"; ?>'>
                                        <input type="hidden" name="cashvouch2" id="cashvouch2" value='<?php Echo ($addflag != 1) ? $get['cashvouch'] : ""; ?>'>
                                        <div class="col-lg-4 col-md-4 col-sm-4 col-xs-5 text-right">
                                            <label class="label-control marg">Cancel Date</label>
                                        </div>
                                        <div class="col-lg-4 col-md-4 col-sm-6 col-xs-7">

                                            <input type="date" name="cancdate" value="<?php Echo ($addflag != 1) ? $get['cancdate'] : ""; ?>" class="form-control cancdate">
                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="col-lg-6 col-md-6 col-sm-7 col-xs-8 text-right">
                                            <input type="submit" value="Cancel"  name="cancbtn" class="btn btn-square" style="background-color: #C0CA33; color: white">
                                        </div>
                                    </div>

                                </form>
                            </div>

                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="modal fade itemModal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" style="top: 15%">
        <div class="modal-dialog modal-lg">
            <div class="modal-content">
                <div class="modal-header">
                    <button class="close" data-dismiss="modal"><span>&times;</span></button>
                    <h4 class="modal-title" id="myLargeModalLabel">Search <? Echo $formname; ?></h4>
                </div>
                <div class="modal-body">
                    <input type="hidden" value="<?php // Echo $fseries                                                                                            ?>" class="form-control series">
                    <input type="hidden" value="<?php Echo $get['vouchno']; ?>" class="form-control vouchno">
                    <input type="hidden" value="<?php Echo $file ?>" class="form-control file">
                    <input type="hidden" value="<?php Echo $para ?>" class="form-control para">
                    <div class="row">
                        <div class="col-lg-3">
                            <select class="form-control ifield">
                                <option value="1">Name</option>
                                <option value="2">Barcode</option>
                                <option value="3">Itemcode</option>
                                <option value="4">Gram</option>
                                <option value="5">Unit</option>
                            </select>
                        </div>
                        <div class="col-lg-2">
                            <select class="form-control ioperator">
                                <option value=""></option>
                                <option value="%">Like</option>
                                <option value="=">Exactly</option>
                            </select>
                        </div>
                        <div class="col-lg-4">
                            <input type="text" value="" class="form-control isearch">
                        </div>
                        <div class="col-lg-3">
                            <input type="button" class="btn btn-primary iload" value="Search">
                        </div>
                    </div>

                    <div class="col-lg-12 iloader text-center">
                        <img src="images/search.gif" alt="loading">       
                    </div>
                    <div class="col-lg-12 inoRecord text-center">
                        <h3>NO RECORDS FOUND</h3>
                    </div>
                    <div class="table-responsive" style="max-height: 400px;overflow: auto;">
                        <table id="" class="table table-striped table-condensed table-bordered" width="100%">
                            <thead>
                                <tr class="mySearchTr">
                                    <th width="20%">Name</th>
                                    <th width="20%">Barcode</th>
                                    <th width="15%">Itemcode</th>
                                    <th width="15%">Gram</th>
                                    <th width="10%">Unit</th>
                                    <th width="10%">Rate</th>
                                </tr>
                            </thead>
                            <tbody class="iTbody">
                            </tbody>
                        </table>
                    </div>
                    <div class="row">
                        <div class="col-xs-12 text-right search-action-bar">
                            <input type="button"  class="btn btn-primary iprevious" value="Previous">
                            <input type="button"  class="btn btn-primary inext" value="Next">
                        </div>
                    </div>
                </div>
                <div class="modal-footer"></div>
            </div>
        </div>
    </div>
    <div class="modal fade searchModal bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
        <div class="modal-dialog modal-lg" style="margin-top: 15%">
            <div class="modal-content">
                <div class="modal-header">
                    <button class="close" data-dismiss="modal"><span>&times;</span></button>
                    <h4 class="modal-title" id="myLargeModalLabel">Search <? Echo $formname; ?></h4>
                </div>
                <div class="modal-body">
                    <input type="hidden" value="<?php Echo $fseries ?>" class="form-control series">
                    <input type="hidden" value="<?php Echo $get['vouchno']; ?>" class="form-control vouchno">
                    <input type="hidden" value="<?php Echo $file ?>" class="form-control file">
                    <input type="hidden" value="<?php Echo $para ?>" class="form-control para">
                    <div class="row">
                        <div class="col-lg-2">
                            <select class="form-control sfield">
                                <option value="1">Voucher</option>
                                <option value="2">Consignee</option>
                                <option value="3">Owner</option>
                                <option value="4">Party</option>
                                <option value="5">Godown</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="1">Voucher</option>
                                <option value="2">Consignee</option>
                                <option value="3">Owner</option>
                                <option value="4">Party</option>
                                <option value="5">Godown</option>
                            </select>
                        </div>
                        <div class="col-lg-2">
                            <select class="form-control orderAs">
                                <option value="desc">Desc</option>
                                <option value="asc">Asc</option>
                            </select>
                        </div>
                        <div class="col-lg-2">
                            <input type="text" value="" class="form-control ssearch" placeholder="Search Here">
                        </div>
                        <div class="col-lg-2">
                            <input type="button" class="btn btn-primary sload" value="Search" >
                        </div>
                    </div>

                    <div class="col-lg-12 sloader text-center">
                        <img src="images/search.gif" alt="loading">       
                    </div>
                    <div class="col-lg-12 snoRecord text-center">
                        <h3>NO RECORDS FOUND</h3>
                    </div>
                    <div class="table-responsive" style="max-height: 400px;overflow: auto;">
                        <table id="" class="table table-striped table-condensed table-bordered" width="100%">
                            <thead>
                                <tr class="mySearchTr">
                                    <th width="15%">Voucher</th>
                                    <th width="20%">Consignee</th>
                                    <th width="20%">Owner</th>
                                    <th width="20%">Party</th>
                                    <th width="13%">Godown</th>
                                    <th width="12%">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 sprevious" 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>
