Añado los fuentes de java

This commit is contained in:
2025-06-09 13:37:06 +02:00
parent d6c990e5d5
commit a97a6350ee
226 changed files with 57246 additions and 0 deletions
@@ -0,0 +1,199 @@
/**
* @(#) PersistenciaTadremed.java
*/
package com.tarisan.control;
import com.tarisan.data.Taconaut;
import com.tarisan.data.Tadremed;
import com.tarisan.log.*;
import com.tarisan.util.DES;
import com.tarisan.util.Utilidades;
import com.tarisan.excepcion.ExcepcionTarisan;
import java.sql.*;
import java.util.Vector;
/**
* Controla los accesos a la persistencia para la entidad <code>Tadremed</code>.
* @author <a href="mailto:sistemas@imqnavarra.com">Dpto. Informática</a>.
* @version 1.0, 24/09/2003
*/
public class PersistenciaTadremed
{
/**
* El objeto <code>Paginacion</code> que controla el número de filas a mostrar por cada página.
*/
private Paginacion objPaginacion = new Paginacion();
/**
* Obtiene el valor del objeto <code>Paginacion</code> para saber que página se está visualizando.
* @return El objeto <code>Paginacion</code>.
*/
public Paginacion getPaginacion()
{
return objPaginacion;
}
/**
* Selecciona los registros de la tabla TADREMED en función de la sentencia SELECT indicada.
* @param sqlSelect La sentencia SELECT de selección.
* @param pagina Número de página a mostrar.
* @param aCondiciones Array que contiene los parámetros utilizados en la sentencia SELECT.
* @return El Vector con los registros seleccionados (todos pertenencientes a la clase <code>Tadremed</code>).
* @throws
*/
public Vector seleccionar(String sqlSelect/*, int pagina*/, Object[] aCondiciones) throws ExcepcionTarisan
{
/*int elementosPaginacion=1;*/
Vector vResultado = new Vector();
Tadremed tadremed = null;
try
{
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect, aCondiciones);
/*objPaginacion.inicializarPaginacion(rs);
if (objPaginacion.getNumeroRegistrosTotales()!=0)
{
objPaginacion.realizarPaginacion(rs, pagina); */
while(rs.next() /*&& (elementosPaginacion <= Paginacion.getFilasPorPagina())*/)
{
tadremed = new Tadremed();
tadremed.setFecha(rs.getDate("FECHA"));
tadremed.setIrpf(rs.getDouble("IRPF"));
tadremed.setImporte(rs.getDouble("IMPORTE"));
vResultado.addElement(tadremed);
/*if (pagina!=0) //Se quiere realizar la paginacion
elementosPaginacion++;*/
}
/*}*/
rs.close();
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados " + vResultado.size() + " registros de la tabla TADREMED (" + sqlSelect + ")");
}
catch (ExcepcionTarisan sqle)
{
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TADREMED: " + sqle + " (" + sqlSelect + ")");
throw (ExcepcionTarisan)sqle;
}
catch(SQLException sqle)
{
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TADREMED: " + sqle + " (" + sqlSelect + ")");
throw new ExcepcionTarisan(sqle.getMessage());
}
catch(Exception sqle)
{
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TADREMED: " + sqle + " (" + sqlSelect + ")");
throw new ExcepcionTarisan(sqle.getMessage());
}
catch(Throwable sqle)
{
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TADREMED: " + sqle + " (" + sqlSelect + ")");
throw new ExcepcionTarisan(sqle.getMessage());
}
return vResultado;
}
public Vector listado_detalle_irpf(String anio, int medico/*, int intPagina*/)
{
Vector resul = new Vector();
StringBuffer strSql = new StringBuffer();
Object [] aCondiciones = new Object[1];
String consulta = "";
strSql.append("SELECT FECHA, IRPF, IMPORTE");
strSql.append(" FROM TADREMED");
strSql.append(" WHERE MEDICO=?");
if (!anio.equalsIgnoreCase("")) //la sql tiene dos parametros
{
if (ParametrosConfiguracion.dataStore.getClass().getName().toUpperCase().indexOf("ORACLE") >= 0)
{
strSql.append(" AND EXTRACT(YEAR FROM FECHA) = ?");
}
else
{
strSql.append(" AND {fn YEAR(FECHA)} = ?");
}
//el array de objetos sera de dos elementos
aCondiciones = new Object[2];
aCondiciones[1] = Integer.valueOf(anio);
}
else //la sql tiene un parametro
//el array de objetos sera de un elemento
aCondiciones = new Object[1];
strSql.append(" ORDER BY FECHA");
aCondiciones[0] = Integer.valueOf(medico);
try {
resul = this.seleccionar(strSql.toString()/*, intPagina*/, aCondiciones);
consulta = Utilidades.obtenerSentenciaSQL(strSql, null, aCondiciones);
} catch (ExcepcionTarisan e) {
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de Tamedico_Taprescr (listado_prescripciones): " + e + " (" + consulta + ")");
}
return resul;
}
public Vector<Tadremed> ObtenerTotalesIrpf(int medico, String anio)
{
Vector<Tadremed> vResul = new Vector<Tadremed>();
Tadremed tadremed = null;
/*StringBuffer sqlSelect = new StringBuffer();*/
String consulta = "";
String fechaInicio = "01/01/"+anio;
String fechaFin = "31/12/"+anio;
try
{
/*sqlSelect.append("Select SUM(IMPORTE) AS IMPORTE, SUM(IRPF) AS IRPF from TADREMED ");
sqlSelect.append("where medico = ?");
sqlSelect.append("AND FECHA BETWEEN " + fechaInicio + " AND " + fechaFin);*/
consulta = "Select SUM(IMPORTE) AS IMPORTE, SUM(IRPF) AS IRPF ";
consulta += "from TADREMED ";
consulta += "where medico = ? ";
consulta += "AND FECHA BETWEEN TO_DATE('" + fechaInicio + "','DD/MM/YYYY') AND TO_DATE('" + fechaFin + "','DD/MM/YYYY')";
Object aCondiciones[] = new Object[1];
aCondiciones[0]=Integer.valueOf(medico);
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, consulta, aCondiciones);
while(rs.next())
{
tadremed = new Tadremed();
tadremed.setIrpfTotal(rs.getDouble("IRPF"));
tadremed.setImporteTotal(rs.getDouble("IMPORTE"));
vResul.addElement(tadremed);
}
rs.close();
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
}
catch (ExcepcionTarisan e)
{
LogTarisan.logger.log(NivelLog.ERROR, "ExcepcionTarisan: "+e.toString());
} catch (SQLException e) {
LogTarisan.logger.log(NivelLog.ERROR, "Excepcion SQL: "+e.toString());
}
return vResul;
}
}