Package ecar.dao

Examples of ecar.dao.ItemEstrtIndResultLocalIettirlDao


         */
        public ArrayList<ProdutoBean> generateProdutoPPA(Set produtos){

    ArrayList<ProdutoBean> retorno = new ArrayList<ProdutoBean>();
    ProdutoBean bean = null;
    final ItemEstrtIndResultLocalIettirlDao indResultDao = new ItemEstrtIndResultLocalIettirlDao(request);
    final AcompRealFisicoDao acompDao = new AcompRealFisicoDao(request);
    indicadorMetaFisicaDao = new ItemEstrtIndResulIettrDao(request);

    // percorre produtos
    for (Iterator iter = produtos.iterator(); iter.hasNext();) {
      ItemEstruturaIettPPA prod = (ItemEstruturaIettPPA) iter.next();
     
      bean = new ProdutoBean();
     
      if( prod.getIndAtivoIett()!=null && "S".equalsIgnoreCase( prod.getIndAtivoIett() ) ){

/*        if (  "2380".equalsIgnoreCase(prod.getItemEstruturaIett().getSiglaIett()) ){
          logger.info(  "Produto: " + prod.getCodIett() );         
        }
*/
       
        // recebe indicadores do produto
        ArrayList<ItemEstrtIndResulIettr> indicadores = indicadorMetaFisicaDao.getIndicadoresMetaFisicaPPA( prod.getCodIett() );
       
        bean.setDescricao( prod.getNomeIett() );
       
        if ( indicadores !=null && (!indicadores.isEmpty()) ){
         
          // percorre indicadores
          for (Iterator iterator = indicadores.iterator(); iterator
              .hasNext();) {
            ItemEstrtIndResulIettr ind = (ItemEstrtIndResulIettr) iterator.next();
           
            if ( ind.getIndAtivoIettr()!=null &&  "S".equalsIgnoreCase(ind.getIndAtivoIettr())) {
             
              bean.setProduto( ind.getNomeIettir() );
              if ( ind.getIndAcumulavelIettr()!=null ){
                if ( "N".equalsIgnoreCase( ind.getIndAcumulavelIettr() ) ){
                 
                  List<Double> qtdePrevista = indResultDao.getListQtdePrevistaByLocal(ind.getCodIettir(),LOCAL_ITEM_CENTRO_EXPANDIDO);
                  Double qtdeCentroExpandido = acompDao.getSomaValoresArfs(ind,  qtdePrevista );
                  bean.setCentroExpandido( qtdeCentroExpandido );
                 
                  List<Double> qtdeLesteList = indResultDao.getListQtdePrevistaByLocal(ind.getCodIettir(),LOCAL_ITEM_LESTE);
                  Double qtdeLeste = acompDao.getSomaValoresArfs(ind,  qtdeLesteList );
                  bean.setLeste( qtdeLeste );
                 
                  List<Double> qtdeNorteList = indResultDao.getListQtdePrevistaByLocal(ind.getCodIettir(),LOCAL_ITEM_NORTE);
                  Double qtdeNorte = acompDao.getSomaValoresArfs(ind,  qtdeNorteList );
                  bean.setNorte( qtdeNorte );
 
                  List<Double> qtdeNoroesteList = indResultDao.getListQtdePrevistaByLocal(ind.getCodIettir(),LOCAL_ITEM_NOROESTE);
                  Double qtdeNoroeste = acompDao.getSomaValoresArfs(ind,  qtdeNoroesteList );
                  bean.setNoroeste( qtdeNoroeste );
 
                  List<Double> setOesteList = indResultDao.getListQtdePrevistaByLocal(ind.getCodIettir(),LOCAL_ITEM_OESTE);
                  Double qtdeOeste = acompDao.getSomaValoresArfs(ind,  setOesteList );
                  bean.setOeste( qtdeOeste );               
                 
                  List<Double> setSudoesteList = indResultDao.getListQtdePrevistaByLocal(ind.getCodIettir(),LOCAL_ITEM_SUDOESTE);
                  Double qtdeSudoeste = acompDao.getSomaValoresArfs(ind,  setSudoesteList );
                  bean.setSudoeste( qtdeSudoeste );                 
 
                  List<Double> qtdeEstadoList = indResultDao.getListQtdePrevistaByLocal(ind.getCodIettir(),LOCAL_ITEM_ESTADO);
                  Double qtdeEstado = acompDao.getSomaValoresArfs(ind,  qtdeEstadoList );
                  bean.setEstado( qtdeEstado );                 
                 
                  Double qtdeTotal = qtdeCentroExpandido + qtdeLeste + qtdeNorte + qtdeNoroeste + qtdeOeste + qtdeSudoeste + qtdeEstado;
                  bean.setTotal( qtdeTotal );               
View Full Code Here


   * @param codLitl Local Item
   * @return qtde prevista
   */
  public Double calcularPrevisaoByLocalLong codIettir, Long codLitl ) {
   
    final ItemEstrtIndResultLocalIettirlDao dao = new ItemEstrtIndResultLocalIettirlDao(request);
    final LocalItemDao localDao = new LocalItemDao(request);
    final Long LOCAL_ITEM_ESTADO = 407L;

    ArrayList<Long> listaExercicioPK = new ArrayList<Long>();   
    Double qtde = new Double(0D)
    try {
      LocalItemLit localChave = (LocalItemLit)localDao.buscar( LocalItemLit.class ,  codLitl );
     
      for (Iterator iter = listaExercicios.iterator(); iter.hasNext();) {
        ExercicioExe exe = (ExercicioExe) iter.next();
        listaExercicioPK.add( exe.getCodExe() );
      }
     
      if ( codLitl.longValue() != LOCAL_ITEM_ESTADO ){
        Set locais = localChave.getLocalItemHierarquiaLithsByCodLitPai();
       
        double qtdeTmp = 0D;     
       
 
        for (Iterator iter = locais.iterator(); iter.hasNext();) {
          LocalItemLit loc = (LocalItemLit) iter.next();
 
 
          Double result = dao.getSomaQtdePrevistaByLocal( codIettir, listaExercicioPK, loc.getCodLit() );
          qtdeTmp = qtdeTmp + result.doubleValue();
       
        }
        qtde = Double.valueOf(qtdeTmp);
      }
     
      qtde = qtde + dao.getSomaQtdePrevistaByLocal( codIettir, listaExercicioPK, codLitl );

     
    } catch (Exception e) {
      e.printStackTrace(System.out);
      logger.error(e);
View Full Code Here

          Double valorPrevisto = 0D;
          int i = 0;
         
         
            ItemEstruturaDao itemDao = new ItemEstruturaDao(null);
        ItemEstrtIndResultLocalIettirlDao dao = new ItemEstrtIndResultLocalIettirlDao(request);
            try {
              ItemEstruturaIett item = (ItemEstruturaIett)itemDao.buscar(ItemEstruturaIett.class, Long.valueOf(codItemEstrutura));
             
             
              ItemEstrutura itemWrapper = new ItemEstrutura(item);
View Full Code Here

  }
 
   
  private void execute(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
   
    final ItemEstrtIndResultLocalIettirlDao dao = new ItemEstrtIndResultLocalIettirlDao(request);
    final DecimalFormat formatBrasil = new DecimalFormat ("#,##0.##########", new DecimalFormatSymbols (new Locale ("pt", "BR")));
    try{
      StringBuilder responseHTML = new StringBuilder();
      Long paramGrupo = Pagina.getParamLong(request, "grupo");
      Long codIettir = Pagina.getParamLong(request, "codIettir");
      Long codIett = Pagina.getParamLong(request, "codIett");
      Long itemSelecionado = Pagina.getParamLong(request, "itemSelecionado");
     
      final LocalItemDao daoItem = new LocalItemDao(request);
      final ExercicioDao exercicioDao = new ExercicioDao(request);
     
      List localList = daoItem.getLocalItemPorLocalGrupo(paramGrupo);
      List listaExercicios = exercicioDao.getExerciciosValidos(Long.valueOf( codIett ));

      ItemEstruturaDao itemDao = new ItemEstruturaDao(request);

      ItemEstruturaIett item = (ItemEstruturaIett)itemDao.buscar(ItemEstruturaIett.class, Long.valueOf( codIett ));
      List locaisItem = new ArrayList(item.getItemEstrutLocalIettls());
      LocalGrupoLgp localGrupoItem = ((ItemEstrutLocalIettl)locaisItem.get(0)).getLocalItemLit().getLocalGrupoLgp();
     
      // Se a lista de locais n�o estiver vazia
      if (!localList.isEmpty() && !localList.isEmpty()){
        final int larguraLocal = 250;
        final int larguraCampo = 150;
        final int larguraTotal = 200;
        final int cont=listaExercicios.size();
        final int larguraCaixaTexto;
        if (80 / cont > 15) {
          larguraCaixaTexto = 15
        }
        else{
          larguraCaixaTexto = (80 / cont );
        }
       
       
        // Criando a tabela
        responseHTML.append( "<table width=" + (larguraLocal + cont*larguraCampo + larguraTotal) + "class='layoutFixo' bgcolor='#EAEEF4' style='table-layout: fixed; text-align: left; margin-left: auto; margin-right: auto;' border='0' cellpadding='0' cellspacing='0' > ");

        // Inserindo a checkbox superior
        responseHTML.append( "  <tr> ");
        responseHTML.append( "    <td colspan=" + (cont + 2) + "valign='top' height='25px'> ");
        responseHTML.append( "      <input type='checkbox' name='copiarQtde1' id='copiarQtde1' value='true' onchange='checkboxSincroniza(\"copiarQtde1\",\"copiarQtde2\");' > Copiar Quantidade(s) para o(s) exerc�cio(s) posterior(es)? ");
        responseHTML.append( "      <label ");
        responseHTML.append( "        id=\"label|-1|-1\"");
        responseHTML.append( "         class=\"dica\" ");
        responseHTML.append( "        onmouseover=\"" );
        responseHTML.append( "          montaTooltipMouseOver(this,\'-1\', \'\', \'-1\', \'\');" );
        responseHTML.append( "        \"" );
        responseHTML.append( "        onmouseout=\"" );
        responseHTML.append( "          montaTooltipMouseOut(\'-1\', \'-1\');" );
        responseHTML.append( "        \"" );
        responseHTML.append( "      />" );
        responseHTML.append( "        <img " );
        responseHTML.append( "          src=\"" + request.getContextPath() + "/images/dica.png\" " );
        responseHTML.append( "          align=\"absmiddle\" " );
        responseHTML.append( "          border=\"0\" " );
        responseHTML.append( "          onclick=\"" );
        responseHTML.append( "            montaTooltipMouseClick(\'-1\', \'\', \'-1\', \'\');" );
        responseHTML.append( "          \" " );
        responseHTML.append( "        /> " );
        responseHTML.append( "      " );
        responseHTML.append( "        <span id=\"span|-1|-1\" ></span>" );
        responseHTML.append( "      " );
        responseHTML.append( "      </label>" );
        responseHTML.append( "    </td> ");
        responseHTML.append( "  </tr> ");

        // Inserindo o t�tulo Exerc�cio
        responseHTML.append( "  <tr> ");
        responseHTML.append( "    <td width=" + larguraLocal + " style='font-size: 14px;color: #003366;font-weight: bold;'  align='center' >&nbsp; </td>");
        responseHTML.append( "    <td  colspan=\"" + (cont + 1) + "\" style=\"font-size: 14px;color: #003366;font-weight: bold;\"  align=\"center\" >Exercicio</td>");
        responseHTML.append( "  </tr> ");

        // Inserindo os t�tulos Local, exerc�cios e Total por Local 
        responseHTML.append( "  <tr> ");
        responseHTML.append( "    <td width=" + larguraLocal + " style='font-size: 14px;color: #003366;font-weight: bold;'  align='center' >Local</td> ");         
        for (Iterator iterator = listaExercicios.iterator(); iterator.hasNext();) {
          ExercicioExe exe = (ExercicioExe) iterator.next();
          responseHTML.append( "  <td width=" + larguraCampo + " style=\"font-size: 14px;color: #003366;font-weight: bold;\"  align=\"center\" > ");
          responseHTML.append(exe.getDescricaoExe().toUpperCase() );
          responseHTML.append( "  </td> ");
       
        responseHTML.append( "    <td width=" + larguraTotal + " style='font-size: 14px;color: #003366;font-weight: bold;'  align='center' >Total por Local</td> ");
        responseHTML.append( "  <tr> ");

        // Inserindo a caixa de sele��o
        Set subgrupo = localGrupoItem.getLocalGrupoHierarquiaLgphsByCodLgpPai();
        if ( subgrupo!=null && !subgrupo.isEmpty()){
          responseHTML.append( "  <tr> ");
          responseHTML.append( "    <td width=" + larguraLocal + " style='font-size: 12px;color: #003366;'  align='left' > ");
          responseHTML.append( "    <table width='90%'> ");
          responseHTML.append( "      <tr>" );
          responseHTML.append( "        <td width='25%' align='right'>" );
          responseHTML.append( "          <img src='../../images/icon_seta_ident.gif'/>" );
          responseHTML.append( "        </td>" );
          responseHTML.append( "        <td width='75%'>" );
          responseHTML.append( "          <select name='subgrupo' id='subgrupo' onchange='carregarlocal();'  > ");
         
          int indice = 1;
          responseHTML.append( "            <option value=" + localGrupoItem.getCodLgp() + " >Selecione</option> ");
          for (Iterator itGrupo = subgrupo.iterator(); itGrupo.hasNext();) {
            LocalGrupoLgp grupo = (LocalGrupoLgp) itGrupo.next();
            if(indice == itemSelecionado){
              responseHTML.append( "        <option value='" + grupo.getCodLgp() + "' selected='true'>" + grupo.getIdentificacaoLgp() + "</option>" );
            }
            else {
              responseHTML.append( "        <option value='" + grupo.getCodLgp() + "' >" + grupo.getIdentificacaoLgp() + "</option>" );
            }
            indice++;
          }
          responseHTML.append( "          </select> ");
          responseHTML.append( "          </td>" );
          responseHTML.append( "        </tr>" );
          responseHTML.append( "      </table>" );
         
          responseHTML.append( "    </td> ");         
          responseHTML.append( "     <td colspan=" + (cont +1) + "valign='top' height='25px'> &nbsp; </td> ");
          responseHTML.append( "  </tr> ");
        }
   
       
        // Inserindo o conte�do da tabela
        String strTdSeta = null;
        String strTdCampo = null;
        String strTdTotalPorLocal = null;
       
        Double totalLocal = 0.0;
        Double totalExercicio[] = new Double [listaExercicios.size()];
        Double totalGeral = 0.0;
        int i = 0;
        for(i = 0; i < totalExercicio.length; i++){
          totalExercicio[i] = 0.0;
        }
       
       
        // Para cada local
        for (Iterator iter = localList.iterator(); iter.hasNext();) {
          LocalItemLit local = (LocalItemLit) iter.next();
         
          // Criar uma c�lula com a seta e o nome do local
          strTdSeta = new String (
                "<td align='rigth' width='" + larguraLocal + "' height='25px' valign='top'>" +
                "  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" +
                "  <table width='100%'> " +
                "    <tr>" +
                "      <td width='25%' align='right'>" +
                "        <img src='../../images/icon_seta_ident.gif'/>" +
                "      </td>" +
                "      <td width='75%'>" +
                "        " + local.getIdentificacaoLit() +
                "        &nbsp;" +
                "      </td>" +
                "    </tr>" +
                "  </table>" +
                "</td>"
          );
          responseHTML.append("<tr>");
          responseHTML.append(strTdSeta);
         
          totalLocal = 0.0;
          i = 0;
          // Para cada exerc�cio
          for (Iterator iterator = listaExercicios.iterator(); iterator.hasNext();) {
            ExercicioExe exe = (ExercicioExe) iterator.next();
            ItemEstrtIndResulLocalIettirl itemEstrtIndResulLocalIettirl = dao.getQtdePrevistaByLocal( codIettir, exe.getCodExe(), local.getCodLit() );
   
            totalLocal += itemEstrtIndResulLocalIettirl.getQtdPrevistaIettirl().doubleValue();
            totalExercicio [i] += itemEstrtIndResulLocalIettirl.getQtdPrevistaIettirl().doubleValue();
            i++;
           
View Full Code Here

/*      List listaQtd = itemEstrtIndResulDao.getListaQuantidadePrevista(request, itemEstrtIndResulOriginal);
      itemEstrtIndResulOriginal.setDataUltManutencao(new Date());
      itemEstrtIndResulOriginal.setUsuarioUsuManutencao(((ecar.login.SegurancaECAR)request.getSession().getAttribute("seguranca")).getUsuario());
      itemEstrtIndResulDao.alterar(itemEstrtIndResulOriginal, listaQtd);
      */
      final ItemEstrtIndResultLocalIettirlDao dao = new ItemEstrtIndResultLocalIettirlDao(request);
      final ItemEstrutFisicoDao daoFisico = new ItemEstrutFisicoDao(request);


      a = request.getParameterNames();
      Long ano = Long.valueOf(request.getParameter("ano"));

        if (itemEstrtIndResulOriginal.getItemEstrutFisicoIettfs() != null)
        {
           Iterator<ItemEstrutFisicoIettf> it = itemEstrtIndResulOriginal.getItemEstrutFisicoIettfs().iterator();
           while (it.hasNext()){
             ItemEstrutFisicoIettf itemF = (ItemEstrutFisicoIettf) it.next();
            
            
             if ((itemF.getAnoIettf().equals(ano.intValue()) )&&(itemF.getItemEstrtIndResulLocalIettirls() != null)){
                dao.deleteBycodIettf(itemF.getCodIettf());
             }
           }
        }       
     
/*      ItemEstrutFisicoIettf itemFisico = daoFisico.getEstruturaFisicaPorMesAno(25l, 6l, 2010l);
     
      Iterator it = itemFisico.getItemEstrtIndResulLocalIettirls().iterator();
     
      ItemEstrtIndResulLocalIettirl itemLocal = (ItemEstrtIndResulLocalIettirl) it.next();
*/
      daoFisico.deleteItemEstrutFisicoDeItem(codIettirLong, ano);
     
     
     
      while(a.hasMoreElements()){
        String elemento = (String)a.nextElement();
       

        if ( elemento.startsWith("cmp")){
         
          StringTokenizer token = new StringTokenizer( elemento, "|", false );
         
          int cont =0;
          String[] parts = new String[3];
          while(token.hasMoreElements()){
            parts[cont] = (String)token.nextElement();
            cont++;
          }
         
          if ( parts.length==3 && (!parts[2].equalsIgnoreCase("total")) ){
            String local = parts[1];
            String mes = parts[2];
            String vlr = request.getParameter(elemento);
           
            if ( vlr!=null & (!"".equalsIgnoreCase(vlr))){
              Long localLong = Long.valueOf(local);
              Long mesLong = Long.valueOf(mes);
             
             
              vlr = Util.formataNumero(vlr);

              ItemEstrutFisicoIettf itemFisico = daoFisico.getEstruturaFisicaPorMesAno(codIettirLong, mesLong, ano);
             
            //  System.out.println("Valor: " + vlr);
              Double vlrDouble = Double.parseDouble(vlr);

              dao.salvarByLocal( codIettirLong, mesLong, ano, localLong, vlrDouble, itemFisico );             
            }
          }
        }
      }
       
View Full Code Here

  }
 
 
  private void execute(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
 
    final ItemEstrtIndResultLocalIettirlDao dao = new ItemEstrtIndResultLocalIettirlDao(request);
    final DecimalFormat formatBrasil = new DecimalFormat ("#,##0.00", new DecimalFormatSymbols (new Locale ("pt", "BR")));
   
    try{
      StringBuilder responseHTML = new StringBuilder();
      Long paramLocal = Pagina.getParamLong(request, "local");
      Long codIettir = Pagina.getParamLong(request, "codIettir");
     
      LocalItemDao daoItem = new LocalItemDao(request);
      final ExercicioDao exercicioDao = new ExercicioDao(request);
      List listaExercicios = exercicioDao.getExercicioByPeriodicidade( CONSTANTE_PERIODO_EXERCICIO );
     
      List localList = daoItem.getLocaisFilhos(paramLocal);
     
      if ( !localList.isEmpty() ){
        responseHTML.append( "<table align=\"left\" width='100%' border='0' >");
        for (Iterator iter = localList.iterator(); iter.hasNext();) {
          responseHTML.append( "<tr>");
          LocalItemLit local = (LocalItemLit) iter.next();
          responseHTML.append("<td width='30%' align='left' height='25px' valign='top' >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
          responseHTML.append("<img src='../../images/icon_seta_ident.gif'/>&nbsp;")
          responseHTML.append( local.getIdentificacaoLit() +"</td>");

          for (Iterator iterator = listaExercicios.iterator(); iterator.hasNext();) {
            ExercicioExe exe = (ExercicioExe) iterator.next();

            ItemEstrtIndResulLocalIettirl item = dao.getQtdePrevistaByLocal( codIettir, exe.getCodExe(), local.getCodLit() );
           
            responseHTML.append( "<td width='14%' align=\"center\" >");
            responseHTML.append( "<input type=\"text\"  onblur=\"calcularTotalLocal('" );
            responseHTML.append( local.getCodLit().toString() );
            responseHTML.append"');calcularTotalExercicio('"+exe.getCodExe().toString()+"');\"    onmouseover=\"calcularTotalExercicio('"+exe.getCodExe().toString()+"');calcularTotalLocal('" +local.getCodLit().toString() + "');\" " );               
View Full Code Here

       
  }
 
  private void execute(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
   
    final ItemEstrtIndResultLocalIettirlDao dao = new ItemEstrtIndResultLocalIettirlDao(request);
    StringBuilder conteudo = new StringBuilder();
   
    try {
      // Excluindo todas quantidades/valores referentes ao item estrutura.
      Long codIettirLong = Pagina.getParamLong(request, "codIettir");
View Full Code Here

      Long qtdeValoresRealizados = 0l;     
      List<Long> locais = new ArrayList<Long>();
      for (int i = 0; i < codigosParaExcluir.length;i++){
        locais.add(Long.valueOf(codigosParaExcluir[i]));
      }     
      ItemEstrtIndResultLocalIettirlDao itemEstrtIndResultLocalIettirlDao = new ItemEstrtIndResultLocalIettirlDao(null);
      AcompRealFisicoLocalDao acompRealFisicoLocalDao = new AcompRealFisicoLocalDao(null);
           
      qtdeValoresPrevistos = itemEstrtIndResultLocalIettirlDao.countByLocaisItemEstrutura(locais, codItemEstrutura);
     
      if (qtdeValoresPrevistos > 0){ //nesse caso j� existem valores previstos informados.
        sbmsg.append("itemEstrutura.localItem.exclusao.valorPrevistoExistente") ;
        return false;
      }
View Full Code Here

TOP

Related Classes of ecar.dao.ItemEstrtIndResultLocalIettirlDao

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.