diff --git a/frontend/mgramseva/lib/providers/bill_generation_details_provider.dart b/frontend/mgramseva/lib/providers/bill_generation_details_provider.dart index 16dc0647e..b4af33f53 100644 --- a/frontend/mgramseva/lib/providers/bill_generation_details_provider.dart +++ b/frontend/mgramseva/lib/providers/bill_generation_details_provider.dart @@ -182,6 +182,7 @@ class BillGenerationProvider with ChangeNotifier { billGenerateDetails.billYear = null; selectedBillCycle = null; billGenerateDetails.billCycle = null; + selectedBillPeriod = null; notifyListeners(); } void onChangeOfBillCycle(cycle) { @@ -360,47 +361,48 @@ class BillGenerationProvider with ChangeNotifier { navigatorKey.currentContext!, listen: false); var rate = rateProvider.wcBillingSlabs!.wCBillingSlabs!.where((element) => element.connectionType=='Non_Metered').toList(); - showDialog(context: context, builder: (context)=>AlertDialog( - surfaceTintColor: Colors.white, - title: Text('${ApplicationLocalizations.of(context).translate(i18.common.CORE_CONFIRM)}'), - content: Container( - height: 370, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text('${ApplicationLocalizations.of(context).translate(i18.demandGenerate.ARE_YOU_SURE_TO_GENERATE_DEMAND_FOR)} "${ApplicationLocalizations.of(context).translate(billGenerateDetails.serviceType!)}" ${ApplicationLocalizations.of(context).translate(i18.demandGenerate.WITH_MINIMUM_CHARGE_OF)} : '), - SizedBox(height: 10,), - FittedBox( - child: DataTable( - border: TableBorder.all( + if(selectedBillPeriod!=null){ + showDialog(context: context, builder: (context)=>AlertDialog( + surfaceTintColor: Colors.white, + title: Text('${ApplicationLocalizations.of(context).translate(i18.common.CORE_CONFIRM)}'), + content: Container( + height: 370, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('${ApplicationLocalizations.of(context).translate(i18.demandGenerate.ARE_YOU_SURE_TO_GENERATE_DEMAND_FOR)} "${ApplicationLocalizations.of(context).translate(billGenerateDetails.serviceType!)}" ${ApplicationLocalizations.of(context).translate(i18.demandGenerate.WITH_MINIMUM_CHARGE_OF)} : '), + SizedBox(height: 10,), + FittedBox( + child: DataTable( + border: TableBorder.all( width: 0.5, borderRadius: BorderRadius.all(Radius.circular(5)), - color: Colors.grey,), columns: [ - DataColumn( - label: Text( - "${ApplicationLocalizations.of(context).translate(i18.searchWaterConnection.CONNECTION_TYPE)}", - style: - TextStyle(color: Colors.black, fontWeight: FontWeight.bold), - )), - DataColumn( - label: Text( - "${ApplicationLocalizations.of(context).translate(i18.common.RATE_PERCENTAGE)}", - style: - TextStyle(color: Colors.black, fontWeight: FontWeight.bold), - )),], rows: [ - ...rate.map((e) => DataRow(cells: [ - DataCell(Text( - "${ApplicationLocalizations.of(context).translate("${e.buildingType}")}")), - DataCell(Text("${e.minimumCharge}")) - ])).toList() - ],), + color: Colors.grey,), columns: [ + DataColumn( + label: Text( + "${ApplicationLocalizations.of(context).translate(i18.searchWaterConnection.CONNECTION_TYPE)}", + style: + TextStyle(color: Colors.black, fontWeight: FontWeight.bold), + )), + DataColumn( + label: Text( + "${ApplicationLocalizations.of(context).translate(i18.common.RATE_PERCENTAGE)}", + style: + TextStyle(color: Colors.black, fontWeight: FontWeight.bold), + )),], rows: [ + ...rate.map((e) => DataRow(cells: [ + DataCell(Text( + "${ApplicationLocalizations.of(context).translate("${e.buildingType}")}")), + DataCell(Text("${e.minimumCharge}")) + ])).toList() + ],), + ), + SizedBox(height: 10,), + Text('${ApplicationLocalizations.of(context).translate(i18.demandGenerate.NO_DEMAND_GEN_WITH_RATE_0)}'), //* Note : No Demand will be generated for the Service Type with rate set to 0. + ], ), - SizedBox(height: 10,), - Text('${ApplicationLocalizations.of(context).translate(i18.demandGenerate.NO_DEMAND_GEN_WITH_RATE_0)}'), //* Note : No Demand will be generated for the Service Type with rate set to 0. - ], ), - ), - actions: + actions: (rateProvider.wcBillingSlabs!.wCBillingSlabs!.where((element) => element.connectionType=='Non_Metered').length- rateProvider.wcBillingSlabs!.wCBillingSlabs!.where((element) => element.connectionType=='Non_Metered' && element.minimumCharge==0).length == 0 ) ? [TextButton(onPressed: (){ @@ -445,11 +447,14 @@ class BillGenerationProvider with ChangeNotifier { })); } }, child: Text('${ApplicationLocalizations.of(context).translate(i18.common.YES)}')), - TextButton(onPressed: (){ - Navigator.pop(context); - }, child: Text('${ApplicationLocalizations.of(context).translate(i18.common.NO)}')),] - , - )); + TextButton(onPressed: (){ + Navigator.pop(context); + }, child: Text('${ApplicationLocalizations.of(context).translate(i18.common.NO)}')),] + , + )); + }else{ + Notifiers.getToastMessage(context, '${ApplicationLocalizations.of(context).translate(i18.common.SELECT_BILLING_CYCLE)}', 'ERROR'); //Please select billing cycle + } } else { autoValidation = true; notifyListeners(); 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'; diff --git a/frontend/mgramseva/package.json b/frontend/mgramseva/package.json index 7734c7a85..96a15c476 100644 --- a/frontend/mgramseva/package.json +++ b/frontend/mgramseva/package.json @@ -1,5 +1,5 @@ { "name": "mgramseva", - "version": "1.2.18", + "version": "1.2.20", "license": "egov" }