Commit dff29b08 by Luis Gangas

Merge branches 'lgangas' and 'master' of…

Merge branches 'lgangas' and 'master' of http://version.sacooliveros.edu.pe/lgangas/trismegisto-planilla into lgangas
parents b594a22d a8cb824a
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/
nbbuild/
dist/
nbdist/
.nb-gradle/
\ No newline at end of file
.nb-gradle/
### 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,7 +2,6 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="f1229581-2498-4c33-b7b4-f715a5fbe428" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/inspectionProfiles/profiles_settings.xml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
</list>
<ignored path="$PROJECT_DIR$/.tmp/" />
......@@ -24,6 +23,29 @@
</counts>
</usages-collector>
</session>
<session id="-1966417198">
<usages-collector id="statistics.lifecycle.project">
<counts>
<entry key="project.closed" value="2" />
<entry key="project.open.time.15" 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>
</usages-collector>
</session>
</component>
<component name="FileEditorManager">
<leaf />
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
......@@ -34,18 +56,15 @@
<detection-done>true</detection-done>
<sorting>DEFINITION_ORDER</sorting>
</component>
<component name="ProjectFrameBounds" extendedState="7" fullScreen="true">
<option name="x" value="260" />
<option name="y" value="60" />
<option name="width" value="1400" />
<option name="height" value="1000" />
<component name="ProjectFrameBounds" extendedState="6">
<option name="width" value="1920" />
<option name="height" value="1080" />
</component>
<component name="ProjectView">
<navigator proportions="" version="1">
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="Scope" />
<pane id="ProjectPane">
<subPane>
<expand>
......@@ -57,6 +76,7 @@
<select />
</subPane>
</pane>
<pane id="Scope" />
</panes>
</component>
<component name="PropertiesComponent">
......@@ -86,22 +106,20 @@
<option name="presentableId" value="Default" />
<updated>1541626387552</updated>
<workItem from="1541626388621" duration="785000" />
<workItem from="1541776350897" duration="159000" />
<workItem from="1541776578549" duration="539000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="785000" />
<option name="totallyTimeSpent" value="1483000" />
</component>
<component name="ToolWindowManager">
<frame x="0" y="0" width="1920" height="1080" extended-state="7" />
<frame x="-8" y="-8" width="1936" height="1056" extended-state="6" />
<layout>
<window_info id="Favorites" side_tool="true" />
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.24973656" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info anchor="bottom" id="Docker" show_stripe_button="false" />
<window_info active="true" anchor="bottom" id="Version Control" visible="true" weight="0.32997987" />
<window_info anchor="bottom" id="Terminal" />
<window_info anchor="bottom" id="Event Log" side_tool="true" />
<window_info id="Favorites" order="2" side_tool="true" />
<window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="bottom" id="Find" order="1" />
<window_info anchor="bottom" id="Run" order="2" />
......@@ -109,6 +127,10 @@
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
<window_info anchor="bottom" id="TODO" order="6" />
<window_info anchor="bottom" id="Docker" order="7" show_stripe_button="false" />
<window_info active="true" anchor="bottom" id="Version Control" order="8" visible="true" weight="0.36123347" />
<window_info anchor="bottom" id="Terminal" order="9" />
<window_info anchor="bottom" id="Event Log" order="10" side_tool="true" />
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
......@@ -117,7 +139,40 @@
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="1" />
</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">
<option name="myLimit" value="2678400000" />
</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>
\ No newline at end of file
......@@ -45,7 +45,7 @@ public class CargaFamiliarMysqlDAO implements CargaFamiliarDAO {
} catch (SQLException e) {
e.printStackTrace();
response.setStatus(false);
response.setMessage("Error: " + e.getMessage() + " \n Error Code: [" + e.getErrorCode() + "]");
response.setMessage("Error: " + e.getMessage() + " Error Code: [" + e.getErrorCode() + "]");
} finally {
try {
if (rs != null) {
......@@ -93,9 +93,11 @@ public class CargaFamiliarMysqlDAO implements CargaFamiliarDAO {
+ "FROM carga_familiar cargafamiliar "
+ "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 "
+ "WHERE cargafamiliar.codigo_persona = ?";
+ "WHERE "
+ " cargafamiliar.codigo_persona = ?";
ps = cnx.prepareStatement(sql);
ps.setInt(1, persona.getCodigoPersona());
rs = ps.executeQuery();
while (rs.next()) {
CargaFamiliarBean cargaFamiliar = new CargaFamiliarBean();
......@@ -124,7 +126,7 @@ public class CargaFamiliarMysqlDAO implements CargaFamiliarDAO {
} catch (SQLException e) {
e.printStackTrace();
response.setStatus(false);
response.setMessage("Error: " + e.getMessage() + " \n Error Code: [" + e.getErrorCode() + "]");
response.setMessage("Error: " + e.getMessage() + " Error Code: [" + e.getErrorCode() + "]");
} finally {
try {
if (rs != null) {
......
......@@ -37,6 +37,7 @@ public class ExperienciaLaboralMysqlDAO implements ExperienciaLaboralDAO {
+ "WHERE experiencialaboral.codigo_persona = ?";
ps = cnx.prepareStatement(sql);
ps.setInt(1, persona.getCodigoPersona());
rs = ps.executeQuery();
while (rs.next()) {
ExperienciaLaboralBean experienciaLaboral = new ExperienciaLaboralBean();
......@@ -59,7 +60,7 @@ public class ExperienciaLaboralMysqlDAO implements ExperienciaLaboralDAO {
} catch (SQLException e) {
e.printStackTrace();
response.setStatus(false);
response.setMessage("Error: " + e.getMessage() + " \n Error Code: [" + e.getErrorCode() + "]");
response.setMessage("Error: " + e.getMessage() + " Error Code: [" + e.getErrorCode() + "]");
} finally {
try {
if (rs != null) {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -59,9 +59,7 @@ public class MysqlDAOFactory extends DAOFactory {
if (base.equalsIgnoreCase("nuevo")) {
user = "juanjose";
pwd = "juanjose";
// url = "jdbc:mysql://172.16.2.43:3306/nuevo";
url = "jdbc:mysql://172.16.2.37:3306/nuevo";
// url = "jdbc:mysql://localhost:3306/nuevo";
try {
conexion = DriverManager.getConnection(url, user, pwd);
} catch (SQLException e) {
......
......@@ -31,195 +31,195 @@ import trismegistoplanilla.utilities.DateTimeServer;
public class DetalleLoteFichaAdministrativaServlet extends HttpServlet {
private static final long serialVersionUID = 7658135208116415341L;
private static final long serialVersionUID = 7658135208116415341L;
@Override
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String accion = request.getParameter("accion");
if (accion.equals("imprimirLote")) {
imprimirLote(request, response);
}
}
@Override
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String accion = request.getParameter("accion");
if (accion.equals("imprimirLote")) {
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();
String numeroLote = request.getParameter("numeroLote");
int numeroFilas = Integer.parseInt(request.getParameter("numeroFilas"));
String json = request.getParameter("data");
JSONArray JAResponse = new JSONArray(json);
String numeroLote = request.getParameter("numeroLote");
int numeroFilas = Integer.parseInt(request.getParameter("numeroFilas"));
String json = request.getParameter("data");
JSONArray JAResponse = new JSONArray(json);
// out.println(numeroLote);
// out.println(numeroFilas);
// out.println(json);
createPDF(request, response, numeroLote, JAResponse);
}
private void createPDF(HttpServletRequest request, HttpServletResponse response, String numeroLote, JSONArray JAResponse) throws ServletException, IOException {
String fileName = "loteAdministrativo" + numeroLote + ".pdf";
response.setContentType("application/pdf");
response.setHeader("Expires", "0");
response.setHeader("Cache-Control", "must-revalidate, post-check=0, pre-check=0");
response.setHeader("Content-Disposition", "inline; filename=" + fileName);
response.setHeader("Accept-Ranges", "bytes");
try {
Document documento = new Document(PageSize.A4.rotate(), 5, 5, 5, 5);
PdfWriter writer = PdfWriter.getInstance(documento, response.getOutputStream());
MyFooter event = new MyFooter();
writer.setPageEvent(event);
documento.open();
// logo saco oliveros y sistema helicoidal
Image logoSOSH = Image.getInstance("C:\\_AppServ\\www\\img\\so_sh.png");
logoSOSH.scaleToFit(200, 200);
logoSOSH.setAlignment(Chunk.ALIGN_LEFT);
Image logoAPE = Image.getInstance("C:\\_AppServ\\www\\img\\ap.png");
logoAPE.scaleToFit(200, 200);
logoAPE.setAlignment(Chunk.ALIGN_RIGHT);
// tabla logo
PdfPTable tablaLogo = new PdfPTable(2);
tablaLogo.setWidthPercentage(100);
PdfPCell celda1 = new PdfPCell();
PdfPCell celda2 = new PdfPCell();
celda1.setBorder(Rectangle.NO_BORDER);
celda2.setBorder(Rectangle.NO_BORDER);
celda1.addElement(logoSOSH);
celda2.addElement(logoAPE);
tablaLogo.addCell(celda1);
tablaLogo.addCell(celda2);
documento.add(tablaLogo);
// titulo principal
Paragraph titulo = new Paragraph("HABER ADMINISTRATIVO",
FontFactory.getFont("arial", 22, Font.UNDERLINE, BaseColor.BLACK));
titulo.setAlignment(Element.ALIGN_CENTER);
documento.add(titulo);
// lote
Paragraph lote = new Paragraph("N° LOTE " + numeroLote,
FontFactory.getFont("arial", 22, Font.BOLD, BaseColor.BLACK));
lote.setAlignment(Element.ALIGN_CENTER);
documento.add(lote);
// salto de linea
documento.add(new Phrase(""));
// cabecera
String[] cabecera = {"NRO", "APELLIDOS Y NOMBRES", "TIPO DOC.", "NRO DOC.", "ESCALAFÓN", "PROPUESTO", "PRESIDENCIA", "OBSERVACIÓN"};
PdfPTable tablaData = new PdfPTable(cabecera.length);
tablaData.setWidths(new float[]{0.5f, 3, 1, 1, 1, 1, 1, 4});
tablaData.setWidthPercentage(100);
for (int i = 0; i < cabecera.length; i++) {
switch (i) {
case 4:
tablaData.addCell(createCell("SUELDO (S/.)", 0.5f, 3, Element.ALIGN_CENTER, Font.BOLD));
break;
case 5:
break;
case 6:
break;
default:
tablaData.addCell(createCell("", 0, 1, Element.ALIGN_CENTER, Font.BOLD));
break;
}
}
for (String tituloCabecera : cabecera) {
tablaData.addCell(createCell(tituloCabecera, 0.5f, 1, Element.ALIGN_CENTER, Font.BOLD));
}
// data
for (int i = 0; i < cabecera.length; i++) {
if (i < JAResponse.length()) {
JSONObject data = JAResponse.getJSONObject(i);
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("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("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("", 0.5f, 1, Element.ALIGN_LEFT, Font.NORMAL));
tablaData.addCell(createCell("", 0.5f, 1, Element.ALIGN_LEFT, Font.NORMAL));
} else {
break;
}
}
documento.add(tablaData);
// salto de linea
documento.add(Chunk.NEWLINE);
documento.add(Chunk.NEWLINE);
documento.add(Chunk.NEWLINE);
documento.add(Chunk.NEWLINE);
documento.add(Chunk.NEWLINE);
// responsables
String[] responsables = new String[]{"Fabianna Janeht Gonzáles Saavedra", "Wilmer Carrasco Beas"};
// cargos
String[] cargos = new String[]{"Directora General", "Presidente de la A.C.E.S.O"};
PdfPTable tablaAutorizacion = new PdfPTable(responsables.length);
PdfPCell cellFirma = new PdfPCell(new Phrase("______________________________"));
cellFirma.setBorder(Rectangle.NO_BORDER);
PdfPCell cellResponsable = null;
PdfPCell cellCargo = null;
// firmas
for (int i = 0; i < responsables.length; i++) {
tablaAutorizacion.addCell(cellFirma);
}
// repsonsables
for (int i = 0; i < responsables.length; i++) {
cellResponsable = new PdfPCell(new Phrase(responsables[i]));
cellResponsable.setBorder(Rectangle.NO_BORDER);
tablaAutorizacion.addCell(cellResponsable);
}
// cargos
for (int i = 0; i < responsables.length; i++) {
cellCargo = new PdfPCell(new Phrase(cargos[i]));
cellCargo.setBorder(Rectangle.NO_BORDER);
tablaAutorizacion.addCell(cellCargo);
}
documento.add(tablaAutorizacion);
documento.close();
} catch (DocumentException e) {
throw new IOException(e.getMessage());
}
}
public PdfPCell createCell(String content, float borderWidth, int colspan, int alignment, int textStyle) {
Font f = new Font(Font.FontFamily.HELVETICA, 7, textStyle, GrayColor.BLACK);
PdfPCell cell = new PdfPCell(new Phrase(content, f));
cell.setBorderWidth(borderWidth);
cell.setColspan(colspan);
cell.setHorizontalAlignment(alignment);
return cell;
}
class MyFooter extends PdfPageEventHelper {
Font ffont = new Font(Font.FontFamily.COURIER, 5, Font.BOLD);
@Override
public void onEndPage(PdfWriter writer, Document document) {
createPDF(request, response, numeroLote, JAResponse);
}
private void createPDF(HttpServletRequest request, HttpServletResponse response, String numeroLote, JSONArray JAResponse) throws ServletException, IOException {
String fileName = "loteAdministrativo" + numeroLote + ".pdf";
response.setContentType("application/pdf");
response.setHeader("Expires", "0");
response.setHeader("Cache-Control", "must-revalidate, post-check=0, pre-check=0");
response.setHeader("Content-Disposition", "inline; filename=" + fileName);
response.setHeader("Accept-Ranges", "bytes");
try {
Document documento = new Document(PageSize.A4.rotate(), 5, 5, 5, 5);
PdfWriter writer = PdfWriter.getInstance(documento, response.getOutputStream());
MyFooter event = new MyFooter();
writer.setPageEvent(event);
documento.open();
// logo saco oliveros y sistema helicoidal
Image logoSOSH = Image.getInstance("C:\\AppServ\\www\\img\\so_sh.png");
logoSOSH.scaleToFit(200, 200);
logoSOSH.setAlignment(Chunk.ALIGN_LEFT);
Image logoAPE = Image.getInstance("C:\\AppServ\\www\\img\\ap.png");
logoAPE.scaleToFit(200, 200);
logoAPE.setAlignment(Chunk.ALIGN_RIGHT);
// tabla logo
PdfPTable tablaLogo = new PdfPTable(2);
tablaLogo.setWidthPercentage(100);
PdfPCell celda1 = new PdfPCell();
PdfPCell celda2 = new PdfPCell();
celda1.setBorder(Rectangle.NO_BORDER);
celda2.setBorder(Rectangle.NO_BORDER);
celda1.addElement(logoSOSH);
celda2.addElement(logoAPE);
tablaLogo.addCell(celda1);
tablaLogo.addCell(celda2);
documento.add(tablaLogo);
// titulo principal
Paragraph titulo = new Paragraph("HABER ADMINISTRATIVO",
FontFactory.getFont("arial", 22, Font.UNDERLINE, BaseColor.BLACK));
titulo.setAlignment(Element.ALIGN_CENTER);
documento.add(titulo);
// lote
Paragraph lote = new Paragraph("N° LOTE " + numeroLote,
FontFactory.getFont("arial", 22, Font.BOLD, BaseColor.BLACK));
lote.setAlignment(Element.ALIGN_CENTER);
documento.add(lote);
// salto de linea
documento.add(new Phrase(""));
// cabecera
String[] cabecera = {"NRO", "APELLIDOS Y NOMBRES", "TIPO DOC.", "NRO DOC.", "ESCALAFÓN", "PROPUESTO", "PRESIDENCIA", "OBSERVACIÓN"};
PdfPTable tablaData = new PdfPTable(cabecera.length);
tablaData.setWidths(new float[]{0.5f, 3, 1, 1, 1, 1, 1, 4});
tablaData.setWidthPercentage(100);
for (int i = 0; i < cabecera.length; i++) {
switch (i) {
case 4:
tablaData.addCell(createCell("SUELDO (S/.)", 0.5f, 3, Element.ALIGN_CENTER, Font.BOLD));
break;
case 5:
break;
case 6:
break;
default:
tablaData.addCell(createCell("", 0, 1, Element.ALIGN_CENTER, Font.BOLD));
break;
}
}
for (String tituloCabecera : cabecera) {
tablaData.addCell(createCell(tituloCabecera, 0.5f, 1, Element.ALIGN_CENTER, Font.BOLD));
}
// data
for (int i = 0; i < cabecera.length; i++) {
if (i < JAResponse.length()) {
JSONObject data = JAResponse.getJSONObject(i);
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("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("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("", 0.5f, 1, Element.ALIGN_LEFT, Font.NORMAL));
tablaData.addCell(createCell("", 0.5f, 1, Element.ALIGN_LEFT, Font.NORMAL));
} else {
break;
}
}
documento.add(tablaData);
// salto de linea
documento.add(Chunk.NEWLINE);
documento.add(Chunk.NEWLINE);
documento.add(Chunk.NEWLINE);
documento.add(Chunk.NEWLINE);
documento.add(Chunk.NEWLINE);
// responsables
String[] responsables = new String[]{"Fabianna Janeht Gonzáles Saavedra", "Wilmer Carrasco Beas"};
// cargos
String[] cargos = new String[]{"Directora General", "Presidente de la A.C.E.S.O"};
PdfPTable tablaAutorizacion = new PdfPTable(responsables.length);
PdfPCell cellFirma = new PdfPCell(new Phrase("______________________________"));
cellFirma.setBorder(Rectangle.NO_BORDER);
PdfPCell cellResponsable = null;
PdfPCell cellCargo = null;
// firmas
for (int i = 0; i < responsables.length; i++) {
tablaAutorizacion.addCell(cellFirma);
}
// repsonsables
for (int i = 0; i < responsables.length; i++) {
cellResponsable = new PdfPCell(new Phrase(responsables[i]));
cellResponsable.setBorder(Rectangle.NO_BORDER);
tablaAutorizacion.addCell(cellResponsable);
}
// cargos
for (int i = 0; i < responsables.length; i++) {
cellCargo = new PdfPCell(new Phrase(cargos[i]));
cellCargo.setBorder(Rectangle.NO_BORDER);
tablaAutorizacion.addCell(cellCargo);
}
documento.add(tablaAutorizacion);
documento.close();
} catch (DocumentException e) {
throw new IOException(e.getMessage());
}
}
public PdfPCell createCell(String content, float borderWidth, int colspan, int alignment, int textStyle) {
Font f = new Font(Font.FontFamily.HELVETICA, 7, textStyle, GrayColor.BLACK);
PdfPCell cell = new PdfPCell(new Phrase(content, f));
cell.setBorderWidth(borderWidth);
cell.setColspan(colspan);
cell.setHorizontalAlignment(alignment);
return cell;
}
class MyFooter extends PdfPageEventHelper {
Font ffont = new Font(Font.FontFamily.COURIER, 5, Font.BOLD);
@Override
public void onEndPage(PdfWriter writer, Document document) {
// String timeStamp = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss").format(Calendar.getInstance().getTime());
String datetime = DateTimeServer.getDateTimeServer();
PdfContentByte cb = writer.getDirectContent();
Phrase footer = new Phrase(datetime, ffont);
ColumnText.showTextAligned(cb, Element.ALIGN_CENTER,
footer,
(document.right() - document.left()) / 2 + document.leftMargin(),
document.bottom() - 1, 0);
}
}
String datetime = DateTimeServer.getDateTimeServer();
PdfContentByte cb = writer.getDirectContent();
Phrase footer = new Phrase(datetime, ffont);
ColumnText.showTextAligned(cb, Element.ALIGN_CENTER,
footer,
(document.right() - document.left()) / 2 + document.leftMargin(),
document.bottom() - 1, 0);
}
}
}
......@@ -117,11 +117,11 @@ public class DetalleLoteFichaDocenteServlet extends HttpServlet {
documento.open();
// 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.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.setAlignment(Chunk.ALIGN_RIGHT);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -1045,7 +1045,6 @@ public class FichaSqlserverDAO implements FichaDAO {
String sql
= "SELECT "
+ "ficha.codigo_ficha codigoFicha, "
// + "ficha.codigo_persona codigoPersona, "
+ "persona.apellido_paterno apellidoPaterno, "
+ "persona.apellido_materno apellidoMaterno, "
+ "persona.nombre nombre, "
......@@ -1101,12 +1100,12 @@ public class FichaSqlserverDAO implements FichaDAO {
ps = cnx.prepareStatement(sql);
ps.setInt(1, persona.getCodigoPersona());
System.out.println(ps);
rs = ps.executeQuery();
rs.next();
// if (rs.next()) {
ReporteBean reporte = new ReporteBean();
reporte.setCodigoFicha(rs.getInt("codigoFicha"));
// reporte.setCodigoPersona(rs.getInt("codigoPersona"));
reporte.setApellidoPaterno(rs.getString("apellidoPaterno"));
reporte.setApellidoMaterno(rs.getString("apellidoMaterno"));
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