mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 07:10:33 +00:00
fix(webapp): change the default from/to date values of reports
This commit is contained in:
@@ -11,7 +11,10 @@ const ARAgingSummaryContext = createContext();
|
|||||||
*/
|
*/
|
||||||
function ARAgingSummaryProvider({ filter, ...props }) {
|
function ARAgingSummaryProvider({ filter, ...props }) {
|
||||||
// Transformes the filter from to the url query.
|
// 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.
|
// A/R aging summary sheet context.
|
||||||
const {
|
const {
|
||||||
@@ -19,11 +22,10 @@ function ARAgingSummaryProvider({ filter, ...props }) {
|
|||||||
isLoading: isARAgingLoading,
|
isLoading: isARAgingLoading,
|
||||||
isFetching: isARAgingFetching,
|
isFetching: isARAgingFetching,
|
||||||
refetch,
|
refetch,
|
||||||
} = useARAgingSummaryReport(query, { keepPreviousData: true });
|
} = useARAgingSummaryReport(requestQuery, { keepPreviousData: true });
|
||||||
|
|
||||||
const provider = {
|
const provider = {
|
||||||
ARAgingSummary,
|
ARAgingSummary,
|
||||||
|
|
||||||
isARAgingLoading,
|
isARAgingLoading,
|
||||||
isARAgingFetching,
|
isARAgingFetching,
|
||||||
refetch,
|
refetch,
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export default function ReceivableAgingSummaryTable({
|
|||||||
}) {
|
}) {
|
||||||
// AR aging summary report context.
|
// AR aging summary report context.
|
||||||
const {
|
const {
|
||||||
ARAgingSummary: { table },
|
ARAgingSummary: { table, query },
|
||||||
isARAgingLoading,
|
isARAgingLoading,
|
||||||
} = useARAgingSummaryContext();
|
} = useARAgingSummaryContext();
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@ export default function ReceivableAgingSummaryTable({
|
|||||||
<FinancialSheet
|
<FinancialSheet
|
||||||
companyName={organizationName}
|
companyName={organizationName}
|
||||||
sheetType={intl.get('receivable_aging_summary')}
|
sheetType={intl.get('receivable_aging_summary')}
|
||||||
asDate={new Date()}
|
asDate={query.as_date}
|
||||||
loading={isARAgingLoading}
|
loading={isARAgingLoading}
|
||||||
>
|
>
|
||||||
<ARAgingSummaryDataTable
|
<ARAgingSummaryDataTable
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import { useAppQueryString } from '@/hooks';
|
|||||||
*/
|
*/
|
||||||
export const getDefaultBalanceSheetQuery = () => ({
|
export const getDefaultBalanceSheetQuery = () => ({
|
||||||
fromDate: moment().startOf('year').format('YYYY-MM-DD'),
|
fromDate: moment().startOf('year').format('YYYY-MM-DD'),
|
||||||
toDate: moment().endOf('year').format('YYYY-MM-DD'),
|
toDate: moment().format('YYYY-MM-DD'),
|
||||||
basis: 'cash',
|
basis: 'cash',
|
||||||
displayColumnsType: 'total',
|
displayColumnsType: 'total',
|
||||||
filterByOption: 'without-zero-balance',
|
filterByOption: 'without-zero-balance',
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import { useAppQueryString } from '@/hooks';
|
|||||||
export const getDefaultCashFlowSheetQuery = () => {
|
export const getDefaultCashFlowSheetQuery = () => {
|
||||||
return {
|
return {
|
||||||
fromDate: moment().startOf('year').format('YYYY-MM-DD'),
|
fromDate: moment().startOf('year').format('YYYY-MM-DD'),
|
||||||
toDate: moment().endOf('year').format('YYYY-MM-DD'),
|
toDate: moment().format('YYYY-MM-DD'),
|
||||||
basis: 'cash',
|
basis: 'cash',
|
||||||
displayColumnsType: 'total',
|
displayColumnsType: 'total',
|
||||||
filterByOption: 'with-transactions',
|
filterByOption: 'with-transactions',
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ export default function CustomersBalanceSummaryTable({
|
|||||||
companyName,
|
companyName,
|
||||||
}) {
|
}) {
|
||||||
const {
|
const {
|
||||||
CustomerBalanceSummary: { table },
|
CustomerBalanceSummary: { table, query },
|
||||||
} = useCustomersBalanceSummaryContext();
|
} = useCustomersBalanceSummaryContext();
|
||||||
|
|
||||||
// Retrieves the customers summary columns.
|
// Retrieves the customers summary columns.
|
||||||
@@ -28,7 +28,7 @@ export default function CustomersBalanceSummaryTable({
|
|||||||
<FinancialSheet
|
<FinancialSheet
|
||||||
companyName={companyName}
|
companyName={companyName}
|
||||||
sheetType={intl.get('customers_balance_summary')}
|
sheetType={intl.get('customers_balance_summary')}
|
||||||
asDate={new Date()}
|
asDate={query.as_date}
|
||||||
>
|
>
|
||||||
<CustomerBalanceDataTable
|
<CustomerBalanceDataTable
|
||||||
columns={columns}
|
columns={columns}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ export const getCustomersTransactionsQuerySchema = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getCustomersTransactionsDefaultQuery = () => ({
|
export const getCustomersTransactionsDefaultQuery = () => ({
|
||||||
fromDate: moment().toDate(),
|
fromDate: moment().startOf('month').toDate(),
|
||||||
toDate: moment().toDate(),
|
toDate: moment().toDate(),
|
||||||
customersIds: [],
|
customersIds: [],
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ export const filterAccountsOptions = [
|
|||||||
* Retrieves the default general ledger query.
|
* Retrieves the default general ledger query.
|
||||||
*/
|
*/
|
||||||
export const getDefaultGeneralLedgerQuery = () => ({
|
export const getDefaultGeneralLedgerQuery = () => ({
|
||||||
fromDate: moment().startOf('year').format('YYYY-MM-DD'),
|
fromDate: moment().startOf('month').format('YYYY-MM-DD'),
|
||||||
toDate: moment().endOf('year').format('YYYY-MM-DD'),
|
toDate: moment().format('YYYY-MM-DD'),
|
||||||
basis: 'accrual',
|
basis: 'accrual',
|
||||||
filterByOption: 'with-transactions',
|
filterByOption: 'with-transactions',
|
||||||
branchesIds: [],
|
branchesIds: [],
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ export function InventoryItemDetailsTable({
|
|||||||
companyName={companyName}
|
companyName={companyName}
|
||||||
sheetType={intl.get('inventory_item_details')}
|
sheetType={intl.get('inventory_item_details')}
|
||||||
loading={isInventoryItemDetailsLoading}
|
loading={isInventoryItemDetailsLoading}
|
||||||
fromDate={query.from_date}
|
fromDate={query.fromDate}
|
||||||
toDate={query.to_date}
|
toDate={query.toDate}
|
||||||
fullWidth={true}
|
fullWidth={true}
|
||||||
>
|
>
|
||||||
<InventoryItemDetailsDataTable
|
<InventoryItemDetailsDataTable
|
||||||
|
|||||||
@@ -31,9 +31,6 @@ const numericColumn = R.curry((data, index, column) => ({
|
|||||||
align: Align.Right,
|
align: Align.Right,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
/**
|
|
||||||
* columns mapper.
|
|
||||||
*/
|
|
||||||
const columnsMapper = R.curry((data, index, column) => ({
|
const columnsMapper = R.curry((data, index, column) => ({
|
||||||
id: column.key,
|
id: column.key,
|
||||||
key: column.key,
|
key: column.key,
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ import { transformToForm } from '@/utils';
|
|||||||
* Retrieves inventory item details default query.
|
* Retrieves inventory item details default query.
|
||||||
*/
|
*/
|
||||||
export const getInventoryItemDetailsDefaultQuery = () => ({
|
export const getInventoryItemDetailsDefaultQuery = () => ({
|
||||||
fromDate: moment().startOf('year').format('YYYY-MM-DD'),
|
fromDate: moment().startOf('month').format('YYYY-MM-DD'),
|
||||||
toDate: moment().endOf('year').format('YYYY-MM-DD'),
|
toDate: moment().format('YYYY-MM-DD'),
|
||||||
itemsIds: [],
|
itemsIds: [],
|
||||||
warehousesIds: [],
|
warehousesIds: [],
|
||||||
branchesIds: [],
|
branchesIds: [],
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ export default function InventoryValuationTable({
|
|||||||
}) {
|
}) {
|
||||||
// inventory valuation context.
|
// inventory valuation context.
|
||||||
const {
|
const {
|
||||||
inventoryValuation: { tableRows },
|
inventoryValuation: { tableRows, query },
|
||||||
isLoading,
|
isLoading,
|
||||||
} = useInventoryValuationContext();
|
} = useInventoryValuationContext();
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@ export default function InventoryValuationTable({
|
|||||||
<InventoryValuationSheet
|
<InventoryValuationSheet
|
||||||
companyName={companyName}
|
companyName={companyName}
|
||||||
sheetType={intl.get('inventory_valuation')}
|
sheetType={intl.get('inventory_valuation')}
|
||||||
asDate={new Date()}
|
asDate={query.as_date}
|
||||||
loading={isLoading}
|
loading={isLoading}
|
||||||
>
|
>
|
||||||
<InventoryValuationDataTable
|
<InventoryValuationDataTable
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export const getInventoryValuationQuerySchema = () => {
|
|||||||
* Retrieves the inventory valuation sheet default query.
|
* Retrieves the inventory valuation sheet default query.
|
||||||
*/
|
*/
|
||||||
export const getInventoryValuationQuery = () => ({
|
export const getInventoryValuationQuery = () => ({
|
||||||
asDate: moment().endOf('day').format('YYYY-MM-DD'),
|
asDate: moment().format('YYYY-MM-DD'),
|
||||||
filterByOption: 'with-transactions',
|
filterByOption: 'with-transactions',
|
||||||
itemsIds: [],
|
itemsIds: [],
|
||||||
branchesIds: [],
|
branchesIds: [],
|
||||||
|
|||||||
@@ -11,17 +11,16 @@ import { transformToForm } from '@/utils';
|
|||||||
*/
|
*/
|
||||||
export const getDefaultJournalQuery = () => {
|
export const getDefaultJournalQuery = () => {
|
||||||
return {
|
return {
|
||||||
fromDate: moment().startOf('year').format('YYYY-MM-DD'),
|
fromDate: moment().startOf('month').format('YYYY-MM-DD'),
|
||||||
toDate: moment().endOf('year').format('YYYY-MM-DD'),
|
toDate: moment().format('YYYY-MM-DD'),
|
||||||
basis: 'accrual',
|
basis: 'accrual',
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses balance sheet query.
|
* Parses balance sheet query.
|
||||||
*/
|
*/
|
||||||
const parseJournalQuery = (locationQuery) => {
|
const parseJournalQuery = (locationQuery) => {
|
||||||
const defaultQuery = getDefaultJournalQuery();
|
const defaultQuery = getDefaultJournalQuery();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import { castArray } from 'lodash';
|
|||||||
export const getDefaultProfitLossQuery = () => ({
|
export const getDefaultProfitLossQuery = () => ({
|
||||||
basis: 'cash',
|
basis: 'cash',
|
||||||
fromDate: moment().startOf('year').format('YYYY-MM-DD'),
|
fromDate: moment().startOf('year').format('YYYY-MM-DD'),
|
||||||
toDate: moment().endOf('year').format('YYYY-MM-DD'),
|
toDate: moment().format('YYYY-MM-DD'),
|
||||||
displayColumnsType: 'total',
|
displayColumnsType: 'total',
|
||||||
filterByOption: 'with-transactions',
|
filterByOption: 'with-transactions',
|
||||||
|
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ import { castArray } from 'lodash';
|
|||||||
* Retrieves the purchases by items query.
|
* Retrieves the purchases by items query.
|
||||||
*/
|
*/
|
||||||
export const getDefaultPurchasesByItemsQuery = () => ({
|
export const getDefaultPurchasesByItemsQuery = () => ({
|
||||||
fromDate: moment().startOf('year').format('YYYY-MM-DD'),
|
fromDate: moment().startOf('month').format('YYYY-MM-DD'),
|
||||||
toDate: moment().endOf('year').format('YYYY-MM-DD'),
|
toDate: moment().format('YYYY-MM-DD'),
|
||||||
filterByOption: 'with-transactions',
|
filterByOption: 'with-transactions',
|
||||||
itemsIds: [],
|
itemsIds: [],
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ export const getSalesByItemsQueryShema = () => {
|
|||||||
* Retrieves the default query.
|
* Retrieves the default query.
|
||||||
*/
|
*/
|
||||||
export const getDefaultSalesByItemsQuery = () => ({
|
export const getDefaultSalesByItemsQuery = () => ({
|
||||||
fromDate: moment().startOf('year').format('YYYY-MM-DD'),
|
fromDate: moment().startOf('month').format('YYYY-MM-DD'),
|
||||||
toDate: moment().endOf('year').format('YYYY-MM-DD'),
|
toDate: moment().format('YYYY-MM-DD'),
|
||||||
filterByOption: 'with-transactions',
|
filterByOption: 'with-transactions',
|
||||||
itemsIds: [],
|
itemsIds: [],
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import { transformToForm } from '@/utils';
|
|||||||
export function getDefaultTrialBalanceQuery() {
|
export function getDefaultTrialBalanceQuery() {
|
||||||
return {
|
return {
|
||||||
fromDate: moment().startOf('year').format('YYYY-MM-DD'),
|
fromDate: moment().startOf('year').format('YYYY-MM-DD'),
|
||||||
toDate: moment().endOf('year').format('YYYY-MM-DD'),
|
toDate: moment().format('YYYY-MM-DD'),
|
||||||
basis: 'accrual',
|
basis: 'accrual',
|
||||||
filterByOption: 'with-transactions',
|
filterByOption: 'with-transactions',
|
||||||
branchesIds: [],
|
branchesIds: [],
|
||||||
|
|||||||
Reference in New Issue
Block a user