mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 15:20:34 +00:00
fix: financial reports responses
This commit is contained in:
@@ -18,16 +18,15 @@ import {
|
|||||||
PURCHASES_BY_ITEM_VIEWED,
|
PURCHASES_BY_ITEM_VIEWED,
|
||||||
} from '../event-tracker';
|
} from '../event-tracker';
|
||||||
import { events } from '@/common/events/events';
|
import { events } from '@/common/events/events';
|
||||||
import { POSTHOG_PROVIDER } from '../PostHog.constants';
|
import { EventTrackerService } from '../EventTracker.service';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ReportsEventsTracker {
|
export class ReportsEventsTracker {
|
||||||
constructor(@Inject(POSTHOG_PROVIDER) private readonly posthog: any) {}
|
constructor(private readonly posthog: EventTrackerService) {}
|
||||||
|
|
||||||
@OnEvent(events.reports.onBalanceSheetViewed)
|
@OnEvent(events.reports.onBalanceSheetViewed)
|
||||||
handleTrackBalanceSheetViewedEvent({ tenantId }: ReportsEvents) {
|
handleTrackBalanceSheetViewedEvent({ tenantId }: ReportsEvents) {
|
||||||
this.posthog.trackEvent({
|
this.posthog.trackEvent({
|
||||||
distinctId: `tenant-${tenantId}`,
|
|
||||||
event: BALANCE_SHEET_VIEWED,
|
event: BALANCE_SHEET_VIEWED,
|
||||||
properties: {},
|
properties: {},
|
||||||
});
|
});
|
||||||
@@ -36,7 +35,6 @@ export class ReportsEventsTracker {
|
|||||||
@OnEvent(events.reports.onTrialBalanceSheetView)
|
@OnEvent(events.reports.onTrialBalanceSheetView)
|
||||||
handleTrackTrialBalanceSheetViewedEvent({ tenantId }: ReportsEvents) {
|
handleTrackTrialBalanceSheetViewedEvent({ tenantId }: ReportsEvents) {
|
||||||
this.posthog.trackEvent({
|
this.posthog.trackEvent({
|
||||||
distinctId: `tenant-${tenantId}`,
|
|
||||||
event: TRIAL_BALANCE_SHEET_VIEWED,
|
event: TRIAL_BALANCE_SHEET_VIEWED,
|
||||||
properties: {},
|
properties: {},
|
||||||
});
|
});
|
||||||
@@ -45,7 +43,6 @@ export class ReportsEventsTracker {
|
|||||||
@OnEvent(events.reports.onProfitLossSheetViewed)
|
@OnEvent(events.reports.onProfitLossSheetViewed)
|
||||||
handleTrackProfitLossSheetViewedEvent({ tenantId }: ReportsEvents) {
|
handleTrackProfitLossSheetViewedEvent({ tenantId }: ReportsEvents) {
|
||||||
this.posthog.trackEvent({
|
this.posthog.trackEvent({
|
||||||
distinctId: `tenant-${tenantId}`,
|
|
||||||
event: PROFIT_LOSS_SHEET_VIEWED,
|
event: PROFIT_LOSS_SHEET_VIEWED,
|
||||||
properties: {},
|
properties: {},
|
||||||
});
|
});
|
||||||
@@ -54,7 +51,6 @@ export class ReportsEventsTracker {
|
|||||||
@OnEvent(events.reports.onCashflowStatementViewed)
|
@OnEvent(events.reports.onCashflowStatementViewed)
|
||||||
handleTrackCashflowStatementViewedEvent({ tenantId }: ReportsEvents) {
|
handleTrackCashflowStatementViewedEvent({ tenantId }: ReportsEvents) {
|
||||||
this.posthog.trackEvent({
|
this.posthog.trackEvent({
|
||||||
distinctId: `tenant-${tenantId}`,
|
|
||||||
event: CASHFLOW_STATEMENT_VIEWED,
|
event: CASHFLOW_STATEMENT_VIEWED,
|
||||||
properties: {},
|
properties: {},
|
||||||
});
|
});
|
||||||
@@ -63,7 +59,6 @@ export class ReportsEventsTracker {
|
|||||||
@OnEvent(events.reports.onGeneralLedgerViewed)
|
@OnEvent(events.reports.onGeneralLedgerViewed)
|
||||||
handleTrackGeneralLedgerViewedEvent({ tenantId }: ReportsEvents) {
|
handleTrackGeneralLedgerViewedEvent({ tenantId }: ReportsEvents) {
|
||||||
this.posthog.trackEvent({
|
this.posthog.trackEvent({
|
||||||
distinctId: `tenant-${tenantId}`,
|
|
||||||
event: GENERAL_LEDGER_VIEWED,
|
event: GENERAL_LEDGER_VIEWED,
|
||||||
properties: {},
|
properties: {},
|
||||||
});
|
});
|
||||||
@@ -72,7 +67,6 @@ export class ReportsEventsTracker {
|
|||||||
@OnEvent(events.reports.onJournalViewed)
|
@OnEvent(events.reports.onJournalViewed)
|
||||||
handleTrackJournalViewedEvent({ tenantId }: ReportsEvents) {
|
handleTrackJournalViewedEvent({ tenantId }: ReportsEvents) {
|
||||||
this.posthog.trackEvent({
|
this.posthog.trackEvent({
|
||||||
distinctId: `tenant-${tenantId}`,
|
|
||||||
event: JOURNAL_VIEWED,
|
event: JOURNAL_VIEWED,
|
||||||
properties: {},
|
properties: {},
|
||||||
});
|
});
|
||||||
@@ -81,7 +75,6 @@ export class ReportsEventsTracker {
|
|||||||
@OnEvent(events.reports.onReceivableAgingViewed)
|
@OnEvent(events.reports.onReceivableAgingViewed)
|
||||||
handleTrackReceivableAgingViewedEvent({ tenantId }: ReportsEvents) {
|
handleTrackReceivableAgingViewedEvent({ tenantId }: ReportsEvents) {
|
||||||
this.posthog.trackEvent({
|
this.posthog.trackEvent({
|
||||||
distinctId: `tenant-${tenantId}`,
|
|
||||||
event: RECEIVABLE_AGING_VIEWED,
|
event: RECEIVABLE_AGING_VIEWED,
|
||||||
properties: {},
|
properties: {},
|
||||||
});
|
});
|
||||||
@@ -90,7 +83,6 @@ export class ReportsEventsTracker {
|
|||||||
@OnEvent(events.reports.onPayableAgingViewed)
|
@OnEvent(events.reports.onPayableAgingViewed)
|
||||||
handleTrackPayableAgingViewedEvent({ tenantId }: ReportsEvents) {
|
handleTrackPayableAgingViewedEvent({ tenantId }: ReportsEvents) {
|
||||||
this.posthog.trackEvent({
|
this.posthog.trackEvent({
|
||||||
distinctId: `tenant-${tenantId}`,
|
|
||||||
event: PAYABLE_AGING_VIEWED,
|
event: PAYABLE_AGING_VIEWED,
|
||||||
properties: {},
|
properties: {},
|
||||||
});
|
});
|
||||||
@@ -99,7 +91,6 @@ export class ReportsEventsTracker {
|
|||||||
@OnEvent(events.reports.onCustomerBalanceSummaryViewed)
|
@OnEvent(events.reports.onCustomerBalanceSummaryViewed)
|
||||||
handleTrackCustomerBalanceSummaryViewedEvent({ tenantId }: ReportsEvents) {
|
handleTrackCustomerBalanceSummaryViewedEvent({ tenantId }: ReportsEvents) {
|
||||||
this.posthog.trackEvent({
|
this.posthog.trackEvent({
|
||||||
distinctId: `tenant-${tenantId}`,
|
|
||||||
event: CUSTOMER_BALANCE_SUMMARY_VIEWED,
|
event: CUSTOMER_BALANCE_SUMMARY_VIEWED,
|
||||||
properties: {},
|
properties: {},
|
||||||
});
|
});
|
||||||
@@ -108,7 +99,6 @@ export class ReportsEventsTracker {
|
|||||||
@OnEvent(events.reports.onVendorBalanceSummaryViewed)
|
@OnEvent(events.reports.onVendorBalanceSummaryViewed)
|
||||||
handleTrackVendorBalanceSummaryViewedEvent({ tenantId }: ReportsEvents) {
|
handleTrackVendorBalanceSummaryViewedEvent({ tenantId }: ReportsEvents) {
|
||||||
this.posthog.trackEvent({
|
this.posthog.trackEvent({
|
||||||
distinctId: `tenant-${tenantId}`,
|
|
||||||
event: VENDOR_BALANCE_SUMMARY_VIEWED,
|
event: VENDOR_BALANCE_SUMMARY_VIEWED,
|
||||||
properties: {},
|
properties: {},
|
||||||
});
|
});
|
||||||
@@ -117,7 +107,6 @@ export class ReportsEventsTracker {
|
|||||||
@OnEvent(events.reports.onInventoryValuationViewed)
|
@OnEvent(events.reports.onInventoryValuationViewed)
|
||||||
handleTrackInventoryValuationViewedEvent({ tenantId }: ReportsEvents) {
|
handleTrackInventoryValuationViewedEvent({ tenantId }: ReportsEvents) {
|
||||||
this.posthog.trackEvent({
|
this.posthog.trackEvent({
|
||||||
distinctId: `tenant-${tenantId}`,
|
|
||||||
event: INVENTORY_VALUATION_VIEWED,
|
event: INVENTORY_VALUATION_VIEWED,
|
||||||
properties: {},
|
properties: {},
|
||||||
});
|
});
|
||||||
@@ -126,7 +115,6 @@ export class ReportsEventsTracker {
|
|||||||
@OnEvent(events.reports.onCustomerTransactionsViewed)
|
@OnEvent(events.reports.onCustomerTransactionsViewed)
|
||||||
handleTrackCustomerTransactionsViewedEvent({ tenantId }: ReportsEvents) {
|
handleTrackCustomerTransactionsViewedEvent({ tenantId }: ReportsEvents) {
|
||||||
this.posthog.trackEvent({
|
this.posthog.trackEvent({
|
||||||
distinctId: `tenant-${tenantId}`,
|
|
||||||
event: CUSTOMER_TRANSACTIONS_VIEWED,
|
event: CUSTOMER_TRANSACTIONS_VIEWED,
|
||||||
properties: {},
|
properties: {},
|
||||||
});
|
});
|
||||||
@@ -135,7 +123,6 @@ export class ReportsEventsTracker {
|
|||||||
@OnEvent(events.reports.onVendorTransactionsViewed)
|
@OnEvent(events.reports.onVendorTransactionsViewed)
|
||||||
handleTrackVendorTransactionsViewedEvent({ tenantId }: ReportsEvents) {
|
handleTrackVendorTransactionsViewedEvent({ tenantId }: ReportsEvents) {
|
||||||
this.posthog.trackEvent({
|
this.posthog.trackEvent({
|
||||||
distinctId: `tenant-${tenantId}`,
|
|
||||||
event: VENDOR_TRANSACTIONS_VIEWED,
|
event: VENDOR_TRANSACTIONS_VIEWED,
|
||||||
properties: {},
|
properties: {},
|
||||||
});
|
});
|
||||||
@@ -144,7 +131,6 @@ export class ReportsEventsTracker {
|
|||||||
@OnEvent(events.reports.onSalesByItemViewed)
|
@OnEvent(events.reports.onSalesByItemViewed)
|
||||||
handleTrackSalesByItemViewedEvent({ tenantId }: ReportsEvents) {
|
handleTrackSalesByItemViewedEvent({ tenantId }: ReportsEvents) {
|
||||||
this.posthog.trackEvent({
|
this.posthog.trackEvent({
|
||||||
distinctId: `tenant-${tenantId}`,
|
|
||||||
event: SALES_BY_ITEM_VIEWED,
|
event: SALES_BY_ITEM_VIEWED,
|
||||||
properties: {},
|
properties: {},
|
||||||
});
|
});
|
||||||
@@ -153,7 +139,6 @@ export class ReportsEventsTracker {
|
|||||||
@OnEvent(events.reports.onPurchasesByItemViewed)
|
@OnEvent(events.reports.onPurchasesByItemViewed)
|
||||||
handleTrackPurchasesByItemViewedEvent({ tenantId }: ReportsEvents) {
|
handleTrackPurchasesByItemViewedEvent({ tenantId }: ReportsEvents) {
|
||||||
this.posthog.trackEvent({
|
this.posthog.trackEvent({
|
||||||
distinctId: `tenant-${tenantId}`,
|
|
||||||
event: PURCHASES_BY_ITEM_VIEWED,
|
event: PURCHASES_BY_ITEM_VIEWED,
|
||||||
properties: {},
|
properties: {},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ export class ExportController {
|
|||||||
@ApiOperation({ summary: 'Retrieves exported the given resource.' })
|
@ApiOperation({ summary: 'Retrieves exported the given resource.' })
|
||||||
async export(
|
async export(
|
||||||
@Query() query: ExportQuery,
|
@Query() query: ExportQuery,
|
||||||
@Res() res: Response,
|
@Res({ passthrough: true }) res: Response,
|
||||||
@Headers('accept') acceptHeader: string,
|
@Headers('accept') acceptHeader: string,
|
||||||
) {
|
) {
|
||||||
const applicationFormat = convertAcceptFormatToFormat(acceptHeader);
|
const applicationFormat = convertAcceptFormatToFormat(acceptHeader);
|
||||||
|
|||||||
@@ -14,14 +14,13 @@ export class APAgingSummaryController {
|
|||||||
@ApiOperation({ summary: 'Get payable aging summary' })
|
@ApiOperation({ summary: 'Get payable aging summary' })
|
||||||
public async get(
|
public async get(
|
||||||
@Query() filter: IAPAgingSummaryQuery,
|
@Query() filter: IAPAgingSummaryQuery,
|
||||||
@Res() res: Response,
|
@Res({ passthrough: true }) res: Response,
|
||||||
@Headers('accept') acceptHeader: string,
|
@Headers('accept') acceptHeader: string,
|
||||||
) {
|
) {
|
||||||
// Retrieves the json table format.
|
// Retrieves the json table format.
|
||||||
if (acceptHeader.includes(AcceptType.ApplicationJsonTable)) {
|
if (acceptHeader.includes(AcceptType.ApplicationJsonTable)) {
|
||||||
const table = await this.APAgingSummaryApp.table(filter);
|
return this.APAgingSummaryApp.table(filter);
|
||||||
|
|
||||||
res.status(200).send(table);
|
|
||||||
// Retrieves the csv format.
|
// Retrieves the csv format.
|
||||||
} else if (acceptHeader.includes(AcceptType.ApplicationCsv)) {
|
} else if (acceptHeader.includes(AcceptType.ApplicationCsv)) {
|
||||||
const csv = await this.APAgingSummaryApp.csv(filter);
|
const csv = await this.APAgingSummaryApp.csv(filter);
|
||||||
@@ -51,9 +50,7 @@ export class APAgingSummaryController {
|
|||||||
res.send(pdfContent);
|
res.send(pdfContent);
|
||||||
// Retrieves the json format.
|
// Retrieves the json format.
|
||||||
} else {
|
} else {
|
||||||
const sheet = await this.APAgingSummaryApp.sheet(filter);
|
return this.APAgingSummaryApp.sheet(filter);
|
||||||
|
|
||||||
res.status(200).send(sheet);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ export class ARAgingSummaryController {
|
|||||||
@ApiOperation({ summary: 'Get receivable aging summary' })
|
@ApiOperation({ summary: 'Get receivable aging summary' })
|
||||||
public async get(
|
public async get(
|
||||||
@Query() filter: IARAgingSummaryQuery,
|
@Query() filter: IARAgingSummaryQuery,
|
||||||
@Res() res: Response,
|
@Res({ passthrough: true }) res: Response,
|
||||||
@Headers('accept') acceptHeader: string,
|
@Headers('accept') acceptHeader: string,
|
||||||
) {
|
) {
|
||||||
// Retrieves the xlsx format.
|
// Retrieves the xlsx format.
|
||||||
@@ -30,9 +30,8 @@ export class ARAgingSummaryController {
|
|||||||
res.send(buffer);
|
res.send(buffer);
|
||||||
// Retrieves the table format.
|
// Retrieves the table format.
|
||||||
} else if (acceptHeader.includes(AcceptType.ApplicationJsonTable)) {
|
} else if (acceptHeader.includes(AcceptType.ApplicationJsonTable)) {
|
||||||
const table = await this.ARAgingSummaryApp.table(filter);
|
return this.ARAgingSummaryApp.table(filter);
|
||||||
|
|
||||||
res.status(200).send(table);
|
|
||||||
// Retrieves the csv format.
|
// Retrieves the csv format.
|
||||||
} else if (acceptHeader.includes(AcceptType.ApplicationCsv)) {
|
} else if (acceptHeader.includes(AcceptType.ApplicationCsv)) {
|
||||||
const buffer = await this.ARAgingSummaryApp.csv(filter);
|
const buffer = await this.ARAgingSummaryApp.csv(filter);
|
||||||
@@ -52,9 +51,7 @@ export class ARAgingSummaryController {
|
|||||||
res.send(pdfContent);
|
res.send(pdfContent);
|
||||||
// Retrieves the json format.
|
// Retrieves the json format.
|
||||||
} else {
|
} else {
|
||||||
const sheet = await this.ARAgingSummaryApp.sheet(filter);
|
return this.ARAgingSummaryApp.sheet(filter);
|
||||||
|
|
||||||
res.status(200).send(sheet);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,14 +21,14 @@ export class BalanceSheetStatementController {
|
|||||||
@ApiResponse({ status: 200, description: 'Balance sheet statement' })
|
@ApiResponse({ status: 200, description: 'Balance sheet statement' })
|
||||||
public async balanceSheet(
|
public async balanceSheet(
|
||||||
@Query() query: IBalanceSheetQuery,
|
@Query() query: IBalanceSheetQuery,
|
||||||
@Res() res: Response,
|
@Res({ passthrough: true }) res: Response,
|
||||||
@Headers('accept') acceptHeader: string,
|
@Headers('accept') acceptHeader: string,
|
||||||
) {
|
) {
|
||||||
// Retrieves the json table format.
|
// Retrieves the json table format.
|
||||||
if (acceptHeader.includes(AcceptType.ApplicationJsonTable)) {
|
if (acceptHeader.includes(AcceptType.ApplicationJsonTable)) {
|
||||||
const table = await this.balanceSheetApp.table(query);
|
const table = await this.balanceSheetApp.table(query);
|
||||||
|
|
||||||
res.status(200).send(table);
|
return table;
|
||||||
// Retrieves the csv format.
|
// Retrieves the csv format.
|
||||||
} else if (acceptHeader.includes(AcceptType.ApplicationCsv)) {
|
} else if (acceptHeader.includes(AcceptType.ApplicationCsv)) {
|
||||||
const buffer = await this.balanceSheetApp.csv(query);
|
const buffer = await this.balanceSheetApp.csv(query);
|
||||||
@@ -59,7 +59,7 @@ export class BalanceSheetStatementController {
|
|||||||
} else {
|
} else {
|
||||||
const sheet = await this.balanceSheetApp.sheet(query);
|
const sheet = await this.balanceSheetApp.sheet(query);
|
||||||
|
|
||||||
res.status(200).send(sheet);
|
return sheet;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
import * as R from 'ramda';
|
import * as R from 'ramda';
|
||||||
import { isEmpty } from 'lodash';
|
import { isEmpty } from 'lodash';
|
||||||
import moment from 'moment';
|
import * as moment from 'moment';
|
||||||
import { I18nService } from 'nestjs-i18n';
|
import { I18nService } from 'nestjs-i18n';
|
||||||
import {
|
import {
|
||||||
ICashFlowStatementSection,
|
ICashFlowStatementSection,
|
||||||
|
|||||||
@@ -15,14 +15,12 @@ export class CashflowController {
|
|||||||
@ApiOperation({ summary: 'Get cashflow statement report' })
|
@ApiOperation({ summary: 'Get cashflow statement report' })
|
||||||
async getCashflow(
|
async getCashflow(
|
||||||
@Query() query: ICashFlowStatementQuery,
|
@Query() query: ICashFlowStatementQuery,
|
||||||
@Res() res: Response,
|
@Res({ passthrough: true }) res: Response,
|
||||||
@Headers('accept') acceptHeader: string,
|
@Headers('accept') acceptHeader: string,
|
||||||
) {
|
) {
|
||||||
// Retrieves the json table format.
|
// Retrieves the json table format.
|
||||||
if (acceptHeader.includes(AcceptType.ApplicationJsonTable)) {
|
if (acceptHeader.includes(AcceptType.ApplicationJsonTable)) {
|
||||||
const table = await this.cashflowSheetApp.table(query);
|
return this.cashflowSheetApp.table(query);
|
||||||
|
|
||||||
res.status(200).send(table);
|
|
||||||
// Retrieves the csv format.
|
// Retrieves the csv format.
|
||||||
} else if (acceptHeader.includes(AcceptType.ApplicationCsv)) {
|
} else if (acceptHeader.includes(AcceptType.ApplicationCsv)) {
|
||||||
const buffer = await this.cashflowSheetApp.csv(query);
|
const buffer = await this.cashflowSheetApp.csv(query);
|
||||||
@@ -52,9 +50,7 @@ export class CashflowController {
|
|||||||
res.send(pdfContent);
|
res.send(pdfContent);
|
||||||
// Retrieves the json format.
|
// Retrieves the json format.
|
||||||
} else {
|
} else {
|
||||||
const cashflow = await this.cashflowSheetApp.sheet(query);
|
return this.cashflowSheetApp.sheet(query);
|
||||||
|
|
||||||
res.status(200).send(cashflow);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ export class CustomerBalanceSummaryController {
|
|||||||
@ApiOperation({ summary: 'Get customer balance summary report' })
|
@ApiOperation({ summary: 'Get customer balance summary report' })
|
||||||
async customerBalanceSummary(
|
async customerBalanceSummary(
|
||||||
@Query() filter: ICustomerBalanceSummaryQuery,
|
@Query() filter: ICustomerBalanceSummaryQuery,
|
||||||
@Res() res: Response,
|
@Res({ passthrough: true }) res: Response,
|
||||||
@Headers('accept') acceptHeader: string,
|
@Headers('accept') acceptHeader: string,
|
||||||
) {
|
) {
|
||||||
// Retrieves the xlsx format.
|
// Retrieves the xlsx format.
|
||||||
@@ -38,8 +38,8 @@ export class CustomerBalanceSummaryController {
|
|||||||
res.send(buffer);
|
res.send(buffer);
|
||||||
// Retrieves the json table format.
|
// Retrieves the json table format.
|
||||||
} else if (acceptHeader.includes(AcceptType.ApplicationJsonTable)) {
|
} else if (acceptHeader.includes(AcceptType.ApplicationJsonTable)) {
|
||||||
const table = await this.customerBalanceSummaryApp.table(filter);
|
return this.customerBalanceSummaryApp.table(filter);
|
||||||
res.status(200).send(table);
|
|
||||||
// Retrieves the pdf format.
|
// Retrieves the pdf format.
|
||||||
} else if (acceptHeader.includes(AcceptType.ApplicationPdf)) {
|
} else if (acceptHeader.includes(AcceptType.ApplicationPdf)) {
|
||||||
const buffer = await this.customerBalanceSummaryApp.pdf(filter);
|
const buffer = await this.customerBalanceSummaryApp.pdf(filter);
|
||||||
@@ -51,8 +51,7 @@ export class CustomerBalanceSummaryController {
|
|||||||
res.send(buffer);
|
res.send(buffer);
|
||||||
// Retrieves the json format.
|
// Retrieves the json format.
|
||||||
} else {
|
} else {
|
||||||
const sheet = await this.customerBalanceSummaryApp.sheet(filter);
|
return this.customerBalanceSummaryApp.sheet(filter);
|
||||||
res.status(200).send(sheet);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,14 +17,12 @@ export class GeneralLedgerController {
|
|||||||
@ApiOperation({ summary: 'Get general ledger report' })
|
@ApiOperation({ summary: 'Get general ledger report' })
|
||||||
public async getGeneralLedger(
|
public async getGeneralLedger(
|
||||||
@Query() query: IGeneralLedgerSheetQuery,
|
@Query() query: IGeneralLedgerSheetQuery,
|
||||||
@Res() res: Response,
|
@Res({ passthrough: true }) res: Response,
|
||||||
@Headers('accept') acceptHeader: string,
|
@Headers('accept') acceptHeader: string,
|
||||||
) {
|
) {
|
||||||
// Retrieves the table format.
|
// Retrieves the table format.
|
||||||
if (acceptHeader.includes(AcceptType.ApplicationJsonTable)) {
|
if (acceptHeader.includes(AcceptType.ApplicationJsonTable)) {
|
||||||
const table = await this.generalLedgerApplication.table(query);
|
return this.generalLedgerApplication.table(query);
|
||||||
|
|
||||||
res.status(200).send(table);
|
|
||||||
// Retrieves the csv format.
|
// Retrieves the csv format.
|
||||||
} else if (acceptHeader.includes(AcceptType.ApplicationCsv)) {
|
} else if (acceptHeader.includes(AcceptType.ApplicationCsv)) {
|
||||||
const buffer = await this.generalLedgerApplication.csv(query);
|
const buffer = await this.generalLedgerApplication.csv(query);
|
||||||
@@ -53,9 +51,7 @@ export class GeneralLedgerController {
|
|||||||
res.send(pdfContent);
|
res.send(pdfContent);
|
||||||
// Retrieves the json format.
|
// Retrieves the json format.
|
||||||
} else {
|
} else {
|
||||||
const sheet = await this.generalLedgerApplication.sheet(query);
|
return this.generalLedgerApplication.sheet(query);
|
||||||
|
|
||||||
res.status(200).send(sheet);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ export class InventoryItemDetailsController {
|
|||||||
@ApiOperation({ summary: 'Get inventory item details' })
|
@ApiOperation({ summary: 'Get inventory item details' })
|
||||||
async inventoryItemDetails(
|
async inventoryItemDetails(
|
||||||
@Query() query: IInventoryDetailsQuery,
|
@Query() query: IInventoryDetailsQuery,
|
||||||
@Res() res: Response,
|
@Res({ passthrough: true }) res: Response,
|
||||||
@Headers('accept') acceptHeader: string,
|
@Headers('accept') acceptHeader: string,
|
||||||
) {
|
) {
|
||||||
if (acceptHeader.includes(AcceptType.ApplicationCsv)) {
|
if (acceptHeader.includes(AcceptType.ApplicationCsv)) {
|
||||||
@@ -38,8 +38,7 @@ export class InventoryItemDetailsController {
|
|||||||
res.send(buffer);
|
res.send(buffer);
|
||||||
// Retrieves the json table format.
|
// Retrieves the json table format.
|
||||||
} else if (acceptHeader.includes(AcceptType.ApplicationJsonTable)) {
|
} else if (acceptHeader.includes(AcceptType.ApplicationJsonTable)) {
|
||||||
const table = await this.inventoryItemDetailsApp.table(query);
|
return this.inventoryItemDetailsApp.table(query);
|
||||||
res.status(200).send(table);
|
|
||||||
// Retrieves the pdf format.
|
// Retrieves the pdf format.
|
||||||
} else if (acceptHeader.includes(AcceptType.ApplicationPdf)) {
|
} else if (acceptHeader.includes(AcceptType.ApplicationPdf)) {
|
||||||
const buffer = await this.inventoryItemDetailsApp.pdf(query);
|
const buffer = await this.inventoryItemDetailsApp.pdf(query);
|
||||||
@@ -50,9 +49,7 @@ export class InventoryItemDetailsController {
|
|||||||
});
|
});
|
||||||
res.send(buffer);
|
res.send(buffer);
|
||||||
} else {
|
} else {
|
||||||
const sheet = await this.inventoryItemDetailsApp.sheet(query);
|
return this.inventoryItemDetailsApp.sheet(query);
|
||||||
|
|
||||||
res.status(200).send(sheet);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,14 +20,12 @@ export class InventoryValuationController {
|
|||||||
})
|
})
|
||||||
public async getInventoryValuationSheet(
|
public async getInventoryValuationSheet(
|
||||||
@Query() query: IInventoryValuationReportQuery,
|
@Query() query: IInventoryValuationReportQuery,
|
||||||
@Res() res: Response,
|
@Res({ passthrough: true }) res: Response,
|
||||||
@Headers('accept') acceptHeader: string,
|
@Headers('accept') acceptHeader: string,
|
||||||
) {
|
) {
|
||||||
// Retrieves the json table format.
|
// Retrieves the json table format.
|
||||||
if (acceptHeader.includes(AcceptType.ApplicationJsonTable)) {
|
if (acceptHeader.includes(AcceptType.ApplicationJsonTable)) {
|
||||||
const table = await this.inventoryValuationApp.table(query);
|
return this.inventoryValuationApp.table(query);
|
||||||
|
|
||||||
res.status(200).send(table);
|
|
||||||
// Retrieves the csv format.
|
// Retrieves the csv format.
|
||||||
} else if (acceptHeader.includes(AcceptType.ApplicationCsv)) {
|
} else if (acceptHeader.includes(AcceptType.ApplicationCsv)) {
|
||||||
const buffer = await this.inventoryValuationApp.csv(query);
|
const buffer = await this.inventoryValuationApp.csv(query);
|
||||||
@@ -57,9 +55,7 @@ export class InventoryValuationController {
|
|||||||
res.status(200).send(pdfContent);
|
res.status(200).send(pdfContent);
|
||||||
// Retrieves the json format.
|
// Retrieves the json format.
|
||||||
} else {
|
} else {
|
||||||
const sheet = await this.inventoryValuationApp.sheet(query);
|
return this.inventoryValuationApp.sheet(query);
|
||||||
|
|
||||||
res.status(200).send(sheet);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,13 +15,12 @@ export class JournalSheetController {
|
|||||||
@ApiOperation({ summary: 'Journal report' })
|
@ApiOperation({ summary: 'Journal report' })
|
||||||
async journalSheet(
|
async journalSheet(
|
||||||
@Query() query: IJournalReportQuery,
|
@Query() query: IJournalReportQuery,
|
||||||
@Res() res: Response,
|
@Res({ passthrough: true }) res: Response,
|
||||||
@Headers('accept') acceptHeader: string,
|
@Headers('accept') acceptHeader: string,
|
||||||
) {
|
) {
|
||||||
// Retrieves the json table format.
|
// Retrieves the json table format.
|
||||||
if (acceptHeader.includes(AcceptType.ApplicationJsonTable)) {
|
if (acceptHeader.includes(AcceptType.ApplicationJsonTable)) {
|
||||||
const table = await this.journalSheetApp.table(query);
|
return this.journalSheetApp.table(query);
|
||||||
res.status(200).send(table);
|
|
||||||
|
|
||||||
// Retrieves the csv format.
|
// Retrieves the csv format.
|
||||||
} else if (acceptHeader.includes(AcceptType.ApplicationCsv)) {
|
} else if (acceptHeader.includes(AcceptType.ApplicationCsv)) {
|
||||||
@@ -51,9 +50,7 @@ export class JournalSheetController {
|
|||||||
});
|
});
|
||||||
res.send(pdfContent);
|
res.send(pdfContent);
|
||||||
} else {
|
} else {
|
||||||
const sheet = await this.journalSheetApp.sheet(query);
|
return this.journalSheetApp.sheet(query);
|
||||||
|
|
||||||
res.status(200).send(sheet);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { I18nService } from 'nestjs-i18n';
|
import { I18nService } from 'nestjs-i18n';
|
||||||
import { sumBy, chain, get, head } from 'lodash';
|
import { sumBy, chain, get, head } from 'lodash';
|
||||||
import moment from 'moment';
|
import * as moment from 'moment';
|
||||||
import {
|
import {
|
||||||
IJournalReportEntriesGroup,
|
IJournalReportEntriesGroup,
|
||||||
IJournalReportQuery,
|
IJournalReportQuery,
|
||||||
@@ -9,17 +9,18 @@ import {
|
|||||||
} from './JournalSheet.types';
|
} from './JournalSheet.types';
|
||||||
import { FinancialSheet } from '../../common/FinancialSheet';
|
import { FinancialSheet } from '../../common/FinancialSheet';
|
||||||
import { JournalSheetRepository } from './JournalSheetRepository';
|
import { JournalSheetRepository } from './JournalSheetRepository';
|
||||||
import { Ledger } from '@/modules/Ledger/Ledger';
|
|
||||||
import { ILedgerEntry } from '@/modules/Ledger/types/Ledger.types';
|
import { ILedgerEntry } from '@/modules/Ledger/types/Ledger.types';
|
||||||
|
|
||||||
export class JournalSheet extends FinancialSheet {
|
export class JournalSheet extends FinancialSheet {
|
||||||
readonly ledger: Ledger;
|
|
||||||
readonly query: IJournalReportQuery;
|
readonly query: IJournalReportQuery;
|
||||||
readonly repository: JournalSheetRepository;
|
readonly repository: JournalSheetRepository;
|
||||||
readonly i18n: I18nService;
|
readonly i18n: I18nService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor method.
|
* Constructor method.
|
||||||
|
* @param {IJournalReportQuery} query -
|
||||||
|
* @param {JournalSheetRepository} repository -
|
||||||
|
* @param {I18nService} i18n -
|
||||||
*/
|
*/
|
||||||
constructor(
|
constructor(
|
||||||
query: IJournalReportQuery,
|
query: IJournalReportQuery,
|
||||||
@@ -130,6 +131,6 @@ export class JournalSheet extends FinancialSheet {
|
|||||||
* @return {IJournalReport}
|
* @return {IJournalReport}
|
||||||
*/
|
*/
|
||||||
reportData(): IJournalTableData {
|
reportData(): IJournalTableData {
|
||||||
return this.entriesWalker(this.ledger.entries);
|
return this.entriesWalker(this.repository.ledger.entries);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
|
import { Injectable } from '@nestjs/common';
|
||||||
import { JournalSheetService } from './JournalSheetService';
|
import { JournalSheetService } from './JournalSheetService';
|
||||||
import { JournalSheetTableInjectable } from './JournalSheetTableInjectable';
|
import { JournalSheetTableInjectable } from './JournalSheetTableInjectable';
|
||||||
import { JournalSheetExportInjectable } from './JournalSheetExport';
|
import { JournalSheetExportInjectable } from './JournalSheetExport';
|
||||||
import { JournalSheetPdfInjectable } from './JournalSheetPdfInjectable';
|
import { JournalSheetPdfInjectable } from './JournalSheetPdfInjectable';
|
||||||
import { IJournalReportQuery, IJournalTable } from './JournalSheet.types';
|
import { IJournalReportQuery, IJournalTable } from './JournalSheet.types';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
export class JournalSheetApplication {
|
export class JournalSheetApplication {
|
||||||
constructor(
|
constructor(
|
||||||
private readonly journalSheetTable: JournalSheetTableInjectable,
|
private readonly journalSheetTable: JournalSheetTableInjectable,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import moment from 'moment';
|
import * as moment from 'moment';
|
||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { FinancialSheetMeta } from '../../common/FinancialSheetMeta';
|
import { FinancialSheetMeta } from '../../common/FinancialSheetMeta';
|
||||||
import { IJournalReportQuery, IJournalSheetMeta } from './JournalSheet.types';
|
import { IJournalReportQuery, IJournalSheetMeta } from './JournalSheet.types';
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
|
import { Injectable } from '@nestjs/common';
|
||||||
|
import { I18nService } from 'nestjs-i18n';
|
||||||
import { JournalSheetService } from './JournalSheetService';
|
import { JournalSheetService } from './JournalSheetService';
|
||||||
import { IJournalReportQuery, IJournalTable } from './JournalSheet.types';
|
import { IJournalReportQuery, IJournalTable } from './JournalSheet.types';
|
||||||
import { JournalSheetTable } from './JournalSheetTable';
|
import { JournalSheetTable } from './JournalSheetTable';
|
||||||
import { I18nService } from 'nestjs-i18n';
|
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
export class JournalSheetTableInjectable {
|
export class JournalSheetTableInjectable {
|
||||||
constructor(
|
constructor(
|
||||||
private readonly journalSheetService: JournalSheetService,
|
private readonly journalSheetService: JournalSheetService,
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import * as moment from 'moment';
|
||||||
|
|
||||||
export const HtmlTableCustomCss = `
|
export const HtmlTableCustomCss = `
|
||||||
table tr.row-type--total td{
|
table tr.row-type--total td{
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export class ProfitLossSheetController {
|
|||||||
@ApiOperation({ summary: 'Get profit/loss statement report' })
|
@ApiOperation({ summary: 'Get profit/loss statement report' })
|
||||||
async profitLossSheet(
|
async profitLossSheet(
|
||||||
@Query() query: IProfitLossSheetQuery,
|
@Query() query: IProfitLossSheetQuery,
|
||||||
@Res() res: Response,
|
@Res({ passthrough: true }) res: Response,
|
||||||
@Headers('accept') acceptHeader: string,
|
@Headers('accept') acceptHeader: string,
|
||||||
) {
|
) {
|
||||||
// Retrieves the csv format.
|
// Retrieves the csv format.
|
||||||
@@ -36,9 +36,8 @@ export class ProfitLossSheetController {
|
|||||||
res.send(sheet);
|
res.send(sheet);
|
||||||
// Retrieves the json table format.
|
// Retrieves the json table format.
|
||||||
} else if (acceptHeader.includes(AcceptType.ApplicationJsonTable)) {
|
} else if (acceptHeader.includes(AcceptType.ApplicationJsonTable)) {
|
||||||
const table = await this.profitLossSheetApp.table(query);
|
return this.profitLossSheetApp.table(query);
|
||||||
|
|
||||||
res.status(200).send(table);
|
|
||||||
// Retrieves the xlsx format.
|
// Retrieves the xlsx format.
|
||||||
} else if (acceptHeader.includes(AcceptType.ApplicationXlsx)) {
|
} else if (acceptHeader.includes(AcceptType.ApplicationXlsx)) {
|
||||||
const sheet = await this.profitLossSheetApp.xlsx(query);
|
const sheet = await this.profitLossSheetApp.xlsx(query);
|
||||||
@@ -59,9 +58,7 @@ export class ProfitLossSheetController {
|
|||||||
});
|
});
|
||||||
res.send(pdfContent);
|
res.send(pdfContent);
|
||||||
} else {
|
} else {
|
||||||
const sheet = await this.profitLossSheetApp.sheet(query);
|
return this.profitLossSheetApp.sheet(query);
|
||||||
|
|
||||||
res.status(200).send(sheet);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
import * as R from 'ramda';
|
import * as R from 'ramda';
|
||||||
import moment from 'moment';
|
import * as moment from 'moment';
|
||||||
import { ITableColumn, ITableColumnAccessor } from '../../types/Table.types';
|
import { ITableColumn, ITableColumnAccessor } from '../../types/Table.types';
|
||||||
import { ProfitLossSheetTablePercentage } from './ProfitLossSheetTablePercentage';
|
import { ProfitLossSheetTablePercentage } from './ProfitLossSheetTablePercentage';
|
||||||
import { ProfitLossTablePreviousPeriod } from './ProfitLossTablePreviousPeriod';
|
import { ProfitLossTablePreviousPeriod } from './ProfitLossTablePreviousPeriod';
|
||||||
|
|||||||
@@ -17,14 +17,12 @@ export class PurchasesByItemReportController {
|
|||||||
@ApiOperation({ summary: 'Get purchases by items report' })
|
@ApiOperation({ summary: 'Get purchases by items report' })
|
||||||
async purchasesByItems(
|
async purchasesByItems(
|
||||||
@Query() filter: IPurchasesByItemsReportQuery,
|
@Query() filter: IPurchasesByItemsReportQuery,
|
||||||
@Res() res: Response,
|
@Res({ passthrough: true }) res: Response,
|
||||||
@Headers('accept') acceptHeader: string,
|
@Headers('accept') acceptHeader: string,
|
||||||
) {
|
) {
|
||||||
// JSON table response format.
|
// JSON table response format.
|
||||||
if (acceptHeader.includes(AcceptType.ApplicationJsonTable)) {
|
if (acceptHeader.includes(AcceptType.ApplicationJsonTable)) {
|
||||||
const table = await this.purchasesByItemsApp.table(filter);
|
return this.purchasesByItemsApp.table(filter);
|
||||||
|
|
||||||
res.status(200).send(table);
|
|
||||||
// CSV response format.
|
// CSV response format.
|
||||||
} else if (acceptHeader.includes(AcceptType.ApplicationCsv)) {
|
} else if (acceptHeader.includes(AcceptType.ApplicationCsv)) {
|
||||||
const buffer = await this.purchasesByItemsApp.csv(filter);
|
const buffer = await this.purchasesByItemsApp.csv(filter);
|
||||||
@@ -54,9 +52,7 @@ export class PurchasesByItemReportController {
|
|||||||
res.send(pdfContent);
|
res.send(pdfContent);
|
||||||
// Json response format.
|
// Json response format.
|
||||||
} else {
|
} else {
|
||||||
const sheet = await this.purchasesByItemsApp.sheet(filter);
|
return this.purchasesByItemsApp.sheet(filter);
|
||||||
|
|
||||||
res.status(200).send(sheet);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export class SalesByItemsController {
|
|||||||
@ApiOperation({ summary: 'Get sales by items report' })
|
@ApiOperation({ summary: 'Get sales by items report' })
|
||||||
public async salesByitems(
|
public async salesByitems(
|
||||||
@Query() filter: ISalesByItemsReportQuery,
|
@Query() filter: ISalesByItemsReportQuery,
|
||||||
@Res() res: Response,
|
@Res({ passthrough: true }) res: Response,
|
||||||
@Headers('accept') acceptHeader: string,
|
@Headers('accept') acceptHeader: string,
|
||||||
) {
|
) {
|
||||||
// Retrieves the csv format.
|
// Retrieves the csv format.
|
||||||
@@ -36,9 +36,7 @@ export class SalesByItemsController {
|
|||||||
res.send(buffer);
|
res.send(buffer);
|
||||||
// Retrieves the json table format.
|
// Retrieves the json table format.
|
||||||
} else if (acceptHeader.includes(AcceptType.ApplicationJsonTable)) {
|
} else if (acceptHeader.includes(AcceptType.ApplicationJsonTable)) {
|
||||||
const table = await this.salesByItemsApp.table(filter);
|
return this.salesByItemsApp.table(filter);
|
||||||
|
|
||||||
res.status(200).send(table);
|
|
||||||
// Retrieves the xlsx format.
|
// Retrieves the xlsx format.
|
||||||
} else if (acceptHeader.includes(AcceptType.ApplicationXlsx)) {
|
} else if (acceptHeader.includes(AcceptType.ApplicationXlsx)) {
|
||||||
const buffer = this.salesByItemsApp.xlsx(filter);
|
const buffer = this.salesByItemsApp.xlsx(filter);
|
||||||
@@ -59,8 +57,7 @@ export class SalesByItemsController {
|
|||||||
});
|
});
|
||||||
res.send(pdfContent);
|
res.send(pdfContent);
|
||||||
} else {
|
} else {
|
||||||
const sheet = await this.salesByItemsApp.sheet(filter);
|
return this.salesByItemsApp.sheet(filter);
|
||||||
res.status(200).send(sheet);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
|
import { Response } from 'express';
|
||||||
|
import { ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';
|
||||||
import { Controller, Get, Headers, Query, Res } from '@nestjs/common';
|
import { Controller, Get, Headers, Query, Res } from '@nestjs/common';
|
||||||
import { SalesTaxLiabilitySummaryQuery } from './SalesTaxLiability.types';
|
import { SalesTaxLiabilitySummaryQuery } from './SalesTaxLiability.types';
|
||||||
import { AcceptType } from '@/constants/accept-type';
|
import { AcceptType } from '@/constants/accept-type';
|
||||||
import { SalesTaxLiabilitySummaryApplication } from './SalesTaxLiabilitySummaryApplication';
|
import { SalesTaxLiabilitySummaryApplication } from './SalesTaxLiabilitySummaryApplication';
|
||||||
import { Response } from 'express';
|
|
||||||
import { ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';
|
|
||||||
|
|
||||||
@Controller('/reports/sales-tax-liability-summary')
|
@Controller('/reports/sales-tax-liability-summary')
|
||||||
@ApiTags('reports')
|
@ApiTags('reports')
|
||||||
@@ -20,16 +20,16 @@ export class SalesTaxLiabilitySummaryController {
|
|||||||
@ApiOperation({ summary: 'Get sales tax liability summary report' })
|
@ApiOperation({ summary: 'Get sales tax liability summary report' })
|
||||||
public async getSalesTaxLiabilitySummary(
|
public async getSalesTaxLiabilitySummary(
|
||||||
@Query() query: SalesTaxLiabilitySummaryQuery,
|
@Query() query: SalesTaxLiabilitySummaryQuery,
|
||||||
@Res() res: Response,
|
@Res({ passthrough: true }) res: Response,
|
||||||
@Headers('accept') acceptHeader: string,
|
@Headers('accept') acceptHeader: string,
|
||||||
) {
|
) {
|
||||||
// Retrieves the json table format.
|
// Retrieves the json table format.
|
||||||
if (acceptHeader.includes(AcceptType.ApplicationJsonTable)) {
|
if (acceptHeader.includes(AcceptType.ApplicationJsonTable)) {
|
||||||
const table = await this.salesTaxLiabilitySummaryApp.table(query);
|
return this.salesTaxLiabilitySummaryApp.table(query);
|
||||||
res.status(200).send(table);
|
|
||||||
// Retrieves the xlsx format.
|
// Retrieves the xlsx format.
|
||||||
} else if (acceptHeader.includes(AcceptType.ApplicationXlsx)) {
|
} else if (acceptHeader.includes(AcceptType.ApplicationXlsx)) {
|
||||||
const buffer = await this.salesTaxLiabilitySummaryApp.xlsx(query);
|
const buffer = await this.salesTaxLiabilitySummaryApp.xlsx(query);
|
||||||
|
|
||||||
res.setHeader('Content-Disposition', 'attachment; filename=output.xlsx');
|
res.setHeader('Content-Disposition', 'attachment; filename=output.xlsx');
|
||||||
res.setHeader(
|
res.setHeader(
|
||||||
'Content-Type',
|
'Content-Type',
|
||||||
@@ -52,8 +52,7 @@ export class SalesTaxLiabilitySummaryController {
|
|||||||
});
|
});
|
||||||
res.status(200).send(pdfContent);
|
res.status(200).send(pdfContent);
|
||||||
} else {
|
} else {
|
||||||
const sheet = await this.salesTaxLiabilitySummaryApp.sheet(query);
|
return this.salesTaxLiabilitySummaryApp.sheet(query);
|
||||||
res.status(200).send(sheet);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,13 +17,12 @@ export class TransactionsByCustomerController {
|
|||||||
@ApiResponse({ status: 200, description: 'Transactions by customer' })
|
@ApiResponse({ status: 200, description: 'Transactions by customer' })
|
||||||
async transactionsByCustomer(
|
async transactionsByCustomer(
|
||||||
@Query() filter: ITransactionsByCustomersFilter,
|
@Query() filter: ITransactionsByCustomersFilter,
|
||||||
@Res() res: Response,
|
@Res({ passthrough: true }) res: Response,
|
||||||
@Headers('accept') acceptHeader: string,
|
@Headers('accept') acceptHeader: string,
|
||||||
) {
|
) {
|
||||||
// Retrieves the json table format.
|
// Retrieves the json table format.
|
||||||
if (acceptHeader.includes(AcceptType.ApplicationJsonTable)) {
|
if (acceptHeader.includes(AcceptType.ApplicationJsonTable)) {
|
||||||
const table = await this.transactionsByCustomersApp.table(filter);
|
return this.transactionsByCustomersApp.table(filter);
|
||||||
res.status(200).send(table);
|
|
||||||
|
|
||||||
// Retrieve the csv format.
|
// Retrieve the csv format.
|
||||||
} else if (acceptHeader.includes(AcceptType.ApplicationCsv)) {
|
} else if (acceptHeader.includes(AcceptType.ApplicationCsv)) {
|
||||||
@@ -53,8 +52,7 @@ export class TransactionsByCustomerController {
|
|||||||
});
|
});
|
||||||
res.send(pdfContent);
|
res.send(pdfContent);
|
||||||
} else {
|
} else {
|
||||||
const sheet = await this.transactionsByCustomersApp.sheet(filter);
|
return this.transactionsByCustomersApp.sheet(filter);
|
||||||
res.status(200).send(sheet);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ export class TransactionsByVendorController {
|
|||||||
@ApiResponse({ status: 200, description: 'Transactions by vendor' })
|
@ApiResponse({ status: 200, description: 'Transactions by vendor' })
|
||||||
async transactionsByVendor(
|
async transactionsByVendor(
|
||||||
@Query() filter: ITransactionsByVendorsFilter,
|
@Query() filter: ITransactionsByVendorsFilter,
|
||||||
@Res() res: Response,
|
@Res({ passthrough: true }) res: Response,
|
||||||
@Headers('accept') acceptHeader: string,
|
@Headers('accept') acceptHeader: string,
|
||||||
) {
|
) {
|
||||||
// Retrieves the xlsx format.
|
// Retrieves the xlsx format.
|
||||||
@@ -38,9 +38,7 @@ export class TransactionsByVendorController {
|
|||||||
res.send(buffer);
|
res.send(buffer);
|
||||||
// Retrieves the json table format.
|
// Retrieves the json table format.
|
||||||
} else if (acceptHeader.includes(AcceptType.ApplicationJsonTable)) {
|
} else if (acceptHeader.includes(AcceptType.ApplicationJsonTable)) {
|
||||||
const table = await this.transactionsByVendorsApp.table(filter);
|
return this.transactionsByVendorsApp.table(filter);
|
||||||
|
|
||||||
res.status(200).send(table);
|
|
||||||
// Retrieves the pdf format.
|
// Retrieves the pdf format.
|
||||||
} else if (acceptHeader.includes(AcceptType.ApplicationPdf)) {
|
} else if (acceptHeader.includes(AcceptType.ApplicationPdf)) {
|
||||||
const pdfContent = await this.transactionsByVendorsApp.pdf(filter);
|
const pdfContent = await this.transactionsByVendorsApp.pdf(filter);
|
||||||
@@ -51,8 +49,7 @@ export class TransactionsByVendorController {
|
|||||||
res.send(pdfContent);
|
res.send(pdfContent);
|
||||||
// Retrieves the json format.
|
// Retrieves the json format.
|
||||||
} else {
|
} else {
|
||||||
const sheet = await this.transactionsByVendorsApp.sheet(filter);
|
return this.transactionsByVendorsApp.sheet(filter);
|
||||||
res.status(200).send(sheet);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ export class TrialBalanceSheetController {
|
|||||||
@ApiResponse({ status: 200, description: 'Trial balance sheet' })
|
@ApiResponse({ status: 200, description: 'Trial balance sheet' })
|
||||||
async getTrialBalanceSheet(
|
async getTrialBalanceSheet(
|
||||||
@Query() query: ITrialBalanceSheetQuery,
|
@Query() query: ITrialBalanceSheetQuery,
|
||||||
@Res() res: Response,
|
@Res({ passthrough: true }) res: Response,
|
||||||
@Headers('accept') acceptHeader: string,
|
@Headers('accept') acceptHeader: string,
|
||||||
) {
|
) {
|
||||||
const filter = {
|
const filter = {
|
||||||
@@ -27,12 +27,11 @@ export class TrialBalanceSheetController {
|
|||||||
};
|
};
|
||||||
// Retrieves in json table format.
|
// Retrieves in json table format.
|
||||||
if (acceptHeader.includes(AcceptType.ApplicationJsonTable)) {
|
if (acceptHeader.includes(AcceptType.ApplicationJsonTable)) {
|
||||||
const { table, meta, query } =
|
return this.trialBalanceSheetApp.table(filter);
|
||||||
await this.trialBalanceSheetApp.table(filter);
|
|
||||||
res.status(200).send({ table, meta, query });
|
|
||||||
// Retrieves in xlsx format
|
// Retrieves in xlsx format
|
||||||
} else if (acceptHeader.includes(AcceptType.ApplicationXlsx)) {
|
} else if (acceptHeader.includes(AcceptType.ApplicationXlsx)) {
|
||||||
const buffer = await this.trialBalanceSheetApp.xlsx(filter);
|
const buffer = await this.trialBalanceSheetApp.xlsx(filter);
|
||||||
|
|
||||||
res.setHeader('Content-Disposition', 'attachment; filename=output.xlsx');
|
res.setHeader('Content-Disposition', 'attachment; filename=output.xlsx');
|
||||||
res.setHeader(
|
res.setHeader(
|
||||||
'Content-Type',
|
'Content-Type',
|
||||||
@@ -50,6 +49,7 @@ export class TrialBalanceSheetController {
|
|||||||
// Retrieves in pdf format.
|
// Retrieves in pdf format.
|
||||||
} else if (acceptHeader.includes(AcceptType.ApplicationPdf)) {
|
} else if (acceptHeader.includes(AcceptType.ApplicationPdf)) {
|
||||||
const pdfContent = await this.trialBalanceSheetApp.pdf(filter);
|
const pdfContent = await this.trialBalanceSheetApp.pdf(filter);
|
||||||
|
|
||||||
res.set({
|
res.set({
|
||||||
'Content-Type': 'application/pdf',
|
'Content-Type': 'application/pdf',
|
||||||
'Content-Length': pdfContent.length,
|
'Content-Length': pdfContent.length,
|
||||||
@@ -57,9 +57,7 @@ export class TrialBalanceSheetController {
|
|||||||
res.send(pdfContent);
|
res.send(pdfContent);
|
||||||
// Retrieves in json format.
|
// Retrieves in json format.
|
||||||
} else {
|
} else {
|
||||||
const { data, query, meta } =
|
return this.trialBalanceSheetApp.sheet(filter);
|
||||||
await this.trialBalanceSheetApp.sheet(filter);
|
|
||||||
res.status(200).send({ data, query, meta });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ export class VendorBalanceSummaryController {
|
|||||||
@ApiResponse({ status: 200, description: 'Vendor balance summary' })
|
@ApiResponse({ status: 200, description: 'Vendor balance summary' })
|
||||||
async vendorBalanceSummary(
|
async vendorBalanceSummary(
|
||||||
@Query() filter: IVendorBalanceSummaryQuery,
|
@Query() filter: IVendorBalanceSummaryQuery,
|
||||||
@Res() res: Response,
|
@Res({ passthrough: true }) res: Response,
|
||||||
@Headers('accept') acceptHeader: string,
|
@Headers('accept') acceptHeader: string,
|
||||||
) {
|
) {
|
||||||
// Retrieves the csv format.
|
// Retrieves the csv format.
|
||||||
@@ -38,9 +38,7 @@ export class VendorBalanceSummaryController {
|
|||||||
|
|
||||||
// Retrieves the json table format.
|
// Retrieves the json table format.
|
||||||
} else if (acceptHeader.includes(AcceptType.ApplicationJsonTable)) {
|
} else if (acceptHeader.includes(AcceptType.ApplicationJsonTable)) {
|
||||||
const table = await this.vendorBalanceSummaryApp.table(filter);
|
return this.vendorBalanceSummaryApp.table(filter);
|
||||||
|
|
||||||
res.status(200).send(table);
|
|
||||||
// Retrieves the pdf format.
|
// Retrieves the pdf format.
|
||||||
} else if (acceptHeader.includes(AcceptType.ApplicationPdf)) {
|
} else if (acceptHeader.includes(AcceptType.ApplicationPdf)) {
|
||||||
const pdfContent = await this.vendorBalanceSummaryApp.pdf(filter);
|
const pdfContent = await this.vendorBalanceSummaryApp.pdf(filter);
|
||||||
@@ -52,8 +50,7 @@ export class VendorBalanceSummaryController {
|
|||||||
res.send(pdfContent);
|
res.send(pdfContent);
|
||||||
// Retrieves the json format.
|
// Retrieves the json format.
|
||||||
} else {
|
} else {
|
||||||
const sheet = await this.vendorBalanceSummaryApp.sheet(filter);
|
return this.vendorBalanceSummaryApp.sheet(filter);
|
||||||
res.status(200).send(sheet);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import moment from 'moment';
|
import * as moment from 'moment';
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { TenantModelProxy } from '../System/models/TenantBaseModel';
|
import { TenantModelProxy } from '../System/models/TenantBaseModel';
|
||||||
import { SaleInvoice } from '../SaleInvoices/models/SaleInvoice';
|
import { SaleInvoice } from '../SaleInvoices/models/SaleInvoice';
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ export class RolesController {
|
|||||||
@Get()
|
@Get()
|
||||||
@ApiOperation({ summary: 'Get all roles' })
|
@ApiOperation({ summary: 'Get all roles' })
|
||||||
@ApiResponse({ status: HttpStatus.OK, description: 'List of all roles' })
|
@ApiResponse({ status: HttpStatus.OK, description: 'List of all roles' })
|
||||||
async getRoles(@Res() res: Response) {
|
async getRoles() {
|
||||||
const roles = await this.rolesApp.getRoles();
|
const roles = await this.rolesApp.getRoles();
|
||||||
|
|
||||||
return { roles };
|
return { roles };
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Mutex } from 'async-mutex';
|
import { Mutex } from 'async-mutex';
|
||||||
import { chain } from 'lodash';
|
import { chain } from 'lodash';
|
||||||
import moment from 'moment';
|
import * as moment from 'moment';
|
||||||
import { Knex } from 'knex';
|
import { Knex } from 'knex';
|
||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { UnitOfWork } from '../Tenancy/TenancyDB/UnitOfWork.service';
|
import { UnitOfWork } from '../Tenancy/TenancyDB/UnitOfWork.service';
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export function useJournalSheet(query, props) {
|
|||||||
[t.FINANCIAL_REPORT, t.JOURNAL, query],
|
[t.FINANCIAL_REPORT, t.JOURNAL, query],
|
||||||
{
|
{
|
||||||
method: 'get',
|
method: 'get',
|
||||||
url: '/financial_statements/journal',
|
url: '/reports/journal',
|
||||||
params: query,
|
params: query,
|
||||||
headers: {
|
headers: {
|
||||||
Accept: 'application/json+table',
|
Accept: 'application/json+table',
|
||||||
|
|||||||
Reference in New Issue
Block a user