Skip to content

Commit

Permalink
UINV-492 Update invoice export details to include Fiscal year
Browse files Browse the repository at this point in the history
  • Loading branch information
usavkov-epam committed Aug 24, 2023
1 parent 7cfd8b9 commit f0b9ca1
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* The value "Default" is hard-coded instead of localized. Refs UINV-489.
* Add handling for a new error code that occurs during invoice approval. Refs UINV-497.
* Update related invoice details to include additional fields on invoice line. Refs UINV-496.
* Update invoice export details to include Fiscal year. Refs UINV-492.

## [4.0.1](https://github.com/folio-org/ui-invoice/tree/v4.0.1) (2023-03-10)
[Full Changelog](https://github.com/folio-org/ui-invoice/compare/v4.0.0...v4.0.1)
Expand Down
1 change: 1 addition & 0 deletions src/invoices/InvoicesList/ExportSettingsModal/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export const EXPORT_INVOICE_FIELDS = {
vendorCode: 'Vendor code',
status: 'Status',
invoiceDate: 'Invoice date',
fiscalYear: 'Fiscal year',
paymentDue: 'Payment due',
approvalDate: 'Approved date',
approvedBy: 'ApprovedBy',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export const createExportReport = ({
batchGroupMap,
exchangeRateMap,
expenseClassMap,
fiscalYearMap,
intl,
invoiceLines = [],
invoiceMap,
Expand All @@ -75,6 +76,7 @@ export const createExportReport = ({
vendorInvoiceNo: invoice.vendorInvoiceNo,
vendorCode: vendorMap[invoice.vendorId]?.code ?? invalidReference,
status: invoice.status,
fiscalYear: fiscalYearMap[invoice.fiscalYearId]?.code,
invoiceDate: formatDate(invoice.invoiceDate, intl),
paymentDue: formatDate(invoice.paymentDue, intl),
approvalDate: formatDate(invoice.approvalDate, intl),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ test('createExportReport should return export report object', () => {
addressMap: keyBy([address], 'id'),
exchangeRateMap: { [invoice.currency]: { from: invoice.currency, exchangeRate: 1 } },
expenseClassMap: {},
fiscalYearMap: { [invoice.fiscalYearId]: { code: 'FY2023' } },
intl,
invoiceLines: [invoiceLine],
batchGroupMap: keyBy([batchGroup], 'id'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {

import {
BATCH_GROUPS_API,
FISCAL_YEARS_API,
INVOICE_LINE_API,
VOUCHER_LINES_API,
VOUCHERS_API,
Expand Down Expand Up @@ -87,13 +88,16 @@ export const getExportData = async ({ ky, intl, query, currency: to }) => {
const exchangeRates = await Promise.all(
currencies.map(from => ky.get(EXCHANGE_RATE_API, { searchParams: { from, to } }).json()),
);
const fiscalYearIds = uniq(exportInvoices.map(({ fiscalYearId }) => fiscalYearId));
const fiscalYears = await fetchExportDataByIds({ ky, ids: fiscalYearIds, api: FISCAL_YEARS_API, records: 'fiscalYears' });

return (createExportReport({
acqUnitMap: keyBy(acqUnits, 'id'),
addressMap: keyBy(addresses, 'id'),
batchGroupMap: keyBy(batchGroups, 'id'),
exchangeRateMap: keyBy(exchangeRates, 'from'),
expenseClassMap: keyBy(expenseClasses, 'id'),
fiscalYearMap: keyBy(fiscalYears, 'id'),
intl,
invoiceLines,
invoiceMap: keyBy(exportInvoices, 'id'),
Expand Down
1 change: 1 addition & 0 deletions test/jest/fixtures/exportReport.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const exportReport = [
'exchangeRate': 1,
'exportToAccounting': true,
'externalAccountNumber': undefined,
'fiscalYear': 'FY2023',
'invoiceAdjustments': '',
'invoiceDate': '2021-06-08',
'invoiceFundDistributions': undefined,
Expand Down
1 change: 1 addition & 0 deletions test/jest/fixtures/invoice.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export const invoice = {
chkSubscriptionOverlap: true,
currency: 'USD',
exportToAccounting: true,
fiscalYearId: 'b0727c6a-a097-4841-bddf-8bb4f6be4118',
id: '2e5067cd-2dc8-4d99-900d-b4518bb6407f',
invoiceDate: '2021-06-08',
paymentMethod: 'Credit Card',
Expand Down

0 comments on commit f0b9ca1

Please sign in to comment.