#!/usr/bin/perl use DBI ; use CGI qw(:standard); use CGI::Carp qw(warningsToBrowsers fatalsToBrowser); my($username) = "someuser"; my($password) = "knownuser"; my($dbh) = DBI->connect ("DBI:mysql:hf", $username , $password); my($empName) = param("empName"); my($year) = param("year"); my($mon) = param("mon"); my($count) = 0; my($sth , @arr); DBI -> trace(4 , 'dbitrace'); if($year && $mon) { # 1 my($empName) = param("empName"); my($year) = param("year"); my($mon) = param("mon"); if($empName) { #2 my($sth) = $dbh->prepare("select * from jobStat where cdate> '$year$mon00' AND cdate<'$year($mon++)00' AND empName='$empNAme'"); $sth->execute(); @arr = $sth->fetchrow_array() if(defined@arr) { #3 while(@arr=$sth->fetchrow_array()) { #4 $count++; } #4' print < Job Status Display Page
Current Date Name Job Allocated Allocation Date Target Date Job Under Execution Job Pending Remark
end_of_html while(@arr=$sth->fetchrow_array()) { #5 print <
$arr[5] $arr[8] $arr[1] $arr[6] $arr[7] $arr[2] $arr[3] $arr[4]
end_of_html } # 5' end of while(@arr=$sth->fetchrow_array()) } # 3' end of if(defined@arr) else { #6 print < Job Status Display Page No Record found for $empName for the given dates.

Back end_of_html } #6' end of else for if(defined@arr) } #2' if $empName has a value else #7 if empName is null , process the query for year and month { my($sth) = $dbh->prepare("select * from jobStat where cdate> '$year$mon00' AND cdate<'$year($mon++)00'"); $sth->execute(); @arr = $sth->fetchrow_array() if(defined@arr) { #8 while(@arr=$sth->fetchrow_array()) { #9 $count++; } #9' print < Job Status Display Page
Current Date Name Job Allocated Allocation Date Target Date Job Under Execution Job Pending Remark
end_of_html while(@arr=$sth->fetchrow_array()) { #10 # 1) id 2) ja 3) je 4)jp 5) remark 6) cdate 7) adate 8) tdate 9) empName print <
$arr[5] $arr[8] $arr[1] $arr[6] $arr[7] $arr[2] $arr[3] $arr[4]
end_of_html } #10' end of while(@arr=$sth->fetchrow_array()) } # 8' end of if(defined@arr) else #else for 2nd if(defined(@arr)) { #11 print < Job Status Display Page No Record found for the given dates.

Back end_of_html } # 11' end of else for if(defined@arr) } #7' end of else for if($empName) } #1' end of if($year && $mon) else #if month or year is not given { #12 print < Job Status Display Page Select year and month.

Back end_of_html } #12'