<?php

    $user_id=$_SESSION['ADMusuario_id'];

    $_SESSION['tec_id']     = $user_id;
    $_SESSION['etapa']    = $_POST['etapa'];
    $_SESSION['codigo']   = $_POST['codigo'];
    $_SESSION['tpr']      = $_POST['ctg_tpr_id'];
    $_SESSION['tpt']      = $_POST['ctg_tpt_id'];
    $_SESSION['tipo']     = $_POST['tipo'];
    $_SESSION['d_id']     = $_POST['id'];

    $arr_label[508]='dias_respuesta';    
    $arr_label[502]='resultado';  
    $arr_label[577]='dias_no_mayor';    
    $arr_label[578]='dias_entre';                    
    $arr_label[499]='fecha_asignado';    
    $arr_label[500]='fecha_esperada';    
    $arr_label[501]='fecha_resultado';    
    $arr_label[503]='proceso';    
    $arr_label[504]='boleta';    
    $arr_label[1327]='preboleta';
    $arr_label[505]='no_cone';    
    $arr_label[323]='conforme';        
    $arr_label[507]='espera_respuesta';
    $arr_label[509]='fecha_limite';
    $arr_label[938]='genera_docx';
	$arr_label[698]='resultado_evaluacion'; 
    $arr_label[1117]='conclusiones';
    $arr_label[1244]='conclusiones1';
    $arr_label[19]='reject';
    $arr_label[1378]='evaluation';
    $arr_label[1816]= 'adm_con_sr_file_name';
    $arr_label[1756]= 'email_enviar';

    $arr_label[1814]='notice1';
    $arr_label[1813]='notice2';
    $arr_label[1777]='notice3';
    $arr_label[110] = 'notice'; 
    $arr_label[1815]='question1';
    $arr_label[1838]='continue';

    $arr_label[1817]='send-loq';    
    $arr_label[1818]='p-conforme';        
    $arr_label[1819]='p-no_conforme';       
    $arr_label[505]='no_conforme';       

    $arr_label[1823]='qc_notappli';    
    $arr_label[1824]='qc_pass';    
    $arr_label[1825]='qc_fail';    

    $arr_label[1379] = 'unselect';

    $arr_lang = "508,502,577,578,499,500,501,503,504,505,323,507,509,938,698,1117,1244,1327,19,1378,1816,1756,1777,1813,1814,1815,110,1817,1818,1819,1823,1824,1825,505,1838,1379";
    include('form_language.php');  

    // if ($_FILES['adm_con_sr_file_name']['tmp_name']!=""){
    //     move_uploaded_file($_FILES['adm_con_sr_file_name']['tmp_name'], $ruta2.$upload_file);
    // }
    $_POST['adm_con_sr_file_name']="";

?>

<input type="hidden" id="numbol"        name="numbol"       value="<?=$_POST['numbol'];?>">
<script type="text/javascript">

var cnf_numbol = parseInt('<?=$adm_cnf_numbol?>');
var cnf_numboldias = parseInt('<?=$adm_cnf_numboldias?>');


 $(document).ready(function(){
     $("form").submit(function(){
         var cadena = $(this).serialize();
         //alert(cadena); works
         return false;
     });
 });



function grabaz_docx(){

	window.frames['frame_docs'].submit_docs();
	return "44";
}

function open_url(myurl){

    var tpr=document.getElementById('ctg_tpr_id').value;
    var tpt=document.getElementById('ctg_tpt_id').value;
    var codigo=document.getElementById('codigo').value;
    var etapa=document.getElementById('etapa').value;
    var tipo=document.getElementById('tipo').value;
    var id=document.getElementById('id').value;
    var tec_id = '<?=$_SESSION['ADMusuario_id']?>';

    var params="&tpr="+ctg_tpr_id+"&codigo="+codigo+"&etapa="+etapa+"&tpt="+ctg_tpt_id+"&tipo="+tipo+"&id="+id+"tec_id="+tec_id;
            //window.open("pestana_imprime.php?"+params, "vent" , "width=1100,height=650,scrollbars=NO");


    //window.open('includes/frmdocs.php?'+params, "vent" , "width=1100,height=650,scrollbars=NO");
    window.open('includes/frmdocs.php', "_blank");
    //window.open(url, '_blank');    

}

function crear_docsx(form, callback){

	document.getElementById ('titlex').value="<?=$arr_label['resultado_evaluacion'] ?>";
	var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
	var is_safari = navigator.userAgent.toLowerCase().indexOf('safari') > -1;
	  if(is_safari && is_chrome==false){

            console.log('if(is_safari && is_chrome==false){');

    	  	var ctg_tpr_desc=document.getElementById('ctg_tpr_desc').value;
    	  	var tipo=document.getElementById('tipo').value;
    	  	var ctg_tpr_id=document.getElementById('ctg_tpr_id').value;
    	  	var codigo=document.getElementById('codigo').value;
    	  	var nomprod=document.getElementById('nomprod').value;
    	  	var ctg_tpt_desc=document.getElementById('ctg_tpt_desc').value;
    	  	var ctg_tpt_id=document.getElementById('ctg_tpt_id').value;
    	  	var titlex=document.getElementById ('titlex').value;
    	  	var id=document.getElementById('id').value;
    	  	var titulo_anterior=document.getElementById('titulo_anterior').value;
    	  	var muestras=document.getElementById('muestras').value;
    	  	var etapa=document.getElementById('etapa').value;

			var u=Math.floor(Math.random()*11);
		 	var params="ctg_tpr_desc="+ctg_tpr_desc+"&ctg_tpr_id="+ctg_tpr_id+"&codigo="+codigo+"&nomprod="+nomprod+"&ctg_tpt_desc="+ctg_tpt_desc+"&ctg_tpt_id="+ctg_tpt_id+"&titlex="+titlex+"&id="+id+"&titulo_anterior="+titulo_anterior+"&muestras="+muestras+"&etapa="+etapa+"&tipo="+tipo+"&W="+u;
			window.open("pestana_imprime.php?"+params, "vent" , "width=1100,height=650,scrollbars=NO");
		}else{
            /*
            if ( callback ) {
                 callback(true);
            }
            */

            console.log('} else {' + form);

			var u=Math.floor(Math.random()*11);
			form.target= '_blank';
			if(is_chrome){ form.action= 'includes/pestana_imprime.php?W='+u; }else{ form.action= 'includes/pestana_imprime.php'; }
			form.submit();
		}




}


function checkform_standar( form ) {

    var errorCount = 0;

    var campo = document.getElementById('enfoco');   

    // if ('<?=$_POST['id']?>' == '03020502') {

    //     msg =  '<?=$arr_label['continue'] ?>';
    //     title = '<?=$arr_label['notice'] ?>';

    //     $('#dialog-confirmar').dialog('option', 'title', title);

    //     //botones
    //     var buttons = $('#dialog-confirmar').dialog('option', 'buttons');
    //     $('#dialog-confirmar').dialog('option', 'buttons', { 
    //         "<?php echo $arr_label['no']?>": function() { $(this).dialog('close');

    //         },
    //         "<?php echo $arr_label['si']?>": function() { $(this).dialog('close');

    //             var waitmsg='<br><br><?=$arr_label['continue'] ?>';
    //             var title = $('#dialog-msg').dialog('option', 'title');
    //             $('#dialog-msg').dialog('option', 'title', 'title');
    //             $('#dialog-msg').html(msg);
    //             $('#dialog-msg').dialog('open');
    //         } 
    //     });
    //     $('#dialog-confirmar').dialog('open');
    //     document.getElementById('dialog-confirmar-conteiner').innerHTML = "<div class=\"dialog_center\">"+msg+"</div>";

    //     return false

    // }

    <?php if (substr($_POST['id'],0,6) != "030205" ) {?>

        if( form.status.value == '0'){errorCount++;if (errorCount == 1) {etiqueta = '<?=$arr_label['resultado']?>';campo.value = 'status';}}

    <?php }?>

    if (errorCount) {
        call_dialog_msg(etiqueta);
        return false;
    }
        if ('<?=$_POST["id"]?>' == '030203' || '<?=$_POST["id"]?>' == '0302042' || '<?=$_POST["id"]?>' == '0302A042' || '<?=$_POST["id"]?>' == '0302B042' || form.status.value=='1') { //2017-12-27

            $('#dialog_standar_0').dialog('open');   

            if ( $('#dialog_standar_0').dialog('isOpen') ) {    
                if (document.getElementById('field_dialog_textarea'))
                    document.getElementById('field_dialog_textarea').style.display = 'none';
                var title = $('#dialog_standar_0').dialog('option', 'title');
                $('#dialog_standar_0').dialog('option', 'title', '' );
                
                var width = $('#dialog_standar_0').dialog('option', 'width');
                $('#dialog_standar_0').dialog('option', 'width', '350');    
                
                var height = $('#dialog_standar_0').dialog('option', 'height');
                $('#dialog_standar_0').dialog('option', 'height', '200');    

                var position = $('#dialog_standar_0').dialog('option', 'position');
                $('#dialog_standar_0').dialog('option', 'position', 'center');    
            } 
            document.getElementById('dialog_standar_0').innerHTML = '<div class="dialog_center"><?=$arr_label["espere"]?></div>';
            setTimeout(function(){grabar_load()},500);
        } else {
            
            if (window.frames['frame_docs']) 
            if (window.frames['frame_docs'].checkform_standar()) {

                //$('#dialog_standar_0').dialog('open');   
                if ( $('#dialog_standar_0').dialog('isOpen') ) {    
                    if (document.getElementById('field_dialog_textarea'))
                        document.getElementById('field_dialog_textarea').style.display = 'none';
                    var title = $('#dialog_standar_0').dialog('option', 'title');
                    $('#dialog_standar_0').dialog('option', 'title', '' );
                    
                    var width = $('#dialog_standar_0').dialog('option', 'width');
                    $('#dialog_standar_0').dialog('option', 'width', '350');    
                    
                    var height = $('#dialog_standar_0').dialog('option', 'height');
                    $('#dialog_standar_0').dialog('option', 'height', '200');    

                    var position = $('#dialog_standar_0').dialog('option', 'position');
                    $('#dialog_standar_0').dialog('option', 'position', 'center');    
                                
                document.getElementById('dialog_standar_0').innerHTML = '<div class="dialog_center"><?=$arr_label["espere"]?></div>';
                } 

                //var params = form.ser
                //alert('(' + $(this).attr("id") + ')');

                //alert('aqui' + );
                //if(form.gendocx.checked) crear_docsx(form); //2012-09-14
                //este procedimiento se paso a form_ctg_botones.php en grabar load con un dialog-comfirm

                var intro=grabaz_docx(); //watch_vus_tramites_docs submit a watch_vus_tramites_op


                setTimeout(function(){grabar_load()},500);

            
            
            }
        }
    
        
    return false;
}

function status_change(valor){
    <?php if (substr($_POST['id'],0,6) == "030205" ) {  ?>
    if (valor == '2') {
            bolespres_change('1');
    } else {

            bolespres_change('2');
    }
    <?php } ?>  

}
 
function bolespres_change(valor){
    
    if (valor == '11') {
              
              
		<?php if ($_POST['id'] == "030202" || $_POST['id'] == "030203" || $_POST['id'] == "030204" ||$_POST['id'] == "0302A02" || $_POST['id'] == "0302A03" || $_POST['id'] == "0302A04" || $_POST['id'] == "0302B02" || $_POST['id'] == "0302B03" || $_POST['id'] == "0302B04" || $_POST['id'] == "0302042" || $_POST['id'] == "0302A042" || $_POST['id'] == "0302B042") {  
		
		} else { //2017-10-28 
?>
            if (document.getElementById('dias').value == "")
                document.getElementById('dias').value = '30';
                document.getElementById('dias_cap').style.display = 'inline';
                document.getElementById('dias_inp').style.display = 'inline';
                document.getElementById('bolresdt_cap').style.display = 'inline';
                document.getElementById('bolresdt_inp').style.display = 'inline';
				dias_limite(30);

		<?php } ?>
                
    } else {
        document.getElementById('dias').value = '';
        document.getElementById('dias_cap').style.display = 'none';
        document.getElementById('dias_inp').style.display = 'none';
        document.getElementById('bolresdt_cap').style.display = 'none';
        document.getElementById('bolresdt_inp').style.display = 'none';

    }   
}    


function dias_limite(valor){
    var errorCount = 0;
    var campo = document.getElementById('enfoco');   

    if (valor == '') valor = 0;

    var numbol = parseInt('<?=$_POST['numbol']?>');  //2014-07-31        
    if (numbol < cnf_numbol)

    if (valor > cnf_numboldias) {
		errorCount++;if (errorCount == 1) {etiqueta = '<?=$arr_label['dias_no_mayor']?> ' + cnf_numboldias; campo.value = 'dias'; document.getElementById('dias').value = ''; }
    }else if(valor <= 0) {
	    errorCount++;if (errorCount == 1) {
	    etiqueta = '<?=$arr_label['dias_entre']?> ' + cnf_numboldias; campo.value = 'dias'; 
	    
	    }
    }
        
    if (errorCount) {
        call_dialog_msg(etiqueta);
        return false;
    }        

		var myCallback = function(bResult) {
			document.getElementById('bolresdt').value=String(bResult).substring(0,10);
		}
	 
		var date='';
		var dias=valor;
		load_ajax('includes/suma_dia.php','date='+date+'&dias='+dias,'','',myCallback);	

}

function SendEmail(form) {
    var var1 = $("#dias").val();
    var var2 = $("#bolresdt").val();
    var var3 = $("#adm_con_sr_file_name").val();
    
    var errorCount = 0;
    var msg;
    var title;

    if (var1=='') {errorCount++;if (errorCount == 1) {etiqueta = 'Please enter days for response';}}
    if (var2=='') {errorCount++;if (errorCount == 1) {etiqueta = 'Please enter deadline date';}}
    if( var3== ''){errorCount++;if (errorCount == 1) {etiqueta = '<?php echo $arr_label['adm_con_sr_file_name']?>';campo = 'adm_con_sr_file_name';}}
    if (errorCount) {
        call_dialog_msg(etiqueta);
        return false;
    }

    var texto1='<br><br>'+'<?=$arr_label['notice1'] ?>';
    var texto2='<br><br>'+'<?=$arr_label['notice2'] ?>';
    var waitmsg = '<br>'+'<?=$arr_label['notice3'] ?>';

    msg =  '<?=$arr_label['question1'] ?>';
    title = '<?=$arr_label['notice'] ?>';

    texto = texto1;
    if (msg != ""){
        var title = $('#dialog-confirmar').dialog('option', 'title');
        $('#dialog-confirmar').dialog('option', 'title', '<?php echo $arr_label['notice']?>');

        //botones
        var buttons = $('#dialog-confirmar').dialog('option', 'buttons');
        $('#dialog-confirmar').dialog('option', 'buttons', { 
            "<?php echo $arr_label['no']?>": function() { $(this).dialog('close');
        },
            "<?php echo $arr_label['si']?>": function() { 

                var title = $('#dialog-msg').dialog('option', 'title');
                $('#dialog-msg').dialog('option', 'title', '<?php echo $arr_label['notice']?>');
                $('#dialog-msg').html(waitmsg);
                $('#dialog-msg').dialog('open');
        
                $.ajax({
                    type: "POST",
                    url: "includes/form_adm_control_etapa_op.php",
                    data: {op:"send_email22",solinum:"<?=$_POST['codigo']?>",tipo:"<?=$_POST['tipo']?>",valtpr:"<?=$_POST['ctg_tpr_id']?>",valtpt:"<?=$_POST['ctg_tpt_id']?>",tdays:var1,tespresp:var2},
                    //dataType: "json",
                    success: function( response ) {
                        //alert(response.stat);
                        if (response.stat=='2' )
                            texto=texto2;
                        else
                            texto=texto1;
                        $('#dialog-msg').dialog('close');

                        var title = $('#dialog-msg').dialog('option', 'title');
                        $('#dialog-msg').dialog('option', 'title', '<?php echo $arr_label['notice']?>');
                        $('#dialog-msg').html(texto);
                        $('#dialog-msg').dialog('open');

                    },
                    error: function (xhr, status, error) {                      
                        console.log(xhr);
                        console.log(status);
                        console.log(error);
                    }
                });
                form.submit();
                $(this).dialog('close'); 
                limpiar_datos('limpia');

            } 
        });
        $('#dialog-confirmar').dialog('open');
        document.getElementById('dialog-confirmar-conteiner').innerHTML = "<div class=\"dialog_center\">"+msg+"</div>";
    }

}


// function core_save_file(){
//     $strFileName = isset( $_FILES[$strInputFileName]['adm_con_sr_file_name'] ) ? $_FILES[$strInputFileName]['adm_con_sr_file_name'] : "" ; 
//     $strFileName = user_input_delmagic($strFileName, $boolUTF8Decode); 
//     $strFileName = core_removeSpecialChars($strFileName); 
 
//     $strAntelacionArchivo = "/var/www/html/dsoft/v5/adm/"; 
//     $strPath = "docssever/prodmed/docs_tramites/ef/2022/"; 
 
//     $strPath = $strPath.$strExtraPath; 
//     $strPathAndFile = ""; 
//     if( !file_exists($strPath) ){ 
//         mkdir($strPath, 0777, true); 
//     } 

//     if( isset( $_FILES[$strInputFileName]['adm_con_sr_file_name'] ) && $_FILES[$strInputFileName]['error'] == UPLOAD_ERR_OK ){ 
//         $strPathAndFile = $strPath.$strAntelacionArchivo+"_"+$intImagenId+"_"+$strFileName; 

//         if( !file_exists($strPathAndFile) ){ 
//             move_uploaded_file($_FILES[$strInputFileName]["tmp_name"], $strPathAndFile); 
//         } 
//         return 1;

//     } else {
//         return 0;
//     }
 
// }

</script>
<form name='form_standar' id='form_standar' action="<?=$_SERVER['PHP_SELF']?>" method="post" enctype="multipart/form-data">

<?php


        //if ($_POST['bolespres'] == "1") {
        if ($_POST['op'] == 'dias')  
            $_POST['bolresdt'] = suma_fechas(date("Y-m-d"),$_POST['dias']);
       


        /* viene de tabla ya sesa actual de ctg menu o la correspondiente en adm_control
                $len = $_POST['id'];
                $etapa = substr($_POST['id'],4,$len);
                $disabled = "";
                $window = false;
                $class = "text-input";
        */      
              
		$StrStatus = "0";
        $sql="SELECT * FROM adm_control_{$_POST['tipo']}{$_SESSION['dtb_adm']}_etapas WHERE 
        adm_coe_numsol = '".$_POST['codigo']."' AND 
        adm_coe_tpr_id = '".$_POST['ctg_tpr_id']."' AND 
        adm_coe_tpt_id = '".$_POST['ctg_tpt_id']."' AND 
        adm_coe_tpe_id = '".$_POST['etapa']."'";
        //echo $sql."<br>";
        $result2=$connection->Execute($sql);
        if (!$result2->EOF) {
            $operador2 = $result2->fields;     
            
            $StrStatus = $operador2['adm_coe_status'];
                                           
            if ($_POST['op'] != 'dias') {   
            
                    if ($operador2['adm_coe_status'] > 4)
                        $_POST['status'] = 0;
                    else
                        $_POST['status'] = $operador2['adm_coe_status'];
                        $_POST['obs'] =  $operador2['adm_coe_obs'];
                        $_POST['bolespres'] = $operador2['adm_coe_bolespres'];//Boleta espera respuesta 1=Si 2=No
                        $_POST['bolresdt'] =  $operador2['adm_coe_bolresdt'];//Fecha limite para responder por boleta generada
                        $_POST['bolresdt2'] =  $operador2['adm_coe_bolresdt'];//Fecha limite para responder por boleta generada
                        $_POST['docsgen'] =  $operador2['adm_coe_docgen'];//Boleta espera respuesta 1=Si 2=No
                        $_POST['docsgendir'] =  $operador2['adm_coe_docgen_ubi'];//Boleta espera respuesta 1=Si 2=No
                        $_POST['bolnum'] =  $operador2['adm_coe_bolnum'];//Boleta espera respuesta 1=Si 2=No
                        
                        //$_POST['adm_coe_pdf'] = base64_decode($operador2['adm_coe_pdf']);
                        //$_POST['adm_coe_pdf'] = $operador2['adm_coe_pdf'];
                        
                        $_POST['docsgendir'] =  $operador2['adm_coe_docgen_ubi'];//Boleta espera respuesta 1=Si 2=No
                        if($_POST['docsgendir']!='' && $_POST['docsgen']!='') $_POST['gendocx']="checked";
                        $_POST['dias'] = $operador2['adm_coe_boldias'];
            }
            switch ($_POST['etapa']) {
                case '02':
                    $intcode="ADM";
                    break;
                case '03':
                    $intcode="QUA";
                    break;
                case '04':
                    $intcode="CLI";
                    break;
                case '05':
                    $intcode="CII";
                    break;
                case '041':
                    $intcode="NCLI";
                    break;
                case '042':
                    $intcode="QCL";
                    break;
                case '07':
                    $intcode="JUN";
                    break;
                                    
            }                
            $sqlpdf="SELECT * FROM adm_control_{$_POST['tipo']}{$_SESSION['dtb_adm']}_docs WHERE 
            adm_cod_numsol = '".$_POST['codigo']."' AND 
            adm_cod_tpr_id = '".$_POST['ctg_tpr_id']."' AND 
            adm_cod_tpt_id = '".$_POST['ctg_tpt_id']."' AND 
            adm_cod_ttc_id = '".$intcode."'";
            $resultpdf=$connection->Execute($sqlpdf);
            if (!$resultpdf->EOF) {
                $_POST['adm_coe_pdf'] = 'yes';
            } else {
                $_POST['adm_coe_pdf'] = '';
            }

            if ($operador2['adm_coe_tec_id'] == "") {
                // echo "por aqui";
            
                /* ya no se asigna aca el evaluadore es en form_adm_control_etapa_evaluadores.php
                $sql="UPDATE adm_control_{$_POST['tipo']}{$_SESSION['dtb_adm']} SET
                adm_con_etapa = '".$_POST['etapa']."',
                adm_con_estatus='1',
                adm_con_sta='2',
                adm_con_usr='".$_SESSION['ADMusuario_id']."',
                adm_con_dt='".date("Y-m-d H:i:s")."'
                WHERE adm_con_numsol = '".$_POST['codigo']."' AND adm_con_tpr_id = '".$_POST['ctg_tpr_id']."' AND 
                adm_con_tpt_id = '".$_POST['ctg_tpt_id']."' 
                AND adm_con_esa_id = '".$_POST['ctg_esa_id']."'";
                $result = $connection->Execute ( $sql );
                                
                $sql="UPDATE adm_control_{$_POST['tipo']}{$_SESSION['dtb_adm']}_etapas SET
                adm_coe_tec_id = '".$_SESSION['ADMusuario_id']."',
                adm_coe_inipro_dt = '".date("Y-m-d")."',
                adm_coe_status = '1'
                WHERE adm_coe_numsol = '".$_POST['codigo']."' AND adm_coe_tpr_id = '".$_POST['ctg_tpr_id']."' AND 
                adm_coe_tpt_id = '".$_POST['ctg_tpt_id']."' AND adm_coe_tpe_id = '".$_POST['etapa']."'";
                $result = $connection->Execute ( $sql );        
                $error = $connection->ErrorMsg();	
                if ($connection->Affected_Rows() == 1) {
                    $info = $arr_label['datos_grabados'];
                    $operador2['adm_coe_inipro_dt'] = date("Y-m-d");
                    //echo "se asigno a su usuario : ".$_SESSION['ADMusuario_id']."; etapa : ".$_POST['etapa'];
                }
                */
                
                //echo $sql."<br>[".$error."]<br>[".$info."]<br>";
            } else {
                if ($_POST['status'] == '3' || $_POST['status'] == '4' || $_POST['ver']=='si'
                ) { //si es no conforme o conforme 2010-07-22 
                    $disabled = " disabled "; 
                    $class = "text-view";
                    $window = true;//edicion de textarea
                    ?>                    
                    <script type="text/javascript">
                            document.getElementById('graba').className = "buttonDis";
                            document.getElementById('graba').disabled = true;
                            document.getElementById('limpia').className = "buttonDis";		
                            document.getElementById('limpia').disabled = true;
                    </script>
                    <?php
                } else {
                    $disabled = " "; 
                    $class = "text-input";
                    $window = false;//edicion de textarea
                    ?>                    
                    <script type="text/javascript">
                            document.getElementById('graba').className = "button";
                            document.getElementById('graba').disabled = false;
                            document.getElementById('limpia').className = "button";		
                            document.getElementById('limpia').disabled = false;
                    </script>
                    <?php

                }
            }

        } //else echo "* etapa no encontrada [".$_POST['etapa']."] *";

?>
        <!--
            <tr><td class=form_standar_cap>
            		<?=$arr_label['fecha_asignado']?><td><span class='fake_field'><?php echo fecha_usr(substr($operador2['adm_coe_inipro_dt'],0,10))?></span>
            	</td>
                <td class=form_standar_cap><?=$arr_label['fecha_esperada']?><td><span class='fake_field'><?php echo fecha_usr(substr($operador2['adm_coe_fin'],0,10))?></span></td>
                <td class=form_standar_cap><?=$arr_label['fecha_resultado']?><td><input class="text-view" readonly size=10 value="<?php echo date('d-m-Y')?>">
        -->

                <td>         
            </tr>

<?php if (substr($_POST['id'],0,6) != "030209" && $_POST['id'] != "030208" && substr($_POST['id'],0,7) != "030209A" && substr($_POST['id'],0,7) != "0302B09" && $_POST['id'] != "030504" ) { //2015-08-07 ?>
            <tr><td class=form_standar_cap><?=$arr_label['resultado']?></td>
                <td>                
                    <?php                     
                    $onchange = "";
                    // echo "(".$disabled.")";
                    $numboletas=0;
                    if ($_POST['id'] == "03020502" || $_POST['id'] == "0302A0502" || $_POST['id'] == "0302B0502") { 
                        $sql = "SELECT adm_cnf_numbol FROM adm_config";
                        $result=$connection->Execute($sql);
                        if (!$result->EOF) 
                            $numboletas=$result->fields[0];
                    }

                    if (intval($_POST['bolespres'])==2)
                        $boleta=1;
                    else
                        $boleta=0;

                        if (trim($disabled) == "disabled" && $boleta == "0")                    
                        $onchange = " onfocus='this.defaultIndex=this.selectedIndex;' onchange='this.selectedIndex=this.defaultIndex;' ";
   
                    ?>
                    <?php
                     if ($boleta != "0" ) {
                        if (trim($disabled) == "disabled"){ ?>
                            <select name="status" id="status" class="text-view" disabled="true"" >
                        <?php } else {?>
                            <select name="status" id="status" <?=$onchange?>  onChange="status_change(this.value)">
                        <?php } ?>
                    <?php } else {?>
                        <select name="status" id="status" <?=$onchange?>  class="<?=$class?>"  onChange="status_change(this.value)">
                    <?php }?>

                    <option value='0'><?=$arr_label['seleccione']?></option>

					<?php if ($_POST['id'] == "030202" || $_POST['id'] == "030203" || $_POST['id'] == "030204" || $_POST['id'] == "0302A02" || $_POST['id'] == "0302A03" || $_POST['id'] == "0302A04" || $_POST['id'] == "0302B02" || $_POST['id'] == "0302B03" || $_POST['id'] == "0302B04" || $_POST['id'] == "0302041" | $_POST['id'] == "0302A041" || $_POST['id'] == "0302B041") { ?>
                        <?php 
                        if ($boleta != "0" && $_POST['bolnum'] == 2) { ?>
                            <option value="3"><?=$arr_label['no_conforme']?></option>
                            <option value="4"><?=$arr_label['conforme']?></option>
                        <?php } else {?>
                            <option value="1"><?=$arr_label['proceso']?></option>
                            <option value="2"><?=$arr_label['boleta']?></option>
                            <option value="3"><?=$arr_label['no_conforme']?></option>
                            <option value="4"><?=$arr_label['conforme']?></option>
                        <?php } ?>
                    <?php } ?>
                    

                    <?php if ($_POST['id'] == "0302042" || $_POST['id'] == "0302A042" || $_POST['id'] == "0302B042" ) { //2017-12-27 ?>
                    <option value="1"><?=$arr_label['qc_notappli']?></option>
                    <option value="4"><?=$arr_label['qc_pass']?></option>
                    <option value="3"><?=$arr_label['qc_fail']?></option> 
                    <?php } ?>
                    

                	<?php if ($_POST['id'] == "030205" || $_POST['id'] == "0302A05" || $_POST['id'] == "0302B05") { ?>
                    <option value="4"><?=$arr_label['p-conforme']?></option>
                    <option value="3"><?=$arr_label['p-no_conforme']?></option>
					<input type="hidden" id="LOQ_gen"		name="LOQ_gen"          value="<?=$_POST['loq_gen'] ?>">
                    <?php } ?>

                    <?php if ($_POST['id'] == "03020502" || $_POST['id'] == "0302A0502" || $_POST['id'] == "0302B0502") { 
                            if ($numboletas<3){ 
                                ?>
                                <option value="1"><?=$arr_label['proceso']?></option>
                                <option value="4"><?=$arr_label['p-conforme']?></option>
                                <option value="3"><?=$arr_label['p-no_conforme']?></option>
                                <?php 
                            } else {
                                ?>
                                <option value="1"><?=$arr_label['proceso']?></option>
                                <option value="8"><?=$arr_label['send-loq']?></option>
                                <option value="4"><?=$arr_label['p-conforme']?></option>
                                <option value="3"><?=$arr_label['p-no_conforme']?></option>
                                <?php                                                    
                            }
                    }?>

					<?php if ($_POST['id'] == "030206" || $_POST['id'] == "030207" || $_POST['id'] == "030208") { //2017-10-28 ?>
                    <option value="1"><?=$arr_label['unselect']?></option>
                    <option value="3"><?=$arr_label['no_conforme']?></option>
                    <option value="4"><?=$arr_label['conforme']?></option>
                    <?php } ?>
                    

					<?php /*if ($_POST['id'] == "030202" || $_POST['id'] == "030203" || $_POST['id'] == "030204" || $_POST['id'] == "0302041") { //2018-01-10 ?>
                    <option value="6"><?=$arr_label['reject']?></option>
                    <?php } */?>

                    </select>
                </td>
                
                    <td colspan=1><td>
                    
                        <table border=0>
                        <tr>
                        <td class=form_standar_cap><div id=bolespres_cap style='display:none'><?=$arr_label['espera_respuesta']?></div></td>
                        <td><div id=bolespres_inp style='display:none'>
                            <select name="bolespres" id="bolespres" <?=$disabled?> class="<?=$class?>" onChange="bolespres_change(this.value)">
                            <option value="2"><?=$arr_label['no']?></option>
                            <option value="1"><?=$arr_label['si']?></option>
                            </select>
                            </div>
                        </td>

                        <td class=form_standar_cap><div id=dias_cap style='display:none'><?=$arr_label['dias_respuesta']?></div></td>
                        <td><div id=dias_inp style='display:none'><input class="<?=$class?>" <?=$disabled?> name="dias" id="dias" autocomplete="off" maxlength="4" size="4" value="<?=$_POST['dias']?>" type=text onKeyPress="return acceptNumeric(event);" onChange="return dias_limite(this.value)"></div></td>

                        <td class=form_standar_cap><div id=bolresdt_cap style='display:none'><?=$arr_label['fecha_limite']?></div></td>
                        <?php if ($class=='text-view'){ ?>

                            <td><div id=bolresdt_inp style='display:none'><input class="<?=$class?>" readonly name="bolresdt2" id="bolresdt2" size=10 value="<?php echo fecha_usr($_POST['bolresdt2'])?>"></div></td>

                        <?php } else { ?>

                            <td><div id=bolresdt_inp style='display:none'><input class="<?=$class?>" readonly name="bolresdt" id="bolresdt" size=10 value="<?php echo fecha_usr($_POST['bolresdt'])?>"></div></td>

                        <?php } ?>


                        <td class=form_standar_cap>
                        <!-- conclusiones de evaluacion -->
                        <?php if (substr($_POST['id'],0,6)!='030205' ) { ?>
                            <button  style="height:32px"  <?=$class?> name=BtnPdf id=BtnPdf onclick="return open_url('')" target="_blank">
                            <?=$arr_label['conclusiones1']?> 
                            </button>
                        <?php } ?>

                        <?php //($_SESSION['ADMusuario_id'] != $operador2['adm_coe_tec_id'] ? " class=buttonDis disabled " : "class=button") ?> 
                        <?php if (substr($_POST['id'],0,6)!='030205' ) {  ?>
                        
                        <span><?=(empty($_POST['adm_coe_pdf'])? "" : "<img src='includes/images/acroread.png'>")?></span>
                        <?php } ?>
                                        
                        <!-- print de conclusiones de evaluacion ene-2018
                        <td class=form_standar_cap>                        
                        <button  style="height:32px"  <?=$class?>                   
                        name=BtnPrn id=BtnPrn onclick="return PrnEvaluation('<?=$disabled2?>','<?=$_POST['etapa']?>','<?=$operador2['adm_coe_tec_id']?>')">
                        <?=$arr_label['evaluation']?> 
                        </button>
                        -->

                        <?php ($_SESSION['ADMusuario_id'] != $operador2['adm_coe_tec_id'] ? " class=buttonDis disabled " : "class=button") ?> 
                        
                        </td>
                        </table>
                    </td>

    
<?php } ?>

</form>
                
<script type="text/javascript">
    if (document.getElementById('status')) {
        document.getElementById('status').value = '<?php echo intval($StrStatus)?>';
        if (document.getElementById('status').value == "") document.getElementById('status').value = 0; //par que funcione en chrome 2012-11-28
        //document.getElementById('bolespres').value = '<?=$_POST['bolespres']?>';
        document.getElementById('status').focus();
        /*
        if (document.getElementById('status').value != '2')
        document.getElementById('bolespres').value = '2';
        */
        status_change(document.getElementById('status').value);
        //bolespres_change(document.getElementById('bolespres').value);
        if (document.getElementById('status').value == '2')                
		    bolespres_change('1');
    }
</script>

