72 lines
2.4 KiB
TypeScript
72 lines
2.4 KiB
TypeScript
/**
|
|
* PresupuestoService - Gestión de Presupuestos de Obra
|
|
*
|
|
* Gestiona presupuestos de obra con sus partidas.
|
|
* Soporta versionamiento y aprobación.
|
|
*
|
|
* @module Budgets
|
|
*/
|
|
import { Repository } from 'typeorm';
|
|
import { BaseService, ServiceContext, PaginatedResult } from '../../../shared/services/base.service';
|
|
import { Presupuesto } from '../entities/presupuesto.entity';
|
|
import { PresupuestoPartida } from '../entities/presupuesto-partida.entity';
|
|
export interface CreatePresupuestoDto {
|
|
code: string;
|
|
name: string;
|
|
description?: string;
|
|
fraccionamientoId?: string;
|
|
prototipoId?: string;
|
|
currencyId?: string;
|
|
}
|
|
export interface AddPartidaDto {
|
|
conceptoId: string;
|
|
quantity: number;
|
|
unitPrice: number;
|
|
sequence?: number;
|
|
}
|
|
export interface UpdatePartidaDto {
|
|
quantity?: number;
|
|
unitPrice?: number;
|
|
sequence?: number;
|
|
}
|
|
export declare class PresupuestoService extends BaseService<Presupuesto> {
|
|
private readonly partidaRepository;
|
|
constructor(repository: Repository<Presupuesto>, partidaRepository: Repository<PresupuestoPartida>);
|
|
/**
|
|
* Crear nuevo presupuesto
|
|
*/
|
|
createPresupuesto(ctx: ServiceContext, data: CreatePresupuestoDto): Promise<Presupuesto>;
|
|
/**
|
|
* Obtener presupuestos por fraccionamiento
|
|
*/
|
|
findByFraccionamiento(ctx: ServiceContext, fraccionamientoId: string, page?: number, limit?: number): Promise<PaginatedResult<Presupuesto>>;
|
|
/**
|
|
* Obtener presupuesto con sus partidas
|
|
*/
|
|
findWithPartidas(ctx: ServiceContext, id: string): Promise<Presupuesto | null>;
|
|
/**
|
|
* Agregar partida al presupuesto
|
|
*/
|
|
addPartida(ctx: ServiceContext, presupuestoId: string, data: AddPartidaDto): Promise<PresupuestoPartida>;
|
|
/**
|
|
* Actualizar partida
|
|
*/
|
|
updatePartida(ctx: ServiceContext, partidaId: string, data: UpdatePartidaDto): Promise<PresupuestoPartida | null>;
|
|
/**
|
|
* Eliminar partida
|
|
*/
|
|
removePartida(ctx: ServiceContext, partidaId: string): Promise<boolean>;
|
|
/**
|
|
* Recalcular total del presupuesto
|
|
*/
|
|
recalculateTotal(ctx: ServiceContext, presupuestoId: string): Promise<void>;
|
|
/**
|
|
* Crear nueva versión del presupuesto
|
|
*/
|
|
createNewVersion(ctx: ServiceContext, presupuestoId: string): Promise<Presupuesto>;
|
|
/**
|
|
* Aprobar presupuesto
|
|
*/
|
|
approve(ctx: ServiceContext, presupuestoId: string): Promise<Presupuesto | null>;
|
|
}
|
|
//# sourceMappingURL=presupuesto.service.d.ts.map
|