Suppot tracking vendor on invoice
This commit is contained in:
parent
1478cf761d
commit
d12d16767d
|
|
@ -74,4 +74,6 @@ class CreditFields {
|
||||||
static const String taxAmount = 'tax_amount';
|
static const String taxAmount = 'tax_amount';
|
||||||
static const String exchangeRate = 'exchange_rate';
|
static const String exchangeRate = 'exchange_rate';
|
||||||
static const String isViewed = 'is_viewed';
|
static const String isViewed = 'is_viewed';
|
||||||
|
static const String project = 'project';
|
||||||
|
static const String vendor = 'vendor';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -73,4 +73,6 @@ class QuoteFields {
|
||||||
static const String taxAmount = 'tax_amount';
|
static const String taxAmount = 'tax_amount';
|
||||||
static const String exchangeRate = 'exchange_rate';
|
static const String exchangeRate = 'exchange_rate';
|
||||||
static const String isViewed = 'is_viewed';
|
static const String isViewed = 'is_viewed';
|
||||||
|
static const String project = 'project';
|
||||||
|
static const String vendor = 'vendor';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,8 @@ class CreditPresenter extends EntityPresenter {
|
||||||
CreditFields.exchangeRate,
|
CreditFields.exchangeRate,
|
||||||
CreditFields.isViewed,
|
CreditFields.isViewed,
|
||||||
CreditFields.lastSentDate,
|
CreditFields.lastSentDate,
|
||||||
|
CreditFields.project,
|
||||||
|
CreditFields.vendor,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -110,6 +112,10 @@ class CreditPresenter extends EntityPresenter {
|
||||||
formatNumberType: FormatNumberType.double));
|
formatNumberType: FormatNumberType.double));
|
||||||
case CreditFields.isViewed:
|
case CreditFields.isViewed:
|
||||||
return Text(credit.isViewed ? localization.yes : localization.no);
|
return Text(credit.isViewed ? localization.yes : localization.no);
|
||||||
|
case CreditFields.project:
|
||||||
|
return Text(state.projectState.get(credit.projectId).listDisplayName);
|
||||||
|
case CreditFields.vendor:
|
||||||
|
return Text(state.vendorState.get(credit.vendorId).name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.getField(field: field, context: context);
|
return super.getField(field: field, context: context);
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@ class InvoicePresenter extends EntityPresenter {
|
||||||
InvoiceFields.lastSentDate,
|
InvoiceFields.lastSentDate,
|
||||||
InvoiceFields.nextSendDate,
|
InvoiceFields.nextSendDate,
|
||||||
InvoiceFields.project,
|
InvoiceFields.project,
|
||||||
|
InvoiceFields.vendor,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -71,6 +72,8 @@ class InvoicePresenter extends EntityPresenter {
|
||||||
.listDisplayName);
|
.listDisplayName);
|
||||||
case InvoiceFields.project:
|
case InvoiceFields.project:
|
||||||
return Text(state.projectState.get(invoice.projectId).listDisplayName);
|
return Text(state.projectState.get(invoice.projectId).listDisplayName);
|
||||||
|
case InvoiceFields.vendor:
|
||||||
|
return Text(state.vendorState.get(invoice.vendorId).name);
|
||||||
case InvoiceFields.date:
|
case InvoiceFields.date:
|
||||||
return Text(formatDate(invoice.date, context));
|
return Text(formatDate(invoice.date, context));
|
||||||
case InvoiceFields.lastSentDate:
|
case InvoiceFields.lastSentDate:
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,8 @@ class QuotePresenter extends EntityPresenter {
|
||||||
QuoteFields.exchangeRate,
|
QuoteFields.exchangeRate,
|
||||||
QuoteFields.isViewed,
|
QuoteFields.isViewed,
|
||||||
QuoteFields.lastSentDate,
|
QuoteFields.lastSentDate,
|
||||||
|
QuoteFields.project,
|
||||||
|
QuoteFields.vendor,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -104,6 +106,10 @@ class QuotePresenter extends EntityPresenter {
|
||||||
formatNumberType: FormatNumberType.double));
|
formatNumberType: FormatNumberType.double));
|
||||||
case QuoteFields.isViewed:
|
case QuoteFields.isViewed:
|
||||||
return Text(quote.isViewed ? localization.yes : localization.no);
|
return Text(quote.isViewed ? localization.yes : localization.no);
|
||||||
|
case QuoteFields.project:
|
||||||
|
return Text(state.projectState.get(quote.projectId).listDisplayName);
|
||||||
|
case QuoteFields.vendor:
|
||||||
|
return Text(state.vendorState.get(quote.vendorId).name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.getField(field: field, context: context);
|
return super.getField(field: field, context: context);
|
||||||
|
|
|
||||||
|
|
@ -70,18 +70,30 @@ enum InvoiceReportFields {
|
||||||
is_viewed,
|
is_viewed,
|
||||||
assigned_to,
|
assigned_to,
|
||||||
created_by,
|
created_by,
|
||||||
|
project,
|
||||||
|
vendor,
|
||||||
}
|
}
|
||||||
|
|
||||||
var memoizedInvoiceReport = memo6((
|
var memoizedInvoiceReport = memo8((
|
||||||
UserCompanyEntity userCompany,
|
UserCompanyEntity userCompany,
|
||||||
ReportsUIState reportsUIState,
|
ReportsUIState reportsUIState,
|
||||||
BuiltMap<String, InvoiceEntity> invoiceMap,
|
BuiltMap<String, InvoiceEntity> invoiceMap,
|
||||||
BuiltMap<String, ClientEntity> clientMap,
|
BuiltMap<String, ClientEntity> clientMap,
|
||||||
BuiltMap<String, UserEntity> userMap,
|
BuiltMap<String, UserEntity> userMap,
|
||||||
|
BuiltMap<String, VendorEntity> vendorMap,
|
||||||
|
BuiltMap<String, ProjectEntity> projectMap,
|
||||||
StaticState staticState,
|
StaticState staticState,
|
||||||
) =>
|
) =>
|
||||||
invoiceReport(userCompany, reportsUIState, invoiceMap, clientMap, userMap,
|
invoiceReport(
|
||||||
staticState));
|
userCompany,
|
||||||
|
reportsUIState,
|
||||||
|
invoiceMap,
|
||||||
|
clientMap,
|
||||||
|
userMap,
|
||||||
|
vendorMap,
|
||||||
|
projectMap,
|
||||||
|
staticState,
|
||||||
|
));
|
||||||
|
|
||||||
ReportResult invoiceReport(
|
ReportResult invoiceReport(
|
||||||
UserCompanyEntity userCompany,
|
UserCompanyEntity userCompany,
|
||||||
|
|
@ -89,6 +101,8 @@ ReportResult invoiceReport(
|
||||||
BuiltMap<String, InvoiceEntity> invoiceMap,
|
BuiltMap<String, InvoiceEntity> invoiceMap,
|
||||||
BuiltMap<String, ClientEntity> clientMap,
|
BuiltMap<String, ClientEntity> clientMap,
|
||||||
BuiltMap<String, UserEntity> userMap,
|
BuiltMap<String, UserEntity> userMap,
|
||||||
|
BuiltMap<String, VendorEntity> vendorMap,
|
||||||
|
BuiltMap<String, ProjectEntity> projectMap,
|
||||||
StaticState staticState,
|
StaticState staticState,
|
||||||
) {
|
) {
|
||||||
final List<List<ReportElement>> data = [];
|
final List<List<ReportElement>> data = [];
|
||||||
|
|
@ -312,6 +326,12 @@ ReportResult invoiceReport(
|
||||||
case InvoiceReportFields.created_by:
|
case InvoiceReportFields.created_by:
|
||||||
value = userMap[invoice.createdUserId]?.listDisplayName ?? '';
|
value = userMap[invoice.createdUserId]?.listDisplayName ?? '';
|
||||||
break;
|
break;
|
||||||
|
case InvoiceReportFields.project:
|
||||||
|
value = (projectMap[invoice.projectId] ?? ProjectEntity()).name;
|
||||||
|
break;
|
||||||
|
case InvoiceReportFields.vendor:
|
||||||
|
value = (vendorMap[invoice.vendorId] ?? VendorEntity()).name;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ReportResult.matchField(
|
if (!ReportResult.matchField(
|
||||||
|
|
|
||||||
|
|
@ -130,7 +130,7 @@ ReportResult quoteReport(
|
||||||
|
|
||||||
switch (column) {
|
switch (column) {
|
||||||
case QuoteReportFields.id:
|
case QuoteReportFields.id:
|
||||||
value = quote.id;
|
value = quote.amount;
|
||||||
break;
|
break;
|
||||||
case QuoteReportFields.amount:
|
case QuoteReportFields.amount:
|
||||||
value = quote.amount;
|
value = quote.amount;
|
||||||
|
|
|
||||||
|
|
@ -118,6 +118,8 @@ class ReportsScreenVM {
|
||||||
state.invoiceState.map,
|
state.invoiceState.map,
|
||||||
state.clientState.map,
|
state.clientState.map,
|
||||||
state.userState.map,
|
state.userState.map,
|
||||||
|
state.vendorState.map,
|
||||||
|
state.projectState.map,
|
||||||
state.staticState,
|
state.staticState,
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue