Add payment type to expenses lists

This commit is contained in:
Hillel Coren 2021-11-01 08:25:05 +02:00
parent f781d34acf
commit 8cbe10b334
3 changed files with 11 additions and 0 deletions

View File

@ -64,6 +64,7 @@ class ExpenseFields {
static const String taxAmount = 'tax_amount'; static const String taxAmount = 'tax_amount';
static const String expenseDate = 'date'; static const String expenseDate = 'date';
static const String paymentDate = 'payment_date'; static const String paymentDate = 'payment_date';
static const String paymentType = 'payment_type';
static const String exchangeRate = 'exchange_rate'; static const String exchangeRate = 'exchange_rate';
static const String invoiceCurrencyId = 'invoice_currency_id'; static const String invoiceCurrencyId = 'invoice_currency_id';
static const String taxRate1 = 'tax_rate1'; static const String taxRate1 = 'tax_rate1';

View File

@ -35,6 +35,7 @@ class ExpensePresenter extends EntityPresenter {
ExpenseFields.categoryId, ExpenseFields.categoryId,
ExpenseFields.category, ExpenseFields.category,
ExpenseFields.paymentDate, ExpenseFields.paymentDate,
ExpenseFields.paymentType,
ExpenseFields.exchangeRate, ExpenseFields.exchangeRate,
ExpenseFields.invoiceCurrencyId, ExpenseFields.invoiceCurrencyId,
ExpenseFields.taxName1, ExpenseFields.taxName1,
@ -107,6 +108,10 @@ class ExpensePresenter extends EntityPresenter {
return Text(state.expenseCategoryState.map[expense.categoryId] return Text(state.expenseCategoryState.map[expense.categoryId]
?.listDisplayName ?? ?.listDisplayName ??
''); '');
case ExpenseFields.paymentType:
return Text(state.staticState.paymentTypeMap[expense.paymentTypeId]
?.listDisplayName ??
'');
case ExpenseFields.paymentDate: case ExpenseFields.paymentDate:
return Text(formatDate(expense.paymentDate, context)); return Text(formatDate(expense.paymentDate, context));
case ExpenseFields.exchangeRate: case ExpenseFields.exchangeRate:

View File

@ -17,6 +17,7 @@ enum ExpenseReportFields {
currency, currency,
date, date,
payment_date, payment_date,
payment_type,
tax_rate1, tax_rate1,
tax_rate2, tax_rate2,
tax_rate3, tax_rate3,
@ -135,6 +136,10 @@ ReportResult expenseReport(
case ExpenseReportFields.payment_date: case ExpenseReportFields.payment_date:
value = expense.paymentDate; value = expense.paymentDate;
break; break;
case ExpenseReportFields.payment_type:
value = staticState
.paymentTypeMap[expense.paymentTypeId]?.listDisplayName ??
'';
break; break;
case ExpenseReportFields.tax_rate1: case ExpenseReportFields.tax_rate1:
value = expense.taxRate1; value = expense.taxRate1;