/* * 修改时删除子项 */ public String delete(HttpServletRequest request,HttpServletResponse response) throws Exception { Map map = dataBaseControl.getOneResultSet("select * from fi_payfor_item t where t.id = ? ", new Object[]{request.getParameter("id")}); Map payformap = dataBaseControl.getOneResultSet("select t.* from fi_payfor t where t.id = ?", new Object[]{map.get("f_id")}); String type = ""+payformap.get("type"); if(!type.equals("1")) { Map map1 = dataBaseControl.getOneResultSet("select * from gm_purchase_item t where t.id = ?", new Object[]{map.get("purchase_item_id")}); Gm_purchase_item gm_purchase_item =new Gm_purchase_item(); BeanUtils.populate(gm_purchase_item, map1); int hasnum = gm_purchase_item.getYfsl() - Integer.parseInt(map.get("num").toString()); gm_purchase_item.setYfsl(hasnum); dataBaseControl.updateByBean(gm_purchase_item); Map map2 = dataBaseControl.getOneResultSet("select * from gm_materiel_inout t where t.id = ?", new Object[]{map.get("inout_id")}); Gm_materiel_inout gm_materiel_inout = new Gm_materiel_inout(); BeanUtils.populate(gm_materiel_inout, map2); gm_materiel_inout.setIspay("0"); dataBaseControl.updateByBean(gm_materiel_inout); } dataBaseControl.executeSql("DELETE FROM fi_payfor_item WHERE ID in (?)", new Object[]{request.getParameter("id")}); List list= dataBaseControl.getOutResultSet("select * from fi_payfor_item t where t.f_id = ? ", new Object[]{map.get("f_id")}); String flag = "0"; if(list == null || list.isEmpty()) { dataBaseControl.executeSql("DELETE FROM fi_payfor WHERE ID in (?)", new Object[]{map.get("f_id")}); flag = "1"; } else { } return "/fi/fi_payfor/Fi_payfor!edit.do?id="+map.get("f_id")+"&flag="+flag+"&type="+request.getParameter("type"); }
/* * 提交款项支付 */ public String sub(HttpServletRequest request,HttpServletResponse response) throws Exception { Map map1 = dataBaseControl.getOneResultSet("select *from fi_payfor t where t.id = ?", new Object[]{request.getParameter("id")}); String type = ""+map1.get("type"); dataBaseControl.beginTransaction(); dataBaseControl.executeSql("update fi_payfor t set t.payforstate = '1' where t.id = ?", new Object[]{request.getParameter("id")}); if(!type.equals("1")) { List payforitemlist =dataBaseControl.getOutResultSet("select * from fi_payfor_item t where t.f_id = ?", new Object[]{request.getParameter("id")}); for(int i = 0 ; i < payforitemlist.size();i++) { Map map = (Map)payforitemlist.get(i); Map iomap = (Map)dataBaseControl.getOneResultSet("select * from gm_materiel_inout t where t.id = ?", new Object[]{map.get("inout_id")}); Gm_materiel_inout gm_materiel_inout = new Gm_materiel_inout(); BeanUtils.populate(gm_materiel_inout, iomap); gm_materiel_inout.setIspay("1"); dataBaseControl.updateByBean(gm_materiel_inout); } } dataBaseControl.endTransaction(); return "/fi/fi_payfor/Fi_payfor!paysearchList.do"; }
public String delete(HttpServletRequest request,HttpServletResponse response) throws Exception { String id=request.getParameter("id"); String pidString=(dataBaseControl.getOneResultSet("select p_id from Hr_family where id=?", new Object[]{id})).get("p_id").toString(); dataBaseControl.executeSql("DELETE FROM Hr_family WHERE ID in (?)", new Object[]{id}); return "/hr/info/Hr_family!searchList.do?id="+pidString; }
public String tongji(HttpServletRequest request,HttpServletResponse response) throws Exception { Map map = dataBaseControl.getOneResultSet("select * from fi_payfor_item t where t.id = ? ", new Object[]{request.getParameter("id")}); dataBaseControl.executeSql("DELETE FROM fi_payfor_item WHERE ID in (?)", new Object[]{request.getParameter("id")}); List list= dataBaseControl.getOutResultSet("select * from fi_payfor_item t where t.f_id = ? ", new Object[]{map.get("f_id")}); String flag = "0"; if(list == null || list.isEmpty()) { dataBaseControl.executeSql("DELETE FROM fi_payfor WHERE ID in (?)", new Object[]{map.get("f_id")}); flag = "1"; } else { } return "/fi/fi_payfor/Fi_payfor!edit.do?id="+map.get("f_id")+"&flag="+flag; }
//按恭元伟代码继续编码,实属无奈... //打印---仅与材料无关部分 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"; }
/* * 提交修改后的款项支付 */ public String sub1(HttpServletRequest request, HttpServletResponse response) throws Exception { Map user = (Map)request.getSession().getAttribute("user"); Map map = dataBaseControl.getOneResultSet("select * from fi_payfor t where t.id = ?", new Object[]{request.getParameter("payforid")}); List itemlist = (List)dataBaseControl.getOutResultSet("select * from fi_payfor_item t where t.f_id = ? order by t.id", new Object[]{request.getParameter("payforid")}); Object[] checkbox = request.getParameterValues("checkbox"); Fi_payfor fi_payfor = new Fi_payfor(); BeanUtils.populate(fi_payfor, map); if(checkbox.length!=0) { dataBaseControl.beginTransaction(); float total = 0 ; for(int j = 0 ; j < itemlist.size();j++) { boolean flag = false; Map tmap = (Map)itemlist.get(j); String id = tmap.get("id").toString(); for(int i = 0 ; i < checkbox.length;i++) { String nid = checkbox[i].toString(); if(id.equals(nid)) //分配付款时仍然保留 { flag = true; } } if(flag)//分配付款保留的 { float money = 0; Map map1 = dataBaseControl.getOneResultSet("select * from fi_payfor_item t where t.id = ?", new Object[]{id}); Fi_payfor_item fi_payfor_item = new Fi_payfor_item(); BeanUtils.populate(fi_payfor_item, map1); fi_payfor_item.setOdate(new java.sql.Date((new java.util.Date()).getTime())); //fi_payfor_item.setNum(new Integer(request.getParameter("num"+checkbox[i].toString()).equals("")?"0":request.getParameter("num"+checkbox[i].toString()))); money = Float.valueOf(fi_payfor_item.getMoney()+"") ; total = total + money; fi_payfor_item.setPerson(new Integer(user.get("base_info_id").toString())); dataBaseControl.updateByBean(fi_payfor_item); } else//此次分配付款未勾选的,删除记录,并将其设置为"未付状态" { Map map1 = dataBaseControl.getOneResultSet("select * from gm_purchase_item t where t.id = ?", new Object[]{tmap.get("purchase_item_id")}); Gm_purchase_item gm_purchase_item =new Gm_purchase_item(); BeanUtils.populate(gm_purchase_item, map1); int hasnum = gm_purchase_item.getYfsl() - Integer.parseInt(tmap.get("num").toString()); gm_purchase_item.setYfsl(hasnum); dataBaseControl.updateByBean(gm_purchase_item); Map map2 = dataBaseControl.getOneResultSet("select * from gm_materiel_inout t where t.id = ?", new Object[]{tmap.get("inout_id")}); Gm_materiel_inout gm_materiel_inout = new Gm_materiel_inout(); BeanUtils.populate(gm_materiel_inout, map2); gm_materiel_inout.setIspay("0"); dataBaseControl.updateByBean(gm_materiel_inout); dataBaseControl.executeSql("DELETE FROM fi_payfor_item WHERE ID in (?)", new Object[]{tmap.get("id")}); } } fi_payfor.setOdate(new java.sql.Date((new java.util.Date()).getTime())); fi_payfor.setPayforstate(request.getParameter("opinionid")); fi_payfor.setMoney(new BigDecimal(map.get("money").toString())); fi_payfor.setPaytype(request.getParameter("paytype")); fi_payfor.setNote(request.getParameter("note")); fi_payfor.setBmoney(NumToRmb.toHanStr(Double.parseDouble(map.get("money").toString()))); dataBaseControl.updateByBean(fi_payfor); dataBaseControl.endTransaction(); request.setAttribute("operationSign", "closeDG_refreshW();"); ///////////////////////分配付款后的短信提醒(财务主管) String num=null; String infor=null; List slist = dataBaseControl.getOutResultSet("select t.* from message t where t.rolename = 2 ", null); if(slist!=null&&!slist.isEmpty()) { Map smap = (Map)slist.get(0); num = smap.get("num").toString(); infor = "您有一条款项支付申请待审批"; } PHPRPC_Client client = new PHPRPC_Client(Constant.HTTPDRESS); Mas m = (Mas) client.useService(Mas.class); m.sendGFDZ(num,infor); } return "/fi/payfor/fi_payforpayDtl.jsp"; }