<?php

$searchdisabled = '';
$adddisabled = '';
$editdisabled = '';
$savedisabled = '';
$deletedisabled = '';
$exitdisabled = '';
$printdisabled = '';
$canceldisabled = '';
$pdisabled = '';
$ndisabled = '';

if (isset($_GET["mode"])) {
    $mode = $_GET["mode"];

    if ($mode == "true") {
        $addflag = 1;
        $result = mysql_query("SELECT vouchdt FROM `attend` ORDER BY vouchdt DESC LIMIT 0,1") or die(mysql_error());
        $get = mysql_fetch_array($result);
        $qvouch = $get['vouchdt'];
        $flag = "Add";

        /* Disabling buttons */

        $searchdisabled = 'none';
        $adddisabled = 'none';
        $editdisabled = 'none';
        $deletedisabled = 'none';
        $exitdisabled = 'none';
        $printdisabled = 'none';
        $pdisabled = 'none';
        $ndisabled = 'none';
        /* End Disabling buttons */
    } elseif ($mode == "last") {
        $addflag = 2;
        $mgetlastrec = mysql_query("SELECT * FROM `$maindb` WHERE $keyfld !='' $keycond ORDER BY $keyfld DESC LIMIT 0,1") or die(mysql_error());
        $mgetvouchno = mysql_fetch_array($mgetlastrec);

        if ($trandbexist == 1) {
            $tgetlastrec = mysql_query("SELECT * FROM `$trandb` ORDER BY $keyfld DESC LIMIT 0,1") or die(mysql_error());
            $lgetvouchno = mysql_fetch_array($tgetlastrec);
            $getvouch = $lgetvouchno["$keyfld"];
        }
        $qvouch = $mgetvouchno["$keyfld"];

        /* Disabling buttons */
        $savedisabled = 'none';
        $canceldisabled = 'none';
        /* End Disabling buttons */
    } elseif ($mode === "edit") {
        $addflag = 0;
        $qvouch = $_GET[$keyfld];
        $flag = "Edit";
        $savedisabled = 'none';
        $canceldisabled = 'none';
//        $pdisabled ='none';
//        $ndisabled ='none';
        /* End Disabling buttons */
    }
}
if (isset($_GET["delete"])) {
    $qvouch = $_GET[$keyfld];
}
?>



