agregar detalle servicio

This commit is contained in:
Andres2908
2022-03-24 14:17:56 -06:00
parent f8350e3961
commit 3d0043cbc1
2 changed files with 27 additions and 3 deletions
+21 -1
View File
@@ -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) => ({