paginacion en planilla

This commit is contained in:
fredyrivera 2017-09-30 16:31:00 -05:00
parent 6577daf540
commit 313cbb41e7
2 changed files with 20 additions and 14 deletions

View File

@ -201,7 +201,7 @@ if ($variable !=''){
/// s= SET DE DATOS /// s= SET DE DATOS
$embebido = "1"; $embebido = "1";
if(isset($_REQUEST['print'])) { $print = "window.print()";} if(isset($_REQUEST['print'])) { $print = "window.print()";}
$onload = "".planilla("$set","$planilla")." <script type=\"text/javascript\">$print</script> "; $onload = "".planilla("$set","$_REQUEST[registros]")." <script type=\"text/javascript\">$print</script> ";
} }
elseif($v[0] =='i') { elseif($v[0] =='i') {

View File

@ -2,7 +2,7 @@
date_default_timezone_set('America/Bogota'); date_default_timezone_set('America/Bogota');
function planilla($id,$plantilla){ function planilla($id,$registros){
$consulta_principal = "SELECT control,id,form_id FROM form_datos WHERE form_id = '$id' GROUP BY form_datos.control "; $consulta_principal = "SELECT control,id,form_id FROM form_datos WHERE form_id = '$id' GROUP BY form_datos.control ";
$link=Conectarse(); $link=Conectarse();
@ -11,15 +11,21 @@ mysqli_real_escape_string($link,$consulta_principal);
$sql_total=mysqli_query($link,$consulta_principal); $sql_total=mysqli_query($link,$consulta_principal);
$sql=mysqli_query($link,$consulta_principal); $sql=mysqli_query($link,$consulta_principal);
mysqli_data_seek($sql_total, 0); mysqli_data_seek($sql_total, 0);
while( $row = mysqli_fetch_array( $sql ) ) {
$linea = formulario_imprimir_linea("$id","$row[control]","linea_planilla");
$despliegue .= "<tr>$linea</tr>";
//formulario_imprimir_linea("$row[form_id]","$row[control]")
}
$titulo = formulario_imprimir_linea("$id",$row[control],'titulos'); $titulo = formulario_imprimir_linea("$id",$row[control],'titulos');
$nombre_formulario = remplacetas("form_id","id",$id,"nombre",""); $nombre_formulario = remplacetas("form_id","id",$id,"nombre","");
$descripcion_formulario = remplacetas("form_id","id",$id,"descripcion",""); $descripcion_formulario = remplacetas("form_id","id",$id,"descripcion","");
$tabla= "<h1>$nombre_formulario[0] <small>$descripcion_formulario[0]</small></h1><table class='table table-bordered'>$titulo $despliegue</table>"; $fila=1;
while( $row = mysqli_fetch_array( $sql ) ) {
if($fila % $registros == 0) {$separador="</table><h1>$nombre_formulario[0] <small>$descripcion_formulario[0]</small></h1><table class='table table-bordered table-striped'><th></th>$titulo";}else {$separador="";}
$linea = formulario_imprimir_linea("$id","$row[control]","linea_planilla");
$despliegue .= "<tr><td><small>$fila</small></td>$linea</tr> $separador";
//formulario_imprimir_linea("$row[form_id]","$row[control]")
$fila++;
}
$tabla= "<h1>$nombre_formulario[0] <small>$descripcion_formulario[0] </small></h1><table class='table table-bordered table-striped'><th></th>$titulo $despliegue</table>";
return "$tabla"; return "$tabla";
} }
@ -10505,7 +10511,7 @@ if (mysqli_num_rows($sql)!='0'){
$array[image]=$imagen; $array[image]=$imagen;
$imagen_icon="secure/?file=150/$imagen"; $imagen_icon="secure/?file=150/$imagen";
$imagen= "<img class='thumbnail' src='images/secure/?file=150/$imagen' alt='$imagen' style='max-width:100px;' title='$imagen'>"; $imagen= "<img class='thumbnail' src='images/secure/?file=150/$imagen' alt='$imagen' style='max-width:100px;' title='$imagen'>";
$td .= "<td >$imagen</td>"; $td .= "<td class='planilla_$row[id_campo]' >$imagen</td>";
}else {$imagen='';} }else {$imagen='';}
@ -10562,8 +10568,8 @@ $td .= "<td >$imagen</td>";
//json_render("$valor","csv","$control"); //json_render("$valor","csv","$control");
else {$contenido = Markdown("$contenido");} else {$contenido = Markdown("$contenido");}
$csv .= "<td style ='max-width:200px;' >$contenido</td>"; $csv .= "<td style ='max-width:200px;' class='planilla_$row[id_campo]'>$contenido</td>";
}else{ $csv.="<td></td>";} }else{ $csv.="<td class='planilla_$row[id_campo]'></td>";}
} }
elseif($tipo=="array"){ elseif($tipo=="array"){
@ -10620,15 +10626,15 @@ $td .= "<td >$imagen</td>";
if($tipo=="titulos") { if($tipo=="titulos") {
$td .= "<th>$contenido</th>"; $td .= "<th class='plantilla_$row[id_campo]'>$contenido</th>";
}else{ }else{
$td .= "<td>$contenido</td>"; $td .= "<td class='planilla_$row[id_campo]'>$contenido</td>";
} }
} }
if($tipo=="titulos") { $identificador ="<th>Identificador</th>"; }else {$identificador ="<td title=''> $control </td>";} if($tipo=="titulos") { $identificador ="<th class='control_planilla'>Identificador</th>"; }else {$identificador ="<td class='control_planilla'> $control </td>";}
$resultado .="$td $identificador "; $resultado .="$td $identificador ";
} }
if($tipo =='titulos_csv' or $tipo=='linea_csv') { if($tipo =='titulos_csv' or $tipo=='linea_csv') {