Пример #1
0
	/*
	 * 和材料无关的款项支付
	 */
	public String addpayfor(HttpServletRequest request, HttpServletResponse response)	throws Exception {
		String IsPostBack = request.getParameter("IsPostBack");
		if(IsPostBack!=null && !IsPostBack.equals("")&&IsPostBack.equals("1")){
			
			try {
				Long id = dataBaseControl.getSeq(Fi_payfor.class);
				dataBaseControl.beginTransaction();
				double total = 0 ;
				
				Map user = (Map)request.getSession().getAttribute("user");
				
				String ck1 = request.getParameter("ck1")==null?"0":request.getParameter("ck1");
				String ck2 = request.getParameter("ck2")==null?"0":request.getParameter("ck2");
				String ck3 = request.getParameter("ck3")==null?"0":request.getParameter("ck3");
				String ck4 = request.getParameter("ck4")==null?"0":request.getParameter("ck4");
				String ck5 = request.getParameter("ck5")==null?"0":request.getParameter("ck5");
				
				if(ck1.equals("1"))
				{
					Fi_payfor_item fi_payfor_item = new Fi_payfor_item();
					fi_payfor_item.setApplyreason(request.getParameter("rea1"));
					fi_payfor_item.setMoney(new BigDecimal((request.getParameter("money1")==null||request.getParameter("money1").equals(""))?"0":request.getParameter("money1")));
					fi_payfor_item.setFujnum(request.getParameter("fuj1"));
					fi_payfor_item.setF_id(new Integer(id+""));
					fi_payfor_item.setPurchase_item_id(new Integer(0));
					fi_payfor_item.setMateriel_id(0);
					fi_payfor_item.setNum(new Integer(0));
					fi_payfor_item.setPrice(new BigDecimal(0));
					fi_payfor_item.setPerson(new Integer(user.get("base_info_id").toString()));
					fi_payfor_item.setOdate(new java.sql.Date((new java.util.Date()).getTime()));
					total = total + Double.valueOf((request.getParameter("money1")==null||request.getParameter("money1").equals(""))?"0":request.getParameter("money1"));
					fi_payfor_item.setGongys(new Integer(request.getParameter("gongys")));
					fi_payfor_item.setInout_id(0);
					dataBaseControl.insertByBean(fi_payfor_item);
					
				}
				
				if(ck2.equals("1"))
				{
					Fi_payfor_item fi_payfor_item = new Fi_payfor_item();
					fi_payfor_item.setApplyreason(request.getParameter("rea2"));
					fi_payfor_item.setMoney(new BigDecimal((request.getParameter("money2")==null||request.getParameter("money2").equals(""))?"0":request.getParameter("money2")));
					fi_payfor_item.setFujnum(request.getParameter("fuj2"));
					fi_payfor_item.setF_id(new Integer(id+""));
					fi_payfor_item.setPurchase_item_id(new Integer(0));
					fi_payfor_item.setMateriel_id(0);
					fi_payfor_item.setNum(new Integer(0));
					fi_payfor_item.setPrice(new BigDecimal(0));
					fi_payfor_item.setPerson(new Integer(user.get("base_info_id").toString()));
					fi_payfor_item.setOdate(new java.sql.Date((new java.util.Date()).getTime()));
					total = total + Double.valueOf((request.getParameter("money2")==null||request.getParameter("money2").equals(""))?"0":request.getParameter("money2"));
					fi_payfor_item.setGongys(new Integer(request.getParameter("gongys")));
					fi_payfor_item.setInout_id(0);
					dataBaseControl.insertByBean(fi_payfor_item);
					
				}
				
				if(ck3.equals("1"))
				{
					Fi_payfor_item fi_payfor_item = new Fi_payfor_item();
					fi_payfor_item.setApplyreason(request.getParameter("rea3"));
					fi_payfor_item.setMoney(new BigDecimal((request.getParameter("money3")==null||request.getParameter("money3").equals(""))?"0":request.getParameter("money3")));
					fi_payfor_item.setFujnum(request.getParameter("fuj3"));
					fi_payfor_item.setF_id(new Integer(id+""));
					fi_payfor_item.setPurchase_item_id(new Integer(0));
					fi_payfor_item.setMateriel_id(0);
					fi_payfor_item.setNum(new Integer(0));
					fi_payfor_item.setPrice(new BigDecimal(0));
					fi_payfor_item.setPerson(new Integer(user.get("base_info_id").toString()));
					fi_payfor_item.setOdate(new java.sql.Date((new java.util.Date()).getTime()));
					total = total + Double.valueOf((request.getParameter("money3")==null||request.getParameter("money3").equals(""))?"0":request.getParameter("money3"));
					fi_payfor_item.setGongys(new Integer(request.getParameter("gongys")));
					fi_payfor_item.setInout_id(0);
					dataBaseControl.insertByBean(fi_payfor_item);
					
				}
				
				if(ck4.equals("1"))
				{
					Fi_payfor_item fi_payfor_item = new Fi_payfor_item();
					fi_payfor_item.setApplyreason(request.getParameter("rea4"));
					fi_payfor_item.setMoney(new BigDecimal((request.getParameter("money4")==null||request.getParameter("money4").equals(""))?"0":request.getParameter("money4")));
					fi_payfor_item.setFujnum(request.getParameter("fuj4"));
					fi_payfor_item.setF_id(new Integer(id+""));
					fi_payfor_item.setPurchase_item_id(new Integer(0));
					fi_payfor_item.setMateriel_id(0);
					fi_payfor_item.setNum(new Integer(0));
					fi_payfor_item.setPrice(new BigDecimal(0));
					fi_payfor_item.setPerson(new Integer(user.get("base_info_id").toString()));
					fi_payfor_item.setOdate(new java.sql.Date((new java.util.Date()).getTime()));
					total = total + Double.valueOf((request.getParameter("money4")==null||request.getParameter("money4").equals(""))?"0":request.getParameter("money4"));
					fi_payfor_item.setGongys(new Integer(request.getParameter("gongys")));
					fi_payfor_item.setInout_id(0);
					dataBaseControl.insertByBean(fi_payfor_item);
					
				}
				
				if(ck5.equals("1"))
				{
					Fi_payfor_item fi_payfor_item = new Fi_payfor_item();
					fi_payfor_item.setApplyreason(request.getParameter("rea5"));
					fi_payfor_item.setMoney(new BigDecimal((request.getParameter("money5")==null||request.getParameter("money5").equals(""))?"0":request.getParameter("money5")));
					fi_payfor_item.setFujnum(request.getParameter("fuj5"));
					fi_payfor_item.setF_id(new Integer(id+""));
					fi_payfor_item.setPurchase_item_id(new Integer(0));
					fi_payfor_item.setMateriel_id(0);
					fi_payfor_item.setNum(new Integer(0));
					fi_payfor_item.setPrice(new BigDecimal(0));
					fi_payfor_item.setPerson(new Integer(user.get("base_info_id").toString()));
					fi_payfor_item.setOdate(new java.sql.Date((new java.util.Date()).getTime()));
					total = total + Double.valueOf((request.getParameter("money5")==null||request.getParameter("money5").equals(""))?"0":request.getParameter("money5"));
					fi_payfor_item.setGongys(new Integer(request.getParameter("gongys")));
					fi_payfor_item.setInout_id(0);
					dataBaseControl.insertByBean(fi_payfor_item);
					
				}
				
				
				
					Fi_payfor fi_payfor = new Fi_payfor();
					fi_payfor.setP_id(new BigDecimal(user.get("base_info_id").toString()));
					fi_payfor.setDept_id(new BigDecimal(user.get("branchid").toString()));
					fi_payfor.setOdate(new java.sql.Date((new java.util.Date()).getTime()));
					fi_payfor.setPayforstate(request.getParameter("state"));
					fi_payfor.setMoney(new BigDecimal(total+""));
					fi_payfor.setPaytype(request.getParameter("paytype"));
					fi_payfor.setNote(request.getParameter("note"));
					fi_payfor.setNote(request.getParameter("gongys"));
					fi_payfor.setBmoney(NumToRmb.toHanStr(total));
					fi_payfor.setSk_id(new BigDecimal(request.getParameter("gongys")));
					fi_payfor.setPjdtype(request.getParameter("pjdtype"));
					fi_payfor.setType("1");
					
					dataBaseControl.insertByBean(fi_payfor, id);
			} catch (Exception e) {
				System.out.println(e);
			} finally{
				dataBaseControl.endTransaction();
			}
			
                request.setAttribute("operationSign", "closeDG_refreshW();");
                
                String num = "";
    			String infor = "您有一条款项支付申请待审批";
    			List slist = dataBaseControl.getOutResultSet("select t.* from message t where t.rolename = 1 and t.dept = 3 ", null);
    			if(slist!=null&&!slist.isEmpty())
    			{
    				Map smap = (Map)slist.get(0);
    				num = smap.get("num").toString();
    			}
    			
    			PHPRPC_Client client = new PHPRPC_Client(Constant.HTTPDRESS);
    			Mas m = (Mas) client.useService(Mas.class);
    			m.sendGFDZ(num,infor);
		}else{
			Long id = dataBaseControl.getSeq(Fi_payfor.class);
			request.setAttribute("accid", id+1);//当插入数据之后id就+1了,所有查看的是id+1的那条数据
		}
		
		buildDDL(request);
		request.setAttribute("editMod", "addpayfor");
		request.setAttribute("IsPostBack", "1");
		return "/fi/payfor/nfi_payforDtl.jsp";
	}
Пример #2
0
	/*
	 * 修改款项支付
	 */
	public String edit(HttpServletRequest request,HttpServletResponse response) throws Exception {
		String IsPostBack = request.getParameter("IsPostBack");
		String forward = "";
		request.setAttribute("type", request.getParameter("type"));
		if(IsPostBack!=null && !IsPostBack.equals("")&&IsPostBack.equals("1")){
			String id = request.getParameter("id");
			
			dataBaseControl.beginTransaction();
			
			List slist = dataBaseControl.getOutResultSet("select * from fi_payfor_item t where t.f_id = ? order by t.id ", new Object[]{id});
			double total = 0;
			for(int i = 0 ; i < slist.size();i++)
			{
				Map map = (Map)slist.get(i);
				Fi_payfor_item fi_payfor_item = new Fi_payfor_item();
				BeanUtils.populate(fi_payfor_item, map);
				
				fi_payfor_item.setApplyreason(request.getParameter("rea"+fi_payfor_item.getId()));
				fi_payfor_item.setMoney(new BigDecimal(request.getParameter("money"+fi_payfor_item.getId())));
				fi_payfor_item.setFujnum(request.getParameter("fuj"+fi_payfor_item.getId()));
				total = total + Double.valueOf(request.getParameter("money"+fi_payfor_item.getId()));
				dataBaseControl.updateByBean(fi_payfor_item);
				
			}
			
			Map user = (Map)request.getSession().getAttribute("user");
			
			String ck1 = request.getParameter("ck1")==null?"0":request.getParameter("ck1");
			String ck2 = request.getParameter("ck2")==null?"0":request.getParameter("ck2");
			String ck3 = request.getParameter("ck3")==null?"0":request.getParameter("ck3");
			String ck4 = request.getParameter("ck4")==null?"0":request.getParameter("ck4");
			String ck5 = request.getParameter("ck5")==null?"0":request.getParameter("ck5");
			
			if(ck1.equals("1"))
			{
				Fi_payfor_item fi_payfor_item = new Fi_payfor_item();
				fi_payfor_item.setApplyreason(request.getParameter("rea1"));
				fi_payfor_item.setMoney(new BigDecimal((request.getParameter("money1")==null||request.getParameter("money1").equals(""))?"0":request.getParameter("money1")));
				fi_payfor_item.setFujnum(request.getParameter("fuj1"));
				fi_payfor_item.setF_id(new Integer(id+""));
				fi_payfor_item.setPurchase_item_id(new Integer(0));
				fi_payfor_item.setMateriel_id(0);
				fi_payfor_item.setNum(new Integer(0));
				fi_payfor_item.setPrice(new BigDecimal(0));
				fi_payfor_item.setPerson(new Integer(user.get("base_info_id").toString()));
				fi_payfor_item.setOdate(new java.sql.Date((new java.util.Date()).getTime()));
				total = total + Double.valueOf((request.getParameter("money1")==null||request.getParameter("money1").equals(""))?"0":request.getParameter("money1"));
				fi_payfor_item.setGongys(0);
				fi_payfor_item.setInout_id(0);
				dataBaseControl.insertByBean(fi_payfor_item);
				
			}
			
			if(ck2.equals("1"))
			{
				Fi_payfor_item fi_payfor_item = new Fi_payfor_item();
				fi_payfor_item.setApplyreason(request.getParameter("rea2"));
				fi_payfor_item.setMoney(new BigDecimal((request.getParameter("money2")==null||request.getParameter("money2").equals(""))?"0":request.getParameter("money2")));
				fi_payfor_item.setFujnum(request.getParameter("fuj2"));
				fi_payfor_item.setF_id(new Integer(id+""));
				fi_payfor_item.setPurchase_item_id(new Integer(0));
				fi_payfor_item.setMateriel_id(0);
				fi_payfor_item.setNum(new Integer(0));
				fi_payfor_item.setPrice(new BigDecimal(0));
				fi_payfor_item.setPerson(new Integer(user.get("base_info_id").toString()));
				fi_payfor_item.setOdate(new java.sql.Date((new java.util.Date()).getTime()));
				total = total + Double.valueOf((request.getParameter("money2")==null||request.getParameter("money2").equals(""))?"0":request.getParameter("money2"));
				fi_payfor_item.setGongys(0);
				fi_payfor_item.setInout_id(0);
				dataBaseControl.insertByBean(fi_payfor_item);
				
			}
			
			if(ck3.equals("1"))
			{
				Fi_payfor_item fi_payfor_item = new Fi_payfor_item();
				fi_payfor_item.setApplyreason(request.getParameter("rea3"));
				fi_payfor_item.setMoney(new BigDecimal((request.getParameter("money3")==null||request.getParameter("money3").equals(""))?"0":request.getParameter("money3")));
				fi_payfor_item.setFujnum(request.getParameter("fuj3"));
				fi_payfor_item.setF_id(new Integer(id+""));
				fi_payfor_item.setPurchase_item_id(new Integer(0));
				fi_payfor_item.setMateriel_id(0);
				fi_payfor_item.setNum(new Integer(0));
				fi_payfor_item.setPrice(new BigDecimal(0));
				fi_payfor_item.setPerson(new Integer(user.get("base_info_id").toString()));
				fi_payfor_item.setOdate(new java.sql.Date((new java.util.Date()).getTime()));
				total = total + Double.valueOf((request.getParameter("money3")==null||request.getParameter("money3").equals(""))?"0":request.getParameter("money3"));
				fi_payfor_item.setGongys(0);
				fi_payfor_item.setInout_id(0);
				dataBaseControl.insertByBean(fi_payfor_item);
				
			}
			
			if(ck4.equals("1"))
			{
				Fi_payfor_item fi_payfor_item = new Fi_payfor_item();
				fi_payfor_item.setApplyreason(request.getParameter("rea4"));
				fi_payfor_item.setMoney(new BigDecimal((request.getParameter("money4")==null||request.getParameter("money4").equals(""))?"0":request.getParameter("money4")));
				fi_payfor_item.setFujnum(request.getParameter("fuj4"));
				fi_payfor_item.setF_id(new Integer(id+""));
				fi_payfor_item.setPurchase_item_id(new Integer(0));
				fi_payfor_item.setMateriel_id(0);
				fi_payfor_item.setNum(new Integer(0));
				fi_payfor_item.setPrice(new BigDecimal(0));
				fi_payfor_item.setPerson(new Integer(user.get("base_info_id").toString()));
				fi_payfor_item.setOdate(new java.sql.Date((new java.util.Date()).getTime()));
				total = total + Double.valueOf((request.getParameter("money4")==null||request.getParameter("money4").equals(""))?"0":request.getParameter("money4"));
				fi_payfor_item.setGongys(0);
				fi_payfor_item.setInout_id(0);
				dataBaseControl.insertByBean(fi_payfor_item);
				
			}
			
			if(ck5.equals("1"))
			{
				Fi_payfor_item fi_payfor_item = new Fi_payfor_item();
				fi_payfor_item.setApplyreason(request.getParameter("rea5"));
				fi_payfor_item.setMoney(new BigDecimal((request.getParameter("money5")==null||request.getParameter("money5").equals(""))?"0":request.getParameter("money5")));
				fi_payfor_item.setFujnum(request.getParameter("fuj5"));
				fi_payfor_item.setF_id(new Integer(id+""));
				fi_payfor_item.setPurchase_item_id(new Integer(0));
				fi_payfor_item.setMateriel_id(0);
				fi_payfor_item.setNum(new Integer(0));
				fi_payfor_item.setPrice(new BigDecimal(0));
				fi_payfor_item.setPerson(new Integer(user.get("base_info_id").toString()));
				fi_payfor_item.setOdate(new java.sql.Date((new java.util.Date()).getTime()));
				total = total + Double.valueOf((request.getParameter("money5")==null||request.getParameter("money5").equals(""))?"0":request.getParameter("money5"));
				fi_payfor_item.setGongys(0);
				fi_payfor_item.setInout_id(0);
				dataBaseControl.insertByBean(fi_payfor_item);
				
			}
			
			Map map1 = dataBaseControl.getOneResultSet("select t.* from fi_payfor t where t.id = ?", new Object[]{id});
			request.setAttribute("accid", map1.get("id"));
			Fi_payfor fi_payfor = new Fi_payfor();
			BeanUtils.populate(fi_payfor, map1);
			
			fi_payfor.setPayforstate(request.getParameter("state"));
			fi_payfor.setMoney(new BigDecimal(total+""));
			fi_payfor.setPaytype(request.getParameter("paytype"));
			fi_payfor.setPjdtype(request.getParameter("pjdtype"));
			fi_payfor.setBmoney(NumToRmb.toHanStr(total));
			fi_payfor.setNote(request.getParameter("gongys"));
			dataBaseControl.updateByBean(fi_payfor);
			dataBaseControl.endTransaction();
			forward = "/fi/payfor/nlfi_payforDtl.jsp";
			request.setAttribute("operationSign", "closeDG_refreshW();");
			
		}
		else
		{
			Map map1 = dataBaseControl.getOneResultSet("select t.* from fi_payfor t where t.id = ?", new Object[]{request.getParameter("id")});
			String type = ""+map1.get("type");
			request.setAttribute("accid", map1.get("id"));
			
			
			buildDDL(request);
			
			if(!type.equals("1"))  //与材料相关
			{
				Page page=search1(request,1,1);		
				if(page.getTotalNumberOfElements()>0)
				{
					request.setAttribute("record", ((ArrayList)page.getThisPageElements()).get(0));
				}
				request.setAttribute("btnDisplay", "display:none");
			
				String flag = request.getParameter("flag")==null?"0":request.getParameter("flag");
				if(flag.equals("1"))
				{
					request.setAttribute("operationSign", "closeDG_refreshW();");
				}
			
				request.setAttribute("type", "modify");
				
				List list = dataBaseControl.getOutResultSet("select t.*,c.prj_id,(select p.name from pr_project p where p.id=c.prj_id)pname,r.ration_apply_id,(select m.name from materiel m where m.id = t.materiel_id) maname,(select s.name from supplier s where s.id = t.gongys) gys from fi_payfor_item t,gm_purchase r,gm_purchase_item c where t.f_id = ? and t.purchase_item_id = c.id and c.purchase_id = r.id order by t.id", new Object[]{request.getParameter("id")});
				request.setAttribute("reslist", list);
				
				request.setAttribute("ssize", list.size());
				
				forward = "/fi/payfor/fi_payforpayDtl.jsp";
			}
			else //与材料无关
			{
				Map map2 = dataBaseControl.getOneResultSet("select t.*,s.name,s.id sid,(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[]{request.getParameter("id")});
				request.setAttribute("info", map2);
				
				Map user = (Map)request.getSession().getAttribute("user");
				request.setAttribute("applyid", user.get("base_info_id"));
				
				List slist = dataBaseControl.getOutResultSet("select * from fi_payfor_item t where t.f_id = ? order by t.id", new Object[]{map2.get("id")});
				request.setAttribute("slist", slist);
				request.setAttribute("ssize", 5-slist.size());
				
				forward = "/fi/payfor/nlfi_payforDtl.jsp";
			}
		}
		
		List splist = dataBaseControl.getOutResultSet("select t.*,(select b.name from hr_base_info b where b.id = t.audit_id)pname from fi_payfor_audit t where t.apply_id = ? order by t.id ",new Object[]{request.getParameter("id")});
		request.setAttribute("splist", splist);
		
		
		request.setAttribute("editMod", "edit");
		request.setAttribute("IsPostBack", "1");
		return forward;
	}
Пример #3
0
	/*
	 * 提交修改后的款项支付
	 */
	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";
	}
Пример #4
0
	/*
	 * 保存新增款项支付
	 */
	public String save(HttpServletRequest request,HttpServletResponse response) throws Exception {
		Map user = (Map)request.getSession().getAttribute("user");
	    Object[] checkbox = request.getParameterValues("checkbox");
	    String[] danju = request.getParameterValues("danju");
	    String  mapro=null;
		if(checkbox.length!=0)
		{
			Long id = dataBaseControl.getSeq(Fi_payfor.class);
			dataBaseControl.beginTransaction();
			for(int i = 0 ; i < checkbox.length;i++)
			{
				float money = 0;
				
				Map iomap = (Map)dataBaseControl.getOneResultSet("select * from gm_materiel_inout t where t.id = ?", new Object[]{checkbox[i]});
				Gm_materiel_inout inout = new Gm_materiel_inout();
				BeanUtils.populate(inout, iomap);
				
				if(request.getParameter("opinionid").equals("1"))
				{
					inout.setIspay("1");
					dataBaseControl.updateByBean(inout);
				}
				
				
				Map map = dataBaseControl.getOneResultSet("select * from gm_purchase_item t where t.id = ?", new Object[]{iomap.get("purchase_item_id")});
				Fi_payfor_item fi_payfor_item = new Fi_payfor_item();
				Gm_purchase_item purchase_item = new Gm_purchase_item();
				BeanUtils.populate(purchase_item, map);
				mapro=map.get("prj_id").toString();
				fi_payfor_item.setInout_id(new Integer(checkbox[i].toString()));
				fi_payfor_item.setPro_id(Integer.parseInt(map.get("prj_id").toString()));
				fi_payfor_item.setPurchase_item_id(new Integer(purchase_item.getId()+""));
				fi_payfor_item.setOdate(new java.sql.Date((new java.util.Date()).getTime()));
				fi_payfor_item.setMateriel_id(purchase_item.getMateriel_id());
				fi_payfor_item.setNum(new Integer(iomap.get("num").toString()));
				fi_payfor_item.setPrice(new BigDecimal(iomap.get("price").toString()));
				
				money =Float.valueOf(fi_payfor_item.getNum())*Float.valueOf(fi_payfor_item.getPrice().toString());
				  
				fi_payfor_item.setMoney(new BigDecimal(money));
				fi_payfor_item.setPerson(new Integer(user.get("base_info_id").toString()));
				fi_payfor_item.setGongys(purchase_item.getGongys());
				fi_payfor_item.setF_id(new Integer(id+""));
				fi_payfor_item.setFujnum(danju[i]);
				
				dataBaseControl.insertByBean(fi_payfor_item);
				
				int hasnum = purchase_item.getYfsl();
				hasnum = hasnum + new Integer(iomap.get("num").toString());
				purchase_item.setYfsl(hasnum);
				dataBaseControl.updateByBean(purchase_item);
			}
			
			Fi_payfor fi_payfor = new Fi_payfor();
			fi_payfor.setP_id(new BigDecimal(user.get("base_info_id").toString()));
			fi_payfor.setDept_id(new BigDecimal(user.get("branchid").toString()));
			fi_payfor.setOdate(new java.sql.Date((new java.util.Date()).getTime()));
			fi_payfor.setPayforstate(request.getParameter("opinionid"));
			fi_payfor.setMoney(new BigDecimal(request.getParameter("editTotal")));
			fi_payfor.setPaytype(request.getParameter("paytype"));
			fi_payfor.setNote(request.getParameter("note"));
			fi_payfor.setBmoney(NumToRmb.toHanStr(Double.parseDouble(request.getParameter("editTotal"))));
			fi_payfor.setSk_id(new BigDecimal(sk_id));
			fi_payfor.setPro_id(Integer.parseInt(mapro));
			dataBaseControl.insertByBean(fi_payfor, id);
			dataBaseControl.endTransaction();
			
			String num = "";
			String infor = "您有一条款项支付申请待审批";
			List slist = dataBaseControl.getOutResultSet("select t.* from message t where t.rolename = 1 and t.dept = 3 ", null);
			if(slist!=null&&!slist.isEmpty())
			{
				Map smap = (Map)slist.get(0);
				num = smap.get("num").toString();
			}
			
			PHPRPC_Client client = new PHPRPC_Client(Constant.HTTPDRESS);
			Mas m = (Mas) client.useService(Mas.class);
			m.sendGFDZ(num,infor);
			
			request.setAttribute("operationSign", "closeDG_refreshW();");
			
		}else{
			Long id = dataBaseControl.getSeq(Fi_payfor.class);
			request.setAttribute("accid", id);
			
			
		}
		
		return "/fi/payfor/fi_payforDtl.jsp";
	}