From 43a09cc5361cb8e88742573764173526865500ba Mon Sep 17 00:00:00 2001 From: Pranav Mohite Date: Tue, 30 Apr 2024 10:31:00 +0530 Subject: [PATCH 1/7] bug fixes in yearly Report and change the default time period in monthly_report.dart and yearly_report.dart --- lib/common/utils.dart | 4 ++++ .../groups/pages/pdf/member_report.dart | 5 ++--- .../groups/pages/pdf/monthly_report.dart | 5 +++-- .../groups/pages/pdf/yearly_report.dart | 22 +++++++------------ 4 files changed, 17 insertions(+), 19 deletions(-) diff --git a/lib/common/utils.dart b/lib/common/utils.dart index 8203173..1c7f0ce 100644 --- a/lib/common/utils.dart +++ b/lib/common/utils.dart @@ -59,6 +59,10 @@ class AppUtils { return "${dt.day}-${AppConstants.cEnMonthsStr[dt.month - 1]}-${dt.year}"; } + static String getHumanReadableMonthhDt(DateTime dt) { + return "${AppConstants.cEnMonthsStr[dt.month - 1]} ${dt.year}"; + } + static String getReadableTrxPeriod(DateTime dt) { return "${dt.day}-${AppConstants.cEnMonthsStr[dt.month - 1]}-${dt.year}"; } diff --git a/lib/features/groups/pages/pdf/member_report.dart b/lib/features/groups/pages/pdf/member_report.dart index f4654f3..c287af1 100644 --- a/lib/features/groups/pages/pdf/member_report.dart +++ b/lib/features/groups/pages/pdf/member_report.dart @@ -27,7 +27,7 @@ class _MemberReportState extends State { late String selectedMemberId; late List memberData; late String selectedMemberName; - DateTime _startDate = DateTime.now(); + late DateTime _startDate; DateTime _endDate = DateTime.now(); DateTimeRange dtchnage = DateTimeRange(start: DateTime.now(), end: DateTime.now()); @@ -112,8 +112,7 @@ class _MemberReportState extends State { _members = widget.members; selectedMemberId = _members.isEmpty ? "" : _members[0].id; selectedMemberName = _members.isEmpty ? " " : _members[0].name; - _startDate = DateTime.now(); - _endDate = DateTime.now(); + _startDate = DateTime(_endDate.year, _endDate.month - 1, _endDate.day); _textController = TextEditingController( text: "${formatDt(_startDate)} to ${formatDt(_endDate)}"); diff --git a/lib/features/groups/pages/pdf/monthly_report.dart b/lib/features/groups/pages/pdf/monthly_report.dart index 19b930a..0f8423b 100644 --- a/lib/features/groups/pages/pdf/monthly_report.dart +++ b/lib/features/groups/pages/pdf/monthly_report.dart @@ -4,6 +4,7 @@ * Proprietary and confidential * Author: Pratik Mohite */ +import 'package:bachat_gat/common/common_index.dart'; import 'package:bachat_gat/locals/app_local_delegate.dart'; import 'package:flutter/material.dart'; @@ -81,7 +82,7 @@ class _MonthlyReportState extends State { TextFormField( readOnly: true, decoration: InputDecoration( - labelText: "Select Date (YYYY-MM-DD)", + labelText: "Select Month", hintText: "Enter ${local.tfStartDate}", filled: true, ), @@ -140,7 +141,7 @@ class _MonthlyReportState extends State { textAlign: TextAlign.center, ), Text( - '${local.period} : ${local.getHumanTrxPeriod(_startDate)} ', + '${local.period} : ${AppUtils.getHumanReadableMonthhDt(_startDate)} ', style: const TextStyle( fontSize: 15, fontWeight: FontWeight.bold), ), diff --git a/lib/features/groups/pages/pdf/yearly_report.dart b/lib/features/groups/pages/pdf/yearly_report.dart index 75b064a..249c815 100644 --- a/lib/features/groups/pages/pdf/yearly_report.dart +++ b/lib/features/groups/pages/pdf/yearly_report.dart @@ -4,6 +4,7 @@ * Proprietary and confidential * Author: Pratik Mohite */ +import 'package:bachat_gat/common/common_index.dart'; import 'package:bachat_gat/locals/app_local_delegate.dart'; import 'package:flutter/material.dart'; @@ -21,8 +22,8 @@ class YearlyReport extends StatefulWidget { class _YearlyReportState extends State { late Group _group; - late DateTime _startDate = DateTime.now(); - late DateTime _endDate = DateTime.now(); + DateTime _startDate = DateTime(DateTime.now().year, 1, 1); + DateTime _endDate = DateTime.now(); bool isLoading = false; double totalcredit = 0.0; @@ -30,11 +31,9 @@ class _YearlyReportState extends State { String str = ''; String end = ''; double bankBalance = 0.0; - DateTimeRange dtchange = - DateTimeRange(start: DateTime.now(), end: DateTime.now()); String _formattDate(DateTime date) { - return "${date.month.toString().padLeft(2, "0")}/${date.year}"; + return "${date.year}-${date.month.toString().padLeft(2, "0")}"; } String formatDt(DateTime dt) { @@ -61,7 +60,7 @@ class _YearlyReportState extends State { ); _textController = TextEditingController( text: - "${formatDt(DateTime(_startDate.year - 1, _startDate.month, _startDate.day))} to ${formatDt(_endDate)}"); + " ${AppUtils.getHumanReadableDt(_startDate)} to ${AppUtils.getHumanReadableDt(_endDate)}"); } @override @@ -88,13 +87,10 @@ class _YearlyReportState extends State { ), controller: _textController, onTap: () async { - var dt = DateTimeRange( - start: DateTime(_startDate.year - 1, _startDate.month, - _startDate.day), - end: _endDate); DateTimeRange? selectedRange = await showDateRangePicker( context: context, - initialDateRange: dt, + initialDateRange: + DateTimeRange(start: _startDate, end: _endDate), firstDate: DateTime(2000), lastDate: DateTime(2099), initialEntryMode: DatePickerEntryMode.input, @@ -108,7 +104,6 @@ class _YearlyReportState extends State { end = local.getHumanTrxPeriod(_endDate); _textController.text = "${formatDt(selectedRange.start)} to ${formatDt(selectedRange.end)}"; - dtchange = selectedRange; }, ); } @@ -157,7 +152,6 @@ class _YearlyReportState extends State { setState(() { balanceSummary = summary; - isLoading = false; }); }, @@ -185,7 +179,7 @@ class _YearlyReportState extends State { textAlign: TextAlign.center, ), Text( - '${_formattDate(_startDate)} to ${_formattDate(_endDate)} ', + '${AppUtils.getHumanReadableMonthhDt(_startDate)} ${local.to} ${AppUtils.getHumanReadableMonthhDt(_endDate)} ', style: const TextStyle( fontSize: 15, fontWeight: FontWeight.bold), ), From 26d1f6cfcf80ebce0beba62c91905432342c9cba Mon Sep 17 00:00:00 2001 From: Pranav Mohite Date: Sat, 18 May 2024 15:24:18 +0530 Subject: [PATCH 2/7] bug fixes in yearly Report and change the default time period in monthly_report.dart and yearly_report.dart --- lib/common/utils.dart | 2 +- .../groups/pages/pdf/member_report.dart | 5 +- .../groups/pages/pdf/monthly_report.dart | 2 +- lib/features/groups/pages/pdf/pad_api2.dart | 197 ++++++++++++++++++ lib/features/groups/pages/pdf/pdf_api.dart | 4 +- .../groups/pages/pdf/yearly_report.dart | 2 +- lib/locals/app_local.dart | 3 + 7 files changed, 208 insertions(+), 7 deletions(-) create mode 100644 lib/features/groups/pages/pdf/pad_api2.dart diff --git a/lib/common/utils.dart b/lib/common/utils.dart index 1c7f0ce..41ed800 100644 --- a/lib/common/utils.dart +++ b/lib/common/utils.dart @@ -59,7 +59,7 @@ class AppUtils { return "${dt.day}-${AppConstants.cEnMonthsStr[dt.month - 1]}-${dt.year}"; } - static String getHumanReadableMonthhDt(DateTime dt) { + static String getHumanReadableMonthDt(DateTime dt) { return "${AppConstants.cEnMonthsStr[dt.month - 1]} ${dt.year}"; } diff --git a/lib/features/groups/pages/pdf/member_report.dart b/lib/features/groups/pages/pdf/member_report.dart index c287af1..7a18188 100644 --- a/lib/features/groups/pages/pdf/member_report.dart +++ b/lib/features/groups/pages/pdf/member_report.dart @@ -75,6 +75,7 @@ class _MemberReportState extends State { memberName: selectedMemberName, groupName: _group.name, context: context); + await PdfApi.previewPDF(bytes, selectedMemberName); } catch (e) { AppUtils.toast(context, "Failed to generate Pdf"); @@ -112,7 +113,7 @@ class _MemberReportState extends State { _members = widget.members; selectedMemberId = _members.isEmpty ? "" : _members[0].id; selectedMemberName = _members.isEmpty ? " " : _members[0].name; - _startDate = DateTime(_endDate.year, _endDate.month - 1, _endDate.day); + _startDate = DateTime(_endDate.year, _endDate.month - 1, 1); _textController = TextEditingController( text: "${formatDt(_startDate)} to ${formatDt(_endDate)}"); @@ -152,7 +153,7 @@ class _MemberReportState extends State { TextFormField( readOnly: true, decoration: InputDecoration( - labelText: "Select Date (YYYY-MM-DD) to (YYYY-MM-DD)", + labelText: "Select Date ", hintText: "Enter ${local.tfStartDate}", filled: true, ), diff --git a/lib/features/groups/pages/pdf/monthly_report.dart b/lib/features/groups/pages/pdf/monthly_report.dart index 0f8423b..855f5e4 100644 --- a/lib/features/groups/pages/pdf/monthly_report.dart +++ b/lib/features/groups/pages/pdf/monthly_report.dart @@ -141,7 +141,7 @@ class _MonthlyReportState extends State { textAlign: TextAlign.center, ), Text( - '${local.period} : ${AppUtils.getHumanReadableMonthhDt(_startDate)} ', + '${local.period} : ${AppUtils.getHumanReadableMonthDt(_startDate)} ', style: const TextStyle( fontSize: 15, fontWeight: FontWeight.bold), ), diff --git a/lib/features/groups/pages/pdf/pad_api2.dart b/lib/features/groups/pages/pdf/pad_api2.dart new file mode 100644 index 0000000..5d432b3 --- /dev/null +++ b/lib/features/groups/pages/pdf/pad_api2.dart @@ -0,0 +1,197 @@ +import 'package:bachat_gat/common/common_index.dart'; +import 'package:bachat_gat/features/groups/models/models_index.dart'; +import 'package:bachat_gat/locals/app_local_delegate.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:htmltopdfwidgets/htmltopdfwidgets.dart'; +import 'package:pdf/widgets.dart' as pw; +import 'package:printing/printing.dart'; + +import '../../dao/groups_dao.dart'; +import 'getFontLoad.dart'; + +class NewPdfApi { + static Future generatePdf( + {required String memberId, + required String groupId, + required DateTime startDate, + required DateTime endDate, + required String memberName, + required String groupName, + required BuildContext context}) async { + final dao = GroupsDao(); + final data = await dao.getMemberDetailsByMemberId( + memberId, + groupId, + AppUtils.getTrxPeriodFromDt(startDate), + AppUtils.getTrxPeriodFromDt(endDate)); + + return generateTable(data, memberName, groupName, context); + } + + static Future generateTable( + List memberData, + String memberName, + String groupName, + BuildContext context) async { + // Create the Font object + final rfont = await FontLoaders.loadFont( + 'assets/fonts/NotoSansDevanagari-Regular.ttf'); + final mfont = await FontLoaders.loadFont( + 'assets/fonts/NotoSansDevanagari-Medium.ttf'); + final bfont = + await FontLoaders.loadFont('assets/fonts/NotoSansDevanagari-Bold.ttf'); + final sbfont = await FontLoaders.loadFont( + 'assets/fonts/NotoSansDevanagari-SemiBold.ttf'); + final nfont = await FontLoaders.loadFont('assets/fonts/marathi.ttf'); + // Create the ThemeData with the loaded font + var myTheme = pw.ThemeData.withFont( + base: rfont, + bold: bfont, + fontFallback: [nfont, mfont, sbfont], + ); + final pdf = pw.Document( + theme: myTheme, + ); + var local = AppLocal.of(context); + // var previouRemainigLoan = 0.0; + final headers = [ + local.lmonth, + local.lShare, + local.lPaidLoan, + local.lPaidInterest, + local.lPenalty, + local.lOthers, + local.lTotal, + local.lGivenLoan, + local.lRmLoan, + ]; + + List totalPaid = []; + for (var m in memberData) { + double total = m.paidOtherAmount! + + m.paidInterest! + + m.paidLoan! + + m.paidLateFee! + + m.paidShares!; + totalPaid.add(total); + } + + final data = memberData.asMap().entries.map( + (entry) { + return [ + entry.value.trxPeriod ?? '0.0', + entry.value.paidShares?.toString() ?? '0.0', + entry.value.paidLoan?.toString() ?? '0.0', + entry.value.paidInterest?.toString() ?? '0.0', + entry.value.paidLateFee?.toString() ?? '0.0', + entry.value.paidOtherAmount?.toString() ?? '', + totalPaid[entry.key].toString(), + entry.value.loanTaken?.toString() ?? '0.0', + entry.value.remainingLoan?.toString() ?? '0.0', + // Add totalPaid for each member + ]; + }, + ).toList(); + print(data[0][0]); + var body = ''' + + + + + + Document + + + +

${local.tfGroupName} : $groupName

+

${local.lMemberName}: $memberName

+
+ + + + + + + + + + + + + + + + + + '''; + + var tableData = ''; + + for (int i = 0; i < data.length; i++) { + tableData = ''' + + + + + + + + + + + + '''; + body = body + tableData; + } + + var foot = ''' + +
${local.lmonth}${local.lShare}${local.lPaidLoan}${local.lPaidInterest}${local.lPenalty}${local.lOthers}${local.lTotal}${local.lGivenLoan}${local.lRmLoan}
${data[i][0]}${data[i][1]}${data[i][2]}${data[i][3]}${data[i][4]}${data[i][5]}${data[i][6]}${data[i][7]}${data[i][8]}
+
+ + '''; + + var finalBody = body + foot; + + print(finalBody); + + final widgets = await HTMLToPdf().convert(body); + pdf.addPage(pw.MultiPage( + pageFormat: PdfPageFormat.a4, build: (context) => widgets)); + return await pdf.save(); + } + + static Future previewPDF(Uint8List bytes, String filename) async { + await Printing.layoutPdf( + onLayout: (PdfPageFormat format) => bytes, name: filename); + } + + static Future sharePDF(Uint8List bytes, String filename) async { + await Printing.sharePdf(bytes: bytes, filename: filename); + } + + static Future saveAsPDF(Uint8List bytes, String fileName) async { + await AppUtils.saveAsBytes(fileName, "pdf", bytes); + } +} diff --git a/lib/features/groups/pages/pdf/pdf_api.dart b/lib/features/groups/pages/pdf/pdf_api.dart index acbb308..a3b7e21 100644 --- a/lib/features/groups/pages/pdf/pdf_api.dart +++ b/lib/features/groups/pages/pdf/pdf_api.dart @@ -99,7 +99,7 @@ class PdfApi { ]; }, ).toList(); - + print(data[0][0]); pdf.addPage( pw.Page( build: (context) { @@ -113,7 +113,7 @@ class PdfApi { pw.SizedBox(height: 20), pw.Column( children: [ - pw.Text("Member Name: $memberName", + pw.Text("${local.tfMemberName}: $memberName", style: pw.TextStyle( fontSize: 15, fontWeight: pw.FontWeight.normal, diff --git a/lib/features/groups/pages/pdf/yearly_report.dart b/lib/features/groups/pages/pdf/yearly_report.dart index 249c815..694b0b3 100644 --- a/lib/features/groups/pages/pdf/yearly_report.dart +++ b/lib/features/groups/pages/pdf/yearly_report.dart @@ -179,7 +179,7 @@ class _YearlyReportState extends State { textAlign: TextAlign.center, ), Text( - '${AppUtils.getHumanReadableMonthhDt(_startDate)} ${local.to} ${AppUtils.getHumanReadableMonthhDt(_endDate)} ', + '${AppUtils.getHumanReadableMonthDt(_startDate)} ${local.to} ${AppUtils.getHumanReadableMonthDt(_endDate)} ', style: const TextStyle( fontSize: 15, fontWeight: FontWeight.bold), ), diff --git a/lib/locals/app_local.dart b/lib/locals/app_local.dart index cb83004..e93ca82 100644 --- a/lib/locals/app_local.dart +++ b/lib/locals/app_local.dart @@ -113,6 +113,7 @@ abstract class AppLocalization { "lmcr": "Monthly credit", "lcb": "Monthly Closing balance", "lcrdr": "Total", + "lMemberaName":"Member Name", }; List get months => [ @@ -257,6 +258,7 @@ abstract class AppLocalization { String get lmcr => getValue("lmcr"); String get lcb => getValue("lcb"); String get lcrdr => getValue("lcrdr"); + String get lMemberName=>getValue("lMemberaName"); } class EnAppLocalization extends AppLocalization { @@ -372,6 +374,7 @@ class MrAppLocalization extends AppLocalization { "lmcr": "मासिक जमा", "lcb": "चालू महिन्यातील शिल्लक", "lcrdr": "एकूण ", + "lMemberaName":"सदस्याचे नाव", }; @override From 84b5389b634b055fd6ee9836902d8f2a91299192 Mon Sep 17 00:00:00 2001 From: Pranav Mohite Date: Fri, 24 May 2024 13:25:19 +0530 Subject: [PATCH 3/7] some changes in yearly report and also in groups_dao.dart --- lib/features/groups/dao/groups_dao.dart | 16 +- lib/features/groups/pages/pdf/pad_api2.dart | 197 ------------------ .../groups/pages/pdf/yearly_report.dart | 14 +- 3 files changed, 21 insertions(+), 206 deletions(-) delete mode 100644 lib/features/groups/pages/pdf/pad_api2.dart diff --git a/lib/features/groups/dao/groups_dao.dart b/lib/features/groups/dao/groups_dao.dart index a540016..b17aea5 100644 --- a/lib/features/groups/dao/groups_dao.dart +++ b/lib/features/groups/dao/groups_dao.dart @@ -116,6 +116,7 @@ class GroupsDao { "paidLoanAmount = ($trxQuery), " "paidInterestAmount = ($trxQuery) " "where id = ?"; + List pars = [ AppConstants.ttLoan, AppConstants.sLoan, @@ -125,7 +126,15 @@ class GroupsDao { loanId, loanId ]; + var row = await dbService.write(query, pars); + + var updateStatus = "update $loanTableName set " + " status = case when paidLoanAmount >= loanAmount then '${AppConstants.lsComplete}' else '${AppConstants.lsActive}' end " + " where id= ? "; + + var row1 = await dbService.write(updateStatus, [loanId]); + return row; } @@ -150,16 +159,17 @@ class GroupsDao { Future updateLoanPaid(Loan loan) async { String updateQuery = "update loans set " - "paidLoanAmount = paidLoanAmount + ?, " + "note = ?, " "paidInterestAmount = paidInterestAmount + ?, " - "status = case when paidLoanAmount>=loanAmount then ${AppConstants.lsComplete} else ${AppConstants.lsActive} end" - // "status = iif(paidLoanAmount >= loanAmount, '${AppConstants.lsComplete}', '${AppConstants.lsActive}') " + "status = case when paidLoanAmount+?>=loanAmount then ${AppConstants.lsComplete} else ${AppConstants.lsActive} end " "where id = ?"; + var row = await dbService.write( updateQuery, [ loan.paidLoanAmount, loan.paidInterestAmount, + loan.paidLoanAmount, loan.id, ], ); diff --git a/lib/features/groups/pages/pdf/pad_api2.dart b/lib/features/groups/pages/pdf/pad_api2.dart deleted file mode 100644 index 5d432b3..0000000 --- a/lib/features/groups/pages/pdf/pad_api2.dart +++ /dev/null @@ -1,197 +0,0 @@ -import 'package:bachat_gat/common/common_index.dart'; -import 'package:bachat_gat/features/groups/models/models_index.dart'; -import 'package:bachat_gat/locals/app_local_delegate.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:htmltopdfwidgets/htmltopdfwidgets.dart'; -import 'package:pdf/widgets.dart' as pw; -import 'package:printing/printing.dart'; - -import '../../dao/groups_dao.dart'; -import 'getFontLoad.dart'; - -class NewPdfApi { - static Future generatePdf( - {required String memberId, - required String groupId, - required DateTime startDate, - required DateTime endDate, - required String memberName, - required String groupName, - required BuildContext context}) async { - final dao = GroupsDao(); - final data = await dao.getMemberDetailsByMemberId( - memberId, - groupId, - AppUtils.getTrxPeriodFromDt(startDate), - AppUtils.getTrxPeriodFromDt(endDate)); - - return generateTable(data, memberName, groupName, context); - } - - static Future generateTable( - List memberData, - String memberName, - String groupName, - BuildContext context) async { - // Create the Font object - final rfont = await FontLoaders.loadFont( - 'assets/fonts/NotoSansDevanagari-Regular.ttf'); - final mfont = await FontLoaders.loadFont( - 'assets/fonts/NotoSansDevanagari-Medium.ttf'); - final bfont = - await FontLoaders.loadFont('assets/fonts/NotoSansDevanagari-Bold.ttf'); - final sbfont = await FontLoaders.loadFont( - 'assets/fonts/NotoSansDevanagari-SemiBold.ttf'); - final nfont = await FontLoaders.loadFont('assets/fonts/marathi.ttf'); - // Create the ThemeData with the loaded font - var myTheme = pw.ThemeData.withFont( - base: rfont, - bold: bfont, - fontFallback: [nfont, mfont, sbfont], - ); - final pdf = pw.Document( - theme: myTheme, - ); - var local = AppLocal.of(context); - // var previouRemainigLoan = 0.0; - final headers = [ - local.lmonth, - local.lShare, - local.lPaidLoan, - local.lPaidInterest, - local.lPenalty, - local.lOthers, - local.lTotal, - local.lGivenLoan, - local.lRmLoan, - ]; - - List totalPaid = []; - for (var m in memberData) { - double total = m.paidOtherAmount! + - m.paidInterest! + - m.paidLoan! + - m.paidLateFee! + - m.paidShares!; - totalPaid.add(total); - } - - final data = memberData.asMap().entries.map( - (entry) { - return [ - entry.value.trxPeriod ?? '0.0', - entry.value.paidShares?.toString() ?? '0.0', - entry.value.paidLoan?.toString() ?? '0.0', - entry.value.paidInterest?.toString() ?? '0.0', - entry.value.paidLateFee?.toString() ?? '0.0', - entry.value.paidOtherAmount?.toString() ?? '', - totalPaid[entry.key].toString(), - entry.value.loanTaken?.toString() ?? '0.0', - entry.value.remainingLoan?.toString() ?? '0.0', - // Add totalPaid for each member - ]; - }, - ).toList(); - print(data[0][0]); - var body = ''' - - - - - - Document - - - -

${local.tfGroupName} : $groupName

-

${local.lMemberName}: $memberName

-
- - - - - - - - - - - - - - - - - - '''; - - var tableData = ''; - - for (int i = 0; i < data.length; i++) { - tableData = ''' - - - - - - - - - - - - '''; - body = body + tableData; - } - - var foot = ''' - -
${local.lmonth}${local.lShare}${local.lPaidLoan}${local.lPaidInterest}${local.lPenalty}${local.lOthers}${local.lTotal}${local.lGivenLoan}${local.lRmLoan}
${data[i][0]}${data[i][1]}${data[i][2]}${data[i][3]}${data[i][4]}${data[i][5]}${data[i][6]}${data[i][7]}${data[i][8]}
-
- - '''; - - var finalBody = body + foot; - - print(finalBody); - - final widgets = await HTMLToPdf().convert(body); - pdf.addPage(pw.MultiPage( - pageFormat: PdfPageFormat.a4, build: (context) => widgets)); - return await pdf.save(); - } - - static Future previewPDF(Uint8List bytes, String filename) async { - await Printing.layoutPdf( - onLayout: (PdfPageFormat format) => bytes, name: filename); - } - - static Future sharePDF(Uint8List bytes, String filename) async { - await Printing.sharePdf(bytes: bytes, filename: filename); - } - - static Future saveAsPDF(Uint8List bytes, String fileName) async { - await AppUtils.saveAsBytes(fileName, "pdf", bytes); - } -} diff --git a/lib/features/groups/pages/pdf/yearly_report.dart b/lib/features/groups/pages/pdf/yearly_report.dart index 694b0b3..e6ce1d5 100644 --- a/lib/features/groups/pages/pdf/yearly_report.dart +++ b/lib/features/groups/pages/pdf/yearly_report.dart @@ -264,16 +264,18 @@ class _YearlyReportState extends State { balanceSummary.expenditures; break; case 11: - label = local.lRmLoan; - value = balanceSummary.remainingLoan - .toStringAsFixed(2); - case 12: label = local.lcrdr; value = (balanceSummary.expenditures + bankBalance + balanceSummary.givenLoan) .toStringAsFixed(2); break; + + case 12: + label = local.lRmLoan; + value = balanceSummary.remainingLoan + .toStringAsFixed(2); + break; } return Row( @@ -282,7 +284,7 @@ class _YearlyReportState extends State { Text( label, style: TextStyle( - color: (index == 7 || index == 12) + color: (index == 7 || index == 11) ? Colors.red : Colors.black, ), @@ -291,7 +293,7 @@ class _YearlyReportState extends State { Text( value, style: TextStyle( - color: (index == 7 || index == 12) + color: (index == 7 || index == 11) ? Colors.red : Colors.black, ), From 0032c99f3cb196cc47a8b50bca826abd72ff1c76 Mon Sep 17 00:00:00 2001 From: Pranav Mohite Date: Tue, 9 Jul 2024 19:53:15 +0530 Subject: [PATCH 4/7] added firebase sync button --- firebase.json | 1 + lib/features/groups/dao/groups_dao.dart | 18 ++++ .../groups/models/common/com_fields.g.dart | 6 -- .../groups/models/common/group.g.dart | 6 -- .../groups/models/common/group_members.g.dart | 6 -- lib/features/groups/models/common/loan.g.dart | 6 -- lib/features/groups/models/common/loans.dart | 79 ++++++++++++++++ .../groups/models/common/loans.g.dart | 45 ++++++++++ .../groups/models/common/transaction.g.dart | 6 -- .../models/common/transaction_list.dart | 84 +++++++++++++++++ .../models/common/transaction_list.g.dart | 49 ++++++++++ lib/features/groups/models/models_index.dart | 3 + .../requests/group_summary_filter.g.dart | 6 -- .../models/requests/group_total_filter.g.dart | 6 -- .../requests/member_balance_filter.g.dart | 6 -- .../models/requests/member_filter.g.dart | 6 -- .../models/requests/member_loan_filter.g.dart | 6 -- .../response/group_balance_summary.g.dart | 6 -- .../response/group_member_details.g.dart | 6 -- .../models/response/group_summary.g.dart | 6 -- .../groups/models/response/group_total.g.dart | 6 -- .../member_transaction_details.g.dart | 6 -- .../member_transaction_summary.g.dart | 6 -- .../response/monthly_balance_summary.g.dart | 6 -- .../pages/group/group_monthly_summary.dart | 13 ++- .../pages/group/group_summary_card.dart | 1 + .../pages/group/group_transaction_list.dart | 28 +++++- .../pages/save_data/import_export_page.dart | 53 +++++++++++ lib/firebase_options.dart | 89 +++++++++++++++++++ lib/locals/app_local.dart | 36 +++++--- lib/main.dart | 5 ++ .../flutter/generated_plugin_registrant.cc | 6 ++ windows/flutter/generated_plugins.cmake | 2 + 33 files changed, 496 insertions(+), 118 deletions(-) create mode 100644 firebase.json create mode 100644 lib/features/groups/models/common/loans.dart create mode 100644 lib/features/groups/models/common/loans.g.dart create mode 100644 lib/features/groups/models/common/transaction_list.dart create mode 100644 lib/features/groups/models/common/transaction_list.g.dart create mode 100644 lib/firebase_options.dart diff --git a/firebase.json b/firebase.json new file mode 100644 index 0000000..4e4c2a3 --- /dev/null +++ b/firebase.json @@ -0,0 +1 @@ +{"flutter":{"platforms":{"android":{"default":{"projectId":"dev-pratikm-project","appId":"1:1089445798939:android:74f628c1ed52d3d33344be","fileOutput":"android/app/google-services.json"}},"dart":{"lib/firebase_options.dart":{"projectId":"dev-pratikm-project","configurations":{"android":"1:1089445798939:android:74f628c1ed52d3d33344be","ios":"1:1089445798939:ios:0b966a6f94d1d7e63344be","macos":"1:1089445798939:ios:0b966a6f94d1d7e63344be","web":"1:1089445798939:web:54a17f777992b8893344be","windows":"1:1089445798939:web:8a7550a05168a5813344be"}}}}}} \ No newline at end of file diff --git a/lib/features/groups/dao/groups_dao.dart b/lib/features/groups/dao/groups_dao.dart index b17aea5..715af01 100644 --- a/lib/features/groups/dao/groups_dao.dart +++ b/lib/features/groups/dao/groups_dao.dart @@ -46,6 +46,12 @@ class GroupsDao { return groups; } + // Future?> getMemberList() async { + // var query = await dbService.read("select * from $memberTableName"); + // var members = query.map((e) => MemberList.fromJson(e)).toList(); + // return members; + // } + Future addGroupMember(GroupMember member) async { var row = await dbService.insert(memberTableName, member.toJson()); return row; @@ -68,6 +74,12 @@ class GroupsDao { return transactions; } + Future> getTransactionList() async { + var rows = await dbService.read("select * from $transactionTableName"); + var tranasctions = rows.map((e) => TransactionList.fromJson(e)).toList(); + return tranasctions; + } + Future addTransaction(Transaction trx) async { var row = await dbService.insert(transactionTableName, trx.toJson()); if (trx.trxType == AppConstants.ttLoan || @@ -196,6 +208,12 @@ class GroupsDao { return members; } + Future> getLoans() async { + var rows = await dbService.read("select * from ${loanTableName};"); + var loans = rows.map((e) => Loan.fromJson(e)).toList(); + return loans; + } + Future> getMemberLoans(MemberLoanFilter filter) async { String selectClause = "select * " "from $loanTableName "; diff --git a/lib/features/groups/models/common/com_fields.g.dart b/lib/features/groups/models/common/com_fields.g.dart index faa6640..53e8ff7 100644 --- a/lib/features/groups/models/common/com_fields.g.dart +++ b/lib/features/groups/models/common/com_fields.g.dart @@ -1,9 +1,3 @@ -/* - * Copyright (C) 2024-present Pratik Mohite, Inc - All Rights Reserved - * Unauthorized copying of this file, via any medium is strictly prohibited - * Proprietary and confidential - * Author: Pratik Mohite -*/ // GENERATED CODE - DO NOT MODIFY BY HAND part of 'com_fields.dart'; diff --git a/lib/features/groups/models/common/group.g.dart b/lib/features/groups/models/common/group.g.dart index a568795..06638ae 100644 --- a/lib/features/groups/models/common/group.g.dart +++ b/lib/features/groups/models/common/group.g.dart @@ -1,9 +1,3 @@ -/* - * Copyright (C) 2024-present Pratik Mohite, Inc - All Rights Reserved - * Unauthorized copying of this file, via any medium is strictly prohibited - * Proprietary and confidential - * Author: Pratik Mohite -*/ // GENERATED CODE - DO NOT MODIFY BY HAND part of 'group.dart'; diff --git a/lib/features/groups/models/common/group_members.g.dart b/lib/features/groups/models/common/group_members.g.dart index 5b801e3..d17a648 100644 --- a/lib/features/groups/models/common/group_members.g.dart +++ b/lib/features/groups/models/common/group_members.g.dart @@ -1,9 +1,3 @@ -/* - * Copyright (C) 2024-present Pratik Mohite, Inc - All Rights Reserved - * Unauthorized copying of this file, via any medium is strictly prohibited - * Proprietary and confidential - * Author: Pratik Mohite -*/ // GENERATED CODE - DO NOT MODIFY BY HAND part of 'group_members.dart'; diff --git a/lib/features/groups/models/common/loan.g.dart b/lib/features/groups/models/common/loan.g.dart index e2e59ed..f92c5bf 100644 --- a/lib/features/groups/models/common/loan.g.dart +++ b/lib/features/groups/models/common/loan.g.dart @@ -1,9 +1,3 @@ -/* - * Copyright (C) 2024-present Pratik Mohite, Inc - All Rights Reserved - * Unauthorized copying of this file, via any medium is strictly prohibited - * Proprietary and confidential - * Author: Pratik Mohite -*/ // GENERATED CODE - DO NOT MODIFY BY HAND part of 'loan.dart'; diff --git a/lib/features/groups/models/common/loans.dart b/lib/features/groups/models/common/loans.dart new file mode 100644 index 0000000..2716931 --- /dev/null +++ b/lib/features/groups/models/common/loans.dart @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2024-present Pratik Mohite, Inc - All Rights Reserved + * Unauthorized copying of this file, via any medium is strictly prohibited + * Proprietary and confidential + * Author: Pratik Mohite +*/ +import 'package:json_annotation/json_annotation.dart'; + +import 'com_fields.dart'; + +part 'loans.g.dart'; + +@JsonSerializable() +class LoansList extends ComFields { + String id = ""; + String memberId = ""; + String groupId = ""; + double loanAmount = 0.0; + double interestPercentage = 0.0; + double paidLoanAmount = 0.0; + double paidInterestAmount = 0.0; + String note = ""; + String status = ""; + String addedBy = ""; + DateTime loanDate = DateTime(2024, 1, 1); + late DateTime sysCreated; + late DateTime sysUpdated; + + LoansList({ + required this.id, + required this.memberId, + required this.groupId, + required this.loanAmount, + required this.interestPercentage, + required this.paidLoanAmount, + required this.paidInterestAmount, + required this.status, + required this.addedBy, + this.note = "", + DateTime? loanDate, + DateTime? sysCreated, + DateTime? sysUpdated, + }) { + this.loanDate = loanDate ?? DateTime.now(); + this.sysCreated = sysCreated ?? DateTime.now(); + this.sysUpdated = sysUpdated ?? DateTime.now(); + } + + LoansList.withEmpty() { + loanDate = DateTime.now(); + sysCreated = DateTime.now(); + sysUpdated = DateTime.now(); + } + + LoansList.withDefault({ + required this.id, + required this.memberId, + required this.groupId, + required this.loanAmount, + required this.interestPercentage, + required this.paidInterestAmount, + required this.status, + this.addedBy = "Admin", + this.note = "", + DateTime? laonDate, + DateTime? sysCreated, + DateTime? sysUpdated, + }) { + this.loanDate = loanDate ?? DateTime.now(); + sysCreated = DateTime.now(); + sysUpdated = DateTime.now(); + } + + factory LoansList.fromJson(Map json) => + _$LoansListFromJson(json); + + @override + Map toJson() => _$LoansListToJson(this); +} diff --git a/lib/features/groups/models/common/loans.g.dart b/lib/features/groups/models/common/loans.g.dart new file mode 100644 index 0000000..8b3ffd2 --- /dev/null +++ b/lib/features/groups/models/common/loans.g.dart @@ -0,0 +1,45 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'loans.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +LoansList _$LoansListFromJson(Map json) => LoansList( + id: json['id'] as String, + memberId: json['memberId'] as String, + groupId: json['groupId'] as String, + loanAmount: (json['loanAmount'] as num).toDouble(), + interestPercentage: (json['interestPercentage'] as num).toDouble(), + paidLoanAmount: (json['paidLoanAmount'] as num).toDouble(), + paidInterestAmount: (json['paidInterestAmount'] as num).toDouble(), + status: json['status'] as String, + addedBy: json['addedBy'] as String, + note: json['note'] as String? ?? "", + loanDate: json['loanDate'] == null + ? null + : DateTime.parse(json['loanDate'] as String), + sysCreated: json['sysCreated'] == null + ? null + : DateTime.parse(json['sysCreated'] as String), + sysUpdated: json['sysUpdated'] == null + ? null + : DateTime.parse(json['sysUpdated'] as String), + ); + +Map _$LoansListToJson(LoansList instance) => { + 'id': instance.id, + 'memberId': instance.memberId, + 'groupId': instance.groupId, + 'loanAmount': instance.loanAmount, + 'interestPercentage': instance.interestPercentage, + 'paidLoanAmount': instance.paidLoanAmount, + 'paidInterestAmount': instance.paidInterestAmount, + 'note': instance.note, + 'status': instance.status, + 'addedBy': instance.addedBy, + 'loanDate': instance.loanDate.toIso8601String(), + 'sysCreated': instance.sysCreated.toIso8601String(), + 'sysUpdated': instance.sysUpdated.toIso8601String(), + }; diff --git a/lib/features/groups/models/common/transaction.g.dart b/lib/features/groups/models/common/transaction.g.dart index ba0fc37..20c049d 100644 --- a/lib/features/groups/models/common/transaction.g.dart +++ b/lib/features/groups/models/common/transaction.g.dart @@ -1,9 +1,3 @@ -/* - * Copyright (C) 2024-present Pratik Mohite, Inc - All Rights Reserved - * Unauthorized copying of this file, via any medium is strictly prohibited - * Proprietary and confidential - * Author: Pratik Mohite -*/ // GENERATED CODE - DO NOT MODIFY BY HAND part of 'transaction.dart'; diff --git a/lib/features/groups/models/common/transaction_list.dart b/lib/features/groups/models/common/transaction_list.dart new file mode 100644 index 0000000..de59b88 --- /dev/null +++ b/lib/features/groups/models/common/transaction_list.dart @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2024-present Pratik Mohite, Inc - All Rights Reserved + * Unauthorized copying of this file, via any medium is strictly prohibited + * Proprietary and confidential + * Author: Pratik Mohite +*/ +import 'package:bachat_gat/common/common_index.dart'; +import 'package:json_annotation/json_annotation.dart'; + +import 'com_fields.dart'; + +part 'transaction_list.g.dart'; + +@JsonSerializable() +class TransactionList extends ComFields { + String memberId = ""; + String groupId = ""; + String trxType = ""; + late DateTime trxDt; + String trxPeriod = ""; + double cr = 0; + double dr = 0; + String sourceType = ""; + String sourceId = ""; + String addedBy = ""; + String note = ""; + String id = ""; + late DateTime sysCreated; + late DateTime sysUpdated; + + TransactionList({ + required this.id, + required this.memberId, + required this.groupId, + required this.trxType, + required this.trxPeriod, + required this.cr, + required this.dr, + required this.sourceType, + required this.sourceId, + required this.addedBy, + this.note = "", + DateTime? trxDt, + DateTime? sysCreated, + DateTime? sysUpdated, + }) { + this.trxDt = trxDt ?? DateTime.now(); + this.sysCreated = sysCreated ?? DateTime.now(); + this.sysUpdated = sysUpdated ?? DateTime.now(); + } + + TransactionList.withEmpty() { + trxDt = DateTime.now(); + sysCreated = DateTime.now(); + sysUpdated = DateTime.now(); + trxPeriod = AppUtils.getTrxPeriodFromDt(trxDt); + } + + TransactionList.withDefault({ + required this.memberId, + required this.groupId, + required this.trxType, + required this.trxPeriod, + this.cr = 0, + this.dr = 0, + this.sourceId = "", + this.sourceType = AppConstants.sUser, + this.addedBy = "Admin", + this.note = "", + DateTime? trxDt, + DateTime? sysCreated, + DateTime? sysUpdated, + }) { + this.trxDt = trxDt ?? DateTime.now(); + sysCreated = DateTime.now(); + sysUpdated = DateTime.now(); + } + + factory TransactionList.fromJson(Map json) => + _$TransactionListFromJson(json); + + @override + Map toJson() => _$TransactionListToJson(this); +} diff --git a/lib/features/groups/models/common/transaction_list.g.dart b/lib/features/groups/models/common/transaction_list.g.dart new file mode 100644 index 0000000..2c73592 --- /dev/null +++ b/lib/features/groups/models/common/transaction_list.g.dart @@ -0,0 +1,49 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'transaction_list.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +TransactionList _$TransactionListFromJson(Map json) => + TransactionList( + id: json['id'] as String, + memberId: json['memberId'] as String, + groupId: json['groupId'] as String, + trxType: json['trxType'] as String, + trxPeriod: json['trxPeriod'] as String, + cr: (json['cr'] as num).toDouble(), + dr: (json['dr'] as num).toDouble(), + sourceType: json['sourceType'] as String, + sourceId: json['sourceId'] as String, + addedBy: json['addedBy'] as String, + note: json['note'] as String? ?? "", + trxDt: json['trxDt'] == null + ? null + : DateTime.parse(json['trxDt'] as String), + sysCreated: json['sysCreated'] == null + ? null + : DateTime.parse(json['sysCreated'] as String), + sysUpdated: json['sysUpdated'] == null + ? null + : DateTime.parse(json['sysUpdated'] as String), + ); + +Map _$TransactionListToJson(TransactionList instance) => + { + 'memberId': instance.memberId, + 'groupId': instance.groupId, + 'trxType': instance.trxType, + 'trxDt': instance.trxDt.toIso8601String(), + 'trxPeriod': instance.trxPeriod, + 'cr': instance.cr, + 'dr': instance.dr, + 'sourceType': instance.sourceType, + 'sourceId': instance.sourceId, + 'addedBy': instance.addedBy, + 'note': instance.note, + 'id': instance.id, + 'sysCreated': instance.sysCreated.toIso8601String(), + 'sysUpdated': instance.sysUpdated.toIso8601String(), + }; diff --git a/lib/features/groups/models/models_index.dart b/lib/features/groups/models/models_index.dart index a9ad58c..6db64b5 100644 --- a/lib/features/groups/models/models_index.dart +++ b/lib/features/groups/models/models_index.dart @@ -9,7 +9,9 @@ export 'common/com_fields.dart'; export 'common/group.dart'; export 'common/group_members.dart'; export 'common/loan.dart'; +export 'common/loans.dart'; export 'common/transaction.dart'; +export 'common/transaction_list.dart'; export 'requests/group_summary_filter.dart'; export 'requests/group_total_filter.dart'; // Request @@ -24,3 +26,4 @@ export 'response/group_total.dart'; export 'response/member_transaction_details.dart'; export 'response/member_transaction_summary.dart'; export 'response/monthly_balance_summary.dart'; +// export 'response/memberList.dart'; diff --git a/lib/features/groups/models/requests/group_summary_filter.g.dart b/lib/features/groups/models/requests/group_summary_filter.g.dart index d16615f..93ddce9 100644 --- a/lib/features/groups/models/requests/group_summary_filter.g.dart +++ b/lib/features/groups/models/requests/group_summary_filter.g.dart @@ -1,9 +1,3 @@ -/* - * Copyright (C) 2024-present Pratik Mohite, Inc - All Rights Reserved - * Unauthorized copying of this file, via any medium is strictly prohibited - * Proprietary and confidential - * Author: Pratik Mohite -*/ // GENERATED CODE - DO NOT MODIFY BY HAND part of 'group_summary_filter.dart'; diff --git a/lib/features/groups/models/requests/group_total_filter.g.dart b/lib/features/groups/models/requests/group_total_filter.g.dart index f17ff1f..4a25e09 100644 --- a/lib/features/groups/models/requests/group_total_filter.g.dart +++ b/lib/features/groups/models/requests/group_total_filter.g.dart @@ -1,9 +1,3 @@ -/* - * Copyright (C) 2024-present Pratik Mohite, Inc - All Rights Reserved - * Unauthorized copying of this file, via any medium is strictly prohibited - * Proprietary and confidential - * Author: Pratik Mohite -*/ // GENERATED CODE - DO NOT MODIFY BY HAND part of 'group_total_filter.dart'; diff --git a/lib/features/groups/models/requests/member_balance_filter.g.dart b/lib/features/groups/models/requests/member_balance_filter.g.dart index 76f8009..5634aa2 100644 --- a/lib/features/groups/models/requests/member_balance_filter.g.dart +++ b/lib/features/groups/models/requests/member_balance_filter.g.dart @@ -1,9 +1,3 @@ -/* - * Copyright (C) 2024-present Pratik Mohite, Inc - All Rights Reserved - * Unauthorized copying of this file, via any medium is strictly prohibited - * Proprietary and confidential - * Author: Pratik Mohite -*/ // GENERATED CODE - DO NOT MODIFY BY HAND part of 'member_balance_filter.dart'; diff --git a/lib/features/groups/models/requests/member_filter.g.dart b/lib/features/groups/models/requests/member_filter.g.dart index 5c39645..092e8d6 100644 --- a/lib/features/groups/models/requests/member_filter.g.dart +++ b/lib/features/groups/models/requests/member_filter.g.dart @@ -1,9 +1,3 @@ -/* - * Copyright (C) 2024-present Pratik Mohite, Inc - All Rights Reserved - * Unauthorized copying of this file, via any medium is strictly prohibited - * Proprietary and confidential - * Author: Pratik Mohite -*/ // GENERATED CODE - DO NOT MODIFY BY HAND part of 'member_filter.dart'; diff --git a/lib/features/groups/models/requests/member_loan_filter.g.dart b/lib/features/groups/models/requests/member_loan_filter.g.dart index e34ae20..6def9ee 100644 --- a/lib/features/groups/models/requests/member_loan_filter.g.dart +++ b/lib/features/groups/models/requests/member_loan_filter.g.dart @@ -1,9 +1,3 @@ -/* - * Copyright (C) 2024-present Pratik Mohite, Inc - All Rights Reserved - * Unauthorized copying of this file, via any medium is strictly prohibited - * Proprietary and confidential - * Author: Pratik Mohite -*/ // GENERATED CODE - DO NOT MODIFY BY HAND part of 'member_loan_filter.dart'; diff --git a/lib/features/groups/models/response/group_balance_summary.g.dart b/lib/features/groups/models/response/group_balance_summary.g.dart index 0eb9717..d772300 100644 --- a/lib/features/groups/models/response/group_balance_summary.g.dart +++ b/lib/features/groups/models/response/group_balance_summary.g.dart @@ -1,9 +1,3 @@ -/* - * Copyright (C) 2024-present Pratik Mohite, Inc - All Rights Reserved - * Unauthorized copying of this file, via any medium is strictly prohibited - * Proprietary and confidential - * Author: Pratik Mohite -*/ // GENERATED CODE - DO NOT MODIFY BY HAND part of 'group_balance_summary.dart'; diff --git a/lib/features/groups/models/response/group_member_details.g.dart b/lib/features/groups/models/response/group_member_details.g.dart index 3933f41..8cbbb7c 100644 --- a/lib/features/groups/models/response/group_member_details.g.dart +++ b/lib/features/groups/models/response/group_member_details.g.dart @@ -1,9 +1,3 @@ -/* - * Copyright (C) 2024-present Pratik Mohite, Inc - All Rights Reserved - * Unauthorized copying of this file, via any medium is strictly prohibited - * Proprietary and confidential - * Author: Pratik Mohite -*/ // GENERATED CODE - DO NOT MODIFY BY HAND part of 'group_member_details.dart'; diff --git a/lib/features/groups/models/response/group_summary.g.dart b/lib/features/groups/models/response/group_summary.g.dart index b679806..c3e15bb 100644 --- a/lib/features/groups/models/response/group_summary.g.dart +++ b/lib/features/groups/models/response/group_summary.g.dart @@ -1,9 +1,3 @@ -/* - * Copyright (C) 2024-present Pratik Mohite, Inc - All Rights Reserved - * Unauthorized copying of this file, via any medium is strictly prohibited - * Proprietary and confidential - * Author: Pratik Mohite -*/ // GENERATED CODE - DO NOT MODIFY BY HAND part of 'group_summary.dart'; diff --git a/lib/features/groups/models/response/group_total.g.dart b/lib/features/groups/models/response/group_total.g.dart index 8a09388..11e41f1 100644 --- a/lib/features/groups/models/response/group_total.g.dart +++ b/lib/features/groups/models/response/group_total.g.dart @@ -1,9 +1,3 @@ -/* - * Copyright (C) 2024-present Pratik Mohite, Inc - All Rights Reserved - * Unauthorized copying of this file, via any medium is strictly prohibited - * Proprietary and confidential - * Author: Pratik Mohite -*/ // GENERATED CODE - DO NOT MODIFY BY HAND part of 'group_total.dart'; diff --git a/lib/features/groups/models/response/member_transaction_details.g.dart b/lib/features/groups/models/response/member_transaction_details.g.dart index 62cbc2e..88eab5b 100644 --- a/lib/features/groups/models/response/member_transaction_details.g.dart +++ b/lib/features/groups/models/response/member_transaction_details.g.dart @@ -1,9 +1,3 @@ -/* - * Copyright (C) 2024-present Pratik Mohite, Inc - All Rights Reserved - * Unauthorized copying of this file, via any medium is strictly prohibited - * Proprietary and confidential - * Author: Pratik Mohite -*/ // GENERATED CODE - DO NOT MODIFY BY HAND part of 'member_transaction_details.dart'; diff --git a/lib/features/groups/models/response/member_transaction_summary.g.dart b/lib/features/groups/models/response/member_transaction_summary.g.dart index 94e9167..fb15234 100644 --- a/lib/features/groups/models/response/member_transaction_summary.g.dart +++ b/lib/features/groups/models/response/member_transaction_summary.g.dart @@ -1,9 +1,3 @@ -/* - * Copyright (C) 2024-present Pratik Mohite, Inc - All Rights Reserved - * Unauthorized copying of this file, via any medium is strictly prohibited - * Proprietary and confidential - * Author: Pratik Mohite -*/ // GENERATED CODE - DO NOT MODIFY BY HAND part of 'member_transaction_summary.dart'; diff --git a/lib/features/groups/models/response/monthly_balance_summary.g.dart b/lib/features/groups/models/response/monthly_balance_summary.g.dart index e8c475a..dfbbdec 100644 --- a/lib/features/groups/models/response/monthly_balance_summary.g.dart +++ b/lib/features/groups/models/response/monthly_balance_summary.g.dart @@ -1,9 +1,3 @@ -/* - * Copyright (C) 2024-present Pratik Mohite, Inc - All Rights Reserved - * Unauthorized copying of this file, via any medium is strictly prohibited - * Proprietary and confidential - * Author: Pratik Mohite -*/ // GENERATED CODE - DO NOT MODIFY BY HAND part of 'monthly_balance_summary.dart'; diff --git a/lib/features/groups/pages/group/group_monthly_summary.dart b/lib/features/groups/pages/group/group_monthly_summary.dart index 98bc99d..447f531 100644 --- a/lib/features/groups/pages/group/group_monthly_summary.dart +++ b/lib/features/groups/pages/group/group_monthly_summary.dart @@ -96,7 +96,16 @@ class _GroupMonthlySummaryState extends State { ); }, ).toList(); - return DataTable(columns: columns, rows: rows); + double width = MediaQuery.of(context).size.width / columns.length; + return SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: ConstrainedBox( + constraints: + BoxConstraints(minWidth: MediaQuery.of(context).size.width), + child: DataTable(columns: columns, rows: rows), + ), + ); + // return DataTable(columnSpacing: width, columns: columns, rows: rows); } void dateRangePickup() async { @@ -164,7 +173,7 @@ class _GroupMonthlySummaryState extends State { ), bottomSheet: ExpansionTile( title: Text(local.sumr), - initiallyExpanded: true, + initiallyExpanded: false, children: [ GroupSummaryCard( key: Key("gs_${groupSummary.length}"), diff --git a/lib/features/groups/pages/group/group_summary_card.dart b/lib/features/groups/pages/group/group_summary_card.dart index d12bd9e..2406795 100644 --- a/lib/features/groups/pages/group/group_summary_card.dart +++ b/lib/features/groups/pages/group/group_summary_card.dart @@ -111,6 +111,7 @@ class _GroupSummaryCardState extends State { String cText = widget.viewMode == "balance" ? "Balance" : c.trxType; tableRows.add(buildTableRow(cText, c.totalCr - c.totalDr)); } + return Table( children: tableRows, ); diff --git a/lib/features/groups/pages/group/group_transaction_list.dart b/lib/features/groups/pages/group/group_transaction_list.dart index 47afbc5..9d41aa6 100644 --- a/lib/features/groups/pages/group/group_transaction_list.dart +++ b/lib/features/groups/pages/group/group_transaction_list.dart @@ -71,6 +71,28 @@ class _GroupTransactionListState extends State { } } + String getLocalValue(String trxType) { + var local = AppLocal.of(context); + const String ttBankInterest = "BankInterest"; + const String ttExpenditures = "Expenditures"; + const String ttOtherDeposit = "OtherDeposit"; + const String ttBankDeposit = "BankDeposit"; + const String ttBankCharges = "BankCharges"; + if (trxType == ttBankInterest) { + return local.ttBankInterest; + } else if (trxType == ttExpenditures) { + return local.ttExpenditures; + } else if (trxType == ttOtherDeposit) { + return local.ltOther; + } else if (trxType == ttBankDeposit) { + return local.ttBankDeposit; + } else if (trxType == ttBankCharges) { + return local.ttBankCharges; + } else { + return ""; + } + } + @override Widget build(BuildContext context) { var local = AppLocal.of(context); @@ -141,7 +163,7 @@ class _GroupTransactionListState extends State { cells: [ DataCell(Text(trx.trxPeriod)), DataCell(Text( - trx.trxType, + getLocalValue(trx.trxType), style: const TextStyle( fontWeight: FontWeight.w600, fontSize: 15), )), @@ -170,7 +192,9 @@ class _GroupTransactionListState extends State { style: const TextStyle( fontWeight: FontWeight.w600, fontSize: 15), )), - DataCell(Text(AppUtils.getHumanReadableDt(trx.trxDt))), + DataCell(Text(trx.trxDt.day.toString() + + "-" + + local.getHumanTrxPeriod(trx.trxDt))), DataCell( CustomDeleteIcon( item: trx, diff --git a/lib/features/groups/pages/save_data/import_export_page.dart b/lib/features/groups/pages/save_data/import_export_page.dart index 26adfdb..620fd05 100644 --- a/lib/features/groups/pages/save_data/import_export_page.dart +++ b/lib/features/groups/pages/save_data/import_export_page.dart @@ -7,11 +7,16 @@ import 'dart:io'; import 'package:bachat_gat/common/common_index.dart'; +import 'package:bachat_gat/features/groups/dao/dao_index.dart'; import 'package:bachat_gat/locals/app_local_delegate.dart'; +import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:sqflite/sqflite.dart' as sqlite; +import '../../models/models_index.dart'; +// import '../../models/common/group.dart'; + class ImportExportPage extends StatefulWidget { const ImportExportPage({super.key}); @@ -21,6 +26,10 @@ class ImportExportPage extends StatefulWidget { class _ImportExportPageState extends State { String dbVersion = ""; + String groupTableName = "groups"; + String memberTableName = "members"; + String transactionTableName = "transactions"; + String loanTableName = "loans"; Future fetchDbVersion() async { var dbService = DbService(); @@ -55,6 +64,7 @@ class _ImportExportPageState extends State { return; } var dbService = DbService(); + if (!kIsWeb) { await dbService.bkpDb(); } @@ -68,6 +78,44 @@ class _ImportExportPageState extends State { } } + Future syncDataToFirestore(BuildContext context) async { + final dao = GroupsDao(); + final db = FirebaseFirestore.instance; + + Future insertData( + String collectionName, Map data, String docId) async { + try { + await db.collection(collectionName).doc(docId).set(data); + ScaffoldMessenger.of(context).showSnackBar(SnackBar( + content: Text('$collectionName data inserted successfully'))); + } catch (e) { + ScaffoldMessenger.of(context).showSnackBar(SnackBar( + content: Text('Failed to insert $collectionName data: $e'))); + } + } + + var groups = await dao.getGroups(); + for (var group in groups) { + await insertData(groupTableName, group.toJson(), group.name); + var members = await dao.getMembers(MemberFilter(group.id)); + for (var member in members) { + await insertData(memberTableName, member.toJson(), member.id); + } + } + + var transactions = await dao.getTransactionList(); + for (var transaction in transactions) { + await insertData( + transactionTableName, transaction.toJson(), transaction.id); + } + + var loans = + await dao.getTransactionList(); // This might need to be dao.getLoans() + for (var loan in loans) { + await insertData(loanTableName, loan.toJson(), loan.id); + } + } + File changeFileNameOnlySync(String oldFilePath, String newFileName) { var file = File(oldFilePath); var path = file.path; @@ -115,6 +163,11 @@ class _ImportExportPageState extends State { icon: const Icon(Icons.call_made_rounded), label: Text(local.bExportFile), ), + ElevatedButton.icon( + onPressed: () => syncDataToFirestore(context), + icon: Icon(Icons.sync), + label: Text("Sync"), + ), ], ), Column( diff --git a/lib/firebase_options.dart b/lib/firebase_options.dart new file mode 100644 index 0000000..53ce2a7 --- /dev/null +++ b/lib/firebase_options.dart @@ -0,0 +1,89 @@ +// File generated by FlutterFire CLI. +// ignore_for_file: type=lint +import 'package:firebase_core/firebase_core.dart' show FirebaseOptions; +import 'package:flutter/foundation.dart' + show defaultTargetPlatform, kIsWeb, TargetPlatform; + +/// Default [FirebaseOptions] for use with your Firebase apps. +/// +/// Example: +/// ```dart +/// import 'firebase_options.dart'; +/// // ... +/// await Firebase.initializeApp( +/// options: DefaultFirebaseOptions.currentPlatform, +/// ); +/// ``` +class DefaultFirebaseOptions { + static FirebaseOptions get currentPlatform { + if (kIsWeb) { + return web; + } + switch (defaultTargetPlatform) { + case TargetPlatform.android: + return android; + case TargetPlatform.iOS: + return ios; + case TargetPlatform.macOS: + return macos; + case TargetPlatform.windows: + return windows; + case TargetPlatform.linux: + throw UnsupportedError( + 'DefaultFirebaseOptions have not been configured for linux - ' + 'you can reconfigure this by running the FlutterFire CLI again.', + ); + default: + throw UnsupportedError( + 'DefaultFirebaseOptions are not supported for this platform.', + ); + } + } + + static const FirebaseOptions web = FirebaseOptions( + apiKey: 'AIzaSyCq7HqAAB3ZWNjO993Gt-a6QNFbw_vSBfY', + appId: '1:1089445798939:web:54a17f777992b8893344be', + messagingSenderId: '1089445798939', + projectId: 'dev-pratikm-project', + authDomain: 'dev-pratikm-project.firebaseapp.com', + storageBucket: 'dev-pratikm-project.appspot.com', + measurementId: 'G-20LFF24H8E', + ); + + static const FirebaseOptions android = FirebaseOptions( + apiKey: 'AIzaSyBSJT0J_C4fv_LXKCFPfApIvfz7gq2IvXQ', + appId: '1:1089445798939:android:74f628c1ed52d3d33344be', + messagingSenderId: '1089445798939', + projectId: 'dev-pratikm-project', + storageBucket: 'dev-pratikm-project.appspot.com', + ); + + static const FirebaseOptions ios = FirebaseOptions( + apiKey: 'AIzaSyBFpYWKKMyok0He3YPftUi1guRwnhsyhOw', + appId: '1:1089445798939:ios:0b966a6f94d1d7e63344be', + messagingSenderId: '1089445798939', + projectId: 'dev-pratikm-project', + storageBucket: 'dev-pratikm-project.appspot.com', + iosBundleId: 'dev.pratikm.bachatGat', + ); + + static const FirebaseOptions macos = FirebaseOptions( + apiKey: 'AIzaSyBFpYWKKMyok0He3YPftUi1guRwnhsyhOw', + appId: '1:1089445798939:ios:0b966a6f94d1d7e63344be', + messagingSenderId: '1089445798939', + projectId: 'dev-pratikm-project', + storageBucket: 'dev-pratikm-project.appspot.com', + iosBundleId: 'dev.pratikm.bachatGat', + ); + + static const FirebaseOptions windows = FirebaseOptions( + apiKey: 'AIzaSyCq7HqAAB3ZWNjO993Gt-a6QNFbw_vSBfY', + appId: '1:1089445798939:web:8a7550a05168a5813344be', + messagingSenderId: '1089445798939', + projectId: 'dev-pratikm-project', + authDomain: 'dev-pratikm-project.firebaseapp.com', + storageBucket: 'dev-pratikm-project.appspot.com', + measurementId: 'G-X8RWHNZ6JP', + ); + +} \ No newline at end of file diff --git a/lib/locals/app_local.dart b/lib/locals/app_local.dart index e93ca82..f7f99b0 100644 --- a/lib/locals/app_local.dart +++ b/lib/locals/app_local.dart @@ -85,7 +85,7 @@ abstract class AppLocalization { "ltShares": "Total Shares (+)", "ltBankBalance": "Total Bank Balance", "ltExpenditures": "Other Expenditures", - "ltOther": "Other Deposit(+)", + "ltOther": "Other Deposit", "ltGathered": "Total Gathered", "lPrm": "Previous Remaining Balance", "lTSaving": "Total Saving", @@ -113,7 +113,11 @@ abstract class AppLocalization { "lmcr": "Monthly credit", "lcb": "Monthly Closing balance", "lcrdr": "Total", - "lMemberaName":"Member Name", + "lMemberaName": "Member Name", + "ttExpenditures": "Expenditure", + "ttBankInterest": "Bank Interest", + "ttBankDeposit": "BankDeposit", + "ttBankCharges": "Bank Charges", }; List get months => [ @@ -258,7 +262,11 @@ abstract class AppLocalization { String get lmcr => getValue("lmcr"); String get lcb => getValue("lcb"); String get lcrdr => getValue("lcrdr"); - String get lMemberName=>getValue("lMemberaName"); + String get lMemberName => getValue("lMemberaName"); + String get ttBankInterest => getValue("ttBankInterest"); + String get ttExpenditures => getValue("ttExpenditures"); + String get ttBankDeposit => getValue("ttBankDeposit"); + String get ttBankCharges => getValue("ttBankCharges"); } class EnAppLocalization extends AppLocalization { @@ -272,13 +280,13 @@ class MrAppLocalization extends AppLocalization { "appTitle": "बचत गट", "abAddLoan": "कर्ज जोडा", "abAddMember": "सदस्य जोडा", - "abRecordTransaction": "लेन-देन नोंदणी करा", + "abRecordTransaction": "जमा-खर्च नोंदणी करा", "abMemberList": "सदस्य", "abLoanList": "कर्ज", "abAddGroup": "समूह जोडा", "abImportExport": "आयात/निर्यात डेटा", - "mRecordedLoanPaymentSuccess": "कर्ज भुगतान सफळतेने नोंदणी केली", - "mRecordedSharePaymentSuccess": "शेअर भुगतान सफळतेने नोंदणी केली", + "mRecordedLoanPaymentSuccess": "कर्ज वसूली नोंदणी केली", + "mRecordedSharePaymentSuccess": "बचत नोंदणी केली", "mSelectLoan": "कृपया कर्ज निवडा", "mEnterLoanAmount": "कृपया कर्ज रक्कम प्रविष्ट करा", "mEnterShareAmount": "कृपया शेअर रक्कम प्रविष्ट करा", @@ -315,7 +323,7 @@ class MrAppLocalization extends AppLocalization { "tfLoanInterest": "कर्ज व्याज", "tfLateFee": "उशिर शुल्क", "tfShareAmount": "शेअर रक्कम", - "tfSelectLoanToPay": "भुगतान करण्यासाठी कर्ज निवडा", + "tfSelectLoanToPay": " वसुलीसाठी कर्ज निवडा", "tfMemberName": "सदस्याचे नाव", "tfMobileNo": "मोबाइल नंबर", "tfAadherNo": "आधार नंबर", @@ -323,16 +331,16 @@ class MrAppLocalization extends AppLocalization { "tfJoiningDate": "सामील होण्याची तारीख", "lLoanAmt": "कर्ज रक्कम", "lLoanInterest": "कर्ज व्याज", - "lPaidLoan": "भुगतान केलेला कर्ज", - "lPaidInterest": "भुगतान केलेला व्याज", + "lPaidLoan": "अंतर्गत कर्ज वसूली", + "lPaidInterest": "वसुली केलेला व्याज", "lLateFee": "उशिर शुल्क", "lShareAmount": "शेअर रक्कम", "lRmLoan": "बाकी कर्ज (-)", "lNote": "टिप", "lBalance": "शिल्लक", "lLoan": "कर्ज", - "lPaidShare": "भुगतान केलेला शेअर", - "lPaidLateFee": "भुगतान केलेला दंड", + "lPaidShare": "बचत जमा", + "lPaidLateFee": "दंड", "lShare": "शेअर", "lMember": "सदस्य", "lTotal": "एकूण", @@ -374,7 +382,11 @@ class MrAppLocalization extends AppLocalization { "lmcr": "मासिक जमा", "lcb": "चालू महिन्यातील शिल्लक", "lcrdr": "एकूण ", - "lMemberaName":"सदस्याचे नाव", + "lMemberaName": "सदस्याचे नाव", + "ttExpenditures": "खर्च", + "ttBankInterest": "बँक मधील व्याज", + "ttBankDeposit": "बँक जमा", + "ttBankCharges": "बँक शुल्क", }; @override diff --git a/lib/main.dart b/lib/main.dart index cd38d59..c1f897f 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -5,12 +5,17 @@ * Author: Pratik Mohite */ import 'package:bachat_gat/common/db_service.dart'; +import 'package:firebase_core/firebase_core.dart'; import 'package:flutter/material.dart'; import 'app_root.dart'; +import 'firebase_options.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); + await Firebase.initializeApp( + options: DefaultFirebaseOptions.currentPlatform, + ); var db = DbService(); await db.initDb(); runApp(const AppRoot()); diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index 5b86857..4ddd3e4 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -6,12 +6,18 @@ #include "generated_plugin_registrant.h" +#include #include +#include #include void RegisterPlugins(flutter::PluginRegistry* registry) { + CloudFirestorePluginCApiRegisterWithRegistrar( + registry->GetRegistrarForPlugin("CloudFirestorePluginCApi")); FileSaverPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("FileSaverPlugin")); + FirebaseCorePluginCApiRegisterWithRegistrar( + registry->GetRegistrarForPlugin("FirebaseCorePluginCApi")); PrintingPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("PrintingPlugin")); } diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index d7999c5..41171da 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -3,7 +3,9 @@ # list(APPEND FLUTTER_PLUGIN_LIST + cloud_firestore file_saver + firebase_core printing ) From 4a5562c54ddb36fef5433b356a1acf7a7550a78c Mon Sep 17 00:00:00 2001 From: Pranav Mohite Date: Tue, 13 Aug 2024 12:35:05 +0530 Subject: [PATCH 5/7] added firebase sync button,some minor changes in loan section to get loan interest properly --- lib/features/groups/dao/groups_dao.dart | 16 +++++++++ .../pages/member/member_details_list.dart | 2 ++ .../pages/save_data/import_export_page.dart | 2 -- .../transaction/add_member_transaction.dart | 36 +++++++++++++++---- 4 files changed, 48 insertions(+), 8 deletions(-) diff --git a/lib/features/groups/dao/groups_dao.dart b/lib/features/groups/dao/groups_dao.dart index 715af01..d7ae829 100644 --- a/lib/features/groups/dao/groups_dao.dart +++ b/lib/features/groups/dao/groups_dao.dart @@ -4,6 +4,8 @@ * Proprietary and confidential * Author: Pratik Mohite */ +import 'dart:async'; + import 'package:bachat_gat/common/constants.dart'; import 'package:bachat_gat/common/utils.dart'; @@ -417,6 +419,20 @@ class GroupsDao { return 0.0; // Default value if no result } + Future getLastLoanInterestDate(GroupMemberDetails filter) async { + var query = """ + SELECT trxPeriod from transactions where memberId=? and groupId=? order by trxPeriod desc limit 1 ; + """; + var result = await dbService.read(query, [filter.memberId, filter.groupId]); + DateTime currentMonth = DateTime.now(); + String date = AppUtils.getTrxPeriodFromDt(currentMonth); + if (result.isNotEmpty) { + String? dateFinal = (result.first["trxPeriod"] as String?)?.toString(); + return dateFinal; + } + return date; + } + String getAmountQuery(String trxType, String trxPeriod, [String mode = "cr"]) { String column = "t.cr"; diff --git a/lib/features/groups/pages/member/member_details_list.dart b/lib/features/groups/pages/member/member_details_list.dart index bf0adc0..53b3c27 100644 --- a/lib/features/groups/pages/member/member_details_list.dart +++ b/lib/features/groups/pages/member/member_details_list.dart @@ -105,6 +105,7 @@ class _MemberDetailsListState extends State { } Future handleAddLoanTrxClick(GroupMemberDetails memberDetails) async { + print("Loan inside"); await AppUtils.navigateTo( context, AddMemberTransaction( @@ -114,6 +115,7 @@ class _MemberDetailsListState extends State { mode: AppConstants.tmLoan, ), ); + getGroupMembers(); } diff --git a/lib/features/groups/pages/save_data/import_export_page.dart b/lib/features/groups/pages/save_data/import_export_page.dart index 620fd05..2e45235 100644 --- a/lib/features/groups/pages/save_data/import_export_page.dart +++ b/lib/features/groups/pages/save_data/import_export_page.dart @@ -86,8 +86,6 @@ class _ImportExportPageState extends State { String collectionName, Map data, String docId) async { try { await db.collection(collectionName).doc(docId).set(data); - ScaffoldMessenger.of(context).showSnackBar(SnackBar( - content: Text('$collectionName data inserted successfully'))); } catch (e) { ScaffoldMessenger.of(context).showSnackBar(SnackBar( content: Text('Failed to insert $collectionName data: $e'))); diff --git a/lib/features/groups/pages/transaction/add_member_transaction.dart b/lib/features/groups/pages/transaction/add_member_transaction.dart index e3cbadc..db8b128 100644 --- a/lib/features/groups/pages/transaction/add_member_transaction.dart +++ b/lib/features/groups/pages/transaction/add_member_transaction.dart @@ -41,7 +41,7 @@ class _AddMemberTransactionState extends State { late Transaction loanTrx; late Transaction loanInterestTrx; late Transaction lateFeeTrx; - + String? lastLoanInterestDate = ""; @override void initState() { groupMemberDetail = widget.groupMemberDetail; @@ -50,9 +50,15 @@ class _AddMemberTransactionState extends State { groupDao = GroupsDao(); prepareRequests(); getLoans(); + getLastDate(); super.initState(); } + Future getLastDate() async { + lastLoanInterestDate = + await groupDao.getLastLoanInterestDate(groupMemberDetail); + } + Future getLoans() async { memberLoans = []; var filter = MemberLoanFilter(group.id, groupMemberDetail.memberId); @@ -130,7 +136,7 @@ class _AddMemberTransactionState extends State { ), ], ); - break; + // break; case AppConstants.tmBoth: return Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -165,7 +171,7 @@ class _AddMemberTransactionState extends State { ), ], ); - break; + // break; case AppConstants.tmPayment: default: return Table( @@ -178,13 +184,28 @@ class _AddMemberTransactionState extends State { ) ], ); - break; + // break; } } + int CalculateMonthDifference(String startDateString, String endDateString) { + if (startDateString == "") { + return 1; + } + + List startParts = startDateString.split('-'); + int startYear = int.parse(startParts[0]); + int startMonth = int.parse(startParts[1]); + List endParts = endDateString.split('-'); + int endYear = int.parse(endParts[0]); + int endMonth = int.parse(endParts[1]); + return (endYear * 12 + endMonth) - (startYear * 12 + startMonth); + } + @override Widget build(BuildContext context) { var local = AppLocal.of(context); + print("IN the record transaction"); return Scaffold( appBar: AppBar( title: Text(local.abRecordTransaction), @@ -340,11 +361,14 @@ class _AddMemberTransactionState extends State { onChange: (op) { var remainingLoan = op.valueObj.loanAmount - op.valueObj.paidLoanAmount; var interest = op.valueObj.interestPercentage; + var lastDate = AppUtils.getTrxPeriodFromDt(trxPeriodDt); + var difference = + CalculateMonthDifference(lastLoanInterestDate!, lastDate); setState(() { loanTrx.sourceId = op.value; loanInterestTrx.sourceId = op.value; - loanInterestTrx.cr = - double.parse((remainingLoan * interest / 100).toStringAsFixed(2)); + loanInterestTrx.cr = double.parse( + (remainingLoan * interest * difference / 100).toStringAsFixed(2)); }); }, ); From df62256f3a63b226fd04b97fc04412477d66abc9 Mon Sep 17 00:00:00 2001 From: Pratik Mohite Date: Sun, 2 Feb 2025 12:23:58 +0530 Subject: [PATCH 6/7] Removed firebase config sync functionality --- android/app/build.gradle | 3 + android/app/google-services.json | 46 ++++++++++ android/settings.gradle | 3 + devtools_options.yaml | 3 + firebase.json | 2 +- ios/Runner.xcodeproj/project.pbxproj | 4 + ios/Runner/GoogleService-Info.plist | 30 +++++++ .../pages/save_data/import_export_page.dart | 84 +++++++++---------- lib/main.dart | 1 + macos/Flutter/GeneratedPluginRegistrant.swift | 4 + macos/Runner.xcodeproj/project.pbxproj | 4 + macos/Runner/GoogleService-Info.plist | 30 +++++++ package.json | 5 +- pubspec.lock | 56 +++++++++++++ pubspec.yaml | 34 ++++---- 15 files changed, 247 insertions(+), 62 deletions(-) create mode 100644 android/app/google-services.json create mode 100644 devtools_options.yaml create mode 100644 ios/Runner/GoogleService-Info.plist create mode 100644 macos/Runner/GoogleService-Info.plist diff --git a/android/app/build.gradle b/android/app/build.gradle index a4d77f1..c516a1f 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -1,5 +1,8 @@ plugins { id "com.android.application" + // START: FlutterFire Configuration + id 'com.google.gms.google-services' + // END: FlutterFire Configuration id "kotlin-android" // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. id "dev.flutter.flutter-gradle-plugin" diff --git a/android/app/google-services.json b/android/app/google-services.json new file mode 100644 index 0000000..e207bb0 --- /dev/null +++ b/android/app/google-services.json @@ -0,0 +1,46 @@ +{ + "project_info": { + "project_number": "1089445798939", + "project_id": "dev-pratikm-project", + "storage_bucket": "dev-pratikm-project.firebasestorage.app" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "1:1089445798939:android:74f628c1ed52d3d33344be", + "android_client_info": { + "package_name": "dev.pratikm.bachat_gat" + } + }, + "oauth_client": [ + { + "client_id": "1089445798939-6svltakl19qf3i7c4r05ft2le37662pl.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyBSJT0J_C4fv_LXKCFPfApIvfz7gq2IvXQ" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "1089445798939-6svltakl19qf3i7c4r05ft2le37662pl.apps.googleusercontent.com", + "client_type": 3 + }, + { + "client_id": "1089445798939-itrdafm0dpkc07q3h3cgqhpl74dd7gq9.apps.googleusercontent.com", + "client_type": 2, + "ios_info": { + "bundle_id": "dev.pratikm.bachatgatmanager" + } + } + ] + } + } + } + ], + "configuration_version": "1" +} \ No newline at end of file diff --git a/android/settings.gradle b/android/settings.gradle index b9e43bd..9759a22 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -19,6 +19,9 @@ pluginManagement { plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" id "com.android.application" version "8.1.0" apply false + // START: FlutterFire Configuration + id "com.google.gms.google-services" version "4.3.15" apply false + // END: FlutterFire Configuration id "org.jetbrains.kotlin.android" version "1.8.22" apply false } diff --git a/devtools_options.yaml b/devtools_options.yaml new file mode 100644 index 0000000..fa0b357 --- /dev/null +++ b/devtools_options.yaml @@ -0,0 +1,3 @@ +description: This file stores settings for Dart & Flutter DevTools. +documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states +extensions: diff --git a/firebase.json b/firebase.json index 4e4c2a3..d108b41 100644 --- a/firebase.json +++ b/firebase.json @@ -1 +1 @@ -{"flutter":{"platforms":{"android":{"default":{"projectId":"dev-pratikm-project","appId":"1:1089445798939:android:74f628c1ed52d3d33344be","fileOutput":"android/app/google-services.json"}},"dart":{"lib/firebase_options.dart":{"projectId":"dev-pratikm-project","configurations":{"android":"1:1089445798939:android:74f628c1ed52d3d33344be","ios":"1:1089445798939:ios:0b966a6f94d1d7e63344be","macos":"1:1089445798939:ios:0b966a6f94d1d7e63344be","web":"1:1089445798939:web:54a17f777992b8893344be","windows":"1:1089445798939:web:8a7550a05168a5813344be"}}}}}} \ No newline at end of file +{"flutter":{"platforms":{"android":{"default":{"projectId":"dev-pratikm-project","appId":"1:1089445798939:android:74f628c1ed52d3d33344be","fileOutput":"android/app/google-services.json"}},"dart":{"lib/firebase_options.dart":{"projectId":"dev-pratikm-project","configurations":{"android":"1:1089445798939:android:74f628c1ed52d3d33344be","ios":"1:1089445798939:ios:0b966a6f94d1d7e63344be","macos":"1:1089445798939:ios:0b966a6f94d1d7e63344be","web":"1:1089445798939:web:54a17f777992b8893344be","windows":"1:1089445798939:web:8a7550a05168a5813344be"}}},"ios":{"default":{"projectId":"dev-pratikm-project","appId":"1:1089445798939:ios:497bdb37a43b58893344be","uploadDebugSymbols":false,"fileOutput":"ios/Runner/GoogleService-Info.plist"}},"macos":{"default":{"projectId":"dev-pratikm-project","appId":"1:1089445798939:ios:497bdb37a43b58893344be","uploadDebugSymbols":false,"fileOutput":"macos/Runner/GoogleService-Info.plist"}}}}} \ No newline at end of file diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 0122179..c0dca49 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -8,6 +8,7 @@ /* Begin PBXBuildFile section */ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 14E39F2633DAE7647851C1BA /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = C41D59E3F30C884549DE11B9 /* GoogleService-Info.plist */; }; 1C4B0D0D5798D889A77D4F92 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 98DF3F15C5458D81BF4547EC /* Pods_Runner.framework */; }; 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; @@ -64,6 +65,7 @@ 9AA244328FBE2114961F23DA /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; 9BC9EE3FF06ED69FB46E63EA /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; AAEE6B343EDE05A10C0D394D /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + C41D59E3F30C884549DE11B9 /* GoogleService-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "Runner/GoogleService-Info.plist"; sourceTree = ""; }; EA0BCB6DB648C47CF1A2D60C /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ @@ -138,6 +140,7 @@ 331C8082294A63A400263BE5 /* RunnerTests */, 975F138FB75160BEE0854D2D /* Pods */, 4F6EAC1CE37B5800EAE5B5EA /* Frameworks */, + C41D59E3F30C884549DE11B9 /* GoogleService-Info.plist */, ); sourceTree = ""; }; @@ -264,6 +267,7 @@ 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, + 14E39F2633DAE7647851C1BA /* GoogleService-Info.plist in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/ios/Runner/GoogleService-Info.plist b/ios/Runner/GoogleService-Info.plist new file mode 100644 index 0000000..9051aac --- /dev/null +++ b/ios/Runner/GoogleService-Info.plist @@ -0,0 +1,30 @@ + + + + + API_KEY + AIzaSyBFpYWKKMyok0He3YPftUi1guRwnhsyhOw + GCM_SENDER_ID + 1089445798939 + PLIST_VERSION + 1 + BUNDLE_ID + dev.pratikm.bachatGat + PROJECT_ID + dev-pratikm-project + STORAGE_BUCKET + dev-pratikm-project.firebasestorage.app + IS_ADS_ENABLED + + IS_ANALYTICS_ENABLED + + IS_APPINVITE_ENABLED + + IS_GCM_ENABLED + + IS_SIGNIN_ENABLED + + GOOGLE_APP_ID + 1:1089445798939:ios:497bdb37a43b58893344be + + \ No newline at end of file diff --git a/lib/features/groups/pages/save_data/import_export_page.dart b/lib/features/groups/pages/save_data/import_export_page.dart index 2e45235..6bd40b3 100644 --- a/lib/features/groups/pages/save_data/import_export_page.dart +++ b/lib/features/groups/pages/save_data/import_export_page.dart @@ -7,9 +7,7 @@ import 'dart:io'; import 'package:bachat_gat/common/common_index.dart'; -import 'package:bachat_gat/features/groups/dao/dao_index.dart'; import 'package:bachat_gat/locals/app_local_delegate.dart'; -import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:sqflite/sqflite.dart' as sqlite; @@ -77,42 +75,42 @@ class _ImportExportPageState extends State { AppUtils.toast(context, e.toString()); } } - - Future syncDataToFirestore(BuildContext context) async { - final dao = GroupsDao(); - final db = FirebaseFirestore.instance; - - Future insertData( - String collectionName, Map data, String docId) async { - try { - await db.collection(collectionName).doc(docId).set(data); - } catch (e) { - ScaffoldMessenger.of(context).showSnackBar(SnackBar( - content: Text('Failed to insert $collectionName data: $e'))); - } - } - - var groups = await dao.getGroups(); - for (var group in groups) { - await insertData(groupTableName, group.toJson(), group.name); - var members = await dao.getMembers(MemberFilter(group.id)); - for (var member in members) { - await insertData(memberTableName, member.toJson(), member.id); - } - } - - var transactions = await dao.getTransactionList(); - for (var transaction in transactions) { - await insertData( - transactionTableName, transaction.toJson(), transaction.id); - } - - var loans = - await dao.getTransactionList(); // This might need to be dao.getLoans() - for (var loan in loans) { - await insertData(loanTableName, loan.toJson(), loan.id); - } - } + // + // Future syncDataToFirestore(BuildContext context) async { + // final dao = GroupsDao(); + // final db = FirebaseFirestore.instance; + // + // Future insertData( + // String collectionName, Map data, String docId) async { + // try { + // await db.collection(collectionName).doc(docId).set(data); + // } catch (e) { + // ScaffoldMessenger.of(context).showSnackBar(SnackBar( + // content: Text('Failed to insert $collectionName data: $e'))); + // } + // } + // + // var groups = await dao.getGroups(); + // for (var group in groups) { + // await insertData(groupTableName, group.toJson(), group.name); + // var members = await dao.getMembers(MemberFilter(group.id)); + // for (var member in members) { + // await insertData(memberTableName, member.toJson(), member.id); + // } + // } + // + // var transactions = await dao.getTransactionList(); + // for (var transaction in transactions) { + // await insertData( + // transactionTableName, transaction.toJson(), transaction.id); + // } + // + // var loans = + // await dao.getTransactionList(); // This might need to be dao.getLoans() + // for (var loan in loans) { + // await insertData(loanTableName, loan.toJson(), loan.id); + // } + // } File changeFileNameOnlySync(String oldFilePath, String newFileName) { var file = File(oldFilePath); @@ -161,11 +159,11 @@ class _ImportExportPageState extends State { icon: const Icon(Icons.call_made_rounded), label: Text(local.bExportFile), ), - ElevatedButton.icon( - onPressed: () => syncDataToFirestore(context), - icon: Icon(Icons.sync), - label: Text("Sync"), - ), + // ElevatedButton.icon( + // onPressed: () => syncDataToFirestore(context), + // icon: Icon(Icons.sync), + // label: Text("Sync"), + // ), ], ), Column( diff --git a/lib/main.dart b/lib/main.dart index c1f897f..d4a5d1d 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -14,6 +14,7 @@ import 'firebase_options.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); await Firebase.initializeApp( + name: "dev.pratikm.bachat_gat", options: DefaultFirebaseOptions.currentPlatform, ); var db = DbService(); diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index 3916ede..0932bba 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -5,16 +5,20 @@ import FlutterMacOS import Foundation +import cloud_firestore import file_picker import file_saver +import firebase_core import path_provider_foundation import printing import shared_preferences_foundation import sqflite_darwin func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { + FLTFirebaseFirestorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseFirestorePlugin")) FilePickerPlugin.register(with: registry.registrar(forPlugin: "FilePickerPlugin")) FileSaverPlugin.register(with: registry.registrar(forPlugin: "FileSaverPlugin")) + FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) PrintingPlugin.register(with: registry.registrar(forPlugin: "PrintingPlugin")) SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) diff --git a/macos/Runner.xcodeproj/project.pbxproj b/macos/Runner.xcodeproj/project.pbxproj index 1b49654..cf1d762 100644 --- a/macos/Runner.xcodeproj/project.pbxproj +++ b/macos/Runner.xcodeproj/project.pbxproj @@ -22,6 +22,7 @@ /* Begin PBXBuildFile section */ 04AA2273CC148B0D5602C7EE /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2797B7090EF8790AC113A61E /* Pods_Runner.framework */; }; + 154D63DE21257DDC810E0703 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 87FEC9CB0B9E83E7B52ACE46 /* GoogleService-Info.plist */; }; 331C80D8294CF71000263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C80D7294CF71000263BE5 /* RunnerTests.swift */; }; 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */; }; 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC10F02044A3C60003C045 /* AppDelegate.swift */; }; @@ -84,6 +85,7 @@ 62D4190605CA197588C33E27 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; 7EA031DF2450317446B14075 /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 87FEC9CB0B9E83E7B52ACE46 /* GoogleService-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "Runner/GoogleService-Info.plist"; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; B7070C078AB76DBE2350786E /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; CC74C0496A8BB3969E49AB5F /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; @@ -138,6 +140,7 @@ 33CC10EE2044A3C60003C045 /* Products */, D73912EC22F37F3D000D13A0 /* Frameworks */, 69D68F60EE031074832C6C28 /* Pods */, + 87FEC9CB0B9E83E7B52ACE46 /* GoogleService-Info.plist */, ); sourceTree = ""; }; @@ -315,6 +318,7 @@ files = ( 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */, 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */, + 154D63DE21257DDC810E0703 /* GoogleService-Info.plist in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/macos/Runner/GoogleService-Info.plist b/macos/Runner/GoogleService-Info.plist new file mode 100644 index 0000000..9051aac --- /dev/null +++ b/macos/Runner/GoogleService-Info.plist @@ -0,0 +1,30 @@ + + + + + API_KEY + AIzaSyBFpYWKKMyok0He3YPftUi1guRwnhsyhOw + GCM_SENDER_ID + 1089445798939 + PLIST_VERSION + 1 + BUNDLE_ID + dev.pratikm.bachatGat + PROJECT_ID + dev-pratikm-project + STORAGE_BUCKET + dev-pratikm-project.firebasestorage.app + IS_ADS_ENABLED + + IS_ANALYTICS_ENABLED + + IS_APPINVITE_ENABLED + + IS_GCM_ENABLED + + IS_SIGNIN_ENABLED + + GOOGLE_APP_ID + 1:1089445798939:ios:497bdb37a43b58893344be + + \ No newline at end of file diff --git a/package.json b/package.json index 32dfa78..3ddd111 100644 --- a/package.json +++ b/package.json @@ -4,5 +4,6 @@ "scripts": { "build": "dart run build_runner build -d", "run": "flutter pub get && flutter run" - } -} \ No newline at end of file + }, + "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e" +} diff --git a/pubspec.lock b/pubspec.lock index bce6125..3649d28 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -9,6 +9,14 @@ packages: url: "https://pub.dev" source: hosted version: "79.0.0" + _flutterfire_internals: + dependency: transitive + description: + name: _flutterfire_internals + sha256: e4f2a7ef31b0ab2c89d2bde35ef3e6e6aff1dce5e66069c6540b0e9cfe33ee6b + url: "https://pub.dev" + source: hosted + version: "1.3.50" _macros: dependency: transitive description: dart @@ -158,6 +166,30 @@ packages: url: "https://pub.dev" source: hosted version: "1.1.1" + cloud_firestore: + dependency: "direct main" + description: + name: cloud_firestore + sha256: "9ba2379f319906567f7078ebf086951c4e333c71620455084c18258f267f0636" + url: "https://pub.dev" + source: hosted + version: "5.6.2" + cloud_firestore_platform_interface: + dependency: transitive + description: + name: cloud_firestore_platform_interface + sha256: c3a2987addea08273c582a91f5fb173ca81916ef6d7f8e1a6760c3a8a3a53fc7 + url: "https://pub.dev" + source: hosted + version: "6.6.2" + cloud_firestore_web: + dependency: transitive + description: + name: cloud_firestore_web + sha256: "4c1bc404d825c68153660b12fd937b90b75cf3aa622cc077da5308ccaec17a9e" + url: "https://pub.dev" + source: hosted + version: "4.4.2" code_builder: dependency: transitive description: @@ -294,6 +326,30 @@ packages: url: "https://pub.dev" source: hosted version: "0.2.14" + firebase_core: + dependency: "direct main" + description: + name: firebase_core + sha256: d851c1ca98fd5a4c07c747f8c65dacc2edd84a4d9ac055d32a5f0342529069f5 + url: "https://pub.dev" + source: hosted + version: "3.10.1" + firebase_core_platform_interface: + dependency: transitive + description: + name: firebase_core_platform_interface + sha256: d7253d255ff10f85cfd2adaba9ac17bae878fa3ba577462451163bd9f1d1f0bf + url: "https://pub.dev" + source: hosted + version: "5.4.0" + firebase_core_web: + dependency: transitive + description: + name: firebase_core_web + sha256: fbc008cf390d909b823763064b63afefe9f02d8afdb13eb3f485b871afee956b + url: "https://pub.dev" + source: hosted + version: "2.19.0" fixnum: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 5e9099f..d86e833 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -14,27 +14,29 @@ dependencies: sdk: flutter flutter_localizations: sdk: flutter - cupertino_icons: ^1.0.6 - sqflite: ^2.3.3 - sqflite_common_ffi: ^2.3.3 - sqflite_common_ffi_web: ^0.4.3+1 - uuid: ^4.4.0 - json_annotation: ^4.8.1 - file_saver: ^0.2.12 - file_picker: ^8.0.0+1 - shared_preferences: ^2.2.3 - pdf: ^3.10.8 - printing: ^5.12.0 - excel: ^4.0.3 - open_filex: ^4.4.0 - cross_file: ^0.3.4+1 + cupertino_icons: ^1.0.8 + sqflite: ^2.4.1 + sqflite_common_ffi: ^2.3.4+4 + sqflite_common_ffi_web: ^0.4.5+4 + uuid: ^4.5.1 + json_annotation: ^4.9.0 + file_saver: ^0.2.14 + file_picker: ^8.3.1 + shared_preferences: ^2.5.1 + pdf: ^3.11.2 + printing: ^5.14.0 + excel: ^4.0.6 + open_filex: ^4.6.0 + cross_file: ^0.3.4+2 + firebase_core: ^3.10.1 + cloud_firestore: ^5.6.2 dev_dependencies: flutter_test: sdk: flutter flutter_lints: ^5.0.0 - json_serializable: ^6.7.1 - build_runner: ^2.4.9 + json_serializable: ^6.9.3 + build_runner: ^2.4.14 flutter: From 6233dd5aa3f6ed2c4e3b1e4ed545d5e7e45cbdd6 Mon Sep 17 00:00:00 2001 From: Pratik Mohite Date: Sun, 2 Feb 2025 12:30:47 +0530 Subject: [PATCH 7/7] Removed print statements --- lib/features/groups/pages/member/member_details_list.dart | 1 - lib/features/groups/pages/pdf/pdf_api.dart | 1 - .../groups/pages/transaction/add_member_transaction.dart | 1 - 3 files changed, 3 deletions(-) diff --git a/lib/features/groups/pages/member/member_details_list.dart b/lib/features/groups/pages/member/member_details_list.dart index 53b3c27..7fd2dde 100644 --- a/lib/features/groups/pages/member/member_details_list.dart +++ b/lib/features/groups/pages/member/member_details_list.dart @@ -105,7 +105,6 @@ class _MemberDetailsListState extends State { } Future handleAddLoanTrxClick(GroupMemberDetails memberDetails) async { - print("Loan inside"); await AppUtils.navigateTo( context, AddMemberTransaction( diff --git a/lib/features/groups/pages/pdf/pdf_api.dart b/lib/features/groups/pages/pdf/pdf_api.dart index a3b7e21..b7422c0 100644 --- a/lib/features/groups/pages/pdf/pdf_api.dart +++ b/lib/features/groups/pages/pdf/pdf_api.dart @@ -99,7 +99,6 @@ class PdfApi { ]; }, ).toList(); - print(data[0][0]); pdf.addPage( pw.Page( build: (context) { diff --git a/lib/features/groups/pages/transaction/add_member_transaction.dart b/lib/features/groups/pages/transaction/add_member_transaction.dart index db8b128..c26e06d 100644 --- a/lib/features/groups/pages/transaction/add_member_transaction.dart +++ b/lib/features/groups/pages/transaction/add_member_transaction.dart @@ -205,7 +205,6 @@ class _AddMemberTransactionState extends State { @override Widget build(BuildContext context) { var local = AppLocal.of(context); - print("IN the record transaction"); return Scaffold( appBar: AppBar( title: Text(local.abRecordTransaction),