diff --git a/frontend/mgramseva/lib/providers/reports_provider.dart b/frontend/mgramseva/lib/providers/reports_provider.dart index 395e5e86f..fd169ff9e 100644 --- a/frontend/mgramseva/lib/providers/reports_provider.dart +++ b/frontend/mgramseva/lib/providers/reports_provider.dart @@ -52,6 +52,11 @@ class ReportsProvider with ChangeNotifier { selectedBillCycle = null; billingcycleCtrl.clear(); billingyearCtrl.clear(); + demandreports = []; + collectionreports = []; + inactiveconsumers = []; + expenseBillReportData = []; + vendorReportData = []; notifyListeners(); } @@ -110,10 +115,10 @@ class ReportsProvider with ChangeNotifier { ]; List get vendorReportHeaderList => [ + TableHeader(i18.common.BILL_ID), TableHeader(i18.expense.VENDOR_NAME), TableHeader(i18.common.MOBILE_NUMBER), TableHeader(i18.expense.EXPENSE_TYPE), - TableHeader(i18.common.BILL_ID), ]; void onChangeOfPageLimit( @@ -245,10 +250,10 @@ class ReportsProvider with ChangeNotifier { String? typeOfExpense = CommonMethods.truncateWithEllipsis(20, data.typeOfExpense!); String? billId = CommonMethods.truncateWithEllipsis(20, data.billId!); return TableDataRow([ + TableData('${billId ?? '-'}'), TableData('${vendorName ?? '-'}'), TableData('${data.mobileNo ?? '-'}'), TableData('${ApplicationLocalizations.of(navigatorKey.currentContext!).translate(typeOfExpense ?? '-')}'), - TableData('${billId ?? '-'}'), ]); } @@ -263,6 +268,11 @@ class ReportsProvider with ChangeNotifier { billingcycleCtrl.clear(); selectedBillCycle = null; selectedBillPeriod = null; + demandreports = []; + collectionreports = []; + inactiveconsumers = []; + expenseBillReportData = []; + vendorReportData = []; notifyListeners(); } @@ -279,6 +289,11 @@ class ReportsProvider with ChangeNotifier { .toLocal() .toString(), dateFormat: "dd/MM/yyyy"); + demandreports = []; + collectionreports = []; + inactiveconsumers = []; + expenseBillReportData = []; + vendorReportData = []; notifyListeners(); } @@ -745,6 +760,7 @@ class ReportsProvider with ChangeNotifier { //Create a Excel document. //Creating a workbook. + headers.insert(0, '${ApplicationLocalizations.of(navigatorKey.currentContext!).translate(i18.common.S_NO)}'); final Workbook workbook = Workbook(); //Accessing via index final Worksheet sheet = workbook.worksheets[0]; @@ -754,20 +770,25 @@ class ReportsProvider with ChangeNotifier { sheet.enableSheetCalculations(); int dataStartRow = 2; int headersStartRow = 1; - // //Set data in the worksheet. + // //Set data in the worksheet.s if (optionalData.isEmpty) { sheet.getRangeByName('A1:D1').columnWidth = 32.5; sheet.getRangeByName('A1:D1').cellStyle.hAlign = HAlignType.center; } else { - sheet.getRangeByName('A1:D1').columnWidth = 32.5; - sheet.getRangeByName('A2:D2').columnWidth = 32.5; - sheet.getRangeByName('A2:D2').cellStyle.hAlign = HAlignType.center; + sheet.getRangeByName('A1:A${tableData.length+1}').columnWidth = 12.5; + sheet.getRangeByName('A1:A${tableData.length+1}').cellStyle.hAlign = HAlignType.center; + sheet.getRangeByName('A1:A${tableData.length+1}').autoFit(); + sheet.getRangeByName('B1:${CommonMethods.getAlphabetsWithKeyValue()[optionalData.length+1].label}1').columnWidth = 32.5; + sheet.getRangeByName('B1:${CommonMethods.getAlphabetsWithKeyValue()[optionalData.length+1].label}1').cellStyle.hAlign = HAlignType.center; + sheet.getRangeByName('B2:${CommonMethods.getAlphabetsWithKeyValue()[headers.length+1].label}2').columnWidth = 32.5; + sheet.getRangeByName('A2:${CommonMethods.getAlphabetsWithKeyValue()[headers.length+1].label}2').cellStyle.hAlign = HAlignType.center; + sheet.getRangeByName('A2:${CommonMethods.getAlphabetsWithKeyValue()[headers.length+1].label}2').cellStyle.bold = true; dataStartRow = 3; headersStartRow = 2; for (int i = 0; i < optionalData.length; i++) { sheet .getRangeByName( - '${CommonMethods.getAlphabetsWithKeyValue()[i].label}1') + '${CommonMethods.getAlphabetsWithKeyValue()[i+1].label}1') .setText( optionalData[CommonMethods.getAlphabetsWithKeyValue()[i].key]); } @@ -782,10 +803,17 @@ class ReportsProvider with ChangeNotifier { 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 - dataStartRow][j]); + if(j==0){ + sheet + .getRangeByName( + '${CommonMethods.getAlphabetsWithKeyValue()[j].label}$i') + .setText('${i - dataStartRow+1}'); + }else{ + sheet + .getRangeByName( + '${CommonMethods.getAlphabetsWithKeyValue()[j].label}$i') + .setText(tableData[i - dataStartRow][j - 1]); + } sheet .getRangeByName( '${CommonMethods.getAlphabetsWithKeyValue()[j].label}$i') diff --git a/frontend/mgramseva/lib/screeens/reports/reports.dart b/frontend/mgramseva/lib/screeens/reports/reports.dart index 53305da4a..02f245535 100644 --- a/frontend/mgramseva/lib/screeens/reports/reports.dart +++ b/frontend/mgramseva/lib/screeens/reports/reports.dart @@ -55,6 +55,10 @@ class _Reports extends State with SingleTickerProviderStateMixin { navigatorKey.currentContext!, listen: false); reportsProvider.getFinancialYearList(); + reportsProvider.clearBillingSelection(); + reportsProvider.clearBuildTableData(); + reportsProvider.clearTableData(); + } showTable(bool status, String title) { diff --git a/frontend/mgramseva/lib/utils/constants/i18_key_constants.dart b/frontend/mgramseva/lib/utils/constants/i18_key_constants.dart index 1a6634757..27c7708d6 100644 --- a/frontend/mgramseva/lib/utils/constants/i18_key_constants.dart +++ b/frontend/mgramseva/lib/utils/constants/i18_key_constants.dart @@ -38,6 +38,7 @@ class Login { class Common { const Common(); String get CONTINUE => 'CORE_COMMON_CONTINUE'; + String get S_NO => 'S_NO'; String get LAST_BILL_CYCLE_MONTH => 'LAST_BILL_CYCLE_MONTH'; String get CONSUMER_COUNT => 'CONSUMER_COUNT'; String get LAST_BILL_CYCLE_DEMAND_NOT_GENERATED => 'LAST_BILL_CYCLE_DEMAND_NOT_GENERATED';