añado jsp
This commit is contained in:
@@ -0,0 +1,768 @@
|
||||
<%@page import="com.tarisan.persistencia.DataStore"%>
|
||||
<%@ page import="com.tarisan.control.*" %>
|
||||
<%@ page import="com.tarisan.data.*" %>
|
||||
<%@ page import="com.tarisan.excepcion.*" %>
|
||||
<%@ page import="com.tarisan.log.*" %>
|
||||
<%@ page import="com.tarisan.util.Utilidades" %>
|
||||
<%@ page import="com.tarisan.persistencia.PersistenciaParametros" %>
|
||||
<%@ page import="java.sql.*" %>
|
||||
<%@ page import="java.util.Vector" %>
|
||||
<%@ page import="java.text.*" %>
|
||||
<%@ page import="java.util.Calendar" %>
|
||||
<%@ page import="java.io.*" %>
|
||||
<%@ page import="com.itextpdf.text.Font" %>
|
||||
<%@ page import="com.itextpdf.text.Image" %>
|
||||
<%@ page import="com.itextpdf.text.Document" %>
|
||||
<%@ page import="com.itextpdf.text.DocumentException" %>
|
||||
<%@ page import="com.itextpdf.text.Paragraph" %>
|
||||
<%@ page import="com.itextpdf.text.Phrase" %>
|
||||
<%@ page import="com.itextpdf.text.pdf.*" %>
|
||||
<%@ page import="com.itextpdf.text.PageSize" %>
|
||||
<%@ page import="com.itextpdf.text.FontFactory" %>
|
||||
<%@ page import="com.itextpdf.text.BaseColor" %>
|
||||
<%@ page import="com.itextpdf.text.Element" %>
|
||||
<%@ page import="com.tarisan.util.DES" %>
|
||||
|
||||
<%
|
||||
//LogTarisan.logger.log(NivelLog.INFO, "Inicio página del histórico liquidaciones (med/historico_liquidacion.jsp)");
|
||||
//JJ Fuerzo un cambio para provocar la descarga
|
||||
|
||||
response.setHeader("Expires", "0");
|
||||
response.setHeader("Pragma", "no-cache");
|
||||
response.setHeader("Cache-Control", "no-cache");
|
||||
HttpSession sesion = request.getSession(true);
|
||||
|
||||
if(sesion.isNew() || (sesion.getAttribute("USUARIO") == null))
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.INFO, "Sesión invalidada");
|
||||
response.sendRedirect("../../html/login.html");
|
||||
}
|
||||
else
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.INFO, ((Usuario)sesion.getAttribute("USUARIO")).getMedico() + " - Inicio página del histórico liquidaciones (med/historico_liquidacion.jsp)");
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
// Definicion de variables
|
||||
String strParametroMenu="";
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
String sql = new String();
|
||||
int intPagina = 0;
|
||||
double dblImporteTotal=0;
|
||||
//Object aCondiciones[]=null;
|
||||
|
||||
//Obtención del perfil del usuario conectado
|
||||
StringBuffer perfil = new StringBuffer();
|
||||
perfil.append("|");
|
||||
perfil.append(sesion.getAttribute("PERFIL"));
|
||||
perfil.append("|");
|
||||
|
||||
//Obtenemos los valores de los parametros que se pasan a la pagina
|
||||
//En caso de que no se le pasen parametros, quedaram inicializados
|
||||
//a sus valores por defecto
|
||||
|
||||
//parametro x para marcar la opcion del menu en la que se encuentra el usuario
|
||||
if (request.getParameter("x")!=null)
|
||||
strParametroMenu=(String)request.getParameter("x");
|
||||
|
||||
//parametro pagina para realizar la paginacion
|
||||
if (request.getParameter("pagina")!=null)
|
||||
intPagina=Integer.parseInt(request.getParameter("pagina"));
|
||||
|
||||
Tamensaje tamensaje = new Tamensaje();
|
||||
PersistenciaTamensaje pertamensaje = new PersistenciaTamensaje();
|
||||
|
||||
boolean mostrarNoticia = true;
|
||||
PersistenciaTanoticias perTaNo = new PersistenciaTanoticias();
|
||||
Vector vSeleccionNot = perTaNo.obtener_noticias_cabecera();
|
||||
Vector vNoticias = new Vector();
|
||||
String strNoticia = "";
|
||||
String noticias ="";
|
||||
String separador = " ---//--- ";
|
||||
if(vSeleccionNot.size()==0){
|
||||
mostrarNoticia = false;
|
||||
}else{
|
||||
mostrarNoticia = true;
|
||||
Tanoticias tanoticia = null;
|
||||
for(int i = 0; i < vSeleccionNot.size(); i++)
|
||||
{
|
||||
tanoticia = (Tanoticias)vSeleccionNot.elementAt(i);
|
||||
if (i!=0){
|
||||
strNoticia = strNoticia + separador + tanoticia.getNoticia();
|
||||
}else{
|
||||
strNoticia = tanoticia.getNoticia();
|
||||
}
|
||||
strNoticia = strNoticia.replaceAll("<br/>", " ");
|
||||
}
|
||||
}
|
||||
%>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Histórico Liquidaciones</title>
|
||||
<link rel="shortcut icon" href="../../img/logo.ico" />
|
||||
<link rel="STYLESHEET" type="text/css" href="../../css/estilos.css">
|
||||
|
||||
<script language="JavaScript" src="../../js/jquery-1.11.3.js"></script>
|
||||
<script language="JavaScript" src="../../js/funciones.js"></script>
|
||||
<script language="JavaScript" src="../../js/inicio_tarisan.js"></script>
|
||||
<script language="JavaScript" src="../../js/menu_med.js"></script>
|
||||
<script language="JavaScript" src="../../js/bloques_tarisan.js"></script>
|
||||
<script language="JavaScript">pNG="<%= perfil.toString() %>"</script>
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
<!--
|
||||
function paginacion(pagina)
|
||||
{
|
||||
document.frmLiquidacion.pagina.value=pagina;
|
||||
document.frmLiquidacion.submit();
|
||||
}
|
||||
|
||||
function enviar_frmLiquidacion()
|
||||
{
|
||||
document.frmLiquidacion.submit();
|
||||
}
|
||||
|
||||
function verdetalles(valor)
|
||||
{
|
||||
obj=document.getElementById(valor);
|
||||
obj.submit();
|
||||
}
|
||||
//-->
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body marginwidth="0" marginheight="0" leftmargin="0" topmargin="0" alink="#43881A" bgcolor="#FFFFFF">
|
||||
<div class="marco">
|
||||
<table cellpadding="0" cellspacing="0" style="width:95%;border:0;margin:0 auto">
|
||||
<tr>
|
||||
<td class="tdLogoCabecera"><img src="<%=request.getContextPath()%>/img/logo.png" class="logoCabecera"></td>
|
||||
<td>
|
||||
<table style="width:100%">
|
||||
<tr><td class="tituloTablaMedico" align="center"><%= sesion.getAttribute("USUARIO") %></td></tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div id="contenedorNoticia">
|
||||
<br>
|
||||
<div class="tituloNoticia">
|
||||
<p class="marquee"><%=strNoticia %></p>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- Cabecera de Navegación superior //-->
|
||||
<table cellpadding="0" cellspacing="0" border="0" align="center" style="width:95%">
|
||||
<tr>
|
||||
<td><script language="JavaScript">bloques();</script></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
|
||||
<!-- Cuerpo de la página //-->
|
||||
<table cellpadding="0" cellspacing="0" border="0" align="center" style="width:95%">
|
||||
<tr valign="top">
|
||||
<!--<td width="180">//-->
|
||||
<td width="5%">
|
||||
<!-- Menú de navegación del módulo (zona izquierda) //-->
|
||||
<table cellpadding="0" cellspacing="0" border="0">
|
||||
<tr valign="top">
|
||||
<td colspan="2"><img src="../../img/sp.gif" width="180" height="12" border="0"></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td><script language="JavaScript">escribirMenuGst();</script></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<!--<td bgcolor="#CCCCCC"><img src="../../img/sp.gif" width="1" height="12" border="0"></td>//-->
|
||||
<td width="565">
|
||||
<!-- Tabla con el contenido de la página (zona central-derecha) //-->
|
||||
<table cellpadding="0" cellspacing="0" border="0" width="100%">
|
||||
<tr>
|
||||
<td width="1px" bgcolor="#CCCCCC" height="330px"></td>
|
||||
<td>
|
||||
<form id="frmLiquidacion" name="frmLiquidacion" action="historico_liquidacion.jsp?x=<%=strParametroMenu%>" method="post">
|
||||
<%
|
||||
//Creación de la tabla presentación de resultados
|
||||
int medico = 0;
|
||||
int esp = 0;
|
||||
medico = Integer.valueOf( ((Usuario)sesion.getAttribute("USUARIO")).getMedico() );
|
||||
esp = Integer.valueOf( ((Usuario)sesion.getAttribute("USUARIO")).getEspecialidad() );
|
||||
if(request.getParameter("pagina")==null)
|
||||
{
|
||||
SimpleDateFormat sdfFormateadorFecha = new SimpleDateFormat("MM/yyyy");
|
||||
java.sql.Date dtFecha = new java.sql.Date(Calendar.getInstance().getTime().getTime());
|
||||
sdfFormateadorFecha.format(dtFecha);
|
||||
|
||||
PersistenciaTaliquimedi per = new PersistenciaTaliquimedi();
|
||||
Vector vSeleccion = per.listado_fechas_liquidaciones(medico);
|
||||
|
||||
if(vSeleccion.size()==0)
|
||||
{
|
||||
%>
|
||||
<table border="0" width="90%" align="center">
|
||||
<tr>
|
||||
<td colspan="5" align="center"><span class="txt"><%=pertamensaje.obtenerMensaje(52).getMensaje() %></span></td>
|
||||
</tr>
|
||||
</table>
|
||||
<%
|
||||
}
|
||||
else
|
||||
{
|
||||
%>
|
||||
<table border="0" width="90%" align="center">
|
||||
<tr>
|
||||
<td colspan="5" align="center"><span class="txt"><%=pertamensaje.obtenerMensaje(53).getMensaje() %> <select name="mes">
|
||||
<%
|
||||
int i=0;
|
||||
do{
|
||||
%><option value="<%=vSeleccion.get(i) %>"><%=vSeleccion.get(i) %></option>
|
||||
<%
|
||||
i=i+1;
|
||||
}while(i<vSeleccion.size());
|
||||
%>
|
||||
<option value="todos">Todos</option>
|
||||
</select>
|
||||
<input type="hidden" name="pagina" value="1">
|
||||
<a href="javascript:enviar_frmLiquidacion()" class="enlace"><%=pertamensaje.obtenerMensaje(24).getMensaje() %></a>
|
||||
</span></td>
|
||||
</tr>
|
||||
</table>
|
||||
<%
|
||||
vSeleccion=null;
|
||||
}
|
||||
}
|
||||
else{
|
||||
//ha pulsado en buscar
|
||||
String strMes = request.getParameter("mes");
|
||||
int prueba01 = strMes.toString().indexOf("s");
|
||||
int prueba02 = 0;
|
||||
if(strMes.toString().indexOf("os")>0)
|
||||
{
|
||||
//Ha seleccionado la opción de todos, para ver un resumen de sus liquidaciones
|
||||
%>
|
||||
<p style="text-align:center;margin:0px auto;"><span class="tituloTabla"><%=pertamensaje.obtenerMensaje(51).getMensaje() %></span></p><br/>
|
||||
|
||||
<table border="0" width="90%" align="center">
|
||||
<%
|
||||
PersistenciaTaliquimedi per = new PersistenciaTaliquimedi();
|
||||
boolean retencion = per.tiene_retencion(medico);
|
||||
//Primero vamos a ver si el médico origen tiene retención o no...
|
||||
Vector vSeleccion = new Vector();
|
||||
if(retencion)
|
||||
{
|
||||
vSeleccion = per.listado_resumen_todas_liquidaciones_con_retencion(medico);
|
||||
}
|
||||
else
|
||||
{
|
||||
vSeleccion = per.listado_resumen_todas_liquidaciones_sin_retencion(medico);
|
||||
}
|
||||
boolean fondo = true;
|
||||
DecimalFormat df = new DecimalFormat("#.##");
|
||||
%>
|
||||
<tr class="tituloTabla">
|
||||
<td align="center" class="cabeceraTabla" bgcolor="#FFAAAA"><%=pertamensaje.obtenerMensaje(54).getMensaje() %></td>
|
||||
<td align="center" class="cabeceraTabla" bgcolor="#FFAAAA"><%=pertamensaje.obtenerMensaje(55).getMensaje() %></td>
|
||||
<td align="center" class="cabeceraTabla" bgcolor="#FFAAAA"><%=pertamensaje.obtenerMensaje(56).getMensaje() %></td>
|
||||
<td align="center" class="cabeceraTabla" bgcolor="#FFAAAA"><%=pertamensaje.obtenerMensaje(57).getMensaje() %></td>
|
||||
<td align="center" class="cabeceraTabla" bgcolor="#FFAAAA"><%=pertamensaje.obtenerMensaje(17).getMensaje() %></td>
|
||||
</tr>
|
||||
<%
|
||||
//while(resul.next())
|
||||
int i=0;
|
||||
do{
|
||||
if(fondo)
|
||||
{
|
||||
fondo = false;
|
||||
%>
|
||||
<tr class="filaA trResultados">
|
||||
<%
|
||||
}
|
||||
else
|
||||
{
|
||||
fondo = true;
|
||||
%>
|
||||
<tr class="filaB trResultados">
|
||||
<%
|
||||
}
|
||||
|
||||
if(retencion)
|
||||
{
|
||||
%>
|
||||
<td align="center"><%=vSeleccion.elementAt(i).toString().trim() %></td>
|
||||
<td align="center"><%=df.format(vSeleccion.elementAt(i+1)) %></td>
|
||||
<td align="center"><%=df.format(vSeleccion.elementAt(i+3)) %></td>
|
||||
<td align="center"><%=df.format(vSeleccion.elementAt(i+2)) %></td>
|
||||
<td align="center">
|
||||
<form name="frmLiquidacion" action="historico_liquidacion.jsp?x=<%=strParametroMenu%>" method="post" style="margin-bottom: 0px">
|
||||
<input type="hidden" name="pagina" value="1"/>
|
||||
<input type="hidden" value="<%=vSeleccion.elementAt(i).toString().trim() %>" name="mes"/>
|
||||
<input type="submit" value="Ver" class="enlace"/>
|
||||
</form>
|
||||
</td>
|
||||
<%
|
||||
i=i+4;
|
||||
}
|
||||
else
|
||||
{
|
||||
%>
|
||||
<td align="center"><%=vSeleccion.elementAt(i).toString().trim() %></td>
|
||||
<td align="center"><%=df.format(vSeleccion.elementAt(i+1)) %></td>
|
||||
<td align="center"></td>
|
||||
<td align="center"><%=df.format(vSeleccion.elementAt(i+2)) %></td>
|
||||
<td align="center">
|
||||
<form name="frmLiquidacion" action="historico_liquidacion.jsp?x=<%=strParametroMenu%>" method="post" style="margin-bottom: 0px">
|
||||
<input type="hidden" name="pagina" value="1"/>
|
||||
<input type="hidden" value="<%=vSeleccion.elementAt(i).toString().trim() %>" name="mes"/>
|
||||
<input type="submit" value="Ver" class="enlace"/>
|
||||
</form>
|
||||
</td>
|
||||
<%
|
||||
i=i+3;
|
||||
}
|
||||
%>
|
||||
</tr>
|
||||
<%
|
||||
|
||||
}while(i<vSeleccion.size());
|
||||
%>
|
||||
</tr>
|
||||
</table>
|
||||
<%
|
||||
}
|
||||
else
|
||||
{
|
||||
//Ha seleccionado un mes/año, generamos la tabla en hmtl y si no existe el PDF
|
||||
/*String file="/root/apache-tomcat-6.0.20/webapps/tarisan/liquidaciones/"+medico+"_"+strMes.toString().replace('/', '_')+".pdf";
|
||||
String file_detalle="/root/apache-tomcat-6.0.20/webapps/tarisan/liquidaciones/detalle_"+medico+"_"+strMes.toString().replace('/', '_')+".pdf";*/
|
||||
String file=ParametrosConfiguracion.ruta_pdf_liquidaciones+medico+"_"+strMes.toString().replace('/', '_')+".pdf";
|
||||
String file_detalle=ParametrosConfiguracion.ruta_pdf_liquidaciones+"detalle_"+medico+"_"+strMes.toString().replace('/', '_')+".pdf";
|
||||
boolean exists = (new File(file)).exists();
|
||||
boolean exists_detalle = (new File(file_detalle)).exists();
|
||||
boolean generado = false;
|
||||
boolean generado_detalle = false;
|
||||
Font fuente= new Font(Font.getFamily("ARIAL"), 12, Font.BOLD);
|
||||
|
||||
String encabezado = null;
|
||||
String detalles_fra = null;
|
||||
String pie = null;
|
||||
Document documento = new Document(PageSize.A4);
|
||||
|
||||
/*Ahora definimos la tabla donde el arguemento recibido indica el numero de columnas y la propiedad setWidthPercentage permite indicarle que ocupe todo el ancho de la pagina*/
|
||||
float[] colsWidth = {1f, 4f, 1f, 1f, 1f};
|
||||
//PdfPTable table = new PdfPTable(colsWidth);
|
||||
PdfPTable tabla=new PdfPTable(colsWidth);
|
||||
tabla.setWidthPercentage(100);
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
int medico_origen = medico;
|
||||
PersistenciaTaliquimedi per = new PersistenciaTaliquimedi();
|
||||
boolean retencion = per.tiene_retencion_por_taliquimedico(medico);
|
||||
if (!exists)
|
||||
{
|
||||
//no existe el pdf de la liquidación que quiere ver, la generamos para que se guarde y poderla mostrar si quiere.
|
||||
//para evitar añadir varios pies si el fichero se generó en una consulta anterior
|
||||
generado = true;
|
||||
|
||||
/*Está generando el pdf, luego ha pulsado en el detalle de la liquidación: lo metemos en el log:
|
||||
medico, fecha, fecha_peticion, correlativo, tabla, sentencia, observaciones
|
||||
*/
|
||||
|
||||
SimpleDateFormat sdfFormateadorFecha = new SimpleDateFormat("dd/MM/yyyy");
|
||||
java.sql.Date dtFecha = new java.sql.Date(Calendar.getInstance().getTime().getTime());
|
||||
sdfFormateadorFecha.format(dtFecha);
|
||||
java.sql.Timestamp timeStampDate = new Timestamp(dtFecha.getTime());
|
||||
PersistenciaTareglog per_ta = new PersistenciaTareglog();
|
||||
Integer sig_correlativo = per_ta.obtenerUltimoValorCorrelativo(medico,timeStampDate);
|
||||
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(dtFecha);
|
||||
per_ta.insertarLog(medico, timeStampDate, cal, sig_correlativo, "liquidaxs", "genera el pdf", "el medico accede al histórico de liquidaciones y consulta el mes "+strMes+" generando el pdf correspondiente");
|
||||
|
||||
//obtenemos los datos del médico necesarios, primero vemos el médico origen:
|
||||
medico_origen = per.obtener_medico_origen(medico);
|
||||
|
||||
PersistenciaVTTbancosTamedico perTtbanTamed = new PersistenciaVTTbancosTamedico();
|
||||
Vector vSeleccion = perTtbanTamed.obtenerMedico_por_medico_y_mes(medico, strMes, intPagina);
|
||||
|
||||
if (vSeleccion.size()!=0) //Se han encontrado datos
|
||||
{
|
||||
VTtbancosTamedico vTtbancosTamedico = null;
|
||||
vTtbancosTamedico = (VTtbancosTamedico)vSeleccion.elementAt(0);
|
||||
|
||||
String nif = vTtbancosTamedico.getNif();
|
||||
String nombre = vTtbancosTamedico.getNombre().trim();
|
||||
String apellidos = vTtbancosTamedico.getApellidos();
|
||||
String direccion = vTtbancosTamedico.getDireccion();
|
||||
String cp = vTtbancosTamedico.getCp();
|
||||
String poblacion = vTtbancosTamedico.getPoblacion();
|
||||
String descripcion = vTtbancosTamedico.getDescripcion();
|
||||
int sucursal = vTtbancosTamedico.getIban_sucursal();
|
||||
String cuenta = vTtbancosTamedico.getIban_cuenta().trim();
|
||||
|
||||
if(medico_origen != medico)
|
||||
{
|
||||
Vector vSeleccion2 = perTtbanTamed.obtenerMedico_por_medico_origen(medico_origen, intPagina);
|
||||
if (vSeleccion2.size()!=0) //Se han encontrado datos
|
||||
{
|
||||
VTtbancosTamedico vTtbancosTamedico2 = null;
|
||||
vTtbancosTamedico2 = (VTtbancosTamedico)vSeleccion2.elementAt(0);
|
||||
|
||||
nif = vTtbancosTamedico2.getNif();
|
||||
nombre = vTtbancosTamedico2.getNombre().trim();
|
||||
apellidos = vTtbancosTamedico2.getApellidos();
|
||||
direccion = vTtbancosTamedico2.getDireccion();
|
||||
cp = vTtbancosTamedico2.getCp();
|
||||
poblacion = vTtbancosTamedico2.getPoblacion();
|
||||
descripcion = vTtbancosTamedico2.getDescripcion();
|
||||
sucursal = vTtbancosTamedico2.getIban_sucursal();
|
||||
cuenta = vTtbancosTamedico2.getIban_cuenta().trim();
|
||||
}
|
||||
}
|
||||
encabezado="Factura Para: "+medico_origen+"\n"+"Igual. Med. Qui. y de E. De Navarra S.A."+"\n"+"AVENIDA BAYONA 4"+"\n"+"31011 PAMPLONA"+"\n"+"CIF: A31005432"+"\n"+"\n";
|
||||
|
||||
detalles_fra="\nHonorarios del: "+strMes+"\n"+ "Fecha Factura: "+String.format("%1$te/%1$tm/%1$tY", vTtbancosTamedico.getFecha_factura())+"\n Factura Numero: "+medico_origen+"/"+vTtbancosTamedico.getFactura()+" N.I.F: "+nif+"\n"+"\n"+"\n"+"\n";
|
||||
|
||||
float[] columnas = {1f, 1f};
|
||||
PdfPTable detalles_medico=new PdfPTable(columnas);
|
||||
PdfPCell celda01 = new PdfPCell();
|
||||
celda01.setBorder(0);
|
||||
detalles_medico.addCell(celda01);
|
||||
PdfPCell celda02 = new PdfPCell(new Paragraph(nombre+" "+apellidos+"\n"+direccion+"\n"+cp+" "+poblacion+"\n",FontFactory.getFont("arial",10,Font.NORMAL,BaseColor.BLACK)));
|
||||
celda02.setBorder(0);
|
||||
detalles_medico.addCell(celda02);
|
||||
|
||||
|
||||
|
||||
//prueba:
|
||||
Paragraph linea = new Paragraph(encabezado,fuente);
|
||||
|
||||
//Definimos un parrafo
|
||||
Phrase para=new Phrase(detalles_fra,FontFactory.getFont("arial",10,Font.NORMAL,BaseColor.BLACK));
|
||||
|
||||
|
||||
//El pie tambión es un párrafo
|
||||
SimpleDateFormat formatearFecha = new SimpleDateFormat("dd 'de' MMMM 'de' yyyy");
|
||||
//String.format("%1$te/%1$tm/%1$tY", result.getDate("FECHA_FACTURA")
|
||||
pie = "Banco: "+descripcion+"\nSucursal: "+sucursal+"\nCuenta: "+cuenta+" Pamplona a "+formatearFecha.format(vTtbancosTamedico.getFecha_factura());
|
||||
|
||||
//Pasamos la fecha a un String y la agregamos a un parrafo
|
||||
Paragraph fecha=new Paragraph(String.format("%1$te/%1$tm/%1$tY", vTtbancosTamedico.getFecha_factura())+"\n"+"\n");
|
||||
|
||||
//Ahora definimos la tabla donde el arguemento recibido indica el numero de columnas y la propiedad setWidthPercentage permite indicarle que ocupe todo el ancho de lapagina*/
|
||||
|
||||
PdfWriter.getInstance(documento, new FileOutputStream(file));
|
||||
documento.open();
|
||||
documento.add(linea);
|
||||
documento.add(detalles_medico);
|
||||
documento.add(para);
|
||||
|
||||
PdfPCell celda1 =new PdfPCell (new Paragraph("Cód. Acto",FontFactory.getFont("arial",10,Font.BOLD,BaseColor.RED)));
|
||||
PdfPCell celda2 =new PdfPCell (new Paragraph("Descripción",FontFactory.getFont("arial",10,Font.BOLD,BaseColor.RED)));
|
||||
PdfPCell celda3 =new PdfPCell (new Paragraph("Cant.",FontFactory.getFont("arial",10,Font.BOLD,BaseColor.RED)));
|
||||
PdfPCell celda4 =new PdfPCell (new Paragraph("Precio",FontFactory.getFont("arial",10,Font.BOLD,BaseColor.RED)));
|
||||
PdfPCell celda5 =new PdfPCell (new Paragraph("Importe",FontFactory.getFont("arial",10,Font.BOLD,BaseColor.RED)));
|
||||
|
||||
celda1.setBorder(1);
|
||||
celda1.setBorderWidthTop(1);
|
||||
celda1.setBorderWidthBottom(1);
|
||||
celda1.setHorizontalAlignment(Element.ALIGN_RIGHT);
|
||||
celda1.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
||||
celda2.setBorder(1);
|
||||
celda2.setBorderWidthTop(1);
|
||||
celda2.setBorderWidthBottom(1);
|
||||
celda2.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
||||
celda3.setBorder(1);
|
||||
celda3.setBorderWidthTop(1);
|
||||
celda3.setBorderWidthBottom(1);
|
||||
celda3.setHorizontalAlignment(Element.ALIGN_RIGHT);
|
||||
celda3.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
||||
celda4.setBorder(1);
|
||||
celda4.setBorderWidthTop(1);
|
||||
celda4.setBorderWidthBottom(1);
|
||||
celda4.setHorizontalAlignment(Element.ALIGN_RIGHT);
|
||||
celda4.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
||||
celda5.setBorder(1);
|
||||
celda5.setBorderWidthTop(1);
|
||||
celda5.setBorderWidthBottom(1);
|
||||
celda5.setHorizontalAlignment(Element.ALIGN_RIGHT);
|
||||
celda5.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
||||
tabla.addCell(celda1);
|
||||
tabla.addCell(celda2);
|
||||
tabla.addCell(celda3);
|
||||
tabla.addCell(celda4);
|
||||
tabla.addCell(celda5);
|
||||
|
||||
}
|
||||
}
|
||||
PersistenciaTaliquimedidet perTaDet = new PersistenciaTaliquimedidet();
|
||||
|
||||
int mes = Integer.parseInt(((String)strMes).substring(0, 2));
|
||||
int anio = Integer.parseInt(((String)strMes).substring(3));
|
||||
generado_detalle = perTaDet.generarPdfDetalle(medico, mes, anio);
|
||||
Double importe = 0.0;
|
||||
|
||||
Vector vSeleccion = per.listado_detalle_liquidaciones_medicos(medico, strMes, intPagina);
|
||||
%>
|
||||
<p style="text-align:center;margin:0px auto;"><span class="tituloTabla"><%=pertamensaje.obtenerMensaje(58).getMensaje() %> <%=request.getParameter("mes") %></p></span><br/>
|
||||
<%
|
||||
%>
|
||||
<table border="0" width="90%" align="center">
|
||||
<%
|
||||
if (vSeleccion.size()==0) //No se han encontrado datos
|
||||
{
|
||||
%>
|
||||
<tr>
|
||||
<td colspan="2"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="center"><span class="txt"><% tamensaje = pertamensaje.obtenerMensaje(10); %><%=tamensaje.getMensaje() %></span></td>
|
||||
</tr>
|
||||
<%
|
||||
}
|
||||
else
|
||||
{
|
||||
%>
|
||||
<tr class="tituloTabla">
|
||||
<td align="center" class="cabeceraTabla" bgcolor="#FFAAAA"><%=pertamensaje.obtenerMensaje(40).getMensaje() %></td>
|
||||
<td align="center" class="cabeceraTabla" bgcolor="#FFAAAA"><%=pertamensaje.obtenerMensaje(41).getMensaje() %></td>
|
||||
<td align="center" class="cabeceraTabla" bgcolor="#FFAAAA"><%=pertamensaje.obtenerMensaje(59).getMensaje() %></td>
|
||||
<td align="center" class="cabeceraTabla" bgcolor="#FFAAAA"><%=pertamensaje.obtenerMensaje(42).getMensaje() %></td>
|
||||
<td align="center" class="cabeceraTabla" bgcolor="#FFAAAA"><%=pertamensaje.obtenerMensaje(60).getMensaje() %></td>
|
||||
</tr>
|
||||
<%
|
||||
boolean fondo = true;
|
||||
DecimalFormat df = new DecimalFormat("#.##");
|
||||
Taliquimedi taliquimedi = null;
|
||||
for(int i = 0; i < vSeleccion.size(); i++)
|
||||
{
|
||||
|
||||
if(fondo)
|
||||
{
|
||||
fondo = false;
|
||||
%>
|
||||
<tr class="filaA trResultados">
|
||||
<%
|
||||
}
|
||||
else
|
||||
{
|
||||
fondo = true;
|
||||
%>
|
||||
<tr class="filaB trResultados">
|
||||
<%
|
||||
}
|
||||
taliquimedi = (Taliquimedi)vSeleccion.elementAt(i);
|
||||
String act = String.valueOf(taliquimedi.getActo());
|
||||
String cant = String.valueOf(taliquimedi.getCantidad());
|
||||
%>
|
||||
<td cellspacing="1"><span class="txt"><%=act.trim() %></span></td>
|
||||
<td><span class="txt"><%=taliquimedi.getDescripcion().trim() %></span></td>
|
||||
<td align="right"><span class="txt"><%=cant.trim() %></span></td>
|
||||
<td align="right"><span class="txt"><%=df.format(taliquimedi.getPrecio()) %></span></td>
|
||||
<td align="right"><span class="txt"><%=df.format(taliquimedi.getImporte()) %></span></td>
|
||||
</tr>
|
||||
<%
|
||||
if(generado)
|
||||
{
|
||||
//si generando el pdf genero la tabla para añadírsela
|
||||
|
||||
/*Definimos las celdas que seran los encabezados de la tabla*/
|
||||
PdfPCell celda1 =new PdfPCell (new Paragraph(act.trim(),FontFactory.getFont("arial",8,Font.NORMAL,BaseColor.BLACK)));
|
||||
PdfPCell celda2 =new PdfPCell (new Paragraph(taliquimedi.getDescripcion().trim(),FontFactory.getFont("arial",8,Font.NORMAL,BaseColor.BLACK)));
|
||||
PdfPCell celda3 =new PdfPCell (new Paragraph(cant.trim(),FontFactory.getFont("arial",8,Font.NORMAL,BaseColor.BLACK)));
|
||||
PdfPCell celda4 =new PdfPCell (new Paragraph(df.format(taliquimedi.getPrecio()),FontFactory.getFont("arial",8,Font.NORMAL,BaseColor.BLACK)));
|
||||
PdfPCell celda5 =new PdfPCell (new Paragraph(df.format(taliquimedi.getImporte()),FontFactory.getFont("arial",8,Font.NORMAL,BaseColor.BLACK)));
|
||||
|
||||
celda1.setBorder(0);
|
||||
celda1.setHorizontalAlignment(Element.ALIGN_RIGHT);
|
||||
celda1.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
||||
celda2.setBorder(0);
|
||||
celda3.setBorder(0);
|
||||
celda3.setHorizontalAlignment(Element.ALIGN_RIGHT);
|
||||
celda3.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
||||
celda4.setBorder(0);
|
||||
celda4.setHorizontalAlignment(Element.ALIGN_RIGHT);
|
||||
celda4.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
||||
celda5.setBorder(0);
|
||||
celda5.setHorizontalAlignment(Element.ALIGN_RIGHT);
|
||||
celda5.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
||||
|
||||
tabla.addCell(celda1);
|
||||
tabla.addCell(celda2);
|
||||
tabla.addCell(celda3);
|
||||
tabla.addCell(celda4);
|
||||
tabla.addCell(celda5);
|
||||
}
|
||||
importe = importe + taliquimedi.getImporte();
|
||||
}
|
||||
|
||||
/*
|
||||
Si el medico tiene retencion
|
||||
*/
|
||||
%>
|
||||
<tr><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
|
||||
<tr><td> </td><td><span class="txt"><%=pertamensaje.obtenerMensaje(61).getMensaje() %></span></td><td align="right"><span class="txt"> <%=df.format(importe) %></span></td><td> </td><td> </td></tr>
|
||||
<%
|
||||
Double irpf = 0.0;
|
||||
Double total = 0.0;
|
||||
if(retencion)
|
||||
{
|
||||
irpf = importe*0.15;
|
||||
total = importe - irpf;
|
||||
%>
|
||||
<tr><td> </td><td><span class="txt"><%=pertamensaje.obtenerMensaje(56).getMensaje() %>: </span></td><td align="right"><span class="txt"> <%=df.format(irpf) %></span></td><td> </td><td> </td></tr>
|
||||
<tr><td> </td><td><span class="txt"><%=pertamensaje.obtenerMensaje(62).getMensaje() %></span></td><td align="right"><span class="txt"> <%=df.format(total) %></span></td><td> </td><td> </td></tr>
|
||||
<%
|
||||
}
|
||||
else
|
||||
{
|
||||
total = importe;%>
|
||||
<tr><td> </td><td><span class="txt"><%=pertamensaje.obtenerMensaje(62).getMensaje() %></span></td><td align="right"><span class="txt"> <%=df.format(importe) %></span></td><td> </td><td> </td></tr>
|
||||
<%
|
||||
}
|
||||
%>
|
||||
<tr>
|
||||
<td> </td><td><span class="txt"><%=pertamensaje.obtenerMensaje(63).getMensaje() %></span></td>
|
||||
<td align="right"><span class="txt"> </span></td><td> </td><td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td align="left">
|
||||
<%
|
||||
String strMedico = ""+medico;
|
||||
DES encrypter = new DES(strMedico);
|
||||
String doc = medico +"_"+strMes.toString().replace('/', '_');
|
||||
String docEncriptado = encrypter.encrypt(doc);
|
||||
/*File ficheroPDF = new File(ParametrosConfiguracion.ruta_pdf_liquidaciones+medico +"_"+strMes.toString().replace('/', '_')+".pdf");*/
|
||||
File ficheroPDF = new File(ParametrosConfiguracion.ruta_pdf_liquidaciones+doc+".pdf");
|
||||
if(ficheroPDF.exists())
|
||||
{
|
||||
%>
|
||||
<form></form>
|
||||
<form name="frmLiqui" action="<%=request.getContextPath()%>/servlet/GestorPacientes" target="blank" method="post" style="margin-bottom: 0px">
|
||||
<input type="hidden" name="tipo" value="17"/>
|
||||
<input type="hidden" name="nombrePDF" value="<%=/*ficheroPDF.getName()*/docEncriptado%>" />
|
||||
<input type="hidden" name="OPCION" value="<%=Constantes.OPC_PAC_VER_PDF%>">
|
||||
<input type="submit" value="Ver PDF" class="enlace"/>
|
||||
</form>
|
||||
<%
|
||||
}
|
||||
else
|
||||
{
|
||||
%><p><span class="txt">No hay PDF</span></p><%
|
||||
}
|
||||
%>
|
||||
</td>
|
||||
<td align="right">
|
||||
<%
|
||||
String docDetalle = "detalle_"+medico +"_"+strMes.toString().replace('/', '_');
|
||||
String docDetalleEncriptado = encrypter.encrypt(docDetalle);
|
||||
File ficheroDetalle = new File(ParametrosConfiguracion.ruta_pdf_liquidaciones+docDetalle+".pdf");
|
||||
if(ficheroDetalle.exists())
|
||||
{
|
||||
%>
|
||||
<form name="frmLiquiDetalle" action="<%=request.getContextPath()%>/servlet/GestorPacientes" target="blank" method="post" style="margin-bottom: 0px">
|
||||
<input type="hidden" name="tipo" value="17"/>
|
||||
<input type="hidden" name="nombrePDF" value="<%=/*ficheroDetalle.getName()*/docDetalleEncriptado%>" />
|
||||
<input type="hidden" name="OPCION" value="<%=Constantes.OPC_PAC_VER_PDF%>">
|
||||
<input type="submit" value="Ver detalle" class="enlace"/>
|
||||
</form><%
|
||||
}
|
||||
else
|
||||
{
|
||||
%><p><span class="txt">No hay Detalle</span></p><%
|
||||
}
|
||||
%>
|
||||
</td>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<%
|
||||
|
||||
if(generado)
|
||||
{
|
||||
PdfPTable resumen=new PdfPTable(2);
|
||||
resumen.setWidthPercentage(40);
|
||||
PdfPCell celda1 =new PdfPCell (new Paragraph("Importe total:",FontFactory.getFont("arial",8,Font.NORMAL,BaseColor.BLACK)));
|
||||
celda1.setBorder(0);
|
||||
PdfPCell celda2 =new PdfPCell (new Paragraph(df.format(importe),FontFactory.getFont("arial",8,Font.NORMAL,BaseColor.BLACK)));
|
||||
celda2.setBorder(0);
|
||||
celda2.setHorizontalAlignment(Element.ALIGN_RIGHT);
|
||||
resumen.addCell(celda1);
|
||||
resumen.addCell(celda2);
|
||||
if(retencion)
|
||||
{
|
||||
celda1 =new PdfPCell (new Paragraph("I.R.P.F. ",FontFactory.getFont("arial",8,Font.NORMAL,BaseColor.BLACK)));
|
||||
celda2 =new PdfPCell (new Paragraph(df.format(irpf),FontFactory.getFont("arial",8,Font.NORMAL,BaseColor.BLACK)));
|
||||
celda1.setBorder(0);
|
||||
celda2.setBorder(0);
|
||||
celda2.setHorizontalAlignment(Element.ALIGN_RIGHT);
|
||||
resumen.addCell(celda1);
|
||||
resumen.addCell(celda2);
|
||||
}
|
||||
celda1 =new PdfPCell (new Paragraph("Total Liquidacion:",FontFactory.getFont("arial",8,Font.NORMAL,BaseColor.BLACK)));
|
||||
celda2 =new PdfPCell (new Paragraph(df.format(total),FontFactory.getFont("arial",8,Font.NORMAL,BaseColor.BLACK)));
|
||||
celda1.setBorder(0);
|
||||
celda2.setBorder(0);
|
||||
celda2.setHorizontalAlignment(Element.ALIGN_RIGHT);
|
||||
resumen.addCell(celda1);
|
||||
resumen.addCell(celda2);
|
||||
|
||||
|
||||
Paragraph fin=new Paragraph(pie,FontFactory.getFont("arial",8,Font.NORMAL,BaseColor.BLACK));
|
||||
|
||||
|
||||
documento.add(tabla);
|
||||
documento.add(new Paragraph("\n\n\n",FontFactory.getFont("arial",8,Font.NORMAL,BaseColor.BLACK)));
|
||||
documento.add(resumen);
|
||||
documento.add(new Paragraph("\n\n\n",FontFactory.getFont("arial",8,Font.NORMAL,BaseColor.BLACK)));
|
||||
documento.add(fin);
|
||||
documento.close();
|
||||
}
|
||||
importe = irpf = total = null;
|
||||
df = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
%>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
<script>
|
||||
var jsMostrarNoticia = <%=mostrarNoticia %>;
|
||||
if (!jsMostrarNoticia){
|
||||
document.getElementById('contenedorNoticia').style.display="none";
|
||||
}else{
|
||||
<% strNoticia = strNoticia.replaceAll("\"", "'"); %>
|
||||
var not = "<%=strNoticia %>";
|
||||
tamanioNoticia(not);
|
||||
marquee($('.tituloNoticia'), $('.marquee'),not);
|
||||
}
|
||||
</script>
|
||||
<%
|
||||
}
|
||||
catch(ExcepcionTarisan ex)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, ((Usuario)sesion.getAttribute("USUARIO")).getMedico() + " - ExcepcionTarisan: " + ex.getMensaje());
|
||||
sesion.setAttribute("ERROR", "ExcepcionTarisan: " + ex.getMensaje());
|
||||
response.sendRedirect("../error.jsp");
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, ((Usuario)sesion.getAttribute("USUARIO")).getMedico() + " - Exception: " + ex);
|
||||
sesion.setAttribute("ERROR", "ExcepcionTarisan: " + ex);
|
||||
response.sendRedirect("../error.jsp");
|
||||
}
|
||||
LogTarisan.logger.log(NivelLog.INFO, ((Usuario)sesion.getAttribute("USUARIO")).getMedico() + " - Final página del histórico de liquidaciones (med/historico_liquidacion.jsp)");
|
||||
}
|
||||
%>
|
||||
Reference in New Issue
Block a user