agregar detalle servicio
This commit is contained in:
@@ -70,7 +70,26 @@ const agregarRecibo = async (folio, monto, fechaTicket, numeroCuenta) => {
|
||||
|
||||
return conn
|
||||
.query(
|
||||
`INSERT INTO recibo(folio_recibo, monto, fecha_recibo, fecha_registro, id_cuenta, id_usuario) values(${folio}, ${monto}, STR_TO_DATE('${fechaTicket}', '%m/%d/%Y'), now() ,${numeroCuenta}, 6)`
|
||||
`INSERT INTO recibo(folio_recibo, monto, fecha_recibo, fecha_registro, id_cuenta, id_usuario) values(${folio}, ${monto}, STR_TO_DATE('${fechaTicket}', '%m/%d/%Y'), now() ,${numeroCuenta}, 134)`
|
||||
)
|
||||
.then((rows) => {
|
||||
conn.end();
|
||||
return rows[0];
|
||||
})
|
||||
.catch((err) => {
|
||||
conn.end();
|
||||
throw new Error('Hubo un problema con el querry.' + err);
|
||||
});
|
||||
};
|
||||
|
||||
const agregarDetalleServicio = async (monto, numeroCuenta) => {
|
||||
const conn = await pool.getConnection().catch((err) => {
|
||||
throw new Error('No se pudo conectar con la db. ' + err);
|
||||
});
|
||||
|
||||
return conn
|
||||
.query(
|
||||
`INSERT INTO recibo(monto, numero_hojas, id_cuenta, id_servicio, id_usuario, id_periodo) values(${monto}, 0, ${numeroCuenta}, 4, 134)`
|
||||
)
|
||||
.then((rows) => {
|
||||
conn.end();
|
||||
@@ -87,4 +106,5 @@ module.exports = {
|
||||
obtenerCarrera,
|
||||
usuarioInscrito,
|
||||
agregarRecibo,
|
||||
agregarDetalleServicio,
|
||||
};
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
const moment = require('moment');
|
||||
const fs = require('fs');
|
||||
const { usuarioInscrito, agregarRecibo } = require('../../config/mariadb.conf');
|
||||
const {
|
||||
usuarioInscrito,
|
||||
agregarRecibo,
|
||||
agregarDetalleServicio,
|
||||
} = require('../../config/mariadb.conf');
|
||||
const {
|
||||
validarNumeroEntero,
|
||||
validarNumero,
|
||||
validarNumeroCuenta,
|
||||
validarFecha,
|
||||
} = require('../../helper/validar');
|
||||
const { eliminarArchivo } = require('../../helper/helper');
|
||||
const gmail = require('../../helper/gmail');
|
||||
@@ -72,6 +75,7 @@ const inscripcion = async (body, file) => {
|
||||
moment(fechaTicket).format('L'),
|
||||
numeroCuenta
|
||||
);
|
||||
agregarDetalleServicio(monto, numeroCuenta);
|
||||
return gmail(correo.subject, email, correo.msj);
|
||||
})
|
||||
.then((res) => ({
|
||||
|
||||
Reference in New Issue
Block a user