+"(cast(datediff(dd,persona.fecha_nacimiento,getdate()) / 365.25 as int)) edad, "
+"(select count(1) from carga_familiar where carga_familiar.codigo_parentesco = 3 and carga_familiar.codigo_persona = ficha.codigo_persona) nroHijos, "
// JSONObject jsonReporte = new JSONObject(reporte);
// jsonArrayListarDatosFicha.put(jsonReporte);
jsonReporte=newJSONObject(reporte);
// }
JSONObjectjsonObjListadoPersona=newJSONObject();
jsonObjListadoPersona.put("persona",jsonReporte);
...
...
@@ -1174,15 +1221,16 @@ public class FichaMysqlDAO implements FichaDAO {
StringcondicionPorUsuario="";
intcantidad=0;
intnumeroFilas=start+1;
if(criterioClient.isNull("tipoBusqueda")){
filtroListarFichas="";
}else{
switch(criterioClient.getString("tipoBusqueda")){
case"TIPO_DOCUMENTO":
filtroListarFichas="and tipo_documento.codigo_tipo_documento = "+criterioClient.getInt("codigoTipoDocumento")+" and persona.numero_documento = '"+criterioClient.getString("numeroDocumento")+"'";
filtroListarFichas="and tipo_documento.codigo_tipo_documento = "+criterioClient.getInt("codigoTipoDocumento")+" and personal.dni = '"+criterioClient.getString("numeroDocumento")+"'";
break;
case"APELLIDOS":
filtroListarFichas="and persona.apellido_paterno like '"+criterioClient.getString("apellido")+"%'";
filtroListarFichas="and persona.apellidoPaterno like '"+criterioClient.getString("apellido")+"%'";
break;
case"FECHA_REGISTRO":
filtroListarFichas="and format(estado_ficha.fecha_registro, 'dd/MM/yyyy') between '"+criterioClient.getString("fechaDesde")+"' and '"+criterioClient.getString("fechaHasta")+"'";
...
...
@@ -1199,60 +1247,40 @@ public class FichaMysqlDAO implements FichaDAO {
if(u.getCodigoProyectoDetalle()==5){
condicionPorUsuario=" ";
}else{
// condicionPorUsuario = " and estado_ficha.codigo_usuario in (" + u.getCodigoUsuario() + ", 0)";
condicionPorUsuario=" and ficha.codigo_ficha in (select ef.codigo_ficha from estado_ficha ef where ef.codigo_usuario = "+u.getCodigoUsuario()+" and ef.codigo_tipo_estado_ficha not in (13))";
}
Stringsql="SELECT "
+" TOP "+length+" ficha.codigo_ficha codigoficha, "