Show expenses as paid

This commit is contained in:
Hillel Coren 2022-06-13 10:56:43 +03:00
parent 2f6dac2509
commit ce171321a1
2 changed files with 8 additions and 0 deletions

View File

@ -101,6 +101,7 @@ class ExpenseStatusColors {
kExpenseStatusLogged: _colorTheme.colorGray, kExpenseStatusLogged: _colorTheme.colorGray,
kExpenseStatusPending: _colorTheme.colorPrimary, kExpenseStatusPending: _colorTheme.colorPrimary,
kExpenseStatusInvoiced: _colorTheme.colorSuccess, kExpenseStatusInvoiced: _colorTheme.colorSuccess,
kExpenseStatusPaid: _colorTheme.colorInfo,
}; };
} }
} }

View File

@ -638,6 +638,11 @@ abstract class ExpenseEntity extends Object
@BuiltValueField(compare: false) @BuiltValueField(compare: false)
int get loadedAt; int get loadedAt;
bool get isPaid =>
paymentDate.isNotEmpty ||
paymentTypeId.isNotEmpty ||
transactionReference.isNotEmpty;
bool isBetween(String startDate, String endDate) { bool isBetween(String startDate, String endDate) {
return (startDate ?? '').compareTo(date ?? '') <= 0 && return (startDate ?? '').compareTo(date ?? '') <= 0 &&
(endDate ?? '').compareTo(date ?? '') >= 0; (endDate ?? '').compareTo(date ?? '') >= 0;
@ -787,6 +792,8 @@ abstract class ExpenseEntity extends Object
return kExpenseStatusInvoiced; return kExpenseStatusInvoiced;
} else if (shouldBeInvoiced) { } else if (shouldBeInvoiced) {
return kExpenseStatusPending; return kExpenseStatusPending;
} else if (isPaid) {
return kExpenseStatusPaid;
} else { } else {
return kExpenseStatusLogged; return kExpenseStatusLogged;
} }