Some checks are pending
Build & Deploy iOS to TestFlight / build-and-deploy (push) Waiting to run
133 lines
3.7 KiB
Dart
133 lines
3.7 KiB
Dart
part of '../analytic.dart';
|
|
|
|
@freezed
|
|
class PurchasingAnalytic with _$PurchasingAnalytic {
|
|
const factory PurchasingAnalytic({
|
|
required String organizationId,
|
|
required String outletId,
|
|
required String outletName,
|
|
required DateTime dateFrom,
|
|
required DateTime dateTo,
|
|
required String groupBy,
|
|
required PurchasingAnalyticSummary summary,
|
|
required List<PurchasingAnalyticData> data,
|
|
required List<PurchasingIngredientData> ingredientData,
|
|
required List<PurchasingVendorData> vendorData,
|
|
}) = _PurchasingAnalytic;
|
|
|
|
factory PurchasingAnalytic.empty() => PurchasingAnalytic(
|
|
organizationId: '',
|
|
outletId: '',
|
|
outletName: '',
|
|
dateFrom: DateTime.fromMillisecondsSinceEpoch(0),
|
|
dateTo: DateTime.fromMillisecondsSinceEpoch(0),
|
|
groupBy: '',
|
|
summary: PurchasingAnalyticSummary.empty(),
|
|
data: [],
|
|
ingredientData: [],
|
|
vendorData: [],
|
|
);
|
|
}
|
|
|
|
@freezed
|
|
class PurchasingAnalyticSummary with _$PurchasingAnalyticSummary {
|
|
const factory PurchasingAnalyticSummary({
|
|
required int totalPurchases,
|
|
required int rawMaterialPurchases,
|
|
required int expensePurchases,
|
|
required int totalPurchaseOrders,
|
|
required int rawMaterialPurchaseOrders,
|
|
required int expenseCount,
|
|
required int totalQuantity,
|
|
required double averagePurchaseOrderValue,
|
|
required int totalIngredients,
|
|
required int totalVendors,
|
|
}) = _PurchasingAnalyticSummary;
|
|
|
|
factory PurchasingAnalyticSummary.empty() =>
|
|
const PurchasingAnalyticSummary(
|
|
totalPurchases: 0,
|
|
rawMaterialPurchases: 0,
|
|
expensePurchases: 0,
|
|
totalPurchaseOrders: 0,
|
|
rawMaterialPurchaseOrders: 0,
|
|
expenseCount: 0,
|
|
totalQuantity: 0,
|
|
averagePurchaseOrderValue: 0,
|
|
totalIngredients: 0,
|
|
totalVendors: 0,
|
|
);
|
|
}
|
|
|
|
@freezed
|
|
class PurchasingAnalyticData with _$PurchasingAnalyticData {
|
|
const factory PurchasingAnalyticData({
|
|
required DateTime date,
|
|
required int purchases,
|
|
required int rawMaterialPurchases,
|
|
required int expensePurchases,
|
|
required int purchaseOrders,
|
|
required int rawMaterialPurchaseOrders,
|
|
required int expenseCount,
|
|
required int quantity,
|
|
required int ingredients,
|
|
required int vendors,
|
|
}) = _PurchasingAnalyticData;
|
|
|
|
factory PurchasingAnalyticData.empty() => PurchasingAnalyticData(
|
|
date: DateTime.fromMillisecondsSinceEpoch(0),
|
|
purchases: 0,
|
|
rawMaterialPurchases: 0,
|
|
expensePurchases: 0,
|
|
purchaseOrders: 0,
|
|
rawMaterialPurchaseOrders: 0,
|
|
expenseCount: 0,
|
|
quantity: 0,
|
|
ingredients: 0,
|
|
vendors: 0,
|
|
);
|
|
}
|
|
|
|
@freezed
|
|
class PurchasingIngredientData with _$PurchasingIngredientData {
|
|
const factory PurchasingIngredientData({
|
|
required String ingredientId,
|
|
required String ingredientName,
|
|
required int quantity,
|
|
required int totalCost,
|
|
required double averageUnitCost,
|
|
required int purchaseOrderCount,
|
|
}) = _PurchasingIngredientData;
|
|
|
|
factory PurchasingIngredientData.empty() =>
|
|
const PurchasingIngredientData(
|
|
ingredientId: '',
|
|
ingredientName: '',
|
|
quantity: 0,
|
|
totalCost: 0,
|
|
averageUnitCost: 0,
|
|
purchaseOrderCount: 0,
|
|
);
|
|
}
|
|
|
|
@freezed
|
|
class PurchasingVendorData with _$PurchasingVendorData {
|
|
const factory PurchasingVendorData({
|
|
required String vendorId,
|
|
required String vendorName,
|
|
required int totalCost,
|
|
required int purchaseOrderCount,
|
|
required int ingredientCount,
|
|
required int quantity,
|
|
}) = _PurchasingVendorData;
|
|
|
|
factory PurchasingVendorData.empty() => const PurchasingVendorData(
|
|
vendorId: '',
|
|
vendorName: '',
|
|
totalCost: 0,
|
|
purchaseOrderCount: 0,
|
|
ingredientCount: 0,
|
|
quantity: 0,
|
|
);
|
|
}
|