fixed detalle_servicio and recibo
This commit is contained in:
@@ -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')
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user