Report changes

This commit is contained in:
Hillel Coren 2021-02-03 23:13:47 +02:00
parent d3e0e7c531
commit ec2ceb2d05
5 changed files with 26 additions and 7 deletions

View File

@ -29,7 +29,7 @@ InvoiceItemEntity convertTaskToInvoiceItem(
final start = final start =
formatDate(time.startDate.toIso8601String(), context, showTime: true); formatDate(time.startDate.toIso8601String(), context, showTime: true);
final end = formatDate(time.endDate.toIso8601String(), context, final end = formatDate(time.endDate.toIso8601String(), context,
showTime: true, showDate: false, showSeconds: false); showTime: true, showDate: false, showSeconds: true);
notes += '\n$start - $end'; notes += '\n$start - $end';
}); });
notes += '\n</span>'; notes += '\n</span>';

View File

@ -91,7 +91,7 @@ class _ExpenseViewState extends State<ExpenseView>
action1: EntityAction.clone, action1: EntityAction.clone,
action2: expense.isInvoiced action2: expense.isInvoiced
? EntityAction.archive ? EntityAction.archive
: EntityAction.newInvoice, : EntityAction.invoiceExpense,
) )
], ],
); );

View File

@ -23,21 +23,32 @@ enum ProfitAndLossReportFields {
vendor_country, vendor_country,
type, type,
amount, amount,
date date,
category,
} }
var memoizedProfitAndLossReport = memo8(( var memoizedProfitAndLossReport = memo9((
UserCompanyEntity userCompany, UserCompanyEntity userCompany,
ReportsUIState reportsUIState, ReportsUIState reportsUIState,
BuiltMap<String, ClientEntity> clientMap, BuiltMap<String, ClientEntity> clientMap,
BuiltMap<String, PaymentEntity> paymentMap, BuiltMap<String, PaymentEntity> paymentMap,
BuiltMap<String, ExpenseEntity> expenseMap, BuiltMap<String, ExpenseEntity> expenseMap,
BuiltMap<String, ExpenseCategoryEntity> expenseCategoryMap,
BuiltMap<String, VendorEntity> vendorMap, BuiltMap<String, VendorEntity> vendorMap,
BuiltMap<String, UserEntity> userMap, BuiltMap<String, UserEntity> userMap,
StaticState staticState, StaticState staticState,
) => ) =>
profitAndLossReport(userCompany, reportsUIState, clientMap, paymentMap, profitAndLossReport(
expenseMap, vendorMap, userMap, staticState)); userCompany,
reportsUIState,
clientMap,
paymentMap,
expenseMap,
expenseCategoryMap,
vendorMap,
userMap,
staticState,
));
ReportResult profitAndLossReport( ReportResult profitAndLossReport(
UserCompanyEntity userCompany, UserCompanyEntity userCompany,
@ -45,6 +56,7 @@ ReportResult profitAndLossReport(
BuiltMap<String, ClientEntity> clientMap, BuiltMap<String, ClientEntity> clientMap,
BuiltMap<String, PaymentEntity> paymentMap, BuiltMap<String, PaymentEntity> paymentMap,
BuiltMap<String, ExpenseEntity> expenseMap, BuiltMap<String, ExpenseEntity> expenseMap,
BuiltMap<String, ExpenseCategoryEntity> expenseCategoryMap,
BuiltMap<String, VendorEntity> vendorMap, BuiltMap<String, VendorEntity> vendorMap,
BuiltMap<String, UserEntity> userMap, BuiltMap<String, UserEntity> userMap,
StaticState staticState, StaticState staticState,
@ -132,6 +144,9 @@ ReportResult profitAndLossReport(
case ProfitAndLossReportFields.date: case ProfitAndLossReportFields.date:
value = payment?.date; value = payment?.date;
break; break;
case ProfitAndLossReportFields.category:
value = '';
break;
} }
if (!ReportResult.matchField( if (!ReportResult.matchField(
@ -217,6 +232,9 @@ ReportResult profitAndLossReport(
case ProfitAndLossReportFields.date: case ProfitAndLossReportFields.date:
value = expense.date; value = expense.date;
break; break;
case ProfitAndLossReportFields.category:
value = expenseCategoryMap[expense.categoryId]?.name ?? '';
break;
} }
if (!ReportResult.matchField( if (!ReportResult.matchField(

View File

@ -226,6 +226,7 @@ class ReportsScreenVM {
state.clientState.map, state.clientState.map,
state.paymentState.map, state.paymentState.map,
state.expenseState.map, state.expenseState.map,
state.expenseCategoryState.map,
state.vendorState.map, state.vendorState.map,
state.userState.map, state.userState.map,
state.staticState, state.staticState,

View File

@ -95,7 +95,7 @@ class _TaskViewState extends State<TaskView>
: EntityAction.resume, : EntityAction.resume,
action2: task.isInvoiced action2: task.isInvoiced
? EntityAction.archive ? EntityAction.archive
: EntityAction.newInvoice, : EntityAction.invoiceTask,
action1Enabled: !task.isInvoiced, action1Enabled: !task.isInvoiced,
), ),
], ],