⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 down_query_hbc.jsp

📁 《jsp案例开发》这本书的源代码。包括源代码和相关的具体配置操作步骤。非常不错
💻 JSP
字号:
<%@ page    language="java"    contentType="text/html; charset=GBK"    import="imis.*,javax.naming.*,javax.rmi.PortableRemoteObject,java.util.*,java.sql.*,java.io.*"%><%    request.setCharacterEncoding("GBK");    session=request.getSession();    userStruct session_us=(userStruct)session.getAttribute("user");    if(session_us==null){      response.sendRedirect("../../login.html");    }    else{        Integer whichyear = (Integer)session.getAttribute("whichyear");        Context ctx = new InitialContext();        Object ref = ctx.lookup("SchemeplanController");        SchemeplanControllerHome schemeplanControllerHome = (SchemeplanControllerHome) PortableRemoteObject.narrow(ref, SchemeplanControllerHome.class);        SchemeplanController schemeplancontroller = schemeplanControllerHome.create();        Context psctx=new InitialContext();        Object psref=psctx.lookup("OfficeUnitController");        OfficeUnitControllerHome officeUnitControllerHome=(OfficeUnitControllerHome) PortableRemoteObject.narrow(psref,OfficeUnitControllerHome.class);        OfficeUnitController officeUnitController=officeUnitControllerHome.create();        Collection plan_collect = schemeplancontroller.getPlanByPlanyear(whichyear);//根据年度取得数据        Iterator ii = plan_collect.iterator();        Vector rongqi = new Vector(); //存放设备名称        Vector vector = new Vector(); //存放符合下达条件的schemeplan        Vector danwei = new Vector(); //存放单位id        Collection detail_coll = new ArrayList();        Judge judge = new Judge();        officeUnitStruct ous=new officeUnitStruct();        while(ii.hasNext())        {          SchemeplanStruct schplanstruct = new SchemeplanStruct();          schplanstruct = (SchemeplanStruct)ii.next();          ////符合下达条件的          if(schplanstruct.downstatus.intValue()==2&&schplanstruct.planstatus.intValue()==1)          {            Collection ttt = new ArrayList();                ttt = officeUnitController.getUnitid(schplanstruct.unitid);            Iterator it = ttt.iterator();            if(it.hasNext())              ous = (officeUnitStruct)it.next();            //if(ous.upunitid.intValue()==session_us.unitid.intValue())            //{             // danwei.addElement(schplanstruct.unitid);            Judge jg = new Judge();            if(jg.decide(session_us.unitid,schplanstruct.unitid))            {              vector.addElement(schplanstruct);//符合下达条件的plan的集合              Integer nTemp = schplanstruct.planid;              Collection devicecollect1 = new ArrayList();              devicecollect1 = schemeplancontroller.getPlandetailsByPlanid(nTemp);              Iterator jj = devicecollect1.iterator();              while(jj.hasNext())              {                 PlandetailsStruct str = new PlandetailsStruct();                 str = (PlandetailsStruct)jj.next();                 detail_coll.add(str);                 String aa = str.devicename;                 rongqi.addElement(aa);              }            //}          }          }        }        for(int l=0;l<rongqi.size()-1;l++)         for(int k=l+1;k<rongqi.size();k++)         {           if(rongqi.elementAt(l).equals(rongqi.elementAt(k)))           {              rongqi.remove(k);              k--;           }          }///////////得到名称不相同设备集        int nRow = rongqi.size();        /*        for(int l=0;l<danwei.size()-1;l++)         for(int k=l+1;k<danwei.size();k++)         {            if(danwei.elementAt(l).equals(danwei.elementAt(k)))            {              danwei.remove(k);              k--;             }         }//////////得到下属单位集         int nCol = danwei.size()*2;*/        Collection pro = officeUnitController.getAll();        Iterator qq = pro.iterator();        while(qq.hasNext())        {          officeUnitStruct polo = new officeUnitStruct();          polo = (officeUnitStruct)qq.next();          if(polo.upunitid.intValue() == session_us.unitid.intValue())            danwei.addElement(polo.unitid);         }         Collection myunit_Coll = officeUnitController.getUnitid(session_us.unitid);/////得到登录人所在单位名称         Iterator iterator_unit = myunit_Coll.iterator();         officeUnitStruct danweiStruct = new officeUnitStruct();         if(iterator_unit.hasNext())           danweiStruct = (officeUnitStruct)iterator_unit.next();         String UnitName = danweiStruct.getProcessname();//////////////////////单位名称session.setAttribute("whichyear",whichyear);session.setAttribute("unitCollection_hbc",danwei);//单位session.setAttribute("planCollection_hbc",vector);//申请session.setAttribute("plandetailCol_hbc",detail_coll);//详细session.setAttribute("subunitColl_hbc",rongqi);if(nRow>0){%><HTML><HEAD><META http-equiv=Content-Type content="text/html; charset=gb_2312-80"><link rel="stylesheet" href="../../css/stii.css" type="text/css"></HEAD><BODY>             <form name="form2" method="post" action="downpro_hbc.jsp">              <table class=title cellspacing=1 cellpadding=2 width="100%" border=1>            <caption align=right><%=UnitName%><%=whichyear.toString()%>年度下达表 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;<font style="font-size:12px">单位:万元(人民币)</font></caption>                  <tr align=middle>                    <td rowspan="2"><div align="center"><font  class="strong">设备名称</font></div></td>                    <td rowspan="2"><div align="center"><font  class="strong">设备规格</font></div></td>          <%for(int ll = 0;ll<danwei.size();ll++){                    Integer aaa = (Integer)danwei.elementAt(ll);                    Collection tempcoll=officeUnitController.getUnitid(aaa);                    Iterator kk = tempcoll.iterator();                    if(kk.hasNext())                      ous = (officeUnitStruct)kk.next();                    String processname = ous.getProcessname();%>                    <td colspan="2">                          <%=processname%><%}%>                  <td rowspan="2"><div align="center"><font  class="strong">合计</font></div></td>                  </tr>                  <tr align=middle>                  <%for(int c=0;c<danwei.size();c++){%>                  <td >申请数量                  <td >申请金额                <%}%>                 </tr>                <%for(int nn=0;nn<nRow;nn++){%>                  <tr align=middle>                   <%String dname = (String)rongqi.elementAt(nn);%>                  <td><%=dname%></td>                  <%                  Iterator iter = detail_coll.iterator();                  PlandetailsStruct detail = new PlandetailsStruct();                  if (iter.hasNext())                    detail = (PlandetailsStruct)iter.next();                  String guige = detail.devicetype;  %>                  <td><%=guige%></td>                  <%                    Iterator myit = detail_coll.iterator();                  Vector detailvec = new Vector();                    PlandetailsStruct ppdetail = new PlandetailsStruct();                    while(myit.hasNext())                    {                      ppdetail = (PlandetailsStruct)myit.next();                      if(ppdetail.devicename.equals(dname))                        detailvec.addElement(ppdetail);//得到该名字的记录集合                    }                    Integer shuliang=new Integer(0);                    Double jine = new Double(0);                    Double total_row = new Double(0);                    // for(int m_m = 0;m_m<detailvec.size();m_m++)                     //{                       PlandetailsStruct pp = new PlandetailsStruct();                       Judge myjudge = new Judge();                       for(int m=0;m<danwei.size();m++)                       {                         Integer int_danwei = (Integer)danwei.elementAt(m);                        for(int m_m = 0;m_m<detailvec.size();m_m++)                        {                          pp = (PlandetailsStruct)detailvec.elementAt(m_m);                          //if(pp.unitid.intValue() == int_danwei.intValue())                          if(myjudge.decide(int_danwei,pp.unitid))                          {                            shuliang = new Integer(pp.appamount.intValue()+shuliang.intValue());                            jine = new Double(pp.deviceprice.doubleValue()+jine.doubleValue());                          }                        }                         %>                         <td><%=shuliang.toString()%></td>                         <td><%=jine.toString()%>                         <%                       total_row = new Double(total_row.doubleValue()+jine.doubleValue());                         shuliang = new Integer(0);                        jine = new Double(0);                       }                      //total_row = new Double(total_row.doubleValue()+pp.deviceprice.doubleValue());                    //}%>                  <td><%=total_row.doubleValue()%></td>                  </tr>                  <%}%>                  <%Double total_col = new Double(0);                    Double total_all = new Double(0);  %>            <tr align=middle>                   <td>合计</td>                   <td>&nbsp</td>                   <%for(int b = 0;b<danwei.size();b++)                     {                       Integer gg = (Integer)danwei.elementAt(b);                       Iterator xulie = detail_coll.iterator();                       PlandetailsStruct hh = new PlandetailsStruct();                       Judge ju = new Judge();                       while(xulie.hasNext())                       {                         hh = (PlandetailsStruct)xulie.next();                         //if(hh.unitid.intValue()==gg.intValue())                         if(ju.decide(gg,hh.unitid))                           total_col = new Double(total_col.doubleValue()+hh.deviceprice.doubleValue());                       }                       total_all = new Double(total_all.doubleValue()+total_col.doubleValue());                       %>                       <td>&nbsp;</td>                       <td><input type="text" name="<%=gg.intValue()%>" class="file" size="8" value="<%=total_col.doubleValue()%>"></td><%                     total_col = new Double(0);                     }%>                     <td><%=total_all.doubleValue()%></td></tr>            </table> <table class=title cellspacing=1 cellpadding=2 width="100%" border=1><tr align=center><td align=left width=50%>海区下达金额<%double buDownPrice = 0;Integer priceid = new Integer(0);Collection pc = schemeplancontroller.getPlanpriceByPlanyear(whichyear);Iterator pi = pc.iterator();while(pi.hasNext()){PlanpriceStruct prs = (PlanpriceStruct)pi.next();if(prs.unitid.intValue()==session_us.unitid.intValue()){if(prs.priceid.intValue()>priceid.intValue()){priceid = prs.priceid;}}}PlanpriceStruct pprs = new PlanpriceStruct();pprs = schemeplancontroller.getPlanpriceByPriceid(priceid);if(pprs!=null){if(pprs.totalprice!=null){buDownPrice = pprs.totalprice.doubleValue();}}%><td align=right><%=buDownPrice%></tr></table>                 <table class=title cellspacing=1 cellpadding=2 width="100%" border=0>                    <tr align=center>                      <td><input type="submit" name="Submit" value="下  达" class="file" onClick="return confirm('请确认下达金额输入正确!')">              &nbsp;&nbsp<input type="button" name="Button3222" value=" 返  回 " class="file" onClick="javascript:history.go(-1)"></td>                  </tr>            </table>          </form>              </td>            </tr>          </table></BODY></HTML><%  }  else{ %> <font color="red">请确定<%=whichyear%>年度海区已经下达</font><br><input type="button" name="Button32" value=" 返  回 " class="file" onClick="javascript:history.go(-1)">    <%  }}%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -