fix: report profit loss

This commit is contained in:
efrilm 2025-08-14 17:32:16 +07:00
parent f87309af3f
commit 0c375de6e4
6 changed files with 10 additions and 9 deletions

View File

@ -70,7 +70,8 @@ class _CustomDatePickerState extends State<CustomDatePicker> {
), ),
decoration: InputDecoration( decoration: InputDecoration(
suffixIcon: Padding( suffixIcon: Padding(
padding: const EdgeInsets.all(16.0), padding: const EdgeInsets.symmetric(
vertical: 8, horizontal: 16),
child: Assets.icons.calendar.svg(), child: Assets.icons.calendar.svg(),
), ),
prefix: widget.prefix, prefix: widget.prefix,

View File

View File

@ -106,7 +106,7 @@ class ProfitLossSummary {
final int netProfit; final int netProfit;
final double netProfitMargin; final double netProfitMargin;
final int totalOrders; final int totalOrders;
final int averageProfit; final double averageProfit;
final double profitabilityRatio; final double profitabilityRatio;
ProfitLossSummary({ ProfitLossSummary({
@ -134,7 +134,7 @@ class ProfitLossSummary {
netProfit: map['net_profit'], netProfit: map['net_profit'],
netProfitMargin: (map['net_profit_margin'] as num).toDouble(), netProfitMargin: (map['net_profit_margin'] as num).toDouble(),
totalOrders: map['total_orders'], totalOrders: map['total_orders'],
averageProfit: map['average_profit'], averageProfit: (map['average_profit'] as num).toDouble(),
profitabilityRatio: (map['profitability_ratio'] as num).toDouble(), profitabilityRatio: (map['profitability_ratio'] as num).toDouble(),
); );
} }
@ -252,8 +252,8 @@ class ProfitLossProduct {
cost: map['cost'], cost: map['cost'],
grossProfit: map['gross_profit'], grossProfit: map['gross_profit'],
grossProfitMargin: (map['gross_profit_margin'] as num).toDouble(), grossProfitMargin: (map['gross_profit_margin'] as num).toDouble(),
averagePrice: map['average_price'], averagePrice: (map['average_price'] as num).toInt(),
averageCost: map['average_cost'], averageCost: (map['average_cost'] as num).toInt(),
profitPerUnit: map['profit_per_unit'], profitPerUnit: map['profit_per_unit'],
); );
} }

View File

@ -194,12 +194,12 @@ class _ReportPageState extends State<ReportPage> {
isActive: selectedMenu == 4, isActive: selectedMenu == 4,
), ),
ReportMenu( ReportMenu(
label: 'Laporan untung rugi', label: 'Laporan Untung Rugi',
subtitle: 'Laporan untung rugi penjualan.', subtitle: 'Laporan untung rugi penjualan.',
icon: Icons.trending_down, icon: Icons.trending_down,
onPressed: () { onPressed: () {
selectedMenu = 5; selectedMenu = 5;
title = 'Laporan untung rugi'; title = 'Laporan Untung Rugi';
setState(() {}); setState(() {});
context.read<ProfitLossBloc>().add( context.read<ProfitLossBloc>().add(
ProfitLossEvent.getProfitLoss( ProfitLossEvent.getProfitLoss(

View File

@ -873,7 +873,7 @@ class ProfitLossWidget extends StatelessWidget {
Expanded( Expanded(
child: _buildMetricCard( child: _buildMetricCard(
'Keuntungan Rata-rata', 'Keuntungan Rata-rata',
_formatCurrency(data.summary.averageProfit), "${data.summary.averageProfit.round()}%",
'Per pesanan', 'Per pesanan',
Icons.trending_up, Icons.trending_up,
AppColorProfitLoss.success, AppColorProfitLoss.success,

View File

@ -16,7 +16,7 @@ class ReportTitle extends StatelessWidget {
vertical: 10.0, vertical: 10.0,
), ),
width: double.infinity, width: double.infinity,
height: context.deviceHeight * 0.1, height: context.deviceHeight * 0.13,
decoration: const BoxDecoration( decoration: const BoxDecoration(
color: AppColors.white, color: AppColors.white,
border: Border( border: Border(