<%@ page language="java" pageEncoding="UTF-8"%>
<%@page import="com.stfhr.dao.hibernate.EmployeeFileDAO"%>
<%@page import="com.stfhr.domain.EmployeeFile"%>
<%@page import="com.stfhr.domain.BankInfo"%>
<%@page import="com.stfoa.domain.Employee"%>
<%@page import="com.stfoa.common.util.FormatUtil"%>
<%@page import="java.util.List"%>
<%@page import="com.stfhr.dao.hibernate.TaxRateDAO"%>
<%@page import="com.stfhr.dao.hibernate.BankInfoDAO"%>
<%@page import="com.stfoa.common.util.DataDicUtil"%>
<%@ include file="/include/taglibs.jsp"%>
<html>
<head>
 <%@ include file="/include/meta.jsp"%>
 <link rel="STYLESHEET" type="text/css" href="${ctx}/css/click.css">
 <link rel="STYLESHEET" type="text/css" href="${ctx}/css/employee.css">
 <script type="text/javascript" src="${ctx}/js/ajaxform.js"></script>
 <%@ include file="/include/calendar.jsp"%>
</head>
<%
 Integer empFileId = Integer.valueOf(request.getParameter("empFileId")); 
 EmployeeFileDAO empfiledao = new EmployeeFileDAO();
 EmployeeFile empfile = empfiledao.findById(empFileId);
 Employee emp = empfile.getOaTblEmployee();
%>
<body>
<form name="myform" action="<%=request.getContextPath()%>/salary.do?actionmethod=salaryrelainfo&empFileId=<%=empFileId%>" method="post">
 <fieldset>
  <legend>&nbsp;&nbsp;<font color="blue"><b>支付信息修改</b></font>&nbsp;&nbsp;</legend>
   <div class="divline">
    <span class="spancol_private_title">员工姓名：</span>
    <span class="spancol_private_input">
      <input name="empCode" style="width:160" type="text" readonly value="<%=emp.getEmpName()%>">
    </span>
    <span class="spancol_private_split"></span>
    <span class="spancol_private_title">员工工号：</span>
    <span class="spancol_private_input">
      <input name="empNo" style="width:160" type="text" readonly value="<%=empfile.getEmpNo()%>">
    </span>
   </div>
    <div class="divline">
    <span class="spancol_private_title">部门：</span>
    <span class="spancol_private_input">
      <input name="deptName" style="width:160" type="text" readonly value="<%=emp.getOaTblDepartment().getDeptName()%>">
    </span>
    <span class="spancol_private_split"></span>
    <span class="spancol_private_title">职务：</span>
    <span class="spancol_private_input">
      <input name="titleName" style="width:160" type="text" readonly value="<%=emp.getOaTblTitle().getTitleName()%>">
    </span>
   </div>
    <div class="divline">
    <span class="spancol_private_title">岗位：</span>
    <span class="spancol_private_input">
      <input name="dutyName" style="width:160" type="text" readonly value="<%=emp.getOaTblDuty().getDutyName()%>">
    </span>
    <span class="spancol_private_split"></span>
    <span class="spancol_private_title"><%=empfile.getIdNoCategory().getName()%>：</span>
    <span class="spancol_private_input">
      <input name="idNo" style="width:160" type="text" readonly value="<%=emp.getIdNo()%>">
    </span>
   </div>
    <div class="divline">
    <span class="spancol_private_title">是否在职：</span>
    <span class="spancol_private_input">
      <input name="empStatus" style="width:160" type="text" readonly value="<%=emp.getEmpStatus()==0?"在职":"离职"%>">
    </span>
    <span class="spancol_private_split"></span>
    <span class="spancol_private_title">是否转正：</span>
    <span class="spancol_private_input">
      <input name="formalStatus" style="width:160" type="text" readonly value="<%=empfile.getFormalStatus()==1?"已转正":"未转正"%>">
    </span>
   </div>
   <div class="divline">
    <span class="spancol_private_title">入职日期：</span>
    <span class="spancol_private_input">
      <input name="inductionDate" style="width:160" type="text" readonly value="<%=FormatUtil.formatDate("yyyy-MM-dd",emp.getInductionDate())%>">
    </span>
    <span class="spancol_private_split"></span>
    <span class="spancol_private_title">离职日期：</span>
    <span class="spancol_private_input">
      <input name="separationDate" style="width:160" type="text" readonly value="<%=FormatUtil.formatDate("yyyy-MM-dd",emp.getSeparationDate())%>">
    </span>
   </div>
   <hr>
   <div class="divline" style="height:30;">
    <span class="spancol_private_title">支付方式：</span>
    <span class="spancol_private_input">
      <input name="payTypeName" style="width:140" type="text" readonly onclick="showSelectTree('PayTypeTree',myform.payTypeName,myform.payType);changePayType();" value="<%=DataDicUtil.parsePayType(empfile.getPayType())%>">
       <img src="${ctx}/images/showselect.gif" onMouseOver="this.style.cursor='hand';" 
         onclick="showSelectTree('PayTypeTree',myform.payTypeName,myform.payType);changePayType();" >
         <input type="hidden" name="payType" value="<%=empfile.getPayType()%>">
    </span>
    <span class="spancol_private_split"></span>
    <span class="spancol_private_title">适用税率：</span>     
      <span class="spancol_private_input">
       <input name="taxrateName" style="width:140" type="text" readonly onclick="showSelectTree('TaxrateTree',myform.taxrateName,myform.taxrateId)" value="<%=empfile.getTaxrateId()==0?"未设置":new TaxRateDAO().findById(empfile.getTaxrateId()).getTaxrateName()%>">
       <img src="${ctx}/images/showselect.gif" onMouseOver="this.style.cursor='hand';" 
         onclick="showSelectTree('TaxrateTree',myform.taxrateName,myform.taxrateId)" >
         <input type="hidden" name="taxrateId" value="<%=empfile.getTaxrateId()%>">
      </span>
   </div>
    <div class="divline" id=div_bankinfo style="display:<%=empfile.getPayType()==1?"":"none"%>">
    <span class="spancol_private_title">银行：</span>
    <span class="spancol_private_input">
      <input name="bankName" style="width:140" type="text" readonly onclick="showSelectTree('BankInfoTree',myform.bankName,myform.bankId)" value="<%=empfile.getBankId()==0?"":new BankInfoDAO().findById(empfile.getBankId()).getBankName()%>">
       <img src="${ctx}/images/showselect.gif" onMouseOver="this.style.cursor='hand';" 
         onclick="showSelectTree('BankInfoTree',myform.bankName,myform.bankId)" >
        <input type="hidden" name="bankId" value="<%=empfile.getBankId()%>">
    </span>
    <span class="spancol_private_split"></span>
    <span class="spancol_private_title">银行账号：</span>
    <span class="spancol_private_input">
     <input name="bankAccount" style="width:160" type="text" value="<%=empfile.getBankAccount()==null?"":empfile.getBankAccount()%>">
    </span>
   </div>
   <div class="divline">
    <span class="spancol_private_title">修改说明：</span>
    <textarea rows="3" style="width:430" name=updateDesc></textarea>
   </div>
 </fieldset>
</form>
<div align=center>
<BUTTON class=Btnnormal onmousedown="javascript:this.className='Btnover'" 
onmouseover="javascript:this.className='Btnover'" title='确定'
onmouseout="javascript:this.className='Btnnormal'" onclick="ok()">&nbsp;&nbsp;确定&nbsp;&nbsp;</BUTTON>
&nbsp;&nbsp;&nbsp;&nbsp;
<BUTTON class=Btnnormal onmousedown="javascript:this.className='Btnover'" 
onmouseover="javascript:this.className='Btnover'" title='取消'
onmouseout="javascript:this.className='Btnnormal'" onclick="self.close()">&nbsp;&nbsp;取消&nbsp;&nbsp;</BUTTON>
</div>
</body>
<script type="text/javascript">
function changePayType(){
 var type = myform.payType.value;
 if(type==1){
  document.all.div_bankinfo.style.display='';
 }else{
  document.all.div_bankinfo.style.display='none';
 }
}
</script>
<script>
 function ajaxSubmitHandle(responseText){  
   if(responseText=='success'){
    alert('保存成功！'); 
    self.close();
   }else if(responseText=='fail'){
    alert('保存失败！');
   }else{
    alert(responseText);
   }
 }
 
 function ok(){
  if(myform.payType.value==1){
   if(myform.bankId.value=='0'){
     alert('请选择银行！');
     return;
   }
   if(myform.bankAccount.value==''){
     alert('请输入银行账号！');
     return;
   }  
  }
  if(myform.taxrateId.value==0){
	  alert('“适用税率”必须设置！');
	  return;
  }
  ajaxSubmitForm(myform);
 }
function showSelectTree(treeClass,textObj,idObj){
 var sRtn;
 var y= window.event.y;
 y = y+130;
 var x = window.event.x;
 x = x+120;
 sRtn = window.showModalDialog("${ctx}/commons/selectinfo/treebuilder.jsp?treeClass="+treeClass,self,"dialogHeight: 400px; dialogWidth:300px;dialogTop:"+y+";dialogLeft: "+x+";center: yes; status=no");
 if(sRtn){
  var values = sRtn.split('@@@');
  textObj.value=values[1];
  idObj.value=values[0];
 }
}
</script>
</html>