73 lines
3.1 KiB
TypeScript
73 lines
3.1 KiB
TypeScript
/**
|
|
* ContractService - Servicio de gestión de contratos
|
|
*
|
|
* Gestión de contratos con workflow de aprobación.
|
|
*
|
|
* @module Contracts
|
|
*/
|
|
import { Repository } from 'typeorm';
|
|
import { Contract, ContractStatus, ContractType } from '../entities/contract.entity';
|
|
import { ContractAddendum } from '../entities/contract-addendum.entity';
|
|
import { ServiceContext, PaginatedResult } from '../../../shared/services/base.service';
|
|
export interface CreateContractDto {
|
|
projectId?: string;
|
|
fraccionamientoId?: string;
|
|
contractType: ContractType;
|
|
clientContractType?: string;
|
|
name: string;
|
|
description?: string;
|
|
clientName?: string;
|
|
clientRfc?: string;
|
|
clientAddress?: string;
|
|
subcontractorId?: string;
|
|
specialty?: string;
|
|
startDate: Date;
|
|
endDate: Date;
|
|
contractAmount: number;
|
|
currency?: string;
|
|
paymentTerms?: string;
|
|
retentionPercentage?: number;
|
|
advancePercentage?: number;
|
|
notes?: string;
|
|
}
|
|
export interface CreateAddendumDto {
|
|
addendumType: string;
|
|
title: string;
|
|
description: string;
|
|
effectiveDate: Date;
|
|
newEndDate?: Date;
|
|
amountChange?: number;
|
|
scopeChanges?: string;
|
|
notes?: string;
|
|
}
|
|
export interface ContractFilters {
|
|
projectId?: string;
|
|
fraccionamientoId?: string;
|
|
contractType?: ContractType;
|
|
subcontractorId?: string;
|
|
status?: ContractStatus;
|
|
expiringInDays?: number;
|
|
}
|
|
export declare class ContractService {
|
|
private readonly contractRepository;
|
|
private readonly addendumRepository;
|
|
constructor(contractRepository: Repository<Contract>, addendumRepository: Repository<ContractAddendum>);
|
|
private generateContractNumber;
|
|
private generateAddendumNumber;
|
|
findWithFilters(ctx: ServiceContext, filters?: ContractFilters, page?: number, limit?: number): Promise<PaginatedResult<Contract>>;
|
|
findById(ctx: ServiceContext, id: string): Promise<Contract | null>;
|
|
findWithDetails(ctx: ServiceContext, id: string): Promise<Contract | null>;
|
|
create(ctx: ServiceContext, dto: CreateContractDto): Promise<Contract>;
|
|
submitForReview(ctx: ServiceContext, id: string): Promise<Contract | null>;
|
|
approveLegal(ctx: ServiceContext, id: string): Promise<Contract | null>;
|
|
approve(ctx: ServiceContext, id: string): Promise<Contract | null>;
|
|
activate(ctx: ServiceContext, id: string, signedDocumentUrl?: string): Promise<Contract | null>;
|
|
complete(ctx: ServiceContext, id: string): Promise<Contract | null>;
|
|
terminate(ctx: ServiceContext, id: string, reason: string): Promise<Contract | null>;
|
|
updateProgress(ctx: ServiceContext, id: string, progressPercentage: number, invoicedAmount?: number, paidAmount?: number): Promise<Contract | null>;
|
|
createAddendum(ctx: ServiceContext, contractId: string, dto: CreateAddendumDto): Promise<ContractAddendum>;
|
|
approveAddendum(ctx: ServiceContext, addendumId: string): Promise<ContractAddendum | null>;
|
|
softDelete(ctx: ServiceContext, id: string): Promise<boolean>;
|
|
getExpiringContracts(ctx: ServiceContext, days?: number): Promise<Contract[]>;
|
|
}
|
|
//# sourceMappingURL=contract.service.d.ts.map
|