fixed detalle_servicio and recibo
This commit is contained in:
@@ -20,16 +20,16 @@ export class DetalleServicioService {
|
|||||||
return this.detalleServicioRepository.find({take:100})
|
return this.detalleServicioRepository.find({take:100})
|
||||||
}
|
}
|
||||||
|
|
||||||
async findByDateRange(fechaInicio: string, fechaFin: string) {
|
async findByDateRange(desde: string, hasta: string) {
|
||||||
return this.detalleServicioRepository
|
return this.detalleServicioRepository
|
||||||
.createQueryBuilder('detalle')
|
.createQueryBuilder('detalle')
|
||||||
.innerJoin('detalle.servicio', 'servicio')
|
.innerJoin('detalle.servicio', 'servicio')
|
||||||
.select('servicio.id_servicio', 'id_servicio')
|
.select('servicio.id_servicio', 'id_servicio')
|
||||||
.addSelect('servicio.servicio', 'servicio')
|
.addSelect('servicio.servicio', 'servicio')
|
||||||
.addSelect('COUNT(detalle.monto)', 'total')
|
.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)', {
|
.andWhere('detalle.fecha_operacion < DATE_ADD(:fin, INTERVAL 1 DAY)', {
|
||||||
fin: fechaFin,
|
fin: hasta,
|
||||||
})
|
})
|
||||||
.groupBy('servicio.id_servicio')
|
.groupBy('servicio.id_servicio')
|
||||||
.addGroupBy('servicio.servicio')
|
.addGroupBy('servicio.servicio')
|
||||||
|
|||||||
@@ -25,14 +25,22 @@ export class ReciboService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async findByDateRange(desde: string, hasta: string) {
|
async findByDateRange(desde: string, hasta: string) {
|
||||||
const fechaDesde = new Date(desde);
|
return this.reciboRepository
|
||||||
const fechaHasta = new Date(hasta);
|
.createQueryBuilder('recibo')
|
||||||
|
.leftJoin('recibo.user', 'user')
|
||||||
return await this.reciboRepository.find({
|
.select([
|
||||||
where: {
|
'recibo.id_recibo',
|
||||||
fecha_recibo: Between(fechaDesde, fechaHasta),
|
'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
|
//IO
|
||||||
|
|||||||
Reference in New Issue
Block a user