diff --git a/packages/webapp/src/containers/FinancialStatements/ARAgingSummary/ARAgingSummaryProvider.tsx b/packages/webapp/src/containers/FinancialStatements/ARAgingSummary/ARAgingSummaryProvider.tsx index c29e2a43d..1b9577900 100644 --- a/packages/webapp/src/containers/FinancialStatements/ARAgingSummary/ARAgingSummaryProvider.tsx +++ b/packages/webapp/src/containers/FinancialStatements/ARAgingSummary/ARAgingSummaryProvider.tsx @@ -11,7 +11,10 @@ const ARAgingSummaryContext = createContext(); */ function ARAgingSummaryProvider({ filter, ...props }) { // Transformes the filter from to the url query. - const query = useMemo(() => transformFilterFormToQuery(filter), [filter]); + const requestQuery = useMemo( + () => transformFilterFormToQuery(filter), + [filter], + ); // A/R aging summary sheet context. const { @@ -19,11 +22,10 @@ function ARAgingSummaryProvider({ filter, ...props }) { isLoading: isARAgingLoading, isFetching: isARAgingFetching, refetch, - } = useARAgingSummaryReport(query, { keepPreviousData: true }); + } = useARAgingSummaryReport(requestQuery, { keepPreviousData: true }); const provider = { ARAgingSummary, - isARAgingLoading, isARAgingFetching, refetch, diff --git a/packages/webapp/src/containers/FinancialStatements/ARAgingSummary/ARAgingSummaryTable.tsx b/packages/webapp/src/containers/FinancialStatements/ARAgingSummary/ARAgingSummaryTable.tsx index d2cdf5baa..2cde74a37 100644 --- a/packages/webapp/src/containers/FinancialStatements/ARAgingSummary/ARAgingSummaryTable.tsx +++ b/packages/webapp/src/containers/FinancialStatements/ARAgingSummary/ARAgingSummaryTable.tsx @@ -20,7 +20,7 @@ export default function ReceivableAgingSummaryTable({ }) { // AR aging summary report context. const { - ARAgingSummary: { table }, + ARAgingSummary: { table, query }, isARAgingLoading, } = useARAgingSummaryContext(); @@ -31,7 +31,7 @@ export default function ReceivableAgingSummaryTable({ ({ fromDate: moment().startOf('year').format('YYYY-MM-DD'), - toDate: moment().endOf('year').format('YYYY-MM-DD'), + toDate: moment().format('YYYY-MM-DD'), basis: 'cash', displayColumnsType: 'total', filterByOption: 'without-zero-balance', diff --git a/packages/webapp/src/containers/FinancialStatements/CashFlowStatement/utils.tsx b/packages/webapp/src/containers/FinancialStatements/CashFlowStatement/utils.tsx index ecad0760e..6606ce259 100644 --- a/packages/webapp/src/containers/FinancialStatements/CashFlowStatement/utils.tsx +++ b/packages/webapp/src/containers/FinancialStatements/CashFlowStatement/utils.tsx @@ -12,7 +12,7 @@ import { useAppQueryString } from '@/hooks'; export const getDefaultCashFlowSheetQuery = () => { return { fromDate: moment().startOf('year').format('YYYY-MM-DD'), - toDate: moment().endOf('year').format('YYYY-MM-DD'), + toDate: moment().format('YYYY-MM-DD'), basis: 'cash', displayColumnsType: 'total', filterByOption: 'with-transactions', diff --git a/packages/webapp/src/containers/FinancialStatements/CustomersBalanceSummary/CustomersBalanceSummaryTable.tsx b/packages/webapp/src/containers/FinancialStatements/CustomersBalanceSummary/CustomersBalanceSummaryTable.tsx index 729b04617..6957483bc 100644 --- a/packages/webapp/src/containers/FinancialStatements/CustomersBalanceSummary/CustomersBalanceSummaryTable.tsx +++ b/packages/webapp/src/containers/FinancialStatements/CustomersBalanceSummary/CustomersBalanceSummaryTable.tsx @@ -18,7 +18,7 @@ export default function CustomersBalanceSummaryTable({ companyName, }) { const { - CustomerBalanceSummary: { table }, + CustomerBalanceSummary: { table, query }, } = useCustomersBalanceSummaryContext(); // Retrieves the customers summary columns. @@ -28,7 +28,7 @@ export default function CustomersBalanceSummaryTable({ { }; export const getCustomersTransactionsDefaultQuery = () => ({ - fromDate: moment().toDate(), + fromDate: moment().startOf('month').toDate(), toDate: moment().toDate(), customersIds: [], }); diff --git a/packages/webapp/src/containers/FinancialStatements/GeneralLedger/common.tsx b/packages/webapp/src/containers/FinancialStatements/GeneralLedger/common.tsx index 7ca26c7a3..4f6c5a65c 100644 --- a/packages/webapp/src/containers/FinancialStatements/GeneralLedger/common.tsx +++ b/packages/webapp/src/containers/FinancialStatements/GeneralLedger/common.tsx @@ -28,8 +28,8 @@ export const filterAccountsOptions = [ * Retrieves the default general ledger query. */ export const getDefaultGeneralLedgerQuery = () => ({ - fromDate: moment().startOf('year').format('YYYY-MM-DD'), - toDate: moment().endOf('year').format('YYYY-MM-DD'), + fromDate: moment().startOf('month').format('YYYY-MM-DD'), + toDate: moment().format('YYYY-MM-DD'), basis: 'accrual', filterByOption: 'with-transactions', branchesIds: [], diff --git a/packages/webapp/src/containers/FinancialStatements/InventoryItemDetails/InventoryItemDetailsTable.tsx b/packages/webapp/src/containers/FinancialStatements/InventoryItemDetails/InventoryItemDetailsTable.tsx index 8171862f7..f8cd204cd 100644 --- a/packages/webapp/src/containers/FinancialStatements/InventoryItemDetails/InventoryItemDetailsTable.tsx +++ b/packages/webapp/src/containers/FinancialStatements/InventoryItemDetails/InventoryItemDetailsTable.tsx @@ -35,8 +35,8 @@ export function InventoryItemDetailsTable({ companyName={companyName} sheetType={intl.get('inventory_item_details')} loading={isInventoryItemDetailsLoading} - fromDate={query.from_date} - toDate={query.to_date} + fromDate={query.fromDate} + toDate={query.toDate} fullWidth={true} > ({ align: Align.Right, })); -/** - * columns mapper. - */ const columnsMapper = R.curry((data, index, column) => ({ id: column.key, key: column.key, diff --git a/packages/webapp/src/containers/FinancialStatements/InventoryItemDetails/utils2.tsx b/packages/webapp/src/containers/FinancialStatements/InventoryItemDetails/utils2.tsx index 02637e36e..4293cf610 100644 --- a/packages/webapp/src/containers/FinancialStatements/InventoryItemDetails/utils2.tsx +++ b/packages/webapp/src/containers/FinancialStatements/InventoryItemDetails/utils2.tsx @@ -12,8 +12,8 @@ import { transformToForm } from '@/utils'; * Retrieves inventory item details default query. */ export const getInventoryItemDetailsDefaultQuery = () => ({ - fromDate: moment().startOf('year').format('YYYY-MM-DD'), - toDate: moment().endOf('year').format('YYYY-MM-DD'), + fromDate: moment().startOf('month').format('YYYY-MM-DD'), + toDate: moment().format('YYYY-MM-DD'), itemsIds: [], warehousesIds: [], branchesIds: [], diff --git a/packages/webapp/src/containers/FinancialStatements/InventoryValuation/InventoryValuationTable.tsx b/packages/webapp/src/containers/FinancialStatements/InventoryValuation/InventoryValuationTable.tsx index 009832ebb..bada2a466 100644 --- a/packages/webapp/src/containers/FinancialStatements/InventoryValuation/InventoryValuationTable.tsx +++ b/packages/webapp/src/containers/FinancialStatements/InventoryValuation/InventoryValuationTable.tsx @@ -19,7 +19,7 @@ export default function InventoryValuationTable({ }) { // inventory valuation context. const { - inventoryValuation: { tableRows }, + inventoryValuation: { tableRows, query }, isLoading, } = useInventoryValuationContext(); @@ -30,7 +30,7 @@ export default function InventoryValuationTable({ { * Retrieves the inventory valuation sheet default query. */ export const getInventoryValuationQuery = () => ({ - asDate: moment().endOf('day').format('YYYY-MM-DD'), + asDate: moment().format('YYYY-MM-DD'), filterByOption: 'with-transactions', itemsIds: [], branchesIds: [], diff --git a/packages/webapp/src/containers/FinancialStatements/Journal/utils.tsx b/packages/webapp/src/containers/FinancialStatements/Journal/utils.tsx index bafa46384..f65f027ed 100644 --- a/packages/webapp/src/containers/FinancialStatements/Journal/utils.tsx +++ b/packages/webapp/src/containers/FinancialStatements/Journal/utils.tsx @@ -11,17 +11,16 @@ import { transformToForm } from '@/utils'; */ export const getDefaultJournalQuery = () => { return { - fromDate: moment().startOf('year').format('YYYY-MM-DD'), - toDate: moment().endOf('year').format('YYYY-MM-DD'), + fromDate: moment().startOf('month').format('YYYY-MM-DD'), + toDate: moment().format('YYYY-MM-DD'), basis: 'accrual', }; }; - /** * Parses balance sheet query. */ - const parseJournalQuery = (locationQuery) => { +const parseJournalQuery = (locationQuery) => { const defaultQuery = getDefaultJournalQuery(); return { diff --git a/packages/webapp/src/containers/FinancialStatements/ProfitLossSheet/utils.tsx b/packages/webapp/src/containers/FinancialStatements/ProfitLossSheet/utils.tsx index b6941a7fe..91ee66d4e 100644 --- a/packages/webapp/src/containers/FinancialStatements/ProfitLossSheet/utils.tsx +++ b/packages/webapp/src/containers/FinancialStatements/ProfitLossSheet/utils.tsx @@ -16,7 +16,7 @@ import { castArray } from 'lodash'; export const getDefaultProfitLossQuery = () => ({ basis: 'cash', fromDate: moment().startOf('year').format('YYYY-MM-DD'), - toDate: moment().endOf('year').format('YYYY-MM-DD'), + toDate: moment().format('YYYY-MM-DD'), displayColumnsType: 'total', filterByOption: 'with-transactions', diff --git a/packages/webapp/src/containers/FinancialStatements/PurchasesByItems/utils.tsx b/packages/webapp/src/containers/FinancialStatements/PurchasesByItems/utils.tsx index 6613e6255..51a2684c3 100644 --- a/packages/webapp/src/containers/FinancialStatements/PurchasesByItems/utils.tsx +++ b/packages/webapp/src/containers/FinancialStatements/PurchasesByItems/utils.tsx @@ -11,8 +11,8 @@ import { castArray } from 'lodash'; * Retrieves the purchases by items query. */ export const getDefaultPurchasesByItemsQuery = () => ({ - fromDate: moment().startOf('year').format('YYYY-MM-DD'), - toDate: moment().endOf('year').format('YYYY-MM-DD'), + fromDate: moment().startOf('month').format('YYYY-MM-DD'), + toDate: moment().format('YYYY-MM-DD'), filterByOption: 'with-transactions', itemsIds: [], }); diff --git a/packages/webapp/src/containers/FinancialStatements/SalesByItems/utils.tsx b/packages/webapp/src/containers/FinancialStatements/SalesByItems/utils.tsx index 461304506..b56536f33 100644 --- a/packages/webapp/src/containers/FinancialStatements/SalesByItems/utils.tsx +++ b/packages/webapp/src/containers/FinancialStatements/SalesByItems/utils.tsx @@ -25,8 +25,8 @@ export const getSalesByItemsQueryShema = () => { * Retrieves the default query. */ export const getDefaultSalesByItemsQuery = () => ({ - fromDate: moment().startOf('year').format('YYYY-MM-DD'), - toDate: moment().endOf('year').format('YYYY-MM-DD'), + fromDate: moment().startOf('month').format('YYYY-MM-DD'), + toDate: moment().format('YYYY-MM-DD'), filterByOption: 'with-transactions', itemsIds: [], }); diff --git a/packages/webapp/src/containers/FinancialStatements/TrialBalanceSheet/utils.tsx b/packages/webapp/src/containers/FinancialStatements/TrialBalanceSheet/utils.tsx index 6bbec6db7..62be9afa8 100644 --- a/packages/webapp/src/containers/FinancialStatements/TrialBalanceSheet/utils.tsx +++ b/packages/webapp/src/containers/FinancialStatements/TrialBalanceSheet/utils.tsx @@ -12,7 +12,7 @@ import { transformToForm } from '@/utils'; export function getDefaultTrialBalanceQuery() { return { fromDate: moment().startOf('year').format('YYYY-MM-DD'), - toDate: moment().endOf('year').format('YYYY-MM-DD'), + toDate: moment().format('YYYY-MM-DD'), basis: 'accrual', filterByOption: 'with-transactions', branchesIds: [],