<?php

include '../conector.php';
session_start();
date_default_timezone_set('America/Bogota');
$today = date('Y-m-d');

if(isset($_SESSION["user"]) && $_SESSION["tipo"]=='D'){
$cuenta="select docente.teacher_id,docente.coordinador
	from usuarios,docente 
	where name='".$_SESSION["user"]."'
	and usuarios.cuenta=docente.email";
$res_cuenta=mysql_query($cuenta);
$rs_cta=mysql_fetch_array($res_cuenta);

  $class1="class=\"active\"";
  $class2="";
  $act2="";
  $act1=" active ";

 $select_pago="select  	id,
			estudiante,
			titulo,
			descripcion,
			valor,
			fecha,
			fecha_insert,
			estado,
			(select estudiante.nombre from estudiante where estudiante.estudiante_id=pagos.estudiante),
			(select curso.codigo from estudiante,curso where curso.curso_id=estudiante.curso_id and estudiante.estudiante_id=pagos.estudiante)
 			from pagos 
 			where estado in ('D','P') 
 			order by id";
//echo $select_pago;				
/* $res_select_pago=mysql_query($select_pago);
				
					$tbody="<tbody>";
					while($r_sp=mysql_fetch_array($res_select_pago)){
					
					if($r_sp[7]=='P'){
					 $pago="<span class='label label-success'>Pago</span>";
					}else{
					 $pago="<span class='label label-danger'>Debe</span>";
					}
					
					$tbody.="<tr role='row'><td>".$r_sp[8]."</td><td>".$r_sp[2]."</td><td>".$r_sp[3]."</td><td>$ ".number_format($r_sp[4])."</td><td>".$pago."</td><td>".$r_sp[5]."</td><td>&nbsp;</td></tr>";
					}
					$tbody.="</tbody>";*/
if(isset($_POST['val2'])&&!empty($_POST['val2'])){

 $class2="class=\"active\"";
  $class1="";
  $act1="";
  $act2=" active ";
  
  $est1="";

	if($_POST['val2']==5){
	//echo $_POST['buscar2']."HOLA";
	
	$select_est="select estudiante_id,nombre,(select nombre_archivo from upload where upload.codigo=estudiante.estudiante_id and clase='F'),estado_est 
			from estudiante  where estudiante_id=".$_POST['buscar2']." ";
	if(mysql_query($select_est)){
	$res_select_est=mysql_query($select_est);
	$num_filas=mysql_num_rows($res_select_est);
	
	if($num_filas>0){	
	$r_estudiante=mysql_fetch_array($res_select_est);
	$est1=$r_estudiante[0];$est1.=" - ";$est1.=$r_estudiante[1];
	if(!empty($r_estudiante[2])&&isset($r_estudiante[2])){$foto="<div align=left><img style='
						border-radius: 100%;
						-moz-border-radius: 100%;
						-webkit-border-radius: 100%;
						-khtml-border-radius: 100%;
						border: 2px solid #cee6fb;
						margin-left:150px;
						margin-bottom:20px;						
						 overflow: hidden;'  src='../img/foto/".$r_estudiante[2]."' width='75px' height='75px' ></div>";}
					else{$foto="<div align=center><img style='
						border-radius: 50%;
						-moz-border-radius: 50%;
						-webkit-border-radius: 50%;
						-khtml-border-radius: 50%;
						border: 2px solid #cee6fb;
						margin-left:150px;
						margin-bottom:20px;						
						 overflow: hidden;'  src='../img/foto/anon.png' width='75px' height='75px' ></div>";}
	}
	}
	
	}
	
}
if(isset($_POST['val1'])&&!empty($_POST['val1'])){

if($_POST['val1']==4){
$insert_pago_det="insert into pagos_detalle 
(pago,fecha,valor,fecha_insert,user)
values
(".$_POST['pago_c'].",'".$_POST['fecha_c']."',".$_POST['abono_c'].",now(),'".$_SESSION["user"]."')
";
//mysql_query($insert_pago_det)or die(mysql_error());

if(mysql_query($insert_pago_det)){

//15042014 1136 pm

		$select_valor_gral="select valor from pagos where id=".$_POST['pago_c']." ";
 			$res_select_valor_gral=mysql_query($select_valor_gral);
			$res_vlrg=mysql_fetch_array($res_select_valor_gral);

		$select_pagos_det3="select sum(valor) as valor3 from pagos_detalle where pago=".$_POST['pago_c']." and estado='A' ";
 			$res_select_pagos_det3=mysql_query($select_pagos_det3);
			$res_pagos3=mysql_fetch_array($res_select_pagos_det3);
					
					
			if(!isset($res_pagos3[0])||$res_pagos3[0]==0){$saldo_consulta3=$res_vlrg[0];}
			else{$saldo_consulta3=$res_vlrg[0]-$res_pagos3[0];}
					
 			if($saldo_consulta3<=0){$estado_final='P';}else{$estado_final='D';}
		

		$act_estado="update pagos set
		estado='$estado_final'
		where id=".$_POST['pago_c']."
			";
		mysql_query($act_estado)or die(mysql_error());
		
		$men="<div class=\"alert alert-success\">
	                    <button type=\"button\" class=\"close\" data-dismiss=\"alert\">X</button>
	                    Abono Insertado
				</div>";
				
				
}else{
		$men="<div class=\"alert alert-danger\">
	                    <button type=\"button\" class=\"close\" data-dismiss=\"alert\">X</button>
	                    Error al Insertar Abono -".mysql_error()."
				</div>";


}



}
if($_POST['val1']==3){
	$borra_obs="update observacion_docente set estado='I' where id=".$_POST['obs1']." ";
	if(mysql_query($borra_obs)){
		$men="<div class=\"alert alert-success\">
	                    <button type=\"button\" class=\"close\" data-dismiss=\"alert\">X</button>
	                    Obs Borrada.
				</div>";
		$insert_audit="insert into auditoria (proceso,cod,modulo,usuario,fecha) values ('BORRAR OBS DISCIP','ID:".$_POST['obs1']." - FECHA:".date("Y-m-d H:i:s")."','DOCENTES','".$_SESSION["user"]."','".date("Y-m-d H:i:s")."' )  ";
		mysql_query($insert_audit)or die(mysql_error());
	}else{
		$men="<div class=\"alert alert-danger\">
	                    <button type=\"button\" class=\"close\" data-dismiss=\"alert\">X</button>
	                    Error al borrar Obs. - ".mysql_error()."
				</div>";
	}


}
 if($_POST['val1']==2){
 	
 
 	$act_obs="update observacion_docente
 	set 
 	problema='".$_POST['problema1']."',
 	correctivo='".$_POST['correctivo1']."',
 	fecha_ocurrencia='".$_POST['fecha1']."',
 	planilla='".$_POST['periodo1']."'
 	where id=".$_POST['obs1']." ";

	if(mysql_query($act_obs)){
	$men="<div class=\"alert alert-success\">
                    <button type=\"button\" class=\"close\" data-dismiss=\"alert\">X</button>
                    Obs. Actualizada
			</div>";
	$insert_audit="insert into auditoria (proceso,cod,modulo,usuario,fecha) values ('ACTUALIZAR OBS DISCIP','ID:".$_POST['obs1']." - FECHA:".$_POST['fecha1']."','DOCENTES','".$_SESSION["user"]."','".date("Y-m-d H:i:s")."' )  ";
		mysql_query($insert_audit)or die(mysql_error());			

	}else{
	$men="<div class=\"alert alert-danger\">
                    <button type=\"button\" class=\"close\" data-dismiss=\"alert\">X</button>
                    Error al Actualizar Obs. - ".mysql_error()."
			</div>";
	}
	
 }
 if($_POST['val1']==1||$_POST['val1']==2||$_POST['val1']==3||$_POST['val1']==4){
 
  $select_est="select    
			(select estudiante.nombre from estudiante where estudiante.estudiante_id=observacion_docente.estudiante),
			(select curso.codigo from estudiante,curso where curso.curso_id=estudiante.curso_id and estudiante.estudiante_id=observacion_docente.estudiante)
 			from observacion_docente 
 			where estudiante='".$_POST['buscar1']."'
 			and estado in ('A')
 			order by id desc";
   $res_select_est=mysql_query($select_est);
 $r_est=mysql_fetch_array($res_select_est);
 
  $select_pago="select    Id,
			  estudiante,
			  problema,
			  correctivo,
			  fecha_ocurrencia,
			  asignatura,
ifnull((select docente.nombre from docente where docente.teacher_id=observacion_docente.docente),observacion_docente.user),
			  (select concat(planilla.anno,' - ',planilla.periodo) from planilla where planilla.id=observacion_docente.planilla),
			  observacion_docente.planilla,
			  pensum,
			  estado,
                          docente
 			from observacion_docente 
 			where estudiante='".$_POST['buscar1']."'
 			and estado in ('A')
 			order by id desc";
 			
//echo $select_pago;				
if(mysql_query($select_pago)){
 $res_select_pago=mysql_query($select_pago);
 $num_fil=mysql_num_rows($res_select_pago);}
				
					if($num_fil>0){
					
					$tbody="<tbody>";
					
					while($r_sp=mysql_fetch_array($res_select_pago)){
					$planilla=$r_sp[8];
					$dis=' disabled ';
					if($rs_cta[0]==$r_sp[11]){$dis=' ';}
					$tbody.="<tr role='row'><td>".$r_sp[7]."</td><td>".date("d-m-Y", strtotime(substr($r_sp[4],0,10)))."</td><td>".$r_sp[6]."</td><td>".$r_sp[2]."</td><td>".$r_sp[3]."</td>
					<td>

					
					<a style='margin-top:5px' $dis class='btn btn-primary btn-xs' data-toggle='modal' data-target='#mimodalb".$r_sp[0]."' name='".$_POST['buscar1']."' id='".$_POST['buscar1']."' onclick=''>
			                Editar  
				            </a>
				            
				            <a style='margin-top:5px' $dis class='btn btn-danger btn-xs' data-toggle='modal'  name='".$r_sp[0]."' id='".$r_sp[0]."' onclick='borra_obs(".$r_sp[0].",".$r_sp[1].")'>
			                Borrar  
				            </a>
					
					</td></tr>";
					
										
					$tbody.="<div name='mimodalb".$r_sp[0]."' id='mimodalb".$r_sp[0]."' class='modal fade bs-example-modal-sm' tabindex='-1' role='dialog' aria-labelledby='mySmallModalLabel' aria-hidden='true'>
					  <div class='modal-dialog modal-md'>
					    <div class='modal-content'>
					      <div class='modal-header'>
						      <button type='button' class='close' data-dismiss='modal' aria-hidden='true'>x</button>
					      		<h4 class='modal-title' id='myLargeModalLabel'>Editar Pago</h4>
      					      </div>
      					      <div class='modal-body'>";
					   

							$tbody.="
							
							 <div class='input' style='float:left;width: 140px;padding-top: 0px;padding-left: 10px;text-align: left;' >
								Periodo&nbsp;
							  </div>
							 <div class='' >
							    <select id='periodo_".$r_sp[0]."' name='periodo_".$r_sp[0]."' style='width:48%;margin-bottom: 10px' class='form-control2'>";
							   
							   
							    $sel_plan2="select Id,anno,periodo,fecha_insert,estado,usuario from planilla where estado='A' ";
							    $res_sel_plan2=mysql_query($sel_plan2);
							    
							    while($r_plan2=mysql_fetch_array($res_sel_plan2)){
							   $se1=''; 
							   if($r_plan2[0]==$r_sp[8]){$se1=' selected '; }
							    $tbody.="<option value=".$r_plan2[0]."  ".$se1.">".$r_plan2[1]." - ".$r_plan2[2]."</option>";
							    
							    
							    
							    }
							   
							   
							   								   
			$tbody.="							   
							
							    	
							    </select>
							    
							 </div>
					
							 <div class='input' style='float:left;width: 140px;;margin-bottom: 10px;padding-left: 10px;text-align: left;' >
								Fecha&nbsp;
							  </div>
							 <div class='input' >
							    <input value='".substr($r_sp[4],0,10)."' id='fecha_".$r_sp[0]."' name='fecha_".$r_sp[0]."' type='date' class='form-control2'  style='width:48%;margin-bottom: 10px'>
							 </div>
			
							<div class='input' style='float:left;width: 140px;padding-top: 0px;padding-left: 10px;text-align: left;' >
								Sit. Problema &nbsp;
							  </div>
							
							 <div class='input' >
							    <input value='".$r_sp[2]."' id='problema_".$r_sp[0]."' name='problema_".$r_sp[0]."' type='text' class='form-control2'  placeholder='ej. pago mes de enero' style='width:48%;margin-bottom: 10px'>
							 </div>
							<div class='input' style='float:left;width: 140px;padding-top: 0px;padding-left: 10px;text-align: left;' >
								Correctivo &nbsp;
							  </div>
							 <div class='input' >
							    <input value='".$r_sp[3]."' id='correctivo_".$r_sp[0]."' name='correctivo_".$r_sp[0]."' type='text' class='form-control2'  placeholder='ej. 100000' style='width:48%;margin-bottom: 10px'>
							 </div>
							
							<div><button type=\"button\" class=\"btn btn-primary btn-xs\" onclick='actualiza_obs(".$r_sp[0].",".$r_sp[1].")' >Actualizar</button>
							<button type=\"button\" class=\"btn btn-info btn-xs\" data-dismiss='modal' >Cerrar</button>
							</div>
							";
					$tbody.="
						</div>
					    </div>
					  </div>
					</div>	";	
					
					
				
					
					
					
					
					
					}
					$tbody.="</tbody>";
 					}else
 					{
 					$men="<div class=\"alert alert-danger\">
		                    <button type=\"button\" class=\"close\" data-dismiss=\"alert\">X</button>
		                    No existen registros para esta busqueda.
					</div>";
 					
 					}
 
 }


}

if(isset($_POST['val2'])&&!empty($_POST['val2'])){

 if($_POST['val2']==1){
  $class1="";
  $class2="class=\"active\"";
  $act1="";
  $act2=" active ";

	
		
		
	$insertar_pago='insert into observacion_docente (estudiante,problema,correctivo,fecha_ocurrencia,asignatura,docente,planilla,pensum,estado,fecha_insert)
	values("'.$_POST['buscar2'].'","'.$_POST['problema2'].'","'.$_POST['correctivo2'].'","'.$_POST['fecha_p2'].'",null,'.$rs_cta[0].','.$_POST['periodo2'].',null,"A",now()
	)';
//echo $insertar_pago;
	if(mysql_query($insertar_pago)){
	$men="<div class=\"alert alert-success\">
                    <button type=\"button\" class=\"close\" data-dismiss=\"alert\">X</button>
                    Obs. Insertada
			</div>";
	$insert_audit="insert into auditoria (proceso,cod,modulo,usuario,fecha) values ('INSERTAR OBS DISCIP','EST:".$_POST['buscar2']." - FECHA:".$_POST['fecha_p2']."','DOCENTES','".$_SESSION["user"]."','".date("Y-m-d H:i:s")."' )  ";
	mysql_query($insert_audit)or die(mysql_error());

	}else{
	$men="<div class=\"alert alert-danger\">
                    <button type=\"button\" class=\"close\" data-dismiss=\"alert\">X</button>
                    Error al insertar Obs. ".mysql_error()."
			</div>";

	}	

 }
}

echo "
<!DOCTYPE html>
<html lang=\"en\">
  <head>
    <meta charset=\"utf-8\">
    <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">
    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">
    <meta name=\"description\" content=\"\">
    <meta name=\"author\" content=\"\">
    <link rel=\"shortcut icon\" href=\"../assets/ico/favicon.ico\">
<link rel='stylesheet' href='../js/css/jquery-ui-1.9.2.custom.css' />	

    <title>Registro Observaciones</title>

    <!-- Bootstrap core CSS -->
    <link href=\"../dist/css/bootstrap.min.css\" rel=\"stylesheet\">

    <!-- Custom styles for this template -->";
	 include 'fuente.php'; 
echo "
    <link href=\"../offcanvas.css\" rel=\"stylesheet\">

    <!-- Just for debugging purposes. Don't actually copy this line! -->
    <!--[if lt IE 9]><script src=\"../assets/js/ie8-responsive-file-warning.js\"></script><![endif]-->

    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src=\"https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js\"></script>
      <script src=\"https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js\"></script>
    <![endif]-->


    <script>
function guardar_det(ide,est){

document.getElementById('buscar1').value=est;
	if(document.getElementById('abono_c_'+ide).value==''){alert('Debe digitar el valor del abono');return false;}
		else{
			if(parseInt(document.getElementById('saldo_c_'+ide).value)<=0)
			{		alert('saldo de la deuda es 0');
					return false;}
			if(parseInt(document.getElementById('abono_c_'+ide).value)==0)
			{		alert('Valor de abono es 0');
					return false;}		
			if( parseInt(document.getElementById('abono_c_'+ide).value)> parseInt(document.getElementById('saldo_c_'+ide).value))
			{		alert('abono es mayor al saldo');
					return false;}
			else
			{		document.getElementById('abono_c').value=document.getElementById('abono_c_'+ide).value;
			}
		}
	if(document.getElementById('fecha_c_'+ide).value==''){alert('Debe seleccionar fecha de pago');return false;}
		else{document.getElementById('fecha_c').value=document.getElementById('fecha_c_'+ide).value;}
	
	document.getElementById('pago_c').value=ide;
	
	document.getElementById('val1').value=4;
	document.forms['listar_pago'].submit();
}
function busca_foto(){
	if(document.getElementById('buscar').value==''){return false;}
		else{
		var mystr = document.getElementById('buscar').value;
		var myarr = mystr.split(' - ');var t_id = myarr[0];
		//alert(t_id);
		document.getElementById('buscar2').value=t_id;
		document.getElementById('val2').value=5;
		document.forms['crear_pago'].submit();
		}
}
function crea_pago(){
	if(document.getElementById('buscar').value==''){alert('Debe digitar el nombre');return false;}
		else{
		var mystr = document.getElementById('buscar').value;
		var myarr = mystr.split(' - ');var t_id = myarr[0];
		document.getElementById('buscar2').value=t_id;
		}
	
	if(document.getElementById('periodo').value==''){alert('Debe seleccionar periodo');return false;}
		else{document.getElementById('periodo2').value=document.getElementById('periodo').value}

	if(document.getElementById('fecha_p').value==''){alert('Debe seleccionar fecha');return false;}
		else{document.getElementById('fecha_p2').value=document.getElementById('fecha_p').value}

	if(document.getElementById('problema').value==''){alert('Debe digitar el problema');return false;}
		else{document.getElementById('problema2').value=document.getElementById('problema').value}
	
	if(document.getElementById('correctivo').value==''){alert('Debe digitar correctivos');return false;}
		else{document.getElementById('correctivo2').value=document.getElementById('correctivo').value}

	document.getElementById('val2').value=1;
	document.forms['crear_pago'].submit();			
}
function buscar_obs(){

if(document.getElementById('buscar_').value==''){alert('Debe digitar el nombre');return false;}
		else{
		var mystr = document.getElementById('buscar_').value;
		var myarr = mystr.split(' - ');var t_id = myarr[0];
		document.getElementById('buscar1').value=t_id;
		}

	document.getElementById('val1').value=1;
	document.forms['listar_pago'].submit();

}
function actualiza_obs(ide,est){
	document.getElementById('buscar1').value=est;
	if(document.getElementById('periodo_'+ide).value==''){alert('Debe seleccionar periodo');return false;}
		else{document.getElementById('periodo1').value=document.getElementById('periodo_'+ide).value}
	if(document.getElementById('fecha_'+ide).value==''){alert('Debe seleccionar fecha');return false;}
		else{document.getElementById('fecha1').value=document.getElementById('fecha_'+ide).value}
	if(document.getElementById('problema_'+ide).value==''){alert('Debe digitar problema');return false;}
		else{document.getElementById('problema1').value=document.getElementById('problema_'+ide).value}
	if(document.getElementById('correctivo_'+ide).value==''){alert('Debe digitar correctivo');return false;}
		else{document.getElementById('correctivo1').value=document.getElementById('correctivo_'+ide).value}				
	document.getElementById('obs1').value=ide;
	
	document.getElementById('val1').value=2;
	document.forms['listar_pago'].submit();
}
function borra_obs(ide,est){



if (confirm('Esta seguro que desea anular esta obs.?')) {	

document.getElementById('buscar1').value=est;
document.getElementById('obs1').value=ide;

	document.getElementById('val1').value=3;
	document.forms['listar_pago'].submit();


}
		else{return false;}



}
</script>
    
  </head>

  <body>
    <div class=\"navbar navbar-fixed-top navbar-inverse\" role=\"navigation\">
      <div class=\"container\">
         <div class=\"navbar-header\">
          <button type=\"button\" class=\"navbar-toggle hidden-xs\" data-toggle=\"collapse\" data-target=\".navbar-collapse\">
            <span class=\"sr-only\">Toggle navigation</span>
         
          </button>
         
         
          
          <a  href=\"general.php\" class='hidden-xs' ><img src='../img/logo1.png'  style='margin-top:5px;'></a>
	         <div align='' class='visible-xs'>
		         <a  href=\"general.php\"  ><img src='../img/logo1.png' width='250px' style='margin-top:10px;margin-left:5px'></a>
		         <a href=\"../index.php\" ><img src='../img/salir2.png' style='float:right;margin-top:15px;margin-right:10px'></a>
	         </div>

        </div>
      	<a href=\"../index.php\" class='hidden-xs'><img src='../img/salir.png' style='float:right;margin-top:15px'>
 	      	
         </a><span style='float:right;margin-right:10px; margin-top:15px' class='label label-success hidden-xs'><span class='glyphicon glyphicon-user'></span> ".$_SESSION["user"]."  </span>  

      
      	
      </div><!-- /.container -->
    </div><!-- /.navbar -->


    <div class=\"container\">

      <div class=\"row row-offcanvas row-offcanvas-left\">

       <div class=\"col-xs-6 col-sm-3 sidebar-offcanvas\" id=\"sidebar\" role=\"navigation\">
         <div class=\"list-group\">
            <a href=\"general.php\" class=\"list-group-item \" data-rel='popover' data-content='Dashboard' data-original-title><span class=\"glyphicon glyphicon-home\"></span> General</a>
            <a href=\"estudiantes.php\" class=\"list-group-item \"><span class=\"glyphicon glyphicon-th\"></span> Estudiantes</a>
            <a href=\"docentes.php\" class=\"list-group-item\"><span class=\"glyphicon glyphicon-user\"></span> Docentes</a>
            <a href=\"horario.php\" class=\"list-group-item \"><span class=\"glyphicon glyphicon-edit\"></span> Horario</a>
            <a href=\"logros.php\" class=\"list-group-item\"><span class=\"glyphicon glyphicon-edit\"></span> Logros</a>            
            <a href=\"planilla.php\" class=\"list-group-item \"><span class=\"glyphicon glyphicon-file\"></span> Planilla Notas</a> 
            <a href=\"planilla_asistencia.php\" class=\"list-group-item \"><span class=\"glyphicon glyphicon-file\"></span> Asistencia</a>                                
            <a href=\"reportes.php\" class=\"list-group-item \"><span class=\"glyphicon glyphicon-file\"></span> Informes</a>
            <a href=\"planilla_obs.php\" class=\"list-group-item \"><span class=\"glyphicon glyphicon-file\"></span> Planilla Obs.</a>
<a href=\"eventos.php\" class=\"list-group-item \"><span class=\"glyphicon glyphicon-edit\"></span> Anuncios</a>
";                        
if($rs_cta[1]==1||$rs_cta[1]==0){
	echo	"<a href=\"obs_disciplinarias.php\" class=\"list-group-item active\"><span class=\"glyphicon glyphicon-file\"></span> Registro Obs.</a>";
}
echo            
          "                        
          </div>
        </div><!--/span-->

        <div class=\"col-xs-12 col-sm-9\">
          <p class=\"pull-left visible-xs\">
            <button type=\"button\" class=\"btn btn-primary btn-xs\" data-toggle=\"offcanvas\">menu</button>
          </p>
    
	<div class=\"panel panel-default\">
	<br>";
echo $men;	
echo	      "<!-- Nav tabs -->
	<ul class=\"nav nav-tabs\">
		<li >&nbsp;</li>
	  <li $class1 ><a href=\"#home\" data-toggle=\"tab\">Consultar Obs. Disc.</a></li>
	  <li $class2 ><a href=\"#profile\" data-toggle=\"tab\">Diligenciar</a></li>
	</ul>
	
	<!-- Tab panes -->

	<div class=\"tab-content\">
	<div class=\"tab-pane fade in $act2 \" id=\"profile\">
		<form name='crear_pago' id='crear_pago' method='post' action='obs_disciplinarias.php#profile' target='' enctype='multipart/form-data'>
		<input type='hidden' name='val2' id='val2' value='".$val2."'>	
		<input type='hidden' name='buscar2' id='buscar2' value='".$buscar2."'>	
		<input type='hidden' name='problema2' id='problema2' value='".$problema2."'>	
		<input type='hidden' name='correctivo2' id='correctivo2' value='".$correctivo2."'>			
		<input type='hidden' name='valor2' id='valor2' value='".$valor2."'>			
		<input type='hidden' name='estado2' id='estado2' value='".$estado2."'>
		<input type='hidden' name='periodo2' id='periodo2' value='".$periodo2."'>		
		<input type='hidden' name='fecha_p2' id='fecha_p2' value='".$fecha_p2."'>				
		<input type='hidden' name='abono2' id='abono2' value='".$abono2."'>			
		
		<div class=\"page\">
			<fieldset>
				<legend>
					<br><span class=\"glyphicon glyphicon-plus\"></span> Nueva Obs.          
				</legend>			
			</fieldset>
		
		$foto
		 <div class='input' style='float:left;width: 140px;padding-top: 5px;padding-left: 10px;text-align: left;' >
			Estudiante&nbsp;
		  </div>
		 <div class='' >
		    <input type='text' id='buscar' name='buscar' class='form-control' value='".$est1."' style='width:48%;margin-bottom: 10px' onclick='this.value=\"\"'    onblur='busca_foto()'>
		 </div>

		 <div class='input' style='float:left;width: 140px;padding-top: 5px;padding-left: 10px;text-align: left;' >
			Periodo&nbsp;
		  </div>
		 <div class='input' >
		    <select id='periodo' name='periodo' class='form-control'  style='width:48%;margin-bottom: 10px'>";
		    $sel_plan="select Id,anno,periodo,fecha_insert,estado,usuario from planilla where estado='A' ";
		    $res_sel_plan=mysql_query($sel_plan);
		    
		    while($r_plan=mysql_fetch_array($res_sel_plan)){
		    
		    echo "<option value=".$r_plan[0].">$r_plan[1]-$r_plan[2]</option>";
		    
		    
		    
		    }
		    
		    
echo		    "</select>
		 </div>

		 <div class='input' style='float:left;width: 140px;padding-top: 5px;padding-left: 10px;text-align: left;' >
			Fecha&nbsp;
		  </div>
		 <div class='input' >
		    <input id='fecha_p' name='fecha_p' type='date' class='form-control'  style='width:48%;margin-bottom: 10px'>
		 </div>
		 
<hr>		 
		 <div class='input' style='float:left;width: 140px;padding-top: 5px;padding-left: 10px;text-align: left;' >
			Observaci&oacute;n &nbsp;
		  </div>
		 <div class='input' >
		    <textarea rows='3' id='problema' class='form-control' style='width:72%;margin-bottom: 10px;font-size:10px;'></textarea>
		 </div>
		 <div class='input' style='float:left;width: 140px;padding-top: 5px;padding-left: 10px;text-align: left;' >
			Sel. Articulo &nbsp;
		  </div>
		  
		  <div class='input' >
		  
		    <select id='sancion' name='sancion' class='form-control'  style='width:72%;margin-bottom: 10px;font-size:9px;' onchange='if(this.value!=\"XX\"){
			var str1 = document.getElementById(\"problema\").value;

			var res = str1.concat(\" - \",this.value);
		    document.getElementById(\"problema\").value=res;
		    }'>";
		
		$select_manual="select Id,descripcion from manual where tipo='S' and estado='A' order by descripcion ";		    
		    $res_select_manual=mysql_query($select_manual);
		    echo "<option value='XX'>Seleccione Art&iacute;culo</option>";
		    while($r_man=mysql_fetch_array($res_select_manual)){
		    echo "<option value='".$r_man[1]."'>$r_man[1]</option>";
		    }
		    
echo		    "</select>
		 </div>	 
<hr>
		<div class='input' style='float:left;width: 140px;padding-top: 5px;padding-left: 10px;text-align: left;' >
			Correctivo &nbsp;
		  </div>
		 <div class='input' >
		    <textarea rows='3' id='correctivo' class='form-control' style='width:72%;margin-bottom: 10px;font-size:10px;'></textarea>
		 </div>
		 <div class='input' style='float:left;width: 140px;padding-top: 5px;padding-left: 10px;text-align: left;' >
			Sel. Articulo &nbsp;
		  </div>
		  
		  <div class='input' >
		  
		    <select id='deber' name='deber' class='form-control'  style='width:72%;margin-bottom: 10px;font-size:9px;' onchange='if(this.value!=\"XX\"){
			var str1 = document.getElementById(\"correctivo\").value;

			var res = str1.concat(\" - \",this.value);
		    document.getElementById(\"correctivo\").value=res;
		    }'>";
		
		$select_manual="select Id,descripcion from manual where tipo='C' and estado='A' order by descripcion ";		    
		    $res_select_manual=mysql_query($select_manual);
		    echo "<option value='XX'>Seleccione Art&iacute;culo</option>";
		    while($r_man=mysql_fetch_array($res_select_manual)){
		    echo "<option value='".$r_man[1]."'>$r_man[1]</option>";
		    }
		    
echo		    "</select>
		 </div>	 






		<fieldset>
		<legend>
					<br>
					
		</legend>	
			<button type='button' class='btn btn-info' onclick='crea_pago()'> Crear</button>     
			<input type='reset' class='btn' value='Borrar'>
						
		</fieldset>
			
			<br>
		</div>
	</form>
		
</div>

<div class=\"tab-pane fade in $act1 \" id=\"home\">
	<form name='listar_pago' id='listar_pago' method='post' action='obs_disciplinarias.php' target=''>
	<div class=\"page\">
	

	<input type='hidden' name='val1' id='val1' value='".$val1."'>	
<input type='hidden' name='buscar1' id='buscar1' value='".$buscar1."'>	
		<input type='hidden' name='titulo1' id='titulo1' value='".$titulo1."'>	
		<input type='hidden' name='descripcion1' id='descripcion1' value='".$descripcion1."'>			
		<input type='hidden' name='valor1' id='valor1' value='".$valor1."'>			
		<input type='hidden' name='estado1' id='estado1' value='".$estado1."'>
		<input type='hidden' name='fecha_p1' id='fecha_p1' value='".$fecha_p1."'>
		<input type='hidden' name='pago1' id='pago1' value='".$pago1."'>		
		<input type='hidden' name='abono1' id='abono1' value='".$abono1."'>					
		<input type='hidden' name='saldo1' id='saldo1' value='".$saldo1."'>
		<input type='hidden' name='abono_c' id='abono_c' value='".$abono_c."'>
		<input type='hidden' name='fecha_c' id='fecha_c' value='".$fecha_c."'>		
		<input type='hidden' name='pago_c' id='pago_c' value='".$pago_c."'>				

		<input type='hidden' name='periodo1' id='periodo1' value='".$periodo1."'>
		<input type='hidden' name='fecha1' id='fecha1' value='".$fecha1."'>
		<input type='hidden' name='problema1' id='problema1' value='".$problema1."'>
		<input type='hidden' name='correctivo1' id='correctivo1' value='".$correctivo1."'>
		<input type='hidden' name='obs1' id='obs1' value='".$obs1."'>						

	<input type='hidden' name='cur1' id='cur1' value='".$cur1."'>	
		<fieldset>
			<legend><br><span class=\"glyphicon glyphicon-th-list\"></span> 
				Listado Obs.
			</legend>			
		</fieldset>
	</div>
	 <div class='input' style='float:left;width: 100px;padding-top: 5px;padding-left: 12px;text-align: left;' >
			Estudiante:&nbsp;
	  </div>
	 <div class='input' style='padding-left:11px;'>
		    <input type='text' id='buscar_' name='buscar_' class='' value='' style='width:30%;margin-bottom: 10px' onclick='this.value=\"\"'>
		 <button type='button' class='btn btn-info btn-sm' onclick='buscar_obs()' style='margin-left: 10px'> Buscar</button>    
	 </div>

	<fieldset>
	<div class='table-responsive'>
	<table class='table table-striped table-bordered '>
		<thead>";
if(isset($r_est[0])&&!empty($r_est[0])){		
echo "<tr role='row'><td colspan='6'><h4>".$r_est[0]." - ".$r_est[1]."</h4></td></tr>";}
echo			"<tr role='row'>
				<th>Periodo</th>				
				<th>Fecha</th>
				<th>Reporta</th>				
				<th>Sit. Problema</th>				
				<th>Correctivo</th>
				<th></th>
			</tr>
		</thead>";
		
echo $tbody;
echo	"
	</div>
	</table>
	</fieldset>
	
	
	
	</form>

</div>
 
         
        </div><!--/span-->

       
      </div><!--/row-->


     </div><!--/row-->
      </div><!--/row--><hr><footer><p>Todos los derechos reservados - Copyright &copy; 2018</p></footer>

    </div><!--/.container-->

    <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src=\"https://code.jquery.com/jquery-1.10.2.min.js\"></script>
  <script src=\"../js/jquery-ui-1.10.3.custom.js\"></script>
  
    <script src=\"../dist/js/bootstrap.min.js\"></script>
    <script src=\"../offcanvas.js\"></script>
<script>
      $(function() {
	$( \"#buscar\" ).autocomplete(
	{
		 source:'../source.php',		 
		 minLength: 3
	})
}); 
$(function() {
	$( \"#buscar_\" ).autocomplete(
	{	 source:'../source.php',		 
		 minLength: 3	})
}); 

function PrintContent(iden)
{
var DocumentContainer = document.getElementById('mimodala'+iden);
var WindowObject = window.open('', 'PrintWindow',
'width=750,height=650,top=50,left=50,toolbars=no,scrollbars=yes,status=no,resizable=yes');
WindowObject.document.writeln(DocumentContainer.innerHTML);
WindowObject.document.close();
WindowObject.focus();
       if (WindowObject.print()){ 
                WindowObject.close(); 
        }else{ 
                WindowObject.close(); 
        } 

//WindowObject.print();
//WindowObject.close();
}



</script>
  </body>
</html>
";
}else{
echo "<div align='center'>Debe registrase para usar la aplicaci&oacute;n <a href='index.php' > Registrar</a></div>";
}
?>