creaciòn de runas nuevas para reportes

This commit is contained in:
2025-11-19 09:59:16 -06:00
parent 118d5f1abf
commit 2be7270c05
4 changed files with 190 additions and 3 deletions
Binary file not shown.
Binary file not shown.
+188
View File
@@ -35,6 +35,7 @@ export class EquipoController {
) {
return this.equipoService.buscarEquipos(filtros, +page, +limit);
}
@UseGuards(AuthGuard('jwt'))
@Get('buscar/:inv')
async serch(@Param('inv') inv: string) {
@@ -137,4 +138,191 @@ export class EquipoController {
throw new BadRequestException('Error al generar el reporte:', error);
}
}
@UseGuards(AuthGuard('jwt'))
@Get('reporte/tipoEquipos_tipoUso')
async reportetipoEquipos_tipoUso() {
try {
return await this.equipoService.contar_tipoEquipos_tipoUso();
} catch (error) {
throw new BadRequestException(
'Error al generar el reporte tipoEquipos_tipoUso:',
error,
);
}
}
@UseGuards(AuthGuard('jwt'))
@Get('reporte/tipoEquipos_sistemasOperativos')
async reportetipoEquipos_sistemasOperativos() {
try {
return await Promise.all([
this.equipoService.contar_tipoEquipos_sistemasOperativos(equpos_pc),
this.equipoService.contar_tipoEquipos_sistemasOperativos([
estritorio_mac,
]),
this.equipoService.contar_tipoEquipos_sistemasOperativos(portatiles),
this.equipoService.contar_tipoEquipos_sistemasOperativos([
portatiles_mac,
]),
this.equipoService.contar_tipoEquipos_sistemasOperativos([servidor]),
]);
} catch (error) {
throw new BadRequestException(
'Error al generar el reporte tipoEquipos_sistemasOperativos:',
error,
);
}
}
@UseGuards(AuthGuard('jwt'))
@Get('reporte/tipoEquipos_procesador')
async reportetipoEquipos_procesador() {
try {
return await Promise.all([
this.equipoService.contar_tipoEquipos_procesador(equpos_pc),
this.equipoService.contar_tipoEquipos_procesador([estritorio_mac]),
this.equipoService.contar_tipoEquipos_procesador(portatiles),
this.equipoService.contar_tipoEquipos_procesador([portatiles_mac]),
this.equipoService.contar_tipoEquipos_procesador([servidor]),
]);
} catch (error) {
throw new BadRequestException(
'Error al generar el reporte tipoEquipos_procesador:',
error,
);
}
}
@UseGuards(AuthGuard('jwt'))
@Get('reporte/tipoEquipos_antiguedad')
async reportetipoEquipos_antiguedad() {
try {
return await this.equipoService.contar_tipoEquipos_antiguedad();
} catch (error) {
throw new BadRequestException(
'Error al generar el reporte contar_tipoEquipos_antiguedad:',
error,
);
}
}
@UseGuards(AuthGuard('jwt'))
@Get('reporte/garantia')
async reportegarantia() {
try {
return await Promise.all([
this.equipoService.garantia(escritorio),
this.equipoService.garantia(portatil),
this.equipoService.garantia([servidor]),
]);
} catch (error) {
throw new BadRequestException(
'Error al generar el reporte garantia:',
error,
);
}
}
@UseGuards(AuthGuard('jwt'))
@Get('reporte/equipos_impesion_group/impresoras')
async reporteequipos_impesion_group() {
try {
return await this.equipoService.equipos_impesion_group(impresoras);
} catch (error) {
throw new BadRequestException(
'Error al generar el reporte impesion_group impresoras:',
error,
);
}
}
@UseGuards(AuthGuard('jwt'))
@Get('reporte/equipos_impesion_group/dijitales')
async reporteequipos_impesion_group_dijitales() {
try {
return await this.equipoService.equipos_impesion_group(dijitales);
} catch (error) {
throw new BadRequestException(
'Error al generar el reporte impesion_group dijitales:',
error,
);
}
}
@UseGuards(AuthGuard('jwt'))
@Get('reporte/contar_periferico_tipoUso/impresoras')
async reporte_contar_periferico_tipoUso_impresoras() {
try {
return await this.equipoService.contar_periferico_tipoUso(impresoras);
} catch (error) {
throw new BadRequestException(
'Error al generar el reporte periferico_tipoUso impresoras:',
error,
);
}
}
@UseGuards(AuthGuard('jwt'))
@Get('reporte/contar_periferico_tipoUso/dijtales')
async reporte_contar_periferico_tipoUso_dijtales() {
try {
return await this.equipoService.contar_periferico_tipoUso(dijitales);
} catch (error) {
throw new BadRequestException(
'Error al generar el reporte periferico_tipoUso dijtales:',
error,
);
}
}
@UseGuards(AuthGuard('jwt'))
@Get('reporte/contar_perifericos_antiguedad')
async reporte_contar_perifericos_antiguedad() {
try {
return await this.equipoService.contar_perifericos_antiguedad(
impresoras,
dijitales,
);
} catch (error) {
throw new BadRequestException(
'Error al generar el reporte perifericos_antiguedad:',
error,
);
}
}
}
let escritorio = ['ESCRITORIO PC', 'ESCRITORIO MAC OS ', 'ESCRITORIO LINUX'];
let portatil = [
'PORTÁTILES WINDOWS',
'PORTÁTILES CHROMEBOOK',
'PORTÁTILES MAC OS',
];
let equipos_mac = ['ESCRITORIO MAC OS ', 'PORTÁTILES MAC OS'];
let equpos_pc = ['ESCRITORIO PC', 'ESCRITORIO LINUX'];
let estritorio_mac = 'ESCRITORIO MAC OS ';
let portatiles_mac = 'PORTÁTILES MAC OS';
let portatiles = ['PORTÁTILES WINDOWS', 'PORTÁTILES CHROMEBOOK'];
let tabletas = ['TABLETA ANDROID', 'TABLETA iPAD OS'];
let impresoras = [
'INYECCIÓN TINTA',
'LÁSER DE ALTO VOLUMEN B/N',
'LÁSER PEQUEÑA B/N',
'LÁSER PEQUEÑA COLOR',
'MATRIZ DE PUNTOS',
'MULTIFUNCIONALES',
];
let dijitales = [
'3D',
'DIGITALIZADOR DE CAMA PLANA PARA OFICINA',
'DIGITALIZADOR CON ALIMENTADOR DE HOJAS PARA OFICINA',
];
let servidor = 'SERVIDOR';
+2 -3
View File
@@ -394,9 +394,8 @@ export class EquipoService {
try {
const count = await this.equipoRepository
.createQueryBuilder('e')
.innerJoin('e.procesador_tipoequipo', 'pt')
.innerJoin('pt.tipoEquipo', 't')
.innerJoin('pt.procesador', 'p')
.innerJoin('e.procesador', 'p')
.innerJoin('e.tipoEquipo', 't')
.where('t.tipo_equipo IN (:...tipo_equipo)', { tipo_equipo })
.select(['p.procesador AS procesador'])
.addSelect('COUNT(*) AS total')