<%@page import="com.amarsoft.dict.als.manage.NameManager"%> <%@page import="com.amarsoft.dict.als.manage.CodeManager"%> <%@page import="com.amarsoft.biz.finance.*" %> <%@ page contentType="text/html; charset=GBK"%> <%@ include file="/IncludeBegin.jsp"%> <%@ include file="/Resources/CodeParts/progressSet.jsp"%> <% /* Describe: 显示和操作指定报表流水号的财务报表 Input Param: ReportNo: 指定报表流水号 Operation: 操作类型 HistoryLog: sxjiang 2010/07/22 统一财务报表单位(元、千元、万元)与精度(小数点后位数)的规范 去掉DataConvert.toMoney函数 */ //定义变量 int i = 0,iColCount = 0,iHalfRowCount = 0; String sAlertStirng = "",sCreditColumn1Value = "",sCreditColumn2Value = "",sDebitColumn1Value = "",sDebitColumn2Value = ""; String[] sTitle = null; Report rReport = null; double dDiff1 = 0.00,dDiff2 = 0.00; String sStyle = ""; boolean isEditable=true; SqlObject so = null; String sNewSql = ""; //获得组件参数 String sReportNo = CurPage.getParameter("ReportNo"); String sRole = CurPage.getParameter("Role"); String sCustomerID = CurPage.getParameter("CustomerID"); String sRecordNo = CurPage.getParameter("RecordNo"); String sEditable = CurPage.getParameter("Editable"); if("false".equals(sEditable))isEditable=false; String sOperation = CurPage.getParameter("Operation"); //将空值转化为空字符串 if(sReportNo == null) sReportNo = ""; if(sRole == null) sRole = ""; if(sCustomerID == null) sCustomerID = ""; if(sRecordNo == null) sRecordNo = ""; if(sOperation == null) sOperation=""; //构造报表对象 rReport = new Report(sReportNo); //获得客户名称 String sCustomerName =JBOFactory.createBizObjectQuery("jbo.app.tenwa.customer.CUSTOMER_INFO", "customerid=:customerid").setParameter("customerid", sCustomerID).getSingleResult(false).getAttribute("customername").getString(); String sReportUnitName = CodeManager.getItemName("ReportUnit", rReport.ReportUnit); if(sReportUnitName == null) sReportUnitName = "元"; String sReportName = rReport.ReportName; java.text.NumberFormat nf = java.text.NumberFormat.getInstance(); if(sReportUnitName.equals("元")){ nf.setMinimumFractionDigits(2); nf.setMaximumFractionDigits(2); }else if(sReportUnitName.equals("千元")){ nf.setMinimumFractionDigits(4); nf.setMaximumFractionDigits(4); }else{ nf.setMinimumFractionDigits(2); nf.setMaximumFractionDigits(2); } if( sOperation.equals("save")){ rReport.updateRows(request); rReport.save(); sNewSql = "Update customer_fsrecord set OrgID=:OrgID,UserID=:UserID,UpdateDate=:UpdateDate where RecordNo=:RecordNo"; so = new SqlObject(sNewSql); so.setParameter("OrgID",CurOrg.getOrgID()); so.setParameter("UserID",CurUser.getUserID()); so.setParameter("UpdateDate",StringFunction.getToday()); so.setParameter("RecordNo",sRecordNo); Sqlca.executeSQL(so); sAlertStirng = "报表保存成功"; %> <% }else if(sOperation.equals("calc")){ rReport.updateRows(request); rReport.calculate(); //判断是否为资产负债表 if(rReport.getReportRowBySubject("804")==null||rReport.getReportRowBySubject("809")==null){ sNewSql = "Update customer_fsrecord set OrgID=:OrgID,UserID=:UserID,UpdateDate=:UpdateDate where RecordNo=:RecordNo"; so = new SqlObject(sNewSql); so.setParameter("OrgID",CurOrg.getOrgID()); so.setParameter("UserID",CurUser.getUserID()); so.setParameter("UpdateDate",StringFunction.getToday()); so.setParameter("RecordNo",sRecordNo); Sqlca.executeSQL(so); sAlertStirng = "报表测算成功"; }else{ //取得总资产 sCreditColumn1Value = rReport.getReportRowBySubject("804").ColDisplay[0]; //期初数 sCreditColumn2Value = rReport.getReportRowBySubject("804").ColDisplay[1]; //期末数 //取得总负债 sDebitColumn1Value = rReport.getReportRowBySubject("809").ColDisplay[0]; //期初数 sDebitColumn2Value = rReport.getReportRowBySubject("809").ColDisplay[1]; //期末数 //期初数比较 //dDiff1 = Double.parseDouble(sCreditColumn1Value) - Double.parseDouble(sDebitColumn1Value); //期末数比较 dDiff2 = Double.parseDouble(sCreditColumn2Value) - Double.parseDouble(sDebitColumn2Value); //if(Math.abs(dDiff1) > 0.00001 ){ // sAlertStirng = sAlertStirng+"年初值:负债比资产小"+DataConvert.toMoney(dDiff1); //} if(Math.abs(dDiff2) > 0.00001 ){ sAlertStirng = " "+sAlertStirng+" 期末值:负债比资产小"+DataConvert.toMoney(dDiff2); } if(sAlertStirng==null||sAlertStirng.equals("")){ sAlertStirng = "报表平衡!"; }else{ sAlertStirng = "报表不平衡! "+sAlertStirng; } } %> <% } // 获得报表显示方式 if(rReport.DisplayMethod.equals("1")) iColCount = 4; // 单栏 else if (rReport.DisplayMethod.equals("2")) iColCount = 8; // 双栏 else iColCount = 3; // 单项 sTitle = new String[iColCount]; //获得表头 StringTokenizer st = new StringTokenizer(rReport.HeaderMethod,"&"); while (st.hasMoreTokens()){ sTitle[i++] = st.nextToken("&"); } %> >
  <%=sCustomerName+" >> "+rReport.ReportDate+" >> "+((rReport.ReportScope.equals("01"))?"合并":(rReport.ReportScope.equals("02")?"本部":"汇总"))+" >> "+rReport.ReportName+">> "+rReport.ModelType%>  <% if(sRole.equals("has") && isEditable){%> <%-- <%=new Button("导 入","导入财务报表数据","importReport()","","").getHtmlText()%> <%=new Button("清 空","清空财务报表","clearReport()","","").getHtmlText()%> --%> <%=new Button("保 存","保存财务报表","saveReport()","","btn_icon_save").getHtmlText()%>
<%=new Button("测 算","测算财务报表","calcReport()","","btn_icon_finish").getHtmlText()%>
<% }%> <%//=new Button("转出至电子表格","转出至电子表格","spreadsheetTransfer(formatContent());","","").getHtmlText()%> <%//=new Button("转出至电子表格","转出至电子表格","AsControl.ExportFinanceReport('"+rReport.ReportNo+"')","","btn_icon_export").getHtmlText()%>
 
<% for(i=0;i <% } %> <% String sRowAttribute,sStyle1,sStyle2,sReadOnly1,sReadOnly2,sNameC,sNameC2,sName1,sName2,sName3,sName4; String sCol1Value,sCol2Value; String rowNameL = null;//当单列的时候,只使用rowNameL String rowNameR = null; // 生成表样及每个字段的名称 if (rReport.DisplayMethod.equals("1") || rReport.DisplayMethod.equals("3")){ // 单栏/单项显示 for(i=0;i <% } if( rReport.DisplayMethod.equals("3")){ %> <% } } }else{ // 双栏显示 iHalfRowCount = rReport.ReportRows.length/2; for(i=0;i <% } } %>
<%=sTitle[i]%>
<%=StringFunction.replace(rReport.ReportRows[i].RowName," "," ")%> > onfocus="setHighLight(this);this.select();" onkeyup="moveFocus('<%=sName1%>')" name=<%=sName1%> value='<%=nf.format(Double.parseDouble(rReport.ReportRows[i].ColDisplay[0]))%>'> onfocus="setHighLight(this);this.select();" onkeyup="moveFocus('<%=sName2%>')" name=<%=sName2%> value='<%=nf.format(Double.parseDouble(rReport.ReportRows[i].ColDisplay[1]))%>'>
<%=rowNameL%> > <% if(sReportName.indexOf("指标表") > -1){%> onfocus="setHighLight(this);this.select();" onkeyup="moveFocus('<%=sName2%>')" name=<%=sName2%> value='<%=DataConvert.toMoney(Double.parseDouble(rReport.ReportRows[i].ColDisplay[1]))%>'> <%}else{ %> onfocus="setHighLight(this);this.select();" onkeyup="moveFocus('<%=sName2%>')" name=<%=sName2%> value='<%=nf.format(Double.parseDouble(rReport.ReportRows[i].ColDisplay[1]))%>'> <%} %>
<%=rowNameL%> > onfocus="setHighLight(this);this.select();" onkeyup="moveFocus('<%=sName2%>')" name=<%=sName2%> value='<%=nf.format(Double.parseDouble(rReport.ReportRows[i].ColDisplay[1]))%>'> onfocus="setHighLight(this);this.select();" onkeyup="moveFocus('<%=sName1%>')" name=<%=sName1%> value='<%=nf.format(Double.parseDouble(rReport.ReportRows[i].ColDisplay[0]))%>'> <%=rowNameR%> > onblur="javascript:amarMoneyControl('<%=sName4%>');unsetHighLight(this,'<%=sReportName %>','<%=sReportUnitName %>');" onfocus="setHighLight(this);this.select();" onkeyup="moveFocus('<%=sName4%>')"name=<%=sName4%> value='<%=nf.format(Double.parseDouble(rReport.ReportRows[i+iHalfRowCount].ColDisplay[1]))%>'> onblur="javascript:amarMoneyControl('<%=sName3%>');unsetHighLight(this,'<%=sReportName %>','<%=sReportUnitName %>');" onfocus="setHighLight(this);this.select();" onkeyup="moveFocus('<%=sName3%>')" name=<%=sName3%> value='<%=nf.format(Double.parseDouble(rReport.ReportRows[i+iHalfRowCount].ColDisplay[0]))%>'>
  <%=sCustomerName+" >> "+rReport.ReportDate+" >> "+((rReport.ReportScope.equals("01"))?"合并":(rReport.ReportScope.equals("02")?"本部":"汇总"))+" >> "+rReport.ReportName+">> "+rReport.ModelType%>  <% if(sRole.equals("has") && isEditable){%> <%-- <%=new Button("导 入","导入财务报表数据","importReport()","","").getHtmlText()%> <%=new Button("清 空","清空财务报表","clearReport()","","").getHtmlText()%> --%> <%=new Button("保 存","保存财务报表","saveReport()","","btn_icon_save").getHtmlText()%>
<%=new Button("测 算","测算财务报表","calcReport()","","btn_icon_finish").getHtmlText()%>
<% }%> <%//=new Button("转出至电子表格","转出至电子表格","newExportToExcel(this);","","").getHtmlText()%> <%-- <%=new Button("转出至电子表格","转出至电子表格","spreadsheetTransfer(formatContent());","","btn_icon_export").getHtmlText()%> --%> <%=new Button("转出至电子表格","转出至电子表格","AsControl.ExportFinanceReport('"+rReport.ReportNo+"')","","btn_icon_export").getHtmlText()%>
 
<%@ include file="/IncludeEnd.jsp"%>