Commit 9799426b by Angel Flores Chombile

prueba 2

parent bedac82e
......@@ -4,3 +4,4 @@ nbbuild/
*.war
nbdist/
.nb-gradle/
/dist/
\ No newline at end of file
......@@ -20,13 +20,18 @@ public class EjecucionPrueba {
* @param args the command line arguments
*/
public static void main(String[] args) {
int codPension = 69541;
PensionService servicio = new PensionService();
JSONObject resultado = servicio.ComprobanteElectronico(codPension);
System.out.println("RESULTADO JSON --->" + resultado);
// int codPension = 75738;
// PensionService servicio = new PensionService();
// JSONObject resultado = servicio.ComprobanteElectronico(codPension);
// System.out.println("RESULTADO JSON --->" + resultado);
String texto = "Número correlativo Correlativo fuera del rango permitido,"
+ " el último número registrado en NubeFacT para este documento y"
+ " serie es el 1980. Se aceptan sólo 20 correlativos siguientes.";
String separarcoma=(texto.replaceAll("[a-zA-Z^a-zA-Z.,úó]","")).replace(" ", "");//.substring(0,4);
int cantidad = Integer.parseInt((texto.replaceAll("[a-zA-Z^a-zA-Z.,úó]","")).replace(" ", ""));
System.out.println(cantidad);
// separarcoma[0]
}
}
......@@ -37,5 +37,8 @@ public interface PensionDAO {
public JSONArray tipoNotaDeCredito()throws Exception;
public int GuardarJsonErrorNubeFact(JSONObject jsonNubefact,String motivo,int codPagoCuota,String codsede,String estado_nubefact) throws Exception;
public JSONArray listarBackupErrorNubeFact()throws Exception;
public int DeshabilitarBackup(int codbackupNubefact)throws Exception;
// public int ultimoCorrelativoNubeFact(int )
}
......@@ -42,9 +42,9 @@ public class MySqlDAOFactory extends DAOFactory {
try {
conexion = DriverManager.getConnection(
"jdbc:mysql://172.16.2.38:3306/academianew",
"jdbc:mysql://localhost:3306/academianew",
"root",
"mysql123");
"mysql2018");
// "jdbc:mysql://172.16.0.18:3306/academianew",
// "backup",
// "mysql2016");
......
......@@ -164,7 +164,7 @@ public class MySqlMatriculaDAO implements MatriculaDAO {
+ "AND codTipoGrado = " + idTipo + " \n"
+ "GROUP BY codGrado ";
ResultSet rs = st.executeQuery(query);
System.out.println(" listarGrados --->>" + query);
while (rs.next()) {
Matricula mat = new Matricula();
mat.setCod_Ciclo(rs.getString("codGrado"));
......@@ -390,7 +390,7 @@ public class MySqlMatriculaDAO implements MatriculaDAO {
String query = "select COUNT(codpagocuota) AS cantidad \n"
+ "from matricula AS m INNER JOIN \n"
+ "pagocuota AS p ON p.codmatricula = m.cod_matricula\n"
+ "WHERE p.estado not in (0,2) AND m.cod_matricula = "+cod_matricula+";";
+ "WHERE p.estado not in (0,2) AND m.cod_matricula = " + cod_matricula + ";";
ResultSet rs = st.executeQuery(query);
System.out.println(" ddddd \n" + query);
while (rs.next()) {
......
......@@ -257,7 +257,7 @@ public class MySqlMatriculadosDAO implements MatriculadosDAO {
+ " (IF(e.estado=1,IF((select COUNT(1) from pagocuota pc WHERE codmatricula=pg.codmatricula and estado=0)>0,1,0),0)) estado,\n"
+ "(select count(*) from matricula as mt where mt.cod_estud_matri=e.codestudiante ) as cantidadM,\n"
+ "uni.coduniversidad,\n"
+ "uni.nomuniversidad\n"
+ " uni.nomuniversidad,e.estado estado_estudiante "
+ " \n"
+ " FROM estudiante AS e \n"
+ " LEFT JOIN matricula AS m ON e.codestudiante = m.cod_estud_matri\n"
......@@ -296,7 +296,7 @@ public class MySqlMatriculadosDAO implements MatriculadosDAO {
matriculados.setCodTurno(rs.getString("idturno"));
matriculados.setNomTurno(rs.getString("turno"));
matriculados.setSeccion(rs.getString("seccion"));
matriculados.setEstado_m(Integer.parseInt(rs.getString("estado")));
matriculados.setEstado_m(Integer.parseInt(rs.getString("estado_estudiante")));
matriculados.setFecha_m(rs.getString("fechaMatricula"));
matriculados.setCant_matricula(Integer.parseInt(rs.getString("cantidadM")));
lista.add(matriculados);
......@@ -812,7 +812,7 @@ public class MySqlMatriculadosDAO implements MatriculadosDAO {
+ "m.seccion,\n"
+ "pg.fecha_pago,p.cadPension,\n"
+ "pg.pagado,\n"
+ "sum(pg.monto)as suma_pensiones,\n"
+ "sum(pg.monto-pg.monto_dscto)as suma_pensiones,\n"
+ "COUNT(m.cod_matricula)as coutas,\n"
+ "pg.fraccion\n"
+ "from matricula as m \n"
......@@ -827,7 +827,7 @@ public class MySqlMatriculadosDAO implements MatriculadosDAO {
+ "LEFT JOIN academia_ciclo as cl ON a.codGrado = cl.idciclo\n"
+ "\n"
+ "LEFT JOIN academia_turno as t ON a.codTurno = t.idturno\n"
+ "WHERE s.idlocal=" + cod_sede + " and pg.estado=0 " + sentencia + " GROUP BY m.cod_matricula HAVING 1=1" + having1 + " ORDER BY COUNT(m.cod_matricula) desc,m.cod_matricula DESC LIMIT " + inicio + "," + cantidad + " ;";
+ "WHERE s.idlocal=" + cod_sede + " and pg.estado=0 " + sentencia + " GROUP BY m.cod_matricula HAVING 1=1 and suma_pensiones>0 " + having1 + " ORDER BY COUNT(m.cod_matricula) desc,m.cod_matricula DESC LIMIT " + inicio + "," + cantidad + " ;";
ResultSet rs = st.executeQuery(query);
//System.out.println("Listar Deudores \n"+query);
......
......@@ -8,6 +8,7 @@ import java.util.ArrayList;
import java.util.Date;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import pe.siso.academia.Beans.Cierre;
import pe.siso.academia.Beans.Pension;
......@@ -258,7 +259,7 @@ public class MySqlPensionDAO implements PensionDAO {
// numero_de_serie = Integer.parseInt(generarNumBoleta(codSede).trim().split("-")[0]);
}
query = "INSERT INTO pagocuota(codmatricula,codpension,monto,efectivo,pagado,devol_monto,nom_dscto,monto_dscto,estado,fraccion,fecha_pago,fecha_anulacion,num_docu,num_serie,usuario_gestor,ref_num_docu,tipo_documento,tipo_nota_credito,ref_serie_docu,ref_tipo_de_comprobante,detalles) \n"
+ "(SELECT codmatricula,codpension,0," + monto * (-1) + ",'" + monto * (-1) + "','" + monto + "',nom_dscto,0,\"3\",fraccion,'" + fecha_actual + "','" + fecha_actual + "','" + numero_de_docum + "',num_serie,usuario_gestor,num_docu,'NOTA DE CREDITO'," + tipo_nota_credito + ",num_serie," + ref_tipo_de_comprobante + ",'" + motivo + "' FROM pagocuota WHERE codpagocuota =" + codPension + ");";
+ "(SELECT codmatricula,codpension,"+monto*(-1)+"," + monto * (-1) + ",'" + monto * (-1) + "',monto,nom_dscto,0,\"3\",fraccion,'" + fecha_actual + "','" + fecha_actual + "','" + numero_de_docum + "',num_serie,usuario_gestor,num_docu,'NOTA DE CREDITO'," + tipo_nota_credito + ",num_serie," + ref_tipo_de_comprobante + ",'" + motivo + "' FROM pagocuota WHERE codpagocuota =" + codPension + ");";
r = st.executeUpdate(query);
ResultSet rs1 = st.getGeneratedKeys();
while (rs1.next()) {
......@@ -399,7 +400,8 @@ public class MySqlPensionDAO implements PensionDAO {
String base = "academianew";
Connection cnx = MySqlDAOFactory.obtenerConexion(base);
Statement st = cnx.createStatement();
String query = "SELECT COUNT(*) AS cantidad FROM pagocuota WHERE estado <> 0 AND codmatricula = " + codmatricula;
String query = "SELECT COUNT(*) AS cantidad FROM pagocuota WHERE estado not in (0,7) AND codmatricula = " + codmatricula;
System.out.println("verificarPensionesActualizarMatri .--->" + query);
ResultSet rs = st.executeQuery(query);
while (rs.next()) {
if (rs.getInt("cantidad") > 0) {
......@@ -706,7 +708,7 @@ public class MySqlPensionDAO implements PensionDAO {
Connection cnx = MySqlDAOFactory.obtenerConexion(base);
Statement st = cnx.createStatement();
String query = "SELECT pc.estado,pc.tipo_documento,CONCAT(IF(pc.tipo_documento=\"CPE BOLETA\" or ref_tipo_de_comprobante=2,\"B\",\"F\"),LPAD(pc.num_serie,3,\"0\")) serie,pc.num_docu,e.dni,CONCAT(TRIM(e.paterno),\" \",TRIM(e.materno),\", \",TRIM(e.nombres)) AS cliente,\n"
+ "s.deslocal,e.correo,pc.fecha_pago,pc.pagado,pc.detalles observacion ,CONCAT(n.nivel,\" \",ci.ciclo,\"/\",t.turno,\" (\",pe.desPension,\")\") ciclo ,ruc,razon_social,pc.ref_num_docu,pc.tipo_nota_credito,CONCAT(IF(pc.ref_tipo_de_comprobante=2,\"B\",\"F\"),LPAD(pc.ref_serie_docu,3,\"0\")) ref_serie_docu,ref_tipo_de_comprobante,ed.tip_moneda,pc.monto_dscto,pc.monto\n"
+ "s.deslocal,e.correo,pc.fecha_pago,pc.pagado,pc.detalles observacion ,CONCAT(n.nivel,\" \",ci.ciclo,\"/\",t.turno,\" (\",pe.desPension,\")\") ciclo ,ruc,razon_social,pc.ref_num_docu,pc.tipo_nota_credito,CONCAT(IF(pc.ref_tipo_de_comprobante=2,\"B\",\"F\"),LPAD(pc.ref_serie_docu,3,\"0\")) ref_serie_docu,ref_tipo_de_comprobante,ed.tip_moneda,pc.monto_dscto,pc.monto,pc.devol_monto\n"
+ ",usu.nubefact_token \n"
+ "FROM pagocuota AS pc \n"
+ "INNER JOIN matricula AS m ON pc.codmatricula = m.cod_matricula \n"
......@@ -823,32 +825,61 @@ public class MySqlPensionDAO implements PensionDAO {
jsonConcat.put("moneda", "1");
jsonConcat.put("tipo_de_cambio", "");
jsonConcat.put("porcentaje_de_igv", "18.00");
if (rs.getInt("tip_moneda") == 1) {
jsonConcat.put("descuento_global", rs.getDouble("monto_dscto"));
// if (rs.getInt("tip_moneda") == 1) {
// jsonConcat.put("descuento_global", rs.getDouble("monto_dscto"));
// jsonConcat.put("total_inafecta", rs.getDouble("monto"));// total inicial
// jsonConcat.put("total", totalPagado); //total neto
//// item
// detalle_comprobante.put("valor_unitario", rs.getDouble("monto"));
// detalle_comprobante.put("precio_unitario", rs.getDouble("monto"));
// detalle_comprobante.put("subtotal", rs.getDouble("monto"));
// detalle_comprobante.put("total", rs.getDouble("monto"));
//
// } else {
if (rs.getDouble("monto_dscto") == rs.getDouble("monto")) {
if (rs.getDouble("monto")==0) {
detalle_comprobante.put("tipo_de_igv", 14);
detalle_comprobante.put("gratuito", rs.getDouble("devol_monto"));
jsonConcat.put("total_gratuita", rs.getDouble("devol_monto"));
jsonConcat.put("total_inafecta", rs.getDouble("devol_monto"));// total inicial
detalle_comprobante.put("valor_unitario", rs.getDouble("devol_monto"));
detalle_comprobante.put("precio_unitario", rs.getDouble("devol_monto"));
detalle_comprobante.put("subtotal", rs.getDouble("devol_monto"));
detalle_comprobante.put("total", rs.getDouble("devol_monto"));
jsonConcat.put("total", totalPagado);
}else{
detalle_comprobante.put("tipo_de_igv", 14);
detalle_comprobante.put("gratuito", rs.getDouble("monto"));
jsonConcat.put("total_gratuita", rs.getDouble("monto"));
jsonConcat.put("total_inafecta", rs.getDouble("monto"));// total inicial
jsonConcat.put("total", totalPagado); //total neto
// item
detalle_comprobante.put("valor_unitario", rs.getDouble("monto"));
detalle_comprobante.put("precio_unitario", rs.getDouble("monto"));
detalle_comprobante.put("subtotal", rs.getDouble("monto"));
detalle_comprobante.put("total", rs.getDouble("monto"));
jsonConcat.put("total", totalPagado);
}
} else {
jsonConcat.put("descuento_global", "");
jsonConcat.put("total_inafecta", totalPagado);// total inicial
detalle_comprobante.put("tipo_de_igv", "9");
jsonConcat.put("total", totalPagado); //total neto
// item
jsonConcat.put("total_inafecta", totalPagado);// total inicial
detalle_comprobante.put("valor_unitario", totalPagado);
detalle_comprobante.put("precio_unitario", totalPagado);
detalle_comprobante.put("subtotal", totalPagado);
detalle_comprobante.put("subtotal", totalPagado);
detalle_comprobante.put("total", totalPagado);
}
jsonConcat.put("descuento_global", "");
jsonConcat.put("total_anticipo", "");
jsonConcat.put("total_gravada", "");
jsonConcat.put("total_exonerada", "");
jsonConcat.put("total_igv", "");
jsonConcat.put("total_gratuita", "");
// jsonConcat.put("total_gratuita", "");
jsonConcat.put("total_otros_cargos", "");
jsonConcat.put("percepcion_tipo", "");
jsonConcat.put("percepcion_base_imponible", "");
......@@ -874,7 +905,7 @@ public class MySqlPensionDAO implements PensionDAO {
detalle_comprobante.put("descuento", "");
detalle_comprobante.put("tipo_de_igv", "9");
// detalle_comprobante.put("tipo_de_igv", "9");
detalle_comprobante.put("igv", "0");
detalle_comprobante.put("anticipo_regularizacion", "false");
detalle_comprobante.put("anticipo_serie", "");
......@@ -997,5 +1028,17 @@ public class MySqlPensionDAO implements PensionDAO {
jsonResultado.add(jsonNubeFact);
}
cnx.close();
return jsonResultado; }
return jsonResultado;
}
@Override
public int DeshabilitarBackup(int codbackupNubefact) throws Exception {
String base = "academianew";
Connection cnx = MySqlDAOFactory.obtenerConexion(base);
Statement st = cnx.createStatement();
String query = "UPDATE cuotaspago_nubefact SET estado_nubefact='0' WHERE cod_nubesfact=" + codbackupNubefact + " ;";
int rs = st.executeUpdate(query);
cnx.close();
return rs;
}
}
......@@ -234,7 +234,7 @@ public class PensionService {
return jsonResultado;
}
public int GuardarJsonErrorNubeFact(JSONObject jsonNubefact,String motivo, int codPagoCuota, String codsede,String estado_nubefact) {
public int GuardarJsonErrorNubeFact(JSONObject jsonNubefact, String motivo, int codPagoCuota, String codsede, String estado_nubefact) {
int resultado = 0;
try {
resultado = objPensionDAO.GuardarJsonErrorNubeFact(jsonNubefact, motivo, codPagoCuota, codsede, estado_nubefact);
......@@ -242,12 +242,22 @@ public class PensionService {
}
return resultado;
}
public JSONArray listarBackupErrorNubeFact(){
JSONArray jsonResultado=new JSONArray();
public JSONArray listarBackupErrorNubeFact() {
JSONArray jsonResultado = new JSONArray();
try {
jsonResultado=objPensionDAO.listarBackupErrorNubeFact();
jsonResultado = objPensionDAO.listarBackupErrorNubeFact();
} catch (Exception e) {
}
return jsonResultado;
}
public int DeshabilitarBackup(int codbackupNubefact) {
int resultado = 0;
try {
resultado = objPensionDAO.DeshabilitarBackup(codbackupNubefact);
} catch (Exception e) {
}
return resultado;
}
}
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