/** * 初始化行信息 * * @param isAdd 是否时添加 * @param isInit 是否从新初始化 */ private final void initRowInfo(boolean isAdd, boolean isInit) { if (d_RowInfos == null) d_RowInfos = new ArrayList(dsBatchAddTable.getRowCount()); else if (isInit) d_RowInfos.clear(); dsBatchAddTable.first(); for (int i = 0; i < dsBatchAddTable.getRowCount(); i++) { RowMap row = new RowMap(dsBatchAddTable); d_RowInfos.add(row); dsBatchAddTable.next(); } }
/** * 初始化列信息 * * @param isAdd 是否时添加 * @param isInit 是否从新初始化 * @throws java.lang.Exception 异常 */ private final void initRowInfo(boolean isMaster, boolean isAdd, boolean isInit) throws java.lang.Exception { // 是否是主表 if (isMaster) { if (isInit && m_RowInfo.size() > 0) m_RowInfo.clear(); // 清除旧数据 if (!isAdd) m_RowInfo.put(getMaterTable()); // 不是新增时,推入主表当前行 } else { EngineDataSet dsDetail = dsDetailTable; if (d_RowInfos == null) d_RowInfos = new ArrayList(dsDetail.getRowCount()); else if (isInit) d_RowInfos.clear(); dsDetail.first(); for (int i = 0; i < dsDetail.getRowCount(); i++) { RowMap row = new RowMap(dsDetail); d_RowInfos.add(row); dsDetail.next(); } } }
public void execute(String action, Obationable o, RunData data, Object arg) throws Exception { initQueryItem(data.getRequest()); fixedQuery.setSearchValue(data.getRequest()); String SQL = fixedQuery.getWhereQuery(); // 得到WHERE子句 if (SQL.length() > 0) SQL = " AND " + SQL; SQL = SQL + " AND (storeid='" + storeid + "' or storeid is null) "; if (!personid.equals("")) SQL = SQL + " AND personid='" + personid + "'"; if (!khlx.equals("")) SQL = SQL + " AND khlx='" + khlx + "'"; if (!dwtxid.equals("")) SQL = SQL + " AND dwtxid='" + dwtxid + "'"; if (!jsfsid.equals("")) SQL = SQL + " AND jsfsid='" + jsfsid + "'"; EngineDataSet tmp = new EngineDataSet(); SQL = combineSQL( HTHW_SQL, "?", new String[] {user.getHandleDeptWhereValue("deptid", "czyid"), fgsid, SQL}); setDataSetProperty(tmp, SQL); tmp.open(); StringBuffer buf = null; ArrayList contain = new ArrayList(); tmp.first(); for (int i = 0; i < tmp.getRowCount(); i++) { String htid = tmp.getValue("htid"); if (!contain.contains(htid)) { contain.add(htid); if (buf == null) buf = new StringBuffer("AND htid IN(").append(htid); else buf.append(",").append(htid); } tmp.next(); } if (buf == null) buf = new StringBuffer(); else buf.append(")"); SQL = buf.toString(); if (SQL.equals("")) SQL = " and 1<>1 "; SQL = combineSQL(MASTER_SQL, "?", new String[] {SQL}); if (!dsMasterTable.getQueryString().equals(SQL)) { dsMasterTable.setQueryString(SQL); dsMasterTable.setRowMax(null); // 以便dbNavigator刷新数据集 } openDetailTable(true); }
public void execute(String action, Obationable o, RunData data, Object arg) throws Exception { retuUrl = data.getParameter("src"); retuUrl = retuUrl != null ? retuUrl.trim() : retuUrl; HttpServletRequest request = data.getRequest(); storeid = request.getParameter("storeid"); // 必选 sendmodeid = request.getParameter("sendmodeid"); // djlx = request.getParameter("djlx"); // khlx = request.getParameter("khlx"); // 非必选 dwtxid = request.getParameter("dwtxid"); // 非必选 personid = request.getParameter("personid"); // 非必选 jsfsid = request.getParameter("jsfsid"); // 非必选 yfdj = request.getParameter("yfdj"); // if (storeid.equals("")) return; String SQL = " AND (storeid='" + storeid + "' or storeid is null) "; if (!khlx.equals("")) SQL = SQL + " AND khlx='" + khlx + "' "; if (!dwtxid.equals("")) SQL = SQL + " AND dwtxid='" + dwtxid + "' "; if (!personid.equals("")) SQL = SQL + " AND personid='" + personid + "' "; if (!jsfsid.equals("")) SQL = SQL + " AND jsfsid='" + jsfsid + "' "; if (!sendmodeid.equals("")) SQL = SQL + " AND sendmodeid='" + sendmodeid + "' "; if (!yfdj.equals("")) SQL = SQL + " AND yfdj='" + yfdj + "' "; srcFrm = request.getParameter("srcFrm"); multiIdInput = request.getParameter("srcVar"); // if(storeid.equals("")||djlx.equals("")||dwtxid.equals("")||personid.equals("")||khlx.equals("")) // return; masterProducer.init(request, loginId); detailProducer.init(request, loginId); // 初始化查询项目和内容 RowMap row = fixedQuery.getSearchRow(); row.clear(); String today = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); String startDay = new SimpleDateFormat("yyyy-MM-01").format(new Date()); row.put("htrq$a", startDay); row.put("htrq$b", today); row.put("zt", "0"); isMasterAdd = true; EngineDataSet tmp = new EngineDataSet(); SQL = combineSQL( HTHW_SQL, "?", new String[] {user.getHandleDeptWhereValue("deptid", "czyid"), fgsid, SQL}); setDataSetProperty(tmp, SQL); tmp.open(); StringBuffer buf = null; ArrayList contain = new ArrayList(); tmp.first(); for (int i = 0; i < tmp.getRowCount(); i++) { String htid = tmp.getValue("htid"); if (!contain.contains(htid)) { contain.add(htid); if (buf == null) buf = new StringBuffer("AND htid IN(").append(htid); else buf.append(",").append(htid); } tmp.next(); } if (buf == null) buf = new StringBuffer(); else buf.append(")"); SQL = buf.toString(); if (SQL.equals("")) SQL = " and 1<>1 "; // String SQL = " AND jsfsid='"+jsfsid+"' AND personid='"+personid+"' AND khlx ='"+khlx+"' // AND dwtxid ='"+dwtxid+"' AND (storeid='"+storeid+"' or storeid is null) "; SQL = combineSQL(MASTER_SQL, "?", new String[] {SQL}); dsMasterTable.setQueryString(SQL); dsMasterTable.setRowMax(null); if (dsDetailTable.isOpen() && dsDetailTable.getRowCount() > 0) dsDetailTable.empty(); }
/** * 初始化列信息 * * @param isAdd 是否时添加 * @param isInit 是否从新初始化 * @throws java.lang.Exception 异常 */ private final void initRowInfo(boolean isInit) throws java.lang.Exception { /** 本月销售* */ double zxsje = 0; double zjje = 0; if (d_XsInfos == null) d_XsInfos = new ArrayList(dsXsTable.getRowCount()); if (isInit) d_XsInfos.clear(); else { dsXsTable.first(); for (int i = 0; i < dsXsTable.getRowCount(); i++) { RowMap row = new RowMap(dsXsTable); String xsje = dsXsTable.getValue("xsje"); zxsje = zxsje + Double.parseDouble(xsje.equals("") ? "0" : xsje); String jje = dsXsTable.getValue("jje"); zjje = zjje + Double.parseDouble(jje.equals("") ? "0" : jje); d_XsInfos.add(row); dsXsTable.next(); } } /** 本月收款* */ double zjsje = 0; if (d_JsInfos == null) d_JsInfos = new ArrayList(dsJsTable.getRowCount()); if (isInit) d_JsInfos.clear(); else { dsJsTable.first(); for (int i = 0; i < dsJsTable.getRowCount(); i++) { RowMap row = new RowMap(dsJsTable); String je = dsJsTable.getValue("je"); zjsje = zjsje + Double.parseDouble(je.equals("") ? "0" : je); d_JsInfos.add(row); dsJsTable.next(); } } /** 本月退货* */ double zthje = 0; if (d_ThInfos == null) d_ThInfos = new ArrayList(dsThTable.getRowCount()); if (isInit) d_ThInfos.clear(); else { dsXsTable.first(); for (int i = 0; i < dsThTable.getRowCount(); i++) { RowMap row = new RowMap(dsThTable); String tjje = dsThTable.getValue("tjje"); zthje = zthje + Double.parseDouble(tjje.equals("") ? "0" : tjje); d_ThInfos.add(row); dsThTable.next(); } } /** 其他应收款* */ double zfy = 0; if (d_QtInfos == null) d_QtInfos = new ArrayList(dsQtTable.getRowCount()); if (isInit) d_QtInfos.clear(); else { dsQtTable.first(); for (int i = 0; i < dsQtTable.getRowCount(); i++) { RowMap row = new RowMap(dsQtTable); String fy = dsQtTable.getValue("fy"); zfy = zfy + Double.parseDouble(fy.equals("") ? "0" : fy); d_QtInfos.add(row); dsQtTable.next(); } } masterRow.put("zxsje", String.valueOf(zxsje)); masterRow.put("zjje", String.valueOf(zjje)); masterRow.put("zjsje", String.valueOf(zjsje)); masterRow.put("zthje", String.valueOf(zthje)); masterRow.put("zfy", String.valueOf(zfy)); // masterRow.put("zsk",String.valueOf(zjsje+zfy)); }