// 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'> </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'>" +
" " +
" <table width='100%'> " +
" <tr>" +
" <td width='25%' align='right'>" +
" <img src='../../images/icon_seta_ident.gif'/>" +
" </td>" +
" <td width='75%'>" +
" " + local.getIdentificacaoLit() +
" " +
" </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++;
//if (local.getCodLit().intValue() == 418){
// Criar uma c�lula contendo um campo e uma imagem de informa��o.
strTdCampo = new String (
"<td width=\"" + larguraCampo + "\" align=\"center\" >" +
" <input " +
" type=\"text\"" +
" size=\"" + (larguraCaixaTexto - 3) + "\"" +
" onblur=\"" +
" copiarExercicio('" + local.getCodLit().toString() + "'); " +
" calcularTotalLocal('" + local.getCodLit().toString() + "');" +
" calcularTotalExercicio('"+exe.getCodExe().toString() + "');" +
" \"" +
" id=\"cmp|" + local.getCodLit().toString() + "|" + exe.getCodExe().toString() + "\"" +
" name=\"cmp|" + local.getCodLit().toString() + "|" + exe.getCodExe().toString() + "\"" +
" value=\"" + formatBrasil.format(itemEstrtIndResulLocalIettirl.getQtdPrevistaIettirl().doubleValue()) + "\"" +
" />" +
" " +
" <label " +
" id=\"label|" + local.getCodLit().toString() + "|" + exe.getCodExe().toString() + "\"" +
" class=\"dica\" " +
" onmouseover=\"" +
" montaTooltipMouseOver(this,\'"+ exe.getCodExe().toString() + "\',\'" + exe.getDescricaoExe() +"\',\'"+ local.getCodLit().toString() + "\',\'" + local.getIdentificacaoLit() +"\');" +
" \"" +
" onmouseout=\"" +
" montaTooltipMouseOut(\'"+ exe.getCodExe().toString() + "\',\'" + local.getCodLit().toString() +"\');" +
" \"" +
" />" +
" <img " +
" src=\"" + request.getContextPath() + "/images/dica.png\" " +
" align=\"absmiddle\" " +
" border=\"0\" " +
" onclick=\"" +
" montaTooltipMouseClick(\'"+ exe.getCodExe().toString() + "\',\'" + exe.getDescricaoExe() +"\',\'"+ local.getCodLit().toString() + "\',\'" + local.getIdentificacaoLit() +"\');" +
" \" " +
" /> " +
" " +
" <span id=\"span|" + local.getCodLit().toString() + "|" + exe.getCodExe().toString() + "\" ></span>" +
" " +
" </label>" +
"</td>"
);
responseHTML.append(strTdCampo);
}
// Criar uma c�lula de total por local
strTdTotalPorLocal = new String(
"<td align=\"center\" width=\"" + larguraTotal + "\" >" +
" <input " +
" type=\"text\"" +
" size=\"12\"" +
" readonly=\"true\"" +
" id=\"cmp|" + local.getCodLit().toString() + "|total\"" +
" name=\"cmp|" + local.getCodLit().toString() + "|total\"" +
" value=\"" + formatBrasil.format(totalLocal) + "\"" +
" style=\"background-color:#FFF9DC;\"" +
" />" +
"</td>"
);
responseHTML.append(strTdTotalPorLocal);
responseHTML.append("</tr>");
//}// if 418
}
responseHTML.append( " <tr> ");
responseHTML.append( " <td width=" + larguraLocal + " style='font-size: 14px;color: #003366;font-weight: bold;' align='center' >Total por Exerc�cio</td> ");
// Inserindo os totais por exerc�cio e o total geral
i = 0;
for (Iterator iterator = listaExercicios.iterator(); iterator.hasNext();) {
ExercicioExe exe = (ExercicioExe) iterator.next();
//responseHTML.append( " <td width=" + larguraCampo + " align=\"center\"><input type=\"text\" style=\"background-color:#FFF9DC;\" size=\"" + larguraCaixaTexto + "\" id=\"total"+exe.getCodExe().toString() +"\" name=\"total"+exe.getCodExe()+"\" value=" + formatBrasil.format(totalExercicio[i]) + " readonly=\"true\" /></td>");
responseHTML.append( " <td width=" + larguraCampo + " align=\"center\"><input type=\"text\" style=\"background-color:#FFF9DC;\" size=\"" + larguraCaixaTexto + "\" id=\"qtdPrevistaIettf"+exe.getCodExe().toString() +"\" name=\"qtdPrevistaIettf"+exe.getCodExe()+"\" value=" + formatBrasil.format(totalExercicio[i]) + " readonly=\"true\" /></td>");
totalGeral += totalExercicio[i];
i++;
}
responseHTML.append( " <td widht=" + larguraTotal + " align='center'><input type=\"text\" style=\"background-color:#FFF9DC;\" size='12' id='totalGeral' style='background-color:#FFF9DC;' name='totalGeral' value='" + formatBrasil.format(totalGeral) + "' readonly='true' /></td> ");