using TakeoutSaaS.Domain.Tenants.Entities; using TakeoutSaaS.Domain.Tenants.Enums; namespace TakeoutSaaS.Domain.Tenants.Repositories; /// /// 租户发票仓储契约。 /// public interface ITenantInvoiceRepository { /// /// 查询租户发票设置。 /// Task GetSettingAsync(long tenantId, CancellationToken cancellationToken = default); /// /// 新增发票设置。 /// Task AddSettingAsync(TenantInvoiceSetting entity, CancellationToken cancellationToken = default); /// /// 更新发票设置。 /// Task UpdateSettingAsync(TenantInvoiceSetting entity, CancellationToken cancellationToken = default); /// /// 分页查询发票记录。 /// Task<(IReadOnlyList Items, int TotalCount)> SearchRecordsAsync( long tenantId, DateTime? startUtc, DateTime? endUtc, TenantInvoiceStatus? status, TenantInvoiceType? invoiceType, string? keyword, int page, int pageSize, CancellationToken cancellationToken = default); /// /// 获取发票页统计。 /// Task GetStatsAsync( long tenantId, DateTime nowUtc, CancellationToken cancellationToken = default); /// /// 根据标识查询发票记录。 /// Task FindRecordByIdAsync( long tenantId, long recordId, CancellationToken cancellationToken = default); /// /// 判断租户下发票号码是否已存在。 /// Task ExistsInvoiceNoAsync( long tenantId, string invoiceNo, CancellationToken cancellationToken = default); /// /// 新增发票记录。 /// Task AddRecordAsync(TenantInvoiceRecord entity, CancellationToken cancellationToken = default); /// /// 更新发票记录。 /// Task UpdateRecordAsync(TenantInvoiceRecord entity, CancellationToken cancellationToken = default); /// /// 持久化变更。 /// Task SaveChangesAsync(CancellationToken cancellationToken = default); } /// /// 发票页面统计快照。 /// public sealed record TenantInvoiceRecordStatsSnapshot { /// /// 本月已开票金额。 /// public decimal CurrentMonthIssuedAmount { get; init; } /// /// 本月已开票张数。 /// public int CurrentMonthIssuedCount { get; init; } /// /// 待开票张数。 /// public int PendingCount { get; init; } /// /// 已作废张数。 /// public int VoidedCount { get; init; } }