66 lines
3.1 KiB
Plaintext
Executable File
66 lines
3.1 KiB
Plaintext
Executable File
package com.fp.armas.rules.query.solicitud;
|
|
|
|
import java.math.BigDecimal;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
import javax.persistence.Query;
|
|
|
|
import com.fp.bpm.query.QueryJsf;
|
|
import com.fp.common.helper.Constant;
|
|
import com.fp.dto.query.QueryRequest;
|
|
import com.fp.dto.rules.QueryRule;
|
|
import com.fp.persistence.commondb.PersistenceHelper;
|
|
import com.fp.persistence.commondb.exception.CommondbException;
|
|
import com.fp.persistence.parmas.fun.TarmRegistroArmas;
|
|
import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo;
|
|
import com.fp.persistence.parmas.soli.CashManagementDTO;
|
|
import com.fp.persistence.parmas.soli.TarmArmas;
|
|
import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail;
|
|
import com.fp.persistence.pgeneral.gene.TgeneCatalogDetailKey;
|
|
import com.fp.persistence.pgeneral.gene.TgeneParameters;
|
|
import com.fp.persistence.pgeneral.gene.TgeneParametersKey;
|
|
|
|
/**
|
|
* Clase que obtiene los datos del reporte de cash management
|
|
* @author Christian Pazmino
|
|
*
|
|
*/
|
|
public class CashManagementQuery extends QueryRule {
|
|
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
String sql ="select 'CO' AS codigoServicio, sol.numerosolicitud as contrato, 'USD' AS moneda, "
|
|
+ "soltra.valorapagar AS valorapagar, 'REC' AS formaCobro, '' as tipoCuenta, '' as numeroCuenta, "
|
|
+ "tipaut.description as referencia, (case perdet.identificationcatalog when 'CED' then 'C' WHEN 'RUC' THEN 'R' WHEN 'PAS' THEN 'P' ELSE 'N' END) as tipoIDCliente, "
|
|
+ "perdet.identification as numeroIDCliente, perdet.name as nombreCliente,'1' as baseImponible, sol.csolicitud as csolicitud "
|
|
+ "from tarmsolicitud sol inner join tarmsolicitudtramite soltra on sol.csolicitud = soltra.csolicitud "
|
|
+ "left join tcustpersondetail perdet on sol.personcode = perdet.personcode and perdet.dateto = to_date('2999-12-31', 'YYYY-MM-DD') "
|
|
+ "left join tarmtramite tra on tra.ctramite = sol.ctramite "
|
|
+ "left join tgenecatalogdetail tipaut on tra.tipoautorizacion = tipaut.catalog and tra.tipoautorizacioncodigo = tipaut.catalogcode "
|
|
+ "where soltra.INCASHREPORT is null and soltra.numerocomprobante is null and soltra.estadotramite='REG' and soltra.valorapagar>0 "
|
|
+ "and trunc(sol.fverificarequisitos) >= to_date(':fechaInicialStr','DD/MM/RRRR') and trunc(sol.fverificarequisitos) <= to_date(':fechaFinalStr','DD/MM/RRRR')";
|
|
|
|
/**
|
|
* Completa datos del arma
|
|
*/
|
|
@SuppressWarnings("unchecked")
|
|
@Override
|
|
public QueryRequest process(QueryRequest pRequest) throws Exception {
|
|
String fechaInicialStr = pRequest.get("fechaInicialStr").toString();
|
|
String fechaFinalStr = pRequest.get("fechaFinalStr").toString();
|
|
sql=sql.replace(":fechaInicialStr", fechaInicialStr);
|
|
sql=sql.replace(":fechaFinalStr", fechaFinalStr);
|
|
Query qry = PersistenceHelper.getEntityManager().createNativeQuery(sql);
|
|
//qry.setParameter("fechaInicialStr", fechaInicialStr);
|
|
//qry.setParameter("fechaFinalStr", fechaFinalStr);
|
|
List<Object[]> lCashManagement = qry.getResultList();
|
|
pRequest.getResponse().put("CASHMANAGEMENTLIST", lCashManagement);
|
|
return pRequest;
|
|
}
|
|
|
|
|
|
|
|
}
|