Suppot tracking vendor on invoice

This commit is contained in:
Hillel Coren 2022-02-08 12:35:01 +02:00
parent d0cc927d92
commit 5d00b2c0f1
1 changed files with 6 additions and 1 deletions

View File

@ -281,8 +281,12 @@ void handleExpenseAction(
}); });
String projectId = ''; String projectId = '';
String vendorId = '';
for (var each in availableExpenses) { for (var each in availableExpenses) {
final expense = each as ExpenseEntity; final expense = each as ExpenseEntity;
if (expense.vendorId.isNotEmpty) {
vendorId = expense.vendorId;
}
if (expense.projectId.isNotEmpty) { if (expense.projectId.isNotEmpty) {
if (projectId.isEmpty && if (projectId.isEmpty &&
state.projectState.get(expense.projectId).clientId == client.id) { state.projectState.get(expense.projectId).clientId == client.id) {
@ -303,7 +307,8 @@ void handleExpenseAction(
entity: InvoiceEntity(state: state, client: client).rebuild( entity: InvoiceEntity(state: state, client: client).rebuild(
(b) => b (b) => b
..lineItems.addAll(items) ..lineItems.addAll(items)
..projectId = projectId, ..projectId = projectId
..vendorId = vendorId,
), ),
); );
} }