From ea0aecf856893e75a7fb1f34a2cf110e72db7027 Mon Sep 17 00:00:00 2001 From: Rahul Dev Garg <34365102+rahuldevgarg@users.noreply.github.com> Date: Thu, 7 Sep 2023 11:35:12 +0530 Subject: [PATCH 1/2] fix excel download if only one record --- frontend/mgramseva/lib/providers/reports_provider.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/mgramseva/lib/providers/reports_provider.dart b/frontend/mgramseva/lib/providers/reports_provider.dart index eeb74b83d..ba3b6e087 100644 --- a/frontend/mgramseva/lib/providers/reports_provider.dart +++ b/frontend/mgramseva/lib/providers/reports_provider.dart @@ -332,12 +332,12 @@ class ReportsProvider with ChangeNotifier { .setText(headers[CommonMethods.getAlphabetsWithKeyValue()[i].key]); } - for (int i = dataStartRow; i < tableData.length + 2; i++) { + for (int i = dataStartRow; i < tableData.length + dataStartRow; i++) { for (int j = 0; j < headers.length; j++) { sheet .getRangeByName( '${CommonMethods.getAlphabetsWithKeyValue()[j].label}$i') - .setText(tableData[i - 2][j]); + .setText(tableData[i - dataStartRow][j]); sheet .getRangeByName( '${CommonMethods.getAlphabetsWithKeyValue()[j].label}$i') From 05448e4302b45497dce5e9c46abc5a4a914d70fb Mon Sep 17 00:00:00 2001 From: Rahul Dev Garg <34365102+rahuldevgarg@users.noreply.github.com> Date: Thu, 7 Sep 2023 11:40:34 +0530 Subject: [PATCH 2/2] clear selection when press back --- frontend/mgramseva/lib/providers/reports_provider.dart | 9 ++++++++- frontend/mgramseva/lib/screeens/reports/reports.dart | 4 ++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/frontend/mgramseva/lib/providers/reports_provider.dart b/frontend/mgramseva/lib/providers/reports_provider.dart index ba3b6e087..c584d164b 100644 --- a/frontend/mgramseva/lib/providers/reports_provider.dart +++ b/frontend/mgramseva/lib/providers/reports_provider.dart @@ -35,7 +35,14 @@ class ReportsProvider with ChangeNotifier { List? demandreports; List? collectionreports; late BillsTableData genericTableData; - + void clearBillingSelection(){ + selectedBillYear = null; + selectedBillPeriod = null; + selectedBillCycle = null; + billingcycleCtrl.clear(); + billingyearCtrl.clear(); + notifyListeners(); + } dispose() { streamController.close(); super.dispose(); diff --git a/frontend/mgramseva/lib/screeens/reports/reports.dart b/frontend/mgramseva/lib/screeens/reports/reports.dart index 576eec223..6c3c48ccf 100644 --- a/frontend/mgramseva/lib/screeens/reports/reports.dart +++ b/frontend/mgramseva/lib/screeens/reports/reports.dart @@ -34,6 +34,10 @@ class _Reports extends State with SingleTickerProviderStateMixin { @override void dispose() { + var reportsProvider = Provider.of( + navigatorKey.currentContext!, + listen: false); + reportsProvider.clearBillingSelection(); super.dispose(); }