<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/enrgise-html.tld" prefix="enrgise" %>


<html:html>
<head>
  <html:base />
  <TITLE><bean:message  key="hrm.title" /></TITLE>
  <jsp:include page="GenIncludes.jsp" />
  <meta http-equiv="pragma" content="no-cache" >
</head>

<BODY onload="doBaseOnLoad()"  scroll="auto">
<html:form  action="HrmGenEligRuleAction" name="HrmGenEligRuleForm" type="wenrgise.hrms.webtier.form.HrmGenEligRuleForm" >
<bean:define id="ParentForm" name="HrmGenEligRuleForm" toScope="request" />
<!--<jsp:include page="GenIconMenu.jsp" flush="true" />-->
<jsp:include page="GenMenu.jsp" flush="true" />
<bean:define id="left" name="ParentForm" property="positionRequested"/>
<bean:define id="right" name="ParentForm" property="totalCount"/>
<table cellSpacing=0 bgColor=#bdd0ef>
<tr height=27>
  <td colSpan=11></td>
</tr>
  <TR > 
    <TD ><img name="ParentForm" property="butQuery" alt="Query (Ctrl+Q)" class="icon" src="../includes/images/query.jpg" onclick="doBaseQueryMode()" /><img name="ParentForm" property="butInsert" alt="Insert (Alt+N)" src="../includes/images/insert_dis.jpg"  ></TD>
    <TD width="2%"></TD>
    <TD ><img name="ParentForm" property="butExecute" alt="Execute (Ctrl+U)" src="../includes/images/execute_dis.jpg" ><enrgise:img name="ParentForm" property="butSave" onmouseover='this.src="../includes/images/save_act.jpg"' onmouseout='this.src="../includes/images/save.jpg"' alt="Save (Ctrl+S)" src="../includes/images/save.jpg" onclick="doBaseSave()" />
    <img name="ParentForm" property="butDelete" src="../includes/images/delete_dis.jpg" ><enrgise:img name="ParentForm" property="butRefresh" onmouseover='this.src="../includes/images/refresh_act.jpg"' onmouseout='this.src="../includes/images/refresh.jpg"' alt="Refresh (Ctrl+R)"  src="../includes/images/refresh.jpg" onclick="doBaseRefresh()" />
    <img name="ParentForm" property="butPrint" src="../includes/images/print_dis.jpg" ></TD>
    <TD width="2%" bgColor=#bdd0ef></TD>
    <TD><enrgise:img name="ParentForm" property="butExit" onmouseover='this.src="../includes/images/exit_act.jpg"' onmouseout='this.src="../includes/images/exit.jpg"' alt="Exit (Alt+X)"  src="../includes/images/exit.jpg"   onclick="doBaseExit()" />
    <enrgise:img name="ParentForm" property="butHelp" onmouseover='this.src="../includes/images/help_act.jpg"' onmouseout='this.src="../includes/images/help.jpg"' alt="Help (Ctrl+?)" src="../includes/images/help.jpg" onclick="doBaseHelp()" /></TD>
    <TD width="50%"></TD>
    <TD ><enrgise:img name="ParentForm" property="butPrevHeader" src='../includes/images/butn_prev.jpg' onmouseover='this.src="../includes/images/butn_prev_act.jpg"' onmouseout='this.src="../includes/images/butn_prev.jpg"' alt="Butn_prev (Ctrl+<)" onclick="doBasePrevHeader()" /></td>
    <td class=dtlNavText><bean:write  name="left" /> of 
    <bean:write name="right" /></td>
    <td align=right><enrgise:img name="ParentForm" property="butNextHeader" src="../includes/images/butn_next.jpg" onmouseover='this.src="../includes/images/butn_next_act.jpg"' onmouseout='this.src="../includes/images/butn_next.jpg"' alt="Butn_next (Ctrl+>)" onclick="doBaseNextHeader()" /></td>
    <td align=right><enrgise:text property="newPositionRequested" size="1"  maxlength="3" onkeydown="isInteger(event)" title="wenrgise.common.jumpDetail" alt="N" disabledClass="locked" styleClass="optional" /></td>
    <td ><enrgise:img name="ParentForm" property="butJumpHeader" alt="Go (Ctrl+G)" src="../includes/images/go.jpg" onmouseover='this.src="../includes/images/go_act.jpg"' onmouseout='this.src="../includes/images/go.jpg"' onclick="doBaseJumpHeader()" /></td>
    <td > </td>
    
</TR>
</table>
<table>
<tr>
  <td colspan="11" class="userText"></td>
</tr>
<enrgise:checkSession/>
</TABLE>

<!-- Icon Menu -->
<!--Top Most Blue Bar-->
<TABLE cellSpacing=0 bgColor=#bdd0ef>
    <tr>
        <TD  colSpan=12 class=mainHeader height=10><bean:message key="hrm.HrmGenEligRule.heading" /></TD>
    </TR>
</TABLE>
<!--//  Display Errors -->
<enrgise:errors/>
<logic:messagesPresent message="true">
<Table>
    <html:messages id="message" message="true">
    <TR><TD>
      <bean:write name="message"/>
    </TD></TR>
    </html:messages>      
</Table>
</logic:messagesPresent>
<!--//  Display Errors --> 

<TABLE cellSpacing=0 cellPadding=0 border=0 >
    <TR>
        <TD>
        <TABLE cellSpacing=0 cellPadding=0 >
        <!-- Header Starts -->
            <TR>
                  <TD class=subHeader colspan=6><bean:message key="hrm.HrmGenEligRule.header" /></TD>
            </TR>
            <TR>
                  <TD colspan=6 bgColor=#4682b4><IMG height=1 src="../includes/images/pixel.gif" width=1 border=0></TD>
            </TR>
            <tr>
                  <td class="labelText"><bean:message key="hrm.HrmGenEligRule.documentType" /></td>
                  <td><enrgise:select property="documentType" titleKey="hrm.HrmGenEligRule.documentType"  styleClass="required" disabledClass="locked" onchange="doBaseValidate()"  >
                      <enrgise:option value="" ><bean:message   key="hrm.pleaseSelect" /></enrgise:option>      
                      <enrgise:option value="V" ><bean:message   key="hrm.HrmGenEligRule.leave" /></enrgise:option>      
                      <enrgise:option value="L" ><bean:message   key="hrm.HrmGenEligRule.loan" /></enrgise:option>      
                      <enrgise:option value="A" ><bean:message   key="hrm.HrmGenEligRule.advances" /></enrgise:option>      
                      <enrgise:option value="C" ><bean:message   key="hrm.HrmGenEligRule.claims" /></enrgise:option>      
                      <!--<enrgise:option value="E" ><bean:message   key="hrm.HrmGenEligRule.earningDeduction" /></enrgise:option>      
                      <enrgise:option value="S" ><bean:message   key="hrm.HrmGenEligRule.separation" /></enrgise:option>-->     
                      </enrgise:select>
                  </td> 
                  <td class="labelText"><bean:message key="hrm.HrmGenEligRule.documentCode" /></td>
                  <td><html:text  property="documentCode" titleKey="hrm.HrmGenEligRule.documentCode" maxlength="10" size="23" styleClass="required"  readonly="true" /><enrgise:img height="16" align="center" styleClass="icon" src="../includes/images/lov.jpg" name="HrmGenEligRuleForm" property="butDocumentCode" onclick="getDocumentCodeLov()" /></td>
       
                  
                  <td class="labelText"> </td>
                  <td> </td>
       
           </tr>
            
            <tr>
                  <td class="labelText"><bean:message key="hrm.HrmGenEligRule.eligibilityClass" /></td>
                  <td><html:select property="eligibilityClass" titleKey="hrm.HrmGenEligRule.eligibilityClass"  styleClass="required" >
                      <html:option value="" ><bean:message   key="hrm.pleaseSelect" /></html:option>      
                      <bean:define  id="mapEligibilityClass" name="HrmGenEligRuleForm" property="eligibilityClasses" />
                      <html:options collection="mapEligibilityClass" property="key" labelProperty="value"  />
                      </html:select>
                  </td> 
                  
                  <td class="labelText"><bean:message key="hrm.HrmGenEligRule.operator" /></td>
                  <td><enrgise:select property="operator" titleKey="hrm.HrmGenEligRule.operator" alt="X" styleClass="required" disabledClass="locked"  >
                      <enrgise:option value="" ><bean:message   key="hrm.pleaseSelect" /></enrgise:option>      
                      <enrgise:option value="=" > =</enrgise:option> 
                      <enrgise:option value="<>" >NOT = </enrgise:option>
                      <enrgise:option value=">" >&gt;</enrgise:option> 
                      <enrgise:option value="<" >&lt;</enrgise:option> 
                      <enrgise:option value="=>" >=&gt; </enrgise:option> 
                      <enrgise:option value="<=" >&lt;= </enrgise:option> 
                      <enrgise:option value="IN" >IN </enrgise:option> 
                      <enrgise:option value="NOT IN" >NOT IN </enrgise:option> 
                      </enrgise:select>
                  </td> 
                  
                  <td class="labelText"><bean:message key="hrm.HrmGenEligRule.values" /></td>
                  <td><enrgise:text property="values" titleKey="hrm.HrmGenEligRule.values" size="23"  styleClass="required" disabledClass="locked"  readonly="false" onchange="doShowFormula()"  /><enrgise:img height="16" align="center" styleClass="icon" src="../includes/images/lov.jpg" name="HrmGenEligRuleForm" property="butValues" onclick="getValuesLov()"/></td>
       
           </tr>
           <tr height="10">
                  <td colspan="6"></td>
          </tr>
       
          <tr height="10">
                  <td colspan="6"></td>
          </tr>
                
           <tr> 
                  <td class="labelText"><bean:message key="hrm.HrmGenEligRule.formula" /></td>
                  <td colspan="5"><html:textarea  property="formula" titleKey="hrm.HrmGenEligRule.formula" cols="159" rows="15" alt="A" styleClass="locked" readonly="true" /></td>
           </tr>
              
                        
      </table>
      
      
     <table cellspacing=0 cellpadding=0 border=0>
         <!-- Detail Information Row starts -->
 	 
<!-- Bottom Blue Bar -->
       <TR>
            <td>
              <TABLE  cellspacing="0" cellpadding="0" border=0>
                    <tr>
                        <td bgColor=#4682b4>&nbsp;</td>
                        <td bgColor=#4682b4 align="center" ><enrgise:button styleClass="bottomBarText"  property="butOr" name="HrmGenEligRuleForm" onclick="doOr()"  >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Or&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</enrgise:button>                  
                        <enrgise:button styleClass="bottomBarText" name="HrmGenEligRuleForm" property="butAnd" onclick="doAnd()"  >&nbsp;&nbsp;&nbsp;&nbsp;And&nbsp;&nbsp;&nbsp;&nbsp;</enrgise:button>
                        <enrgise:button styleClass="bottomBarText" name="HrmGenEligRuleForm" property="butShowFormula" onclick="doShowFormula()"  >Show Final Formula</enrgise:button></td>
                        <td align="right" bgColor=#4682b4><img src="../includes/images/man.jpg"></td>
                   </TR>
                </table>
            </td>
          </tr>
 
<!-- Container Table Ending Columns Starts-->
  </TD>
    
</TR>
</TBODY>
</TABLE>
<!-- Container Table Ends -->

<!--//Common hidden fields      -->
<html:hidden name="HrmGenEligRuleForm"  property="screenMode" value="Q" />
<html:hidden name="HrmGenEligRuleForm"  property="screenName" value="HrmGenEligRule" />
<html:hidden name="HrmGenEligRuleForm"  property="forwardedPage" />
<html:hidden property="positionRequested" name="HrmGenEligRuleForm" />
<html:hidden property="userPageRequested"  />
<html:hidden property="userPositionRequested" />
<html:hidden property="pageRequested" />
<html:hidden property="actionName" name="HrmGenEligRuleForm" />
<html:hidden property="headerPrimaryKey" name="HrmGenEligRuleForm" />
<html:hidden property="headerDataChanged" name="HrmGenEligRuleForm" />
<html:hidden property="detailDataChanged" name="HrmGenEligRuleForm" />
<html:hidden property="firstLoad" name="HrmGenEligRuleForm" />
<html:hidden property="txtIndex" name="HrmGenEligRuleForm"  />
<html:hidden property="buttonName" name="HrmGenEligRuleForm" />
<!--//For LOV-->
<html:hidden property="txtHidSubmitFirst" />
<html:hidden property="lovKey" />
<html:hidden property="txtSearchFields" />
<html:hidden property="txtDisplayFields" />
<input type="hidden" name="multipleFlag" >
<input type="hidden" name="queryParam" >

<!--//Page specific Hidden fields-->
<html:hidden property="hidAction" />
<html:hidden property="hidFormula" />
<html:hidden property="hidDocumentCodeId" />
<html:hidden property="eligSql" />
<html:hidden property="hidValuesId" onchange="doShowFormula();" />

</html:form>
</body>
</html:html>

<script>
function doQueryMode()
{
  
  return "HrmGenEligRuleValidateAction.do"; //Dummy
}

function doInsertMode()
{

  document.forms[0].hidAction.value="Refresh";
  return "HrmGenEligRuleValidateAction.do";
}


function doExecute()
{

  return "HrmGenEligRuleGetHeaderAction.do";
}

function doSave()
{
  document.forms[0].screenMode.value="N";
  document.forms[0].headerDataChanged.value = "true";
  return "HrmGenEligRuleSaveAction.do";
}


function doDelete()
{

  return "HrmGenEligRuleDeleteAction.do";
  
}

function doRefresh()
{
  document.forms[0].hidAction.value="Refresh";
  return "HrmGenEligRuleAction.do";

}

function doPrevHeader()
{
  return "HrmGenEligRuleGetNextHeaderAction.do"; 
}

function doNextHeader()
{
  return "HrmGenEligRuleGetNextHeaderAction.do"; 
}

function doJumpHeader()
{
  return "HrmGenEligRuleGetNextHeaderAction.do"; 
}

function doGetDetail()
{

  return "HrmGenEligRuleGetDetailAction.do";
}

function doAddRow()
{

  return "HrmGenEligRuleAddRowAction.do"; 
}

function doDelRow()
{
 return "HrmGenEligRuleDeleteRowAction.do";  
}

function doGetDetailTableName()
{
  return "tableName";
}

function doPrevDetail()
{

  return "HrmGenEligRuleGetDetailPageAction.do";  
}

function doNextDetail()
{

  return "HrmGenEligRuleGetDetailPageAction.do";
}
function doExit()
{

  return "HrmGenEligRuleExitAction.do";
}

function doJumpDetail()
{
  return  "HrmGenEligRuleGetDetailPageAction.do"; 
}

function doValidate()
{
  return  "HrmGenEligRuleValidateAction.do"; 
}
function doOnLoad()
{
  //if(document.forms[0].firstLoad.value!="false")
  //{
  //  return  "HrmGenEligRuleOnLoadAction.do"; 
  //}
  //else
 // {
    if(document.forms[0].txtHidSubmitFirst.value!="false")
    {
      document.forms[0].hidAction.value="classinfo";
      document.forms[0].action= contextRoot + "HrmGenEligRuleAction.do";
      document.forms[0].submit();
    }
 // }
}


function getValuesLov()
{
   document.forms[0].lovKey.value = "EligValues" + document.forms[0].screenName.value + document.forms[0].screenMode.value;
   document.forms[0].txtSearchFields.value = "";
   document.forms[0].txtDisplayFields.value = "hidValuesId,values";
   
   var bMultiple="false";
   if( document.forms[0].operator.value == "IN"  || document.forms[0].operator.value == "NOT IN" ){
      bMultiple="true";
   }
   document.forms[0].multipleFlag.value = bMultiple;
   if(document.forms[0].eligibilityClass.value=="")
   {
    return;
   }
   document.forms[0].queryParam.value = "eligibilityClass="+ document.forms[0].eligibilityClass.value;
   showLov('<html:rewrite page="/hrms/jsp/CommonSearchScreen.jsp" />', 'HrmGenEligRuleForm');
   return true;
}

function getDocumentCodeLov()
{
   var key;
  
   switch(document.forms[0].documentType.value)
   {
    case "V":  key="DocTypeLeave";break;
    case "L":  key="DocTypeLoan";break;
    case "A":  key="DocTypeAdvances";break;
    case "C":  key="DocTypeClaim";break;
    case "E":  key="DocTypeEarnDed";break;
    case "S":  key="DocTypeSep";break;
   }
   if(key==null){
    return;
   }
   document.forms[0].lovKey.value = key + document.forms[0].screenName.value + document.forms[0].screenMode.value;
   document.forms[0].txtSearchFields.value = "";
   document.forms[0].txtDisplayFields.value = "hidDocumentCodeId,documentCode";
   showLov('<html:rewrite page="/hrms/jsp/CommonSearchScreen.jsp" />', 'HrmGenEligRuleForm');
   return true;
}


function doSetFields(arr,rows,cols)
{
  var sVal="";
  var sValId="";
  for(i=0;i<rows;i++){
    sValId+=arr[i][0];
    sVal+=arr[i][1];
    if(i!=rows-1){
      sVal+=",";
      sValId+=",";
    }
  }
  document.forms[0].values.value=sVal;
  document.forms[0].hidValuesId.value=sValId;
}

function doAnd()
{
 // if(isValidated()){
    document.forms[0].hidAction.value="and";
    document.forms[0].submit(); 
 // }
}
function doOr()
{
  //if(isValidated()){
    document.forms[0].hidAction.value="or";
    document.forms[0].submit(); 
 // }
}

function doShowFormula()
{
  //if(isValidated()){
    document.forms[0].hidAction.value="show";
    document.forms[0].headerDataChanged.value = "true";
    document.forms[0].submit(); 
  //}
}

</script>