<%@ Language=VBScript %>
<HTML>
<HEAD>
<TITLE><%=application("Title")%> - <%=request("formHeader")%></TITLE>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<link rel="stylesheet" type="text/css" href="scriptFunctions/calendar.css">
<link rel="stylesheet" type="text/css" href="style.css">
<style >
.txt_Field {
BACKGROUND-COLOR: #FCFFE8;
foreground-color:black
}
</style>
<link rel="stylesheet" type="text/css" href="scriptFunctions/calendar.css">
<link rel="stylesheet" type="text/css" href="images/style.css">
<link rel="stylesheet" type="text/css" href="images/style1.css">
<script language="JavaScript" src="scriptFunctions/calendarcode.
js"></script>
<script language="JavaScript" src="scriptFunctions/DMS_scriptFunctions.
js"></script>
<script language="JavaScript" src="scriptFunctions/javascriptfunctions.
js"></script>
<script language="JavaScript" src="scriptFunctions/commonJS.
js"></script>
<script language="JavaScript" src="date-picker.
js"></script>
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript></SCRIPT>
</HEAD>
<script language="JavaScript">
var v_DataChange=false;
function window_onload(ErrMsg)
{
if (ErrMsg != "")
{
ErrString = '1)' + ErrMsg + '<BR>';
ErrorId.style.color="#FF0000";
Depthead_revision.hError.value = ErrString;
// START Added By Sandeep Holkar on 08/03/2004 for Intergity Check
ErrorDiv.innerHTML =ErrString;
// END Added By Sandeep Holkar on 08/03/2004 for Intergity Check
document.Depthead_revision.txt_loc.style.backgroun dColor = "#ff0000";
document.Depthead_revision.txt_loc.style.color = "#ffffff";
}
document.Depthead_revision.txt_loc.focus();
}
function chkKeys ()
{
if (window.event.keyCode==39)
{
window.event.keyCode =96;
}
}
function ErrorDisplay()
{
var bFlag;
var iSNo;
var txtSetFocus;
bFlag = true;
ErrString="";
iSNo=0;
txtSetFocus="";
ResetColor()
if (removeExcessWhitespace(document.Depthead_revision .txt_loc_code.value) == "")
{
iSNo++;
ErrString = ErrString + iSNo +') Location Code cannot be blank.'+ '<BR>';
document.Depthead_revision.txt_loc_code.style.back groundColor = "#ff0000";
document.Depthead_revision.txt_loc_code.style.colo r = "#ffffff";
if (txtSetFocus=="") txtSetFocus="txt_loc";
bFlag = false ;
}
if(removeExcessWhitespace(document.Depthead_revisi on.txt_div_code.value) == "")
{
iSNo++;
ErrString = ErrString + iSNo +') Division cannot be blank.'+ '<BR>';
document.Depthead_revision.txt_div_code.style.back groundColor = "#ff0000";
document.Depthead_revision.txt_div_code.style.colo r = "#ffffff";
if (txtSetFocus=="") txtSetFocus="txt_div_code";
bFlag = false ;
}
if(document.Depthead_revision.txt_unt_code.value == "")
{
iSNo++;
ErrString = ErrString + iSNo +') Unit cannot be blank.'+ '<BR>';
document.Depthead_revision.txt_unt_code.style.back groundColor = "#ff0000";
document.Depthead_revision.txt_unt_code.style.colo r = "#ffffff";
if (txtSetFocus=="") txtSetFocus="txt_unt_code";
bFlag = false ;
}
if(document.Depthead_revision.txt_dep_code.value == "")
{
iSNo++;
ErrString = ErrString + iSNo +') Department cannot be blank.'+ '<BR>';
document.Depthead_revision.txt_dep_code.style.back groundColor = "#ff0000";
document.Depthead_revision.txt_dep_code.style.colo r = "#ffffff";
if (txtSetFocus=="") txtSetFocus="txt_dep_code";
bFlag = false ;
}
Depthead_revision.hError.value = ErrString;
document.getElementById("ErrorDiv").innerHTML = ErrString;
if (txtSetFocus.length>1) document.getElementById(txtSetFocus).select();
if(!bFlag)
{
ErrorId.style.color="#FF0000";
}
else
{
ErrorId.style.color="";
//botButClicked(but);
}
return(bFlag);
}
function blankValues ()
{
document.Depthead_revision.txt_loc_code.value = "";
document.Depthead_revision.txt_div_code.value = "";
document.Depthead_revision.txt_unt_code.value = "";
document.Depthead_revision.txt_dep_code.value = "";
document.Depthead_revision.txt_emp_code.value = "";
}
function ResetColor()
{
Depthead_revision.txt_loc_code.style.backgroundCol or = "";
Depthead_revision.txt_loc_code.style.color = "";
Depthead_revision.txt_div_code.style.backgroundCol or = "";
Depthead_revision.txt_div_code.style.color = "";
Depthead_revision.txt_dep_code.style.backgroundCol or = "";
Depthead_revision.txt_dep_code.style.color = "";
Depthead_revision.txt_emp_code.style.backgroundCol or = "";
Depthead_revision.txt_emp_code.style.color = "";
}
function doAction(button)
{
var bFlag;
if(button.value=='Save')
{
bFlag = ErrorDisplay();
if(bFlag==true)
{
document.Depthead_revision.txtbtn.value="Save";
document.Depthead_revision.action="Depthead_revisi on.asp"
document.Depthead_revision.submit();
}
}//save button
if(button.value=='Close')
{
if(v_DataChange==true)
{
var doConfirm=confirm('Do you want to save changes?');
if (doConfirm)
{
bFlag = ErrorDisplay();
if(bFlag==true)
{
document.Depthead_revision.txtbtn.value="Save";
document.Depthead_revision.action="Depthead_revisi on.asp"
document.Depthead_revision.submit();
}
}
else
{
//close the form
window.location.href = document.Depthead_revision.esearchval1.value + "?text_mode=" + document.Depthead_revision.text_mode.value + "&doButMode=" + document.Depthead_revision.doButMode.value + "&formName=" + document.Depthead_revision.formName.value + "&searchPageFlag=revision"
}//doConfirm
}
else
{
window.location.href = document.Depthead_revision.esearchval1.value + "?text_mode=" + document.Depthead_revision.text_mode.value + "&doButMode=" + document.Depthead_revision.doButMode.value + "&formName=" + document.Depthead_revision.formName.value + "&searchPageFlag=revision"
} //v_DataChange
}//close button
if(button.value=='Delete')
{
var doConfirm=confirm('Do you want to Delete?');
if(doConfirm)
{
document.Depthead_revision.txtbtn.value="Save";
document.Depthead_revision.action="Depthead_revisi on.asp"
document.Depthead_revision.submit();
}
}//delete
}//end of function
</script>
<%
dim mixforward,filename
dim sqlStat, RowCount
mixforward = request("esearchval1")
set con=Server.CreateObject("ADODB.Connection")
con.Open connstring
tmode = trim(Request("text_mode"))
if tmode<>"Add" then
loc1=trim(Request("txt_loc_code"))
div1=trim(Request("txt_div_code"))
unt1=trim(Request("txt_unt_code"))
dep1=trim(Request("txt_dep_code"))
memp1=trim(Request("txt_memp_code"))
mempname=trim(Request("txt_memp_name"))
frdt1 = trim(Request("txt_fr_dt"))
todt1 = trim(Request("txt_to_dt"))
end if
'Response.Write tmode
dim mixstr
mixstr = mixforward
filename=Mid(mixstr,(InStrRev(mixstr,"/")+1),len(mixstr))
if tmode<>"Add" and tmode<>"Modify" then
read="readonly"
dis="disabled"
end if
if request("txtbtn")="Save" then%>
<%if tmode="Add" then
set rstres=server.CreateObject("adodb.recordset")
rstres.open "select loc_code from dept_head where loc_code='" & Trim(request("txt_loc_code")) & "'",con,3,3
if rstres.recordcount>0 then%>
<script language="javascript">
alert("Duplicate Location not allowed")
</script>
<%else
con.BeginTrans
FSsql =""
FSsql = "Insert into dept_head(dept_code,loc_code,div_code,unt_code,mem p_code,frm_dt,to_dt)"
FSsql = FSsql & " Values('" + trim(request("txt_dep_code")) + "','" +trim(Request("txt_loc_code"))+"','" + trim(Request("txt_div_code")) + "','" + trim(request("txt_unt_code")) & "','"
FSsql = FSsql & trim(request("txt_memp_code"))+ "','" + trim(request("txt_fr_dt"))+ "','" + trim(request("txt_to_dt")) + "')"
con.Execute fssql
'if trim(request("txt_address_yn"))="True" then
'end if
con.CommitTrans%>
<script language="javascript">
window.location.href = '<%=trim(request("fileName"))%>' + '<%=trim(request("searchStr"))%>';
//document.Depthead_revision.action="mnumrecruitsour ce.asp"
//document.Depthead_revision.submit();
</script>
<%end if
elseif tmode="Modify" then
con.BeginTrans
FSsql =""
FSsql = "Update dept_head Set memp_code = '" & (Trim(request("txt_memp_code")))
FSsql = FSsql & "' Where loc_code = '" & Trim(request("txt_loc_code")) & "' And div_code='" & Trim(request("txt_div_code")) & "' And unt_code='" & Trim(request("txt_unt_code")) & "' "
FSsql = FSsql & " And dep_code = '" & Trim(request("txt_dep_code")) & "' "
con.Execute Fssql
con.CommitTrans%>
<script language="javascript">
window.location.href = '<%=trim(request("fileName"))%>' + '<%=trim(request("searchStr"))%>';
//document.Depthead_revision.action="mnumrecruitsour ce.asp"
//document.Depthead_revision.submit();
</script>
<%elseif tmode="Delete" then
set rstres=server.CreateObject("adodb.recordset")
FSsql =""
FSsql = "Select * from MEMPOFF where mempoff.memp_code= = '" & Trim(request("txt_memp_code")) & "'"
rstres.Open fssql,con,3,3
if rstres.RecordCount>0 then
dim ErrMsg
ErrMsg = "Source cannot be deleted,Used for an Applicant"%>
<script language="javascript">
</script>
<%else
con.BeginTrans
con.Execute "Delete from dept_head where dept_head.loc_Code = '" & Trim(request("txt_loc_code")) & "'"
'con.Execute "Delete from MAddress where Type = 'S' And Code = '" & Trim(request("txt_source_code")) & "'"
con.CommitTrans
%>
<script language="javascript">
window.location.href = '<%=trim(request("fileName"))%>' + '<%=trim(request("searchStr"))%>';
//document.Depthead_revision.action="mnumrecruitsour ce.asp"
//document.Depthead_revision.submit();
</script>
<%end if
set rstres=nothing
end if
'end if'added by utk
end if
%>
<BODY>
<BODY bgColor=white topmargin=0 leftmargin=0 LANGUAGE=javascript onload="return window_onload('<%=ErrMsg%>')">
<span class="cal-GreyDate"></span>
<FORM name="Depthead_revision" id="Depthead_revision" method="get" >
<table width="100%" cellspacing=0 cellpadding=0>
<tr>
<td width=100% colspan=3>
</td>
</tr>
<tr bordercolor="#3333CC">
<td width="80%" align="middle" class="topgrad" height="24" ><%=request("text_Mode")%>: <%=request("formHeader")%></td>
<td width="20%" align="left" class="topgrad">
<A align=right id="ErrorId" name="ErrorId" style="CURSOR:HAND" onclick="this.blur(); return DispError();" >
<B>Errors</B></A>
<DIV id="ErrorDiv" name="ErrorDiv" class="div_ErrorDisplay" STYLE="Z-INDEX: 3;POSITION: absolute; LEFT: 75px; WIDTH: 637px; TOP: 20px; HEIGHT: 340px; visibility: hidden" LANGUAGE=javascript onmouseout="return ErrorDiv_onmouseout()" >
<nobr>
</nobr>
</DIV>
</td>
<td width="10%" align="left" class="topgrad">
<a align="right" id="helpId" style="FONT-WEIGHT: normal; FONT-SIZE: 12px; CURSOR: hand; LINE-HEIGHT: normal; FONT-STYLE: normal; FONT-VARIANT
normal" onClick="WebHelp('<%=Session("formNo")%>');">
<b>Help</b>
</a>
</td>
<!--
<td width="10%" align="left" class="topgrad">
<A align=right id="helpId" class="errorText" style="font:12;CURSOR:HAND" onclick="this.blur(); return DispError();" ><B>Help</B></A>
</td>
-->
</tr>
</table>
<table width="100%" border="0" align="center" style="LEFT:0% ;TOP:20% ;POSITION:absolute" bordercolor="#FFFFDE">
<input type=hidden id=text_mode name=text_mode value=<%=request("text_mode")%>>
<tr>
<td colspan="2">
<table width="78%" border="1" height="97" align="center" bordercolor="#6699cc" cellpadding="0" cellspacing="0">
<tr align="left">
<td class="text-head" height="24" bordercolor="#FFFFFF" bgcolor="#6699CC" width="24%" >
<strong>Location</strong>
</td>
<%if tmode<>"Add" then
set rstloc=server.CreateObject("adodb.recordset")
rstloc.Open "select mloc_name,mloc_per from mloc where mloc_code='" & trim(loc1) & "'",con,3,3
if rstloc.RecordCount>0 then
locname=trim(rstloc("mloc_name"))
per=trim(rstloc("mloc_per"))
end if
set rstloc=nothing
else
per = "False" 'Added By [Harry-TU28102K31547] as Address is not validated in Add Mode and then it is validated in modify and Delete Mode
end if%>
<td style="BACKGROUND-COLOR: #ffffff" height="10" valign="middle" >
<input id="txt_loc_code" name="txt_loc_code" class="text" size=25 value="<%=loc1%>" onchange="v_DataChange=true;ErrorId.style.color='# 000000';document.Depthead_revision.txt_loc_name.va lue='';" ONKEYPRESS="checkAlphaNumeric();" onblur="DispDesc(this.value,this.name,'txt_loc_nam e','Depthead_revision','mloc','mloc_code','mloc_na me','V');" maxlength="35" >
<%if (trim(tmode) <> "View") and (trim(tmode) <> "Delete") and (trim(tmode) <> "Modify") then %>
<a href="javascript
:imgClickNW('txt_loc_code','Depthe ad_revision','mloc;mloc_code;mloc_name','revision' ,'txt_loc_name')" >
<img id=cat_img style="WIDTH: 25px; HEIGHT: 18px" height=18 alt="" src="Images\torch.gif" width=25 name=cat_img align="absbottom"> </a>
<%else%>
<%end if%>
<input id="txt_loc_name" name="txt_loc_name" class="text" size=25 maxlength=6 readonly value=<%=locname%>>
</td>
</tr>
<tr>
<td class="text-head" bgcolor="#6699CC" bordercolor="#FFFFFF" height="30" >
<strong>Division</strong>
</td>
<%if tmode<>"Add" then
set rstdiv=server.CreateObject("adodb.recordset")
rstdiv.Open "select mdiv_name from mdiv where mdiv_code='" & trim(div1) & "'",con,3,3
if rstdiv.RecordCount>0 then
divname=trim(rstdiv("mdiv_name"))
end if
set rstdiv=nothing
end if%>
<td style="BACKGROUND-COLOR: #ffffff" height="30" valign="middle" align="left" >
<input id="txt_div_code" name="txt_div_code" class="text" size=25 value="<%=div1%>" onchange="v_DataChange=true;ErrorId.style.color='# 000000';document.Depthead_revision.txt_div_name.va lue='';" ONKEYPRESS="checkAlphaNumeric();" onblur="DispDesc(this.value,this.name,'txt_div_nam e','Depthead_revision','mdiv','mdiv_code','mdiv_na me','V');" maxlength="35" >
<%if (trim(tmode) <> "View") and (trim(tmode) <> "Delete")and (trim(tmode) <> "Modify") then%>
<a href="javascript
:imgClickNW('txt_div_code','Depthe ad_revision','mdiv;mdiv_code;mdiv_name','revision' ,'txt_div_name')" >
<img id=cat_img style="WIDTH: 25px; HEIGHT: 18px" height=18 alt="" src="Images\torch.gif" width=25 name=cat_img align="absbottom"> </a>
<%else%>
<%end if%>
<input id="txt_div_name" name="txt_div_name" class="text" size=25 maxlength=6 readonly value=<%=divname%> >
</td>
</tr>
<tr>
<td class="text-head" bgcolor="#6699CC" bordercolor="#FFFFFF" height="30" >
<strong>Unit</strong>
</td>
<%if tmode<>"Add" then
set rstunt=server.CreateObject("adodb.recordset")
rstunt.Open "select muni_name from munit where muni_code='" & trim(unt1) & "'",con,3,3
if rstunt.RecordCount>0 then
untname=trim(rstunt("muni_name"))
end if
set rstunt=nothing
end if%>
<td style="BACKGROUND-COLOR: #ffffff" valign="center" align="left" height="30" >
<input id="txt_unt_code" name="txt_unt_code" class="text" size=25 value="<%=unt1%>" onchange="v_DataChange=true;ErrorId.style.color='# 000000';document.Depthead_revision.txt_unt_name.va lue='';" ONKEYPRESS="checkAlphaNumeric();" onblur="DispDesc(this.value,this.name,'txt_unt_nam e','Depthead_revision','munit','muni_code','muni_n ame','V');" maxlength="35" >
<%if (trim(tmode) <> "View") and (trim(tmode) <> "Delete")and (trim(tmode) <> "Modify") then%>
<a href="javascript
:imgClickNW('txt_unt_code','Depthe ad_revision','munit;muni_code;muni_name','revision ','txt_unt_name')" >
<img id=cat_img style="WIDTH: 25px; HEIGHT: 18px" height=18 alt="" src="Images\torch.gif" width=25 name=cat_img align="absbottom"> </a>
<%else%>
<%end if%>
<input id="txt_unt_name" name="txt_unt_name" class="text" size=25 maxlength=6 readonly value=<%=untname%> >
</td>
</tr>
<tr>
<td class="text-head" bgcolor="#6699CC" bordercolor="#FFFFFF" height="30" >
<strong>Department</strong>
</td>
<%if tmode<>"Add" then
set rstdep=server.CreateObject("adodb.recordset")
rstdep.Open "select mdep_name from mdep where mdep_code='" & trim(dep1) & "'",con,3,3
if rstdep.RecordCount>0 then
depname=trim(rstdep("mdep_name"))
end if
set rstdep=nothing
end if%>
<td style="BACKGROUND-COLOR: #ffffff" valign="center" align="left" height="30" >
<input id="txt_dep_code" name="txt_dep_code" class="text" size=25 value="<%=dep1%>" onchange="v_DataChange=true;ErrorId.style.color='# 000000';document.Depthead_revision.txt_dep_name.va lue='';" ONKEYPRESS="checkAlphaNumeric();" onblur="DispDesc(this.value,this.name,'txt_dep_nam e','Depthead_revision','mdep','mdep_code','mdep_na me','V');" maxlength="35" >
<%if (trim(tmode) <> "View") and (trim(tmode) <> "Delete") and (trim(tmode) <> "Modify")then%>
<a href="javascript
:imgClickNW('txt_dep_code','Depthe ad_revision','mdep;mdep_code;mdep_name','revision' ,'txt_dep_name')" >
<img id=cat_img style="WIDTH: 25px; HEIGHT: 18px" height=18 alt="" src="Images\torch.gif" width=25 name=cat_img align="absbottom"> </a>
<%else%>
<%end if%>
<input id="txt_dep_name" name="txt_dep_name" class="text" size=25 maxlength=6 readonly value=<%=depname%> >
</td>
</tr>
<tr>
<td class="text-head" bgcolor="#6699CC" bordercolor="#FFFFFF" height="30" >
<strong>Employee Code</strong>
</td>
<%if tmode<>"Add" then
set rstmemp=server.CreateObject("adodb.recordset")
rstmemp.Open "select memp_name from mempoff where memp_code='" & trim(memp1) & "'",con,3,3
if rstmemp.RecordCount>0 then
mempname=trim(rstmemp("memp_name"))
end if
set rstmemp=nothing
end if%>
&nb