//按恭元伟代码继续编码,实属无奈... //打印---仅与材料无关部分 public String print(HttpServletRequest request,HttpServletResponse response) throws Exception { String idString = request.getParameter("id"); String IsPostBack = request.getParameter("IsPostBack"); request.setAttribute("IsPostBack", "1"); if(IsPostBack!=null && !IsPostBack.equals("")&&IsPostBack.equals("1")){ int count = Integer.parseInt((dataBaseControl.getOneResultSet("select print from fi_payfor where id=?", new Object[]{idString})).get("print").toString()); count++; dataBaseControl.executeSql("update fi_payfor set print=? where id=?", new Object[]{count,idString}); request.setAttribute("operationSign", "closeDG_refreshW();"); } //获取类型,是否与材料有关 Map typeMap = dataBaseControl.getOneResultSet("select t.type from fi_payfor t where t.id = ?", new Object[]{idString}); String type = null; if(typeMap.size()!=0){ type= ""+typeMap.get("type"); } Map mainMap = null; List itemlist = null; if(type.equals("1")){ mainMap = dataBaseControl.getOneResultSet("select t.*,s.name,s.id sid," + "(select mb.branchname from mrbranch mb where mb.id=t.dept_id) dept_name," + "(select b.name from hr_base_info b where t.p_id = b.id) pname " + "from fi_payfor t,supplier s where t.id = ? and t.note = s.id", new Object[]{idString}); //明细清单 itemlist = dataBaseControl.getOutResultSet("select t.applyreason,t.fujnum,t.money from fi_payfor_item t where t.f_id = ? order by t.id", new Object[]{idString}); }else{ List mainList = dataBaseControl.getTopResultSet("select t.*," + "(select s.name from supplier s where s.id = gi.gongys) name," + "(select mb.branchname from mrbranch mb where mb.id=t.dept_id) dept_name, " + "(select b.name from hr_base_info b where t.p_id = b.id) pname " + "from fi_payfor t,fi_payfor_item pi,gm_purchase_item gi where t.id = ? " + "and t.id = pi.f_id and pi.purchase_item_id = gi.id", new Object[]{idString} ,1); if(mainList.size()!=0){ mainMap=(Map) mainList.get(0); } itemlist = dataBaseControl.getOutResultSet("select " + "(select m.name from materiel m where m.id = t.materiel_id) applyreason," + "t.fujnum,t.money from fi_payfor_item t where t.f_id = ? order by t.id", new Object[]{idString}); } //主表map request.setAttribute("main", mainMap); request.setAttribute("itemlist", itemlist); //审批意见 //部门经理 List dmList = dataBaseControl.getTopResultSet("select hb.name,t.opinion,t.audit_date from fi_payfor_audit t,hr_base_info hb,fi_payfor fp where fp.id=t.apply_id(+) and t.audit_id = hb.id(+) and hb.dept_id = fp.dept_id and fp.id=? order by t.id desc", new Object[]{idString}, 1); //会计 List cpaList = dataBaseControl.getTopResultSet("select hb.name,t.opinion,t.audit_date from fi_payfor_audit t,hr_base_info hb,fi_payfor fp where fp.id=t.apply_id(+) and t.audit_id=hb.id(+) and hb.dept_id=6 and hb.duty_id=1 and t.apply_id=? order by t.id desc", new Object[]{idString}, 1); //财务经理 List fmList = dataBaseControl.getTopResultSet("select hb.name,t.opinion,t.audit_date from fi_payfor_audit t,hr_base_info hb,fi_payfor fp where fp.id=t.apply_id(+) and t.audit_id=hb.id(+) and hb.dept_id=6 and hb.duty_id=2 and t.apply_id=? order by t.id desc", new Object[]{idString}, 1); //公司领导 List gmList = dataBaseControl.getTopResultSet("select hb.name,t.opinion,t.audit_date from fi_payfor_audit t,hr_base_info hb where t.audit_id=hb.id(+) and hb.duty_id!=1 and hb.duty_id!=2 and t.apply_id=? order by t.id desc", new Object[]{idString}, 1); Map dmMap = null; Map cpaMap = null; Map fmMap = null; Map gmMap = null; if(dmList.size()!=0){ dmMap = (Map) dmList.get(0); } if(cpaList.size()!=0){ cpaMap = (Map) cpaList.get(0); } if(fmList.size()!=0){ fmMap = (Map) fmList.get(0); } if(gmList.size()!=0){ gmMap = (Map) gmList.get(0); } request.setAttribute("dmMap", dmMap); request.setAttribute("fmMap", fmMap); request.setAttribute("gmMap", gmMap); request.setAttribute("cpaMap", cpaMap); buildDDL(request); return "/fi/payfor/print.jsp"; }