diff --git a/lib/data/models/expense_model.dart b/lib/data/models/expense_model.dart index c8e13d35c..75c232d37 100644 --- a/lib/data/models/expense_model.dart +++ b/lib/data/models/expense_model.dart @@ -56,7 +56,9 @@ class ExpenseFields { static const String currencyId = 'currency_id'; static const String categoryId = 'category_id'; static const String category = 'category'; + static const String netAmount = 'net_amount'; static const String amount = 'amount'; + static const String taxAmount = 'tax_amount'; static const String expenseDate = 'date'; static const String paymentDate = 'payment_date'; static const String exchangeRate = 'exchange_rate'; @@ -317,6 +319,9 @@ abstract class ExpenseEntity extends Object final ExpenseEntity expenseB = sortAscending ? expense : this; switch (sortField) { + case ExpenseFields.netAmount: + response = expenseA.netAmount.compareTo(expenseB.netAmount); + break; case ExpenseFields.amount: response = expenseA.amount.compareTo(expenseB.amount); break; @@ -590,7 +595,7 @@ abstract class ExpenseEntity extends Object double get convertedExchangeRate => exchangeRate == 0 ? 1 : exchangeRate; - double get convertedAmount => round(amount * convertedExchangeRate, 2); + double get convertedAmount => round(grossAmount * convertedExchangeRate, 2); double get convertedAmountWithTax => round(grossAmount * convertedExchangeRate, 2); diff --git a/lib/ui/app/presenters/entity_presenter.dart b/lib/ui/app/presenters/entity_presenter.dart index a58c23b60..60e8e4600 100644 --- a/lib/ui/app/presenters/entity_presenter.dart +++ b/lib/ui/app/presenters/entity_presenter.dart @@ -83,10 +83,10 @@ class EntityPresenter { 'tax_amount', 'tax_paid', 'payment_amount', - 'net_amount', 'net_balance', 'rate', 'calculated_rate', 'duration', + 'net_amount', ].contains(field); } diff --git a/lib/ui/expense/expense_presenter.dart b/lib/ui/expense/expense_presenter.dart index 48e8f04f0..f75608862 100644 --- a/lib/ui/expense/expense_presenter.dart +++ b/lib/ui/expense/expense_presenter.dart @@ -24,6 +24,8 @@ class ExpensePresenter extends EntityPresenter { ...getDefaultTableFields(userCompany), ...EntityPresenter.getBaseFields(), ExpenseFields.number, + ExpenseFields.netAmount, + ExpenseFields.taxAmount, ExpenseFields.privateNotes, ExpenseFields.shouldBeInvoiced, ExpenseFields.transactionId, @@ -71,8 +73,15 @@ class ExpensePresenter extends EntityPresenter { .listDisplayName); case ExpenseFields.expenseDate: return Text(formatDate(expense.paymentDate, context)); + case ExpenseFields.netAmount: + return Text(formatNumber(expense.netAmount, context, + currencyId: expense.currencyId)); case ExpenseFields.amount: - return Text(formatNumber(expense.amount, context)); + return Text(formatNumber(expense.amount, context, + currencyId: expense.currencyId)); + case ExpenseFields.taxAmount: + return Text(formatNumber(expense.taxAmount, context, + currencyId: expense.currencyId)); case ExpenseFields.publicNotes: return Text(expense.publicNotes); case ExpenseFields.number: diff --git a/lib/utils/i18n.dart b/lib/utils/i18n.dart index f5efde07a..884a6cd00 100644 --- a/lib/utils/i18n.dart +++ b/lib/utils/i18n.dart @@ -51250,8 +51250,7 @@ mixin LocalizationsProvider on LocaleCodeAware { String get searchTaskStatus => _localizedValues[localeCode]['search_task_status']; - String get expenseTotal => - _localizedValues[localeCode]['expense_total']; + String get expenseTotal => _localizedValues[localeCode]['expense_total']; String get expenseCategory => _localizedValues[localeCode]['expense_category']; @@ -52434,8 +52433,7 @@ mixin LocalizationsProvider on LocaleCodeAware { String get projectNumber => _localizedValues[localeCode]['project_number'] ?? ''; - String get projectName => - _localizedValues[localeCode]['project_name'] ?? ''; + String get projectName => _localizedValues[localeCode]['project_name'] ?? ''; String get taskNumber => _localizedValues[localeCode]['task_number'] ?? '';