feat: item sales report
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:enaklo_pos/core/extensions/build_context_ext.dart';
|
||||
import 'package:enaklo_pos/presentation/sales/pages/sales_page.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:enaklo_pos/core/components/custom_date_picker.dart';
|
||||
import 'package:enaklo_pos/core/constants/colors.dart';
|
||||
@@ -29,7 +31,7 @@ class ReportPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _ReportPageState extends State<ReportPage> {
|
||||
int selectedMenu = 0;
|
||||
int selectedMenu = 1;
|
||||
String title = 'Transaction Report';
|
||||
DateTime fromDate = DateTime.now().subtract(const Duration(days: 30));
|
||||
DateTime toDate = DateTime.now();
|
||||
@@ -37,10 +39,9 @@ class _ReportPageState extends State<ReportPage> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
context.read<TransactionReportBloc>().add(
|
||||
TransactionReportEvent.getReport(
|
||||
startDate: DateFormatter.formatDateTime(fromDate),
|
||||
endDate: DateFormatter.formatDateTime(toDate)),
|
||||
context.read<ItemSalesReportBloc>().add(
|
||||
ItemSalesReportEvent.getItemSales(
|
||||
startDate: fromDate, endDate: toDate),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -117,18 +118,7 @@ class _ReportPageState extends State<ReportPage> {
|
||||
'Menampilkan riwayat lengkap semua transaksi yang telah dilakukan.',
|
||||
icon: Icons.receipt_long_outlined,
|
||||
onPressed: () {
|
||||
selectedMenu = 0;
|
||||
title = 'Laporan Transaksi';
|
||||
setState(() {});
|
||||
//enddate is 1 month before the current date
|
||||
context.read<TransactionReportBloc>().add(
|
||||
TransactionReportEvent.getReport(
|
||||
startDate:
|
||||
DateFormatter.formatDateTime(
|
||||
fromDate),
|
||||
endDate: DateFormatter.formatDateTime(
|
||||
toDate)),
|
||||
);
|
||||
context.push(SalesPage(status: 'completed'));
|
||||
},
|
||||
isActive: selectedMenu == 0,
|
||||
),
|
||||
@@ -143,11 +133,7 @@ class _ReportPageState extends State<ReportPage> {
|
||||
setState(() {});
|
||||
context.read<ItemSalesReportBloc>().add(
|
||||
ItemSalesReportEvent.getItemSales(
|
||||
startDate:
|
||||
DateFormatter.formatDateTime(
|
||||
fromDate),
|
||||
endDate: DateFormatter.formatDateTime(
|
||||
toDate)),
|
||||
startDate: fromDate, endDate: toDate),
|
||||
);
|
||||
},
|
||||
isActive: selectedMenu == 1,
|
||||
@@ -254,7 +240,7 @@ class _ReportPageState extends State<ReportPage> {
|
||||
},
|
||||
loaded: (itemSales) {
|
||||
return ItemSalesReportWidget(
|
||||
itemSales: itemSales,
|
||||
sales: itemSales,
|
||||
title: title,
|
||||
searchDateFormatted:
|
||||
searchDateFormatted,
|
||||
|
||||
Reference in New Issue
Block a user