-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bugfixes/reports #12
base: main
Are you sure you want to change the base?
Bugfixes/reports #12
Changes from all commits
43a09cc
26d1f6c
84b5389
2f96bf8
0032c99
4a5562c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"}}}}}} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,8 @@ | |
* Proprietary and confidential | ||
* Author: Pratik Mohite <[email protected]> | ||
*/ | ||
import 'dart:async'; | ||
|
||
import 'package:bachat_gat/common/constants.dart'; | ||
import 'package:bachat_gat/common/utils.dart'; | ||
|
||
|
@@ -46,6 +48,12 @@ class GroupsDao { | |
return groups; | ||
} | ||
|
||
// Future<List<MemberList>?> getMemberList() async { | ||
// var query = await dbService.read("select * from $memberTableName"); | ||
// var members = query.map((e) => MemberList.fromJson(e)).toList(); | ||
// return members; | ||
// } | ||
|
||
Future<int> addGroupMember(GroupMember member) async { | ||
var row = await dbService.insert(memberTableName, member.toJson()); | ||
return row; | ||
|
@@ -68,6 +76,12 @@ class GroupsDao { | |
return transactions; | ||
} | ||
|
||
Future<List<TransactionList>> getTransactionList() async { | ||
var rows = await dbService.read("select * from $transactionTableName"); | ||
var tranasctions = rows.map((e) => TransactionList.fromJson(e)).toList(); | ||
return tranasctions; | ||
} | ||
|
||
Future<int> addTransaction(Transaction trx) async { | ||
var row = await dbService.insert(transactionTableName, trx.toJson()); | ||
if (trx.trxType == AppConstants.ttLoan || | ||
|
@@ -116,6 +130,7 @@ class GroupsDao { | |
"paidLoanAmount = ($trxQuery), " | ||
"paidInterestAmount = ($trxQuery) " | ||
"where id = ?"; | ||
|
||
List<String> pars = [ | ||
AppConstants.ttLoan, | ||
AppConstants.sLoan, | ||
|
@@ -125,7 +140,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 +173,17 @@ class GroupsDao { | |
|
||
Future<int> 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, | ||
], | ||
); | ||
|
@@ -186,6 +210,12 @@ class GroupsDao { | |
return members; | ||
} | ||
|
||
Future<List<Loan>> getLoans() async { | ||
var rows = await dbService.read("select * from ${loanTableName};"); | ||
var loans = rows.map((e) => Loan.fromJson(e)).toList(); | ||
return loans; | ||
} | ||
|
||
Future<List<Loan>> getMemberLoans(MemberLoanFilter filter) async { | ||
String selectClause = "select * " | ||
"from $loanTableName "; | ||
|
@@ -389,6 +419,20 @@ class GroupsDao { | |
return 0.0; // Default value if no result | ||
} | ||
|
||
Future<String?> 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"; | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <[email protected]> | ||
*/ | ||
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<String, dynamic> json) => | ||
_$LoansListFromJson(json); | ||
|
||
@override | ||
Map<String, dynamic> toJson() => _$LoansListToJson(this); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <[email protected]> | ||
*/ | ||
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<String, dynamic> json) => | ||
_$TransactionListFromJson(json); | ||
|
||
@override | ||
Map<String, dynamic> toJson() => _$TransactionListToJson(this); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not going to work check query params