feat(finance): add cost management backend module
This commit is contained in:
@@ -0,0 +1,214 @@
|
||||
using TakeoutSaaS.Domain.Finance.Enums;
|
||||
|
||||
namespace TakeoutSaaS.Domain.Finance.Models;
|
||||
|
||||
/// <summary>
|
||||
/// 成本明细项快照。
|
||||
/// </summary>
|
||||
public sealed record FinanceCostDetailItemSnapshot
|
||||
{
|
||||
/// <summary>
|
||||
/// 明细标识。
|
||||
/// </summary>
|
||||
public long? ItemId { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 明细名称。
|
||||
/// </summary>
|
||||
public required string ItemName { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 明细金额。
|
||||
/// </summary>
|
||||
public decimal Amount { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 数量(人工类可用)。
|
||||
/// </summary>
|
||||
public decimal? Quantity { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 单价(人工类可用)。
|
||||
/// </summary>
|
||||
public decimal? UnitPrice { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序值。
|
||||
/// </summary>
|
||||
public int SortOrder { get; init; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 成本分类快照。
|
||||
/// </summary>
|
||||
public sealed record FinanceCostCategorySnapshot
|
||||
{
|
||||
/// <summary>
|
||||
/// 成本分类。
|
||||
/// </summary>
|
||||
public required FinanceCostCategory Category { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 分类总金额。
|
||||
/// </summary>
|
||||
public decimal TotalAmount { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 分类明细。
|
||||
/// </summary>
|
||||
public IReadOnlyList<FinanceCostDetailItemSnapshot> Items { get; init; } = [];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 成本录入页快照。
|
||||
/// </summary>
|
||||
public sealed record FinanceCostMonthSnapshot
|
||||
{
|
||||
/// <summary>
|
||||
/// 统计维度。
|
||||
/// </summary>
|
||||
public required FinanceCostDimension Dimension { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 门店标识(租户维度为空)。
|
||||
/// </summary>
|
||||
public long? StoreId { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 成本月份。
|
||||
/// </summary>
|
||||
public required DateTime CostMonth { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 本月营业额。
|
||||
/// </summary>
|
||||
public decimal MonthRevenue { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 成本分类集合。
|
||||
/// </summary>
|
||||
public IReadOnlyList<FinanceCostCategorySnapshot> Categories { get; init; } = [];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 月度趋势行。
|
||||
/// </summary>
|
||||
public sealed record FinanceCostTrendSnapshot
|
||||
{
|
||||
/// <summary>
|
||||
/// 月份起始时间(UTC)。
|
||||
/// </summary>
|
||||
public required DateTime MonthStartUtc { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 月度总成本。
|
||||
/// </summary>
|
||||
public decimal TotalCost { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 月度营业额。
|
||||
/// </summary>
|
||||
public decimal Revenue { get; init; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 月度成本明细表行。
|
||||
/// </summary>
|
||||
public sealed record FinanceCostMonthlyDetailSnapshot
|
||||
{
|
||||
/// <summary>
|
||||
/// 月份起始时间(UTC)。
|
||||
/// </summary>
|
||||
public required DateTime MonthStartUtc { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 食材成本。
|
||||
/// </summary>
|
||||
public decimal FoodAmount { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 人工成本。
|
||||
/// </summary>
|
||||
public decimal LaborAmount { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 固定费用。
|
||||
/// </summary>
|
||||
public decimal FixedAmount { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 包装耗材。
|
||||
/// </summary>
|
||||
public decimal PackagingAmount { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 月度总成本。
|
||||
/// </summary>
|
||||
public decimal TotalCost { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 月度营业额。
|
||||
/// </summary>
|
||||
public decimal Revenue { get; init; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 成本分析快照。
|
||||
/// </summary>
|
||||
public sealed record FinanceCostAnalysisSnapshot
|
||||
{
|
||||
/// <summary>
|
||||
/// 统计维度。
|
||||
/// </summary>
|
||||
public required FinanceCostDimension Dimension { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 门店标识(租户维度为空)。
|
||||
/// </summary>
|
||||
public long? StoreId { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 当前月份。
|
||||
/// </summary>
|
||||
public required DateTime CostMonth { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 当前月总成本。
|
||||
/// </summary>
|
||||
public decimal CurrentTotalCost { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 当前月食材成本。
|
||||
/// </summary>
|
||||
public decimal CurrentFoodAmount { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 当前月营业额。
|
||||
/// </summary>
|
||||
public decimal CurrentRevenue { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 当前月支付成功订单数。
|
||||
/// </summary>
|
||||
public int CurrentPaidOrderCount { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 环比变化率(%)。
|
||||
/// </summary>
|
||||
public decimal MonthOnMonthChangeRate { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 分类构成。
|
||||
/// </summary>
|
||||
public IReadOnlyList<FinanceCostCategorySnapshot> CurrentCategories { get; init; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// 近 N 月趋势。
|
||||
/// </summary>
|
||||
public IReadOnlyList<FinanceCostTrendSnapshot> Trends { get; init; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// 明细表数据。
|
||||
/// </summary>
|
||||
public IReadOnlyList<FinanceCostMonthlyDetailSnapshot> DetailRows { get; init; } = [];
|
||||
}
|
||||
Reference in New Issue
Block a user