[ADD] consultas ficha

parent 022140d1
nbproject/private/
# Created by https://www.gitignore.io/api/java,node,linux,macos,maven,windows,eclipse,java-web,netbeans,webstorm+all,jetbrains+all
# Edit at https://www.gitignore.io/?templates=java,node,linux,macos,maven,windows,eclipse,java-web,netbeans,webstorm+all,jetbrains+all
### Eclipse ###
.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
.recommenders
# External tool builders
.externalToolBuilders/
# Locally stored "Eclipse launch configurations"
*.launch
# PyDev specific (Python IDE for Eclipse)
*.pydevproject
# CDT-specific (C/C++ Development Tooling)
.cproject
# CDT- autotools
.autotools
# Java annotation processor (APT)
.factorypath
# PDT-specific (PHP Development Tools)
.buildpath
# sbteclipse plugin
.target
# Tern plugin
.tern-project
# TeXlipse plugin
.texlipse
# STS (Spring Tool Suite)
.springBeans
# Code Recommenders
.recommenders/
# Annotation Processing
.apt_generated/
# Scala IDE specific (Scala & Java development for Eclipse)
.cache-main
.scala_dependencies
.worksheet
### Eclipse Patch ###
# Eclipse Core
.project
# JDT-specific (Eclipse Java Development Tools)
.classpath
# Annotation Processing
.apt_generated
.sts4-cache/
### Java ###
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
### Java-Web ###
## ignoring target file
target/
### JetBrains+all ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
### JetBrains+all Patch ###
# Ignores the whole .idea folder and all .iml files
# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360
.idea/
# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023
*.iml
modules.xml
.idea/misc.xml
*.ipr
### Linux ###
*~
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
# .nfs files are created when an open file is removed but is still being accessed
.nfs*
### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### Maven ###
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
.mvn/wrapper/maven-wrapper.jar
### NetBeans ###
**/nbproject/private/
build/ build/
nbbuild/ nbbuild/
dist/ dist/
nbdist/ nbdist/
.nb-gradle/ .nb-gradle/
\ No newline at end of file
### Node ###
# Logs
logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# TypeScript v1 declaration files
typings/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
# parcel-bundler cache (https://parceljs.org/)
.cache
# next.js build output
.next
# nuxt.js build output
.nuxt
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless
# FuseBox cache
.fusebox/
### WebStorm+all ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
# Generated files
# Sensitive or high-churn files
# Gradle
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# CMake
# Mongo Explorer plugin
# File-based project format
# IntelliJ
# mpeltonen/sbt-idea plugin
# JIRA plugin
# Cursive Clojure plugin
# Crashlytics plugin (for Android Studio and IntelliJ)
# Editor-based Rest Client
# Android studio 3.1+ serialized cache file
### WebStorm+all Patch ###
# Ignores the whole .idea folder and all .iml files
# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360
# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023
### Windows ###
# Windows thumbnail cache files
Thumbs.db
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# Windows shortcuts
*.lnk
# End of https://www.gitignore.io/api/java,node,linux,macos,maven,windows,eclipse,java-web,netbeans,webstorm+all,jetbrains+all
\ No newline at end of file
...@@ -2,9 +2,7 @@ ...@@ -2,9 +2,7 @@
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="f1229581-2498-4c33-b7b4-f715a5fbe428" name="Default Changelist" comment=""> <list default="true" id="f1229581-2498-4c33-b7b4-f715a5fbe428" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/src/java/trismegistoplanilla/mysqldao/FichaMysqlDAO.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/java/trismegistoplanilla/mysqldao/FichaMysqlDAO.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/java/trismegistoplanilla/mysqldao/MysqlDAOFactory.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/java/trismegistoplanilla/mysqldao/MysqlDAOFactory.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/java/trismegistoplanilla/mysqldao/PersonaMysqlDAO.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/java/trismegistoplanilla/mysqldao/PersonaMysqlDAO.java" afterDir="false" />
</list> </list>
<ignored path="$PROJECT_DIR$/.tmp/" /> <ignored path="$PROJECT_DIR$/.tmp/" />
<ignored path="$PROJECT_DIR$/temp/" /> <ignored path="$PROJECT_DIR$/temp/" />
...@@ -28,13 +26,27 @@ ...@@ -28,13 +26,27 @@
<session id="-1966417198"> <session id="-1966417198">
<usages-collector id="statistics.lifecycle.project"> <usages-collector id="statistics.lifecycle.project">
<counts> <counts>
<entry key="project.closed" value="1" /> <entry key="project.closed" value="2" />
<entry key="project.open.time.15" value="1" /> <entry key="project.open.time.15" value="1" />
<entry key="project.opened" value="1" /> <entry key="project.open.time.5" value="1" />
<entry key="project.opened" value="2" />
</counts>
</usages-collector>
<usages-collector id="statistics.file.extensions.open">
<counts>
<entry key="java" value="1" />
</counts>
</usages-collector>
<usages-collector id="statistics.file.types.open">
<counts>
<entry key="PLAIN_TEXT" value="1" />
</counts> </counts>
</usages-collector> </usages-collector>
</session> </session>
</component> </component>
<component name="FileEditorManager">
<leaf />
</component>
<component name="Git.Settings"> <component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" /> <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component> </component>
...@@ -95,11 +107,12 @@ ...@@ -95,11 +107,12 @@
<updated>1541626387552</updated> <updated>1541626387552</updated>
<workItem from="1541626388621" duration="785000" /> <workItem from="1541626388621" duration="785000" />
<workItem from="1541776350897" duration="159000" /> <workItem from="1541776350897" duration="159000" />
<workItem from="1541776578549" duration="539000" />
</task> </task>
<servers /> <servers />
</component> </component>
<component name="TimeTrackingManager"> <component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="944000" /> <option name="totallyTimeSpent" value="1483000" />
</component> </component>
<component name="ToolWindowManager"> <component name="ToolWindowManager">
<frame x="-8" y="-8" width="1936" height="1056" extended-state="6" /> <frame x="-8" y="-8" width="1936" height="1056" extended-state="6" />
...@@ -126,7 +139,40 @@ ...@@ -126,7 +139,40 @@
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">
<option name="version" value="1" /> <option name="version" value="1" />
</component> </component>
<component name="Vcs.Log.Tabs.Properties">
<option name="TAB_STATES">
<map>
<entry key="MAIN">
<value>
<State>
<option name="RECENTLY_FILTERED_USER_GROUPS">
<collection />
</option>
<option name="RECENTLY_FILTERED_BRANCH_GROUPS">
<collection />
</option>
<option name="COLUMN_ORDER">
<list>
<option value="0" />
<option value="1" />
<option value="2" />
<option value="3" />
</list>
</option>
</State>
</value>
</entry>
</map>
</option>
</component>
<component name="VcsContentAnnotationSettings"> <component name="VcsContentAnnotationSettings">
<option name="myLimit" value="2678400000" /> <option name="myLimit" value="2678400000" />
</component> </component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/src/java/trismegistoplanilla/mysqldao/FichaMysqlDAO.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-68431" />
</provider>
</entry>
</component>
</project> </project>
\ No newline at end of file
...@@ -45,7 +45,7 @@ public class CargaFamiliarMysqlDAO implements CargaFamiliarDAO { ...@@ -45,7 +45,7 @@ public class CargaFamiliarMysqlDAO implements CargaFamiliarDAO {
} catch (SQLException e) { } catch (SQLException e) {
e.printStackTrace(); e.printStackTrace();
response.setStatus(false); response.setStatus(false);
response.setMessage("Error: " + e.getMessage() + " \n Error Code: [" + e.getErrorCode() + "]"); response.setMessage("Error: " + e.getMessage() + " Error Code: [" + e.getErrorCode() + "]");
} finally { } finally {
try { try {
if (rs != null) { if (rs != null) {
...@@ -77,25 +77,29 @@ public class CargaFamiliarMysqlDAO implements CargaFamiliarDAO { ...@@ -77,25 +77,29 @@ public class CargaFamiliarMysqlDAO implements CargaFamiliarDAO {
Connection cnx = null; Connection cnx = null;
try { try {
cnx = MysqlDAOFactory.obtenerConexion(Variables.MYSQL_NUEVO_BD_NAME); cnx = MysqlDAOFactory.obtenerConexion(Variables.MYSQL_NUEVO_BD_NAME);
String sql String sql = "SELECT "
= "SELECT " + " cargafamiliar.apellido_paterno apellidoPaterno, "
+ "cargafamiliar.apellido_paterno apellidoPaterno , " + " cargafamiliar.apellido_materno apellidoMaterno, "
+ "cargafamiliar.apellido_materno apellidoMaterno , " + " cargafamiliar.nombre nombre, "
+ "cargafamiliar.nombre nombre, " + " parentesco.nombre parentesco, "
+ "parentesco.nombre parentesco, " + " cargafamiliar.fecha_nacimiento fechaNacimiento, "
+ "Format(cargafamiliar.fecha_nacimiento, 'dd/MM/yyyy') fechaNacimiento , " + " YEAR (CURDATE()) - YEAR ( "
+ "(cast(datediff(dd,cargafamiliar.fecha_nacimiento,getdate()) / 365.25 as int)) edad, " + " cargafamiliar.fecha_nacimiento "
+ "tipodocumento.descripcion_larga tipoDocumentoDescripcionLarga, " + " ) edad, "
+ "tipodocumento.descripcion_corta tipoDocumentoDescripcionCorta, " + " tipodocumento.descripcion_larga tipoDocumentoDescripcionLarga, "
+ "cargafamiliar.numero_documento numeroDocumento , " + " tipodocumento.descripcion_corta tipoDocumentoDescripcionCorta, "
+ "cargafamiliar.sexo sexo, " + " cargafamiliar.numero_documento numeroDocumento, "
+ "Isnull(cargafamiliar.telefono, '-') telefono " + " cargafamiliar.sexo sexo, "
+ "FROM carga_familiar cargafamiliar " + " Ifnull('-', cargafamiliar.telefono) telefono "
+ "FROM "
+ " carga_familiar cargafamiliar "
+ "INNER JOIN parentesco parentesco ON parentesco.codigo_parentesco = cargafamiliar.codigo_parentesco " + "INNER JOIN parentesco parentesco ON parentesco.codigo_parentesco = cargafamiliar.codigo_parentesco "
+ "INNER JOIN tipo_documento tipodocumento ON tipodocumento.codigo_tipo_documento = cargafamiliar.codigo_tipo_documento " + "INNER JOIN tipo_documento tipodocumento ON tipodocumento.codigo_tipo_documento = cargafamiliar.codigo_tipo_documento "
+ "WHERE cargafamiliar.codigo_persona = ?"; + "WHERE "
+ " cargafamiliar.codigo_persona = ?";
ps = cnx.prepareStatement(sql); ps = cnx.prepareStatement(sql);
ps.setInt(1, persona.getCodigoPersona()); ps.setInt(1, persona.getCodigoPersona());
rs = ps.executeQuery(); rs = ps.executeQuery();
while (rs.next()) { while (rs.next()) {
CargaFamiliarBean cargaFamiliar = new CargaFamiliarBean(); CargaFamiliarBean cargaFamiliar = new CargaFamiliarBean();
...@@ -124,7 +128,7 @@ public class CargaFamiliarMysqlDAO implements CargaFamiliarDAO { ...@@ -124,7 +128,7 @@ public class CargaFamiliarMysqlDAO implements CargaFamiliarDAO {
} catch (SQLException e) { } catch (SQLException e) {
e.printStackTrace(); e.printStackTrace();
response.setStatus(false); response.setStatus(false);
response.setMessage("Error: " + e.getMessage() + " \n Error Code: [" + e.getErrorCode() + "]"); response.setMessage("Error: " + e.getMessage() + " Error Code: [" + e.getErrorCode() + "]");
} finally { } finally {
try { try {
if (rs != null) { if (rs != null) {
......
...@@ -26,17 +26,28 @@ public class ExperienciaLaboralMysqlDAO implements ExperienciaLaboralDAO { ...@@ -26,17 +26,28 @@ public class ExperienciaLaboralMysqlDAO implements ExperienciaLaboralDAO {
try { try {
cnx = MysqlDAOFactory.obtenerConexion(Variables.MYSQL_NUEVO_BD_NAME); cnx = MysqlDAOFactory.obtenerConexion(Variables.MYSQL_NUEVO_BD_NAME);
String sql String sql = "SELECT "
= "SELECT " + " experiencialaboral.nombre_empresa nombreEmpresa, "
+ "experiencialaboral.nombre_empresa nombreEmpresa, " + " experiencialaboral.nombre_cargo nombreCargo, "
+ "experiencialaboral.nombre_cargo nombreCargo, " + " Format( "
+ "Format(experiencialaboral.fecha_inicio, 'dd/MM/yyyy') fechaInicio, " + " experiencialaboral.fecha_inicio, "
+ "Format(experiencialaboral.fecha_fin, 'dd/MM/yyyy') fechaFin, " + " 'dd/MM/yyyy' "
+ "Isnull(experiencialaboral.telefono, '-') telefono " + " ) fechaInicio, "
+ "FROM experiencia_laboral experiencialaboral " + " Format( "
+ "WHERE experiencialaboral.codigo_persona = ?"; + " experiencialaboral.fecha_fin, "
+ " 'dd/MM/yyyy' "
+ " ) fechaFin, "
+ " Ifnull( "
+ " '-', "
+ " experiencialaboral.telefono "
+ " ) telefono "
+ "FROM "
+ " experiencia_laboral experiencialaboral "
+ "WHERE "
+ " experiencialaboral.codigo_persona = ?";
ps = cnx.prepareStatement(sql); ps = cnx.prepareStatement(sql);
ps.setInt(1, persona.getCodigoPersona()); ps.setInt(1, persona.getCodigoPersona());
rs = ps.executeQuery(); rs = ps.executeQuery();
while (rs.next()) { while (rs.next()) {
ExperienciaLaboralBean experienciaLaboral = new ExperienciaLaboralBean(); ExperienciaLaboralBean experienciaLaboral = new ExperienciaLaboralBean();
...@@ -59,7 +70,7 @@ public class ExperienciaLaboralMysqlDAO implements ExperienciaLaboralDAO { ...@@ -59,7 +70,7 @@ public class ExperienciaLaboralMysqlDAO implements ExperienciaLaboralDAO {
} catch (SQLException e) { } catch (SQLException e) {
e.printStackTrace(); e.printStackTrace();
response.setStatus(false); response.setStatus(false);
response.setMessage("Error: " + e.getMessage() + " \n Error Code: [" + e.getErrorCode() + "]"); response.setMessage("Error: " + e.getMessage() + " Error Code: [" + e.getErrorCode() + "]");
} finally { } finally {
try { try {
if (rs != null) { if (rs != null) {
......
...@@ -1027,70 +1027,120 @@ public class FichaMysqlDAO implements FichaDAO { ...@@ -1027,70 +1027,120 @@ public class FichaMysqlDAO implements FichaDAO {
try { try {
cnx = MysqlDAOFactory.obtenerConexion(Variables.MYSQL_NUEVO_BD_NAME); cnx = MysqlDAOFactory.obtenerConexion(Variables.MYSQL_NUEVO_BD_NAME);
String sql
= "SELECT " String sql = "SELECT "
+ "ficha.codigo_ficha codigoFicha, " + " ficha.codigo_ficha codigoFicha, "
+ "persona.apellido_paterno apellidoPaterno, " + " personal.apellidoPaterno apellidoPaterno, "
+ "persona.apellido_materno apellidoMaterno, " + " personal.apellidoMaterno apellidoMaterno, "
+ "persona.nombre nombre, " + " personal.nombre nombre, "
+ "tipodocumento.descripcion_larga tipoDocumentoDescripcionLarga, " + " tipodocumento.descripcion_larga tipoDocumentoDescripcionLarga, "
+ "tipodocumento.descripcion_corta tipoDocumentoDescripcionCorta, " + " tipodocumento.descripcion_corta tipoDocumentoDescripcionCorta, "
+ "persona.numero_documento numeroDocumento, " + " personal.dni numeroDocumento, "
+ "CASE " + " CASE "
+ " WHEN persona.sexo = 'M' THEN 'MASCULINO' " + "WHEN personal.sexo = 'M' THEN "
+ " WHEN persona.sexo = 'F' THEN 'FEMENINO' " + " 'MASCULINO' "
+ " ELSE 'SIN SEXO' " + "WHEN personal.sexo = 'F' THEN "
+ " 'FEMENINO' "
+ "ELSE "
+ " 'SIN SEXO' "
+ "END sexo, " + "END sexo, "
+ "estadocivil.nombre estadoCivil, " + " estadocivil.nombre estadoCivil, "
+ "Format(persona.fecha_nacimiento, 'dd/MM/yyyy') fechaNacimiento, " + " Format( "
+ "(cast(datediff(dd,persona.fecha_nacimiento,getdate()) / 365.25 as int)) edad, " + " personal.fechanacimiento, "
+ "(select count(1) from carga_familiar where carga_familiar.codigo_parentesco = 3 and carga_familiar.codigo_persona = ficha.codigo_persona) nroHijos, " + " 'dd/MM/yyyy' "
+ "nacionalidad.pais pais, " + ") fechaNacimiento, "
+ "nacionalidad.gentilicio gentilicio, " + " YEAR (CURDATE()) - YEAR (personal.fechanacimiento) edad, "
+ "nacionalidad.iso iso, " + " ( "
+ "Isnull(ubigeonacimiento.nombre_departamento,'-') nombreDepartamentoNacimiento, " + " SELECT "
+ "Isnull(ubigeonacimiento.nombre_provincia,'-') nombreProvinciaNacimiento, " + " COUNT(1) "
+ "Isnull(ubigeonacimiento.nombre_distrito,'-') nombreDistritoNacimiento, " + " FROM "
+ "Isnull(persona.direccion_documento,'-') direccionDocumento, " + " carga_familiar "
+ "case when persona.telefono_fijo is null then '-' when persona.telefono_fijo = '' then '-' else persona.telefono_fijo end telefonoFijo," + " WHERE "
+ "case when persona.telefono_movil is null then '-' when persona.telefono_movil = '' then '-' else persona.telefono_movil end telefonoMovil," + " carga_familiar.codigo_parentesco = 3 "
+ "persona.correo correo, " + " AND carga_familiar.codigo_persona = ficha.codigo_persona "
+ "Isnull(cast(persona.ruc as varchar), '-') ruc, " + ") nroHijos, "
+ "Isnull(persona.foto, 'default.jpg') foto, " + " nacionalidad.pais pais, "
+ "ubigeoresidencia.nombre_departamento nombreDepartamentoResidencia, " + " nacionalidad.gentilicio gentilicio, "
+ "ubigeoresidencia.nombre_provincia nombreProvinciaResidencia, " + " nacionalidad.iso iso, "
+ "ubigeoresidencia.nombre_distrito nombreDistritoResidencia, " + " Ifnull( "
+ "persona.direccion_residencia direccionResidencia, " + " '-', "
+ "persona.latitud_residencia latitudResidencia, " + " ubigeonacimiento.nombre_departamento "
+ "persona.longitud_residencia longitudResidencia, " + ") nombreDepartamentoNacimiento, "
+ "CASE WHEN persona.fondo_pension_activo = 0 THEN 'INACTIVO' " + " Ifnull( "
+ " WHEN persona.fondo_pension_activo = 1 THEN 'ACTIVO' " + " '-', "
+ " ELSE 'ERROR' " + " ubigeonacimiento.nombre_provincia "
+ ") nombreProvinciaNacimiento, "
+ " Ifnull( "
+ " '-', "
+ " ubigeonacimiento.nombre_distrito "
+ ") nombreDistritoNacimiento, "
+ " Ifnull('-', personal.direccion) direccionDocumento, "
+ " CASE "
+ "WHEN personal.telefono IS NULL THEN "
+ " '-' "
+ "WHEN personal.telefono = '' THEN "
+ " '-' "
+ "ELSE "
+ " personal.telefono "
+ "END telefonoFijo, "
+ " CASE "
+ "WHEN personal.telefono_movil IS NULL THEN "
+ " '-' "
+ "WHEN personal.telefono_movil = '' THEN "
+ " '-' "
+ "ELSE "
+ " personal.telefono_movil "
+ "END telefonoMovil, "
+ " personal.email correo, "
+ " ifnull( "
+ " '-', "
+ " CAST(personal.ruc AS CHAR(11)) "
+ ") ruc, "
+ " ifnull( "
+ " 'default.jpg', "
+ " personal.foto "
+ ") foto, "
+ " ubigeoresidencia.nombre_departamento nombreDepartamentoResidencia, "
+ " ubigeoresidencia.nombre_provincia nombreProvinciaResidencia, "
+ " ubigeoresidencia.nombre_distrito nombreDistritoResidencia, "
+ " personal.direccion direccionResidencia, "
+ " personal.latitud_residencia latitudResidencia, "
+ " personal.longitud_residencia longitudResidencia, "
+ " CASE "
+ "WHEN personal.fondo_pension_activo = 0 THEN "
+ " 'INACTIVO' "
+ "WHEN personal.fondo_pension_activo = 1 THEN "
+ " 'ACTIVO' "
+ "ELSE "
+ " 'ERROR' "
+ "END fondoPensionActivo, " + "END fondoPensionActivo, "
+ "fondopension.descripcion_larga fondoPensionDescripcionLarga, " + " fondopension.descripcion_larga fondoPensionDescripcionLarga, "
+ "fondopension.descripcion_corta fondoPensionDescripcionCorta, " + " fondopension.descripcion_corta fondoPensionDescripcionCorta, "
+ "persona.enlace_alfresco enlaceAlfresco, " + " personal.enlace_alfresco enlaceAlfresco, "
+ "tipo_estado_ficha.nombre estadoFicha " + " tipo_estado_ficha.nombre estadoFicha "
+ "FROM ficha ficha " + "FROM "
+ "INNER JOIN persona persona ON ficha.codigo_persona = persona.codigo_persona " + " ficha ficha "
+ "INNER JOIN tipo_documento tipodocumento ON tipodocumento.codigo_tipo_documento = persona.codigo_tipo_documento " + "INNER JOIN personal personal ON ficha.codigo_persona = personal.codper "
+ "INNER JOIN estado_civil estadocivil ON estadocivil.codigo_estado_civil = persona.codigo_estado_civil " + "INNER JOIN tipo_documento tipodocumento ON tipodocumento.codigo_tipo_documento = personal.codigo_tipo_documento "
+ "INNER JOIN nacionalidad nacionalidad ON nacionalidad.codigo_nacionalidad = persona.codigo_nacionalidad " + "INNER JOIN estado_civil estadocivil ON estadocivil.codigo_estado_civil = personal.codigo_estado_civil "
+ "LEFT JOIN ubigeo ubigeonacimiento ON ubigeonacimiento.codigo_ubigeo = persona.codigo_ubigeo_nacimiento " + "INNER JOIN nacionalidad nacionalidad ON nacionalidad.codigo_nacionalidad = personal.codigo_nacionalidad "
+ "INNER JOIN ubigeo ubigeoresidencia ON ubigeoresidencia.codigo_ubigeo = persona.codigo_ubigeo_residencia " + "LEFT JOIN ubigeo ubigeonacimiento ON ubigeonacimiento.codigo_ubigeo = personal.codigo_ubigeo_nacimiento "
+ "INNER JOIN fondo_pension fondopension ON fondopension.codigo_fondo_pension = persona.codigo_fondo_pension " + "INNER JOIN ubigeo ubigeoresidencia ON ubigeoresidencia.codigo_ubigeo = personal.codigo_ubigeo_residencia "
+ "INNER JOIN estado_ficha on estado_ficha.codigo_ficha = ficha.codigo_ficha " + "INNER JOIN fondo_pension fondopension ON fondopension.codigo_fondo_pension = personal.codigo_fondo_pension "
+ "INNER JOIN tipo_estado_ficha on tipo_estado_ficha.codigo_tipo_estado_ficha = estado_ficha.codigo_tipo_estado_ficha " + "INNER JOIN estado_ficha ON estado_ficha.codigo_ficha = ficha.codigo_ficha "
+ "where ficha.estado_registro = 1 and estado_ficha.estado_registro = 1 and ficha.codigo_persona = ?"; + "INNER JOIN tipo_estado_ficha ON tipo_estado_ficha.codigo_tipo_estado_ficha = estado_ficha.codigo_tipo_estado_ficha "
+ "WHERE "
+ " ficha.estado_registro = 1 "
+ "AND estado_ficha.estado_registro = 1 "
+ "AND ficha.codigo_persona = ?";
ps = cnx.prepareStatement(sql); ps = cnx.prepareStatement(sql);
ps.setInt(1, persona.getCodigoPersona()); ps.setInt(1, persona.getCodigoPersona());
rs = ps.executeQuery(); rs = ps.executeQuery();
rs.next(); rs.next();
// if (rs.next()) {
ReporteBean reporte = new ReporteBean(); ReporteBean reporte = new ReporteBean();
reporte.setCodigoFicha(rs.getInt("codigoFicha")); reporte.setCodigoFicha(rs.getInt("codigoFicha"));
// reporte.setCodigoPersona(rs.getInt("codigoPersona"));
reporte.setApellidoPaterno(rs.getString("apellidoPaterno")); reporte.setApellidoPaterno(rs.getString("apellidoPaterno"));
reporte.setApellidoMaterno(rs.getString("apellidoMaterno")); reporte.setApellidoMaterno(rs.getString("apellidoMaterno"));
reporte.setNombre(rs.getString("nombre")); reporte.setNombre(rs.getString("nombre"));
...@@ -1125,10 +1175,7 @@ public class FichaMysqlDAO implements FichaDAO { ...@@ -1125,10 +1175,7 @@ public class FichaMysqlDAO implements FichaDAO {
reporte.setFondoPensionDescripcionCorta(rs.getString("fondoPensionDescripcionCorta")); reporte.setFondoPensionDescripcionCorta(rs.getString("fondoPensionDescripcionCorta"));
reporte.setEnlaceAlfresco(rs.getString("enlaceAlfresco")); reporte.setEnlaceAlfresco(rs.getString("enlaceAlfresco"));
reporte.setEstadoFicha(rs.getString("estadoFicha")); reporte.setEstadoFicha(rs.getString("estadoFicha"));
// JSONObject jsonReporte = new JSONObject(reporte);
// jsonArrayListarDatosFicha.put(jsonReporte);
jsonReporte = new JSONObject(reporte); jsonReporte = new JSONObject(reporte);
// }
JSONObject jsonObjListadoPersona = new JSONObject(); JSONObject jsonObjListadoPersona = new JSONObject();
jsonObjListadoPersona.put("persona", jsonReporte); jsonObjListadoPersona.put("persona", jsonReporte);
...@@ -1174,15 +1221,16 @@ public class FichaMysqlDAO implements FichaDAO { ...@@ -1174,15 +1221,16 @@ public class FichaMysqlDAO implements FichaDAO {
String condicionPorUsuario = ""; String condicionPorUsuario = "";
int cantidad = 0; int cantidad = 0;
int numeroFilas = start + 1; int numeroFilas = start + 1;
if (criterioClient.isNull("tipoBusqueda")) { if (criterioClient.isNull("tipoBusqueda")) {
filtroListarFichas = ""; filtroListarFichas = "";
} else { } else {
switch (criterioClient.getString("tipoBusqueda")) { switch (criterioClient.getString("tipoBusqueda")) {
case "TIPO_DOCUMENTO": 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; break;
case "APELLIDOS": case "APELLIDOS":
filtroListarFichas = "and persona.apellido_paterno like '" + criterioClient.getString("apellido") + "%'"; filtroListarFichas = "and persona.apellidoPaterno like '" + criterioClient.getString("apellido") + "%'";
break; break;
case "FECHA_REGISTRO": case "FECHA_REGISTRO":
filtroListarFichas = "and format(estado_ficha.fecha_registro, 'dd/MM/yyyy') between '" + criterioClient.getString("fechaDesde") + "' and '" + criterioClient.getString("fechaHasta") + "'"; 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 { ...@@ -1199,60 +1247,40 @@ public class FichaMysqlDAO implements FichaDAO {
if (u.getCodigoProyectoDetalle() == 5) { if (u.getCodigoProyectoDetalle() == 5) {
condicionPorUsuario = " "; condicionPorUsuario = " ";
} else { } 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))"; 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))";
} }
String sql = "SELECT " String sql = "SELECT "
+ " TOP " + length + " ficha.codigo_ficha codigoficha, " + " ficha.codigo_ficha codigoficha, "
+ " persona.codigo_persona codigopersona, " + " personal.codper codigopersona, "
+ " tipo_documento.codigo_tipo_documento codigotipodocumento, " + " tipo_documento.codigo_tipo_documento codigotipodocumento, "
+ " tipo_documento.descripcion_corta tipodocumentodescripcioncorta, " + " tipo_documento.descripcion_corta tipodocumentodescripcioncorta, "
+ " persona.numero_documento numerodocumento, " + " personal.dni numerodocumento, "
+ " persona.apellido_paterno apellidopaterno, " + " personal.apellidoPaterno apellidopaterno, "
+ " persona.apellido_materno apellidomaterno, " + " personal.apellidoMaterno apellidomaterno, "
+ " persona.nombre nombre, " + " personal.nombre nombre, "
+ " CASE " + " CASE "
+ "WHEN persona.apellido_paterno = '' " + "WHEN personal.apellidoPaterno = '' "
+ "AND persona.apellido_materno = '' " + "AND personal.apellidoMaterno = '' "
+ "AND persona.nombre = '' THEN " + "AND personal.nombre = '' THEN "
+ " '-' " + " '-' "
+ "WHEN persona.apellido_paterno IS NULL " + "WHEN personal.apellidoPaterno IS NULL "
+ "OR persona.apellido_materno IS NULL " + "OR personal.apellidoMaterno IS NULL "
+ "OR persona.nombre IS NULL THEN " + "OR personal.nombre IS NULL THEN "
+ " '-' " + " '-' "
+ "ELSE " + "ELSE "
+ " persona.apellido_paterno + ' ' + persona.apellido_materno + ', ' + persona.nombre " + " personal.apellidoPaterno + ' ' + personal.apellidoMaterno + ', ' + personal.nombre "
+ "END personal, " + "END personal, "
+ " persona.correo correo, " + " personal.email correo, "
+ " isnull(cargo.nombre, '-') cargo, " + " ifnull(cargo.nombre, '-') cargo, "
+ " format ( " + " estado_ficha.fecha_registro fecharegistroficha, "
+ " estado_ficha.fecha_registro, "
+ " 'dd/MM/yyyy' "
+ ") + ' ' + stuff( "
+ " replace( "
+ " RIGHT ( "
+ " CONVERT ( "
+ " VARCHAR (19), "
+ " estado_ficha.fecha_registro, "
+ " 0 "
+ " ), "
+ " 7 "
+ " ), "
+ " ' ', "
+ " '0' "
+ " ), "
+ " 6, "
+ " 0, "
+ " ' ' "
+ ") fecharegistroficha, "
+ " tipo_estado_ficha.codigo_tipo_estado_ficha codigoTipoEstadoFicha, " + " tipo_estado_ficha.codigo_tipo_estado_ficha codigoTipoEstadoFicha, "
+ " tipo_estado_ficha.nombre estadoficha, " + " tipo_estado_ficha.nombre estadoficha, "
+ " '<span class=\"' + tipo_estado_ficha.estilo + '\">' + tipo_estado_ficha.nombre + '</span>' estilo " + " '<span class=\"' + tipo_estado_ficha.estilo + '\">' + tipo_estado_ficha.nombre + '</span>' estilo "
+ "FROM " + "FROM "
+ " ficha " + " ficha "
+ "INNER JOIN persona ON persona.codigo_persona = ficha.codigo_persona " + "INNER JOIN personal ON personal.codper = ficha.codigo_persona "
+ "INNER JOIN tipo_documento ON tipo_documento.codigo_tipo_documento = persona.codigo_tipo_documento " + "INNER JOIN tipo_documento ON tipo_documento.codigo_tipo_documento = personal.codigo_tipo_documento "
+ "INNER JOIN estado_ficha ON estado_ficha.codigo_ficha = ficha.codigo_ficha " + "INNER JOIN estado_ficha ON estado_ficha.codigo_ficha = ficha.codigo_ficha "
+ "INNER JOIN tipo_estado_ficha ON tipo_estado_ficha.codigo_tipo_estado_ficha = estado_ficha.codigo_tipo_estado_ficha " + "INNER JOIN tipo_estado_ficha ON tipo_estado_ficha.codigo_tipo_estado_ficha = estado_ficha.codigo_tipo_estado_ficha "
+ "LEFT JOIN ficha_laboral ON ficha_laboral.codigo_ficha = ficha.codigo_ficha " + "LEFT JOIN ficha_laboral ON ficha_laboral.codigo_ficha = ficha.codigo_ficha "
...@@ -1263,20 +1291,26 @@ public class FichaMysqlDAO implements FichaDAO { ...@@ -1263,20 +1291,26 @@ public class FichaMysqlDAO implements FichaDAO {
+ "AND ficha.estado_registro IN (0, 1) " + "AND ficha.estado_registro IN (0, 1) "
+ "AND ficha.codigo_ficha NOT IN ( " + "AND ficha.codigo_ficha NOT IN ( "
+ " SELECT " + " SELECT "
+ " TOP " + start + " f.codigo_ficha " + " * "
+ " FROM " + " FROM "
+ " ficha f " + " ( "
+ " INNER JOIN estado_ficha ef ON ef.codigo_ficha = f.codigo_ficha " + " SELECT "
+ " WHERE " + " f.codigo_ficha "
+ " ef.estado_registro = 1 " + " FROM "
+ " AND f.estado_registro IN (0, 1) " + " ficha f "
+ " ORDER BY " + " INNER JOIN estado_ficha ef ON ef.codigo_ficha = f.codigo_ficha "
+ " ef.fecha_registro DESC " + " WHERE "
+ " ef.estado_registro = 1 "
+ " AND f.estado_registro IN (0, 1) "
+ " ORDER BY "
+ " ef.fecha_registro DESC "
+ " LIMIT " + start + " "
+ " ) temp_tab "
+ ") " + ") "
+ " " + filtroListarFichas + condicionPorUsuario
+ "ORDER BY " + "ORDER BY "
+ " estado_ficha.fecha_registro DESC"; + " estado_ficha.fecha_registro DESC "
+ "LIMIT " + length + " ";
System.out.println(sql);
try { try {
conexion = MysqlDAOFactory.obtenerConexion(Variables.MYSQL_NUEVO_BD_NAME); conexion = MysqlDAOFactory.obtenerConexion(Variables.MYSQL_NUEVO_BD_NAME);
...@@ -1304,18 +1338,20 @@ public class FichaMysqlDAO implements FichaDAO { ...@@ -1304,18 +1338,20 @@ public class FichaMysqlDAO implements FichaDAO {
JAlistarFichas.put(objListadoFicha); JAlistarFichas.put(objListadoFicha);
} }
sql = "" sql = "SELECT "
+ "select " + " count(1) cantidad "
+ "count(1) cantidad " + "FROM "
+ "from ficha " + " ficha "
+ "inner join persona ON persona.codigo_persona = ficha.codigo_persona " + "INNER JOIN personal ON personal.codper = ficha.codigo_persona "
+ "inner join tipo_documento ON tipo_documento.codigo_tipo_documento = persona.codigo_tipo_documento " + "INNER JOIN tipo_documento ON tipo_documento.codigo_tipo_documento = personal.codigo_tipo_documento "
+ "inner join estado_ficha ON estado_ficha.codigo_ficha = ficha.codigo_ficha " + "INNER JOIN estado_ficha ON estado_ficha.codigo_ficha = ficha.codigo_ficha "
+ "inner join tipo_estado_ficha ON tipo_estado_ficha.codigo_tipo_estado_ficha = estado_ficha.codigo_tipo_estado_ficha " + "INNER JOIN tipo_estado_ficha ON tipo_estado_ficha.codigo_tipo_estado_ficha = estado_ficha.codigo_tipo_estado_ficha "
+ "left join ficha_laboral ON ficha_laboral.codigo_ficha = ficha.codigo_ficha " + "LEFT JOIN ficha_laboral ON ficha_laboral.codigo_ficha = ficha.codigo_ficha "
+ "left join area_cargo ON area_cargo.codigo_area_cargo = ficha_laboral.codigo_area_cargo " + "LEFT JOIN area_cargo ON area_cargo.codigo_area_cargo = ficha_laboral.codigo_area_cargo "
+ "left join cargo ON cargo.codigo_cargo = area_cargo.codigo_cargo " + "LEFT JOIN cargo ON cargo.codigo_cargo = area_cargo.codigo_cargo "
+ "where estado_ficha.estado_registro = 1 and ficha.estado_registro in (0,1) " + filtroListarFichas + condicionPorUsuario; + "WHERE "
+ " estado_ficha.estado_registro = 1 "
+ "AND ficha.estado_registro IN (0, 1) " + filtroListarFichas + condicionPorUsuario;
psCount = conexion.prepareStatement(sql); psCount = conexion.prepareStatement(sql);
rsCount = psCount.executeQuery(); rsCount = psCount.executeQuery();
...@@ -1362,23 +1398,27 @@ public class FichaMysqlDAO implements FichaDAO { ...@@ -1362,23 +1398,27 @@ public class FichaMysqlDAO implements FichaDAO {
JSONArray JAlistarDetalleEstadoFicha = new JSONArray(); JSONArray JAlistarDetalleEstadoFicha = new JSONArray();
ResponseHelper response = new ResponseHelper(); ResponseHelper response = new ResponseHelper();
String sql = "" String sql = "SELECT "
+ "select " + " tipo_estado_ficha.nombre nombreEstado, "
+ "tipo_estado_ficha.nombre nombreEstado, " + " tipo_estado_ficha.descripcion descripcionEstado, "
+ "tipo_estado_ficha.descripcion descripcionEstado, " + " estado_ficha.fecha_registro fechaRegistroEstado, "
+ "format(estado_ficha.fecha_registro, 'dd/MM/yyyy') + ' ' + STUFF(REPLACE(RIGHT(CONVERT(varchar(19), estado_ficha.fecha_registro, 0), 7), ' ', '0'), 6, 0, ' ') fechaRegistroEstado, " + " estado_ficha.codigo_usuario codigoUsuario, "
+ "estado_ficha.codigo_usuario codigoUsuario, " + " CASE "
+ "case " + "WHEN estado_ficha.codigo_usuario = 0 THEN "
+ "when estado_ficha.codigo_usuario = 0 then persona.apellido_paterno + ' ' + persona.apellido_materno + ' ' + persona.nombre " + " personal.apellidoPaterno + ' ' + personal.apellidoMaterno + ' ' + personal.nombre "
+ "else trabajador_responsable.apellido_paterno + ' ' + trabajador_responsable.apellido_materno + ' ' +trabajador_responsable.nombre " + "ELSE "
+ "end nombreUsuario " + " trabajador_responsable.apellido_paterno + ' ' + trabajador_responsable.apellido_materno + ' ' + trabajador_responsable.nombre "
+ "from ficha " + "END nombreUsuario "
+ "inner join persona ON persona.codigo_persona = ficha.codigo_persona " + "FROM "
+ "inner join estado_ficha ON estado_ficha.codigo_ficha = ficha.codigo_ficha " + " ficha "
+ "inner join tipo_estado_ficha ON tipo_estado_ficha.codigo_tipo_estado_ficha = estado_ficha.codigo_tipo_estado_ficha " + "INNER JOIN personal ON personal.codper = ficha.codigo_persona "
+ "left join trabajador_responsable on trabajador_responsable.codigo_usuario = estado_ficha.codigo_usuario " + "INNER JOIN estado_ficha ON estado_ficha.codigo_ficha = ficha.codigo_ficha "
+ "where ficha.codigo_ficha = ? " + "INNER JOIN tipo_estado_ficha ON tipo_estado_ficha.codigo_tipo_estado_ficha = estado_ficha.codigo_tipo_estado_ficha "
+ "order by estado_ficha.fecha_registro"; + "LEFT JOIN trabajador_responsable ON trabajador_responsable.codigo_usuario = estado_ficha.codigo_usuario "
+ "WHERE "
+ " ficha.codigo_ficha = ? "
+ "ORDER BY "
+ " estado_ficha.fecha_registro";
Connection conexion = null; Connection conexion = null;
PreparedStatement ps = null; PreparedStatement ps = null;
...@@ -1387,6 +1427,7 @@ public class FichaMysqlDAO implements FichaDAO { ...@@ -1387,6 +1427,7 @@ public class FichaMysqlDAO implements FichaDAO {
conexion = MysqlDAOFactory.obtenerConexion(Variables.MYSQL_NUEVO_BD_NAME); conexion = MysqlDAOFactory.obtenerConexion(Variables.MYSQL_NUEVO_BD_NAME);
ps = conexion.prepareStatement(sql); ps = conexion.prepareStatement(sql);
ps.setInt(1, f.getCodigoFicha()); ps.setInt(1, f.getCodigoFicha());
rs = ps.executeQuery(); rs = ps.executeQuery();
while (rs.next()) { while (rs.next()) {
DetalleEstadoFichaBean def = new DetalleEstadoFichaBean(); DetalleEstadoFichaBean def = new DetalleEstadoFichaBean();
...@@ -1398,6 +1439,7 @@ public class FichaMysqlDAO implements FichaDAO { ...@@ -1398,6 +1439,7 @@ public class FichaMysqlDAO implements FichaDAO {
JSONObject objDetalleEstadoFicha = new JSONObject(def); JSONObject objDetalleEstadoFicha = new JSONObject(def);
JAlistarDetalleEstadoFicha.put(objDetalleEstadoFicha); JAlistarDetalleEstadoFicha.put(objDetalleEstadoFicha);
} }
JSONObject objDetalleEstadoFicha = new JSONObject(); JSONObject objDetalleEstadoFicha = new JSONObject();
objDetalleEstadoFicha.put("detallesEstadoFicha", JAlistarDetalleEstadoFicha); objDetalleEstadoFicha.put("detallesEstadoFicha", JAlistarDetalleEstadoFicha);
response.setStatus(true); response.setStatus(true);
...@@ -1434,54 +1476,114 @@ public class FichaMysqlDAO implements FichaDAO { ...@@ -1434,54 +1476,114 @@ public class FichaMysqlDAO implements FichaDAO {
JSONArray JAlistarDatosAdministrativos = new JSONArray(); JSONArray JAlistarDatosAdministrativos = new JSONArray();
ResponseHelper response = new ResponseHelper(); ResponseHelper response = new ResponseHelper();
String sql = "" // String sql = ""
+ "select " // + "select "
+ "ficha_laboral.codigo_ficha codigoFicha, " // + "ficha_laboral.codigo_ficha codigoFicha, "
+ "format(ficha_laboral.fecha_ingreso,'dd/MM/yyyy') fechaIngreso, " // + "format(ficha_laboral.fecha_ingreso,'dd/MM/yyyy') fechaIngreso, "
+ "format(ficha_laboral.fecha_fin,'dd/MM/yyyy') fechaTermino, " // + "format(ficha_laboral.fecha_fin,'dd/MM/yyyy') fechaTermino, "
+ "sede.nombre sede, " // + "sede.nombre sede, "
+ "area.nombre area, " // + "area.nombre area, "
+ "cargo.nombre cargo, " // + "cargo.nombre cargo, "
+ "case " // + "case "
+ "when ficha_laboral.tipo_ficha = 'A' then " // + "when ficha_laboral.tipo_ficha = 'A' then "
+ "(" // + "("
+ "select codigo_area_cargo_tipo_pago " // + "select codigo_area_cargo_tipo_pago "
+ "from sueldo_administrativo " // + "from sueldo_administrativo "
+ "where estado_registro = 1 " // + "where estado_registro = 1 "
+ "and codigo_ficha = " + f.getCodigoFicha() + " " // + "and codigo_ficha = " + f.getCodigoFicha() + " "
+ ") " // + ") "
+ "when ficha_laboral.tipo_ficha = 'D' then " // + "when ficha_laboral.tipo_ficha = 'D' then "
+ "( " // + "( "
+ "select codigo_area_cargo_tipo_pago " // + "select codigo_area_cargo_tipo_pago "
+ "from sueldo_docente " // + "from sueldo_docente "
+ "where estado_registro = 1 " // + "where estado_registro = 1 "
+ "and codigo_ficha = " + f.getCodigoFicha() + " " // + "and codigo_ficha = " + f.getCodigoFicha() + " "
// + ") "
// + "end codigoAreaCargoTipoPago, "
// + "case "
// + " when ficha_laboral.tipo_ficha = 'A' then "
// + " ( "
// + " select tipo_pago.nombre from tipo_pago "
// + " inner join area_cargo_tipo_pago ON area_cargo_tipo_pago.codigo_tipo_pago = tipo_pago.codigo_tipo_pago "
// + " inner join sueldo_administrativo ON sueldo_administrativo.codigo_area_cargo_tipo_pago = area_cargo_tipo_pago.codigo_area_cargo_tipo_pago "
// + " where sueldo_administrativo.codigo_ficha = ficha_laboral.codigo_ficha and sueldo_administrativo.estado_registro = 1 "
// + " ) "
// + " when ficha_laboral.tipo_ficha = 'D' then "
// + " ( "
// + " select tipo_pago.nombre from tipo_pago "
// + " inner join area_cargo_tipo_pago ON area_cargo_tipo_pago.codigo_tipo_pago = tipo_pago.codigo_tipo_pago "
// + " inner join sueldo_docente ON sueldo_docente.codigo_area_cargo_tipo_pago = area_cargo_tipo_pago.codigo_area_cargo_tipo_pago "
// + " where sueldo_docente.codigo_ficha = ficha_laboral.codigo_ficha and sueldo_docente.estado_registro = 1 "
// + " ) "
// + "end tipoPago, "
// + "case when ficha_laboral.tipo_ficha = 'A' then 'ADMINISTRATIVO' else 'DOCENTE' end tipoFicha "
// + "from ficha_laboral "
// + "inner join sede_area ON sede_area.codigo_sede_area = ficha_laboral.codigo_sede_area "
// + "inner join sede ON sede.codigo_sede = sede_area.codigo_sede "
// + "inner join area_cargo ON area_cargo.codigo_area_cargo = ficha_laboral.codigo_area_cargo "
// + "inner join area ON area.codigo_area = area_cargo.codigo_area "
// + "inner join cargo ON cargo.codigo_cargo = area_cargo.codigo_cargo "
// + "where ficha_laboral.codigo_ficha = ?";
String sql = "SELECT "
+ " ficha.codigo_ficha codigoficha, "
+ " personal.codper codigopersona, "
+ " tipo_documento.codigo_tipo_documento codigotipodocumento, "
+ " tipo_documento.descripcion_corta tipodocumentodescripcioncorta, "
+ " personal.dni numerodocumento, "
+ " personal.apellidoPaterno apellidopaterno, "
+ " personal.apellidoMaterno apellidomaterno, "
+ " personal.nombre nombre, "
+ " CASE "
+ "WHEN personal.apellidoPaterno = '' "
+ "AND personal.apellidoMaterno = '' "
+ "AND personal.nombre = '' THEN "
+ " '-' "
+ "WHEN personal.apellidoPaterno IS NULL "
+ "OR personal.apellidoMaterno IS NULL "
+ "OR personal.nombre IS NULL THEN "
+ " '-' "
+ "ELSE "
+ " personal.apellidoPaterno + ' ' + personal.apellidoMaterno + ', ' + personal.nombre "
+ "END personal, "
+ " personal.email correo, "
+ " ifnull(cargo.nombre, '-') cargo, "
+ " estado_ficha.fecha_registro fecharegistroficha, "
+ " tipo_estado_ficha.codigo_tipo_estado_ficha codigoTipoEstadoFicha, "
+ " tipo_estado_ficha.nombre estadoficha, "
+ " '<span class=\"' + tipo_estado_ficha.estilo + '\">' + tipo_estado_ficha.nombre + '</span>' estilo "
+ "FROM "
+ " ficha "
+ "INNER JOIN personal ON personal.codper = ficha.codigo_persona "
+ "INNER JOIN tipo_documento ON tipo_documento.codigo_tipo_documento = personal.codigo_tipo_documento "
+ "INNER JOIN estado_ficha ON estado_ficha.codigo_ficha = ficha.codigo_ficha "
+ "INNER JOIN tipo_estado_ficha ON tipo_estado_ficha.codigo_tipo_estado_ficha = estado_ficha.codigo_tipo_estado_ficha "
+ "LEFT JOIN ficha_laboral ON ficha_laboral.codigo_ficha = ficha.codigo_ficha "
+ "LEFT JOIN area_cargo ON area_cargo.codigo_area_cargo = ficha_laboral.codigo_area_cargo "
+ "LEFT JOIN cargo ON cargo.codigo_cargo = area_cargo.codigo_cargo "
+ "WHERE "
+ " estado_ficha.estado_registro = 1 "
+ "AND ficha.estado_registro IN (0, 1) "
+ "AND ficha.codigo_ficha NOT IN ( "
+ " SELECT "
+ " * "
+ " FROM "
+ " ( "
+ " SELECT "
+ " f.codigo_ficha "
+ " FROM "
+ " ficha f "
+ " INNER JOIN estado_ficha ef ON ef.codigo_ficha = f.codigo_ficha "
+ " WHERE "
+ " ef.estado_registro = 1 "
+ " AND f.estado_registro IN (0, 1) "
+ " ORDER BY "
+ " ef.fecha_registro DESC "
+ " LIMIT 0 "
+ " ) temp_tab "
+ ") " + ") "
+ "end codigoAreaCargoTipoPago, " + "ORDER BY "
+ "case " + " estado_ficha.fecha_registro DESC "
+ " when ficha_laboral.tipo_ficha = 'A' then " + "LIMIT 20";
+ " ( "
+ " select tipo_pago.nombre from tipo_pago "
+ " inner join area_cargo_tipo_pago ON area_cargo_tipo_pago.codigo_tipo_pago = tipo_pago.codigo_tipo_pago "
+ " inner join sueldo_administrativo ON sueldo_administrativo.codigo_area_cargo_tipo_pago = area_cargo_tipo_pago.codigo_area_cargo_tipo_pago "
+ " where sueldo_administrativo.codigo_ficha = ficha_laboral.codigo_ficha and sueldo_administrativo.estado_registro = 1 "
+ " ) "
+ " when ficha_laboral.tipo_ficha = 'D' then "
+ " ( "
+ " select tipo_pago.nombre from tipo_pago "
+ " inner join area_cargo_tipo_pago ON area_cargo_tipo_pago.codigo_tipo_pago = tipo_pago.codigo_tipo_pago "
+ " inner join sueldo_docente ON sueldo_docente.codigo_area_cargo_tipo_pago = area_cargo_tipo_pago.codigo_area_cargo_tipo_pago "
+ " where sueldo_docente.codigo_ficha = ficha_laboral.codigo_ficha and sueldo_docente.estado_registro = 1 "
+ " ) "
+ "end tipoPago, "
+ "case when ficha_laboral.tipo_ficha = 'A' then 'ADMINISTRATIVO' else 'DOCENTE' end tipoFicha "
+ "from ficha_laboral "
+ "inner join sede_area ON sede_area.codigo_sede_area = ficha_laboral.codigo_sede_area "
+ "inner join sede ON sede.codigo_sede = sede_area.codigo_sede "
+ "inner join area_cargo ON area_cargo.codigo_area_cargo = ficha_laboral.codigo_area_cargo "
+ "inner join area ON area.codigo_area = area_cargo.codigo_area "
+ "inner join cargo ON cargo.codigo_cargo = area_cargo.codigo_cargo "
+ "where ficha_laboral.codigo_ficha = ?";
Connection conexion = null; Connection conexion = null;
PreparedStatement ps = null, psCostos = null; PreparedStatement ps = null, psCostos = null;
......
...@@ -26,26 +26,46 @@ public class FormacionAcademicaMysqlDAO implements FormacionAcademicaDAO { ...@@ -26,26 +26,46 @@ public class FormacionAcademicaMysqlDAO implements FormacionAcademicaDAO {
try { try {
cnx = MysqlDAOFactory.obtenerConexion(Variables.MYSQL_NUEVO_BD_NAME); cnx = MysqlDAOFactory.obtenerConexion(Variables.MYSQL_NUEVO_BD_NAME);
String sql String sql = "SELECT "
= "SELECT " + " formacionacademica.nombre_centro_estudio centroEstudios, "
+ "formacionacademica.nombre_centro_estudio centroEstudios, " + " nivelestudio.nombre nivelEstudio, "
+ "nivelestudio.nombre nivelEstudio, " + " estadoestudio.nombre estadoEstudio, "
+ "estadoestudio.nombre estadoEstudio, " + " formacionacademica.fecha_inicio fechaInicio, "
+ "Format(formacionacademica.fecha_inicio, 'dd/MM/yyyy') fechaInicio, " + " ifnull( "
+ "isnull(Format(formacionacademica.fecha_fin, 'dd/MM/yyyy'),'-') fechaFin, " + " '-', "
+ "Isnull(formacionacademica.documento_adjunto, 'NO TIENE DOCUMENTO ADJUNTO') documentoAdjunto," + " Format( "
+ "IsNull(formacionacademica.carrera_profesional,'-') carreraProfesional, " + " formacionacademica.fecha_fin, "
+ "formacionacademica.sector_institucion sectorInstitucion, " + " 'dd/MM/yyyy' "
+ "Isnull(formacionacademica.numero_colegiatura, '-') numeroColegiatura, " + " ) "
+ "Isnull(formacionacademica.observacion, '-') observacion " + " ) fechaFin, "
+ "FROM formacion_academica formacionacademica " + " Ifnull( "
+ " 'NO TIENE DOCUMENTO ADJUNTO', "
+ " formacionacademica.documento_adjunto "
+ " ) documentoAdjunto, "
+ " IfNull( "
+ " '-', "
+ " formacionacademica.carrera_profesional "
+ " ) carreraProfesional, "
+ " formacionacademica.sector_institucion sectorInstitucion, "
+ " Ifnull( "
+ " '-', "
+ " formacionacademica.numero_colegiatura "
+ " ) numeroColegiatura, "
+ " Ifnull( "
+ " '-', "
+ " formacionacademica.observacion "
+ " ) observacion "
+ "FROM "
+ " formacion_academica formacionacademica "
+ "INNER JOIN nivel_estado nivelestado ON nivelestado.codigo_nivel_estado = formacionacademica.codigo_nivel_estado " + "INNER JOIN nivel_estado nivelestado ON nivelestado.codigo_nivel_estado = formacionacademica.codigo_nivel_estado "
+ "INNER JOIN estado_estudio estadoestudio ON estadoestudio.codigo_estado_estudio = nivelestado.codigo_estado_estudio " + "INNER JOIN estado_estudio estadoestudio ON estadoestudio.codigo_estado_estudio = nivelestado.codigo_estado_estudio "
+ "INNER JOIN nivel_estudio nivelestudio ON nivelestudio.codigo_nivel_estudio = nivelestado.codigo_nivel_estudio " + "INNER JOIN nivel_estudio nivelestudio ON nivelestudio.codigo_nivel_estudio = nivelestado.codigo_nivel_estudio "
+ "where formacionacademica.codigo_persona = ?"; + "WHERE "
+ " formacionacademica.codigo_persona = ?";
ps = cnx.prepareStatement(sql); ps = cnx.prepareStatement(sql);
ps.setInt(1, persona.getCodigoPersona()); ps.setInt(1, persona.getCodigoPersona());
rs = ps.executeQuery(); rs = ps.executeQuery();
while (rs.next()) { while (rs.next()) {
FormacionAcademicaBean formacionAcademica = new FormacionAcademicaBean(); FormacionAcademicaBean formacionAcademica = new FormacionAcademicaBean();
...@@ -73,7 +93,7 @@ public class FormacionAcademicaMysqlDAO implements FormacionAcademicaDAO { ...@@ -73,7 +93,7 @@ public class FormacionAcademicaMysqlDAO implements FormacionAcademicaDAO {
} catch (SQLException e) { } catch (SQLException e) {
e.printStackTrace(); e.printStackTrace();
response.setStatus(false); response.setStatus(false);
response.setMessage("Error: " + e.getMessage() + " \n Error Code: [" + e.getErrorCode() + "]"); response.setMessage("Error: " + e.getMessage() + " Error Code: [" + e.getErrorCode() + "]");
} finally { } finally {
try { try {
if (rs != null) { if (rs != null) {
......
...@@ -31,195 +31,195 @@ import trismegistoplanilla.utilities.DateTimeServer; ...@@ -31,195 +31,195 @@ import trismegistoplanilla.utilities.DateTimeServer;
public class DetalleLoteFichaAdministrativaServlet extends HttpServlet { public class DetalleLoteFichaAdministrativaServlet extends HttpServlet {
private static final long serialVersionUID = 7658135208116415341L; private static final long serialVersionUID = 7658135208116415341L;
@Override @Override
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String accion = request.getParameter("accion"); String accion = request.getParameter("accion");
if (accion.equals("imprimirLote")) { if (accion.equals("imprimirLote")) {
imprimirLote(request, response); imprimirLote(request, response);
} }
} }
private void imprimirLote(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { private void imprimirLote(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// PrintWriter out = response.getWriter(); // PrintWriter out = response.getWriter();
String numeroLote = request.getParameter("numeroLote"); String numeroLote = request.getParameter("numeroLote");
int numeroFilas = Integer.parseInt(request.getParameter("numeroFilas")); int numeroFilas = Integer.parseInt(request.getParameter("numeroFilas"));
String json = request.getParameter("data"); String json = request.getParameter("data");
JSONArray JAResponse = new JSONArray(json); JSONArray JAResponse = new JSONArray(json);
// out.println(numeroLote); // out.println(numeroLote);
// out.println(numeroFilas); // out.println(numeroFilas);
// out.println(json); // out.println(json);
createPDF(request, response, numeroLote, JAResponse); createPDF(request, response, numeroLote, JAResponse);
} }
private void createPDF(HttpServletRequest request, HttpServletResponse response, String numeroLote, JSONArray JAResponse) throws ServletException, IOException { private void createPDF(HttpServletRequest request, HttpServletResponse response, String numeroLote, JSONArray JAResponse) throws ServletException, IOException {
String fileName = "loteAdministrativo" + numeroLote + ".pdf"; String fileName = "loteAdministrativo" + numeroLote + ".pdf";
response.setContentType("application/pdf"); response.setContentType("application/pdf");
response.setHeader("Expires", "0"); response.setHeader("Expires", "0");
response.setHeader("Cache-Control", "must-revalidate, post-check=0, pre-check=0"); response.setHeader("Cache-Control", "must-revalidate, post-check=0, pre-check=0");
response.setHeader("Content-Disposition", "inline; filename=" + fileName); response.setHeader("Content-Disposition", "inline; filename=" + fileName);
response.setHeader("Accept-Ranges", "bytes"); response.setHeader("Accept-Ranges", "bytes");
try { try {
Document documento = new Document(PageSize.A4.rotate(), 5, 5, 5, 5); Document documento = new Document(PageSize.A4.rotate(), 5, 5, 5, 5);
PdfWriter writer = PdfWriter.getInstance(documento, response.getOutputStream()); PdfWriter writer = PdfWriter.getInstance(documento, response.getOutputStream());
MyFooter event = new MyFooter(); MyFooter event = new MyFooter();
writer.setPageEvent(event); writer.setPageEvent(event);
documento.open(); documento.open();
// logo saco oliveros y sistema helicoidal // logo saco oliveros y sistema helicoidal
Image logoSOSH = Image.getInstance("C:\\_AppServ\\www\\img\\so_sh.png"); Image logoSOSH = Image.getInstance("C:\\AppServ\\www\\img\\so_sh.png");
logoSOSH.scaleToFit(200, 200); logoSOSH.scaleToFit(200, 200);
logoSOSH.setAlignment(Chunk.ALIGN_LEFT); logoSOSH.setAlignment(Chunk.ALIGN_LEFT);
Image logoAPE = Image.getInstance("C:\\_AppServ\\www\\img\\ap.png"); Image logoAPE = Image.getInstance("C:\\AppServ\\www\\img\\ap.png");
logoAPE.scaleToFit(200, 200); logoAPE.scaleToFit(200, 200);
logoAPE.setAlignment(Chunk.ALIGN_RIGHT); logoAPE.setAlignment(Chunk.ALIGN_RIGHT);
// tabla logo // tabla logo
PdfPTable tablaLogo = new PdfPTable(2); PdfPTable tablaLogo = new PdfPTable(2);
tablaLogo.setWidthPercentage(100); tablaLogo.setWidthPercentage(100);
PdfPCell celda1 = new PdfPCell(); PdfPCell celda1 = new PdfPCell();
PdfPCell celda2 = new PdfPCell(); PdfPCell celda2 = new PdfPCell();
celda1.setBorder(Rectangle.NO_BORDER); celda1.setBorder(Rectangle.NO_BORDER);
celda2.setBorder(Rectangle.NO_BORDER); celda2.setBorder(Rectangle.NO_BORDER);
celda1.addElement(logoSOSH); celda1.addElement(logoSOSH);
celda2.addElement(logoAPE); celda2.addElement(logoAPE);
tablaLogo.addCell(celda1); tablaLogo.addCell(celda1);
tablaLogo.addCell(celda2); tablaLogo.addCell(celda2);
documento.add(tablaLogo); documento.add(tablaLogo);
// titulo principal // titulo principal
Paragraph titulo = new Paragraph("HABER ADMINISTRATIVO", Paragraph titulo = new Paragraph("HABER ADMINISTRATIVO",
FontFactory.getFont("arial", 22, Font.UNDERLINE, BaseColor.BLACK)); FontFactory.getFont("arial", 22, Font.UNDERLINE, BaseColor.BLACK));
titulo.setAlignment(Element.ALIGN_CENTER); titulo.setAlignment(Element.ALIGN_CENTER);
documento.add(titulo); documento.add(titulo);
// lote // lote
Paragraph lote = new Paragraph("N° LOTE " + numeroLote, Paragraph lote = new Paragraph("N° LOTE " + numeroLote,
FontFactory.getFont("arial", 22, Font.BOLD, BaseColor.BLACK)); FontFactory.getFont("arial", 22, Font.BOLD, BaseColor.BLACK));
lote.setAlignment(Element.ALIGN_CENTER); lote.setAlignment(Element.ALIGN_CENTER);
documento.add(lote); documento.add(lote);
// salto de linea // salto de linea
documento.add(new Phrase("")); documento.add(new Phrase(""));
// cabecera // cabecera
String[] cabecera = {"NRO", "APELLIDOS Y NOMBRES", "TIPO DOC.", "NRO DOC.", "ESCALAFÓN", "PROPUESTO", "PRESIDENCIA", "OBSERVACIÓN"}; String[] cabecera = {"NRO", "APELLIDOS Y NOMBRES", "TIPO DOC.", "NRO DOC.", "ESCALAFÓN", "PROPUESTO", "PRESIDENCIA", "OBSERVACIÓN"};
PdfPTable tablaData = new PdfPTable(cabecera.length); PdfPTable tablaData = new PdfPTable(cabecera.length);
tablaData.setWidths(new float[]{0.5f, 3, 1, 1, 1, 1, 1, 4}); tablaData.setWidths(new float[]{0.5f, 3, 1, 1, 1, 1, 1, 4});
tablaData.setWidthPercentage(100); tablaData.setWidthPercentage(100);
for (int i = 0; i < cabecera.length; i++) { for (int i = 0; i < cabecera.length; i++) {
switch (i) { switch (i) {
case 4: case 4:
tablaData.addCell(createCell("SUELDO (S/.)", 0.5f, 3, Element.ALIGN_CENTER, Font.BOLD)); tablaData.addCell(createCell("SUELDO (S/.)", 0.5f, 3, Element.ALIGN_CENTER, Font.BOLD));
break; break;
case 5: case 5:
break; break;
case 6: case 6:
break; break;
default: default:
tablaData.addCell(createCell("", 0, 1, Element.ALIGN_CENTER, Font.BOLD)); tablaData.addCell(createCell("", 0, 1, Element.ALIGN_CENTER, Font.BOLD));
break; break;
} }
} }
for (String tituloCabecera : cabecera) { for (String tituloCabecera : cabecera) {
tablaData.addCell(createCell(tituloCabecera, 0.5f, 1, Element.ALIGN_CENTER, Font.BOLD)); tablaData.addCell(createCell(tituloCabecera, 0.5f, 1, Element.ALIGN_CENTER, Font.BOLD));
} }
// data // data
for (int i = 0; i < cabecera.length; i++) { for (int i = 0; i < cabecera.length; i++) {
if (i < JAResponse.length()) { if (i < JAResponse.length()) {
JSONObject data = JAResponse.getJSONObject(i); JSONObject data = JAResponse.getJSONObject(i);
tablaData.addCell(createCell("" + (i + 1), 0.5f, 1, Element.ALIGN_CENTER, Font.NORMAL)); tablaData.addCell(createCell("" + (i + 1), 0.5f, 1, Element.ALIGN_CENTER, Font.NORMAL));
tablaData.addCell(createCell(data.getString("apellidoPaterno") + " " + data.getString("apellidoMaterno") + ", " + data.getString("nombre"), 0.5f, 1, Element.ALIGN_LEFT, Font.NORMAL)); tablaData.addCell(createCell(data.getString("apellidoPaterno") + " " + data.getString("apellidoMaterno") + ", " + data.getString("nombre"), 0.5f, 1, Element.ALIGN_LEFT, Font.NORMAL));
tablaData.addCell(createCell(data.getString("tipoDocumento"), 0.5f, 1, Element.ALIGN_LEFT, Font.NORMAL)); tablaData.addCell(createCell(data.getString("tipoDocumento"), 0.5f, 1, Element.ALIGN_LEFT, Font.NORMAL));
tablaData.addCell(createCell(data.getString("numeroDocumento"), 0.5f, 1, Element.ALIGN_LEFT, Font.NORMAL)); tablaData.addCell(createCell(data.getString("numeroDocumento"), 0.5f, 1, Element.ALIGN_LEFT, Font.NORMAL));
tablaData.addCell(createCell(data.getString("sueldoEscalafon"), 0.5f, 1, Element.ALIGN_CENTER, Font.NORMAL)); tablaData.addCell(createCell(data.getString("sueldoEscalafon"), 0.5f, 1, Element.ALIGN_CENTER, Font.NORMAL));
tablaData.addCell(createCell(data.getString("sueldoMensual"), 0.5f, 1, Element.ALIGN_CENTER, Font.NORMAL)); tablaData.addCell(createCell(data.getString("sueldoMensual"), 0.5f, 1, Element.ALIGN_CENTER, Font.NORMAL));
tablaData.addCell(createCell("", 0.5f, 1, Element.ALIGN_LEFT, Font.NORMAL)); tablaData.addCell(createCell("", 0.5f, 1, Element.ALIGN_LEFT, Font.NORMAL));
tablaData.addCell(createCell("", 0.5f, 1, Element.ALIGN_LEFT, Font.NORMAL)); tablaData.addCell(createCell("", 0.5f, 1, Element.ALIGN_LEFT, Font.NORMAL));
} else { } else {
break; break;
} }
} }
documento.add(tablaData); documento.add(tablaData);
// salto de linea // salto de linea
documento.add(Chunk.NEWLINE); documento.add(Chunk.NEWLINE);
documento.add(Chunk.NEWLINE); documento.add(Chunk.NEWLINE);
documento.add(Chunk.NEWLINE); documento.add(Chunk.NEWLINE);
documento.add(Chunk.NEWLINE); documento.add(Chunk.NEWLINE);
documento.add(Chunk.NEWLINE); documento.add(Chunk.NEWLINE);
// responsables // responsables
String[] responsables = new String[]{"Fabianna Janeht Gonzáles Saavedra", "Wilmer Carrasco Beas"}; String[] responsables = new String[]{"Fabianna Janeht Gonzáles Saavedra", "Wilmer Carrasco Beas"};
// cargos // cargos
String[] cargos = new String[]{"Directora General", "Presidente de la A.C.E.S.O"}; String[] cargos = new String[]{"Directora General", "Presidente de la A.C.E.S.O"};
PdfPTable tablaAutorizacion = new PdfPTable(responsables.length); PdfPTable tablaAutorizacion = new PdfPTable(responsables.length);
PdfPCell cellFirma = new PdfPCell(new Phrase("______________________________")); PdfPCell cellFirma = new PdfPCell(new Phrase("______________________________"));
cellFirma.setBorder(Rectangle.NO_BORDER); cellFirma.setBorder(Rectangle.NO_BORDER);
PdfPCell cellResponsable = null; PdfPCell cellResponsable = null;
PdfPCell cellCargo = null; PdfPCell cellCargo = null;
// firmas // firmas
for (int i = 0; i < responsables.length; i++) { for (int i = 0; i < responsables.length; i++) {
tablaAutorizacion.addCell(cellFirma); tablaAutorizacion.addCell(cellFirma);
} }
// repsonsables // repsonsables
for (int i = 0; i < responsables.length; i++) { for (int i = 0; i < responsables.length; i++) {
cellResponsable = new PdfPCell(new Phrase(responsables[i])); cellResponsable = new PdfPCell(new Phrase(responsables[i]));
cellResponsable.setBorder(Rectangle.NO_BORDER); cellResponsable.setBorder(Rectangle.NO_BORDER);
tablaAutorizacion.addCell(cellResponsable); tablaAutorizacion.addCell(cellResponsable);
} }
// cargos // cargos
for (int i = 0; i < responsables.length; i++) { for (int i = 0; i < responsables.length; i++) {
cellCargo = new PdfPCell(new Phrase(cargos[i])); cellCargo = new PdfPCell(new Phrase(cargos[i]));
cellCargo.setBorder(Rectangle.NO_BORDER); cellCargo.setBorder(Rectangle.NO_BORDER);
tablaAutorizacion.addCell(cellCargo); tablaAutorizacion.addCell(cellCargo);
} }
documento.add(tablaAutorizacion); documento.add(tablaAutorizacion);
documento.close(); documento.close();
} catch (DocumentException e) { } catch (DocumentException e) {
throw new IOException(e.getMessage()); throw new IOException(e.getMessage());
} }
} }
public PdfPCell createCell(String content, float borderWidth, int colspan, int alignment, int textStyle) { public PdfPCell createCell(String content, float borderWidth, int colspan, int alignment, int textStyle) {
Font f = new Font(Font.FontFamily.HELVETICA, 7, textStyle, GrayColor.BLACK); Font f = new Font(Font.FontFamily.HELVETICA, 7, textStyle, GrayColor.BLACK);
PdfPCell cell = new PdfPCell(new Phrase(content, f)); PdfPCell cell = new PdfPCell(new Phrase(content, f));
cell.setBorderWidth(borderWidth); cell.setBorderWidth(borderWidth);
cell.setColspan(colspan); cell.setColspan(colspan);
cell.setHorizontalAlignment(alignment); cell.setHorizontalAlignment(alignment);
return cell; return cell;
} }
class MyFooter extends PdfPageEventHelper { class MyFooter extends PdfPageEventHelper {
Font ffont = new Font(Font.FontFamily.COURIER, 5, Font.BOLD); Font ffont = new Font(Font.FontFamily.COURIER, 5, Font.BOLD);
@Override @Override
public void onEndPage(PdfWriter writer, Document document) { public void onEndPage(PdfWriter writer, Document document) {
// String timeStamp = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss").format(Calendar.getInstance().getTime()); // String timeStamp = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss").format(Calendar.getInstance().getTime());
String datetime = DateTimeServer.getDateTimeServer(); String datetime = DateTimeServer.getDateTimeServer();
PdfContentByte cb = writer.getDirectContent(); PdfContentByte cb = writer.getDirectContent();
Phrase footer = new Phrase(datetime, ffont); Phrase footer = new Phrase(datetime, ffont);
ColumnText.showTextAligned(cb, Element.ALIGN_CENTER, ColumnText.showTextAligned(cb, Element.ALIGN_CENTER,
footer, footer,
(document.right() - document.left()) / 2 + document.leftMargin(), (document.right() - document.left()) / 2 + document.leftMargin(),
document.bottom() - 1, 0); document.bottom() - 1, 0);
} }
} }
} }
...@@ -117,11 +117,11 @@ public class DetalleLoteFichaDocenteServlet extends HttpServlet { ...@@ -117,11 +117,11 @@ public class DetalleLoteFichaDocenteServlet extends HttpServlet {
documento.open(); documento.open();
// logo saco oliveros y sistema helicoidal // logo saco oliveros y sistema helicoidal
Image logoSOSH = Image.getInstance("C:\\_AppServ\\www\\img\\so_sh.png"); Image logoSOSH = Image.getInstance("C:\\AppServ\\www\\img\\so_sh.png");
logoSOSH.scaleToFit(200, 200); logoSOSH.scaleToFit(200, 200);
logoSOSH.setAlignment(Chunk.ALIGN_LEFT); logoSOSH.setAlignment(Chunk.ALIGN_LEFT);
Image logoAPE = Image.getInstance("C:\\_AppServ\\www\\img\\ap.png"); Image logoAPE = Image.getInstance("C:\\AppServ\\www\\img\\ap.png");
logoAPE.scaleToFit(200, 200); logoAPE.scaleToFit(200, 200);
logoAPE.setAlignment(Chunk.ALIGN_RIGHT); logoAPE.setAlignment(Chunk.ALIGN_RIGHT);
......
...@@ -1743,12 +1743,12 @@ public class FichaServlet extends HttpServlet { ...@@ -1743,12 +1743,12 @@ public class FichaServlet extends HttpServlet {
documento.open(); documento.open();
// logo saco oliveros y sistema helicoidal // logo saco oliveros y sistema helicoidal
Image logoSOSH = Image.getInstance("C:\\_AppServ\\www\\img\\so_sh.png"); Image logoSOSH = Image.getInstance("C:\\AppServ\\www\\img\\so_sh.png");
logoSOSH.scaleToFit(100, 100); logoSOSH.scaleToFit(100, 100);
logoSOSH.setAlignment(Chunk.ALIGN_LEFT); logoSOSH.setAlignment(Chunk.ALIGN_LEFT);
// logo apeiron // logo apeiron
Image logoAPE = Image.getInstance("C:\\_AppServ\\www\\img\\ap.png"); Image logoAPE = Image.getInstance("C:\\AppServ\\www\\img\\ap.png");
logoAPE.scaleToFit(100, 100); logoAPE.scaleToFit(100, 100);
logoAPE.setAlignment(Chunk.ALIGN_RIGHT); logoAPE.setAlignment(Chunk.ALIGN_RIGHT);
...@@ -1795,7 +1795,7 @@ public class FichaServlet extends HttpServlet { ...@@ -1795,7 +1795,7 @@ public class FichaServlet extends HttpServlet {
tablaDatosPersonales.addCell(createCell(objPersona.getString("gentilicio"), 0.5f, 1, 1, Element.ALIGN_LEFT, Font.NORMAL, contentBodySize, Rectangle.NO_BORDER, 5)); tablaDatosPersonales.addCell(createCell(objPersona.getString("gentilicio"), 0.5f, 1, 1, Element.ALIGN_LEFT, Font.NORMAL, contentBodySize, Rectangle.NO_BORDER, 5));
// foto // foto
if (objPersona.getString("foto").equals("")) { if (objPersona.getString("foto").equals("")) {
String foto = "C:\\_AppServ\\www\\img\\default.jpeg"; // 128 x 128 String foto = "C:\\AppServ\\www\\img\\default.jpeg"; // 128 x 128
Image image = Image.getInstance(foto); Image image = Image.getInstance(foto);
PdfPCell cellImage = new PdfPCell(); PdfPCell cellImage = new PdfPCell();
cellImage.addElement(image); cellImage.addElement(image);
...@@ -1807,12 +1807,12 @@ public class FichaServlet extends HttpServlet { ...@@ -1807,12 +1807,12 @@ public class FichaServlet extends HttpServlet {
cellImage.setPaddingBottom(5); cellImage.setPaddingBottom(5);
tablaDatosPersonales.addCell(cellImage); tablaDatosPersonales.addCell(cellImage);
} else { } else {
String foto = "C:\\_AppServ\\www\\img\\" + objPersona.getString("foto"); // 128 x 128 String foto = "C:\\AppServ\\www\\img\\" + objPersona.getString("foto"); // 128 x 128
// validar si la imagen si existe // validar si la imagen si existe
File file = new File(foto); File file = new File(foto);
if (!file.exists()) { if (!file.exists()) {
foto = "C:\\_AppServ\\www\\img\\default.jpg"; // 128 x 128 foto = "C:\\AppServ\\www\\img\\default.jpg"; // 128 x 128
} }
Image image = Image.getInstance(foto); Image image = Image.getInstance(foto);
...@@ -2015,12 +2015,12 @@ public class FichaServlet extends HttpServlet { ...@@ -2015,12 +2015,12 @@ public class FichaServlet extends HttpServlet {
documento.open(); documento.open();
// logo saco oliveros y sistema helicoidal // logo saco oliveros y sistema helicoidal
Image logoSOSH = Image.getInstance("C:\\_AppServ\\www\\img\\so_sh.png"); Image logoSOSH = Image.getInstance("C:\\AppServ\\www\\img\\so_sh.png");
logoSOSH.scaleToFit(100, 100); logoSOSH.scaleToFit(100, 100);
logoSOSH.setAlignment(Chunk.ALIGN_LEFT); logoSOSH.setAlignment(Chunk.ALIGN_LEFT);
// logo apeiron // logo apeiron
Image logoAPE = Image.getInstance("C:\\_AppServ\\www\\img\\ap.png"); Image logoAPE = Image.getInstance("C:\\AppServ\\www\\img\\ap.png");
logoAPE.scaleToFit(100, 100); logoAPE.scaleToFit(100, 100);
logoAPE.setAlignment(Chunk.ALIGN_RIGHT); logoAPE.setAlignment(Chunk.ALIGN_RIGHT);
......
...@@ -1045,7 +1045,6 @@ public class FichaSqlserverDAO implements FichaDAO { ...@@ -1045,7 +1045,6 @@ public class FichaSqlserverDAO implements FichaDAO {
String sql String sql
= "SELECT " = "SELECT "
+ "ficha.codigo_ficha codigoFicha, " + "ficha.codigo_ficha codigoFicha, "
// + "ficha.codigo_persona codigoPersona, "
+ "persona.apellido_paterno apellidoPaterno, " + "persona.apellido_paterno apellidoPaterno, "
+ "persona.apellido_materno apellidoMaterno, " + "persona.apellido_materno apellidoMaterno, "
+ "persona.nombre nombre, " + "persona.nombre nombre, "
...@@ -1101,12 +1100,12 @@ public class FichaSqlserverDAO implements FichaDAO { ...@@ -1101,12 +1100,12 @@ public class FichaSqlserverDAO implements FichaDAO {
ps = cnx.prepareStatement(sql); ps = cnx.prepareStatement(sql);
ps.setInt(1, persona.getCodigoPersona()); ps.setInt(1, persona.getCodigoPersona());
System.out.println(ps);
rs = ps.executeQuery(); rs = ps.executeQuery();
rs.next(); rs.next();
// if (rs.next()) {
ReporteBean reporte = new ReporteBean(); ReporteBean reporte = new ReporteBean();
reporte.setCodigoFicha(rs.getInt("codigoFicha")); reporte.setCodigoFicha(rs.getInt("codigoFicha"));
// reporte.setCodigoPersona(rs.getInt("codigoPersona"));
reporte.setApellidoPaterno(rs.getString("apellidoPaterno")); reporte.setApellidoPaterno(rs.getString("apellidoPaterno"));
reporte.setApellidoMaterno(rs.getString("apellidoMaterno")); reporte.setApellidoMaterno(rs.getString("apellidoMaterno"));
reporte.setNombre(rs.getString("nombre")); reporte.setNombre(rs.getString("nombre"));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment