/** * EstimacionService - Gestión de Estimaciones de Obra * * Gestiona estimaciones periódicas con workflow de aprobación. * Incluye cálculo de anticipos, retenciones e IVA. * * @module Estimates */ import { Repository, DataSource } from 'typeorm'; import { BaseService, ServiceContext, PaginatedResult } from '../../../shared/services/base.service'; import { Estimacion, EstimateStatus } from '../entities/estimacion.entity'; import { EstimacionConcepto } from '../entities/estimacion-concepto.entity'; import { Generador } from '../entities/generador.entity'; import { EstimacionWorkflow } from '../entities/estimacion-workflow.entity'; export interface CreateEstimacionDto { contratoId: string; fraccionamientoId: string; periodStart: Date; periodEnd: Date; notes?: string; } export interface AddConceptoDto { conceptoId: string; contratoPartidaId?: string; quantityContract?: number; quantityPrevious?: number; quantityCurrent: number; unitPrice: number; notes?: string; } export interface AddGeneradorDto { generatorNumber: string; description?: string; loteId?: string; departamentoId?: string; locationDescription?: string; quantity: number; formula?: string; photoUrl?: string; sketchUrl?: string; } export interface EstimacionFilters { contratoId?: string; fraccionamientoId?: string; status?: EstimateStatus; periodFrom?: Date; periodTo?: Date; } export declare class EstimacionService extends BaseService { private readonly conceptoRepository; private readonly generadorRepository; private readonly workflowRepository; private readonly dataSource; constructor(repository: Repository, conceptoRepository: Repository, generadorRepository: Repository, workflowRepository: Repository, dataSource: DataSource); /** * Crear nueva estimación */ createEstimacion(ctx: ServiceContext, data: CreateEstimacionDto): Promise; /** * Obtener siguiente número de secuencia */ private getNextSequenceNumber; /** * Generar número de estimación */ private generateEstimateNumber; /** * Obtener estimaciones por contrato */ findByContrato(ctx: ServiceContext, contratoId: string, page?: number, limit?: number): Promise>; /** * Obtener estimaciones con filtros */ findWithFilters(ctx: ServiceContext, filters: EstimacionFilters, page?: number, limit?: number): Promise>; /** * Obtener estimación con detalles completos */ findWithDetails(ctx: ServiceContext, id: string): Promise; /** * Agregar concepto a estimación */ addConcepto(ctx: ServiceContext, estimacionId: string, data: AddConceptoDto): Promise; /** * Agregar generador a concepto de estimación */ addGenerador(ctx: ServiceContext, estimacionConceptoId: string, data: AddGeneradorDto): Promise; /** * Recalcular totales de estimación */ recalculateTotals(_ctx: ServiceContext, estimacionId: string): Promise; /** * Cambiar estado de estimación */ changeStatus(ctx: ServiceContext, estimacionId: string, newStatus: EstimateStatus, action: string, comments?: string): Promise; /** * Agregar entrada al workflow */ private addWorkflowEntry; /** * Enviar estimación para revisión */ submit(ctx: ServiceContext, estimacionId: string): Promise; /** * Revisar estimación */ review(ctx: ServiceContext, estimacionId: string): Promise; /** * Aprobar estimación */ approve(ctx: ServiceContext, estimacionId: string): Promise; /** * Rechazar estimación */ reject(ctx: ServiceContext, estimacionId: string, reason: string): Promise; /** * Obtener resumen de estimaciones por contrato */ getContractSummary(ctx: ServiceContext, contratoId: string): Promise; } interface ContractEstimateSummary { totalEstimates: number; totalApproved: number; totalPaid: number; } export {}; //# sourceMappingURL=estimacion.service.d.ts.map