feat: update profit shareing
Build & Deploy iOS to TestFlight / build-and-deploy (push) Canceled after 0s
Build & Deploy iOS to TestFlight / build-and-deploy (push) Canceled after 0s
This commit is contained in:
@@ -59,6 +59,13 @@ class ProfitSharingCategory with _$ProfitSharingCategory {
|
||||
|
||||
bool get hasTopProduct => topProduct.productId.isNotEmpty;
|
||||
|
||||
/// Porsi tim = omzet − SDL. Response tidak membawa porsi tim per kategori,
|
||||
/// jadi dihitung dari nominalnya (docs/migrasi-profit-sharing.md).
|
||||
int get teamShare => totalRevenue - sdl;
|
||||
|
||||
/// % porsi tim terhadap omzet, yaitu 100 − fee owner.
|
||||
double get teamPercent => 100 - ownerFeePercent;
|
||||
|
||||
/// Laba kotor memakai HPP standar (acuan yang dipakai di laporan laba rugi).
|
||||
int get grossProfit => totalRevenue - totalStandardHpp;
|
||||
|
||||
@@ -106,16 +113,16 @@ class ProfitSharingBudget with _$ProfitSharingBudget {
|
||||
);
|
||||
}
|
||||
|
||||
/// Porsi bawaan bagi hasil: owner (SDL) dan tim, dengan tim = 100 − owner.
|
||||
@freezed
|
||||
class ProfitSharingPercentage with _$ProfitSharingPercentage {
|
||||
const factory ProfitSharingPercentage({
|
||||
required double purchase,
|
||||
required double owner,
|
||||
required double team,
|
||||
}) = _ProfitSharingPercentage;
|
||||
|
||||
factory ProfitSharingPercentage.empty() =>
|
||||
const ProfitSharingPercentage(purchase: 0, owner: 0, team: 0);
|
||||
const ProfitSharingPercentage(owner: 0, team: 0);
|
||||
}
|
||||
|
||||
/// Satu baris periode bagi hasil. Dipakai untuk total, mingguan, dan bulanan.
|
||||
@@ -129,7 +136,6 @@ class ProfitSharingPeriod with _$ProfitSharingPeriod {
|
||||
required DateTime periodEnd,
|
||||
required int revenue,
|
||||
required int orderCount,
|
||||
required int limitPurchase,
|
||||
required int sdl,
|
||||
required int limitTeam,
|
||||
@Default('') String month,
|
||||
@@ -141,7 +147,6 @@ class ProfitSharingPeriod with _$ProfitSharingPeriod {
|
||||
periodEnd: DateTime.fromMillisecondsSinceEpoch(0),
|
||||
revenue: 0,
|
||||
orderCount: 0,
|
||||
limitPurchase: 0,
|
||||
sdl: 0,
|
||||
limitTeam: 0,
|
||||
);
|
||||
@@ -152,6 +157,9 @@ class ProfitSharingPeriod with _$ProfitSharingPeriod {
|
||||
/// induk, jadi porsinya dihitung dari nominal, bukan dari persentase tetap.
|
||||
double get sdlPercentage => revenue == 0 ? 0 : (sdl / revenue) * 100;
|
||||
|
||||
/// % porsi tim terhadap omzet, dihitung dari nominal dengan alasan yang sama.
|
||||
double get teamPercentage => revenue == 0 ? 0 : (limitTeam / revenue) * 100;
|
||||
|
||||
int get averageOrderValue => orderCount == 0 ? 0 : revenue ~/ orderCount;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user