<%@ page contentType="text/html;charset=gbk" %>
<%@ page import="java.util.*" %>
<%@ page import="net.sz600.tool.SzDateHelp"%>
<%@ page import="net.sz600.basicdata.*" %>
<%@ page import="net.sz600.tool.SzConvert" %>
<%@ page import="net.sz600.database.SzPageInfo" %>
<%@ page import="net.sz600.system.*" %>
<%@ page import="net.sz600.stat.*" %>
<%@ include file="/sessionInfo.jsp"%>

<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gbk">
<link href="<%=strSkin_SESSION%>/css2007.css" rel="stylesheet" type="text/css">
<script language="javascript" src="../../../share/js/commonTool.js"></script>
</head>
<%
	

	//获取选择的客户名称
	String KHMC = SzConvert.strWriteData(request.getParameter("KHMC"));
	//业务人员
	String YGXM = SzConvert.strWriteData(request.getParameter("YGXM"));
	
	StringBuffer sCond = new StringBuffer("");
	
	//获取对象信息
	Customer customer = new Customer();
	
	String searchStr = customer.getStat_SQL("KH.KHXXMC5",KHMC,"KH.KHXXMC19",YGXM,"", "", "", "");
	ArrayList KHList = customer.getKH_KH_List(searchStr);
	int KHListSize = KHList.size(); 
	
	
%>
<!-----上面的工具栏------>
<%@ include file="/share/title.jsp"%>
<table width="100%">
  <form name="formBar" method="post">
  <tr>
  	<td valign="bottom" style="padding-bottom: 5px;padding-top: 5px;" align="center">
  		<h4 style="display: inline;">客户业务数据统计</h4>
  	</td>
  </tr>
  <tr>
    <td>
      客户名称<input type="text" name="KHMC" class="txtClassSearch" value="<%=KHMC%>">
      业务人员<input type="text" name="YGXM" class="txtClassSearch" value="<%=YGXM%>">
      <%=SzPageHelp.button("查询", "javascript:FormSubmit(formBar,'stat_customer.jsp');")%>
    </td>
  </tr>
  </form>
</table>

<!-----信息列表----->
<table width="100%" border="1" bordercolorlight="#C0C0C0" bordercolordark="#FFFFFF" class="tableClass" cellpadding="1" cellspacing="0">
  <form name="formList" method="post">
  <tr class="trClassTitle_c">
    <td>客户名称</td>
    <td>业务人员</td>
    <td>合同总金额</td>
    <td>总已收款(元)</td>
    <td>总应收款(元)</td>
  </tr>
<%

	StringBuffer outSB = new StringBuffer();
	int spanRowCount = 0;
	int rowCount = 0;
	int count = 0;
	int uCont = 0;
	int departCount = 0;
	double money = 0;
	int sum = 0;
	Object obj = null;
	Object objvalue[] = null;
	double[] sumValue = new double[3];
	int sumValueLength = sumValue.length;
    for (int i=0;i<KHListSize;i++){
    	obj = KHList.get(i);
    	objvalue = obj != null? (Object[])obj:null;
    	
    	if (objvalue!=null){
			int objvaluelen = objvalue.length;
			out.println("<tr align=\"center\">");
			for (int j = 0;j < objvaluelen; j++){
				if (j-2 >= 0){
			         money = objvalue!=null? Double.valueOf(objvalue[j].toString()):0;
			         sumValue[j-2] = sumValue[j-2] + money;
			         if (j == objvaluelen-1 && money > 0){
			        	 out.println("<td align=\"center\" style=\"color: red;\">"+ objvalue[j] +"&nbsp;</td>");
			         } else {
			        	 out.println("<td align=\"center\">"+ objvalue[j] +"&nbsp;</td>");
			         }
				} else {
					out.println("<td align=\"center\">"+ objvalue[j] +"&nbsp;</td>");
				}
			}
			out.println("</tr>");
    	}
    }
    out.println("<tr class=\"trClassTitle2\" align=\"center\">");
    out.println("<td style=\"color: red;\">合计</td>");
    out.println("<td>&nbsp;</td>");
    for (int j = 0;j<sumValueLength;j++) {
   		out.println("<td align=\"center\">"+ SzConvert.formatFloat2Str(sumValue[j]) +"&nbsp;</td>");
    }
    out.println("<tr>");
    
    KHList = null;
    
%>

  </form>
</table>

<!-----下面的工具栏------>
<table width="100%">
  <form name="formPage" method="post">
  </form>
</table>

<!-----这里包含要提交的内容--->
<form name="formHidden" method="post">
</form>
<%
    ////如果要使用日历控件，必须输出这个calendarFrame
    out.println(SzPageHelp.calendar2Frame("../../../"));
%>