Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Herberth Nilsen

[Resolvido] Erro de execução desconhecido

Recommended Posts

Bom dia galera,

 

Estou com um problema aqui no trabalho

 

eu tenho uma página do meu sistema que faz uma chamada AJAX para uma página completa em PHP (<html><head><body><form> <etc>)

 

porém quando eu chamo a função AJAX para abrir essa página, ela me retorna um erro desconhecido no momento em que vou jogar o responseText no innerHTML da minha div

 

 

se fosse só isso, tudo bem, pois saberia que o problema está no AJAX, mas acontece que a mesma página PHP que é chamada, utilizando a mesma função AJAX mas em outra página do sistema funciona perfeitamente e acredito que o problema esteja na página que chama a função do AJAX.

 

Isso já está me tirando o sono, desde o começo da semana que quero resolver isso e não consegui ainda

 

Pelo amor de deus, me ajudem

 

Segue abaixo os códigos do AJAX, da página PHP que quero chamar e a página PHP do sistema que utilizará a função AJAX

 

 

 

 

//FUNÇÃO AJAX



function ajax_dinamic(StrNomeForm,StrPagina,StrDivPagina,StrObrigatorioValue,StrMsgErro,StrRedirecionamento,StrPerguntar,StrTextButton,StrRefresh,StrButtonId,StrDisableButton, Trigger)
{
	var elem 					= document.getElementById(StrNomeForm).elements;
	var exibeResultado 			= document.getElementById(StrDivPagina);
	var ranNum 					= Math.floor(Math.random()*372766);
	var array_count 			= StrObrigatorioValue.split("|");
	var StrMsgErro_count		= StrMsgErro.split("|");
	exibeResultado.innerHTML 	= "";
	var warning					= "";
	var strRetorno				= "";
	var vCodPaginas				= "";
	var vCount 					= 0;
	var StrPonto				= "";
	var array_buton				= StrDisableButton.split("|");

	if(StrPerguntar == 1)
	{
		var r=confirm(StrTextButton)

		if (r==true)
		{
			var strStatus = true;
		} else
		{
			return false;
		}
	}

	for(var i = 0; i < elem.length; i++)
	{
		if(elem[i].type == "radio" || elem[i].type == "checkbox")
		{
			if(elem[i].checked)
			{
				if(strRetorno == '')
				{
					strRetorno = elem[i].name + "=" + elem[i].value;
				} else
				{
					strRetorno = strRetorno + "&" + elem[i].name + "=" + elem[i].value;
				}
			}
		} else
		{
			var verific = "^CorOrigem";

			if (elem[i].id.match(verific))
			{

			} else
			{
				//NAO ENVIA VARIAVEIS COM VALOR VAZIO
				if(elem[i].value != ''  && (elem[i].type == 'password' || elem[i].type == 'hidden' || elem[i].type == 'text' || elem[i].type == 'select-one' || elem[i].type == 'textarea'))
				{
					if(strRetorno == '')
					{
						strRetorno = elem[i].name + "=" + elem[i].value;
					} else
					{
						strRetorno = strRetorno + "&" + elem[i].name + "=" + elem[i].value;
					}
				}
			}
		}
	}

	exibeResultado = document.getElementById(StrDivPagina); // div que exibirá o resultado.

	A_url = StrPagina.split("?");

	if(A_url[1] != '')
	{
		strRetorno = A_url[1]+'&'+strRetorno
	}

	var params = ""+strRetorno+"";

    with((window.XMLHttpRequest && new XMLHttpRequest()) || new ActiveXObject('Microsoft.XMLHTTP')){

        open('POST', A_url[0], true);

        setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=iso-8859-1');

        setRequestHeader('Cache-Control', 'no-store, no-cache, must-revalidate');
        setRequestHeader('Cache-Control', 'post-check=0, pre-check=0');

        setRequestHeader('Pragma', 'no-cache');

        onreadystatechange = function(){

            switch(this.readyState){

                case 1:

                    exibeResultado.innerHTML = "<div align=\"center\"><img src=\"../images/ajax-loader.gif\" alt=\"\" onerror=\"this.src = '../../images/ajax-loader.gif'; this.onerror = null;\" /></div>";

                    break;

                case 4:

                    switch(this.status){

                        case 200:

                            exibeResultado.innerHTML = this.responseText;

                            if(Trigger){ // Dispara uma função após a requisição ser aceita

                                    Trigger(this.responseText);

                            }

                            break;

                        default:

                            exibeResultado.innerHTML = 'Error';

                    }

                    break;

            }

        }

        send(params);

    }

    return false;

}

 

 

//ARQUIVO PHP QUE QUERO CHAMAR - SuperBuscaElemento.php



<?
	session_start();

	$cod_mensagens = "'ACbrTIPANE'";
	include("../library/functions.php");
	include("../mensagens/mensagens.php");
	

		# ======================================================
		# validando se o Ctrl est correto e valido
		# ======================================================
		if(Check_autenticacao($_REQUEST['CTL']) == 1)
		{
			$autenticacao = true;
		}
		else
		{
			die(Mensagem_autenticacao());
		}
		# ======================================================
		
		$strform = $_REQUEST['strform']; 
		$strdiv	 = $_REQUEST['div'];
		
		$CTL 	 	 	 = $_REQUEST['CTL']; 
		$SBE_FORM 	 	 = $_REQUEST['SBE_FORM']; 
		$SBE_DIV	 	 = $_REQUEST['SBE_DIV'];
		$SBE_BIS	 	 = $_REQUEST['SBE_BIS'];
		$SBE_DESC	 	 = $_REQUEST['SBE_DESC'];
		$SBE_ID	 	 	 = $_REQUEST['SBE_ID'];
		$SBE_DIV_VALOR 	 = $_REQUEST['SBE_DIV_VALOR'];
		$SBE_DIV_UNIDADE = $_REQUEST['SBE_DIV_UNIDADE'];
		$SBE_DIV_RESP 	 = $_REQUEST['SBE_DIV_RESP'];
	
		$Dic1    = new Traduz(100036,$USUARIO[7],$USUARIO[19]);
		$DicRay2 = $Dic1->GetTraduz(3);

		
?>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<link rel="stylesheet" type="text/css" href="../css/padrao.css">
		<script type="text/javascript" src="../JS/ajax.js"></script>
	</head>
	<body scroll="yes" >
		<form name="formElemento" id="formElemento" method="post">
			<div id="teste" class="divfundo"></div>
			<div class="divdados">
<?
/*Trecho adicionado por Herberth Nilsen - Data: 21/05/2010
----------------------------------------------------------------------*/
?>
<div class="centralizar"   >
    <div class="container" style="width:700px; text-align:center">
   	  <div class="header" style="width:96.3%; text-align:left"><?=$DicRay2[0]?></div>
    	<div class="header" style="width:3%; text-align:left">
        	<img src="../images/btn_fechando.png" alt="Fechar" width="20" height="20" border="0" 
            	onClick="volta_combo();disablePopup();fechanovadiv();" />
        </div>
        <div class="panel"  style="width:98%; height:100px; margin-top:30px;">
            <div class="conteudo" style="width:98%; height:110; ">
    			<div class="padrao_tbl" style="width:320px"><?=$DicRay2[1]?></div>
    			<div class="padrao_tbl" style="width:314px"><?=$DicRay2[2]?></div>

    			<div class="padrao_tbl" style="width:320px">
                	<select name="cboGenero" class="combo_elemento3-230" id="cboGenero" tabindex="1" 
                    	onChange="list_tipos(this.value,'formElemento','<?=$CTL;?>','<?=$SBE_BIS;?>')">
                        <option value="0"><?= "Escolha..";?> </option>
                        <?
                        $sql 	= "SELECT DISTINCT TG.cod_genero,TG.descricao FROM tb_genero TG 
                                   INNER JOIN tb_elemento TE ON TE.cod_genero = TG.cod_genero AND TG.id_instituicao IN ($USUARIO[17]) 
                                   INNER JOIN tb_tipo_elemento TTE ON TTE.id_tipo = TE.cod_tipo_elemento AND TTE.id_bem_servico IN ($SBE_BIS)
                                   ORDER BY TG.descricao ";
                        $result	= DBSEL($sql);
                        $total  = count($result);
                        
                        if($total > 0)
                        {
                            foreach ($result as $dados)
                            {
                                $descricao  = $dados[1];
                                $cod  		= $dados[0];
                                $descricao  = str_split($descricao,30);
                                
                                echo "<option value=$dados[0]>$dados[1]</option>";
                            }
                        } else
                        {
                            echo "<option value=NULL> Nenhum Genero Cadastrado </option>";
                        } ?>
                        </select>
                </div>
    		<div class="padrao_tbl" style="width:314px" id="div_genero" name="div_genero">
                    <select name="cboTipo" class="combo_elemento3-230" id="cboTipo" tabindex="2">
                      <option value="0"> Escolha..</option>
                      <?
                        $sql 	= "SELECT id_tipo,descricao_tipo FROM tb_tipo_elemento 
                                   WHERE descricao_tipo <> '' AND id_bem_servico IN($SBE_BIS) AND id_instituicao IN ($USUARIO[17]) 
                                   ORDER BY descricao_tipo";
                        $result	= DBSEL($sql);
                        $total  = count($result);
                    
                        if($total > 0)
                        {
                            foreach ($result as $dados)
                            {
                                $descricao  = $dados[1];
                                $cod  		= $dados[0];
                                $descricao  = str_split($descricao,30);
                                
                                echo "<option value=$cod>$descricao[0]</option>";
                            }
                        } else
                        {
                            echo "<option value=NULL > Nenhum Tipo de Elemento cadastrado </option>";
                        } ?>
                    </select>   
				</div>

                <div class="padrao_tbl" style="width:510px"><?=$DicRay2[3]?></div>
                <div class="padrao_tbl" style="width:124px"></div>

                <div class="padrao_tbl" style="width:450px">
                	<input name="txtcampodescricao" type="text" class="textopadrao" id="txtcampodescricao" accesskey="p" tabindex="3"  size="70" maxlength="60" />
                </div>
                <div class="procurar" style="width:180px" >
                    <div style="float:left; ">
                        <input class="botaoprocurar2" type="button" name="btnTodos" tabindex="4" value="" id="btnTodos" 
                        	onClick="Super_Procura('<?= $CTL; ?>','<?= $SBE_FORM;?>','<?= $SBE_DIV;?>','<?= $SBE_BIS;?>', '<?= $SBE_DESC;?>',
                            					   '<?= $SBE_ID;?>', '<?= $SBE_DIV_VALOR;?>','<?= $SBE_DIV_UNIDADE;?>','<?= $SBE_DIV_RESP;?>');" />
                    </div>
                    <div style="width:39px; float:left; text-align:center; padding-top:2px; ">
                        <input 	class="texto" name="txtqtde" id="txtqtde" tabindex="2" value="10" 
                                onKeyPress="return apenasnumeros(event, false)" size="3" />
                    </div>
                </div>
	            <div id="retorno_pesquisa2" class="padrao_tbl" style="width:100%"></div>
		</div>
      </div>
    </div>              
</div>  
<input type="hidden" name="retorno" id="retorno" value="MostraRetorno" />                
<?
/*--------------------------------------------------------------------*/
?>        
		</div>
		     <?// CAMPOS QUE RECEBEM O ID SELECIONADO PARA EDITAR?>
		    <input name="IdSelecionado" 		type="hidden" value="">
			<input name="IdSelecionado_banco" 	type="hidden" value="">
			
			<input name="SBE_FORM" 		 	id="SBE_FORM" 			type="hidden" value="<?= $SBE_FORM; ?>">
			<input name="CTL" 	   		 	id="CTL" 	 			type="hidden" value="<?= $CTL; ?>">
			<input name="SBE_DIV"  		 	id="SBE_DIV"  			type="hidden" value="<?= $SBE_DIV; ?>">
			<input name="SBE_BIS" 		 	id="SBE_BIS" 			type="hidden" value="<?= $SBE_BIS; ?>">
			<input name="SBE_DESC" 		 	id="SBE_DESC" 			type="hidden" value="<?= $SBE_DESC; ?>">
			<input name="SBE_ID" 		 	id="SBE_ID" 			type="hidden" value="<?= $SBE_ID; ?>">
			<input name="SBE_DIV_VALOR"  	id="SBE_DIV_VALOR" 		type="hidden" value="<?= $SBE_DIV_VALOR; ?>">
			<input name="SBE_DIV_UNIDADE" 	id="SBE_DIV_UNIDADE" 	type="hidden" value="<?= $SBE_DIV_UNIDADE; ?>">
			<input name="SBE_FORM" 			id="SBE_FORM" 			type="hidden" value="<?= $SBE_FORM; ?>">
			
			<?// NOME DO FORM AQUI - USADO PARA RETORNAR VALORES AO FORM?>
		    <input name="strform" type="hidden" value="formElemento">
			
			<?// DADOS DA TABELA DE SELECT E CAMPO PRINCIPAL DE ID E ORDER BY?>
			<input name="strcampo" 		type="hidden" value="descricao">
		    <input name="strtabela" 	type="hidden" value="tb_elemento">
		    <input name="stridtabela" 	type="hidden" value="id_elemento">
			
			<?// CAMPO A SER DESENHADO NO SELECT E QUAL A COLUNA QUE CAI NELE?>
			<input name="strdisplay" 	type="hidden" value="Busca de Elemento">
			<input name="strfrontable" 	type="hidden" value="1">
			
			<?// CAMPOS A SEREM SELECIONADO E RETORNADO AO SELECT?>
		    <input name="strnameCampo" 		type="hidden" value="IdSelecionado|txtcampodescricao">
			<input name="strnameCampotable" type="hidden" value="0|1">
			
			<?// cAMPOS USADOS PARA FILTRO NO FORMATO COLUNA-INPUT?>
			<input name="strFiltro" type="hidden" value="descricao-txtcampodescricao">
				
			<?// CAMPO A FICAR EM FOCO QUANDO SELECIONAR UM REGISTRO?>
			<input name="strcampofocus" type="hidden" value="txtcampodescricao">
			
			<?// TABELA A RECEBER DADOS, COLUNAS E VALORES e colunas que nao podem ter valor duplicado -C se for caracter e -I se for inteiro?>
			<input name="insTable" type="hidden" value="tb_elemento">
			<input name="insColum" type="hidden" value="cod_tipo_elemento|cod_genero|descricao">
			<input name="insValue" type="hidden" value="cboTipo-I|cboGenero-I|txtcampodescricao-C">
			
			<?// COLUNAS QUE DEVER SER UNIQUES?>
			<input name="insUnique" type="hidden" value="descricao-txtcampodescricao-C">
		</form>
	</body>
</html>
<? include("../library/footer.php"); ?>


 

 

 

 

 


/*ARQUIVO PHP QUE CHAMA A FUNÇÃO DO AJAX - etapaOS.php
MAIS ESPECIFICAMENTE NO TRECHO 

<img src="../images/lupa.jpg" title="Buscar Elemento" <?= $hs ?> border="0" width="20" alt="Buscar Elemento" align="absmiddle" onClick="oculta_combo(); abrenovadiv(); abrirElemento(); />


abrirElemento() É UMA FUNÇÃO NESTA PÁGINA QUE CHAMA A FUNÇÃO DO AJAX
*/






<?
session_start();

include("../library/functions.php");
include("../classes/EtapaOS.class.php");

//TRADUZ
$Dic1 = new Traduz(162, $USUARIO[7], $USUARIO[19]);
$DicRay1 = $Dic1->GetTraduz(1);
$DicRay2 = $Dic1->GetTraduz(3);

//PEGA ID DA OS SE EXISTIR
$id_os = $_REQUEST['idordemservico'];

//Pegando a unidade organizacional da OS, para que no campo de bem s? venha a itens que pertencem ? mesma unidade organizacional
$Quo = DBSEL("select os.id_unid_org from tb_os os where os.id_os = $id_os");
list($id_unid_org_os) = dbsel_fetch_array($Quo);

if (!empty($id_os)) {
    $id_etapa = $_REQUEST['id_etapaOS'];

    $etapaOS = new EtapaOS($id_etapa);

    if (!empty($id_etapa)) {
        $OS = new OS($id_os, $id_etapa);

        //PREENCHE A TELA
        $query = "SELECT TEO.dsc_etapa_os, TEO.id_status,TEO.id_etapa_os,TEO.id_elemento,TEO.id_elem_conceito,TEO.codi_combo_servico,
                              TEO.id_ptserv,TEO.id_equipe,TEO.id_responsavel,TEO.id_elemento_ponto,TEO.id_ctro_servico,TEO.id_tip_tarefa,
                              TEO.duracao_parada,TEO.duracao_setup,TEO.condicao_elemento,TEO.perc_concluida,TEO.dt_prev_inicio,
                              TEO.dt_prev_fim,TEO.dt_real_inicio,TEO.dt_real_fim,TEO.custo_prev,TEO.custo_real,TEO.preco_prev,
                              TEO.preco_real,TEO.restricao,TEO.dt_restricao,TEO.numero_etapa_os,TEO.quantidade,TEO.interdita,TEO.obs,
                              TEO.interna,TEO.id_fornecedor,TEO.cod_acervo,OS.numero_os, OS.nome_os
                       FROM tb_osetap TEO
                       INNER JOIN  tb_os OS ON OS.id_os = TEO.id_os
                       WHERE TEO.id_etapa_os = $id_etapa AND TEO.id_instituicao IN ($USUARIO[17])";


        $result = @DBSEL($query);

        $descricao = $result[0][0];
        $id_status = $result[0][1];
        $id_etapa = $result[0][2];
        $id_bem = $result[0][3];
        $id_servico = $result[0][4];
        $id_condicao = $result[0][5];
        $id_ptserv = $result[0][6];
        $id_equipe = $result[0][7];
        $id_responsavel = $result[0][8];
        $id_elemponto = $result[0][9];
        $id_centro = $result[0][10];
        $id_tarefa = $result[0][11];
        $interdicao = $result[0][12];
        $setup = $result[0][13];
        $condicao = $result[0][14];
        $porcent = $result[0][15];
        $dt_prev_ini = $result[0][16];
        $dt_prev_fim = $result[0][17];
        $dt_real_ini = $result[0][18];
        $dt_real_fim = $result[0][19];
        $custo_prev = $result[0][20];
        $custo_real = $result[0][21];
        $preco_prev = $result[0][22];
        $preco_real = $result[0][23];
        $id_tip_restricao = $result[0][24];
        $data = $result[0][25];
        $num_etapa_os = $result[0][26];
        $quantidade = $result[0][27];
        $id_interdita = $result[0][28];
        $observacao = $result[0][29];
        $interna = $result[0][30];
        $id_fornecedor = $result[0][31];
        $cod_acervo = $result[0][32];
        $num_os = $result[0][33];
        $desc_os = $result[0][34];

        $disabled_falha = !empty($cod_acervo) ? "disabled" : "";
        $disabled_status = ($id_status == 80 || $id_status == 90) ? "disabled" : "";


        //INTERDITA
        switch ($id_interdita) {
            case "1":
                $interdita = "Sim";
                $disabled_interna = "";
                break;
            case "2":
                $interdita = "Não";
                $disabled_interna = "disabled";
                break;
        }

        if (empty($interna)) {
            $interna = 2;
        }

        //ACERVO
        $acervo = (!empty($cod_acervo)) ? $OS->GetAcervo($cod_acervo) : "Sem Acervo Cadastrado.";


        //STATUS
        $status = $OS->GetStatus($id_status);

        //PONTO DE SERVI?O
        $pontserv = $OS->GetPontoServico($id_ptserv);

        //ELEMENTO DO PONTO
        $elepont = $OS->GetElemento($id_elemponto);

        //EQUIPE
        $equipe = $OS->GetEquipe($id_equipe);

        //RESPONSAVEL
        $respons = $OS->GetResponsavel($id_responsavel);

        //BEM
        $bem = $OS->GetElemento($id_bem);

        //SERVI?O
        $servico = $OS->GetElemento($id_servico);

        //CENTRO DE SERVI?O
        $centro = $OS->GetCentroServico($id_centro);

        //CONDI??O DO SERVIçO
        $cond_serv = $OS->GetCondicaoServico($id_condicao);

        //TAREFA
        $tarefa = $OS->GetTarefa($id_tarefa);

        //RESTRIçãO
        $restricao = $OS->GetRestricao($id_tip_restricao);

        //QUANTIDADE DE ITENS
        $num_item = $OS->GetItensEtapa();

        //QUANTIDADE DE DEPENDNCIA
        $num_dep = $OS->GetNumDependencia();

        //QUANTIDADE DE REPOSITORIO
        $num_rep = $OS->GetNumRepositorio();

        //QUANTIDADE DE PARECER
        $num_par = $OS->GetNumParecerEtapa();

        //SELECIONA A SIGLA DA UNIDADE DO SERVIO
        $unidade = $OS->GetUnidadeElemento($id_servico);

        //FONTE CONTIDA NA MAIORIA DOS ITENS
        $id_fonte = $OS->GetMaximoFonte();

        //FONTE
        $fonte = $OS->GetFonte($id_fonte);

        //REGIAO CONTIDA NA MAIORIA DOS ITENS
        $id_regiao = $OS->GetMaximoRegiao();

        //REGIAO
        $regiao = $OS->GetRegiao($id_regiao);
    } else {
        $OS = new OS($id_os);

        $interna = 2;
    }
}

//PEGA A SIGLA DA MOEDA
$moeda = $OS->GetMoeda();

//VERIFICA SE CORRETIVA OU N?O
$nat_falha = $OS->GetNaturezaOS();
?>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<link rel="StyleSheet" type="text/css" href="../tree/dtree.css"/>
<link rel="stylesheet" type="text/css" href="../restrita/css.css">
<link rel="stylesheet" type="text/css" href="../css/padrao.css">
<script type="text/javascript" src="../JS/ajax.js"></script>
        <style type="text/css">
            .subcategoria
            {
                position: absolute;
                z-index: 1;
                top: 43px;
                left: 28px;
                width: 99%;
                border: 1px solid black;
                background-color: #CFE7CF;
                display: block;
            }
            .subcategoria1
            {
                position: absolute;
                z-index: 0;
                display: none;
            }
        </style>

        <script language="javascript">
            function insert_etapa()
            {
                ajax_dinamic('formEtapaOS','../retorno_ajax/filtro_insup_etapa.php?acao=1','pop','','','',0,'',0,'','');
            }

            function update_etapa()
            {
                ajax_dinamic('formEtapaOS','../retorno_ajax/filtro_insup_etapa.php?acao=2','pop','','','',0,'',0,'','');
            }

            function confirma(msg, acao)
            {
                decisao = confirm(msg);

                if (decisao == true)
                {
                    if(acao == 1)
                    {
                        ajax_dinamic('formEtapaOS','../processos/editando_inserindo.php?flag_controle=autenticado&etapaOS=inserindo','retorno_inserindo','txtIdOrderServico|txtNumeroEtapaOS|cboBem|cboServico|cboTarefa|cboCentroServico|cboRestricao|cboStatus|txtEtapa|txtNumeroOS|txtDuracaoInterdicao|rdbCondicaoDoBem|txtDuracaoSetup|txtPorcentagemConcluida|txtDataPrevistaInicio|txtDataPrevistaFim|txtDataRealizadaInicio|txtDataRealFim|txtCustoPrevisto|txtCustoRealizado|txtPrecoPrevisto|txtPrecoRealizado|txtIdOrderServico|txtIdOrdemServico|txtNumeroEtapaOS','<?
for ($i = 0; $i < sizeof($chave); $i++) {
    echo $mensagem[$i];
}
?>','',0,'',1,'btnTodos','btnAlterar|btnExcluir');
                habilitaBotaoItem(1);
            } else
            {
                ajax_dinamic('formEtapaOS','../processos/editando_inserindo.php?flag_controle=autenticado&etapaOS=editando','retorno_inserindo','txtIdOrderServico|txtNumeroEtapaOS|cboBem|cboServico|cboTarefa|cboCentroServico|cboRestricao|cboStatus|txtEtapa|txtNumeroOS|txtDuracaoInterdicao|rdbCondicaoDoBem|txtDuracaoSetup|txtPorcentagemConcluida|txtDataPrevistaInicio|txtDataPrevistaFim|txtDataRealizadaInicio|txtDataRealFim|txtCustoPrevisto|txtCustoRealizado|txtPrecoPrevisto|txtPrecoRealizado|txtIdOrdemServico|txtNumeroEtapaOS','<?
for ($i = 0; $i < sizeof($chave); $i++) {
    echo $mensagem[$i];
}
?>','',1,'Deseja mesmo alterar ?',1,'','');
                habilitaBotaoItem(1);
                desabilita_campos();
            }
        }
    }

    function MSg_1(){

        alert('N\u00e3o existe custo para Aprova\u00e7\u00e3o');
    }
    function MSg_2(){

        alert('Sem permiss\u00e3o para Aprova\u00e7\u00e3o');
    }

    function insup(acao)
    {
        if(acao == 1)
        {
            ajax_dinamic('formEtapaOS','../processos/editando_inserindo.php?flag_controle=autenticado&etapaOS=inserindo','retorno_inserindo','txtIdOrderServico|txtNumeroEtapaOS|cboBem|cboServico|cboTarefa|cboCentroServico|cboRestricao|cboStatus|txtEtapa|txtNumeroOS|txtDuracaoInterdicao|rdbCondicaoDoBem|txtDuracaoSetup|txtPorcentagemConcluida|txtDataPrevistaInicio|txtDataPrevistaFim|txtDataRealizadaInicio|txtDataRealFim|txtCustoPrevisto|txtCustoRealizado|txtPrecoPrevisto|txtPrecoRealizado|txtIdOrderServico|txtIdOrdemServico|txtNumeroEtapaOS|txtObservacao','<?
for ($i = 0; $i < sizeof($chave); $i++) {
    echo $mensagem[$i];
}
?>','',0,'',1,'btnTodos','btnAlterar|btnExcluir');
            habilitaBotaoItem(1);
        } else
        {
            ajax_dinamic('formEtapaOS','../processos/editando_inserindo.php?flag_controle=autenticado&etapaOS=editando','retorno_inserindo','txtIdOrderServico|txtNumeroEtapaOS|cboBem|cboServico|cboTarefa|cboCentroServico|cboRestricao|cboStatus|txtEtapa|txtNumeroOS|txtDuracaoInterdicao|rdbCondicaoDoBem|txtDuracaoSetup|txtPorcentagemConcluida|txtDataPrevistaInicio|txtDataPrevistaFim|txtDataRealizadaInicio|txtDataRealFim|txtCustoPrevisto|txtCustoRealizado|txtPrecoPrevisto|txtPrecoRealizado|txtIdOrdemServico|txtNumeroEtapaOS|txtObservacao','<?
for ($i = 0; $i < sizeof($chave); $i++) {
    echo $mensagem[$i];
}
?>','',1,'Deseja mesmo alterar ?',1,'','');
            habilitaBotaoItem(1);
            desabilita_campos();
        }
    }

    function desabilita_campos()
    {
        var CTL 	 = document.formEtapaOS.ctlhid.value;

        if(document.getElementById('cboStatus').value == 80)
        {
            if(document.getElementById('rdbInternaN').checked)
            {
                if(document.getElementById('txtBem').value != '' && document.getElementById('txtServico').value != '' && document.getElementById('cboCondServ').value != '0' && document.getElementById('cboCentroServico').value != '0' && document.getElementById('cbousuario').value != '0' && document.getElementById('txtDataPrevistaInicio').value != '' && document.getElementById('txtDataPrevistaFim').value != '')
                {
                    var flag = 1;
                }
            } else
            {
                if(document.getElementById('txtBem').value != '' && document.getElementById('txtServico').value != '' && document.getElementById('cboCondServ').value != '0' && (document.getElementById('cboFornecedor') && document.getElementById('cboFornecedor').value != '0') && document.getElementById('txtDataPrevistaInicio').value != '' && document.getElementById('txtDataPrevistaFim').value != '')
                {
                    var flag = 2;
                }
            }
        }

        if (flag == 1)
        {
            document.getElementById('txtEtapa').disabled 					= true;
            document.getElementById('rdbInternaS').disabled 				= true;
            document.getElementById('rdbInternaN').disabled 				= true;
            document.getElementById('txtBem').disabled 						= true;
            document.getElementById('cboPonto').disabled 					= true;
            document.getElementById('cboElementoPonto').disabled 			= true;
            document.getElementById('txtServico').disabled 					= true;
            document.getElementById('cboCondServ').disabled 				= true;
            document.getElementById('txtquantidade').disabled 				= true;
            document.getElementById('cboFonte').disabled 					= true;
            document.getElementById('cboRegiao').disabled 					= true;
            document.getElementById('cboCentroServico').disabled 			= true;
            document.getElementById('cboEquipe').disabled 					= true;
            document.getElementById('cbousuario').disabled 					= true;
            document.getElementById('txtObservacao').disabled 				= true;
            document.getElementById('cbointerdita').disabled 				= true;
            document.getElementById('txtDuracaoInterdicao').disabled		= true;
            document.getElementById('txtPorcentagemConcluida').disabled 	= true;
            document.getElementById('txtDuracaoSetup').disabled 			= true;
            document.getElementById('txtDataPrevistaInicio').disabled 		= true;
            document.getElementById('txtDataPrevistaFim').disabled 			= true;
            document.getElementById('txtDataRealizadaInicio').disabled 		= true;
            document.getElementById('txtDataRealFim').disabled 				= true;
            document.getElementById('txtCustoPrevisto').disabled 			= true;
            document.getElementById('txtCustoRealizado').disabled 			= true;
            document.getElementById('txtPrecoPrevisto').disabled 			= true;
            document.getElementById('txtPrecoRealizado').disabled 			= true;
            document.getElementById('btnincluindo').disabled 				= true;
            document.getElementById('btnlimpar').disabled 					= true;
            document.getElementById('btnExcluir').disabled 					= true;

            sttos = document.getElementById('sttos').value;

            list_status('formEtapaOS','DIV_cboStatus',''+sttos+'',''+CTL+'','2');
        } else
        {
            document.getElementById('txtEtapa').disabled 					= true;
            document.getElementById('rdbInternaS').disabled 				= true;
            document.getElementById('rdbInternaN').disabled 				= true;
            document.getElementById('txtBem').disabled 						= true;
            document.getElementById('cboPonto').disabled 					= true;
            document.getElementById('cboElementoPonto').disabled 			= true;
            document.getElementById('txtServico').disabled 					= true;
            document.getElementById('cboCondServ').disabled 				= true;
            document.getElementById('txtquantidade').disabled 				= true;
            document.getElementById('cboFonte').disabled 					= true;
            document.getElementById('cboRegiao').disabled 					= true;

            if(document.getElementById('cboFornecedor')){

                document.getElementById('cboFornecedor').disabled 				= true;

            }
            document.getElementById('txtObservacao').disabled 				= true;
            document.getElementById('cbointerdita').disabled 				= true;
            document.getElementById('txtDuracaoInterdicao').disabled		= true;
            document.getElementById('txtPorcentagemConcluida').disabled 	= true;
            document.getElementById('txtDuracaoSetup').disabled 			= true;
            document.getElementById('txtDataPrevistaInicio').disabled 		= true;
            document.getElementById('txtDataPrevistaFim').disabled 			= true;
            document.getElementById('txtDataRealizadaInicio').disabled 		= true;
            document.getElementById('txtDataRealFim').disabled 				= true;
            document.getElementById('txtCustoPrevisto').disabled 			= true;
            document.getElementById('txtCustoRealizado').disabled 			= true;
            document.getElementById('txtPrecoPrevisto').disabled 			= true;
            document.getElementById('txtPrecoRealizado').disabled 			= true;
            document.getElementById('btnincluindo').disabled 				= true;
            document.getElementById('btnlimpar').disabled 					= true;
            document.getElementById('btnExcluir').disabled 					= true;

            sttos = document.getElementById('sttos').value;

            list_status('formEtapaOS','DIV_cboStatus',''+sttos+'',''+CTL+'','2');
        }
    }

    function fc_unid_etapa(id_elem)
    {
        ajax_dinamic('formEtapaOS','../retorno_ajax/filtro_unid_etapa.php?tipo=1&paiun='+id_elem+'','Div_Unidade','','','',0,'',0,'','');
    }

    function fc_falha(id_elem)
    {
        ajax_dinamic('formEtapaOS','../retorno_ajax/filtro_falha_etapa.php?txtBem_hidden='+id_elem+'&filtro_todos=filtro_todos','div_falha','','','',0,'',0,'','');
    }

    function atualizafunc()
    {
        var valor 	 = document.formEtapaOS.cboCentroServico.value;

        Super_Combo('DISTINCT tb_funcionario.id_funcionario', 'tb_funcionario.nome', 'tb_funcionario,tb_func_centro_servico', 'where tb_func_centro_servico.cod_centro_servico= '+valor+'', 'tb_funcionario.nome', 'cbousuario', 'cbousuario', 'combo_elemento_equipe', '15', 'DIV_cbousuario', 'formEtapaOS', '');
    }

    function goitem()
    {
        var CTL 	 = document.formEtapaOS.ctlhid.value;
        var id_etapa = document.formEtapaOS.id_etapa2.value;
        var id_os 	 = document.formEtapaOS.txtIdOrdemServico.value;
        var url 	 = document.formEtapaOS.urltoreturn.value;
        var retorno	 = document.formEtapaOS.retorno.value;

        elmLoop(document.formEtapaOS.IdSelecionado_banco.value,'CadastrarItemEtapa.php?CTL='+CTL+'&id_etapa='+id_etapa+'&idordemservico='+id_os+'&urltoreturn2='+url+'&retorno2='+retorno+'',1,'','','etapaOS.php');
        return false
    }

    function enabled_fornecedor(valor)
    {
        var CTL 			= document.formEtapaOS.ctlhid.value;
        var id_fornecedor 	= document.formEtapaOS.id_fornecedor.value;

        if (valor == 1)
        {
            ajax_dinamic('formEtapaOS','../retorno_ajax/filtrocombo_fornecedor.php?CTL='+CTL+'&id_fornecedor='+id_fornecedor+'&filtro_todos=2','Div_Fornecedor','','','',0,'',0,'','');
        }
    }

    function enabled_centro(valor)
    {
        var CTL 		= document.formEtapaOS.ctlhid.value;
        var id_centro 	= document.formEtapaOS.id_centro.value;
        var centro 		= document.formEtapaOS.centro.value;
        var id_equipe 	= document.formEtapaOS.id_equipe.value;
        var equipe 		= document.formEtapaOS.equipe.value;
        var id_respons 	= document.formEtapaOS.id_respons.value;
        var respons 	= document.formEtapaOS.respons.value;

        if (valor == 2)
        {
            ajax_dinamic('formEtapaOS','../retorno_ajax/filtrocombo_fornecedor.php?CTL='+CTL+'&id_centro='+id_centro+'&centro='+centro+'&id_equipe='+id_equipe+'&equipe='+equipe+'&id_respons='+id_respons+'&respons='+respons+'&filtro_todos=1','Div_Fornecedor','','','',0,'',0,'','');
        }
    }

    function mostra_duracao(valor)
    {
        if (valor == 1)
        {
            document.getElementById('txtDuracaoInterdicao').disabled = false;
        } else if (valor == 2)
        {
            document.getElementById('txtDuracaoInterdicao').disabled = true;
        }
    }

    function list_falha_ck()
    {
        var id_elem 	= document.formEtapaOS.txtBem_hidden.value;

        if(id_elem != '')
        {
            ajax_dinamic('formEtapaOS','../retorno_ajax/filtro_falha_etapa.php?txtBem_hidden='+id_elem+'&filtro_todos=filtro_todos','div_falha','','','',0,'',0,'','');
        } else
        {
            fnOpen("Por favor selecione um Bem!");
            document.getElementById('cktipfalha').checked = false;
        }
    }

    function validaporcentagem(valor)
    {
        if(valor.value > 100)
        {
            fnOpen("O valor digitado n\u00e3o pode ser maior que 100!");
            document.getElementById('txtPorcentagemConcluida').value = "";
            document.getElementById('txtPorcentagemConcluida').focus();
        }

        if(document.getElementById('cboStatus').value == 05 && valor.value == 100)
        {
            fnOpen("Porcentagem para esse status n\u00e3o pode ser de 100!");
            document.getElementById('txtPorcentagemConcluida').value = "";
            document.getElementById('txtPorcentagemConcluida').focus();
        }
    }

    function maxleght_textarea(valor,maximo)
    {
        if (valor.value.length > maximo)
        {
            valor.value = valor.value.substring(0, maximo);
        }
    }

    function inf_div(valor)
    {
        var elemento = document.getElementById("categoria");

        if (valor == "")
        {
            return false;
        } else if (valor == "")
        {
            return false;
        } else
        {
            elemento.className = "subcategoria";
            elemento.innerHTML = valor;
        }
    }
    function class_div()
    {
        var elemento = document.getElementById("categoria");

        elemento.className = "subcategoria1";
    }

    function formataValor(id, tamanhoMaximo, teclaPressionada)
    {
        var valor, teclar, compString;

        if(window.event)
        { // Internet Explorer
            tecla = teclaPressionada.keyCode;
        }
        else if(teclaPressionada.which)
        { // Nestcape / firefox
            tecla = teclaPressionada.which;
        }

        valor = document.getElementById(id).value;
        valor = valor.toString().replace("/", "");
        valor = valor.toString().replace("/", "");
        valor = valor.toString().replace(",", "");
        valor = valor.toString().replace(".", "");
        valor = valor.toString().replace(".", "");
        valor = valor.toString().replace(".", "");
        valor = valor.toString().replace(".", "");
        compString = valor.length;

        if(compString < tamanhoMaximo && tecla != 8)
        {
            compString = valor.length + 1;
        }

        if(tecla == 8 )
        {
            compString = compString - 1;
        }

        if(tecla == 8 || tecla >= 48 && tecla <= 57 || tecla >= 96 && tecla <= 105)
        {
            if(compString <= 2)
            {
                document.getElementById(id).value = valor;
            }
            if((compString > 2) && (compString <= 5))
            {
                document.getElementById(id).value = valor.substr(0, compString - 2) + ',' + valor.substr(compString - 2, compString);
            }
            if((compString >= 6) && (compString <= 8) )
            {
                document.getElementById(id).value = valor.substr(0, compString - 5) + '.' + valor.substr(compString - 5, 3) + ',' + valor.substr(compString - 2, compString);
            }
            if((compString >= 9) && (compString <= 11))
            {
                document.getElementById(id).value = valor.substr(0, compString - 8) + '.' + valor.substr(compString - 8, 3) + '.' + valor.substr(compString - 5, 3) + ',' + valor.substr(compString - 2, compString);
            }
            if((compString >= 12) && (compString <= 14))
            {
                document.getElementById(id).value = valor.substr(0, compString - 11) + '.' + valor.substr(compString - 11, 3) + '.' + valor.substr(compString - 8, 3) + '.' + valor.substr(compString - 5, 3) + ',' + valor.substr(compString - 2, compString);
            }
            if((compString >= 15) && (compString <= 17) )
            {
                document.getElementById(id).value = valor.substr(0, compString - 14) + '.' + valor.substr(compString - 14, 3) + '.' + valor.substr(compString - 11, 3) + '.' + valor.substr(compString - 8, 3 ) + '.' + valor.substr(compString - 5, 3) + ',' + valor.substr(compString - 2, compString);
            }
        }
    }

    function habilitaBotaoItem(tipo)
    {
        if(tipo == 1)
        {
            document.getElementById("btnItemEtapa").disabled 	= false;
            document.getElementById("btnDependencia").disabled 	= false;
            document.getElementById("btnRepositorio").disabled 	= false;
            document.getElementById("btnParecer").disabled 		= false;
        }
        else
        {
            document.getElementById("btnItemEtapa").disabled 	= true;
            document.getElementById("btnDependencia").disabled 	= true;
            document.getElementById("btnRepositorio").disabled 	= true;
            document.getElementById("btnParecer").disabled 		= true;
        }
    }

    function habilitaAlterar(tipo)
    {
        if(tipo == 1)
        {
            document.getElementById("btnAlterar").disabled  	= false;
            document.getElementById("btnExcluir").disabled   	= false;
            document.getElementById("btnincluindo").disabled 	= true;
        }
        else
        {
            document.getElementById("btnAlterar").disabled 	    = true;
            document.getElementById("btnExcluir").disabled 	    = true;
            document.getElementById("btnincluindo").disabled 	= false;
        }
    }

    function validar_datafinal()
    {
        if(document.getElementById('txtDataPrevistaFim').value != "")
        {
            data1 	= document.getElementById('txtDataPrevistaInicio').value;
            data2   = document.getElementById('txtDataPrevistaFim').value;
            datade  = data1.split('/');
            dataate = data2.split('/');

            if(dataate[2] > datade[2])
            {
                return false;
            } else if(dataate[2] < datade[2])
            {
                fnOpen(" Aten\u00e7\u00e3o, data final menor que data inicial!");
                document.getElementById('txtDataPrevistaInicio').value  = "";
                document.getElementById('txtDataPrevistaFim').value = "";
                document.getElementById('txtDataPrevistaInicio').focus();
                return false;
            } else
            {
                if(dataate[1] > datade[1])
                {
                    return false;
                } else if(dataate[1] < datade[1])
                {
                    fnOpen(" Aten\u00e7\u00e3o, data final menor que data inicial!");
                    document.getElementById('txtDataPrevistaInicio').value  = "";
                    document.getElementById('txtDataPrevistaFim').value = "";
                    document.getElementById('txtDataPrevistaInicio').focus();
                    return false;
                } else
                {
                    if(dataate[0] >= datade[0])
                    {
                        return false;
                    } else
                    {
                        fnOpen(" Aten\u00e7\u00e3o, data final menor que data inicial!");
                        document.getElementById('txtDataPrevistaInicio').value  = "";
                        document.getElementById('txtDataPrevistaFim').value = "";
                        document.getElementById('txtDataPrevistaInicio').focus();
                        return false;
                    }
                }
            }
        }
    }

    function DataValidar(StrValue,StrCampo)
    {
        if(StrValue.value.length == 10)
        {
            ValidaDataReg(StrValue,StrCampo);
        }
    }

    function validar_datafinal2()
    {
        if(document.getElementById("txtDataRealizadaInicio").value != "")
        {
            if(document.getElementById('cboStatus').value == 05)
            {
                fnOpen(" Aten\u00e7\u00e3o, n\u00e3o pode haver data real de in\u00edcio para esse status!");
                document.getElementById('txtDataRealizadaInicio').value = "";
                document.getElementById('txtDataRealizadaInicio').focus();
            }
        }

        if(document.getElementById('txtDataRealFim').value != "")
        {
            data1 	= document.getElementById('txtDataRealizadaInicio').value;
            data2   = document.getElementById('txtDataRealFim').value;
            datade  = data1.split('/');
            dataate = data2.split('/');

            if(dataate[2] > datade[2])
            {
                return false;
            } else if(dataate[2] < datade[2])
            {
                fnOpen(" Aten\u00e7\u00e3o, data final menor que data inicial!");
                document.getElementById('txtDataRealizadaInicio').value  = "";
                document.getElementById('txtDataRealFim').value = "";
                document.getElementById('txtDataRealizadaInicio').focus();
                return false;
            } else
            {
                if(dataate[1] > datade[1])
                {
                    return false;
                } else if(dataate[1] < datade[1])
                {
                    fnOpen(" Aten\u00e7\u00e3o, data final menor que data inicial!");
                    document.getElementById('txtDataRealizadaInicio').value  = "";
                    document.getElementById('txtDataRealFim').value = "";
                    document.getElementById('txtDataRealizadaInicio').focus();
                    return false;
                } else
                {
                    if(dataate[0] >= datade[0])
                    {
                        return false;
                    } else
                    {
                        fnOpen(" Aten\u00e7\u00e3o, data final menor que data inicial!");
                        document.getElementById('txtDataRealizadaInicio').value  = "";
                        document.getElementById('txtDataRealFim').value = "";
                        document.getElementById('txtDataRealizadaInicio').focus();
                        return false;
                    }
                }
            }
        }
    }

    function DataValidar2(StrValue,StrCampo)
    {
        if(StrValue.value.length == 10)
        {
            ValidaDataReg(StrValue,StrCampo);
        }
    }

    //FUNO PARA FILTRO PARA COMBO DE EQUIPE NA TELA  ETAPAOS.PHP - FABRICIO RODRIGUES - 25/09/2008
    function list_dados_Equipe(id_equipe,descricao)
    {
        var CTL = document.formEtapaOS.ctlhid.value;

        ajax_dinamic('formEtapaOS','../retorno_ajax/filtro_comboEquipe.php?CTL='+CTL+'&id_equipecentro='+id_equipe+'&filtro_todos=filtro_todos&descricao='+descricao+'','DIV_cboEquipe','','','',0,'',0,'','');
    }

    //FUNO PARA FILTRO PARA COMBO DE EQUIPE NA TELA  ETAPAOS.PHP - FABRICIO RODRIGUES - 25/09/2008
    function list_dados_Responsavel(id_responsavel,descricao)
    {
        var CTL = document.formEtapaOS.ctlhid.value;

        ajax_dinamic('formEtapaOS','../retorno_ajax/filtro_comboResponsavel.php?CTL='+CTL+'&id_responsavel='+id_responsavel+'&filtro_todos=filtro_todos&descricao='+descricao+'','DIV_cbousuario','','','',0,'',0,'','');
    }

    function ID(valor,valor2)
    {
        document.getElementById('txtBem').value  = valor2;
    }

    /**
     * abrirElemento
     */
    function abrirElemento() {
        ajax_dinamic('formEtapaOS', '../POPS/SuperBuscaElemento.php?CTL=<?= $_REQUEST['CTL']; ?>&SBE_FORM=formEtapaOS&SBE_DIV=DIV_cboBem&SBE_DESC=txtBem&SBE_ID=txtBem_hidden&SBE_BIS=1&SBE_DIV_VALOR=null&SBE_DIV_UNIDADE=null&SBE_DIV_RESP=null','pop','','','',0,'',0,'','');
    }
        </script>

    </head>
    <body scroll="yes" onResize="" <?= isset($_REQUEST[idEtapa]) ? '' : "onLoad=\"list_status('formEtapaOS','DIV_cboStatus','$id_status','{$_REQUEST[CTL]}','2');\""; ?> >
        <form name="formEtapaOS" id="formEtapaOS" method="post">
            <input type="hidden" name="id_etapa" id="id_etapa" value="<?= (!empty($id_etapa) ? $id_etapa : '0'); ?>">
            <input type="hidden" name="ctlhid" id="ctlhid" value="<?= $_REQUEST[CTL]; ?>">
            <input type="hidden" name="id_fornecedor" id="id_fornecedor" value="<?= $id_fornecedor; ?>">
            <input type="hidden" name="id_centro" id="id_centro" value="<?= $id_centro; ?>">
            <input type="hidden" name="centro" id="centro" value="<?= $centro; ?>">
            <input type="hidden" name="urltoreturn" id="urltoreturn" value="<?= $_REQUEST[urltoreturn]; ?>">
            <input type="hidden" name="retorno" id="retorno" value="<?= $_REQUEST[retorno]; ?>">
            <input type="hidden" name="id_equipe" id="id_equipe" value="<?= $id_equipe; ?>">
            <input type="hidden" name="equipe" id="equipe" value="<?= $equipe; ?>">
            <input type="hidden" name="id_respons" id="id_respons" value="<?= $id_responsavel; ?>">
            <input type="hidden" name="respons" id="respons" value="<?= $respons; ?>">
            <input type="hidden" name="nat_falha" id="nat_falha" value="<?= $nat_falha; ?>">

            <table class="tborder" cellpadding="1" cellspacing="1" border="0" width="100%" align="center">
                <tr>
                    <td width="77%" class="thead"><?= "Etapa da OS:"; ?>  
                        <span style="color: yellow;"><?= "($num_etapa_os) $descricao da OS ($num_os) $desc_os"; ?></span>
                    </td>


                    <td width="23%" class="thead"><?= ValidandoTimePage(); ?></td>
                </tr>
                <tr>
                    <td colspan="2" align="center" class="panelsurround">
                        <div class="panel">
                            <table width="98%" border="0" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td>
                                        <div class="subcategoria1" id="categoria" ></div>
                                        <fieldset class="fieldset">
                                            <table border="0" width="100%" cellpadding="2" cellspacing="2">
                                                <tr>
                                                    <td> </td>
                                                    <td> </td>
                                                    <td> </td>
                                                </tr>
                                                <tr>
                                                    <td> </td>
                                                    <td> </td>
                                                    <td> </td>
                                                </tr>
                                                <tr>
                                                    <td width="30%"><?= "Descrição da Etapa"; ?></td>
                                                    <td width="30%"><?= "Status"; ?></td>
                                                    <td width="40%"><?= "Terceirizada"; ?></td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <input name="txtEtapa" type="text" <?= $hs ?> <?= $disabled_status ?> class="texto2" id="txtEtapa" size="43" maxlength="37" tabindex="1" value="<?= (!empty($descricao) ? $descricao : ''); ?>">
                                                    </td>
                                                    <td>
                                                        <div name="DIV_cboStatus" id="DIV_cboStatus">
                                                            <select name="cboStatus" class="combo_elemento3-300" id="cboStatus" tabindex="2" style="width: 100%;" <?= $hs ?>>
                                                                <?php
                                                                $query = "SELECT id_tipo_status_os, descricao_tipo FROM tb_sttos
										            					   WHERE id_tipo_status_os = '05' AND id_instituicao IN ($USUARIO[17])
										            					   ORDER BY descricao_tipo ASC";
                                                                $result = @DBSEL($query);

                                                                if (count($result) >= 1) {
                                                                ?>
                                                                    <option value="<?= (!empty($id_status) ? $id_status : '0'); ?>"><?= (!empty($status) ? "(" . $id_status . ")" . $status : 'Escolha...'); ?></option>"; <?
                                                                    foreach ($result as $rows) {
                                                                ?>
                                                                        <option value="<?= $rows[0]; ?>"><?= "(" . $rows[0] . ") " . $rows[1]; ?></option> <?
                                                                    }
                                                                } else {
                                                                    echo "<option value=\"0\">" . Acentos("N�o h� Status cadastrados") . "</option>";
                                                                }
                                                                ?>
                                                            </select>
                                                        </div>
                                                    </td>
                                                    <td>
                                                        <input name="rdbInterna" <?= $disabled_status ?> <?= $hs ?> id="rdbInternaS" tabindex="3" type="radio" value="1" <?php if ($interna == "1") { ?> checked <?php } ?> onclick="enabled_fornecedor(this.value);">Sim
                                                        <input name="rdbInterna" <?= $disabled_status ?> <?= $hs ?> id="rdbInternaN" tabindex="4" type="radio" value="2" <?php if ($interna == "2") { ?> checked <?php } ?> onclick="enabled_centro(this.value);">Não
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td><?= "Bem"; ?></td>
                                                    <td><?= "Ponto de Serviço"; ?></td>
                                                    <td><?= "Bem do Ponto de Serviço"; ?></td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <div name="DIV_cboBem" id="DIV_cboBem">
                                                            <input type="text" class="texto2" <?= $disabled_status ?> tabindex="5" <?= $hs ?> id="txtBem" name="txtBem" size="43" value="<?= (!empty($bem) ? $bem : ''); ?>"
                                                                   onMouseOver="inf_div(this.value);"
                                                                   onChange="inf_div(this.value);"
                                                                   onMouseOut="class_div();"
                                                                   onselect="alert('N\u00e3o \u00e9 permitido selecionar o elemento!')"
                                                                   onblur="limpa_idcampo(this.value,'txtBem_hidden');class_div();"
                                                                   onclick="autocomplete('txtBem','1','txtBem_hidden')">
                                                                   <?
                                                                   if (empty($disabled_status)) {
                                                                   ?>
                                                                <img src="../images/lupa.jpg" title="Buscar Elemento" <?= $hs ?> border="0" width="20" alt="Buscar Elemento" align="absmiddle" onClick="oculta_combo(); abrenovadiv(); abrirElemento();
                                                                     ">
                                                                 <? } ?>
                                                              <input type="hidden" id="txtBem_hidden" name="txtBem_hidden" value="<?= (!empty($id_bem) ? $id_bem : ''); ?>">
                                                              <input type="hidden" id="uo_os" name="uo_os" value="<?= $id_unid_org_os ?>">
                                                              <input type="hidden" id="autocomplete_dados" name="autocomplete_dados">
                                                          </div>
                                                      </td>
                                                      <td>
                                                          <div name="DIV_cboPonto" id="DIV_cboPonto">
                                                              <select name="cboPonto" id="cboPonto" tabindex="6" class="combo_elemento3-300" style="width: 82%" <?= $disabled_status ?> <?= $hs ?>>
                                                                  <option value=<?= (!empty($id_ptserv) ? $id_ptserv : NULL); ?>><?= (!empty($pontserv) ? $pontserv : 'Escolha um Bem Primeiro'); ?></option>

                                                                <?
                                                                   if (!empty($id_ptserv)) {
                                                                       $Select = Storage::connect()->prepare("SELECT TPS.descricao
                                                                                 FROM tb_ptserv TPS
                                                                                 WHERE TPS.id_elemento = :id_bem AND TPS.id_ptserv <> :id_ptserv
                                                                                 AND TPS.id_instituicao IN (:institution)
                                                                                 ORDER BY TPS.descricao ASC-:id_ptserv-:pontserv");

                                                                       $Select->execute(array(
                                                                           'id_bem' => $id_bem,
                                                                           'id_ptserv' => $id_ptserv,
                                                                           'institution' => $_SESSION[domain][institution],
                                                                           'pontserv' => $pontserv
                                                                       ));

                                                                       $descricao = $Select->fetchColumn();
                                                                ?>
                                                                       <option value="<?= $id_ptser ?>"><?= $descricao ?></option>
                                                                <? } ?>

                                                               </select>
                                                           </div>
                                                       </td>
                                                       <td>

                                                           <div name="DIV_cboElementoPonto" id="DIV_cboElementoPonto">
                                                               <select name="cboElementoPonto" id="cboElementoPonto" tabindex="7" class="combo_elemento3-300" style="width: 79%" <?= $disabled_status ?> <?= $hs ?>>
                                                                   <option value=<?= (!empty($id_ptserv) ? $id_ptserv : NULL); ?>><?= (!empty($pontserv) ? $pontserv : 'Escolha um Bem Primeiro'); ?></option>

                                                                <?
                                                                   if (!empty($id_ptserv)) {
                                                                       $Select = Storage::connect()->prepare("SELECT TE.descricao_elemento FROM tb_elemento TE
                                                                                 INNER JOIN tb_composicao_elemento TCE ON TCE.id_elemento_filho = TE.id_elemento
                                                                                        AND id_elemento <> ':id_elemponto' AND TE.id_instituicao IN (:institution)
                                                                                 INNER JOIN tb_ptserv TPS ON TPS.id_ptserv = TCE.id_ptserv AND TPS.id_ptserv = :id_ptserv-:id_elemponto-:elepont");

                                                                       $Select->execute(array(
                                                                           'id_elemponto' => $id_elemponto,
                                                                           'id_ptserv' => $id_ptserv,
                                                                           'institution' => $_SESSION[domain][institution],
                                                                           'pontserv' => $pontserv,
                                                                           'elepont' => $elepont
                                                                       ));

                                                                       $descricao = $Select->fetchColumn();
                                                                ?>
                                                                       <option value="<?= $id_elemponto ?>"><?= $descricao ?></option>
                                                                <?
                                                                   }
                                                                ?>

                                                               </select>
                                                           </div>
                                                       </td>
                                                   </tr>
                                                   <tr>
                                                       <td><?= "Serviço"; ?></td>
                                                       <td><?= "Condição de Serviço"; ?></td>
                                                       <td>
                                                           <table border="0" cellpadding="0" cellspacing="0">
                                                               <tr>
                                                                   <td>Quantidade de Serviço Aplicado</td>
                                                                   <td><div id="Div_Unidade"><?= (!empty($unidade) ? "(" . $unidade . ")" : ""); ?></div></td>
                                                               </tr>
                                                           </table>
                                                       </td>
                                                   </tr>
                                                   <tr>
                                                       <td>
                                                           <div name="DIV_cboServico" id="DIV_cboServico">
                                                               <input type="text" class="texto2" size="43" tabindex="8" id="txtServico" onselect="alert('N\u00e3o \u00e9 permitido selecionar o elemento!')" <?= $hs ?> <?= $disabled_status ?> name="txtServico" size="70" value="<?= (!empty($servico) ? $servico : ''); ?>" onblur="limpa_idcampo(this.value,'txtServico_hidden');" onMouseOver="inf_div(this.value);" onChange="inf_div(this.value);" onMouseOut="class_div();" onclick="autocomplete('txtServico','2,3,4','txtServico_hidden')">
                                                            <?
                                                                   if (empty($disabled_status)) {
                                                            ?>
                                                                       <img src="../images/lupa.jpg" title="Buscar Elemento" id="button2" border="0" width="20" alt="Buscar Elemento" align="absmiddle" onClick="abrenovadiv();ajax_dinamic('formEtapaOS','../POPS/SuperBuscaElemento.php?CTL=<?= $_REQUEST['CTL']; ?>&SBE_FORM=formEtapaOS&SBE_DIV=DIV_cboServico&SBE_DESC=txtServico&SBE_ID=txtServico_hidden&SBE_BIS=2,3,4,6&SBE_DIV_VALOR=null&SBE_DIV_UNIDADE=Div_Unidade&SBE_DIV_RESP=null','pop','','','',0,'',1,'','');">
                                                            <? } ?>
                                                                   <input type="hidden" id="txtServico_hidden" name="txtServico_hidden" value="<?= (!empty($id_servico) ? $id_servico : ''); ?>">
                                                               </div>
                                                           </td>
                                                           <td>
                                                               <div name="DIV_cboCondServ" id="DIV_cboCondServ">
                                                            <?
                                                                   Construct_Combo("SELECT TC.id_condicao, TC.descricao
											            					 FROM tb_condicao TC
											            					 WHERE TC.id_instituicao IN ($USUARIO[17])
																			 ORDER BY TC.descricao ASC-$id_condicao-$cond_serv",
                                                                           "9",
                                                                           "combo_elemento3-300",
                                                                           "cboCondServ",
                                                                           "",
                                                                           "Favor cadastrar",
                                                                           "style=\"width: 82%;\"",
                                                                           "$USUARIO[19]",
                                                                           "$hs $disabled_status");
                                                            ?>
                                                               </div>
                                                           </td>
                                                           <td>
                                                               <input name="txtquantidade" <?= $hs ?> <?= $disabled_status ?> tabindex="11" type="text" class="texto2" maxlength="6" id="txtquantidade" size="58" onKeyPress="return apenasnumeros(event, false)" value="<?= (!empty($quantidade) ? $quantidade : ''); ?>">
                                                           </td>
                                                       </tr>
                                                       <tr>
                                                           <td>Fonte</td>
                                                           <td>Região Valorada</td>
                                                           <td> </td>
                                                       </tr>
                                                       <tr>
                                                           <td>
                                                        <?
                                                                   //SELECIONA AS FONTES PARA AQUELE ELEMENTO
                                                                   Construct_Combo("SELECT id_fonte,descricao
																	   	 FROM tb_fonte WHERE id_instituicao IN ($USUARIO[17])
																	   	 ORDER BY descricao ASC-$id_fonte-$fonte",
                                                                           "12",
                                                                           "combo_elemento",
                                                                           "cboFonte",
                                                                           "",
                                                                           "Favor cadastrar",
                                                                           "style=\"width: 80%;\"",
                                                                           "$USUARIO[19]",
                                                                           "$disabled_status");
                                                        ?>
                                                               </td>
                                                               <td>
                                                        <?
                                                                   Construct_Combo("SELECT id_regiao, descricao
	        																 FROM tb_regiao WHERE id_instituicao IN ($USUARIO[17])
	        																 ORDER BY descricao ASC-$id_regiao-$regiao",
                                                                           "13",
                                                                           "combo_elemento3-300",
                                                                           "cboRegiao",
                                                                           "",
                                                                           "Favor cadastrar",
                                                                           "style=\"width: 82%;\"",
                                                                           "$USUARIO[19]",
                                                                           "$disabled_status");
                                                        ?>
                                                               </td>
                                                               <td> </td>
                                                           </tr>
                                                       </table>
                                                       <div id="Div_Fornecedor">
                                                <?
                                                                   if ($interna == 2) {
                                                ?>
                                                                       <table border="0" width="100%" cellpadding="2" cellspacing="2">
                                                                           <tr>
                                                                               <td width="30%"><?= "Centro de Serviço"; ?></td>
                                                                               <td width="30%"><?= "Equipe"; ?></td>
                                                                               <td width="40%"><?= "Responsável"; ?></td>
                                                                           </tr>
                                                                           <tr>
                                                                               <td>
                                                                                   <div name="DIV_cboCentroServico" id="DIV_cboCentroServico">
                                                                <?
                                                                       $inner = empty($id_servico) ? '' : "INNER JOIN tb_ceselm TC ON TC.id_ctro_servico = TCS.id_centro_servico AND TC.id_elemento = $id_servico";

                                                                       Construct_Combo("SELECT TCS.id_centro_servico,TCS.descricao
											            					   	   	 FROM tb_centro_servico TCS $inner ORDER BY TCS.descricao-$id_centro-$centro",
                                                                               "14",
                                                                               "combo_elemento3-300",
                                                                               "cboCentroServico",
                                                                               "onChange=\"Super_Combo('id_equipe', 'descricao', 'tb_equipe', 'where cod_centro_servico = '+this.value+'', 'descricao', 'cboEquipe', 'cboEquipe', 'combo_elemento_etapa', '14', 'DIV_cboEquipe', 'formEtapaOS', '');setTimeout('atualizafunc()',500);\"",
                                                                               "Favor cadastrar",
                                                                               "style=\"width: 80%;\"",
                                                                               "$USUARIO[19]",
                                                                               "$hs $disabled_status");
                                                                ?>
                                                                   </div>
                                                               </td>
                                                               <td>
                                                                   <div name="DIV_cboEquipe" id="DIV_cboEquipe">
                                                                       <select name="cbousuario" id="cbousuario" tabindex="15" class="combo_elemento3-300" style="width: 82%" <?= $hs . ' ' . $disabled_status ?>>
                                                                           <option ><?= 'Escolha' ?></option>


                                                                    <?
                                                                       $Select = Storage::connect()->query("select id_equipe,descricao from tb_equipe order by descricao");

                                                                       while ($row = $Select->fetch()) {

                                                                           $check_option = (!empty($id_equipe) && $id_equipe = $row['id_equipe']) ? 'checked="checked"' : "";
                                                                    ?>
                                                                           <option <?= $check_option ?> value="<?= $row['id_equipe'] ?>"><?= $row['descricao'] ?></option>
                                                                    <?
                                                                       }
                                                                    ?>

                                                                   </select>
                                                               </div>
                                                           </td>
                                                           <td>
                                                               <div name="DIV_cbousuario" id="DIV_cbousuario">
                                                                   <select name="cbousuario" id="cbousuario" tabindex="15" class="combo_elemento3-300" style="width: 82%" <?= $hs . ' ' . $disabled_status ?>>
                                                                       <option ><?= 'Escolha um Bem Primeiro' ?></option>

                                                                    <?
                                                                       $Select = Storage::connect()->query(" SELECT TF.id_funcionario,TF.nome
                                                                                                            FROM tb_funcionario TF
                                                                                                            ORDER BY TF.nome");


                                                                       while ($row = $Select->fetch()) {

                                                                           $check_option = (!empty($id_func) && $id_func == $row['id_funcionario']) ? 'checked="checked"' : "";
                                                                    ?>

                                                                           <option <?= $check_option ?> value="<?= $row['id_funcionario'] ?>"><?= $row['nome'] ?></option>
                                                                    <?
                                                                       }
                                                                    ?>

                                                                   </select>

                                                               </div>
                                                           </td>
                                                       </tr>
                                                   </table>
                                                <?
                                                                   } else {
                                                                       $inner = empty($id_servico) ? '' : "INNER JOIN tb_forn_elemento TFE ON TFE.id_fornecedor = TF.id_fornecedor AND TFE.id_elem_conceito = $id_servico ";
                                                ?>
                                                                       <table border="0" width="100%" cellpadding="2" cellspacing="2">
                                                                           <tr>
                                                                               <td width="30%"><?= "Fornecedor"; ?></td>
                                                                               <td width="30%"> </td>
                                                                               <td width="40%"> </td>
                                                                           </tr>
                                                                           <tr>
                                                                               <td>
                                                                                   <select id="cboFornecedor" class="combo_elemento" style="width:80%;" name="cboFornecedor">
                                                                <?
                                                                       $select = DBSEL("SELECT TF.id_fornecedor,TF.nome_fantasia
                                                                                    FROM tb_fornecedor TF $inner ORDER BY TF.nome_fantasia");

                                                                       foreach ($select as $column) {

                                                                           list($identify, $description) = $column;

                                                                           $default = $identify == $id_fornecedor ? 'selected="selected"' : '';

                                                                           echo "<option value='$identify' $default>$description</option>";
                                                                       }
                                                                ?>
                                                                   </select>
                                                               </td>
                                                               <td> </td>
                                                               <td> </td>
                                                           </tr>
                                                       </table><? } ?>
                                               </div>
                                            <?
                                                                   if ($nat_falha == 10) {
                                            ?>
                                                                       <table border="0" width="100%">
                                                                           <tr>
                                                                               <td class="texto2" width="30%"> </td>
                                                                               <td class="texto2" align="left">Falha</td>
                                                                           </tr>
                                                                           <tr>
                                                                               <td class="texto2">
                                                                                   <input type="checkbox" name="cktipfalha" <?= $disabled_falha; ?> id="cktipfalha" onclick="list_falha_ck();"/>Apenas falhas apontadas do elemento.
                                                                               </td>
                                                                               <td class="texto2" align="left">
                                                                                   <div id="div_falha">
                                                                                       <select name="cbofalha" id="cbofalha" <?= $disabled_falha; ?> class="combo_elemento" style="width:88%" tabindex="6">
                                                                                           <option value="<?= (!empty($cod_acervo) ? $cod_acervo : '0'); ?>"><?= (!empty($acervo) ? $acervo : 'Escolha...'); ?></option>
                                                                                       </select>
                                                                                   </div>
                                                                               </td>
                                                                           </tr>
                                                                       </table><?
                                                                   }
                                            ?>
                                                                   <table border="0" width="100%" cellpadding="1" cellspacing="1">
                                                                       <tr>
                                                                           <td colspan="3"><hr></td>
                                                                       </tr>
                                                                   </table>
                                                                   <table border="0" width="100%" cellpadding="2" cellspacing="2">
                                                                       <tr>
                                                                           <td width="30%">Interdita</td>
                                                                           <td width="30%">
                                                                               <table border="0" width="100%" cellpadding="0" cellspacing="0">
                                                                                   <tr>
                                                                                       <td width="50%">Interdição (Dias)</td>
                                                                                       <td width="50%">% Concluída</td>
                                                                                   </tr>
                                                                               </table>
                                                                           </td>
                                                                           <td  rowspan="6" colspan="2">
                                                        <?= "Observação"; ?><br />
                                                                   <textarea name="txtObservacao" class="texto2" cols="40" <?= $disabled_status ?> rows="7" maxlength="10" id="txtObservacao" tabindex="22" onKeyUp="maxleght_textarea(this.form.txtObservacao,10000);"><?= (empty($observacao) ? '' : $observacao); ?></textarea>
                                                               </td>
                                                    <?
                                                                   if (!empty($_REQUEST[idsol])) {
                                                    ?>
                                                                       <td rowspan='6'>
                                                                           <input align="center" type="button" class="btn_solicitacao"  onclick="abrenovadiv();ajax_dinamic('formEtapaOS','../cadastro/obsol.php?CTL=<?= $CTL; ?>&sol=<?= $_REQUEST[idsol] ?>&SBE_FORM=form_Funcionario&SBE_DIV=DIV_cboElem&SBE_DESC=txtMatricula&SBE_ID=txtelem_hidden&SBE_BIS=1&SBE_DIV_VALOR=null&SBE_DIV_UNIDADE=null&SBE_DIV_RESP=null','pop','','','',0,'',1,'','');" >
                                                                       </td><? } ?>
                                                               </tr>
                                                               <tr>
                                                                   <td>
                                                                       <select class="combo_elemento" name="cbointerdita" <?= $disabled_status ?> id="cbointerdita" tabindex="10" style="width: 80%;" onchange="mostra_duracao(this.value);">
                                                                           <option value="<?= (!empty($id_interdita) ? $id_interdita : 0); ?>" selected><?=
                                                                   (!empty($interdita) ? $interdita : "Escolha...");
                                                                   if ($id_interdita == 1) {
                                                    ?>
                                                                   <option value="2"><?= "Não"; ?><?
                                                                   } elseif ($_REQUEST['novo'] == 1) {
                                                    ?>
                                                                   <option value="1"><?= "Sim"; ?>
                                                                   <option value="2"><?= "Não"; ?><?
                                                                   } else {
                                                    ?>
                                                                   <option value="1"><?= "Sim"; ?><?
                                                                   }
                                                    ?>
                                                           </select>
                                                       </td>
                                                       <td>
                                                           <table border="0" width="100%" cellpadding="0" cellspacing="0">
                                                               <tr>
                                                                   <td width="50%">
                                                                       <input name="txtDuracaoInterdicao" <?= $disabled_interna; ?> <?= $hs; ?> <?= $disabled_status ?> tabindex="17" type="text" class="texto2" maxlength="6" id="txtDuracaoInterdicao" size="15" onKeyPress="return apenasnumeros(event, false)" value="<?= (!empty($interdicao) ? $interdicao : ''); ?>">
                                                                   </td>
                                                                   <td width="50%">
                                                                    <?
                                                                    if ($_REQUEST['novo'] == 1) {
                                                                    ?>
                                                                        <input name="txtPorcentagemConcluida" <?= $disabled_status ?> <?= $hs ?> tabindex="21" type="text" class="texto2" id="txtPorcentagemConcluida" size="15" maxlength="16" value="<?= (!empty($porcent) ? $porcent * 1 : '0'); ?>" disabled style="background-color:E6E6E6"><?
                                                                    } else {
                                                                    ?>
                                                                        <input name="txtPorcentagemConcluida" <?= $disabled_status ?> <?= $hs ?> tabindex="22" type="text" class="texto2" id="txtPorcentagemConcluida" size="15" maxlength="16" onKeyPress="return apenasnumeros(event, false);" onBlur="validaporcentagem(this);" value="<?= (!empty($porcent) ? $porcent * 1 : ''); ?>"><?
                                                                    }
                                                                    ?>
                                                                </td>
                                                            </tr>
                                                        </table>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <input name="txtNumeroOS" type="hidden" id="txtNumeroOS" value="<?= $row['numero_os']; ?>" >
                                                        <input name="rdbCondicaoDoBem" type="hidden" id="rdbCondicaoDoBem" value="B">
                                                        <input name="txtDuracaoSetup" <?= $hs ?> <?= $disabled_status ?> tabindex="20" type="hidden" maxlength="6" class="texto2" id="txtDuracaoSetup" size="15" onKeyPress="return apenasnumeros(event, false)" value="<?= (!empty($setup) ? $setup : ''); ?>">
                                                        <table border="0" width="100%" cellpadding="0" cellspacing="0">
                                                            <tr>
                                                                <td width="50%">Data Prevista do Início</td>
                                                                <td width="50%">Data Prevista do Fim</td>
                                                            </tr>
                                                        </table>
                                                    </td>
                                                    <td>
                                                        <table border="0" width="100%" cellpadding="0" cellspacing="0">
                                                            <tr>
                                                                <td width="50%">Data Real de Início</td>
                                                                <td width="50%">Data Real de Fim</td>
                                                            </tr>
                                                        </table>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <table border="0" width="100%" cellpadding="0" cellspacing="0">
                                                            <tr>
                                                                <td width="50%">
                                                                    <input name="txtDataPrevistaInicio" <?= $hs ?> <?= $disabled_status ?> onBlur="DataValidar(this,'txtDataPrevistaInicio'); validar_datafinal();" tabindex="24" type="text" class="texto2" id="txtDataPrevistaInicio" size="15"  maxlength="10" onKeyPress="MascaraData(this);" value="<?= (!empty($dt_prev_ini) ? ModificarDataVisual($dt_prev_ini) : ''); ?>" >
                                                                </td>
                                                                <td width="50%">
                                                                    <input name="txtDataPrevistaFim" <?= $hs ?> <?= $disabled_status ?> onBlur="DataValidar(this,'txtDataPrevistaFim'); validar_datafinal();" tabindex="25" type="text" class="texto2" id="txtDataPrevistaFim" size="15" maxlength="10" onKeyPress="MascaraData(this);" value="<?= (!empty($dt_prev_fim) ? ModificarDataVisual($dt_prev_fim) : ''); ?>">
                                                                </td>
                                                            </tr>
                                                        </table>
                                                    </td>
                                                    <td>
                                                        <table border="0" width="100%" cellpadding="0" cellspacing="0">
                                                            <tr>
                                                                <td width="50%">
                                                                    <?
                                                                    if ($_REQUEST['novo'] == 1) {
                                                                    ?>
                                                                        <input name="txtDataRealizadaInicio" <?= $hs ?> <?= $disabled_status ?> onBlur="DataValidar2(this,'txtDataRealizadaInicio'); validar_datafinal2();" tabindex="26" type="text" class="texto2" id="txtDataRealizadaInicio"  maxlength="10" size="15" onKeyPress="MascaraData(this);" value="<?= (!empty($dt_real_ini) ? ModificarDataVisual($dt_real_ini) : ''); ?>" disabled style="background-color:E6E6E6"><?
                                                                    } else {
                                                                    ?>
                                                                        <input name="txtDataRealizadaInicio" <?= $hs ?> <?= $disabled_status ?> onBlur="DataValidar2(this,'txtDataRealizadaInicio'); validar_datafinal2();" tabindex="27" type="text" class="texto2" id="txtDataRealizadaInicio"  maxlength="10" size="15" onKeyPress="MascaraData(this);" value="<?= (!empty($dt_real_ini) ? ModificarDataVisual($dt_real_ini) : ''); ?>"><? } ?>
                                                                </td>
                                                                <td width="50%">
                                                                    <?
                                                                    if ($_REQUEST['novo'] == 1) {
                                                                    ?>
                                                                        <input name="txtDataRealFim" <?= $hs ?> <?= $disabled_status ?> onBlur="DataValidar2(this,'txtDataRealFim'); validar_datafinal2();" tabindex="28" type="text" class="texto2" id="txtDataRealFim" size="15"  maxlength="10" onKeyPress="MascaraData(this);" value="<?= (!empty($dt_real_fim) ? ModificarDataVisual($dt_real_fim) : ''); ?>" disabled style="background-color:E6E6E6"><?
                                                                    } else {
                                                                    ?>
                                                                        <input name="txtDataRealFim" <?= $hs ?> <?= $disabled_status ?> onBlur="DataValidar2(this,'txtDataRealFim'); validar_datafinal2();" tabindex="29" type="text" class="texto2" id="txtDataRealFim" size="15"  maxlength="10" onKeyPress="MascaraData(this);" value="<?= (!empty($dt_real_fim) ? ModificarDataVisual($dt_real_fim) : ''); ?>"><? } ?>
                                                                </td>
                                                            </tr>
                                                        </table>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <table border="0" width="100%" cellpadding="0" cellspacing="0">
                                                            <tr>
                                                                <td width="50%">Custo Previsto (<?= $moeda; ?>)</td>
                                                                <td width="50%">Preço Previsto (<?= $moeda; ?>)</td>
                                                            </tr>
                                                        </table>
                                                    </td>
                                                    <td>
                                                        <table border="0" width="100%" cellpadding="0" cellspacing="0">
                                                            <tr>
                                                                <td width="50%">Custo Realizado (<?= $moeda; ?>)</td>
                                                                <td width="50%">Preço Realizado (<?= $moeda; ?>)</td>
                                                            </tr>
                                                        </table>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <table border="0" width="100%" cellpadding="0" cellspacing="0">
                                                            <tr>
                                                                <td width="50%">
                                                                    <input name="txtCustoPrevisto" value="<?= ($id_etapa) ? number_format($etapaOS->getValoracao(), 2, ",", ".") : "" ?>" <?= $hs ?> <?= $disabled_status ?> size="15" tabindex="30" type="text" class="texto2" id="txtCustoPrevisto" maxlength="14" onKeyPress="formataValor(this.id, 10, event);return apenasnumeros(event, false)" maxlength="18" dir="rtl"  disabled style="background-color:E6E6E6"/>
                                                                </td>
                                                                <td width="50%">
                                                                    <input name="txtPrecoPrevisto" value="<?= ($id_etapa) ? number_format($etapaOS->getValoracao(true), 2, ",", ".") : "" ?>" <?= $hs ?> <?= $disabled_status ?> size="15" tabindex="32" type="text" class="texto2" id="txtPrecoPrevisto" maxlength="14" onKeyPress="formataValor(this.id, 10, event);return apenasnumeros(event, false)" maxlength="18" dir="rtl" disabled  disabled style="background-color:E6E6E6"/>
                                                                </td>
                                                            </tr>
                                                        </table>
                                                    </td>
                                                    <td>
                                                        <table border="0" width="100%" cellpadding="0" cellspacing="0">
                                                            <tr>
                                                                <td width="50%">
                                                                    <input name="txtCustoRealizado" value="<?= ($id_etapa) ? number_format($etapaOS->getValoracao(false, true), 2, ",", ".") : "" ?>" <?= $hs ?> <?= $disabled_status ?> size="15" tabindex="31" type="text" class="texto2" id="txtCustoRealizado" maxlength="14" onKeyPress="formataValor(this.id, 10, event);return apenasnumeros(event, false)" maxlength="18" dir="rtl"/>
                                                                </td>
                                                                <td width="50%">
                                                                    <input name="txtPrecoRealizado" value="<?= ($id_etapa) ? number_format($etapaOS->getValoracao(true, true), 2, ",", ".") : "" ?>" <?= $hs ?> <?= $disabled_status ?> size="15" tabindex="33" type="text" class="texto2" id="txtPrecoRealizado" maxlength="14" onKeyPress="formataValor(this.id, 10, event);return apenasnumeros(event, false)" maxlength="18" dir="rtl" />
                                                                </td>
                                                            </tr>
                                                        </table>
                                                    </td>
                                                </tr>
                                            </table>
                                            <table border="0" width="100%" cellpadding="0" cellspacing="0">
                                                <tr>
                                                    <td width="65%"><div id="retorno_inserindo" align="center"></div></td>
                                                    <td width="35%"> </td>
                                                </tr>
                                            </table>
                                            <table border="0" width="100%" cellpadding="0" cellspacing="0">
                                                <tr>
                                                    <td width="55%">
                                                        <?
                                                                    if ($_REQUEST['novo'] == 1) {
                                                        ?>
                                                                        <input type="button" <?= $hs ?> class="botaoitemdaetapa" name="btnItemEtapa" id="btnItemEtapa" tabindex="34" value="" onClick="goitem();" disabled />
                                                                        <input type="button" <?= $hs ?> class="botaodependencia" name="btnDependencia" id="btnDependencia" tabindex="35" value="" onClick="elmLoop(document.formEtapaOS.IdSelecionado_banco.value,'CadastrarDependenciaEtapaOS.php?CTL=<?= $_REQUEST['CTL']; ?>&id_etapa=<?= $id_etapa; ?>&idordemservico=<?= $_REQUEST['idordemservico']; ?>&urltoreturn2=<?= $_REQUEST['urltoreturn']; ?>&retorno2=<?= $_REQUEST['retorno']; ?>',1,'','','CadastroEtapaOS.php'); return false" disabled />
                                                                        <input type="button" <?= $hs ?> class="botaorepositorio" name="btnRepositorio" id="btnRepositorio" tabindex="36" value="" onClick="elmLoop(document.formEtapaOS.IdSelecionado_banco.value,'InformacoesAdicionaisOS.php?CTL=<?= $_REQUEST['CTL']; ?>&id_etapa=<?= $id_etapa; ?>&idordemservico=<?= $_REQUEST['idordemservico']; ?>&urltoreturn2=<?= $_REQUEST['urltoreturn']; ?>&retorno2=<?= $_REQUEST['retorno']; ?>',1,'','','InformacoesAdicionaisOS.php'); return false" disabled />
                                                                        <input type="button" <?= $hs ?> class="botaoparecer" name="btnParecer" id="btnParecer" tabindex="37" value="" onClick="elmLoop(document.formEtapaOS.IdSelecionado_banco.value,'CadastrarParecerOS.php?CTL=<?= $_REQUEST['CTL']; ?>&id_etapa=<?= $id_etapa; ?>&idordemservico=<?= $_REQUEST['idordemservico']; ?>&urltoreturn2=<?= $_REQUEST['urltoreturn']; ?>&retorno2=<?= $_REQUEST['retorno']; ?>',1,'','','CadastrarParecerOS.php'); return false"  disabled />
                                                                        <input type="button" class="botaohiststatus" name="btn_orcamento" id="btn_orcamento" tabindex="21" onClick="location.href='Historico_Status_Etapa.php?CTL=<?= $_REQUEST['CTL']; ?>&voltaralerta=<?= $_REQUEST[voltaralerta]; ?>&busca=<?= $_REQUEST[busca]; ?>&idsol=<?= $_REQUEST[idsol]; ?>&idos=<?= $_REQUEST[idordemservico] ?>';" />
                                                        <?
                                                                    } else {
                                                        ?>
                                                                        <input type="button"  class="botaoitemdaetapa" name="btnItemEtapa" id="btnItemEtapa" tabindex="34" value="" onClick="elmLoop(document.formEtapaOS.IdSelecionado_banco.value,'CadastrarItemEtapa.php?CTL=<?= $_REQUEST['CTL']; ?>&id_etapa=<?= $id_etapa; ?>&idordemservico=<?= $_REQUEST['idordemservico']; ?>&urltoreturn2=<?= $_REQUEST['urltoreturn']; ?>&retorno2=<?= $_REQUEST['retorno']; ?>',1,'','','etapaOS.php'); return false" />
                                                                        <input type="button"  class="botaodependencia" name="btnDependencia" id="btnDependencia" tabindex="35" value="" onClick="elmLoop(document.formEtapaOS.IdSelecionado_banco.value,'CadastrarDependenciaEtapaOS.php?CTL=<?= $_REQUEST['CTL']; ?>&id_etapa=<?= $id_etapa; ?>&idordemservico=<?= $_REQUEST['idordemservico']; ?>&urltoreturn2=<?= $_REQUEST['urltoreturn']; ?>&retorno2=<?= $_REQUEST['retorno']; ?>',1,'','','CadastroEtapaOS.php'); return false" />
                                                                        <input type="button"  class="botaorepositorio" name="btnRepositorio" id="btnRepositorio" tabindex="36" value="" onClick="elmLoop(document.formEtapaOS.IdSelecionado_banco.value,'InformacoesAdicionaisOS.php?CTL=<?= $_REQUEST['CTL']; ?>&id_etapa=<?= $id_etapa; ?>&idordemservico=<?= $_REQUEST['idordemservico']; ?>&urltoreturn2=<?= $_REQUEST['urltoreturn']; ?>&retorno2=<?= $_REQUEST['retorno']; ?>',1,'','','InformacoesAdicionaisOS.php'); return false" />
                                                                        <input type="button"  class="botaoparecer" name="btnParecer" id="btnParecer" tabindex="37" value="" onClick="elmLoop(document.formEtapaOS.IdSelecionado_banco.value,'CadastrarParecerOS.php?CTL=<?= $_REQUEST['CTL']; ?>&id_etapa=<?= $id_etapa; ?>&idordemservico=<?= $_REQUEST['idordemservico']; ?>&urltoreturn2=<?= $_REQUEST['urltoreturn']; ?>&retorno2=<?= $_REQUEST['retorno']; ?>',1,'','','CadastrarParecerOS.php'); return false"/>
                                                                        <input type="button" class="botaohiststatus" name="btn_histstatus" id="btn_histstatus" tabindex="21" onClick="location.href='Historico_Status_Etapa.php?CTL=<?= $_REQUEST['CTL']; ?>&voltaralerta=<?= $_REQUEST[voltaralerta]; ?>&busca=<?= $_REQUEST[busca]; ?>&idsol=<?= $_REQUEST[idsol]; ?>&idos=<?= $_REQUEST[idordemservico] ?>';" />
                                                                        <input type="button" class="botao_localizacao" name="btnLocalizacao" id="btnLocalizacao" onclick="oculta_combo(); abrenovadiv(); ajax_dinamic('formEtapaOS','../POPS/BuscaLocalizacao.php?CTL=<?= $_REQUEST['CTL']; ?>','pop','','','',0,'',1,'','');" /><?
                                                                    }
                                                        ?>
                                                                </td>
                                                                <td width="5%"> </td>
                                                                <td width="35%">
                                                                    <div align="right">
                                                                        <p>
                                                                <? if (isset($_REQUEST['idEtapa'])) {
                                                                ?>
                                                                        <input name="btnvoltar" type="button" class="botaovoltar" tabindex="38" id="btnvoltar" onClick="history.go(-1)">
                                                                <? } else {
 ?>
                                                                        <input name="btnvoltar" type="button" class="botaovoltar" tabindex="39" id="btnvoltar" onClick="location.href='pspageos.php?CTL=<?= $_REQUEST['CTL']; ?>&voltaralerta=<?= $_REQUEST[voltaralerta]; ?>&busca=<?= $_REQUEST[busca]; ?>&idsol=<?= $_REQUEST[idsol]; ?>&idos=<?= $_REQUEST[idordemservico] ?>';habilitaBotaoItem(1);">
                                                                <?
                                                                    }

                                                                    if ($_REQUEST['novo'] == 1) {
                                                                ?>
                                                                        <input type="button" <?= $hs ?><?= $disabled_status; ?> class="botaolimpeza" name="btnlimpar" id="btnlimpar" tabindex="40" onClick="SuperNova();" />
                                                                        <input type="button" <?= $hs ?><?= $disabled_status; ?> class="botaoincluir" name="btnincluindo" id="btnincluindo" tabindex="41" onClick="insert_etapa();"/>
                                                                        <input name="btnAlterar" <?= $hs ?> type="button" class="botaoalterar" id="btnAlterar" tabindex="42" disabled onClick="update_etapa();"/>
                                                                        <input name="btnExcluir" <?= $hs ?><?= $disabled_status ?> type="button" class="botaoexcluir" id="btnExcluir" tabindex="43" disabled onClick="ajax_dinamic('formEtapaOS','../processos/editando_inserindo.php?flag_controle=autenticado&etapaOS=excluindo','retorno_inserindo','IdSelecionado_banco','<?
                                                                        for ($i = 0; $i < sizeof($chave); $i++) {
                                                                            echo $mensagem[$i];
                                                                        }
                                                                ?>','',1,'Deseja mesmo excluir?',1,'btnTodos','btnAlterar|btnExcluir');SuperNova();habilitaBotaoItem(0);"> <?
                                                                    } else {
                                                                ?>
                                                                 <input type="button" <?= $hs ?><?= $disabled_status; ?> class="botaolimpeza" name="btnlimpar" id="btnlimpar" tabindex="40" onClick="SuperNova();habilitaAlterar(0);" />
                                                                 <input type="button" <?= $hs ?><?= $disabled_status; ?> class="botaoincluir" name="btnincluindo" id="btnincluindo" tabindex="41" onClick="insert_etapa();"/>
                                                                 <input name="btnAlterar" <?= $hs ?> type="button" class="botaoalterar" id="btnAlterar" tabindex="42" onClick="update_etapa();"/>
                                                                 <input name="btnExcluir" <?= $hs ?><?= $disabled_status ?> type="button" class="botaoexcluir" id="btnExcluir" tabindex="43" onClick="ajax_dinamic('formEtapaOS','../processos/editando_inserindo.php?flag_controle=autenticado&etapaOS=excluindo','retorno_inserindo','IdSelecionado_banco','<?
                                                                        for ($i = 0; $i < sizeof($chave); $i++) {
                                                                            echo $mensagem[$i];
                                                                        }
                                                                ?>','',1,'Deseja mesmo excluir a Etapa e todos Itens associados?',1,'btnTodos','btnAlterar|btnExcluir');SuperNova();habilitaBotaoItem(0);"> <? } ?>
                                                            </p>
                                                        </div>
                                                    </td>
                                                </tr>
                                            </table>
                                        </fieldset>
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </td>
                </tr>
            </table>
            <table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
                <tr>
                    <td colspan="4"><div id="retorno_pesquisa"></div></td>
                </tr>
            </table>
            <input name="IdSelecionado" type="hidden"  value="">
            <input name="IdSelecionado_banco" type="hidden"  value="">
            <input name="strform" type="hidden" value="formEtapaOS">
            <input type="hidden" name="action" value="etapaos">

            <!--- Banco de dados --->
            <input name="strnameCampo" type="hidden" value="cboBem|txtServico|cboServico|cboTarefa|cboCentroServico|cboRestricao|cboStatus|txtEtapa|txtNumeroOS|txtDuracaoInterdicao|rdbCondicaoDoBem|txtDuracaoSetup|txtPorcentagemConcluida|txtDataPrevistaInicio|txtDataPrevistaFim|txtDataRealizadaInicio|txtDataRealFim|txtCustoPrevisto|txtCustoRealizado|txtPrecoPrevisto|txtPrecoRealizado|txtIdOrdemServico|txtNumeroEtapaOS|txtDataRestricao|cboRestricao|txtquantidade">
            <input name="strcampofocus" type="hidden" value="cboBem">
            <input name="recurso" type="hidden" id="recurso" value="">
            <input type="hidden" name="txtIdOrdemServico" id="txtIdOrdemServico" <?php
                                                                    if (isset($_REQUEST['idordemservico'])) {
                                                                        echo "value=\"" . $_REQUEST['idordemservico'] . "\"";
                                                                    } else {
                                                                        echo "value=\"\"";
                                                                    }
                                                                ?>  />
                                                             <input type="hidden" name="txtNumeroEtapaOS" id="txtNumeroEtapaOS" <?php
                                                                    if (!empty($num_etapa_os)) {
                                                                        echo "value=\"" . $num_etapa_os . "\"";
                                                                    } else {
                                                                        echo "value=\"\"";
                                                                    }
                                                                ?>  />
            <div id="pop" style="width: 1px; height: 1px;"></div>

            <input type="button" onclick="abrirElemento()"/>
        </form>

    </body>
</html>




 

 

 

 

 

desde já agradeço a paciência e a ajuda

Compartilhar este post


Link para o post
Compartilhar em outros sites

Galera, consegui resolver o problema

 

 

o que acontece é o seguinte, o IE não aceita que seja inserido via innerHTML uma tag <form> dentro de outra tag <form>, e a div que estava sendo atualizada estava justamente nesta em uma tag form.

 

problema resolvido

 

obrigado

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.