diff --git a/frontend/mgramseva/lib/providers/collect_payment.dart b/frontend/mgramseva/lib/providers/collect_payment.dart index f4f095fa1..77bd859bc 100644 --- a/frontend/mgramseva/lib/providers/collect_payment.dart +++ b/frontend/mgramseva/lib/providers/collect_payment.dart @@ -1,5 +1,4 @@ import 'dart:async'; -import 'dart:typed_data'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; @@ -112,9 +111,21 @@ class CollectPaymentProvider with ChangeNotifier { } else {} if (paymentDetails != null) { + var commonProvider = Provider.of( + navigatorKey.currentContext!, + listen: false); if (mdmsData == null) { - mdmsData = await CommonProvider.getMdmsBillingService(); - paymentDetails.first.mdmsData = mdmsData; + mdmsData = await CommonProvider.getMdmsBillingService( + commonProvider.userDetails!.selectedtenant?.code.toString() ?? + commonProvider.userDetails!.userRequest!.tenantId.toString()); + if (mdmsData.mdmsRes?.billingService?.taxHeadMasterList != null && + mdmsData.mdmsRes!.billingService!.taxHeadMasterList!.isNotEmpty) { + paymentDetails.first.mdmsData = mdmsData; + } else { + mdmsData = await CommonProvider.getMdmsBillingService( + commonProvider.userDetails!.userRequest!.tenantId.toString()); + paymentDetails.first.mdmsData = mdmsData; + } } paymentDetails.first.billDetails @@ -394,7 +405,7 @@ class CollectPaymentProvider with ChangeNotifier { navigatorKey.currentContext!, listen: false); var res = await CoreRepository().getMdms(getMdmsPaymentModes( - commonProvider.userDetails!.userRequest!.tenantId.toString())); + commonProvider.userDetails!.selectedtenant!.code.toString())); if (res.mdmsRes?.billingService != null && res.mdmsRes?.billingService?.businessServiceList != null) { Constants.PAYMENT_METHOD.forEach((e) { @@ -406,8 +417,20 @@ class CollectPaymentProvider with ChangeNotifier { } }); fetchBill.paymentMethod = paymentModeList.first.key; - notifyListeners(); + } else { + var mdms = await CoreRepository().getMdms(getMdmsPaymentModes( + commonProvider.userDetails!.userRequest!.tenantId.toString())); + Constants.PAYMENT_METHOD.forEach((e) { + var index = mdms.mdmsRes?.billingService?.businessServiceList?.first + .collectionModesNotAllowed! + .indexOf(e.key); + if (index == -1) { + paymentModeList.add(KeyValue(e.key, e.label)); + } + }); + fetchBill.paymentMethod = paymentModeList.first.key; } + notifyListeners(); } Future updatePaymentInformation( diff --git a/frontend/mgramseva/lib/providers/common_provider.dart b/frontend/mgramseva/lib/providers/common_provider.dart index ba848043c..b16c92a94 100644 --- a/frontend/mgramseva/lib/providers/common_provider.dart +++ b/frontend/mgramseva/lib/providers/common_provider.dart @@ -907,15 +907,14 @@ class CommonProvider with ChangeNotifier { .abs(); } - static Future getMdmsBillingService() async { + static Future getMdmsBillingService(String tenantId) async { try { var commonProvider = Provider.of( navigatorKey.currentContext!, listen: false); - return await CoreRepository().getPaymentTypeMDMS(getMdmsPaymentModes( - commonProvider.userDetails!.selectedtenant?.code.toString() ?? - commonProvider.userDetails!.userRequest!.tenantId.toString())); + return await CoreRepository() + .getPaymentTypeMDMS(getMdmsPaymentModes(tenantId)); } catch (e) { return PaymentType(); } diff --git a/frontend/mgramseva/lib/providers/consumer_details_provider.dart b/frontend/mgramseva/lib/providers/consumer_details_provider.dart index 2d45f6b4c..4d15130aa 100644 --- a/frontend/mgramseva/lib/providers/consumer_details_provider.dart +++ b/frontend/mgramseva/lib/providers/consumer_details_provider.dart @@ -1,8 +1,10 @@ import 'dart:async'; + import 'package:flutter/material.dart'; import 'package:mgramseva/model/common/demand.dart'; import 'package:mgramseva/model/connection/property.dart'; import 'package:mgramseva/model/connection/tenant_boundary.dart'; +import 'package:mgramseva/model/connection/water_connection.dart' as addition; import 'package:mgramseva/model/connection/water_connection.dart'; import 'package:mgramseva/model/connection/water_connections.dart'; import 'package:mgramseva/model/localization/language.dart'; @@ -32,9 +34,6 @@ import 'package:mgramseva/utils/notifyers.dart'; import 'package:mgramseva/widgets/SearchSelectFieldBuilder.dart'; import 'package:mgramseva/widgets/dialog.dart'; import 'package:provider/provider.dart'; -import 'package:mgramseva/model/connection/water_connection.dart' as addition; - -import '../widgets/SelectFieldBuilder.dart'; class ConsumerProvider with ChangeNotifier { late List consmerWalkthrougList; @@ -57,7 +56,6 @@ class ConsumerProvider with ChangeNotifier { bool phoneNumberAutoValidation = false; GlobalKey? searchPickerKey; - setModel() async { waterconnection.BillingCycleCtrl.text = ""; var commonProvider = Provider.of( @@ -89,10 +87,10 @@ class ConsumerProvider with ChangeNotifier { onChangeOflocaity(property.address.localityCtrl); } if (commonProvider.userDetails?.selectedtenant?.code != null) { - property.address.gpNameCtrl - .text = commonProvider.userDetails!.selectedtenant!.code!; - property.address.gpNameCityCodeCtrl - .text = commonProvider.userDetails!.selectedtenant!.city!.code!; + property.address.gpNameCtrl.text = + commonProvider.userDetails!.selectedtenant!.code!; + property.address.gpNameCityCodeCtrl.text = + commonProvider.userDetails!.selectedtenant!.city!.code!; } } @@ -102,7 +100,7 @@ class ConsumerProvider with ChangeNotifier { } void onChangeOfCheckBox(bool? value, BuildContext context) { - if(value ?? false) showInActiveAlert(context); + if (value ?? false) showInActiveAlert(context); if (value == true) waterconnection.status = Constants.CONNECTION_STATUS.first; else @@ -111,21 +109,18 @@ class ConsumerProvider with ChangeNotifier { } showInActiveAlert(BuildContext context) { - showDialog( - context: context, - builder: (BuildContext context) { - return CustomDialog( - title: i18.common.ALERT, - content: i18.consumer.ALL_DEMANDS_REVERSED, - actions: [ - { - 'label' : i18.common.OK, - 'callBack' : () => Navigator.pop(context) - } - ], - ); - }, - ); + showDialog( + context: context, + builder: (BuildContext context) { + return CustomDialog( + title: i18.common.ALERT, + content: i18.consumer.ALL_DEMANDS_REVERSED, + actions: [ + {'label': i18.common.OK, 'callBack': () => Navigator.pop(context)} + ], + ); + }, + ); } Future getWaterConnection(id) async { @@ -158,24 +153,29 @@ class ConsumerProvider with ChangeNotifier { waterconnection = data; waterconnection.getText(); selectedcycle = DateFormats.timeStampToDate( - waterconnection.previousReadingDate, - format: 'yyyy-MM-dd') - .toString() + + waterconnection.previousReadingDate, + format: 'yyyy-MM-dd') + .toString() + " 00:00:00.000"; - if(waterconnection.previousReadingDate != null && (languageList?.mdmsRes?.billingService?.taxPeriodList?.isNotEmpty ?? false)) { + if (waterconnection.previousReadingDate != null && + (languageList?.mdmsRes?.billingService?.taxPeriodList?.isNotEmpty ?? + false)) { var date = DateTime.fromMillisecondsSinceEpoch( waterconnection.previousReadingDate!); DatePeriod datePeriod; - if(date.month > 3) - datePeriod = DatePeriod(DateTime(date.year, 4), DateTime(date.year+1, 3, 31, 23,59, 59, 999), DateType.YEAR); + if (date.month > 3) + datePeriod = DatePeriod(DateTime(date.year, 4), + DateTime(date.year + 1, 3, 31, 23, 59, 59, 999), DateType.YEAR); else - datePeriod = DatePeriod(DateTime(date.year -1, 4), DateTime(date.year, 3, 31, 23,59, 59, 999), DateType.YEAR); + datePeriod = DatePeriod(DateTime(date.year - 1, 4), + DateTime(date.year, 3, 31, 23, 59, 59, 999), DateType.YEAR); - billYear = languageList?.mdmsRes?.billingService?.taxPeriodList?.firstWhere((e) { + billYear = languageList?.mdmsRes?.billingService?.taxPeriodList + ?.firstWhere((e) { var date = DateTime.fromMillisecondsSinceEpoch(e.fromDate!); - return date.month == datePeriod.startDate.month && date.year == datePeriod.startDate.year; + return date.month == datePeriod.startDate.month && + date.year == datePeriod.startDate.year; }); - } List? demand = await ConsumerRepository().getDemandDetails({ "consumerCode": waterconnection.connectionNo, @@ -196,50 +196,40 @@ class ConsumerProvider with ChangeNotifier { .toString() .padLeft(5, '0'); waterconnection.om_1Ctrl.text = - meterReading - .toString() - .characters - .elementAt(0); + meterReading.toString().characters.elementAt(0); waterconnection.om_2Ctrl.text = - meterReading - .toString() - .characters - .elementAt(1); + meterReading.toString().characters.elementAt(1); waterconnection.om_3Ctrl.text = - meterReading - .toString() - .characters - .elementAt(2); + meterReading.toString().characters.elementAt(2); waterconnection.om_4Ctrl.text = - meterReading - .toString() - .characters - .elementAt(3); + meterReading.toString().characters.elementAt(3); waterconnection.om_5Ctrl.text = - meterReading - .toString() - .characters - .elementAt(4); + meterReading.toString().characters.elementAt(4); } - demand = demand?.where((element) => element.status != 'CANCELLED').toList(); + demand = + demand?.where((element) => element.status != 'CANCELLED').toList(); if (demand?.isEmpty == true) { isfirstdemand = false; } else if (demand?.length == 1 && demand?.first.consumerType == 'waterConnection-arrears') { isfirstdemand = false; - }else if(demand?.length == 1 && demand?.first.consumerType == 'waterConnection-advance' && demand?.first.demandDetails?.first.taxHeadMasterCode == 'WS_ADVANCE_CARRYFORWARD'){ + } else if (demand?.length == 1 && + demand?.first.consumerType == 'waterConnection-advance' && + demand?.first.demandDetails?.first.taxHeadMasterCode == + 'WS_ADVANCE_CARRYFORWARD') { isfirstdemand = false; } else { isfirstdemand = true; } - if(paymentDetails.payments != null && paymentDetails.payments!.isNotEmpty){ + if (paymentDetails.payments != null && + paymentDetails.payments!.isNotEmpty) { isfirstdemand = true; } notifyListeners(); - }catch(e,s){ + } catch (e, s) { ErrorHandler().allExceptionsHandler(navigatorKey.currentContext!, e, s); } } @@ -305,9 +295,15 @@ class ConsumerProvider with ChangeNotifier { "initialMeterReading": waterconnection.previousReading, "propertyType": property.propertyType, "meterReading": waterconnection.previousReading, - "category": waterconnection.categoryCtrl.text.trim().isEmpty ? null : waterconnection.additionalDetails?.category, - "subCategory": waterconnection.subCategoryCtrl.text.trim().isEmpty ? null : waterconnection.additionalDetails?.subCategory, - "aadharNumber": waterconnection.addharCtrl.text.trim().isEmpty ? null : waterconnection.addharCtrl.text.trim() + "category": waterconnection.categoryCtrl.text.trim().isEmpty + ? null + : waterconnection.additionalDetails?.category, + "subCategory": waterconnection.subCategoryCtrl.text.trim().isEmpty + ? null + : waterconnection.additionalDetails?.subCategory, + "aadharNumber": waterconnection.addharCtrl.text.trim().isEmpty + ? null + : waterconnection.addharCtrl.text.trim() }); } else { waterconnection.additionalDetails!.locality = @@ -315,11 +311,17 @@ class ConsumerProvider with ChangeNotifier { waterconnection.additionalDetails!.initialMeterReading = waterconnection.previousReading; waterconnection.additionalDetails!.category = - waterconnection.categoryCtrl.text.trim().isEmpty ? null : waterconnection.additionalDetails?.category; + waterconnection.categoryCtrl.text.trim().isEmpty + ? null + : waterconnection.additionalDetails?.category; waterconnection.additionalDetails!.subCategory = - waterconnection.subCategoryCtrl.text.trim().isEmpty ? null : waterconnection.additionalDetails?.subCategory; + waterconnection.subCategoryCtrl.text.trim().isEmpty + ? null + : waterconnection.additionalDetails?.subCategory; waterconnection.additionalDetails!.aadharNumber = - waterconnection.addharCtrl.text.trim().isEmpty ? null : waterconnection.addharCtrl.text.trim(); + waterconnection.addharCtrl.text.trim().isEmpty + ? null + : waterconnection.addharCtrl.text.trim(); waterconnection.additionalDetails!.street = property.address.street; waterconnection.additionalDetails!.doorNo = property.address.doorNo; waterconnection.additionalDetails!.meterReading = @@ -354,7 +356,7 @@ class ConsumerProvider with ChangeNotifier { property.address.geoLocation?.latitude = null; property.address.geoLocation?.longitude = null; property.source = 'WS'; - if(waterconnection.status == 'Inactive'){ + if (waterconnection.status == 'Inactive') { waterconnection.paymentType = null; waterconnection.penalty = null; waterconnection.arrears = null; @@ -397,8 +399,8 @@ class ConsumerProvider with ChangeNotifier { listen: false); var dateTime = DateTime.now(); - if(dateTime.month == 4){ - dateTime = DateTime(dateTime.year, dateTime.month -1, dateTime.day); + if (dateTime.month == 4) { + dateTime = DateTime(dateTime.year, dateTime.month - 1, dateTime.day); } var res = await CoreRepository().getMdms( @@ -413,9 +415,21 @@ class ConsumerProvider with ChangeNotifier { } Future getPaymentType() async { + var commonProvider = Provider.of( + navigatorKey.currentContext!, + listen: false); try { - var res = await CommonProvider.getMdmsBillingService(); - paymentType = res; + var res = await CommonProvider.getMdmsBillingService( + commonProvider.userDetails!.selectedtenant?.code.toString() ?? + commonProvider.userDetails!.userRequest!.tenantId.toString()); + if (res.mdmsRes?.billingService?.taxHeadMasterList != null && + res.mdmsRes!.billingService!.taxHeadMasterList!.isNotEmpty) { + paymentType = res; + } else { + var res = await CommonProvider.getMdmsBillingService( + commonProvider.userDetails!.userRequest!.tenantId.toString()); + paymentType = res; + } notifyListeners(); } catch (e) { print(e); @@ -437,10 +451,10 @@ class ConsumerProvider with ChangeNotifier { (element) => element.code == property.address.locality!.code); onChangeOflocaity(property.address.localityCtrl); - property.address.gpNameCtrl - .text = commonProvider.userDetails!.selectedtenant!.code!; - property.address.gpNameCityCodeCtrl - .text = commonProvider.userDetails!.selectedtenant!.city!.code!; + property.address.gpNameCtrl.text = + commonProvider.userDetails!.selectedtenant!.code!; + property.address.gpNameCityCodeCtrl.text = + commonProvider.userDetails!.selectedtenant!.city!.code!; streamController.add(property); notifyListeners(); } catch (e) { @@ -595,10 +609,14 @@ class ConsumerProvider with ChangeNotifier { dates = []; if (billYear != null) { late DatePeriod ytd; - if(DateTime.now().month >= 4) { - ytd = DatePeriod(DateTime(DateTime.now().year, 4) , DateTime(DateTime.now().year + 1, 4, 0, 23,59, 59, 999), DateType.YTD); - }else{ - ytd = DatePeriod(DateTime( DateTime.now().year - 1, 4), DateTime.now(), DateType.YTD); + if (DateTime.now().month >= 4) { + ytd = DatePeriod( + DateTime(DateTime.now().year, 4), + DateTime(DateTime.now().year + 1, 4, 0, 23, 59, 59, 999), + DateType.YTD); + } else { + ytd = DatePeriod( + DateTime(DateTime.now().year - 1, 4), DateTime.now(), DateType.YTD); } var date1 = DateFormats.getFormattedDateToDateTime( @@ -676,9 +694,11 @@ class ConsumerProvider with ChangeNotifier { List> getFinancialYearList() { if (languageList?.mdmsRes?.billingService?.taxPeriodList != null) { - CommonMethods.getFilteredFinancialYearList(languageList?.mdmsRes?.billingService?.taxPeriodList ?? []); + CommonMethods.getFilteredFinancialYearList( + languageList?.mdmsRes?.billingService?.taxPeriodList ?? + []); return (languageList?.mdmsRes?.billingService?.taxPeriodList ?? - []) + []) .map((value) { return DropdownMenuItem( value: value, @@ -689,21 +709,20 @@ class ConsumerProvider with ChangeNotifier { return >[]; } - void onChangeOfAmountType(value){ + void onChangeOfAmountType(value) { waterconnection.paymentType = value; - if(!isEdit) { + if (!isEdit) { waterconnection.penaltyCtrl.clear(); waterconnection.advanceCtrl.clear(); waterconnection.arrearsCtrl.clear(); - }else{ - - } + } else {} notifyListeners(); } List getPaymentTypeList() { - if(CommonProvider.getPenaltyOrAdvanceStatus(paymentType, true)) return Constants.CONSUMER_PAYMENT_TYPE; + if (CommonProvider.getPenaltyOrAdvanceStatus(paymentType, true)) + return Constants.CONSUMER_PAYMENT_TYPE; return [Constants.CONSUMER_PAYMENT_TYPE.first]; } } diff --git a/frontend/mgramseva/lib/providers/household_details_provider.dart b/frontend/mgramseva/lib/providers/household_details_provider.dart index 31f9421e8..fa7a4f81c 100644 --- a/frontend/mgramseva/lib/providers/household_details_provider.dart +++ b/frontend/mgramseva/lib/providers/household_details_provider.dart @@ -74,7 +74,18 @@ class HouseHoldProvider with ChangeNotifier { listen: false) .fetchBill(waterConnection, navigatorKey.currentContext!); - waterConnection?.mdmsData = await CommonProvider.getMdmsBillingService(); + var mdms = await CommonProvider.getMdmsBillingService( + commonProvider.userDetails!.selectedtenant?.code.toString() ?? + commonProvider.userDetails!.userRequest!.tenantId.toString()); + if (mdms.mdmsRes?.billingService?.taxHeadMasterList != null && + mdms.mdmsRes!.billingService!.taxHeadMasterList!.isNotEmpty) { + waterConnection?.mdmsData = mdms; + } else { + var mdmsData = await CommonProvider.getMdmsBillingService( + commonProvider.userDetails!.selectedtenant?.code.toString() ?? + commonProvider.userDetails!.userRequest!.tenantId.toString()); + waterConnection?.mdmsData = mdmsData; + } if (status != Constants.CONNECTION_STATUS.first) { if (demandList == null) { diff --git a/frontend/mgramseva/lib/utils/role_actions.dart b/frontend/mgramseva/lib/utils/role_actions.dart index 63cf20bb2..717a6d77f 100644 --- a/frontend/mgramseva/lib/utils/role_actions.dart +++ b/frontend/mgramseva/lib/utils/role_actions.dart @@ -1,5 +1,3 @@ -import 'dart:math'; - import 'package:mgramseva/providers/common_provider.dart'; import 'package:mgramseva/routers/Routers.dart'; import 'package:mgramseva/utils/constants.dart'; @@ -88,19 +86,18 @@ class RoleActionsFiltering { List getRolesBasedOnModule(String route) { switch (route) { - // GP Admin case Routes.HOUSEHOLD: return ['COLLECTION_OPERATOR', 'SUPERUSER']; case Routes.CONSUMER_UPDATE: - return ['GP_ADMIN', 'SUPERUSER']; + return ['GP_ADMIN', 'SUPERUSER', 'COLLECTION_OPERATOR']; case Routes.CONSUMER_SEARCH_UPDATE: - return ['GP_ADMIN', 'SUPERUSER']; + return ['GP_ADMIN', 'SUPERUSER', 'COLLECTION_OPERATOR']; case Routes.CONSUMER_CREATE: - return ['GP_ADMIN', 'SUPERUSER']; + return ['GP_ADMIN', 'SUPERUSER', 'COLLECTION_OPERATOR']; case Routes.HOUSEHOLD_DETAILS: return ['BULK_DEMAND_PROCESSING', 'COLLECTION_OPERATOR', 'SUPERUSER']; @@ -123,10 +120,6 @@ class RoleActionsFiltering { return ['EXPENSE_PROCESSING', 'SUPERUSER']; case Routes.EXPENSE_UPDATE: return ['EXPENSE_PROCESSING', 'SUPERUSER']; - - case Routes.HOUSEHOLD_DETAILS: - return ['BULK_DEMAND_PROCESSING', 'SUPERUSER']; - case Routes.HOUSEHOLDRECEIPTS: return ['BULK_DEMAND_PROCESSING', 'COLLECTION_OPERATOR', 'SUPERUSER']; diff --git a/frontend/mgramseva/package.json b/frontend/mgramseva/package.json index 55c797f0b..b13034528 100644 --- a/frontend/mgramseva/package.json +++ b/frontend/mgramseva/package.json @@ -1,5 +1,5 @@ { "name": "mgramseva", - "version": "1.2.2", + "version": "1.2.4", "license": "egov" } diff --git a/frontend/mgramseva/pubspec.yaml b/frontend/mgramseva/pubspec.yaml index 283d27209..3690a4f32 100644 --- a/frontend/mgramseva/pubspec.yaml +++ b/frontend/mgramseva/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.2.3+21 +version: 1.2.4+22 environment: sdk: ">=2.12.0 <3.0.0" diff --git a/municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/service/DemandService.java b/municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/service/DemandService.java index 3d5c8901c..0f421e7ec 100644 --- a/municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/service/DemandService.java +++ b/municipal-services/ws-calculator/src/main/java/org/egov/wscalculation/service/DemandService.java @@ -598,7 +598,7 @@ public List updateDemands(GetBillCriteria getBillCriteria, RequestInfoWr Map timeBasedExemptionMasterMap = new HashMap<>(); mstrDataService.setWaterConnectionMasterValues(requestInfo, getBillCriteria.getTenantId(), billingSlabMaster, timeBasedExemptionMasterMap); - + if (CollectionUtils.isEmpty(getBillCriteria.getConsumerCodes())) getBillCriteria.setConsumerCodes(Collections.singletonList(getBillCriteria.getConnectionNumber())); @@ -637,8 +637,14 @@ public List updateDemands(GetBillCriteria getBillCriteria, RequestInfoWr List taxPeriods = mstrDataService.getTaxPeriodList(requestInfoWrapper.getRequestInfo(), tenantId, WSCalculationConstant.SERVICE_FIELD_VALUE_WS); - Map penaltyMaster = mstrDataService.getApplicableMaster(estimationService.getAssessmentYear(), timeBasedExemptionMasterMap.get(WSCalculationConstant.WC_PENANLTY_MASTER)); + if(timeBasedExemptionMasterMap.get(WSCalculationConstant.WC_PENANLTY_MASTER) == null) { + mstrDataService.setWaterConnectionMasterValues(requestInfo, getBillCriteria.getTenantId().substring(0,2), billingSlabMaster, + timeBasedExemptionMasterMap); + } + Map penaltyMaster = mstrDataService.getApplicableMaster(estimationService.getAssessmentYear(), timeBasedExemptionMasterMap.get(WSCalculationConstant.WC_PENANLTY_MASTER)); + + if(null != penaltyMaster) { String type = (String) penaltyMaster.get(WSCalculationConstant.TYPE_FIELD_NAME); String subType = (String) penaltyMaster.get(WSCalculationConstant.SUBTYPE_FIELD_NAME);