mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 04:40:32 +00:00
feat(webapp): refactor http api hooks to seperate files
This commit is contained in:
18
packages/webapp/src/hooks/query/FinancialReports/index.ts
Normal file
18
packages/webapp/src/hooks/query/FinancialReports/index.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
export * from './use-balance-sheet';
|
||||
export * from './use-trial-balance-sheet';
|
||||
export * from './use-cashflow-sheet';
|
||||
export * from './use-profit-loss-sheet';
|
||||
export * from './use-general-ledger';
|
||||
export * from './use-journal-sheet';
|
||||
export * from './use-AP-aging-summary';
|
||||
export * from './use-AR-aging-summary';
|
||||
export * from './use-inventory-valuation';
|
||||
export * from './use-inventory-item-details';
|
||||
export * from './use-purchases-by-items';
|
||||
export * from './use-sales-by-items';
|
||||
export * from './use-customer-balance-summary';
|
||||
export * from './use-vendor-balance-summary';
|
||||
export * from './use-customer-transactions';
|
||||
export * from './use-vendor-transactions';
|
||||
export * from './use-sales-tax-liabilities-summary';
|
||||
export * from './use-transactions-by-reference';
|
||||
@@ -0,0 +1,61 @@
|
||||
// @ts-nocheck
|
||||
import { useRequestQuery } from '../../useQueryRequest';
|
||||
import { useDownloadFile } from '../../useDownloadFile';
|
||||
import { useRequestPdf } from '../../useRequestPdf';
|
||||
import t from '../types';
|
||||
|
||||
/**
|
||||
* Retrieve A/P aging summary report.
|
||||
*/
|
||||
export function useAPAgingSummaryReport(query, props) {
|
||||
return useRequestQuery(
|
||||
[t.FINANCIAL_REPORT, t.AP_AGING_SUMMARY, query],
|
||||
{
|
||||
method: 'get',
|
||||
url: '/financial_statements/payable_aging_summary',
|
||||
params: query,
|
||||
headers: {
|
||||
Accept: 'application/json+table',
|
||||
},
|
||||
},
|
||||
{
|
||||
select: (res) => res.data,
|
||||
...props,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
export const useAPAgingSheetXlsxExport = (query, args) => {
|
||||
return useDownloadFile({
|
||||
url: '/financial_statements/payable_aging_summary',
|
||||
config: {
|
||||
headers: {
|
||||
accept: 'application/xlsx',
|
||||
},
|
||||
params: query,
|
||||
},
|
||||
filename: 'payable_aging_summary.xlsx',
|
||||
...args,
|
||||
});
|
||||
};
|
||||
|
||||
export const useAPAgingSheetCsvExport = (query, args) => {
|
||||
return useDownloadFile({
|
||||
url: '/financial_statements/payable_aging_summary',
|
||||
config: {
|
||||
headers: {
|
||||
accept: 'application/csv',
|
||||
},
|
||||
params: query,
|
||||
},
|
||||
filename: 'payable_aging_summary.csv',
|
||||
...args,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieves the balance sheet pdf document data.
|
||||
*/
|
||||
export function useAPAgingSummaryPdf() {
|
||||
return useRequestPdf(`financial_statements/payable_aging_summary`);
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
// @ts-nocheck
|
||||
import { useRequestQuery } from '../../useQueryRequest';
|
||||
import { useDownloadFile } from '../../useDownloadFile';
|
||||
import { useRequestPdf } from '../../useRequestPdf';
|
||||
import t from '../types';
|
||||
/**
|
||||
* Retrieve A/R aging summary report.
|
||||
*/
|
||||
export function useARAgingSummaryReport(query, props) {
|
||||
return useRequestQuery(
|
||||
[t.FINANCIAL_REPORT, t.AR_AGING_SUMMARY, query],
|
||||
{
|
||||
method: 'get',
|
||||
url: '/financial_statements/receivable_aging_summary',
|
||||
params: query,
|
||||
headers: {
|
||||
Accept: 'application/json+table',
|
||||
},
|
||||
},
|
||||
{
|
||||
select: (res) => res.data,
|
||||
...props,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
export const useARAgingSheetXlsxExport = (query, args) => {
|
||||
return useDownloadFile({
|
||||
url: '/financial_statements/receivable_aging_summary',
|
||||
config: {
|
||||
headers: {
|
||||
accept: 'application/xlsx',
|
||||
},
|
||||
params: query,
|
||||
},
|
||||
filename: 'receivable_aging_summary.xlsx',
|
||||
...args,
|
||||
});
|
||||
};
|
||||
|
||||
export const useARAgingSheetCsvExport = (query, args) => {
|
||||
return useDownloadFile({
|
||||
url: '/financial_statements/receivable_aging_summary',
|
||||
config: {
|
||||
headers: {
|
||||
accept: 'application/csv',
|
||||
},
|
||||
params: query,
|
||||
},
|
||||
filename: 'receivable_aging_summary.csv',
|
||||
...args,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieves the A/R aging summary pdf document data.
|
||||
*/
|
||||
export function useARAgingSummaryPdf() {
|
||||
return useRequestPdf(`financial_statements/receivable_aging_summary`);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
// @ts-nocheck
|
||||
import { useRequestQuery } from '../../useQueryRequest';
|
||||
import { useDownloadFile } from '../../useDownloadFile';
|
||||
import { useRequestPdf } from '../../useRequestPdf';
|
||||
import t from '../types';
|
||||
|
||||
/**
|
||||
* Retrieve balance sheet.
|
||||
*/
|
||||
export function useBalanceSheet(query, props) {
|
||||
return useRequestQuery(
|
||||
[t.FINANCIAL_REPORT, t.BALANCE_SHEET, query],
|
||||
{
|
||||
method: 'get',
|
||||
url: '/financial_statements/balance_sheet',
|
||||
params: query,
|
||||
headers: {
|
||||
Accept: 'application/json+table',
|
||||
},
|
||||
},
|
||||
{
|
||||
select: (res) => res.data,
|
||||
...props,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
export const useBalanceSheetXlsxExport = (query, args) => {
|
||||
return useDownloadFile({
|
||||
url: '/financial_statements/balance_sheet',
|
||||
config: {
|
||||
headers: {
|
||||
accept: 'application/xlsx',
|
||||
},
|
||||
params: query,
|
||||
},
|
||||
filename: 'balance_sheet.xlsx',
|
||||
...args,
|
||||
});
|
||||
};
|
||||
|
||||
export const useBalanceSheetCsvExport = (query, args) => {
|
||||
return useDownloadFile({
|
||||
url: '/financial_statements/balance_sheet',
|
||||
config: {
|
||||
headers: {
|
||||
accept: 'application/csv',
|
||||
},
|
||||
params: query,
|
||||
},
|
||||
filename: 'balance_sheet.csv',
|
||||
...args,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieves the balance sheet pdf document data.
|
||||
*/
|
||||
export function useBalanceSheetPdf() {
|
||||
return useRequestPdf(`financial_statements/balance_sheet`);
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
// @ts-nocheck
|
||||
import { useRequestQuery } from '../../useQueryRequest';
|
||||
import { useDownloadFile } from '../../useDownloadFile';
|
||||
import { useRequestPdf } from '../../useRequestPdf';
|
||||
import t from '../types';
|
||||
|
||||
/**
|
||||
* Retrieve cash flow statement report.
|
||||
*/
|
||||
export function useCashFlowStatementReport(query, props) {
|
||||
return useRequestQuery(
|
||||
[t.FINANCIAL_REPORT, t.CASH_FLOW_STATEMENT, query],
|
||||
{
|
||||
method: 'get',
|
||||
url: '/financial_statements/cash-flow',
|
||||
params: query,
|
||||
headers: {
|
||||
Accept: 'application/json+table',
|
||||
},
|
||||
},
|
||||
{
|
||||
select: (res) => ({
|
||||
columns: res.data.table.columns,
|
||||
query: res.data.query,
|
||||
meta: res.data.meta,
|
||||
tableRows: res.data.table.rows,
|
||||
}),
|
||||
defaultData: {
|
||||
tableRows: [],
|
||||
columns: [],
|
||||
query: {},
|
||||
meta: {},
|
||||
},
|
||||
...props,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
export const useCashFlowStatementXlsxExport = (query, args) => {
|
||||
const url = '/financial_statements/cash-flow';
|
||||
const config = {
|
||||
headers: {
|
||||
accept: 'application/xlsx',
|
||||
},
|
||||
params: query,
|
||||
};
|
||||
const filename = 'cashflow_statement.xlsx';
|
||||
|
||||
return useDownloadFile({
|
||||
url,
|
||||
config,
|
||||
filename,
|
||||
...args,
|
||||
});
|
||||
};
|
||||
|
||||
export const useCashFlowStatementCsvExport = (query, args) => {
|
||||
const url = '/financial_statements/cash-flow';
|
||||
const config = {
|
||||
headers: {
|
||||
accept: 'application/csv',
|
||||
},
|
||||
params: query,
|
||||
};
|
||||
const filename = 'cashflow_statement.csv';
|
||||
|
||||
return useDownloadFile({
|
||||
url,
|
||||
config,
|
||||
filename,
|
||||
...args,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieves the cashflow sheet pdf document data.
|
||||
*/
|
||||
export function useCashflowSheetPdf() {
|
||||
return useRequestPdf(`financial_statements/cash-flow`);
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
// @ts-nocheck
|
||||
import { useRequestQuery } from '../../useQueryRequest';
|
||||
import { useDownloadFile } from '../../useDownloadFile';
|
||||
import { useRequestPdf } from '../../useRequestPdf';
|
||||
import t from '../types';
|
||||
|
||||
/**
|
||||
* Retrieve customers balance summary report.
|
||||
*/
|
||||
export function useCustomerBalanceSummaryReport(query, props) {
|
||||
return useRequestQuery(
|
||||
[t.FINANCIAL_REPORT, t.CUSTOMERS_BALANCE_SUMMARY, query],
|
||||
{
|
||||
method: 'get',
|
||||
url: '/financial_statements/customer-balance-summary',
|
||||
params: query,
|
||||
headers: {
|
||||
Accept: 'application/json+table',
|
||||
},
|
||||
},
|
||||
{
|
||||
select: (res) => ({
|
||||
query: res.data.query,
|
||||
table: res.data.table,
|
||||
}),
|
||||
defaultData: {
|
||||
table: {},
|
||||
query: {},
|
||||
},
|
||||
...props,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
export const useCustomerBalanceSummaryXlsxExport = (query, args) => {
|
||||
return useDownloadFile({
|
||||
url: '/financial_statements/customer-balance-summary',
|
||||
config: {
|
||||
headers: {
|
||||
accept: 'application/xlsx',
|
||||
},
|
||||
params: query,
|
||||
},
|
||||
filename: 'customer_balance_summary.xlsx',
|
||||
...args,
|
||||
});
|
||||
};
|
||||
|
||||
export const useCustomerBalanceSummaryCsvExport = (query, args) => {
|
||||
return useDownloadFile({
|
||||
url: '/financial_statements/customer-balance-summary',
|
||||
config: {
|
||||
headers: {
|
||||
accept: 'application/csv',
|
||||
},
|
||||
params: query,
|
||||
},
|
||||
filename: 'customer_balance_summary.csv',
|
||||
...args,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieves the balance sheet pdf document data.
|
||||
*/
|
||||
export function useCustomerBalanceSummaryPdf() {
|
||||
return useRequestPdf(`financial_statements/customer-balance-summary`);
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
// @ts-nocheck
|
||||
import { useRequestQuery } from '../../useQueryRequest';
|
||||
import { useDownloadFile } from '../../useDownloadFile';
|
||||
import { useRequestPdf } from '../../useRequestPdf';
|
||||
import t from '../types';
|
||||
|
||||
/**
|
||||
* Retrieve customers transactions report.
|
||||
*/
|
||||
export function useCustomersTransactionsReport(query, props) {
|
||||
return useRequestQuery(
|
||||
[t.FINANCIAL_REPORT, t.CUSTOMERS_TRANSACTIONS, query],
|
||||
{
|
||||
method: 'get',
|
||||
url: '/financial_statements/transactions-by-customers',
|
||||
params: query,
|
||||
headers: {
|
||||
Accept: 'application/json+table',
|
||||
},
|
||||
},
|
||||
{
|
||||
select: (res) => ({
|
||||
data: res.data.table,
|
||||
tableRows: res.data.table.rows,
|
||||
}),
|
||||
defaultData: {
|
||||
tableRows: [],
|
||||
data: [],
|
||||
},
|
||||
...props,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
export const useCustomersTransactionsXlsxExport = (query, args) => {
|
||||
const url = '/financial_statements/transactions-by-customers';
|
||||
const config = {
|
||||
headers: {
|
||||
accept: 'application/xlsx',
|
||||
},
|
||||
params: query,
|
||||
};
|
||||
const filename = 'customers_transactions.xlsx';
|
||||
|
||||
return useDownloadFile({
|
||||
url,
|
||||
config,
|
||||
filename,
|
||||
...args,
|
||||
});
|
||||
};
|
||||
|
||||
export const useCustomersTransactionsCsvExport = (query, args) => {
|
||||
return useDownloadFile({
|
||||
url: '/financial_statements/transactions-by-customers',
|
||||
config: {
|
||||
headers: {
|
||||
accept: 'application/csv',
|
||||
},
|
||||
params: query,
|
||||
},
|
||||
filename: 'customers_transactions.csv',
|
||||
...args,
|
||||
});
|
||||
};
|
||||
|
||||
export const useCustomersTransactionsPdfExport = () => {
|
||||
return useRequestPdf('/financial_statements/transactions-by-customers');
|
||||
};
|
||||
@@ -0,0 +1,60 @@
|
||||
// @ts-nocheck
|
||||
import { useRequestQuery } from '../../useQueryRequest';
|
||||
import { useDownloadFile } from '../../useDownloadFile';
|
||||
import { useRequestPdf } from '../../useRequestPdf';
|
||||
import t from '../types';
|
||||
|
||||
/**
|
||||
* Retrieve general ledger (GL) sheet.
|
||||
*/
|
||||
export function useGeneralLedgerSheet(query, props) {
|
||||
return useRequestQuery(
|
||||
[t.FINANCIAL_REPORT, t.GENERAL_LEDGER, query],
|
||||
{
|
||||
method: 'get',
|
||||
url: '/financial_statements/general_ledger',
|
||||
params: query,
|
||||
headers: {
|
||||
Accept: 'application/json+table',
|
||||
},
|
||||
},
|
||||
{
|
||||
select: (res) => res.data,
|
||||
...props,
|
||||
},
|
||||
);
|
||||
}
|
||||
export const useGeneralLedgerSheetXlsxExport = (query, args) => {
|
||||
return useDownloadFile({
|
||||
url: '/financial_statements/general_ledger',
|
||||
config: {
|
||||
headers: {
|
||||
accept: 'application/xlsx',
|
||||
},
|
||||
params: query,
|
||||
},
|
||||
filename: 'general_ledger.xlsx',
|
||||
...args,
|
||||
});
|
||||
};
|
||||
|
||||
export const useGeneralLedgerSheetCsvExport = (query, args) => {
|
||||
return useDownloadFile({
|
||||
url: '/financial_statements/general_ledger',
|
||||
config: {
|
||||
headers: {
|
||||
accept: 'application/csv',
|
||||
},
|
||||
params: query,
|
||||
},
|
||||
filename: 'general_ledger.csv',
|
||||
...args,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieves the general ledger pdf document data.
|
||||
*/
|
||||
export function useGeneralLedgerPdf() {
|
||||
return useRequestPdf(`financial_statements/general_ledger`);
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
// @ts-nocheck
|
||||
import { useRequestQuery } from '../../useQueryRequest';
|
||||
import { useDownloadFile } from '../../useDownloadFile';
|
||||
import { useRequestPdf } from '../../useRequestPdf';
|
||||
import t from '../types';
|
||||
|
||||
/**
|
||||
* Retrieve inventory item detail report.
|
||||
*/
|
||||
export function useInventoryItemDetailsReport(query, props) {
|
||||
return useRequestQuery(
|
||||
[t.FINANCIAL_REPORT, t.INVENTORY_ITEM_DETAILS, query],
|
||||
{
|
||||
method: 'get',
|
||||
url: '/financial_statements/inventory-item-details',
|
||||
params: query,
|
||||
headers: {
|
||||
Accept: 'application/json+table',
|
||||
},
|
||||
},
|
||||
{
|
||||
select: (res) => ({
|
||||
columns: res.data.table.columns,
|
||||
query: res.data.query,
|
||||
meta: res.data.meta,
|
||||
tableRows: res.data.table.rows,
|
||||
}),
|
||||
defaultData: {
|
||||
tableRows: [],
|
||||
columns: [],
|
||||
query: {},
|
||||
meta: {},
|
||||
},
|
||||
...props,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
export const useInventoryItemDetailsXlsxExport = (query, args) => {
|
||||
return useDownloadFile({
|
||||
url: '/financial_statements/inventory-item-details',
|
||||
config: {
|
||||
headers: {
|
||||
accept: 'application/xlsx',
|
||||
},
|
||||
params: query,
|
||||
},
|
||||
filename: 'inventory_item_details.xlsx',
|
||||
...args,
|
||||
});
|
||||
};
|
||||
|
||||
export const useInventoryItemDetailsCsvExport = (query, args) => {
|
||||
return useDownloadFile({
|
||||
url: '/financial_statements/inventory-item-details',
|
||||
config: {
|
||||
headers: {
|
||||
accept: 'application/csv',
|
||||
},
|
||||
params: query,
|
||||
},
|
||||
filename: 'inventory_item_details.csv',
|
||||
...args,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieves the balance sheet pdf document data.
|
||||
*/
|
||||
export function useInventoryItemDetailsPdf() {
|
||||
return useRequestPdf(`financial_statements/inventory-item-details`);
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
// @ts-nocheck
|
||||
import { useRequestQuery } from '../../useQueryRequest';
|
||||
import { useDownloadFile } from '../../useDownloadFile';
|
||||
import { useRequestPdf } from '../../useRequestPdf';
|
||||
import t from '../types';
|
||||
|
||||
/**
|
||||
* Retrieve inventory valuation.
|
||||
*/
|
||||
export function useInventoryValuation(query, props) {
|
||||
return useRequestQuery(
|
||||
[t.FINANCIAL_REPORT, t.INVENTORY_VALUATION, query],
|
||||
{
|
||||
method: 'get',
|
||||
url: '/financial_statements/inventory-valuation',
|
||||
params: query,
|
||||
},
|
||||
{
|
||||
select: (res) => res.data,
|
||||
|
||||
...props,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve inventory valuation.
|
||||
*/
|
||||
export function useInventoryValuationTable(query, props) {
|
||||
return useRequestQuery(
|
||||
[t.FINANCIAL_REPORT, t.INVENTORY_VALUATION, query],
|
||||
{
|
||||
method: 'get',
|
||||
url: '/financial_statements/inventory-valuation',
|
||||
params: query,
|
||||
headers: {
|
||||
Accept: 'application/json+table',
|
||||
},
|
||||
},
|
||||
{
|
||||
select: (res) => res.data,
|
||||
...props,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
export const useInventoryValuationXlsxExport = (query, args) => {
|
||||
return useDownloadFile({
|
||||
url: '/financial_statements/inventory-valuation',
|
||||
config: {
|
||||
headers: {
|
||||
accept: 'application/xlsx',
|
||||
},
|
||||
params: query,
|
||||
},
|
||||
filename: 'inventory_valuation.xlsx',
|
||||
...args,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieves the inventory valuation pdf document data.
|
||||
*/
|
||||
export function useInventoryValuationPdf() {
|
||||
return useRequestPdf(`financial_statements/inventory-valuation`);
|
||||
}
|
||||
|
||||
export const useInventoryValuationCsvExport = (query, args) => {
|
||||
return useDownloadFile({
|
||||
url: '/financial_statements/inventory-valuation',
|
||||
config: {
|
||||
headers: {
|
||||
accept: 'application/csv',
|
||||
},
|
||||
params: query,
|
||||
},
|
||||
filename: 'inventory_valuation.csv',
|
||||
...args,
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1,61 @@
|
||||
// @ts-nocheck
|
||||
import { useRequestQuery } from '../../useQueryRequest';
|
||||
import { useDownloadFile } from '../../useDownloadFile';
|
||||
import { useRequestPdf } from '../../useRequestPdf';
|
||||
import t from '../types';
|
||||
|
||||
/**
|
||||
* Retrieve journal sheet.
|
||||
*/
|
||||
export function useJournalSheet(query, props) {
|
||||
return useRequestQuery(
|
||||
[t.FINANCIAL_REPORT, t.JOURNAL, query],
|
||||
{
|
||||
method: 'get',
|
||||
url: '/financial_statements/journal',
|
||||
params: query,
|
||||
headers: {
|
||||
Accept: 'application/json+table',
|
||||
},
|
||||
},
|
||||
{
|
||||
select: (res) => res.data,
|
||||
...props,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
export const useJournalSheetXlsxExport = (query, args) => {
|
||||
return useDownloadFile({
|
||||
url: '/financial_statements/journal',
|
||||
config: {
|
||||
headers: {
|
||||
accept: 'application/xlsx',
|
||||
},
|
||||
params: query,
|
||||
},
|
||||
filename: 'journal.xlsx',
|
||||
...args,
|
||||
});
|
||||
};
|
||||
|
||||
export const useJournalSheetCsvExport = (query, args) => {
|
||||
return useDownloadFile({
|
||||
url: '/financial_statements/journal',
|
||||
config: {
|
||||
headers: {
|
||||
accept: 'application/csv',
|
||||
},
|
||||
params: query,
|
||||
},
|
||||
filename: 'journal.csv',
|
||||
...args,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieves the journal sheet pdf content.
|
||||
*/
|
||||
export const useJournalSheetPdf = (query = {}) => {
|
||||
return useRequestPdf(`financial_statements/journal`);
|
||||
};
|
||||
@@ -0,0 +1,61 @@
|
||||
// @ts-nocheck
|
||||
import { useRequestQuery } from '../../useQueryRequest';
|
||||
import { useDownloadFile } from '../../useDownloadFile';
|
||||
import { useRequestPdf } from '../../useRequestPdf';
|
||||
import t from '../types';
|
||||
|
||||
/**
|
||||
* Retrieve profit/loss (P&L) sheet.
|
||||
*/
|
||||
export function useProfitLossSheet(query, props) {
|
||||
return useRequestQuery(
|
||||
[t.FINANCIAL_REPORT, t.PROFIT_LOSS_SHEET, query],
|
||||
{
|
||||
method: 'get',
|
||||
url: '/financial_statements/profit_loss_sheet',
|
||||
params: query,
|
||||
headers: {
|
||||
Accept: 'application/json+table',
|
||||
},
|
||||
},
|
||||
{
|
||||
select: (res) => res.data,
|
||||
...props,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
export const useProfitLossSheetXlsxExport = (query, args) => {
|
||||
return useDownloadFile({
|
||||
url: '/financial_statements/profit_loss_sheet',
|
||||
config: {
|
||||
headers: {
|
||||
accept: 'application/xlsx',
|
||||
},
|
||||
params: query,
|
||||
},
|
||||
filename: 'profit_loss_sheet.xlsx',
|
||||
...args,
|
||||
});
|
||||
};
|
||||
|
||||
export const useProfitLossSheetCsvExport = (query, args) => {
|
||||
return useDownloadFile({
|
||||
url: '/financial_statements/profit_loss_sheet',
|
||||
config: {
|
||||
headers: {
|
||||
accept: 'application/csv',
|
||||
},
|
||||
params: query,
|
||||
},
|
||||
filename: 'profit_loss_sheet.csv',
|
||||
...args,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieves the cashflow sheet pdf document data.
|
||||
*/
|
||||
export function useProfitLossSheetPdf() {
|
||||
return useRequestPdf(`financial_statements/profit_loss_sheet`);
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
// @ts-nocheck
|
||||
import { useRequestQuery } from '../../useQueryRequest';
|
||||
import { useDownloadFile } from '../../useDownloadFile';
|
||||
import { useRequestPdf } from '../../useRequestPdf';
|
||||
import t from '../types';
|
||||
|
||||
/**
|
||||
* Retrieve purchases by items.
|
||||
*/
|
||||
export function usePurchasesByItems(query, props) {
|
||||
return useRequestQuery(
|
||||
[t.FINANCIAL_REPORT, t.PURCHASES_BY_ITEMS, query],
|
||||
{
|
||||
method: 'get',
|
||||
url: '/financial_statements/purchases-by-items',
|
||||
params: query,
|
||||
},
|
||||
{
|
||||
select: (res) => res.data,
|
||||
...props,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
export function usePurchasesByItemsTable(query, props) {
|
||||
return useRequestQuery(
|
||||
[t.FINANCIAL_REPORT, t.PURCHASES_BY_ITEMS, query],
|
||||
{
|
||||
method: 'get',
|
||||
url: '/financial_statements/purchases-by-items',
|
||||
params: query,
|
||||
headers: {
|
||||
accept: 'application/json+table',
|
||||
},
|
||||
},
|
||||
{
|
||||
select: (res) => res.data,
|
||||
...props,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
export const usePurchasesByItemsCsvExport = (query, args) => {
|
||||
return useDownloadFile({
|
||||
url: '/financial_statements/purchases-by-items',
|
||||
config: {
|
||||
headers: {
|
||||
accept: 'application/csv',
|
||||
},
|
||||
params: query,
|
||||
},
|
||||
filename: 'purchases_by_items.csv',
|
||||
...args,
|
||||
});
|
||||
};
|
||||
|
||||
export const usePurchasesByItemsXlsxExport = (query, args) => {
|
||||
return useDownloadFile({
|
||||
url: '/financial_statements/purchases-by-items',
|
||||
config: {
|
||||
headers: {
|
||||
accept: 'application/xlsx',
|
||||
},
|
||||
params: query,
|
||||
},
|
||||
filename: 'purchases_by_items.xlsx',
|
||||
...args,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @returns
|
||||
*/
|
||||
export const usePurchasesByItemsPdfExport = () => {
|
||||
return useRequestPdf('/financial_statements/purchases-by-items');
|
||||
};
|
||||
@@ -0,0 +1,75 @@
|
||||
// @ts-nocheck
|
||||
import { useRequestQuery } from '../../useQueryRequest';
|
||||
import { useDownloadFile } from '../../useDownloadFile';
|
||||
import { useRequestPdf } from '../../useRequestPdf';
|
||||
import t from '../types';
|
||||
|
||||
/**
|
||||
* Retrieve sales by items.
|
||||
*/
|
||||
export function useSalesByItems(query, props) {
|
||||
return useRequestQuery(
|
||||
[t.FINANCIAL_REPORT, t.SALES_BY_ITEMS, query],
|
||||
{
|
||||
method: 'get',
|
||||
url: '/financial_statements/sales-by-items',
|
||||
params: query,
|
||||
},
|
||||
{
|
||||
...props,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves sales by items table format.
|
||||
*/
|
||||
export function useSalesByItemsTable(query, props) {
|
||||
return useRequestQuery(
|
||||
[t.FINANCIAL_REPORT, t.SALES_BY_ITEMS, query],
|
||||
{
|
||||
method: 'get',
|
||||
url: '/financial_statements/sales-by-items',
|
||||
params: query,
|
||||
headers: {
|
||||
Accept: 'application/json+table',
|
||||
},
|
||||
},
|
||||
{
|
||||
select: (res) => res.data,
|
||||
...props,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
export const useSalesByItemsCsvExport = (query, args) => {
|
||||
return useDownloadFile({
|
||||
url: '/financial_statements/sales-by-items',
|
||||
config: {
|
||||
headers: {
|
||||
accept: 'application/csv',
|
||||
},
|
||||
params: query,
|
||||
},
|
||||
filename: 'sales_by_items.csv',
|
||||
...args,
|
||||
});
|
||||
};
|
||||
|
||||
export const useSalesByItemsXlsxExport = (query, args) => {
|
||||
return useDownloadFile({
|
||||
url: '/financial_statements/sales-by-items',
|
||||
config: {
|
||||
headers: {
|
||||
accept: 'application/xlsx',
|
||||
},
|
||||
params: query,
|
||||
},
|
||||
filename: 'sales_by_items.xlsx',
|
||||
...args,
|
||||
});
|
||||
};
|
||||
|
||||
export const useSalesByItemsPdfExport = () => {
|
||||
return useRequestPdf('/financial_statements/sales-by-items');
|
||||
};
|
||||
@@ -0,0 +1,61 @@
|
||||
// @ts-nocheck
|
||||
import { useRequestQuery } from '../../useQueryRequest';
|
||||
import { useDownloadFile } from '../../useDownloadFile';
|
||||
import { useRequestPdf } from '../../useRequestPdf';
|
||||
import t from '../types';
|
||||
|
||||
/**
|
||||
* Retrieves the sales tax liability summary report.
|
||||
*/
|
||||
export function useSalesTaxLiabilitySummary(query, props) {
|
||||
return useRequestQuery(
|
||||
[t.FINANCIAL_REPORT, t.SALES_TAX_LIABILITY_SUMMARY, query],
|
||||
{
|
||||
method: 'get',
|
||||
url: '/financial_statements/sales-tax-liability-summary',
|
||||
params: query,
|
||||
headers: {
|
||||
Accept: 'application/json+table',
|
||||
},
|
||||
},
|
||||
{
|
||||
select: (res) => res.data,
|
||||
...props,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
export const useSalesTaxLiabilitySummaryXlsxExport = (query, args) => {
|
||||
return useDownloadFile({
|
||||
url: '/financial_statements/sales-tax-liability-summary',
|
||||
config: {
|
||||
headers: {
|
||||
accept: 'application/xlsx',
|
||||
},
|
||||
params: query,
|
||||
},
|
||||
filename: 'sales_tax_liability_summary.xlsx',
|
||||
...args,
|
||||
});
|
||||
};
|
||||
|
||||
export const useSalesTaxLiabilitySummaryCsvExport = (query, args) => {
|
||||
return useDownloadFile({
|
||||
url: '/financial_statements/sales-tax-liability-summary',
|
||||
config: {
|
||||
headers: {
|
||||
accept: 'application/csv',
|
||||
},
|
||||
params: query,
|
||||
},
|
||||
filename: 'sales_tax_liability_summary.csv',
|
||||
...args,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieves the balance sheet pdf document data.
|
||||
*/
|
||||
export function useSalesTaxLiabilitySummaryPdf() {
|
||||
return useRequestPdf(`financial_statements/sales-tax-liability-summary`);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
// @ts-nocheck
|
||||
import { useRequestQuery } from '../../useQueryRequest';
|
||||
import t from '../types';
|
||||
/**
|
||||
* 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,
|
||||
defaultData: {
|
||||
transactions: [],
|
||||
},
|
||||
...props,
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
// @ts-nocheck
|
||||
import { useRequestQuery } from '../../useQueryRequest';
|
||||
import { useDownloadFile } from '../../useDownloadFile';
|
||||
import { useRequestPdf } from '../../useRequestPdf';
|
||||
import t from '../types';
|
||||
|
||||
/**
|
||||
* Retrieve trial balance sheet.
|
||||
*/
|
||||
export function useTrialBalanceSheet(query, props) {
|
||||
return useRequestQuery(
|
||||
[t.FINANCIAL_REPORT, t.TRIAL_BALANCE_SHEET, query],
|
||||
{
|
||||
method: 'get',
|
||||
url: '/financial_statements/trial_balance_sheet',
|
||||
params: query,
|
||||
headers: {
|
||||
Accept: 'application/json+table',
|
||||
},
|
||||
},
|
||||
{
|
||||
select: (res) => res.data,
|
||||
...props,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
export const useTrialBalanceSheetXlsxExport = (query, args) => {
|
||||
return useDownloadFile({
|
||||
url: '/financial_statements/trial_balance_sheet',
|
||||
config: {
|
||||
headers: {
|
||||
accept: 'application/xlsx',
|
||||
},
|
||||
params: query,
|
||||
},
|
||||
filename: 'trial_balance_sheet.xlsx',
|
||||
...args,
|
||||
});
|
||||
};
|
||||
|
||||
export const useTrialBalanceSheetCsvExport = (query, args) => {
|
||||
return useDownloadFile({
|
||||
url: '/financial_statements/trial_balance_sheet',
|
||||
config: {
|
||||
headers: {
|
||||
accept: 'application/csv',
|
||||
},
|
||||
params: query,
|
||||
},
|
||||
filename: 'trial_balance_sheet.csv',
|
||||
...args,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieves the trial balance sheet pdf document data.
|
||||
*/
|
||||
export function useTrialBalanceSheetPdf() {
|
||||
return useRequestPdf(`financial_statements/trial_balance_sheet`);
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
// @ts-nocheck
|
||||
import { useRequestQuery } from '../../useQueryRequest';
|
||||
import { useDownloadFile } from '../../useDownloadFile';
|
||||
import { useRequestPdf } from '../../useRequestPdf';
|
||||
import t from '../types';
|
||||
|
||||
/**
|
||||
* Retrieve vendors balance summary report.
|
||||
*/
|
||||
export function useVendorsBalanceSummaryReport(query, props) {
|
||||
return useRequestQuery(
|
||||
[t.FINANCIAL_REPORT, t.VENDORS_BALANCE_SUMMARY, query],
|
||||
{
|
||||
method: 'get',
|
||||
url: '/financial_statements/vendor-balance-summary',
|
||||
params: query,
|
||||
headers: {
|
||||
Accept: 'application/json+table',
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
select: (res) => ({
|
||||
query: res.data.query,
|
||||
table: res.data.table,
|
||||
}),
|
||||
defaultData: {
|
||||
table: {},
|
||||
query: {},
|
||||
},
|
||||
...props,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
export const useVendorBalanceSummaryXlsxExport = (args) => {
|
||||
const url = '/financial_statements/vendor-balance-summary';
|
||||
const config = {
|
||||
headers: {
|
||||
accept: 'application/xlsx',
|
||||
},
|
||||
};
|
||||
const filename = 'vendor_balance_summary.xlsx';
|
||||
|
||||
return useDownloadFile({
|
||||
url,
|
||||
config,
|
||||
filename,
|
||||
...args,
|
||||
});
|
||||
};
|
||||
|
||||
export const useVendorBalanceSummaryCsvExport = (args) => {
|
||||
return useDownloadFile({
|
||||
url: '/financial_statements/vendor-balance-summary',
|
||||
config: {
|
||||
headers: {
|
||||
accept: 'application/csv',
|
||||
},
|
||||
},
|
||||
filename: 'vendor_balance_summary.csv',
|
||||
...args,
|
||||
});
|
||||
};
|
||||
|
||||
export const useVendorBalanceSummaryPdfExport = () => {
|
||||
return useRequestPdf('/financial_statements/vendor-balance-summary');
|
||||
};
|
||||
@@ -0,0 +1,71 @@
|
||||
// @ts-nocheck
|
||||
import { useRequestQuery } from '../../useQueryRequest';
|
||||
import { useDownloadFile } from '../../useDownloadFile';
|
||||
import { useRequestPdf } from '../../useRequestPdf';
|
||||
import t from '../types';
|
||||
|
||||
/**
|
||||
* Retrieve vendors transactions report.
|
||||
*/
|
||||
export function useVendorsTransactionsReport(query, props) {
|
||||
return useRequestQuery(
|
||||
[t.FINANCIAL_REPORT, t.VENDORS_TRANSACTIONS, query],
|
||||
{
|
||||
method: 'get',
|
||||
url: '/financial_statements/transactions-by-vendors',
|
||||
params: query,
|
||||
headers: {
|
||||
Accept: 'application/json+table',
|
||||
},
|
||||
},
|
||||
{
|
||||
select: (res) => ({
|
||||
data: res.data.table,
|
||||
tableRows: res.data.table.rows,
|
||||
}),
|
||||
defaultData: {
|
||||
tableRows: [],
|
||||
data: [],
|
||||
},
|
||||
...props,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
export const useVendorsTransactionsXlsxExport = (query, args) => {
|
||||
const url = '/financial_statements/transactions-by-vendors';
|
||||
const config = {
|
||||
headers: {
|
||||
accept: 'application/xlsx',
|
||||
},
|
||||
params: query,
|
||||
};
|
||||
const filename = 'transactions_by_vendor.xlsx';
|
||||
|
||||
return useDownloadFile({
|
||||
url,
|
||||
config,
|
||||
filename,
|
||||
...args,
|
||||
});
|
||||
};
|
||||
|
||||
export const useVendorsTransactionsCsvExport = (query, args) => {
|
||||
return useDownloadFile({
|
||||
url: '/financial_statements/transactions-by-vendors',
|
||||
config: {
|
||||
headers: {
|
||||
accept: 'application/csv',
|
||||
},
|
||||
params: query,
|
||||
},
|
||||
filename: 'transactions_by_vendor.csv',
|
||||
...args,
|
||||
});
|
||||
};
|
||||
/**
|
||||
* Retrieves the balance sheet pdf document data.
|
||||
*/
|
||||
export function useTransactionsByVendorsPdf() {
|
||||
return useRequestPdf(`financial_statements/transactions-by-vendors`);
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -6,7 +6,6 @@ export * from './items';
|
||||
export * from './itemsCategories';
|
||||
export * from './inventoryAdjustments';
|
||||
export * from './expenses';
|
||||
export * from './financialReports';
|
||||
export * from './customers';
|
||||
export * from './vendors';
|
||||
export * from './manualJournals';
|
||||
@@ -37,3 +36,4 @@ export * from './transactionsLocking';
|
||||
export * from './warehouses';
|
||||
export * from './branches';
|
||||
export * from './warehousesTransfers';
|
||||
export * from './FinancialReports';
|
||||
|
||||
Reference in New Issue
Block a user