<%@ page language="java"  pageEncoding="UTF-8"%>
<%@page import="org.fuwushe.cp.dao.hibernate.ContractSubDAO"%>
<%@page import="org.fuwushe.cp.domain.ContractSub"%>
<%@page import="org.fuwushe.cp.domain.ContractMain"%>
<%@page import="com.myoa.common.util.FormatUtil"%>
<%@page import="com.myoa.common.util.UUIDUtil"%>
<%@page import="com.stfoa.domain.Employee"%>
<%@page import="com.myoa.common.util.ValidateUtil"%>
<%@page import="org.fuwushe.cp.domain.PaySheet"%>
<%@page import="org.fuwushe.cp.dao.hibernate.PaySheetDAO"%>
<%@page import="com.myoa.common.util.ContractUtil"%>
<%@page import="org.fuwushe.cp.domain.PaySheetUsage"%>
<%@page import="java.util.List"%>
<%@page import="org.fuwushe.cp.domain.FormTraffic"%>
<%@page import="org.fuwushe.cp.domain.FormEntertainment"%>
<%@page import="org.fuwushe.cp.domain.FormHotel"%>
<%@page import="org.fuwushe.cp.domain.FormPhone"%>
<%@page import="org.fuwushe.cp.domain.FormOther"%>
<%@page import="java.util.Iterator"%>
<%@page import="org.fuwushe.cp.domain.PaySheetAttachment"%>
<%@page import="com.myoa.common.components.upload.UploadSessionManager"%>
<%@page import="java.io.File"%>
<%@page import="com.myoa.common.components.upload.UploadFile"%>
<%@page import="com.myoa.common.util.StringUtil"%>
<%@page import="java.util.Date"%>
<%@page import="org.apache.commons.lang.time.DateUtils"%>
<%@page import="org.fuwushe.fi.domain.Currency"%>
<%@page import="org.fuwushe.fi.dao.CurrencyDAO"%>
<%@include file="/common/include/taglibsnocss.jsp"%>
<html>
<head>
<%@include file="/common/include/meta.jsp"%>
<%@include file="/common/include/jquery.jsp"%>
<%@include file="/common/include/datepicker.jsp"%>
<%long uuid = UUIDUtil.getLongId(); %>
<script>
 var uuid = "<%=uuid%>";
 var contextpath = '${ctx}';
 var fileiconpath = '${ctx}/common/images/fileicons/'
</script>
<%
 Employee self = (Employee)session.getAttribute("session_employee");
 Date now = new Date();
 String paySheetId = request.getParameter("paySheetId");
 PaySheet sheet = null;
 PaySheetDAO sheetdao = new PaySheetDAO();
 if(!ValidateUtil.isNull(paySheetId)){	
	sheet = sheetdao.findById(Long.valueOf(paySheetId));
 }
%>
<script type="text/javascript" src="${ctx}/common/components/upload/js/upload.js"></script>
<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns="http://www.w3.org/TR/REC-html40">
<script type="text/javascript" src="<%=request.getContextPath()%>/common/js/payutil.js"></script>
<script type=text/javascript src="${ctx}/common/components/expenseform/i18n/${locale}.js" ></script>
<script type=text/javascript src="${ctx}/common/components/expenseform/form.js" ></script>
<script type=text/javascript src="${ctx}/common/js/jquery/jquery.contextmenu.js"></script>
<link rel="STYLESHEET" type="text/css" href="${ctx}/common/js/jquery/css/jquery.contextMenu.css">
<script type="text/javascript">
$(document).ready( function() {
	$("#image_sign").contextMenu({
		menu: 'myMenu'
	},
		function(action, el, pos) {
	});	
});
function init(){
 <%if(sheet!=null){%>
  oneToMore('<%=FormatUtil.formatDouble(sheet.getPayMoneyXx(),2)%>');
  <%
  try{
		int attachTotal = 0;
		
	 %>
	  var usageList = [];
	  <%
	   for(PaySheetUsage usage:sheet.getPaySheetUsages()){
		   attachTotal += usage.getUsageAttach();
	  %>
	  var usageItemList<%=usage.getOrderNo()%> = [];
	  <%
	   if(usage.getFormType()==1){//交通
		 List<FormTraffic> trafficlist = sheetdao.queryByHQL("from org.fuwushe.cp.domain.FormTraffic where usageId="+usage.getId()+" order by orderNo");
	     for(FormTraffic traffic:trafficlist){
	  %>
	  usageItemList<%=usage.getOrderNo()%>.push(new Traffic(<%=traffic.getOrderNo()%>,'<%=traffic.getBegPlace()%>','<%=traffic.getEndPlace()%>','<%=FormatUtil.formatDate("yyyy-MM-dd HH:mm",traffic.getBegTime())%>','<%=FormatUtil.formatDate("yyyy-MM-dd HH:mm",traffic.getEndTime())%>','<%=traffic.getVehicle()%>','<%=traffic.getVehicleName()%>','<%=FormatUtil.formatDouble(traffic.getMoney(),2)%>',<%=traffic.getAttachNum()%>,'<%=traffic.getMemo()%>',<%=traffic.getIsSpecial()%>));
	  <%
	     }
	   }else if(usage.getFormType()==2){//招待
		   List<FormEntertainment> entertainmentlist = sheetdao.queryByHQL("from org.fuwushe.cp.domain.FormEntertainment where usageId="+usage.getId()+" order by orderNo");
		     for(FormEntertainment entertainment:entertainmentlist){
		  %>
		  usageItemList<%=usage.getOrderNo()%>.push(new Entertainment(<%=entertainment.getOrderNo()%>,'<%=FormatUtil.formatDate("yyyy-MM-dd HH:mm",entertainment.getTheDate())%>','<%=entertainment.getPlace()%>','<%=entertainment.getCustomers()%>','<%=FormatUtil.formatDouble(entertainment.getMoney(),2)%>',<%=entertainment.getAttachNum()%>,'<%=entertainment.getMemo()%>',<%=entertainment.getIsSpecial()%>));
		  <%} 
	   }else if(usage.getFormType()==3){//住宿
		   List<FormHotel> hotellist = sheetdao.queryByHQL("from org.fuwushe.cp.domain.FormHotel where usageId="+usage.getId()+" order by orderNo");
		     for(FormHotel hotel:hotellist){
		  %>
		  usageItemList<%=usage.getOrderNo()%>.push(new Hotel(<%=hotel.getOrderNo()%>,'<%=FormatUtil.formatDate("yyyy-MM-dd HH:mm",hotel.getBegTime())%>','<%=FormatUtil.formatDate("yyyy-MM-dd HH:mm",hotel.getEndTime())%>','<%=FormatUtil.formatDouble(hotel.getDayNum(),1)%>','<%=hotel.getPlace()%>','<%=FormatUtil.formatDouble(hotel.getMoney(),2)%>',<%=hotel.getAttachNum()%>,'<%=hotel.getMemo()%>',<%=hotel.getIsSpecial()%>));
		  <% }
	   }else if(usage.getFormType()==4){//通讯
		   List<FormPhone> phonelist = sheetdao.queryByHQL("from org.fuwushe.cp.domain.FormPhone where usageId="+usage.getId()+" order by orderNo");
		     for(FormPhone phone:phonelist){
		  %>
		  usageItemList<%=usage.getOrderNo()%>.push(new Phone(<%=phone.getOrderNo()%>,'<%=phone.getMonth()%>','<%=FormatUtil.formatDate("yyyy-MM-dd",phone.getReceiptDate())%>','<%=FormatUtil.formatDouble(phone.getMoney(),2)%>',<%=phone.getAttachNum()%>,'<%=phone.getMemo()%>',<%=phone.getIsSpecial()%>));
		  <%}
	   }else{//其他
		   List<FormOther> otherlist = sheetdao.queryByHQL("from org.fuwushe.cp.domain.FormOther where usageId="+usage.getId()+" order by orderNo");
		     for(FormOther other:otherlist){
		  %>
		  usageItemList<%=usage.getOrderNo()%>.push(new Other(<%=other.getOrderNo()%>,'<%=other.getCause()%>','<%=FormatUtil.formatDouble(other.getMoney(),2)%>',<%=other.getAttachNum()%>,'<%=other.getMemo()%>',<%=other.getIsSpecial()%>));
		  <%  }
	   }
	  %>
	  usageList.push(new Usage(<%=usage.getOrderNo()%>,<%=usage.getFormType()%>,'<%=FormatUtil.formatDouble(usage.getUsageMoney(),2)%>',<%=usage.getUsageAttach()%>,<%=usage.getCategoryId()%>,'<%=usage.getCategoryName()%>',usageItemList<%=usage.getOrderNo()%>));
	  <%}%>
	  var paysheet = new PaySheet('<%=FormatUtil.formatDouble(sheet.getPayMoneyXx(),2)%>','<%=sheet.getPayMoneyDx()%>',<%=attachTotal%>,usageList);
	  var jsonText = $.json.encode(paysheet);
	  document.all.usageJSON.value= jsonText;
	 <%}catch(Exception ex){ex.printStackTrace();}%>
 <%}%>
}
</script>
<head>
<meta http-equiv=Content-Type content="text/html; charset=gb2312">
</head>

<body lang=ZH-CN style='tab-interval:21.0pt;text-justify-trim:punctuation' onload="init()">
<p class=MsoNormal align=center style='text-align:center;width:748px;margin-top:8px;margin-bottom:0px;margin-left:23.4pt;'><span
style='font-size:15.0pt;font-family:黑体'><fmt:message key="paysheet.expense.Title"/><span lang=EN-US><o:p></o:p></span></span></p>
<table class=MsoTableGrid border=0 cellspacing=0 cellpadding=0 width=748
 style='width:591.2pt;margin-left:23.4pt;border-collapse:collapse;border:none;'>
 <tr style='height:10.2pt'>
  <td style='height:10.2pt' width="50%" align=left><font size=2><span id="datespan"><fmt:formatDate value="<%=now%>" type="date" dateStyle="long"/></span></font></td>
  <td style='height:10.2pt' width="50%" align=right><font size=2><fmt:message key="paysheet.Code"/>：</font><INPUT TYPE="text" NAME="PaysheetCode" id="PaysheetCode" size=12 readonly value=""style='BORDER-LEFT:none;BORDER-RIGHT:none;BORDER-TOP:none; border-bottom: none;'></td>
 </tr>
</table>
<table class=MsoTableGrid border=1 cellspacing=0 cellpadding=0 width=748
 style='width:591.2pt;margin-left:23.4pt;border-collapse:collapse;border:none;
 mso-border-alt:solid windowtext .5pt;mso-yfti-tbllook:480;mso-padding-alt:
 0cm 5.4pt 0cm 5.4pt;mso-border-insideh:.5pt solid windowtext;mso-border-insidev:
 .5pt solid windowtext'>
 <tr style='mso-yfti-irow:0;mso-yfti-firstrow:yes;height:27.75pt'>
  <td style='width:224.9pt;border:solid windowtext 1.0pt;mso-border-alt:
  solid windowtext .5pt;padding:0cm 5.4pt 0cm 5.4pt;height:27.75pt'>
   <font size=2><fmt:message key="paysheet.Dept"/>：</font> <INPUT TYPE="text" NAME="DeptName" size=24 readonly value="<%=self.getOaTblDepartment().getDeptName()%>"style='BORDER-LEFT:none;BORDER-RIGHT:none;BORDER-TOP:none; border-bottom: none;'>
  </td>
  <td width=488 colspan=12 style='width:366.3pt;border:solid windowtext 1.0pt;
  border-left:none;mso-border-left-alt:solid windowtext .5pt;mso-border-alt:
  solid windowtext .5pt;padding:0cm 5.4pt 0cm 5.4pt;height:27.75pt'>
  <font size=2><fmt:message key="paysheet.Receiver"/>：</font><INPUT TYPE="text" NAME="PaySellerName" id="PaySellerName" size=50 maxlength="80" value="<%=sheet==null?"":sheet.getPaySellerName()%>" style='BORDER-LEFT:none;BORDER-RIGHT:none;BORDER-TOP:none; border-bottom: none;'>
  <img id="image_sign" alt="<fmt:message key="paysheet.Self"/>" src="${ctx}/common/images/sign.png" style="cursor:hand;">
  </td>
 </tr>
 <tr style='mso-yfti-irow:2;height:27.75pt'>
  <td style='width:224.9pt;border:solid windowtext 1.0pt;border-top:
  none;mso-border-top-alt:solid windowtext .5pt;mso-border-alt:solid windowtext .5pt;
  padding:0cm 5.4pt 0cm 5.4pt;height:27.75pt'>
  <font size=2><fmt:message key="paysheet.SettleType"/>：</font>
  <input type="text" name=payTypeName value="<%=sheet==null?"":sheet.getPayType().getPayTypeName()%>" style="BORDER-LEFT:none;BORDER-RIGHT:none;BORDER-TOP:none; border-bottom: 1px solid black;" readonly onMouseOver="this.style.cursor='hand';" onclick="selectPayType()">
	<img src="${ctx}/common/images/showselect.gif" onMouseOver="this.style.cursor='hand';" onclick="selectPayType()" >
	<input type="hidden" name=payType value="<%=sheet==null?"":sheet.getPayType().getPayTypeId()%>">
  </td>
  <td width=488 colspan=12 style='width:366.3pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;
  mso-border-alt:solid windowtext .5pt;padding:0cm 5.4pt 0cm 5.4pt;height:27.75pt'>
  <font size=2><fmt:message key="paysheet.PlanPayDate"/>：</font>
  <INPUT TYPE="text" size=12 readonly NAME="PayDate" id="PayDate" value="<%=sheet==null?"":FormatUtil.formatDate("yyyy-MM-dd",sheet.getPlanPayDate())%>" onclick="WdatePicker({el:$dp.$('PayDate'),dateFmt:'yyyy-MM-dd',minDate:'<%=FormatUtil.formatDate("yyyy-MM-dd",now)%>',maxDate:'<%=FormatUtil.formatDate("yyyy-MM-dd",DateUtils.addDays(now,90))%>'});" style='BORDER-LEFT:none;BORDER-RIGHT:none;BORDER-TOP:none; border-bottom: none;cursor:hand;'>
  <img src="${ctx}/common/images/dateicon.gif" onclick="WdatePicker({el:$dp.$('PayDate'),dateFmt:'yyyy-MM-dd',minDate:'<%=FormatUtil.formatDate("yyyy-MM-dd",now)%>',maxDate:'<%=FormatUtil.formatDate("yyyy-MM-dd",DateUtils.addDays(now,90))%>'});" style="cursor:hand;">
  </td>
 </tr>
 <tr style='mso-yfti-irow:2;height:27.75pt'>
  <td style='width:224.9pt;border:solid windowtext 1.0pt;border-top:
  none;mso-border-top-alt:solid windowtext .5pt;mso-border-alt:solid windowtext .5pt;
  padding:0cm 5.4pt 0cm 5.4pt;height:27.75pt'>
  <font size="2.5"><fmt:message key="paysheet.BankNO"/>：</font><INPUT TYPE="text" NAME="PayAccount" id="PayAccount" size=24 <%=sheet==null?"":sheet.getPayType().getPayTypeId()==1?"disabled":"" %> value="<%=sheet==null?"":sheet.getPayAccount()%>" style='BORDER-LEFT:none;BORDER-RIGHT:none;BORDER-TOP:none; border-bottom: none;'> 
  </td>
  <td width=488 colspan=12 style='width:366.3pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;
  mso-border-alt:solid windowtext .5pt;padding:0cm 5.4pt 0cm 5.4pt;height:27.75pt'>
  <font size=2><fmt:message key="paysheet.BankName"/>：</font><INPUT TYPE="text" size=50 NAME="PayBank" id="PayBank" <%=sheet==null?"":sheet.getPayType().getPayTypeId()==1?"disabled":"" %> value="<%=sheet==null?"":sheet.getPayBank()%>" style='BORDER-LEFT:none;BORDER-RIGHT:none;BORDER-TOP:none; border-bottom: none;'>
  </td>
 </tr>
 <tr style='mso-yfti-irow:3;height:16.05pt;'>
  <td  colspan=2 rowspan=2  style='width:470.2pt;border:solid windowtext 1.0pt;
  border-top:none;mso-border-top-alt:solid windowtext .5pt;mso-border-alt:solid windowtext .5pt;
  padding:0;height:16.05pt'>
  <table height="100%" width="100%" border=0 cellspacing=0 cellpadding=0>
   <tr>
    <td style='padding:0cm 5.4pt 0cm 5.4pt;width:60pt;border-right:solid windowtext 1.0pt;'>
    <%
     Currency currency = null;
     if(sheet==null){
    	 CurrencyDAO dao = new CurrencyDAO();
         String currencyHQL = "from org.fuwushe.fi.domain.Currency where useStatus=0"; 
         List<Currency> currencyList = dao.queryByHQL(currencyHQL);
         if(currencyList.size()==1){
        	 currency = currencyList.get(0); 
         }
     }else{
    	 currency =  sheet.getCurrency();
     }    
    %>
    <font size=2><fmt:message key="paysheet.Currency"/>：</font><input type="text" name=currencyName value="<%=currency==null?"":currency.getCurrencyNo()%>" style="BORDER-LEFT:none;BORDER-RIGHT:none;BORDER-TOP:none; border-bottom: 1px solid black;width:30pt;" readonly onMouseOver="this.style.cursor='hand';" onclick="selectCurrency()">
    <input type="hidden" name=currencyId value="<%=currency==null?"":currency.getId()%>">
    </td>
    <td style='padding:0cm 5.4pt 0cm 5.4pt;cursor:hand;' onclick='usage()'><font size=2><fmt:message key="paysheet.TotalDX"/>：</font><INPUT TYPE="text" size=45 NAME="PayDX" id="PayDX" readonly value="<%=sheet==null?"":sheet.getPayMoneyDx()%>"style='BORDER-LEFT:none;BORDER-RIGHT:none;BORDER-TOP:none; border-bottom: none;'>
     <input name="PayXX" id="PayXX" type="hidden" value="<%=sheet==null?"":sheet.getPayMoneyXx()%>"></td>
   </tr>
  </table>
  </td>
  <td  style='width:10pt;border-top:none;border-left:none;border-bottom:
  solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;mso-border-top-alt:
  solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;mso-border-alt:
  solid windowtext .5pt;padding:0cm 5.4pt 0cm 5.4pt;height:16.05pt'>
  <font size=2>亿</font>
  </td>
  <td  style='width:10pt;border-top:none;border-left:none;border-bottom:
  solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;mso-border-top-alt:
  solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;mso-border-alt:
  solid windowtext .5pt;padding:0cm 5.4pt 0cm 5.4pt;height:16.05pt'>
  <font size=2>千</font>
  </td>
  <td  style='width:10pt;border-top:none;border-left:none;border-bottom:
  solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;mso-border-top-alt:
  solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;mso-border-alt:
  solid windowtext .5pt;padding:0cm 5.4pt 0cm 5.4pt;height:16.05pt'>
  <font size=2>百</font>
  </td>
  <td style='width:10pt;border-top:none;border-left:none;border-bottom:
  solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;mso-border-top-alt:
  solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;mso-border-alt:
  solid windowtext .5pt;padding:0cm 5.4pt 0cm 5.4pt;height:16.05pt'>
  <font size=2>十</font>
  </td>
  <td  style='width:10pt;border-top:none;border-left:none;border-bottom:
  solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;mso-border-top-alt:
  solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;mso-border-alt:
  solid windowtext .5pt;padding:0cm 5.4pt 0cm 5.4pt;height:16.05pt'>
  <font size=2>万</font>
  </td>
  <td  style='width:10pt;border-top:none;border-left:none;border-bottom:
  solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;mso-border-top-alt:
  solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;mso-border-alt:
  solid windowtext .5pt;padding:0cm 5.4pt 0cm 5.4pt;height:16.05pt'>
  <font size=2>千</font>
  </td>
  <td  style='width:10pt;border-top:none;border-left:none;border-bottom:
  solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;mso-border-top-alt:
  solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;mso-border-alt:
  solid windowtext .5pt;padding:0cm 5.4pt 0cm 5.4pt;height:16.05pt'>
  <font size=2>百</font>
  </td>
  <td  style='width:10pt;border-top:none;border-left:none;border-bottom:
  solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;mso-border-top-alt:
  solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;mso-border-alt:
  solid windowtext .5pt;padding:0cm 5.4pt 0cm 5.4pt;height:16.05pt'>
  <font size=2>十</font>
  </td>
  <td  style='width:10pt;border-top:none;border-left:none;border-bottom:
  solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;mso-border-top-alt:
  solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;mso-border-alt:
  solid windowtext .5pt;padding:0cm 5.4pt 0cm 5.4pt;height:16.05pt'>
  <font size=2>元</font>
  </td>
  <td  style='width:10pt;border-top:none;border-left:none;border-bottom:
  solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;mso-border-top-alt:
  solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;mso-border-alt:
  solid windowtext .5pt;padding:0cm 5.4pt 0cm 5.4pt;height:16.05pt'>
  <font size=2>角</font>
  </td>
  <td  style='width:10pt;border-top:none;border-left:none;border-bottom:
  solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;mso-border-top-alt:
  solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;mso-border-alt:
  solid windowtext .5pt;padding:0cm 5.4pt 0cm 5.4pt;height:16.05pt'>
  <font size=2>分</font>
  </td>
 </tr>
 <tr style='mso-yfti-irow:4;height:26.2pt;cursor:hand;' onclick='usage()'>
 <td  style='width:10pt;border-top:none;border-left:none;border-bottom:
  solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;mso-border-top-alt:
  solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;mso-border-alt:
  solid windowtext .5pt;padding:0cm 5.4pt 0cm 5.4pt;height:26.2pt'>
  <INPUT TYPE="text" NAME="Yi" size=1 maxlength=1 readonly style='BORDER-LEFT:none;BORDER-RIGHT:none;BORDER-TOP:none; border-bottom: none;width:10pt;'>
  </td>
 <td  style='width:10pt;border-top:none;border-left:none;border-bottom:
  solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;mso-border-top-alt:
  solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;mso-border-alt:
  solid windowtext .5pt;padding:0cm 5.4pt 0cm 5.4pt;height:26.2pt'>
  <INPUT TYPE="text" NAME="QianWan" size=1 maxlength=1 readonly style='BORDER-LEFT:none;BORDER-RIGHT:none;BORDER-TOP:none; border-bottom: none;width:10pt;'>
  </td>
  <td  style='width:10pt;border-top:none;border-left:none;border-bottom:
  solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;mso-border-top-alt:
  solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;mso-border-alt:
  solid windowtext .5pt;padding:0cm 5.4pt 0cm 5.4pt;height:26.2pt'>
  <INPUT TYPE="text" NAME="BaiWan" size=1 maxlength=1 readonly style='BORDER-LEFT:none;BORDER-RIGHT:none;BORDER-TOP:none; border-bottom: none;width:10pt;'>
  </td>
  <td  style='width:10pt;border-top:none;border-left:none;border-bottom:
  solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;mso-border-top-alt:
  solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;mso-border-alt:
  solid windowtext .5pt;padding:0cm 5.4pt 0cm 5.4pt;height:26.2pt'>
  <INPUT TYPE="text" NAME="ShiWan" size=1 maxlength=1  readonly style='BORDER-LEFT:none;BORDER-RIGHT:none;BORDER-TOP:none; border-bottom: none;width:10pt;'>
  </td>
  <td  style='width:10pt;border-top:none;border-left:none;border-bottom:
  solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;mso-border-top-alt:
  solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;mso-border-alt:
  solid windowtext .5pt;padding:0cm 5.4pt 0cm 5.4pt;height:26.2pt'>
  <INPUT TYPE="text" NAME="Wan" size=1 maxlength=1  readonly style='BORDER-LEFT:none;BORDER-RIGHT:none;BORDER-TOP:none; border-bottom: none;width:10pt;'>
  </td>
  <td  style='width:10pt;border-top:none;border-left:none;border-bottom:
  solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;mso-border-top-alt:
  solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;mso-border-alt:
  solid windowtext .5pt;padding:0cm 5.4pt 0cm 5.4pt;height:26.2pt'>
  <INPUT TYPE="text" NAME="Qian" size=1 maxlength=1  readonly style='BORDER-LEFT:none;BORDER-RIGHT:none;BORDER-TOP:none; border-bottom: none;width:10pt;'>
  </td>
  <td  style='width:10pt;border-top:none;border-left:none;border-bottom:
  solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;mso-border-top-alt:
  solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;mso-border-alt:
  solid windowtext .5pt;padding:0cm 5.4pt 0cm 5.4pt;height:26.2pt'>
  <INPUT TYPE="text" NAME="Bai" size=1 maxlength=1  readonly style='BORDER-LEFT:none;BORDER-RIGHT:none;BORDER-TOP:none; border-bottom: none;width:10pt;'>
  </td>
  <td  style='width:10pt;border-top:none;border-left:none;border-bottom:
  solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;mso-border-top-alt:
  solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;mso-border-alt:
  solid windowtext .5pt;padding:0cm 5.4pt 0cm 5.4pt;height:26.2pt'>
  <INPUT TYPE="text" NAME="Shi" size=1 maxlength=1  readonly style='BORDER-LEFT:none;BORDER-RIGHT:none;BORDER-TOP:none; border-bottom: none;width:10pt;'>
  </td>
  <td  style='width:10pt;border-top:none;border-left:none;border-bottom:
  solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;mso-border-top-alt:
  solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;mso-border-alt:
  solid windowtext .5pt;padding:0cm 5.4pt 0cm 5.4pt;height:26.2pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-bidi-font-size:10.5pt;
  font-family:宋体'><o:p><INPUT TYPE="text" NAME="Yuan"  size=1 maxlength=1 readonly style='BORDER-LEFT:none;BORDER-RIGHT:none;BORDER-TOP:none; border-bottom: none;width:10pt;'></o:p></span></p>
  </td>
  <td  style='width:10pt;border-top:none;border-left:none;border-bottom:
  solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;mso-border-top-alt:
  solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;mso-border-alt:
  solid windowtext .5pt;padding:0cm 5.4pt 0cm 5.4pt;height:26.2pt'>
  <INPUT TYPE="text" NAME="Jiao" size=1 maxlength=1  readonly style='BORDER-LEFT:none;BORDER-RIGHT:none;BORDER-TOP:none; border-bottom: none;width:10pt;'>
  </td>
  <td  style='width:10pt;border-top:none;border-left:none;border-bottom:
  solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;mso-border-top-alt:
  solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;mso-border-alt:
  solid windowtext .5pt;padding:0cm 5.4pt 0cm 5.4pt;height:26.2pt'>
  <INPUT TYPE="text" NAME="Fen" size=1 maxlength=1 readonly style='BORDER-LEFT:none;BORDER-RIGHT:none;BORDER-TOP:none; border-bottom: none;width:10pt;'>
  </td>
 </tr>
 <tr style='mso-yfti-irow:5;height:27.75pt;cursor:hand;' onclick='usage()'>
  <td width=748 colspan=13 style='width:591.2pt;border:solid windowtext 1.0pt;
  border-top:none;mso-border-top-alt:solid windowtext .5pt;mso-border-alt:solid windowtext .5pt;
  padding:0cm 5.4pt 0cm 5.4pt;height:27.75pt'>
  <input type="hidden" name="payUsageDetails">
  <font size=2><fmt:message key="paysheet.Usage"/>：</font><INPUT TYPE="text" NAME="PayUsage" id="PayUsage"size=110  value="<%=sheet==null?"":sheet.getPayUsage()%>" readonly style='BORDER-LEFT:none;BORDER-RIGHT:none;BORDER-TOP:none; border-bottom: none;cursor:hand;'>
  </td>
 </tr>
 <tr style='mso-yfti-irow:6;mso-yfti-lastrow:yes;height:27.75pt'>
  <td width=748 colspan=13 style='width:591.2pt;border:solid windowtext 1.0pt;
  border-top:none;mso-border-top-alt:solid windowtext .5pt;mso-border-alt:solid windowtext .5pt;
  padding:0cm 5.4pt 0cm 5.4pt;height:27.75pt'>
  <font size=2><fmt:message key="paysheet.Remark"/>：</font><INPUT TYPE="text" NAME="PayMemo" id="PayMemo" value="<%=sheet==null?"":sheet.getPayMemo()%>" size=110 maxlength=200 style='BORDER-LEFT:none;BORDER-RIGHT:none;BORDER-TOP:none; border-bottom: none;'>
  </td>
 </tr>
 <tr style='mso-yfti-irow:6;mso-yfti-lastrow:yes;height:27.75pt'>
  <td width=748 colspan=13 style='width:591.2pt;border:solid windowtext 1.0pt;
  border-top:none;mso-border-top-alt:solid windowtext .5pt;mso-border-alt:solid windowtext .5pt;
  padding:0cm 5.4pt 0cm 5.4pt;height:27.75pt'>
  <font size=2><fmt:message key="paysheet.Attachment"/>：<a href="###" onclick="parent.toolframe.upload();"><img src="${ctx}/common/images/toolbar/add.gif" border=0/><fmt:message key="paysheet.AddAttach"/></a></font>
  <div id="div_filelist" style="font-size:13px;">
  <%
  if(sheet!=null){
	 Iterator<PaySheetAttachment> iter = sheet.getPaySheetAttachments().iterator();
	 UploadSessionManager uploadmanager = new UploadSessionManager();
	 session.setAttribute("upload_"+uuid,uploadmanager);
 
   int size = 0;
   while(iter.hasNext()){ 
	 size ++;
	 PaySheetAttachment attach = iter.next();
	 File localFile = new File(attach.getAttachUrl());
	 UploadFile uploadfile = new UploadFile();
	 uploadfile.setFileId(size);
	 uploadfile.setFileType(StringUtil.getFileType(attach.getAttachName(), "unkown"));
	 uploadfile.setRealFileName(attach.getAttachName());
	 uploadfile.setServerFile(localFile);
	 uploadmanager.getUploadfilelist().add(uploadfile);
	 uploadmanager.setFileCount(size);
  %>
    <div align=left id="div_file_<%=size%>" style="font-size:13px;">
     <img src="${ctx}/common/images/fileicons/<%=StringUtil.getFileType(attach.getAttachName(),"unkown")%>.gif"><br>
     <a href="${ctx}/contract.do?actionmethod=downloadpayattach&attachId=<%=attach.getId()%>">
      <%=attach.getAttachName()%>
     </a>&nbsp;&nbsp;
     <img src="${ctx}/common/images/toolbar/delete.gif" width="13" height="13" style="cursor:hand;"  title="<fmt:message key="paysheet.DelThisAttach"/>" onclick="removefile('<%=size%>','false')"/>
     <div style="height:20"></div>
   </div>
  <%} }%>
  </div>
  </td>
 </tr>
 <tr height=0>
  <td style='border:none'></td>
  <td width=235 style='border:none'></td>
  <td width=26 style='border:none'></td>
  <td width=28 style='border:none'></td>
  <td width=28 style='border:none'></td>
  <td width=28 style='border:none'></td>
  <td width=28 style='border:none'></td>
  <td width=28 style='border:none'></td>
  <td width=28 style='border:none'></td>
  <td width=28 style='border:none'></td>
  <td width=28 style='border:none'></td>
  <td width=28 style='border:none'></td>
  <td width=28 style='border:none'></td>
 </tr>
</table>
<input type="hidden" name="usageJSON" value="">
<ul id="myMenu" class="contextMenu">
	<li><a href="###" onclick="selectSelf();"><fmt:message key="paysheet.Self"/></a></li>
	<li><a href="###" onclick="selectSeller();"><fmt:message key="contract.Seller"/></a></li>
</ul>
</body>
<script type="text/javascript">
function selectPayType(){
	var sRtn;
	 var y= window.event.y;
	 y = y+130;
	 var x = window.event.x;
	 x = x+120;
	 sRtn = window.showModalDialog("${ctx}/common/selecttree/paytype.jsp?selecttype=attribute&useStatus=0",self,"dialogHeight: 400px; dialogWidth:300px;dialogTop:"+y+";dialogLeft: "+x+";center: yes; status=no");
	 if (sRtn && sRtn!=""){
	 var values = sRtn.split('@@@');
	  document.all.payType.value = values[0];
	  document.all.payTypeName.value = values[1];
	  if(values[0]==1){
		document.all.PayAccount.value = '';
		document.all.PayBank.value ='';
		document.all.PayAccount.disabled = true;
		document.all.PayBank.disabled = true;
	  }else{
		document.all.PayAccount.disabled = false;
		document.all.PayBank.disabled = false;
	  }
	 }
}
function selectCurrency(){
	var sRtn;
	 var y= window.event.y;
	 y = y+130;
	 var x = window.event.x;
	 x = x+120;
	 sRtn = window.showModalDialog("${ctx}/common/selecttree/currency.jsp?selecttype=attribute&useStatus=0",self,"dialogHeight: 400px; dialogWidth:300px;dialogTop:"+y+";dialogLeft: "+x+";center: yes; status=no");
	 if (sRtn && sRtn!=""){
	 var values = sRtn.split('@@@');
	  document.all.currencyId.value = values[0];
	  document.all.currencyName.value = values[1];
	 }
}
function selectSeller(){
	  var retvalue = window.showModalDialog("${ctx}/common/selectseller/index.jsp",self,"dialogHeight:600px; dialogWidth:800px;dialogTop:200;dialogLeft: 400;center: yes; status=no");
	  if(retvalue){
		var values = retvalue.split(',');
		document.all.PaySellerName.value = values[2];		
		document.all.PayBank.value = values[3];
		document.all.PayAccount.value = values[4];
	  }
}
function selectSelf(){
	$('#PaySellerName').val('<%=self.getEmpName()%>');
	document.all.PayBank.value = '';
	document.all.PayAccount.value = '';
}	
function usage(){
	var screenwidth=1020;
	var screenheight=screen.height;
	var retValue = window.showModalDialog('usage.jsp',self,'dialogHeight: '+screenheight+'px; dialogWidth: '+screenwidth+'px;dialogTop: 120;dialogLeft: 188;center: yes; status=no');
	if(retValue){
	  document.all.usageJSON.value = retValue;
	  var paysheet = $.json.decode(retValue);
	  usageToSheet(paysheet.totalMoneyXx);
	  var payusagestr = '';
	  var usageList = paysheet.usageList;
	  for(var i=0;i<usageList.length;i++){
		 var usage = usageList[i];
		 payusagestr +=usage.categoryName+'—'+usage.usageMoney+'；';
	  }
	  document.all.PayUsage.value = payusagestr;
	}
}
</script>
</html>
