/** * 从表保存操作 * * @param request 网页的请求对象 * @param response 网页的响应对象 * @return 返回HTML或javascipt的语句 * @throws Exception 异常 */ private final void putDetailInfo(HttpServletRequest request) { RowMap rowInfo = getMasterRowinfo(); // 保存网页的所有信息 rowInfo.put(request); int rownum = d_RowInfos.size(); RowMap detailRow = null; for (int i = 0; i < rownum; i++) { detailRow = (RowMap) d_RowInfos.get(i); detailRow.put("wzdjid", rowInfo.get("wzdjid_" + i)); detailRow.put("dmsxid", rowInfo.get("dmsxid_" + i)); detailRow.put("hssl", formatNumber(rowInfo.get("hssl_" + i), qtyFormat)); // detailRow.put("sl", formatNumber(rowInfo.get("sl_" + i), qtyFormat)); // detailRow.put("zk", formatNumber(rowInfo.get("zk_" + i), priceFormat)); // detailRow.put("dj", formatNumber(rowInfo.get("dj_" + i), priceFormat)); // 含税单价 detailRow.put("xsje", formatNumber(rowInfo.get("xsje_" + i), sumFormat)); detailRow.put("jje", formatNumber(rowInfo.get("jje_" + i), sumFormat)); // 无税单价 detailRow.put("jzj", formatNumber(rowInfo.get("jzj_" + i), sumFormat)); // 基准价 detailRow.put("cjtcl", formatNumber(rowInfo.get("cjtcl_" + i), sumFormat)); // 差价提成率 detailRow.put("jxts", formatNumber(rowInfo.get("jxts_" + i), qtyFormat)); // 计息天数 detailRow.put("hlts", formatNumber(rowInfo.get("hlts_" + i), qtyFormat)); // 回笼天数 detailRow.put("hltcl", formatNumber(rowInfo.get("hltcl_" + i), sumFormat)); // 回笼提成率 detailRow.put("bz", rowInfo.get("bz_" + i)); // 备注 detailRow.put("jhrq", rowInfo.get("jhrq_" + i)); // detailRow.put("xsj", rowInfo.get("xsj_" + i)); // // 保存用户自定义的字段 FieldInfo[] fields = detailProducer.getBakFieldCodes(); for (int j = 0; j < fields.length; j++) { String fieldCode = fields[j].getFieldcode(); detailRow.put(fieldCode, rowInfo.get(fieldCode + "_" + i)); } } }
/** * 初始化行信息 * * @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 request 网页的请求对象 * @param response 网页的响应对象 * @return 返回HTML或javascipt的语句 * @throws Exception 异常 */ private final void putDetailInfo(HttpServletRequest request) { RowMap rowInfo = new RowMap(); rowInfo.put(request); int rownum = dsBatchAddTable.getRowCount(); RowMap detailRow = null; for (int i = 0; i < rownum; i++) { detailRow = (RowMap) d_RowInfos.get(i); detailRow.put("cpid", rowInfo.get("cpid_" + i)); // detailRow.put("djlx", rowInfo.get("djlx_" + i)); // String bz = rowInfo.get("bz_" + i); detailRow.put("bz", rowInfo.get("bz_" + i)); // d_RowInfos.set(i, detailRow); } }
/** * 初始化列信息 * * @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(); }
/*得到从表多列的信息*/ public final RowMap[] getDetailRowinfos() { RowMap[] rows = new RowMap[d_RowInfos.size()]; d_RowInfos.toArray(rows); return rows; }
public synchronized void addDbAccessListener(DbAccessListener l) { if (l == null) return; if (dbAccessListeners == null) dbAccessListeners = new ArrayList<DbAccessListener>(); if (!dbAccessListeners.contains(l)) dbAccessListeners.add(l); }
public synchronized void removeDbAccessListener(DbAccessListener l) { if (dbAccessListeners != null && dbAccessListeners.contains(l)) dbAccessListeners.remove(l); }
/** * 初始化列信息 * * @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)); }