Skip to content
This repository has been archived by the owner on Nov 26, 2024. It is now read-only.

Commit

Permalink
Merge pull request #899 from egovernments/ISTE-292-Dev-Merge
Browse files Browse the repository at this point in the history
Ledger update
  • Loading branch information
pradeepkumarcm-egov authored Aug 9, 2024
2 parents 7fd9f1c + ac4dd01 commit 4373e28
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
10 changes: 9 additions & 1 deletion frontend/mgramseva/lib/model/reports/leadger_report.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,23 @@ class LedgerData {
class MonthData {
final LeadgerDemand? demand;
final List<LeadgerPayment>? payment;
final num? totalPaymentInMonth;
final num? totalBalanceLeftInMonth;

MonthData({this.demand, this.payment});
MonthData(
{this.demand,
this.payment,
this.totalPaymentInMonth,
this.totalBalanceLeftInMonth});

factory MonthData.fromJson(Map<String, dynamic> json) {
return MonthData(
demand: LeadgerDemand.fromJson(json['demand']),
payment: (json['payment'] as List<dynamic>?)
?.map((e) => LeadgerPayment.fromJson(e))
.toList(),
totalPaymentInMonth: json['totalPaymentInMonth'] as num?,
totalBalanceLeftInMonth: json['totalBalanceLeftInMonth'] as num?,
);
}
}
Expand Down
11 changes: 8 additions & 3 deletions frontend/mgramseva/lib/providers/reports_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,10 @@ class ReportsProvider with ChangeNotifier {
}
}

String formatPaymentReceipts(List<LeadgerPayment>? payments) {
return payments?.map((payment) => payment.receiptNo)?.join(', ') ?? '';
}

TableDataRow getLedgerRow(LedgerData data, {bool isExcel = false}) {
return TableDataRow([
TableData(
Expand All @@ -207,10 +211,11 @@ class ReportsProvider with ChangeNotifier {
'${DateFormats.leadgerTimeStampToDate(data.months?.values.first.demand?.dueDateOfPayment)}'),
TableData(
'${DateFormats.leadgerTimeStampToDate(data.months?.values.first.payment?.first.paymentCollectionDate)}'),
TableData('${data.months?.values.first.payment?.first.receiptNo}'),
TableData('₹ ${data.months?.values.first.payment?.first.amountPaid}'),
// TableData('${data.months?.values.first.payment?.first.receiptNo}'),
TableData('${formatPaymentReceipts(data.months?.values?.first.payment)}'),
TableData('₹ ${data.months?.values.first.totalPaymentInMonth}'),
TableData(
'₹ ${(double.parse("${data.months?.values.first.demand?.totalDues}") - double.parse("${data.months?.values.first.payment?.first.amountPaid}"))}'),
'₹ ${(double.parse("${data.months?.values.first.demand?.totalDues}") - double.parse("${data.months?.values.first.totalPaymentInMonth}"))}'),
TableData(
'${DateFormats.leadgerTimeStampToDate(data.months?.values.first.demand?.penaltyAppliedOnDate)}'),
TableData('₹ ${data.months?.values.first.demand?.penalty}'),
Expand Down
3 changes: 0 additions & 3 deletions frontend/mgramseva/lib/screeens/reports/leadger_table.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ import 'package:mgramseva/model/connection/water_connection.dart';
import 'package:mgramseva/utils/constants/i18_key_constants.dart';
import 'package:provider/provider.dart';
import '../../providers/reports_provider.dart';
import '../../utils/constants.dart';
import '../../utils/date_formats.dart';
import '../../utils/global_variables.dart';
import '../../utils/localization/application_localizations.dart';
import '../../widgets/label_text.dart';
import '../../widgets/pagination.dart';
Expand Down

0 comments on commit 4373e28

Please sign in to comment.