function showMdlCol()
{
    $year = null;
    $month = null;
    $day = null;
    $fullDay = strtEndDateMonthDiff();
    $today = $fullDay[0];
    $dateArr = explode("-", $today);
    $curyear = $dateArr[0];
    $curmonth = $dateArr[1];
    $curday = $dateArr[2];
    $year = $curyear;
    $month = $curmonth;
    $resultCaseReport = mysql_query("select casereportid, casedate from casereport");
    while ($rowCaseReport = mysql_fetch_array($resultCaseReport)) {
        $id = $rowCaseReport['casereportid'];
        $caseDate = explode("-", $rowCaseReport['casedate']);
        if (strtotime($rowCaseReport['casedate']) < strtotime($today)) {
            if ($curday < $caseDate[2]) {
                $day = $caseDate[2] + 1;
            } else {
                $day = $curday;
            }
            $updatedate = $year . '-' . $month . '-' . $day;
            $day = null;
            mysql_query("update casereport set casedate = '" . $updatedate . "' where casereportid='" . $id . "' ") or die(mysql_error());
        }
    }
    $resultBulkReport = mysql_query("select createdon,bulkcaseid from bulkcase");
    while ($rowBulkReport = mysql_fetch_array($resultBulkReport)) {
        $id = $rowBulkReport['bulkcaseid'];
        $caseDate = explode("-", $rowBulkReport['createdon']);
        if (strtotime($rowBulkReport['createdon']) < strtotime($today)) {
            if ($curday < $caseDate[2]) {
                $day = $caseDate[2] + 1;
            } else {
                $day = $curday;
            }
            $updatedate = $year . '-' . $month . '-' . $day;
            $day = null;
            mysql_query("update bulkcase set createdon = '" . $updatedate . "' where bulkcaseid='" . $id . "' ") or die(mysql_error());
        }
    }
    echo 'Date successfully updated';
}
/* districtkml file create */
$kml = array('<?xml version="1.0" encoding="UTF-8"?>');
$kml[] = '<kml xmlns="http://earth.google.com/kml/2.1">';
$kml[] = ' <Document>';
$kml[] = '<name>MLB.kml</name>';
$kml[] = ' <Style id="downArrowIcon">';
$kml[] = ' <IconStyle>';
$kml[] = ' <Icon>';
$kml[] = '<href>http://www.zyxware.com/projects/healthmonitor/images/districticon.png</href>';
$kml[] = ' </Icon>';
$kml[] = ' </IconStyle>';
$kml[] = ' </Style>';
$kml[] = '<Folder>';
$kml[] = '<name>MLB</name>';
/* find the start and end date */
list($startDate, $endDate) = strtEndDateMonthDiff();
$kmlData = '';
$resultDistrict = mysql_query("SELECT * FROM district");
while ($rowDistrict = mysql_fetch_array($resultDistrict)) {
    $districtName = $rowDistrict['name'];
    $kmlData .= '<Placemark>';
    $kmlData .= '<description><![CDATA[<table style="border:thin solid #000000;font-size:10px;
                                      width:175px;background-color:#E9E9DA">
                                    <tr>
                                      <th colspan="3"style="border:thin solid #000000;">' . $districtName . '
                                      </th>
                                    </tr>
                                      <th style="border:thin solid #000000;">
                                        Disease
                                      </th>
                                      <th style="border:thin solid #000000;">
function displayContent($authorise, $val)
{
    $userName = $_SESSION['userName'];
    $strContent = '<h3>List Bulk Case Report</h3>';
    $choice = 0;
    $result = null;
    switch ($val) {
        case "1":
            if (isset($_GET['Datestart'])) {
                $startdate = getDateToDb($_GET['Datestart']);
                $enddate = getDateToDb($_GET['Dateclose']);
            } else {
                $arrDate = strtEndDateMonthDiff();
                $startdate = $arrDate[0];
                $enddate = $arrDate[1];
            }
            $filterVal = "createdon between '" . $startdate . "' and '" . $enddate . "' ";
            $choice = 1;
            $strContent .= '<h4>Case Reported between ' . getDateFromDb($startdate) . ' 
				and ' . getDateFromDb($enddate) . '</h4>';
            break;
        case "2":
            $disease = $_GET['cmpDiseaseList'];
            $filterVal = "bulkcase.diseaseid='" . $disease . "' ";
            $choice = 2;
            $resultDis = mysql_query("SELECT name FROM disease where \n\t\t\t\tdiseaseid='" . $disease . "'  ") or die(mysql_error());
            $row = mysql_fetch_array($resultDis);
            $strContent .= '<h4>Case Report of ' . $row['name'] . '</h4>';
            break;
        case "3":
            $district = $_GET['cmpDistrictList'];
            $filterVal = "bulkcase.districtid='" . $district . "' ";
            $choice = 3;
            $resultDist = mysql_query("SELECT name FROM district where \n\t\t\t\tdistrictid='" . $district . "'  ") or die(mysql_error());
            $row = mysql_fetch_array($resultDist);
            $strContent .= '<h4>Case Report of ' . $row['name'] . '</h4>';
            break;
        default:
            $arrDate = strtEndDateMonthDiff();
            $startdate = $arrDate[0];
            $enddate = $arrDate[1];
            $filterVal = " reportedon between '" . $startdate . "' and '" . $enddate . "' ";
            $choice = 1;
            $strContent .= '<h4>Case Reported between ' . $startdate . ' and ' . $enddate . '</h4>';
            break;
    }
    if ($authorise == "GMO") {
        $userName = $_SESSION['userName'];
        $resultGmo = mysql_query("SELECT districtid FROM gmo where username='******'  ") or die(mysql_error());
        $rowGmo = mysql_fetch_array($resultGmo);
        $districtid = $rowGmo['districtid'];
        $result = mysql_query("SELECT bulkcaseid, disease.name as diseasename, district.name as \n\t\t\tdistname, reportedcase, fatalcase, createdon\n\t\t\tFROM bulkcase \n\t\t\tLEFT JOIN disease on bulkcase.diseaseid=disease.diseaseid \n\t\t\tLEFT JOIN district on bulkcase.districtid=district.districtid \n\t\t\tLEFT JOIN gmo on bulkcase.districtid=gmo.districtid \n\t\t\tWHERE gmo.districtid='" . $districtid . "' and " . $filterVal . " ") or die(mysql_error());
        $paginationQuery = "SELECT bulkcaseid, disease.name as diseasename, district.name as \n\t\t\tdistname, reportedcase, fatalcase, createdon\n\t\t\tFROM bulkcase \n\t\t\tLEFT JOIN disease on bulkcase.diseaseid=disease.diseaseid \n\t\t\tLEFT JOIN district on bulkcase.districtid=district.districtid \n\t\t\tWHERE bulkcase.districtid='" . $districtid . "' and " . $filterVal;
    } else {
        if ($authorise == "DAO") {
            $resultDao = mysql_query("SELECT districtid FROM dao where username='******' ");
            $rowDao = mysql_fetch_array($resultDao);
            $districtid = $rowDao['districtid'];
            $result = mysql_query("SELECT bulkcaseid, disease.name as diseasename, district.name as \n\t\t\tdistname, reportedcase, fatalcase, createdon\n\t\t\tFROM bulkcase \n\t\t\tLEFT JOIN disease on bulkcase.diseaseid=disease.diseaseid\n\t\t\tLEFT JOIN district on bulkcase.districtid=district.districtid \n\t\t\tWHERE bulkcase.districtid='" . $districtid . "' and " . $filterVal . "") or die(mysql_error());
            $paginationQuery = "SELECT bulkcaseid, disease.name as diseasename, district.name as \n\t\t\tdistname, reportedcase, fatalcase, createdon\n\t\t\tFROM bulkcase \n\t\t\tLEFT JOIN disease on bulkcase.diseaseid=disease.diseaseid\n\t\t\tLEFT JOIN district on bulkcase.districtid=district.districtid \n\t\t\tWHERE bulkcase.districtid='" . $districtid . "' and  " . $filterVal;
        } else {
            if ($authorise == "ADMIN") {
                $result = mysql_query("SELECT  bulkcaseid, disease.name as diseasename, district.name as \n\t\t\tdistname, reportedcase, fatalcase, createdon\n\t\t\tFROM bulkcase \n\t\t\tLEFT JOIN disease on bulkcase.diseaseid=disease.diseaseid\n\t\t\tLEFT JOIN district on bulkcase.districtid=district.districtid\n\t\t\tWHERE 1=1 and " . $filterVal . " ") or die(mysql_error());
                $paginationQuery = "SELECT  bulkcaseid, disease.name as diseasename, district.name as \n\t\t\tdistname, reportedcase, fatalcase, createdon\n\t\t\tFROM bulkcase \n\t\t\tLEFT JOIN disease on bulkcase.diseaseid=disease.diseaseid\n\t\t\tLEFT JOIN district on bulkcase.districtid=district.districtid\n\t\t\tWHERE 1=1 and " . $filterVal;
            } else {
            }
        }
    }
    $intResultNum = mysql_num_rows($result);
    if ($intResultNum > 0) {
        list($result, $classObj, $dispyListInfo) = classPagination($paginationQuery, $intResultNum);
        $listData = listCaseReport($authorise, $intResultNum, $result);
        $strContent .= $listData;
        $strContent .= '<br /><br />';
        $strContent .= $dispyListInfo . '<br />';
        $strContent .= $classObj->navigationBar();
    } else {
        $strContent .= "No data is stored in the database or you are not authorised to view this data";
    }
    return $strContent;
}
function showContent($authorise, $selectedText, $option)
{
    $strContent = "";
    $choice = 0;
    $dte1 = "";
    $dte2 = "";
    $curDate = "";
    $event = "";
    switch ($option) {
        case "1":
            $year = $_GET['MYear'];
            $dte1 = $year . "-" . $selectedText . "-" . "01";
            $dte2 = $year . "-" . $selectedText . "-" . "31";
            $filterval = "eventtime between '" . $dte1 . "' and '" . $dte2 . "' ";
            $choice = 1;
            break;
        case "2":
            $curDate = date("d.m.Y");
            $arrDate = explode(".", $curDate);
            $dte1 = $selectedText . "-01-01";
            $dte2 = $selectedText . "-12-31";
            $filterval = "eventtime between '" . $dte1 . "' and '" . $dte2 . "' ";
            $choice = 2;
            break;
        case "3":
            if (isset($_GET['Datestart'])) {
                $startdate = getDateToDb($_GET['Datestart']);
                $enddate = getDateToDb($_GET['Dateclose']);
            } else {
                $arrDate = strtEndDateMonthDiff();
                $startdate = $arrDate[0];
                $enddate = $arrDate[1];
            }
            $filterval = "eventtime between '" . $startdate . "' and '" . $enddate . "' ";
            $choice = 3;
            break;
        case "4":
            $filterval = "event like '%" . $selectedText . "' ";
            $choice = 4;
            break;
        default:
            break;
    }
    $result = mysql_query("select * from eventlog where 1=1  and " . $filterval . " ") or die(mysql_error());
    $paginationQuery = "select * from eventlog where 1=1  and " . $filterval;
    $intCount = mysql_num_rows($result);
    if ($intCount > 0) {
        if ($choice == 1) {
            echo '<h4>Report on ' . getMonth($selectedText) . ' ' . $_GET['MYear'] . '</h4><br>';
        } else {
            if ($choice == 2) {
                echo '<h4>Report For The Year ' . $selectedText . '</h4><br>';
            } else {
                if ($choice == 3) {
                    if (isset($_GET['Datestart'])) {
                        echo '<h4>Report on ' . $_GET['Datestart'] . ' and ' . $_GET['Dateclose'] . '</h4><br>';
                    } else {
                        echo '<h4>Report on ' . getDateFromDb($startdate) . ' and ' . getDateFromDb($enddate) . '</h4><br>';
                    }
                } else {
                    echo '<h4>Report on  ' . $selectedText . '</h4><br>';
                }
            }
        }
        /* function for pagination */
        list($result, $classObj, $dispyListInfo) = classPagination($paginationQuery, $intCount);
        $listData = listEvent($authorise, $intCount, $result);
        $strContent .= $listData;
        $strContent .= '<br /><br />';
        $strContent .= $dispyListInfo . '<br />';
        $strContent .= $classObj->navigationBar();
    } else {
        $strContent .= "No data is stored in the database or you are not authorised to view this data";
    }
    echo $strContent;
}
function displayContent($authorise, $val)
{
    $userName = $_SESSION['userName'];
    $strContent = '<h3>List Case Report</h3>';
    $choice = 0;
    $result = null;
    switch ($val) {
        case "1":
            if (isset($_GET['Datestart'])) {
                $startdate = getDateToDb($_GET['Datestart']);
                $enddate = getDateToDb($_GET['Dateclose']);
            } else {
                $arrDate = strtEndDateMonthDiff();
                $startdate = $arrDate[0];
                $enddate = $arrDate[1];
            }
            $filterVal = "reportedon between '" . $startdate . "' and '" . $enddate . "' ";
            $choice = 1;
            $strContent .= '<h4>Case Reported between ' . getDateFromDb($startdate) . ' 
				and ' . getDateFromDb($enddate) . '</h4>';
            break;
        case "2":
            $disease = $_GET['cmpDiseaseList'];
            $filterVal = "casereport.diseaseid='" . $disease . "' ";
            $choice = 2;
            $resultDis = mysql_query("SELECT name FROM disease where \n\t\t\t\tdiseaseid='" . $disease . "'  ") or die(mysql_error());
            $row = mysql_fetch_array($resultDis);
            $strContent .= '<h4>Case Report of ' . $row['name'] . '</h4>';
            break;
        case "3":
            $district = $_GET['cmpDistrictList'];
            $filterVal = "casereport.districtid='" . $district . "' ";
            $choice = 3;
            $resultDist = mysql_query("SELECT name FROM district where \n\t\t\t\tdistrictid='" . $district . "'  ") or die(mysql_error());
            $row = mysql_fetch_array($resultDist);
            $strContent .= '<h4>Case Report of ' . $row['name'] . '</h4>';
            break;
        case "4":
            $age = explode("-", $_GET['cmpAgeList']);
            $agest = $age[0];
            $ageend = $age[1];
            $filterVal = "age between '" . $agest . "' and '" . $ageend . "' ";
            $choice = 4;
            $strContent .= '<h4>Case Reported on age, between ' . $agest . ' and ' . $ageend . '</h4>';
            break;
        case "5":
            $hospital = $_GET['cmpHospitalList'];
            $filterVal = "casereport.hospitalid='" . $hospital . "' ";
            $choice = 5;
            $resultHos = mysql_query("SELECT name FROM hospital where \n\t\t\t\thospitalid='" . $hospital . "'  ") or die(mysql_error());
            $row = mysql_fetch_array($resultHos);
            $strContent .= '<h4>Case Report of ' . $row['name'] . '</h4>';
            break;
        default:
            $arrDate = strtEndDateMonthDiff();
            $startdate = $arrDate[0];
            $enddate = $arrDate[1];
            $filterVal = " reportedon between '" . $startdate . "' and '" . $enddate . "' ";
            $choice = 1;
            $strContent .= '<h4>Case Reported between ' . $startdate . ' and ' . $enddate . '</h4>';
            break;
    }
    if ($authorise == "GMO") {
        $resultGmo = mysql_query("SELECT districtid FROM gmo where username='******'  ") or die(mysql_error());
        $rowGmo = mysql_fetch_array($resultGmo);
        $districtid = $rowGmo['districtid'];
        $result = mysql_query("SELECT casereportid, casereport.name as pname, age, sex, \n\t\t\tdisease.name as dname, hospital.name as hname, casedate FROM casereport \n\t\t\tLEFT JOIN hospital on casereport.hospitalid=hospital.hospitalid\n\t\t\tLEFT JOIN disease on casereport.diseaseid=disease.diseaseid \n\t\t\tWHERE casereport.districtid='" . $districtid . "' and " . $filterVal . "") or die(mysql_error());
        $paginationQuery = "SELECT casereportid, casereport.name as pname, age, sex, \n\t\t\t\t\t\t\t\t\t\t\tdisease.name as dname, hospital.name as hname, casedate FROM casereport \n\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN hospital on casereport.hospitalid=hospital.hospitalid\n\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN disease on casereport.diseaseid=disease.diseaseid \n\t\t\t\t\t\t\t\t\t\t\tWHERE casereport.districtid='" . $districtid . "' and " . $filterVal;
    } else {
        if ($authorise == "DAO") {
            $resultDao = mysql_query("SELECT districtid FROM dao where username='******' ");
            $rowDao = mysql_fetch_array($resultDao);
            $districtid = $rowDao['districtid'];
            $result = mysql_query("SELECT casereportid, casereport.name as pname, age, sex, \n\t\t\tdisease.name as dname, hospital.name as hname, casedate FROM casereport \n\t\t\tLEFT JOIN hospital on casereport.hospitalid=hospital.hospitalid\n\t\t\tLEFT JOIN disease on casereport.diseaseid=disease.diseaseid \n\t\t\tWHERE casereport.districtid='" . $districtid . "' and " . $filterVal . "") or die(mysql_error());
            $paginationQuery = "SELECT casereportid, casereport.name as pname, age, sex, \n\t\t\t\t\t\t\t\t\t\t\tdisease.name as dname, hospital.name as hname, casedate FROM casereport \n\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN hospital on casereport.hospitalid=hospital.hospitalid\n\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN disease on casereport.diseaseid=disease.diseaseid \n\t\t\t\t\t\t\t\t\t\t\tWHERE casereport.districtid='" . $districtid . "' and " . $filterVal;
        } else {
            if ($authorise == "HOSPITAL") {
                $resultHos = mysql_query("SELECT hospitalid FROM hospital where username='******' ");
                $rowHos = mysql_fetch_array($resultHos);
                $hosId = $rowHos['hospitalid'];
                $result = mysql_query("SELECT casereportid, casereport.name as pname, age, sex, \n\t\t\tdisease.name as dname,hospital.name as hname, casedate FROM casereport \n\t\t\tLEFT JOIN hospital on casereport.hospitalid=hospital.hospitalid\n\t\t\tLEFT JOIN disease on casereport.diseaseid=disease.diseaseid \n\t\t\tWHERE casereport.hospitalid='" . $hosId . "' and " . $filterVal . " ") or die(mysql_error());
                $paginationQuery = "SELECT casereportid, casereport.name as pname, age, sex, \n\t\t\tdisease.name as dname,hospital.name as hname, casedate FROM casereport \n\t\t\tLEFT JOIN hospital on casereport.hospitalid=hospital.hospitalid\n\t\t\tLEFT JOIN disease on casereport.diseaseid=disease.diseaseid \n\t\t\tWHERE casereport.hospitalid='" . $hosId . "' and " . $filterVal;
            } else {
                if ($authorise == "ADMIN") {
                    $result = mysql_query("SELECT casereportid, casereport.name as pname, age, sex, \n\t\t\tdisease.name as dname, hospital.name as hname, casedate FROM casereport \n\t\t\tLEFT JOIN hospital on casereport.hospitalid=hospital.hospitalid\n\t\t\tLEFT JOIN disease on casereport.diseaseid=disease.diseaseid \n\t\t\tWHERE " . $filterVal . " ") or die(mysql_error());
                    $paginationQuery = "SELECT casereportid, casereport.name as pname, age, sex, \n\t\t\t\t\t\t\t\t\t\t\tdisease.name as dname, hospital.name as hname, casedate FROM casereport \n\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN hospital on casereport.hospitalid=hospital.hospitalid\n\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN disease on casereport.diseaseid=disease.diseaseid \n\t\t\t\t\t\t\t\t\t\t\tWHERE " . $filterVal;
                } else {
                }
            }
        }
    }
    $intResultNum = mysql_num_rows($result);
    if ($intResultNum > 0) {
        /* function for pagination */
        list($result, $classObj, $dispyListInfo) = classPagination($paginationQuery, $intResultNum);
        $listData = listCaseReport($authorise, $intResultNum, $result);
        $strContent .= $listData;
        $strContent .= '<br /><br />';
        $strContent .= $dispyListInfo . '<br />';
        $strContent .= $classObj->navigationBar();
    } else {
        $strContent .= "No data is stored in the database or you are not authorised to view this data";
    }
    return $strContent;
}