fixed detalle_servicio and recibo

This commit is contained in:
2026-01-16 15:32:05 -06:00
parent 19dacc38ae
commit 0bbac3b9b3
2 changed files with 19 additions and 11 deletions
@@ -20,16 +20,16 @@ export class DetalleServicioService {
return this.detalleServicioRepository.find({take:100})
}
async findByDateRange(fechaInicio: string, fechaFin: string) {
async findByDateRange(desde: string, hasta: string) {
return this.detalleServicioRepository
.createQueryBuilder('detalle')
.innerJoin('detalle.servicio', 'servicio')
.select('servicio.id_servicio', 'id_servicio')
.addSelect('servicio.servicio', 'servicio')
.addSelect('COUNT(detalle.monto)', 'total')
.where('detalle.fecha_operacion >= :inicio', { inicio: fechaInicio })
.where('detalle.fecha_operacion >= :inicio', { inicio: desde })
.andWhere('detalle.fecha_operacion < DATE_ADD(:fin, INTERVAL 1 DAY)', {
fin: fechaFin,
fin: hasta,
})
.groupBy('servicio.id_servicio')
.addGroupBy('servicio.servicio')
+16 -8
View File
@@ -25,14 +25,22 @@ export class ReciboService {
}
async findByDateRange(desde: string, hasta: string) {
const fechaDesde = new Date(desde);
const fechaHasta = new Date(hasta);
return await this.reciboRepository.find({
where: {
fecha_recibo: Between(fechaDesde, fechaHasta),
},
});
return this.reciboRepository
.createQueryBuilder('recibo')
.leftJoin('recibo.user', 'user')
.select([
'recibo.id_recibo',
'recibo.folio_recibo',
'recibo.monto',
'recibo.fecha_recibo',
'recibo.fecha_registro',
'user.usuario',
])
.where('recibo.fecha_recibo >= :inicio', { inicio: desde })
.andWhere('recibo.fecha_recibo < DATE_ADD(:fin, INTERVAL 1 DAY)', {
fin: hasta,
})
.getMany();
}
}
//IO