<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page import="com.csc.library.entry.*,com.csc.library.utilities.*,java.text.DecimalFormat,com.csc.library.session.*" %>
<%@page contentType="text/html; charset=UTF-8"%>
<jsp:useBean id="ASR002" scope="page" class="com.csc.library.system.Task"/>
<% 
   ASR002.setChannel(request ,response);
   ReportEntry screen=null;
   screen=(ReportEntry)ASR002.process("ReportEntry",request.getParameter("__screen"));
   UProfile uf=screen.getUProfile();
   CscCalendar cs=new CscCalendar();
   
  CscCalendar cDate = new CscCalendar();
  String monthtxt="";
  String cdate ="";
  String month="";
  String year ="";
 // int dayS=1,dayE=1;

	cdate=(cDate.getEngYYYY())+"-"+(Integer.parseInt(cDate.getMM())+1)+"-"+"01";
	month = (Integer.parseInt(cDate.getMM())+1 )+"";
	year = cDate.getEngYYYY()+"";
	//cDate.incMonth(1);
	monthtxt = cDate.getEngLongMonth().toUpperCase();
%>
<html>
<head>
<title>ReportOption PRR171</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="../CSS/TISCO.css" rel="stylesheet" type="text/css">
<script language='javascript' src='../JS/SCREEN.js'></script> 
<script language='javascript'>setLang('<%=screen.getUProfile().get("lang")%>');</script>
<script src="../JS/VIEWCALENDAR.js"></script>

<script language="JavaScript" type="text/JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function back_bakup(){
	
	var z=0;
	with(document.cscform){	
	 for(z=0;z<elements.length;z++){
			if(elements[z].type.indexOf("select")>-1){
				 setParent(elements[z].name,elements[z].options[elements[z].selectedIndex].value);
			}else {
				if(elements[z].type.indexOf("radio")>-1){
					if (elements[z].checked)  {
						setParent(elements[z].name, elements[z].value);					
					}
				}else {
		 			setParent(elements[z].name,elements[z].value);
				}
		     }
	 }

		var mymonth1=month1.value;
		var myyear1=year1.value;

		var mymonth2=month2.value;
		var myyear2=year2.value;

		//window.opener.document.cscform.__fixfiltermemployee.value=" employeeid in(select employeeid from tpy_his0 where gendate between '"+myyear1+"-"+mymonth1+"-01' and '"+myyear2+"-"+mymonth2+"-31')";	
		//window.opener.document.cscform.__fixfiltertpy_his0.value="gendate between '"+myyear1+"-"+mymonth1+"-01' and '"+myyear2+"-"+mymonth2+"-31' ";	
		//window.opener.document.cscform.__ST_DATE.value= myyear1+"-"+mymonth1+"-01";
		//window.opener.document.cscform.__EN_DATE.value= myyear2+"-"+mymonth2+"-01";
		//window.opener.document.cscform.__FILTERDATE.value= " gendate between '"+myyear1+"-"+mymonth1+"-01' and '"+myyear2+"-"+mymonth2+"-31' ";

	}
	window.close();
}

function setParent(inputName,inputValue){
	with(window.opener.document.cscform){
	 for(var  z=0;z<elements.length;z++){
	 	if(elements[z].name==inputName){ 
			   if(elements[z].name=="__language"){
					for(var k=0;k<__language.length;k++){
						if(__language.options[k].value==inputValue){
						     __language.options[k].selected=true;  
						}
					}
			  }else{
			   elements[z].value=inputValue;
			   }
 		}	
	 }
	}
}

function goHelp(helpName,inputName) {
	var helpReturn;
	if (inputName=="__codeid" ) {
	 	helpReturn="__codeid:codeid,MLEAVE_REPORT@EDESC";	
	}
	linkHelp_Return(helpName,helpReturn);
}

function linkHelp_Return(help,input){
	with(document.cscform){
		var param="PRU084.jsp?__helpName="+help+"&__helpReturn="+input+"&__pageCall="+__screen.value+"&__checkVerify=off";
		window.open(param,"Help","left=150,top=150,width=600,height=400,toolbar=no,status=yes,scrollbars=yes,resizable=yes");
	}
}

function back(){
	window.opener.document.cscform.__APSID.value = APSID.value;
	window.opener.document.cscform.__STATE_LIST.value= setStateList(APSID.value);
	window.close();
}

function setStateList(apsid){
	with(document.cscform){
		var result = "";
		for(var z=0;z<elements.length;z++){
			if(elements[z].type=="checkbox" && elements[z].name.indexOf(apsid)>-1 && elements[z].checked==true){
				result += ","+elements[z].value;
			}
		}
		return result;
	}
}

function setShow(apsid){
	with(document.cscform){
		clear();
		if(apsid=="MBO"){
			document.getElementById("mbo_tr").style.display="";
			document.getElementById("pae_tr").style.display="none";
			document.getElementById("pat_tr").style.display="none";
		}else if(apsid=="PAE"){
			document.getElementById("mbo_tr").style.display="none";
			document.getElementById("pae_tr").style.display="";
			document.getElementById("pat_tr").style.display="none";
		}else if(apsid=="PAT"){
			document.getElementById("mbo_tr").style.display="none";
			document.getElementById("pae_tr").style.display="none";
			document.getElementById("pat_tr").style.display="";
		}
	}
}

function clear(){
	with(document.cscform){
		for(var z=0;z<elements.length;z++){
			if(elements[z].type=="checkbox"){
				elements[z].checked = false;
			}
		}
	}
}

//-->
</script>

</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<form name="cscform" method="post" >
<input type="hidden" name="__cmd" value="">
<input type="hidden" name="__language" value ="<%=screen.getUProfile().get("lang")%>">
<input type="hidden" name="__dateformat" value ="DD-MM-YYYY">
<input type="hidden" name="__calendar">
  <div align="center">
    <table  cellpadding="0"  cellspacing="0">
      <tr > 
        <td  class="header"> PRR171, 
		  <script language="javascript">swapLang('Report Option');</script>&nbsp;</td>
      </tr>
      <tr > 
        <td  colspan="2"> 
          <div align="center"> 
            <table  cellpadding="0" cellspacing="0" >

			  <%//=screen.getTagComponent("columnlabel") %> 

				<tr>
					<td><div align="right"><script language="javascript">swapLang('Document :');</script>&nbsp;</div></td>
					<td>
						<select id="APSID" name="APSID" onchange="setShow(this.value)">
						<%
							DbInquiry inq = new InitialInquiry(screen.getUProfile()).getDbInquiry("Tapstran0");
							inq.setColumn("*");
							inq.setFilter("APSID in ('MBO','PAE','PAT') and ACTIVE_STATUS='1'");
							inq.setOrderBy("apsid");
							inq.refresh();
							while(inq.next()){
						%>
						<option value="<%=inq.getString("apsid")%>"><%=inq.getString("edesc")%></option>		
						<%
							}
						%>
						</select>
					</td>
				</tr>

				<table id="mbo_tr" style="display:">
						<%
							DbInquiry inq_mbo = new InitialInquiry(screen.getUProfile()).getDbInquiry("Tapsstate");
							inq_mbo.setColumn("*");
							inq_mbo.setFilter("APSPEID in (select APSPEID from TAPSPERIOD where APSID='MBO') and STATEID in ('0')");
							inq_mbo.setOrderBy("stateid");
							inq_mbo.refresh();
							while(inq_mbo.next()){
						%>
							<tr>
								<td nowrap align="right" width="40%"><input name="MBO<%=inq_mbo.getString("stateid")%>" type="checkbox" value="<%=inq_mbo.getString("stateid")%>">&nbsp;</td>
								<td nowrap align=""><%=inq_mbo.getString("edesc")%></td>
							</tr>
						<%
							}
						%>
							<tr>
								<td nowrap align="right"><input name="MBO0+" type="checkbox" value="0+">&nbsp;</td>
								<td nowrap align="">Set KPIs by Approver</td>
							</tr>
						<%
							inq_mbo.setFilter("APSPEID in (select APSPEID from TAPSPERIOD where APSID='MBO') and STATEID in ('1','2','3','4')");
							inq_mbo.setOrderBy("stateid");
							inq_mbo.refresh();
							while(inq_mbo.next()){
						%>
							<tr>
								<td nowrap align="right" width="40%"><input name="MBO<%=inq_mbo.getString("stateid")%>" type="checkbox" value="<%=inq_mbo.getString("stateid")%>">&nbsp;</td>
								<td nowrap align=""><%=inq_mbo.getString("edesc")%></td>
							</tr>
						<%
							}
						%>
				</table>

				<table id="pae_tr" style="display:none">
						<%
							DbInquiry inq_pae = new InitialInquiry(screen.getUProfile()).getDbInquiry("Tapsstate");
							inq_pae.setColumn("*");
							inq_pae.setFilter("APSPEID in (select APSPEID from TAPSPERIOD where APSID='PAE') and STATEID in ('0','1','2','3','4','5')");
							inq_pae.setOrderBy("stateid");
							inq_pae.refresh();
							while(inq_pae.next()){
						%>
							<tr>
								<td nowrap align="right" width="40%"><input name="PAE<%=inq_pae.getString("stateid")%>" type="checkbox" value="<%=inq_pae.getString("stateid")%>">&nbsp;</td>
								<td nowrap align=""><%=inq_pae.getString("edesc")%></td>
							</tr>
						<%
							}
						%>
				</table>

				<table id="pat_tr" style="display:none">
						<%
							DbInquiry inq_pat = new InitialInquiry(screen.getUProfile()).getDbInquiry("Tapsstate");
							inq_pat.setColumn("*");
							inq_pat.setFilter("APSPEID in (select APSPEID from TAPSPERIOD where APSID='PAT') and STATEID in ('0','1','2','3','4')");
							inq_pat.setOrderBy("stateid");
							inq_pat.refresh();
							while(inq_pat.next()){
						%>
							<tr>
								<td nowrap align="right" width="40%"><input name="PAT<%=inq_pat.getString("stateid")%>" type="checkbox" value="<%=inq_pat.getString("stateid")%>">&nbsp;</td>
								<td nowrap align=""><%=inq_pat.getString("edesc")%></td>
							</tr>
						<%
							}
						%>
				</table>
			  
				<tr > 
					<td height="13" colspan="2" class="blankspace"></td>
				</tr>  
				
				<tr >
                   <TD colspan="2"><div align="center"><img src="../IMAGES/BUTTON/OK.gif" onClick="javascript:back()"> 
                    &nbsp;&nbsp; <img src="../IMAGES/BUTTON/CANCEL.gif" onClick="window.close()"></div></TD>
				</TR>
				<tr >
					<td colspan="2" class="blankspace"></td>
				</tr>
            </table>
          </div></td>
      </tr>
      <tr bordercolor="0069B3"> 
        <td colspan="2" class="bottom"></td>
      </tr>
    </table>
  </div>
<INPUT TYPE="hidden" NAME="__screen" VALUE="<%=request.getParameter("__screen")%>">
</form>
</body>
</html>
