diff --git a/client/src/containers/Drawers/BillDrawer/BillDrawerDetails.js b/client/src/containers/Drawers/BillDrawer/BillDrawerDetails.js
index b617a1bee..9f2b86253 100644
--- a/client/src/containers/Drawers/BillDrawer/BillDrawerDetails.js
+++ b/client/src/containers/Drawers/BillDrawer/BillDrawerDetails.js
@@ -4,11 +4,14 @@ import intl from 'react-intl-universal';
import LocatedLandedCostTable from './LocatedLandedCostTable';
import JournalEntriesTable from '../../JournalEntriesTable/JournalEntriesTable';
+import { useBillDrawerContext } from './BillDrawerProvider';
/**
* Bill view details.
*/
export default function BillDrawerDetails() {
+ const { data } = useBillDrawerContext();
+
return (
@@ -16,7 +19,7 @@ export default function BillDrawerDetails() {
}
+ panel={}
/>
+
}
+ panel={}
/>
diff --git a/client/src/containers/Drawers/InvoiceDetailDrawer/InvoiceDetailDrawerProvider.js b/client/src/containers/Drawers/InvoiceDetailDrawer/InvoiceDetailDrawerProvider.js
index 3383528ca..6f81e6a6b 100644
--- a/client/src/containers/Drawers/InvoiceDetailDrawer/InvoiceDetailDrawerProvider.js
+++ b/client/src/containers/Drawers/InvoiceDetailDrawer/InvoiceDetailDrawerProvider.js
@@ -1,16 +1,29 @@
import React from 'react';
import intl from 'react-intl-universal';
import { DrawerHeaderContent, DashboardInsider } from 'components';
+import { useTransactionsByReference } from 'hooks/query';
const InvoiceDetailDrawerContext = React.createContext();
/**
* Invoice detail provider.
*/
function InvoiceDetailDrawerProvider({ invoiceId, ...props }) {
+
+ // Handle fetch transaction by reference.
+ const { data, isLoading: isTransactionLoading } = useTransactionsByReference(
+ {
+ reference_id: invoiceId,
+ reference_type: 'SaleInvoice',
+ },
+ { enabled: !!invoiceId },
+ );
+
//provider.
- const provider = {};
+ const provider = {
+ data,
+ };
return (
-
+
+
@@ -15,7 +18,7 @@ export default function PaymentReceiveDetail() {
}
+ panel={}
/>
diff --git a/client/src/containers/Drawers/PaymentReceiveDetailDrawer/PaymentReceiveDetailProvider.js b/client/src/containers/Drawers/PaymentReceiveDetailDrawer/PaymentReceiveDetailProvider.js
index 8602ba01c..50c8db63d 100644
--- a/client/src/containers/Drawers/PaymentReceiveDetailDrawer/PaymentReceiveDetailProvider.js
+++ b/client/src/containers/Drawers/PaymentReceiveDetailDrawer/PaymentReceiveDetailProvider.js
@@ -1,17 +1,29 @@
import React from 'react';
import intl from 'react-intl-universal';
import { DrawerHeaderContent, DashboardInsider } from 'components';
+import { useTransactionsByReference } from 'hooks/query';
const PaymentReceiveDetailContext = React.createContext();
+
/**
* Payment receive detail provider.
*/
function PaymentReceiveDetailProvider({ paymentReceiveId, ...props }) {
+
+ // Handle fetch transaction by reference.
+ const { data, isLoading: isTransactionLoading } = useTransactionsByReference(
+ {
+ reference_id: paymentReceiveId,
+ reference_type: 'paymentReceive',
+ },
+ { enabled: !!paymentReceiveId },
+ );
+
//provider.
- const provider = {};
+ const provider = { data };
return (
-
+
@@ -15,7 +18,7 @@ export default function ReceiptDetail() {
}
+ panel={}
/>
diff --git a/client/src/containers/Drawers/ReceiptDetailDrawer/ReceiptDetailDrawerProvider.js b/client/src/containers/Drawers/ReceiptDetailDrawer/ReceiptDetailDrawerProvider.js
index 9f0ba768b..c107acf89 100644
--- a/client/src/containers/Drawers/ReceiptDetailDrawer/ReceiptDetailDrawerProvider.js
+++ b/client/src/containers/Drawers/ReceiptDetailDrawer/ReceiptDetailDrawerProvider.js
@@ -1,18 +1,31 @@
import React from 'react';
import intl from 'react-intl-universal';
import { DrawerHeaderContent, DashboardInsider } from 'components';
+import { useTransactionsByReference } from 'hooks/query';
+// useTransactionsByReference
const ReceiptDetailDrawerContext = React.createContext();
/**
* Receipt detail provider.
*/
function ReceiptDetailDrawerProvider({ receiptId, ...props }) {
+ // Handle fetch transaction by reference.
+ const { data, isLoading: isTransactionLoading } = useTransactionsByReference(
+ {
+ reference_id: receiptId,
+ reference_type: 'SaleReceipt',
+ },
+ { enabled: !!receiptId },
+ );
+
//provider.
- const provider = {};
+ const provider = {
+ data,
+ };
return (
-
+
[
{
@@ -17,22 +17,22 @@ export default function JournalEntriesTable({ journal }) {
},
{
Header: intl.get('account_name'),
- accessor: 'account_name',
+ accessor: 'accountName',
width: 150,
},
{
Header: intl.get('contact'),
- accessor: 'contact',
+ accessor: 'contactTypeFormatted',
width: 150,
},
{
Header: intl.get('credit'),
- accessor: 'credit',
+ accessor: ({ credit }) => credit.formattedAmount,
width: 100,
},
{
Header: intl.get('debit'),
- accessor: 'debit',
+ accessor: ({ debit }) => debit.formattedAmount,
width: 100,
},
],
@@ -43,7 +43,7 @@ export default function JournalEntriesTable({ journal }) {
diff --git a/client/src/hooks/query/financialReports.js b/client/src/hooks/query/financialReports.js
index 1826269c2..4b7258ea7 100644
--- a/client/src/hooks/query/financialReports.js
+++ b/client/src/hooks/query/financialReports.js
@@ -466,3 +466,22 @@ export function useInventoryItemDetailsReport(query, props) {
},
);
}
+
+/**
+ * Retrieve transactions by reference report.
+ */
+export function useTransactionsByReference(query, props) {
+ return useRequestQuery(
+ [t.TRANSACTIONS_BY_REFERENCE, query],
+ {
+ method: 'get',
+ url: `/financial_statements/transactions-by-reference`,
+ params: query,
+ },
+ {
+ select: (res) => res.data.data,
+ defaultData: {},
+ ...props,
+ },
+ );
+}
diff --git a/client/src/hooks/query/types.js b/client/src/hooks/query/types.js
index 886c07dd3..57ae0d0d2 100644
--- a/client/src/hooks/query/types.js
+++ b/client/src/hooks/query/types.js
@@ -23,6 +23,7 @@ const FINANCIAL_REPORTS = {
INVENTORY_VALUATION: 'INVENTORY_VALUATION',
CASH_FLOW_STATEMENT: 'CASH_FLOW_STATEMENT',
INVENTORY_ITEM_DETAILS: 'INVENTORY_ITEM_DETAILS',
+ TRANSACTIONS_BY_REFERENCE: 'TRANSACTIONS_BY_REFERENCE',
};
const BILLS = {