Merge pull request #1019 from bigcapitalhq/feat/reports-openapi-response-dtos
feat(server): add OpenAPI response DTOs for financial reports
This commit is contained in:
@@ -11,12 +11,6 @@ export class BankAccountsController {
|
|||||||
|
|
||||||
@Get()
|
@Get()
|
||||||
@ApiOperation({ summary: 'Retrieve the bank accounts.' })
|
@ApiOperation({ summary: 'Retrieve the bank accounts.' })
|
||||||
@ApiQuery({
|
|
||||||
name: 'query',
|
|
||||||
description: 'Query parameters for the bank accounts list.',
|
|
||||||
type: BankAccountsQueryDto,
|
|
||||||
required: false,
|
|
||||||
})
|
|
||||||
@ApiResponse({
|
@ApiResponse({
|
||||||
status: 200,
|
status: 200,
|
||||||
description: 'List of bank accounts retrieved successfully.',
|
description: 'List of bank accounts retrieved successfully.',
|
||||||
|
|||||||
@@ -0,0 +1,103 @@
|
|||||||
|
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||||
|
|
||||||
|
// ============== Common DTOs ==============
|
||||||
|
|
||||||
|
export class FinancialReportTotalDto {
|
||||||
|
@ApiProperty({ description: 'Numeric amount', type: Number })
|
||||||
|
amount: number;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Formatted amount string' })
|
||||||
|
formattedAmount: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Currency code' })
|
||||||
|
currencyCode: string;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Date associated with the total' })
|
||||||
|
date?: string | Date;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class FinancialReportPercentageDto {
|
||||||
|
@ApiProperty({ description: 'Percentage amount', type: Number })
|
||||||
|
amount: number;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Formatted percentage string' })
|
||||||
|
formattedAmount: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class FinancialReportMetaDto {
|
||||||
|
@ApiProperty({ description: 'Organization name' })
|
||||||
|
organizationName: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Base currency code' })
|
||||||
|
baseCurrency: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Date format string' })
|
||||||
|
dateFormat: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Whether cost computation is running' })
|
||||||
|
isCostComputeRunning: boolean;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Sheet name' })
|
||||||
|
sheetName: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============== Table DTOs ==============
|
||||||
|
|
||||||
|
export class FinancialTableCellDto {
|
||||||
|
@ApiProperty({ description: 'Cell key' })
|
||||||
|
key: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Cell value' })
|
||||||
|
value: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class FinancialTableRowDto {
|
||||||
|
@ApiProperty({ description: 'Cell data for this row', type: [FinancialTableCellDto] })
|
||||||
|
cells: FinancialTableCellDto[];
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Row type classifications', type: [String] })
|
||||||
|
rowTypes: string[];
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Row identifier' })
|
||||||
|
id: string | number;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Child rows', type: () => [FinancialTableRowDto] })
|
||||||
|
children?: FinancialTableRowDto[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export class FinancialTableColumnDto {
|
||||||
|
@ApiProperty({ description: 'Column key' })
|
||||||
|
key: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Column header label' })
|
||||||
|
label: string;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Cell position index', type: Number })
|
||||||
|
cellIndex?: number;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Nested column definitions', type: () => [FinancialTableColumnDto] })
|
||||||
|
children?: FinancialTableColumnDto[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export class FinancialTableDataDto {
|
||||||
|
@ApiProperty({ description: 'Table column definitions', type: [FinancialTableColumnDto] })
|
||||||
|
columns: FinancialTableColumnDto[];
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Table row data', type: [FinancialTableRowDto] })
|
||||||
|
rows: FinancialTableRowDto[];
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============== Base Report Response DTOs ==============
|
||||||
|
|
||||||
|
export class BaseFinancialReportResponseDto {
|
||||||
|
@ApiProperty({ description: 'Report metadata', type: FinancialReportMetaDto })
|
||||||
|
meta: FinancialReportMetaDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class BaseFinancialTableResponseDto {
|
||||||
|
@ApiProperty({ description: 'Table data structure', type: FinancialTableDataDto })
|
||||||
|
table: FinancialTableDataDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Report metadata', type: FinancialReportMetaDto })
|
||||||
|
meta: FinancialReportMetaDto;
|
||||||
|
}
|
||||||
+16
-1
@@ -3,13 +3,19 @@ import { Controller, Get, Headers, Query, Res, UseGuards } from '@nestjs/common'
|
|||||||
import { APAgingSummaryApplication } from './APAgingSummaryApplication';
|
import { APAgingSummaryApplication } from './APAgingSummaryApplication';
|
||||||
import { AcceptType } from '@/constants/accept-type';
|
import { AcceptType } from '@/constants/accept-type';
|
||||||
import {
|
import {
|
||||||
|
ApiExtraModels,
|
||||||
ApiOperation,
|
ApiOperation,
|
||||||
ApiProduces,
|
ApiProduces,
|
||||||
ApiResponse,
|
ApiResponse,
|
||||||
ApiTags,
|
ApiTags,
|
||||||
|
getSchemaPath,
|
||||||
} from '@nestjs/swagger';
|
} from '@nestjs/swagger';
|
||||||
import { APAgingSummaryQueryDto } from './APAgingSummaryQuery.dto';
|
import { APAgingSummaryQueryDto } from './APAgingSummaryQuery.dto';
|
||||||
import { APAgingSummaryResponseExample } from './APAgingSummary.swagger';
|
import { APAgingSummaryResponseExample } from './APAgingSummary.swagger';
|
||||||
|
import {
|
||||||
|
APAgingSummaryResponseDto,
|
||||||
|
APAgingSummaryTableResponseDto,
|
||||||
|
} from './APAgingSummaryResponse.dto';
|
||||||
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
|
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
|
||||||
import { RequirePermission } from '@/modules/Roles/RequirePermission.decorator';
|
import { RequirePermission } from '@/modules/Roles/RequirePermission.decorator';
|
||||||
import { PermissionGuard } from '@/modules/Roles/Permission.guard';
|
import { PermissionGuard } from '@/modules/Roles/Permission.guard';
|
||||||
@@ -21,6 +27,7 @@ import { ReportsAction } from '../../types/Report.types';
|
|||||||
@ApiTags('Reports')
|
@ApiTags('Reports')
|
||||||
@ApiCommonHeaders()
|
@ApiCommonHeaders()
|
||||||
@UseGuards(AuthorizationGuard, PermissionGuard)
|
@UseGuards(AuthorizationGuard, PermissionGuard)
|
||||||
|
@ApiExtraModels(APAgingSummaryResponseDto, APAgingSummaryTableResponseDto)
|
||||||
export class APAgingSummaryController {
|
export class APAgingSummaryController {
|
||||||
constructor(private readonly APAgingSummaryApp: APAgingSummaryApplication) { }
|
constructor(private readonly APAgingSummaryApp: APAgingSummaryApplication) { }
|
||||||
|
|
||||||
@@ -30,7 +37,15 @@ export class APAgingSummaryController {
|
|||||||
@ApiResponse({
|
@ApiResponse({
|
||||||
status: 200,
|
status: 200,
|
||||||
description: 'A/P aging summary response',
|
description: 'A/P aging summary response',
|
||||||
example: APAgingSummaryResponseExample,
|
content: {
|
||||||
|
[AcceptType.ApplicationJson]: {
|
||||||
|
schema: { $ref: getSchemaPath(APAgingSummaryResponseDto) },
|
||||||
|
example: APAgingSummaryResponseExample,
|
||||||
|
},
|
||||||
|
[AcceptType.ApplicationJsonTable]: {
|
||||||
|
schema: { $ref: getSchemaPath(APAgingSummaryTableResponseDto) },
|
||||||
|
},
|
||||||
|
},
|
||||||
})
|
})
|
||||||
@ApiProduces(
|
@ApiProduces(
|
||||||
AcceptType.ApplicationJson,
|
AcceptType.ApplicationJson,
|
||||||
|
|||||||
+109
@@ -0,0 +1,109 @@
|
|||||||
|
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||||
|
import { NumberFormatQueryDto } from '@/modules/BankingTransactions/dtos/NumberFormatQuery.dto';
|
||||||
|
import {
|
||||||
|
FinancialReportTotalDto,
|
||||||
|
FinancialReportMetaDto,
|
||||||
|
FinancialTableDataDto,
|
||||||
|
} from '../../dtos/FinancialReportResponse.dto';
|
||||||
|
|
||||||
|
export class APAgingPeriodDto {
|
||||||
|
@ApiProperty({ description: 'From period date' })
|
||||||
|
fromPeriod: string;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'To period date' })
|
||||||
|
toPeriod: string | null;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Before days', type: Number })
|
||||||
|
beforeDays: number;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'To days', type: Number })
|
||||||
|
toDays: number | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class APAgingPeriodTotalDto extends APAgingPeriodDto {
|
||||||
|
@ApiProperty({ description: 'Period total', type: FinancialReportTotalDto })
|
||||||
|
total: FinancialReportTotalDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class APAgingVendorDto {
|
||||||
|
@ApiProperty({ description: 'Vendor name' })
|
||||||
|
vendorName: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Current balance', type: FinancialReportTotalDto })
|
||||||
|
current: FinancialReportTotalDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Aging periods', type: [APAgingPeriodTotalDto] })
|
||||||
|
aging: APAgingPeriodTotalDto[];
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Vendor total', type: FinancialReportTotalDto })
|
||||||
|
total: FinancialReportTotalDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class APAgingSummaryDataDto {
|
||||||
|
@ApiProperty({ description: 'Vendors aging data', type: [APAgingVendorDto] })
|
||||||
|
vendors: APAgingVendorDto[];
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Current total', type: FinancialReportTotalDto })
|
||||||
|
current: FinancialReportTotalDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Aging totals', type: [APAgingPeriodTotalDto] })
|
||||||
|
aging: APAgingPeriodTotalDto[];
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Grand total', type: FinancialReportTotalDto })
|
||||||
|
total: FinancialReportTotalDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class APAgingSummaryMetaDto extends FinancialReportMetaDto {
|
||||||
|
@ApiProperty({ description: 'Formatted as-of date' })
|
||||||
|
formattedAsDate: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class APAgingSummaryQueryResponseDto {
|
||||||
|
@ApiProperty({ description: 'As-of date' })
|
||||||
|
asDate: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Aging days before', type: Number })
|
||||||
|
agingDaysBefore: number;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Number of aging periods', type: Number })
|
||||||
|
agingPeriods: number;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Number format settings', type: NumberFormatQueryDto })
|
||||||
|
numberFormat: NumberFormatQueryDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Vendor IDs to include', type: [Number] })
|
||||||
|
vendorsIds: number[];
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Branch IDs to include', type: [Number] })
|
||||||
|
branchesIds: number[];
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Exclude zero balance accounts' })
|
||||||
|
noneZero: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class APAgingSummaryResponseDto {
|
||||||
|
@ApiProperty({ description: 'Aging summary data', type: APAgingSummaryDataDto })
|
||||||
|
data: APAgingSummaryDataDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Report metadata', type: APAgingSummaryMetaDto })
|
||||||
|
meta: APAgingSummaryMetaDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Re-export table DTOs for convenience
|
||||||
|
export {
|
||||||
|
FinancialTableCellDto as APAgingSummaryTableCellDto,
|
||||||
|
FinancialTableRowDto as APAgingSummaryTableRowDto,
|
||||||
|
FinancialTableColumnDto as APAgingSummaryTableColumnDto,
|
||||||
|
FinancialTableDataDto as APAgingSummaryTableDataDto,
|
||||||
|
} from '../../dtos/FinancialReportResponse.dto';
|
||||||
|
|
||||||
|
export class APAgingSummaryTableResponseDto {
|
||||||
|
@ApiProperty({ description: 'Table data structure', type: () => FinancialTableDataDto })
|
||||||
|
table: FinancialTableDataDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Query parameters used to generate the report', type: APAgingSummaryQueryResponseDto })
|
||||||
|
query: APAgingSummaryQueryResponseDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Report metadata', type: APAgingSummaryMetaDto })
|
||||||
|
meta: APAgingSummaryMetaDto;
|
||||||
|
}
|
||||||
+16
-1
@@ -3,13 +3,19 @@ import { ARAgingSummaryApplication } from './ARAgingSummaryApplication';
|
|||||||
import { AcceptType } from '@/constants/accept-type';
|
import { AcceptType } from '@/constants/accept-type';
|
||||||
import { Response } from 'express';
|
import { Response } from 'express';
|
||||||
import {
|
import {
|
||||||
|
ApiExtraModels,
|
||||||
ApiOperation,
|
ApiOperation,
|
||||||
ApiProduces,
|
ApiProduces,
|
||||||
ApiResponse,
|
ApiResponse,
|
||||||
ApiTags,
|
ApiTags,
|
||||||
|
getSchemaPath,
|
||||||
} from '@nestjs/swagger';
|
} from '@nestjs/swagger';
|
||||||
import { ARAgingSummaryQueryDto } from './ARAgingSummaryQuery.dto';
|
import { ARAgingSummaryQueryDto } from './ARAgingSummaryQuery.dto';
|
||||||
import { ARAgingSummaryResponseExample } from './ARAgingSummary.swagger';
|
import { ARAgingSummaryResponseExample } from './ARAgingSummary.swagger';
|
||||||
|
import {
|
||||||
|
ARAgingSummaryResponseDto,
|
||||||
|
ARAgingSummaryTableResponseDto,
|
||||||
|
} from './ARAgingSummaryResponse.dto';
|
||||||
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
|
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
|
||||||
import { RequirePermission } from '@/modules/Roles/RequirePermission.decorator';
|
import { RequirePermission } from '@/modules/Roles/RequirePermission.decorator';
|
||||||
import { PermissionGuard } from '@/modules/Roles/Permission.guard';
|
import { PermissionGuard } from '@/modules/Roles/Permission.guard';
|
||||||
@@ -21,6 +27,7 @@ import { ReportsAction } from '../../types/Report.types';
|
|||||||
@ApiTags('Reports')
|
@ApiTags('Reports')
|
||||||
@ApiCommonHeaders()
|
@ApiCommonHeaders()
|
||||||
@UseGuards(AuthorizationGuard, PermissionGuard)
|
@UseGuards(AuthorizationGuard, PermissionGuard)
|
||||||
|
@ApiExtraModels(ARAgingSummaryResponseDto, ARAgingSummaryTableResponseDto)
|
||||||
export class ARAgingSummaryController {
|
export class ARAgingSummaryController {
|
||||||
constructor(private readonly ARAgingSummaryApp: ARAgingSummaryApplication) {}
|
constructor(private readonly ARAgingSummaryApp: ARAgingSummaryApplication) {}
|
||||||
|
|
||||||
@@ -30,7 +37,15 @@ export class ARAgingSummaryController {
|
|||||||
@ApiResponse({
|
@ApiResponse({
|
||||||
status: 200,
|
status: 200,
|
||||||
description: 'Receivable aging summary response',
|
description: 'Receivable aging summary response',
|
||||||
example: ARAgingSummaryResponseExample,
|
content: {
|
||||||
|
[AcceptType.ApplicationJson]: {
|
||||||
|
schema: { $ref: getSchemaPath(ARAgingSummaryResponseDto) },
|
||||||
|
example: ARAgingSummaryResponseExample,
|
||||||
|
},
|
||||||
|
[AcceptType.ApplicationJsonTable]: {
|
||||||
|
schema: { $ref: getSchemaPath(ARAgingSummaryTableResponseDto) },
|
||||||
|
},
|
||||||
|
},
|
||||||
})
|
})
|
||||||
@ApiProduces(
|
@ApiProduces(
|
||||||
AcceptType.ApplicationJson,
|
AcceptType.ApplicationJson,
|
||||||
|
|||||||
+115
@@ -0,0 +1,115 @@
|
|||||||
|
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||||
|
import { NumberFormatQueryDto } from '@/modules/BankingTransactions/dtos/NumberFormatQuery.dto';
|
||||||
|
import {
|
||||||
|
FinancialReportTotalDto,
|
||||||
|
FinancialReportMetaDto,
|
||||||
|
FinancialTableDataDto,
|
||||||
|
} from '../../dtos/FinancialReportResponse.dto';
|
||||||
|
|
||||||
|
export class ARAgingPeriodDto {
|
||||||
|
@ApiProperty({ description: 'From period date' })
|
||||||
|
fromPeriod: string;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'To period date' })
|
||||||
|
toPeriod: string | null;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Before days', type: Number })
|
||||||
|
beforeDays: number;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'To days', type: Number })
|
||||||
|
toDays: number | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class ARAgingPeriodTotalDto extends ARAgingPeriodDto {
|
||||||
|
@ApiProperty({ description: 'Period total', type: FinancialReportTotalDto })
|
||||||
|
total: FinancialReportTotalDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class ARAgingCustomerDto {
|
||||||
|
@ApiProperty({ description: 'Customer name' })
|
||||||
|
customerName: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Current balance', type: FinancialReportTotalDto })
|
||||||
|
current: FinancialReportTotalDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Aging periods', type: [ARAgingPeriodTotalDto] })
|
||||||
|
aging: ARAgingPeriodTotalDto[];
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Customer total', type: FinancialReportTotalDto })
|
||||||
|
total: FinancialReportTotalDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class ARAgingSummaryDataDto {
|
||||||
|
@ApiProperty({ description: 'Customers aging data', type: [ARAgingCustomerDto] })
|
||||||
|
customers: ARAgingCustomerDto[];
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Current total', type: FinancialReportTotalDto })
|
||||||
|
current: FinancialReportTotalDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Aging totals', type: [ARAgingPeriodTotalDto] })
|
||||||
|
aging: ARAgingPeriodTotalDto[];
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Grand total', type: FinancialReportTotalDto })
|
||||||
|
total: FinancialReportTotalDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class ARAgingSummaryMetaDto extends FinancialReportMetaDto {
|
||||||
|
@ApiProperty({ description: 'Formatted as-of date' })
|
||||||
|
formattedAsDate: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class ARAgingSummaryQueryResponseDto {
|
||||||
|
@ApiProperty({ description: 'As-of date' })
|
||||||
|
asDate: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Aging days before', type: Number })
|
||||||
|
agingDaysBefore: number;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Number of aging periods', type: Number })
|
||||||
|
agingPeriods: number;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Number format settings', type: NumberFormatQueryDto })
|
||||||
|
numberFormat: NumberFormatQueryDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Customer IDs to include', type: [Number] })
|
||||||
|
customersIds: number[];
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Branch IDs to include', type: [Number] })
|
||||||
|
branchesIds: number[];
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Exclude zero balance accounts' })
|
||||||
|
noneZero: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class ARAgingSummaryResponseDto {
|
||||||
|
@ApiProperty({ description: 'Query parameters used to generate the report', type: ARAgingSummaryQueryResponseDto })
|
||||||
|
query: ARAgingSummaryQueryResponseDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Aging columns definitions', type: [ARAgingPeriodDto] })
|
||||||
|
columns: ARAgingPeriodDto[];
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Aging summary data', type: ARAgingSummaryDataDto })
|
||||||
|
data: ARAgingSummaryDataDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Report metadata', type: ARAgingSummaryMetaDto })
|
||||||
|
meta: ARAgingSummaryMetaDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Re-export table DTOs for convenience
|
||||||
|
export {
|
||||||
|
FinancialTableCellDto as ARAgingSummaryTableCellDto,
|
||||||
|
FinancialTableRowDto as ARAgingSummaryTableRowDto,
|
||||||
|
FinancialTableColumnDto as ARAgingSummaryTableColumnDto,
|
||||||
|
FinancialTableDataDto as ARAgingSummaryTableDataDto,
|
||||||
|
} from '../../dtos/FinancialReportResponse.dto';
|
||||||
|
|
||||||
|
export class ARAgingSummaryTableResponseDto {
|
||||||
|
@ApiProperty({ description: 'Table data structure', type: () => FinancialTableDataDto })
|
||||||
|
table: FinancialTableDataDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Query parameters used to generate the report', type: ARAgingSummaryQueryResponseDto })
|
||||||
|
query: ARAgingSummaryQueryResponseDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Report metadata', type: ARAgingSummaryMetaDto })
|
||||||
|
meta: ARAgingSummaryMetaDto;
|
||||||
|
}
|
||||||
+21
-2
@@ -3,13 +3,22 @@ import { Controller, Get, Headers, Query, Res, UseGuards } from '@nestjs/common'
|
|||||||
import { AcceptType } from '@/constants/accept-type';
|
import { AcceptType } from '@/constants/accept-type';
|
||||||
import { BalanceSheetApplication } from './BalanceSheetApplication';
|
import { BalanceSheetApplication } from './BalanceSheetApplication';
|
||||||
import {
|
import {
|
||||||
|
ApiExtraModels,
|
||||||
ApiOperation,
|
ApiOperation,
|
||||||
ApiProduces,
|
ApiProduces,
|
||||||
ApiResponse,
|
ApiResponse,
|
||||||
ApiTags,
|
ApiTags,
|
||||||
|
getSchemaPath,
|
||||||
} from '@nestjs/swagger';
|
} from '@nestjs/swagger';
|
||||||
import { BalanceSheetQueryDto } from './BalanceSheet.dto';
|
import { BalanceSheetQueryDto } from './BalanceSheet.dto';
|
||||||
import { BalanceSheetResponseExample } from './BalanceSheet.swagger';
|
import {
|
||||||
|
BalanceSheetResponseExample,
|
||||||
|
BalanceSheetTableResponseExample,
|
||||||
|
} from './BalanceSheet.swagger';
|
||||||
|
import {
|
||||||
|
BalanceSheetResponseDto,
|
||||||
|
BalanceSheetTableResponseDto,
|
||||||
|
} from './BalanceSheetResponse.dto';
|
||||||
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
|
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
|
||||||
import { RequirePermission } from '@/modules/Roles/RequirePermission.decorator';
|
import { RequirePermission } from '@/modules/Roles/RequirePermission.decorator';
|
||||||
import { PermissionGuard } from '@/modules/Roles/Permission.guard';
|
import { PermissionGuard } from '@/modules/Roles/Permission.guard';
|
||||||
@@ -21,6 +30,7 @@ import { ReportsAction } from '../../types/Report.types';
|
|||||||
@ApiTags('Reports')
|
@ApiTags('Reports')
|
||||||
@ApiCommonHeaders()
|
@ApiCommonHeaders()
|
||||||
@UseGuards(AuthorizationGuard, PermissionGuard)
|
@UseGuards(AuthorizationGuard, PermissionGuard)
|
||||||
|
@ApiExtraModels(BalanceSheetResponseDto, BalanceSheetTableResponseDto)
|
||||||
export class BalanceSheetStatementController {
|
export class BalanceSheetStatementController {
|
||||||
constructor(private readonly balanceSheetApp: BalanceSheetApplication) {}
|
constructor(private readonly balanceSheetApp: BalanceSheetApplication) {}
|
||||||
|
|
||||||
@@ -36,7 +46,16 @@ export class BalanceSheetStatementController {
|
|||||||
@ApiResponse({
|
@ApiResponse({
|
||||||
status: 200,
|
status: 200,
|
||||||
description: 'Balance sheet statement',
|
description: 'Balance sheet statement',
|
||||||
example: BalanceSheetResponseExample,
|
content: {
|
||||||
|
[AcceptType.ApplicationJson]: {
|
||||||
|
schema: { $ref: getSchemaPath(BalanceSheetResponseDto) },
|
||||||
|
example: BalanceSheetResponseExample,
|
||||||
|
},
|
||||||
|
[AcceptType.ApplicationJsonTable]: {
|
||||||
|
schema: { $ref: getSchemaPath(BalanceSheetTableResponseDto) },
|
||||||
|
example: BalanceSheetTableResponseExample,
|
||||||
|
},
|
||||||
|
},
|
||||||
})
|
})
|
||||||
@ApiProduces(
|
@ApiProduces(
|
||||||
AcceptType.ApplicationJson,
|
AcceptType.ApplicationJson,
|
||||||
|
|||||||
+158
@@ -0,0 +1,158 @@
|
|||||||
|
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||||
|
import { NumberFormatQueryDto } from '@/modules/BankingTransactions/dtos/NumberFormatQuery.dto';
|
||||||
|
import {
|
||||||
|
FinancialReportTotalDto,
|
||||||
|
FinancialReportPercentageDto,
|
||||||
|
FinancialReportMetaDto,
|
||||||
|
FinancialTableDataDto,
|
||||||
|
} from '../../dtos/FinancialReportResponse.dto';
|
||||||
|
|
||||||
|
export class BalanceSheetDataNodeDto {
|
||||||
|
@ApiProperty({ description: 'Node identifier (string for aggregates, number for accounts)' })
|
||||||
|
id: string | number;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Account or category name' })
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
@ApiProperty({
|
||||||
|
description: 'Type of node',
|
||||||
|
enum: ['AGGREGATE', 'ACCOUNTS', 'ACCOUNT', 'NET_INCOME'],
|
||||||
|
})
|
||||||
|
nodeType: string;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Node type alias' })
|
||||||
|
type?: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Total amount information', type: FinancialReportTotalDto })
|
||||||
|
total: FinancialReportTotalDto;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Horizontal totals for date periods', type: [FinancialReportTotalDto] })
|
||||||
|
horizontalTotals?: FinancialReportTotalDto[];
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Percentage of row', type: FinancialReportPercentageDto })
|
||||||
|
percentageRow?: FinancialReportPercentageDto;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Percentage of column', type: FinancialReportPercentageDto })
|
||||||
|
percentageColumn?: FinancialReportPercentageDto;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Previous period total', type: FinancialReportTotalDto })
|
||||||
|
previousPeriod?: FinancialReportTotalDto;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Previous period change', type: FinancialReportTotalDto })
|
||||||
|
previousPeriodChange?: FinancialReportTotalDto;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Previous period percentage', type: FinancialReportPercentageDto })
|
||||||
|
previousPeriodPercentage?: FinancialReportPercentageDto;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Previous year total', type: FinancialReportTotalDto })
|
||||||
|
previousYear?: FinancialReportTotalDto;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Previous year change', type: FinancialReportTotalDto })
|
||||||
|
previousYearChange?: FinancialReportTotalDto;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Previous year percentage', type: FinancialReportPercentageDto })
|
||||||
|
previousYearPercentage?: FinancialReportPercentageDto;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Account code' })
|
||||||
|
code?: string;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Display index', type: Number })
|
||||||
|
index?: number;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Parent account ID', type: Number })
|
||||||
|
parentAccountId?: number;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Child nodes', type: () => [BalanceSheetDataNodeDto] })
|
||||||
|
children?: BalanceSheetDataNodeDto[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export class BalanceSheetMetaDto extends FinancialReportMetaDto {
|
||||||
|
@ApiProperty({ description: 'Formatted as-of date' })
|
||||||
|
formattedAsDate: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Formatted date range' })
|
||||||
|
formattedDateRange: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class BalanceSheetQueryResponseDto {
|
||||||
|
@ApiProperty({ description: 'Column display type', enum: ['total', 'date_periods'] })
|
||||||
|
displayColumnsType: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Column grouping', enum: ['day', 'month', 'year', 'quarter'] })
|
||||||
|
displayColumnsBy: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Start date' })
|
||||||
|
fromDate: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'End date' })
|
||||||
|
toDate: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Number format settings', type: NumberFormatQueryDto })
|
||||||
|
numberFormat: NumberFormatQueryDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Exclude zero balance accounts' })
|
||||||
|
noneZero: boolean;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Exclude accounts with no transactions' })
|
||||||
|
noneTransactions: boolean;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Accounting basis', enum: ['cash', 'accrual'] })
|
||||||
|
basis: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Account IDs to include', type: [Number] })
|
||||||
|
accountIds: number[];
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Show percentage of column' })
|
||||||
|
percentageOfColumn: boolean;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Show percentage of row' })
|
||||||
|
percentageOfRow: boolean;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Include previous period' })
|
||||||
|
previousPeriod: boolean;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Show previous period amount change' })
|
||||||
|
previousPeriodAmountChange: boolean;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Show previous period percentage change' })
|
||||||
|
previousPeriodPercentageChange: boolean;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Include previous year' })
|
||||||
|
previousYear: boolean;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Show previous year amount change' })
|
||||||
|
previousYearAmountChange: boolean;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Show previous year percentage change' })
|
||||||
|
previousYearPercentageChange: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class BalanceSheetResponseDto {
|
||||||
|
@ApiProperty({ description: 'Query parameters used to generate the report', type: BalanceSheetQueryResponseDto })
|
||||||
|
query: BalanceSheetQueryResponseDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Hierarchical balance sheet data', type: [BalanceSheetDataNodeDto] })
|
||||||
|
data: BalanceSheetDataNodeDto[];
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Report metadata', type: BalanceSheetMetaDto })
|
||||||
|
meta: BalanceSheetMetaDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Re-export table DTOs for convenience
|
||||||
|
export {
|
||||||
|
FinancialTableCellDto as BalanceSheetTableCellDto,
|
||||||
|
FinancialTableRowDto as BalanceSheetTableRowDto,
|
||||||
|
FinancialTableColumnDto as BalanceSheetTableColumnDto,
|
||||||
|
FinancialTableDataDto as BalanceSheetTableDataDto,
|
||||||
|
} from '../../dtos/FinancialReportResponse.dto';
|
||||||
|
|
||||||
|
export class BalanceSheetTableResponseDto {
|
||||||
|
@ApiProperty({ description: 'Table data structure', type: () => FinancialTableDataDto })
|
||||||
|
table: FinancialTableDataDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Query parameters used to generate the report', type: BalanceSheetQueryResponseDto })
|
||||||
|
query: BalanceSheetQueryResponseDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Report metadata', type: BalanceSheetMetaDto })
|
||||||
|
meta: BalanceSheetMetaDto;
|
||||||
|
}
|
||||||
+16
-1
@@ -3,13 +3,19 @@ import { Controller, Get, Headers, Query, Res, UseGuards } from '@nestjs/common'
|
|||||||
import { AcceptType } from '@/constants/accept-type';
|
import { AcceptType } from '@/constants/accept-type';
|
||||||
import { CashflowSheetApplication } from './CashflowSheetApplication';
|
import { CashflowSheetApplication } from './CashflowSheetApplication';
|
||||||
import {
|
import {
|
||||||
|
ApiExtraModels,
|
||||||
ApiOperation,
|
ApiOperation,
|
||||||
ApiProduces,
|
ApiProduces,
|
||||||
ApiResponse,
|
ApiResponse,
|
||||||
ApiTags,
|
ApiTags,
|
||||||
|
getSchemaPath,
|
||||||
} from '@nestjs/swagger';
|
} from '@nestjs/swagger';
|
||||||
import { CashFlowStatementQueryDto } from './CashFlowStatementQuery.dto';
|
import { CashFlowStatementQueryDto } from './CashFlowStatementQuery.dto';
|
||||||
import { CashflowStatementResponseExample } from './CashflowStatement.swagger';
|
import { CashflowStatementResponseExample } from './CashflowStatement.swagger';
|
||||||
|
import {
|
||||||
|
CashflowStatementResponseDto,
|
||||||
|
CashflowStatementTableResponseDto,
|
||||||
|
} from './CashflowStatementResponse.dto';
|
||||||
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
|
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
|
||||||
import { RequirePermission } from '@/modules/Roles/RequirePermission.decorator';
|
import { RequirePermission } from '@/modules/Roles/RequirePermission.decorator';
|
||||||
import { PermissionGuard } from '@/modules/Roles/Permission.guard';
|
import { PermissionGuard } from '@/modules/Roles/Permission.guard';
|
||||||
@@ -21,6 +27,7 @@ import { ReportsAction } from '../../types/Report.types';
|
|||||||
@ApiTags('Reports')
|
@ApiTags('Reports')
|
||||||
@ApiCommonHeaders()
|
@ApiCommonHeaders()
|
||||||
@UseGuards(AuthorizationGuard, PermissionGuard)
|
@UseGuards(AuthorizationGuard, PermissionGuard)
|
||||||
|
@ApiExtraModels(CashflowStatementResponseDto, CashflowStatementTableResponseDto)
|
||||||
export class CashflowController {
|
export class CashflowController {
|
||||||
constructor(private readonly cashflowSheetApp: CashflowSheetApplication) { }
|
constructor(private readonly cashflowSheetApp: CashflowSheetApplication) { }
|
||||||
|
|
||||||
@@ -29,7 +36,15 @@ export class CashflowController {
|
|||||||
@ApiResponse({
|
@ApiResponse({
|
||||||
status: 200,
|
status: 200,
|
||||||
description: 'Cashflow statement report',
|
description: 'Cashflow statement report',
|
||||||
example: CashflowStatementResponseExample,
|
content: {
|
||||||
|
[AcceptType.ApplicationJson]: {
|
||||||
|
schema: { $ref: getSchemaPath(CashflowStatementResponseDto) },
|
||||||
|
example: CashflowStatementResponseExample,
|
||||||
|
},
|
||||||
|
[AcceptType.ApplicationJsonTable]: {
|
||||||
|
schema: { $ref: getSchemaPath(CashflowStatementTableResponseDto) },
|
||||||
|
},
|
||||||
|
},
|
||||||
})
|
})
|
||||||
@ApiOperation({ summary: 'Get cashflow statement report' })
|
@ApiOperation({ summary: 'Get cashflow statement report' })
|
||||||
@ApiProduces(
|
@ApiProduces(
|
||||||
|
|||||||
+109
@@ -0,0 +1,109 @@
|
|||||||
|
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||||
|
import { NumberFormatQueryDto } from '@/modules/BankingTransactions/dtos/NumberFormatQuery.dto';
|
||||||
|
import {
|
||||||
|
FinancialReportTotalDto,
|
||||||
|
FinancialReportMetaDto,
|
||||||
|
FinancialTableDataDto,
|
||||||
|
} from '../../dtos/FinancialReportResponse.dto';
|
||||||
|
|
||||||
|
export class CashflowStatementDataNodeDto {
|
||||||
|
@ApiProperty({ description: 'Node identifier (string for aggregates, number for accounts)' })
|
||||||
|
id: string | number;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Account or category name' })
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
@ApiProperty({
|
||||||
|
description: 'Type of node',
|
||||||
|
enum: ['AGGREGATE', 'ACCOUNT', 'NET_INCOME', 'TOTAL'],
|
||||||
|
})
|
||||||
|
nodeType: string;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Node type alias' })
|
||||||
|
type?: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Total amount information', type: FinancialReportTotalDto })
|
||||||
|
total: FinancialReportTotalDto;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Horizontal totals for date periods', type: [FinancialReportTotalDto] })
|
||||||
|
horizontalTotals?: FinancialReportTotalDto[];
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Account code' })
|
||||||
|
code?: string;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Display index', type: Number })
|
||||||
|
index?: number;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Child nodes', type: () => [CashflowStatementDataNodeDto] })
|
||||||
|
children?: CashflowStatementDataNodeDto[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export class CashflowStatementMetaDto extends FinancialReportMetaDto {
|
||||||
|
@ApiProperty({ description: 'Formatted from date' })
|
||||||
|
formattedFromDate: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Formatted to date' })
|
||||||
|
formattedToDate: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Formatted date range' })
|
||||||
|
formattedDateRange: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class CashflowStatementQueryResponseDto {
|
||||||
|
@ApiProperty({ description: 'Column display type', enum: ['total', 'date_periods'] })
|
||||||
|
displayColumnsType: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Column grouping', enum: ['day', 'month', 'year', 'quarter'] })
|
||||||
|
displayColumnsBy: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Start date' })
|
||||||
|
fromDate: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'End date' })
|
||||||
|
toDate: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Number format settings', type: NumberFormatQueryDto })
|
||||||
|
numberFormat: NumberFormatQueryDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Exclude zero balance accounts' })
|
||||||
|
noneZero: boolean;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Exclude accounts with no transactions' })
|
||||||
|
noneTransactions: boolean;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Accounting basis', enum: ['cash', 'accrual'] })
|
||||||
|
basis: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Account IDs to include', type: [Number] })
|
||||||
|
accountIds: number[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export class CashflowStatementResponseDto {
|
||||||
|
@ApiProperty({ description: 'Query parameters used to generate the report', type: CashflowStatementQueryResponseDto })
|
||||||
|
query: CashflowStatementQueryResponseDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Hierarchical cashflow data', type: [CashflowStatementDataNodeDto] })
|
||||||
|
data: CashflowStatementDataNodeDto[];
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Report metadata', type: CashflowStatementMetaDto })
|
||||||
|
meta: CashflowStatementMetaDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Re-export table DTOs for convenience
|
||||||
|
export {
|
||||||
|
FinancialTableCellDto as CashflowStatementTableCellDto,
|
||||||
|
FinancialTableRowDto as CashflowStatementTableRowDto,
|
||||||
|
FinancialTableColumnDto as CashflowStatementTableColumnDto,
|
||||||
|
FinancialTableDataDto as CashflowStatementTableDataDto,
|
||||||
|
} from '../../dtos/FinancialReportResponse.dto';
|
||||||
|
|
||||||
|
export class CashflowStatementTableResponseDto {
|
||||||
|
@ApiProperty({ description: 'Table data structure', type: () => FinancialTableDataDto })
|
||||||
|
table: FinancialTableDataDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Query parameters used to generate the report', type: CashflowStatementQueryResponseDto })
|
||||||
|
query: CashflowStatementQueryResponseDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Report metadata', type: CashflowStatementMetaDto })
|
||||||
|
meta: CashflowStatementMetaDto;
|
||||||
|
}
|
||||||
+19
-1
@@ -1,26 +1,44 @@
|
|||||||
import { Response } from 'express';
|
import { Response } from 'express';
|
||||||
import {
|
import {
|
||||||
|
ApiExtraModels,
|
||||||
ApiOperation,
|
ApiOperation,
|
||||||
ApiProduces,
|
ApiProduces,
|
||||||
ApiResponse,
|
ApiResponse,
|
||||||
ApiTags,
|
ApiTags,
|
||||||
|
getSchemaPath,
|
||||||
} from '@nestjs/swagger';
|
} from '@nestjs/swagger';
|
||||||
import { Controller, Get, Headers, Query, Res } from '@nestjs/common';
|
import { Controller, Get, Headers, Query, Res } from '@nestjs/common';
|
||||||
import { CustomerBalanceSummaryApplication } from './CustomerBalanceSummaryApplication';
|
import { CustomerBalanceSummaryApplication } from './CustomerBalanceSummaryApplication';
|
||||||
import { CustomerBalanceSummaryQueryDto } from './CustomerBalanceSummaryQuery.dto';
|
import { CustomerBalanceSummaryQueryDto } from './CustomerBalanceSummaryQuery.dto';
|
||||||
import { AcceptType } from '@/constants/accept-type';
|
import { AcceptType } from '@/constants/accept-type';
|
||||||
|
import {
|
||||||
|
CustomerBalanceSummaryResponseDto,
|
||||||
|
CustomerBalanceSummaryTableResponseDto,
|
||||||
|
} from './CustomerBalanceSummaryResponse.dto';
|
||||||
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
|
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
|
||||||
|
|
||||||
@Controller('/reports/customer-balance-summary')
|
@Controller('/reports/customer-balance-summary')
|
||||||
@ApiTags('Reports')
|
@ApiTags('Reports')
|
||||||
@ApiCommonHeaders()
|
@ApiCommonHeaders()
|
||||||
|
@ApiExtraModels(CustomerBalanceSummaryResponseDto, CustomerBalanceSummaryTableResponseDto)
|
||||||
export class CustomerBalanceSummaryController {
|
export class CustomerBalanceSummaryController {
|
||||||
constructor(
|
constructor(
|
||||||
private readonly customerBalanceSummaryApp: CustomerBalanceSummaryApplication,
|
private readonly customerBalanceSummaryApp: CustomerBalanceSummaryApplication,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
@Get()
|
@Get()
|
||||||
@ApiResponse({ status: 200, description: 'Customer balance summary report' })
|
@ApiResponse({
|
||||||
|
status: 200,
|
||||||
|
description: 'Customer balance summary report',
|
||||||
|
content: {
|
||||||
|
[AcceptType.ApplicationJson]: {
|
||||||
|
schema: { $ref: getSchemaPath(CustomerBalanceSummaryResponseDto) },
|
||||||
|
},
|
||||||
|
[AcceptType.ApplicationJsonTable]: {
|
||||||
|
schema: { $ref: getSchemaPath(CustomerBalanceSummaryTableResponseDto) },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
@ApiOperation({ summary: 'Get customer balance summary report' })
|
@ApiOperation({ summary: 'Get customer balance summary report' })
|
||||||
@ApiProduces(
|
@ApiProduces(
|
||||||
AcceptType.ApplicationJson,
|
AcceptType.ApplicationJson,
|
||||||
|
|||||||
+82
@@ -0,0 +1,82 @@
|
|||||||
|
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||||
|
import { NumberFormatQueryDto } from '@/modules/BankingTransactions/dtos/NumberFormatQuery.dto';
|
||||||
|
import {
|
||||||
|
FinancialReportTotalDto,
|
||||||
|
FinancialReportMetaDto,
|
||||||
|
FinancialTableDataDto,
|
||||||
|
} from '../../dtos/FinancialReportResponse.dto';
|
||||||
|
|
||||||
|
export class CustomerBalanceDto {
|
||||||
|
@ApiProperty({ description: 'Customer ID', type: Number })
|
||||||
|
customerId: number;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Customer name' })
|
||||||
|
customerName: string;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Opening balance', type: FinancialReportTotalDto })
|
||||||
|
openingBalance?: FinancialReportTotalDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Closing balance', type: FinancialReportTotalDto })
|
||||||
|
closingBalance: FinancialReportTotalDto;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Total debit', type: FinancialReportTotalDto })
|
||||||
|
totalDebit?: FinancialReportTotalDto;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Total credit', type: FinancialReportTotalDto })
|
||||||
|
totalCredit?: FinancialReportTotalDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class CustomerBalanceSummaryMetaDto extends FinancialReportMetaDto {
|
||||||
|
@ApiProperty({ description: 'Formatted as-of date' })
|
||||||
|
formattedAsDate: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Formatted date range' })
|
||||||
|
formattedDateRange: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class CustomerBalanceSummaryQueryResponseDto {
|
||||||
|
@ApiProperty({ description: 'As-of date' })
|
||||||
|
asDate: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Number format settings', type: NumberFormatQueryDto })
|
||||||
|
numberFormat: NumberFormatQueryDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Customer IDs to include', type: [Number] })
|
||||||
|
customersIds: number[];
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Exclude zero balance customers' })
|
||||||
|
noneZero: boolean;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Exclude inactive customers' })
|
||||||
|
noneInactive: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class CustomerBalanceSummaryResponseDto {
|
||||||
|
@ApiProperty({ description: 'Query parameters used to generate the report', type: CustomerBalanceSummaryQueryResponseDto })
|
||||||
|
query: CustomerBalanceSummaryQueryResponseDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Customer balances', type: [CustomerBalanceDto] })
|
||||||
|
data: CustomerBalanceDto[];
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Report metadata', type: CustomerBalanceSummaryMetaDto })
|
||||||
|
meta: CustomerBalanceSummaryMetaDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Re-export table DTOs for convenience
|
||||||
|
export {
|
||||||
|
FinancialTableCellDto as CustomerBalanceSummaryTableCellDto,
|
||||||
|
FinancialTableRowDto as CustomerBalanceSummaryTableRowDto,
|
||||||
|
FinancialTableColumnDto as CustomerBalanceSummaryTableColumnDto,
|
||||||
|
FinancialTableDataDto as CustomerBalanceSummaryTableDataDto,
|
||||||
|
} from '../../dtos/FinancialReportResponse.dto';
|
||||||
|
|
||||||
|
export class CustomerBalanceSummaryTableResponseDto {
|
||||||
|
@ApiProperty({ description: 'Table data structure', type: () => FinancialTableDataDto })
|
||||||
|
table: FinancialTableDataDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Query parameters used to generate the report', type: CustomerBalanceSummaryQueryResponseDto })
|
||||||
|
query: CustomerBalanceSummaryQueryResponseDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Report metadata', type: CustomerBalanceSummaryMetaDto })
|
||||||
|
meta: CustomerBalanceSummaryMetaDto;
|
||||||
|
}
|
||||||
+16
-1
@@ -1,8 +1,10 @@
|
|||||||
import {
|
import {
|
||||||
|
ApiExtraModels,
|
||||||
ApiOperation,
|
ApiOperation,
|
||||||
ApiProduces,
|
ApiProduces,
|
||||||
ApiResponse,
|
ApiResponse,
|
||||||
ApiTags,
|
ApiTags,
|
||||||
|
getSchemaPath,
|
||||||
} from '@nestjs/swagger';
|
} from '@nestjs/swagger';
|
||||||
import { Response } from 'express';
|
import { Response } from 'express';
|
||||||
import { Controller, Get, Headers, Query, Res, UseGuards } from '@nestjs/common';
|
import { Controller, Get, Headers, Query, Res, UseGuards } from '@nestjs/common';
|
||||||
@@ -10,6 +12,10 @@ import { GeneralLedgerApplication } from './GeneralLedgerApplication';
|
|||||||
import { AcceptType } from '@/constants/accept-type';
|
import { AcceptType } from '@/constants/accept-type';
|
||||||
import { GeneralLedgerQueryDto } from './GeneralLedgerQuery.dto';
|
import { GeneralLedgerQueryDto } from './GeneralLedgerQuery.dto';
|
||||||
import { GeneralLedgerResponseExample } from './GeneralLedger.swagger';
|
import { GeneralLedgerResponseExample } from './GeneralLedger.swagger';
|
||||||
|
import {
|
||||||
|
GeneralLedgerResponseDto,
|
||||||
|
GeneralLedgerTableResponseDto,
|
||||||
|
} from './GeneralLedgerResponse.dto';
|
||||||
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
|
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
|
||||||
import { RequirePermission } from '@/modules/Roles/RequirePermission.decorator';
|
import { RequirePermission } from '@/modules/Roles/RequirePermission.decorator';
|
||||||
import { PermissionGuard } from '@/modules/Roles/Permission.guard';
|
import { PermissionGuard } from '@/modules/Roles/Permission.guard';
|
||||||
@@ -21,6 +27,7 @@ import { ReportsAction } from '../../types/Report.types';
|
|||||||
@ApiTags('Reports')
|
@ApiTags('Reports')
|
||||||
@ApiCommonHeaders()
|
@ApiCommonHeaders()
|
||||||
@UseGuards(AuthorizationGuard, PermissionGuard)
|
@UseGuards(AuthorizationGuard, PermissionGuard)
|
||||||
|
@ApiExtraModels(GeneralLedgerResponseDto, GeneralLedgerTableResponseDto)
|
||||||
export class GeneralLedgerController {
|
export class GeneralLedgerController {
|
||||||
constructor(
|
constructor(
|
||||||
private readonly generalLedgerApplication: GeneralLedgerApplication,
|
private readonly generalLedgerApplication: GeneralLedgerApplication,
|
||||||
@@ -31,7 +38,15 @@ export class GeneralLedgerController {
|
|||||||
@ApiResponse({
|
@ApiResponse({
|
||||||
status: 200,
|
status: 200,
|
||||||
description: 'General ledger report',
|
description: 'General ledger report',
|
||||||
example: GeneralLedgerResponseExample,
|
content: {
|
||||||
|
[AcceptType.ApplicationJson]: {
|
||||||
|
schema: { $ref: getSchemaPath(GeneralLedgerResponseDto) },
|
||||||
|
example: GeneralLedgerResponseExample,
|
||||||
|
},
|
||||||
|
[AcceptType.ApplicationJsonTable]: {
|
||||||
|
schema: { $ref: getSchemaPath(GeneralLedgerTableResponseDto) },
|
||||||
|
},
|
||||||
|
},
|
||||||
})
|
})
|
||||||
@ApiOperation({ summary: 'Get general ledger report' })
|
@ApiOperation({ summary: 'Get general ledger report' })
|
||||||
@ApiProduces(
|
@ApiProduces(
|
||||||
|
|||||||
+156
@@ -0,0 +1,156 @@
|
|||||||
|
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||||
|
import { NumberFormatQueryDto } from '@/modules/BankingTransactions/dtos/NumberFormatQuery.dto';
|
||||||
|
import {
|
||||||
|
FinancialReportTotalDto,
|
||||||
|
FinancialReportMetaDto,
|
||||||
|
FinancialTableDataDto,
|
||||||
|
} from '../../dtos/FinancialReportResponse.dto';
|
||||||
|
|
||||||
|
export class GeneralLedgerTransactionDto {
|
||||||
|
@ApiProperty({ description: 'Transaction date' })
|
||||||
|
date: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Formatted date' })
|
||||||
|
dateFormatted: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Reference type' })
|
||||||
|
referenceType: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Reference ID', type: Number })
|
||||||
|
referenceId: number;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Transaction number' })
|
||||||
|
transactionNumber: string | null;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Formatted transaction type' })
|
||||||
|
transactionTypeFormatted: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Contact name' })
|
||||||
|
contactName: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Contact type' })
|
||||||
|
contactType: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Transaction type' })
|
||||||
|
transactionType: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Transaction index', type: Number })
|
||||||
|
index: number;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Transaction note' })
|
||||||
|
note: string | null;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Credit amount', type: Number })
|
||||||
|
credit: number;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Debit amount', type: Number })
|
||||||
|
debit: number;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Transaction amount', type: Number })
|
||||||
|
amount: number;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Running balance', type: Number })
|
||||||
|
runningBalance: number;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Formatted amount' })
|
||||||
|
formattedAmount: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Formatted credit' })
|
||||||
|
formattedCredit: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Formatted debit' })
|
||||||
|
formattedDebit: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Formatted running balance' })
|
||||||
|
formattedRunningBalance: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Currency code' })
|
||||||
|
currencyCode: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class GeneralLedgerAccountDto {
|
||||||
|
@ApiProperty({ description: 'Account ID', type: Number })
|
||||||
|
id: number;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Account name' })
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Account code' })
|
||||||
|
code: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Account index', type: Number })
|
||||||
|
index: number;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Parent account ID', type: Number })
|
||||||
|
parentAccountId: number | null;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Opening balance', type: FinancialReportTotalDto })
|
||||||
|
openingBalance: FinancialReportTotalDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Account transactions', type: [GeneralLedgerTransactionDto] })
|
||||||
|
transactions: GeneralLedgerTransactionDto[];
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Closing balance', type: FinancialReportTotalDto })
|
||||||
|
closingBalance: FinancialReportTotalDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class GeneralLedgerMetaDto extends FinancialReportMetaDto {
|
||||||
|
@ApiProperty({ description: 'Formatted from date' })
|
||||||
|
formattedFromDate: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Formatted to date' })
|
||||||
|
formattedToDate: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Formatted date range' })
|
||||||
|
formattedDateRange: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class GeneralLedgerQueryResponseDto {
|
||||||
|
@ApiProperty({ description: 'Start date' })
|
||||||
|
fromDate: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'End date' })
|
||||||
|
toDate: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Accounting basis', enum: ['cash', 'accrual'] })
|
||||||
|
basis: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Number format settings', type: NumberFormatQueryDto })
|
||||||
|
numberFormat: NumberFormatQueryDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Exclude zero balance accounts' })
|
||||||
|
noneZero: boolean;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Account IDs to include', type: [Number] })
|
||||||
|
accountsIds: number[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export class GeneralLedgerResponseDto {
|
||||||
|
@ApiProperty({ description: 'Query parameters used to generate the report', type: GeneralLedgerQueryResponseDto })
|
||||||
|
query: GeneralLedgerQueryResponseDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'General ledger data', type: [GeneralLedgerAccountDto] })
|
||||||
|
data: GeneralLedgerAccountDto[];
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Report metadata', type: GeneralLedgerMetaDto })
|
||||||
|
meta: GeneralLedgerMetaDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Re-export table DTOs for convenience
|
||||||
|
export {
|
||||||
|
FinancialTableCellDto as GeneralLedgerTableCellDto,
|
||||||
|
FinancialTableRowDto as GeneralLedgerTableRowDto,
|
||||||
|
FinancialTableColumnDto as GeneralLedgerTableColumnDto,
|
||||||
|
FinancialTableDataDto as GeneralLedgerTableDataDto,
|
||||||
|
} from '../../dtos/FinancialReportResponse.dto';
|
||||||
|
|
||||||
|
export class GeneralLedgerTableResponseDto {
|
||||||
|
@ApiProperty({ description: 'Table data structure', type: () => FinancialTableDataDto })
|
||||||
|
table: FinancialTableDataDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Query parameters used to generate the report', type: GeneralLedgerQueryResponseDto })
|
||||||
|
query: GeneralLedgerQueryResponseDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Report metadata', type: GeneralLedgerMetaDto })
|
||||||
|
meta: GeneralLedgerMetaDto;
|
||||||
|
}
|
||||||
+25
-1
@@ -1,14 +1,19 @@
|
|||||||
import { Response } from 'express';
|
import { Response } from 'express';
|
||||||
import { ApiOperation, ApiTags } from '@nestjs/swagger';
|
import { ApiExtraModels, ApiOperation, ApiTags, ApiResponse, ApiProduces, getSchemaPath } from '@nestjs/swagger';
|
||||||
import { Controller, Get, Headers, Query, Res } from '@nestjs/common';
|
import { Controller, Get, Headers, Query, Res } from '@nestjs/common';
|
||||||
import { InventoryItemDetailsApplication } from './InventoryItemDetailsApplication';
|
import { InventoryItemDetailsApplication } from './InventoryItemDetailsApplication';
|
||||||
import { AcceptType } from '@/constants/accept-type';
|
import { AcceptType } from '@/constants/accept-type';
|
||||||
import { InventoryItemDetailsQueryDto } from './InventoryItemDetailsQuery.dto';
|
import { InventoryItemDetailsQueryDto } from './InventoryItemDetailsQuery.dto';
|
||||||
|
import {
|
||||||
|
InventoryItemDetailsResponseDto,
|
||||||
|
InventoryItemDetailsTableResponseDto,
|
||||||
|
} from './InventoryItemDetailsResponse.dto';
|
||||||
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
|
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
|
||||||
|
|
||||||
@Controller('reports/inventory-item-details')
|
@Controller('reports/inventory-item-details')
|
||||||
@ApiTags('Reports')
|
@ApiTags('Reports')
|
||||||
@ApiCommonHeaders()
|
@ApiCommonHeaders()
|
||||||
|
@ApiExtraModels(InventoryItemDetailsResponseDto, InventoryItemDetailsTableResponseDto)
|
||||||
export class InventoryItemDetailsController {
|
export class InventoryItemDetailsController {
|
||||||
constructor(
|
constructor(
|
||||||
private readonly inventoryItemDetailsApp: InventoryItemDetailsApplication,
|
private readonly inventoryItemDetailsApp: InventoryItemDetailsApplication,
|
||||||
@@ -16,6 +21,25 @@ export class InventoryItemDetailsController {
|
|||||||
|
|
||||||
@Get('/')
|
@Get('/')
|
||||||
@ApiOperation({ summary: 'Get inventory item details' })
|
@ApiOperation({ summary: 'Get inventory item details' })
|
||||||
|
@ApiResponse({
|
||||||
|
status: 200,
|
||||||
|
description: 'Inventory item details report',
|
||||||
|
content: {
|
||||||
|
[AcceptType.ApplicationJson]: {
|
||||||
|
schema: { $ref: getSchemaPath(InventoryItemDetailsResponseDto) },
|
||||||
|
},
|
||||||
|
[AcceptType.ApplicationJsonTable]: {
|
||||||
|
schema: { $ref: getSchemaPath(InventoryItemDetailsTableResponseDto) },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
@ApiProduces(
|
||||||
|
AcceptType.ApplicationJson,
|
||||||
|
AcceptType.ApplicationJsonTable,
|
||||||
|
AcceptType.ApplicationPdf,
|
||||||
|
AcceptType.ApplicationXlsx,
|
||||||
|
AcceptType.ApplicationCsv,
|
||||||
|
)
|
||||||
async inventoryItemDetails(
|
async inventoryItemDetails(
|
||||||
@Query() query: InventoryItemDetailsQueryDto,
|
@Query() query: InventoryItemDetailsQueryDto,
|
||||||
@Res({ passthrough: true }) res: Response,
|
@Res({ passthrough: true }) res: Response,
|
||||||
|
|||||||
+114
@@ -0,0 +1,114 @@
|
|||||||
|
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||||
|
import { NumberFormatQueryDto } from '@/modules/BankingTransactions/dtos/NumberFormatQuery.dto';
|
||||||
|
import {
|
||||||
|
FinancialReportTotalDto,
|
||||||
|
FinancialReportMetaDto,
|
||||||
|
FinancialTableDataDto,
|
||||||
|
} from '../../dtos/FinancialReportResponse.dto';
|
||||||
|
|
||||||
|
export class InventoryItemTransactionDto {
|
||||||
|
@ApiProperty({ description: 'Transaction date' })
|
||||||
|
date: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Formatted date' })
|
||||||
|
dateFormatted: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Transaction type' })
|
||||||
|
transactionType: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Reference ID', type: Number })
|
||||||
|
referenceId: number;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Transaction number' })
|
||||||
|
transactionNumber: string;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Transaction description' })
|
||||||
|
description?: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Quantity', type: Number })
|
||||||
|
quantity: number;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Rate', type: Number })
|
||||||
|
rate: number;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Total amount', type: FinancialReportTotalDto })
|
||||||
|
total: FinancialReportTotalDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Running quantity', type: Number })
|
||||||
|
runningQuantity: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class InventoryItemDetailDto {
|
||||||
|
@ApiProperty({ description: 'Item ID', type: Number })
|
||||||
|
id: number;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Item name' })
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Item code' })
|
||||||
|
code: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Opening quantity', type: Number })
|
||||||
|
openingQuantity: number;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Closing quantity', type: Number })
|
||||||
|
closingQuantity: number;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Item transactions', type: [InventoryItemTransactionDto] })
|
||||||
|
transactions: InventoryItemTransactionDto[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export class InventoryItemDetailsMetaDto extends FinancialReportMetaDto {
|
||||||
|
@ApiProperty({ description: 'Formatted from date' })
|
||||||
|
formattedFromDate: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Formatted to date' })
|
||||||
|
formattedToDate: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Formatted date range' })
|
||||||
|
formattedDateRange: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class InventoryItemDetailsQueryResponseDto {
|
||||||
|
@ApiProperty({ description: 'Start date' })
|
||||||
|
fromDate: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'End date' })
|
||||||
|
toDate: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Number format settings', type: NumberFormatQueryDto })
|
||||||
|
numberFormat: NumberFormatQueryDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Item IDs to include', type: [Number] })
|
||||||
|
itemsIds: number[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export class InventoryItemDetailsResponseDto {
|
||||||
|
@ApiProperty({ description: 'Query parameters used to generate the report', type: InventoryItemDetailsQueryResponseDto })
|
||||||
|
query: InventoryItemDetailsQueryResponseDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Inventory items with details', type: [InventoryItemDetailDto] })
|
||||||
|
data: InventoryItemDetailDto[];
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Report metadata', type: InventoryItemDetailsMetaDto })
|
||||||
|
meta: InventoryItemDetailsMetaDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Re-export table DTOs for convenience
|
||||||
|
export {
|
||||||
|
FinancialTableCellDto as InventoryItemDetailsTableCellDto,
|
||||||
|
FinancialTableRowDto as InventoryItemDetailsTableRowDto,
|
||||||
|
FinancialTableColumnDto as InventoryItemDetailsTableColumnDto,
|
||||||
|
FinancialTableDataDto as InventoryItemDetailsTableDataDto,
|
||||||
|
} from '../../dtos/FinancialReportResponse.dto';
|
||||||
|
|
||||||
|
export class InventoryItemDetailsTableResponseDto {
|
||||||
|
@ApiProperty({ description: 'Table data structure', type: () => FinancialTableDataDto })
|
||||||
|
table: FinancialTableDataDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Query parameters used to generate the report', type: InventoryItemDetailsQueryResponseDto })
|
||||||
|
query: InventoryItemDetailsQueryResponseDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Report metadata', type: InventoryItemDetailsMetaDto })
|
||||||
|
meta: InventoryItemDetailsMetaDto;
|
||||||
|
}
|
||||||
+15
@@ -1,19 +1,26 @@
|
|||||||
import { Response } from 'express';
|
import { Response } from 'express';
|
||||||
import {
|
import {
|
||||||
|
ApiExtraModels,
|
||||||
ApiOperation,
|
ApiOperation,
|
||||||
ApiProduces,
|
ApiProduces,
|
||||||
ApiResponse,
|
ApiResponse,
|
||||||
ApiTags,
|
ApiTags,
|
||||||
|
getSchemaPath,
|
||||||
} from '@nestjs/swagger';
|
} from '@nestjs/swagger';
|
||||||
import { Controller, Get, Headers, Query, Res } from '@nestjs/common';
|
import { Controller, Get, Headers, Query, Res } from '@nestjs/common';
|
||||||
import { InventoryValuationSheetApplication } from './InventoryValuationSheetApplication';
|
import { InventoryValuationSheetApplication } from './InventoryValuationSheetApplication';
|
||||||
import { InventoryValuationQueryDto } from './InventoryValuationQuery.dto';
|
import { InventoryValuationQueryDto } from './InventoryValuationQuery.dto';
|
||||||
import { AcceptType } from '@/constants/accept-type';
|
import { AcceptType } from '@/constants/accept-type';
|
||||||
|
import {
|
||||||
|
InventoryValuationResponseDto,
|
||||||
|
InventoryValuationTableResponseDto,
|
||||||
|
} from './InventoryValuationResponse.dto';
|
||||||
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
|
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
|
||||||
|
|
||||||
@Controller('reports/inventory-valuation')
|
@Controller('reports/inventory-valuation')
|
||||||
@ApiTags('Reports')
|
@ApiTags('Reports')
|
||||||
@ApiCommonHeaders()
|
@ApiCommonHeaders()
|
||||||
|
@ApiExtraModels(InventoryValuationResponseDto, InventoryValuationTableResponseDto)
|
||||||
export class InventoryValuationController {
|
export class InventoryValuationController {
|
||||||
constructor(
|
constructor(
|
||||||
private readonly inventoryValuationApp: InventoryValuationSheetApplication,
|
private readonly inventoryValuationApp: InventoryValuationSheetApplication,
|
||||||
@@ -24,6 +31,14 @@ export class InventoryValuationController {
|
|||||||
@ApiResponse({
|
@ApiResponse({
|
||||||
status: 200,
|
status: 200,
|
||||||
description: 'The inventory valuation sheet',
|
description: 'The inventory valuation sheet',
|
||||||
|
content: {
|
||||||
|
[AcceptType.ApplicationJson]: {
|
||||||
|
schema: { $ref: getSchemaPath(InventoryValuationResponseDto) },
|
||||||
|
},
|
||||||
|
[AcceptType.ApplicationJsonTable]: {
|
||||||
|
schema: { $ref: getSchemaPath(InventoryValuationTableResponseDto) },
|
||||||
|
},
|
||||||
|
},
|
||||||
})
|
})
|
||||||
@ApiProduces(
|
@ApiProduces(
|
||||||
AcceptType.ApplicationJson,
|
AcceptType.ApplicationJson,
|
||||||
|
|||||||
+88
@@ -0,0 +1,88 @@
|
|||||||
|
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||||
|
import { NumberFormatQueryDto } from '@/modules/BankingTransactions/dtos/NumberFormatQuery.dto';
|
||||||
|
import {
|
||||||
|
FinancialReportTotalDto,
|
||||||
|
FinancialReportMetaDto,
|
||||||
|
FinancialTableDataDto,
|
||||||
|
} from '../../dtos/FinancialReportResponse.dto';
|
||||||
|
|
||||||
|
export class InventoryValuationItemDto {
|
||||||
|
@ApiProperty({ description: 'Item ID', type: Number })
|
||||||
|
id: number;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Item name' })
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Item code' })
|
||||||
|
code: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Item type' })
|
||||||
|
type: string;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Quantity on hand', type: Number })
|
||||||
|
quantityOnHand?: number;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Average cost', type: Number })
|
||||||
|
averageCost?: number;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Total value', type: FinancialReportTotalDto })
|
||||||
|
totalValue?: FinancialReportTotalDto;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Asset account name' })
|
||||||
|
assetAccountName?: string;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Asset account code' })
|
||||||
|
assetAccountCode?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class InventoryValuationMetaDto extends FinancialReportMetaDto {
|
||||||
|
@ApiProperty({ description: 'Formatted as-of date' })
|
||||||
|
formattedAsDate: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Formatted date range' })
|
||||||
|
formattedDateRange: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class InventoryValuationQueryResponseDto {
|
||||||
|
@ApiProperty({ description: 'As-of date' })
|
||||||
|
asDate: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Number format settings', type: NumberFormatQueryDto })
|
||||||
|
numberFormat: NumberFormatQueryDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Item IDs to include', type: [Number] })
|
||||||
|
itemsIds: number[];
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Exclude zero quantity items' })
|
||||||
|
noneZero: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class InventoryValuationResponseDto {
|
||||||
|
@ApiProperty({ description: 'Query parameters used to generate the report', type: InventoryValuationQueryResponseDto })
|
||||||
|
query: InventoryValuationQueryResponseDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Inventory items valuation', type: [InventoryValuationItemDto] })
|
||||||
|
data: InventoryValuationItemDto[];
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Report metadata', type: InventoryValuationMetaDto })
|
||||||
|
meta: InventoryValuationMetaDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Re-export table DTOs for convenience
|
||||||
|
export {
|
||||||
|
FinancialTableCellDto as InventoryValuationTableCellDto,
|
||||||
|
FinancialTableRowDto as InventoryValuationTableRowDto,
|
||||||
|
FinancialTableColumnDto as InventoryValuationTableColumnDto,
|
||||||
|
FinancialTableDataDto as InventoryValuationTableDataDto,
|
||||||
|
} from '../../dtos/FinancialReportResponse.dto';
|
||||||
|
|
||||||
|
export class InventoryValuationTableResponseDto {
|
||||||
|
@ApiProperty({ description: 'Table data structure', type: () => FinancialTableDataDto })
|
||||||
|
table: FinancialTableDataDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Query parameters used to generate the report', type: InventoryValuationQueryResponseDto })
|
||||||
|
query: InventoryValuationQueryResponseDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Report metadata', type: InventoryValuationMetaDto })
|
||||||
|
meta: InventoryValuationMetaDto;
|
||||||
|
}
|
||||||
+16
-1
@@ -3,13 +3,19 @@ import { Response } from 'express';
|
|||||||
import { AcceptType } from '@/constants/accept-type';
|
import { AcceptType } from '@/constants/accept-type';
|
||||||
import { JournalSheetApplication } from './JournalSheetApplication';
|
import { JournalSheetApplication } from './JournalSheetApplication';
|
||||||
import {
|
import {
|
||||||
|
ApiExtraModels,
|
||||||
ApiOperation,
|
ApiOperation,
|
||||||
ApiProduces,
|
ApiProduces,
|
||||||
ApiResponse,
|
ApiResponse,
|
||||||
ApiTags,
|
ApiTags,
|
||||||
|
getSchemaPath,
|
||||||
} from '@nestjs/swagger';
|
} from '@nestjs/swagger';
|
||||||
import { JournalSheetQueryDto } from './JournalSheetQuery.dto';
|
import { JournalSheetQueryDto } from './JournalSheetQuery.dto';
|
||||||
import { JournalSheetResponseExample } from './JournalSheet.swagger';
|
import { JournalSheetResponseExample } from './JournalSheet.swagger';
|
||||||
|
import {
|
||||||
|
JournalSheetResponseDto,
|
||||||
|
JournalSheetTableResponseDto,
|
||||||
|
} from './JournalSheetResponse.dto';
|
||||||
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
|
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
|
||||||
import { RequirePermission } from '@/modules/Roles/RequirePermission.decorator';
|
import { RequirePermission } from '@/modules/Roles/RequirePermission.decorator';
|
||||||
import { PermissionGuard } from '@/modules/Roles/Permission.guard';
|
import { PermissionGuard } from '@/modules/Roles/Permission.guard';
|
||||||
@@ -21,6 +27,7 @@ import { ReportsAction } from '../../types/Report.types';
|
|||||||
@ApiTags('Reports')
|
@ApiTags('Reports')
|
||||||
@ApiCommonHeaders()
|
@ApiCommonHeaders()
|
||||||
@UseGuards(AuthorizationGuard, PermissionGuard)
|
@UseGuards(AuthorizationGuard, PermissionGuard)
|
||||||
|
@ApiExtraModels(JournalSheetResponseDto, JournalSheetTableResponseDto)
|
||||||
export class JournalSheetController {
|
export class JournalSheetController {
|
||||||
constructor(private readonly journalSheetApp: JournalSheetApplication) {}
|
constructor(private readonly journalSheetApp: JournalSheetApplication) {}
|
||||||
|
|
||||||
@@ -29,7 +36,15 @@ export class JournalSheetController {
|
|||||||
@ApiResponse({
|
@ApiResponse({
|
||||||
status: 200,
|
status: 200,
|
||||||
description: 'Journal report',
|
description: 'Journal report',
|
||||||
example: JournalSheetResponseExample,
|
content: {
|
||||||
|
[AcceptType.ApplicationJson]: {
|
||||||
|
schema: { $ref: getSchemaPath(JournalSheetResponseDto) },
|
||||||
|
example: JournalSheetResponseExample,
|
||||||
|
},
|
||||||
|
[AcceptType.ApplicationJsonTable]: {
|
||||||
|
schema: { $ref: getSchemaPath(JournalSheetTableResponseDto) },
|
||||||
|
},
|
||||||
|
},
|
||||||
})
|
})
|
||||||
@ApiOperation({ summary: 'Journal report' })
|
@ApiOperation({ summary: 'Journal report' })
|
||||||
@ApiProduces(
|
@ApiProduces(
|
||||||
|
|||||||
+137
@@ -0,0 +1,137 @@
|
|||||||
|
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||||
|
import {
|
||||||
|
FinancialReportTotalDto,
|
||||||
|
FinancialReportMetaDto,
|
||||||
|
FinancialTableDataDto,
|
||||||
|
} from '../../dtos/FinancialReportResponse.dto';
|
||||||
|
|
||||||
|
export class JournalEntryDto {
|
||||||
|
@ApiProperty({ description: 'Entry index', type: Number })
|
||||||
|
index: number;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Entry note' })
|
||||||
|
note: string | null;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Contact name' })
|
||||||
|
contactName?: string;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Contact type' })
|
||||||
|
contactType?: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Account name' })
|
||||||
|
accountName: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Account code' })
|
||||||
|
accountCode: string;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Transaction number' })
|
||||||
|
transactionNumber: string | null;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Formatted credit' })
|
||||||
|
formattedCredit: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Formatted debit' })
|
||||||
|
formattedDebit: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Credit amount', type: Number })
|
||||||
|
credit: number;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Debit amount', type: Number })
|
||||||
|
debit: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class JournalTransactionDto {
|
||||||
|
@ApiProperty({ description: 'Transaction date' })
|
||||||
|
date: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Formatted date' })
|
||||||
|
dateFormatted: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Transaction type' })
|
||||||
|
transactionType: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Reference ID', type: Number })
|
||||||
|
referenceId: number;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Formatted reference type' })
|
||||||
|
referenceTypeFormatted: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Journal entries', type: [JournalEntryDto] })
|
||||||
|
entries: JournalEntryDto[];
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Total credit', type: Number })
|
||||||
|
credit: number;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Total debit', type: Number })
|
||||||
|
debit: number;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Formatted total credit' })
|
||||||
|
formattedCredit: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Formatted total debit' })
|
||||||
|
formattedDebit: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class JournalSheetMetaDto extends FinancialReportMetaDto {
|
||||||
|
@ApiProperty({ description: 'Formatted from date' })
|
||||||
|
formattedFromDate: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Formatted to date' })
|
||||||
|
formattedToDate: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Formatted date range' })
|
||||||
|
formattedDateRange: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class JournalSheetQueryResponseDto {
|
||||||
|
@ApiProperty({ description: 'Start date' })
|
||||||
|
fromDate: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'End date' })
|
||||||
|
toDate: string;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'From range' })
|
||||||
|
fromRange: number | null;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'To range' })
|
||||||
|
toRange: number | null;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Account IDs to include', type: [Number] })
|
||||||
|
accountsIds: number[];
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Number format settings', type: Object })
|
||||||
|
numberFormat: {
|
||||||
|
noCents: boolean;
|
||||||
|
divideOn1000: boolean;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export class JournalSheetResponseDto {
|
||||||
|
@ApiProperty({ description: 'Query parameters used to generate the report', type: JournalSheetQueryResponseDto })
|
||||||
|
query: JournalSheetQueryResponseDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Journal transactions', type: [JournalTransactionDto] })
|
||||||
|
data: JournalTransactionDto[];
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Report metadata', type: JournalSheetMetaDto })
|
||||||
|
meta: JournalSheetMetaDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Re-export table DTOs for convenience
|
||||||
|
export {
|
||||||
|
FinancialTableCellDto as JournalSheetTableCellDto,
|
||||||
|
FinancialTableRowDto as JournalSheetTableRowDto,
|
||||||
|
FinancialTableColumnDto as JournalSheetTableColumnDto,
|
||||||
|
FinancialTableDataDto as JournalSheetTableDataDto,
|
||||||
|
} from '../../dtos/FinancialReportResponse.dto';
|
||||||
|
|
||||||
|
export class JournalSheetTableResponseDto {
|
||||||
|
@ApiProperty({ description: 'Table data structure', type: () => FinancialTableDataDto })
|
||||||
|
table: FinancialTableDataDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Query parameters used to generate the report', type: JournalSheetQueryResponseDto })
|
||||||
|
query: JournalSheetQueryResponseDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Report metadata', type: JournalSheetMetaDto })
|
||||||
|
meta: JournalSheetMetaDto;
|
||||||
|
}
|
||||||
+16
-1
@@ -3,13 +3,19 @@ import { Controller, Get, Headers, Query, Res, UseGuards } from '@nestjs/common'
|
|||||||
import { ProfitLossSheetApplication } from './ProfitLossSheetApplication';
|
import { ProfitLossSheetApplication } from './ProfitLossSheetApplication';
|
||||||
import { AcceptType } from '@/constants/accept-type';
|
import { AcceptType } from '@/constants/accept-type';
|
||||||
import {
|
import {
|
||||||
|
ApiExtraModels,
|
||||||
ApiOperation,
|
ApiOperation,
|
||||||
ApiProduces,
|
ApiProduces,
|
||||||
ApiResponse,
|
ApiResponse,
|
||||||
ApiTags,
|
ApiTags,
|
||||||
|
getSchemaPath,
|
||||||
} from '@nestjs/swagger';
|
} from '@nestjs/swagger';
|
||||||
import { ProfitLossSheetQueryDto } from './ProfitLossSheetQuery.dto';
|
import { ProfitLossSheetQueryDto } from './ProfitLossSheetQuery.dto';
|
||||||
import { ProfitLossSheetResponseExample } from './ProfitLossSheet.swagger';
|
import { ProfitLossSheetResponseExample } from './ProfitLossSheet.swagger';
|
||||||
|
import {
|
||||||
|
ProfitLossSheetResponseDto,
|
||||||
|
ProfitLossSheetTableResponseDto,
|
||||||
|
} from './ProfitLossSheetResponse.dto';
|
||||||
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
|
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
|
||||||
import { RequirePermission } from '@/modules/Roles/RequirePermission.decorator';
|
import { RequirePermission } from '@/modules/Roles/RequirePermission.decorator';
|
||||||
import { PermissionGuard } from '@/modules/Roles/Permission.guard';
|
import { PermissionGuard } from '@/modules/Roles/Permission.guard';
|
||||||
@@ -21,6 +27,7 @@ import { ReportsAction } from '../../types/Report.types';
|
|||||||
@ApiTags('Reports')
|
@ApiTags('Reports')
|
||||||
@ApiCommonHeaders()
|
@ApiCommonHeaders()
|
||||||
@UseGuards(AuthorizationGuard, PermissionGuard)
|
@UseGuards(AuthorizationGuard, PermissionGuard)
|
||||||
|
@ApiExtraModels(ProfitLossSheetResponseDto, ProfitLossSheetTableResponseDto)
|
||||||
export class ProfitLossSheetController {
|
export class ProfitLossSheetController {
|
||||||
constructor(
|
constructor(
|
||||||
private readonly profitLossSheetApp: ProfitLossSheetApplication,
|
private readonly profitLossSheetApp: ProfitLossSheetApplication,
|
||||||
@@ -37,7 +44,15 @@ export class ProfitLossSheetController {
|
|||||||
@ApiResponse({
|
@ApiResponse({
|
||||||
status: 200,
|
status: 200,
|
||||||
description: 'Profit & loss statement',
|
description: 'Profit & loss statement',
|
||||||
example: ProfitLossSheetResponseExample,
|
content: {
|
||||||
|
[AcceptType.ApplicationJson]: {
|
||||||
|
schema: { $ref: getSchemaPath(ProfitLossSheetResponseDto) },
|
||||||
|
example: ProfitLossSheetResponseExample,
|
||||||
|
},
|
||||||
|
[AcceptType.ApplicationJsonTable]: {
|
||||||
|
schema: { $ref: getSchemaPath(ProfitLossSheetTableResponseDto) },
|
||||||
|
},
|
||||||
|
},
|
||||||
})
|
})
|
||||||
@ApiOperation({ summary: 'Get profit/loss statement report' })
|
@ApiOperation({ summary: 'Get profit/loss statement report' })
|
||||||
@ApiProduces(
|
@ApiProduces(
|
||||||
|
|||||||
+170
@@ -0,0 +1,170 @@
|
|||||||
|
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||||
|
import { NumberFormatQueryDto } from '@/modules/BankingTransactions/dtos/NumberFormatQuery.dto';
|
||||||
|
import {
|
||||||
|
FinancialReportTotalDto,
|
||||||
|
FinancialReportPercentageDto,
|
||||||
|
FinancialReportMetaDto,
|
||||||
|
FinancialTableDataDto,
|
||||||
|
} from '../../dtos/FinancialReportResponse.dto';
|
||||||
|
|
||||||
|
export class ProfitLossSheetDataNodeDto {
|
||||||
|
@ApiProperty({ description: 'Node identifier (string for aggregates, number for accounts)' })
|
||||||
|
id: string | number;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Account or category name' })
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
@ApiProperty({
|
||||||
|
description: 'Type of node',
|
||||||
|
enum: ['ACCOUNTS', 'ACCOUNT', 'EQUATION', 'TOTAL'],
|
||||||
|
})
|
||||||
|
node_type: string;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Node type alias' })
|
||||||
|
type?: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Total amount information', type: FinancialReportTotalDto })
|
||||||
|
total: FinancialReportTotalDto;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Horizontal totals for date periods', type: [FinancialReportTotalDto] })
|
||||||
|
horizontal_totals?: FinancialReportTotalDto[];
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Percentage of income', type: FinancialReportPercentageDto })
|
||||||
|
percentage_income?: FinancialReportPercentageDto;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Percentage of expense', type: FinancialReportPercentageDto })
|
||||||
|
percentage_expense?: FinancialReportPercentageDto;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Percentage of row', type: FinancialReportPercentageDto })
|
||||||
|
percentage_row?: FinancialReportPercentageDto;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Percentage of column', type: FinancialReportPercentageDto })
|
||||||
|
percentage_column?: FinancialReportPercentageDto;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Previous period total', type: FinancialReportTotalDto })
|
||||||
|
previous_period?: FinancialReportTotalDto;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Previous period change', type: FinancialReportTotalDto })
|
||||||
|
previous_period_change?: FinancialReportTotalDto;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Previous period percentage', type: FinancialReportPercentageDto })
|
||||||
|
previous_period_percentage?: FinancialReportPercentageDto;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Previous year total', type: FinancialReportTotalDto })
|
||||||
|
previous_year?: FinancialReportTotalDto;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Previous year change', type: FinancialReportTotalDto })
|
||||||
|
previous_year_change?: FinancialReportTotalDto;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Previous year percentage', type: FinancialReportPercentageDto })
|
||||||
|
previous_year_percentage?: FinancialReportPercentageDto;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Account code' })
|
||||||
|
code?: string;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Display index', type: Number })
|
||||||
|
index?: number;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Child nodes', type: () => [ProfitLossSheetDataNodeDto] })
|
||||||
|
children?: ProfitLossSheetDataNodeDto[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export class ProfitLossSheetMetaDto extends FinancialReportMetaDto {
|
||||||
|
@ApiProperty({ description: 'Formatted from date' })
|
||||||
|
formatted_from_date: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Formatted to date' })
|
||||||
|
formatted_to_date: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Formatted date range' })
|
||||||
|
formatted_date_range: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class ProfitLossSheetQueryResponseDto {
|
||||||
|
@ApiProperty({ description: 'Column display type', enum: ['total', 'date_periods'] })
|
||||||
|
display_columns_type: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Column grouping', enum: ['day', 'month', 'year', 'quarter'] })
|
||||||
|
display_columns_by: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Start date' })
|
||||||
|
from_date: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'End date' })
|
||||||
|
to_date: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Number format settings', type: NumberFormatQueryDto })
|
||||||
|
number_format: NumberFormatQueryDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Exclude zero balance accounts' })
|
||||||
|
none_zero: boolean;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Exclude accounts with no transactions' })
|
||||||
|
none_transactions: boolean;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Accounting basis', enum: ['cash', 'accrual'] })
|
||||||
|
basis: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Account IDs to include', type: [Number] })
|
||||||
|
accounts_ids: number[];
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Show percentage of column' })
|
||||||
|
percentage_column: boolean;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Show percentage of row' })
|
||||||
|
percentage_row: boolean;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Show percentage of income' })
|
||||||
|
percentage_income: boolean;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Show percentage of expense' })
|
||||||
|
percentage_expense: boolean;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Include previous period' })
|
||||||
|
previous_period: boolean;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Show previous period amount change' })
|
||||||
|
previous_period_amount_change: boolean;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Show previous period percentage change' })
|
||||||
|
previous_period_percentage_change: boolean;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Include previous year' })
|
||||||
|
previous_year: boolean;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Show previous year amount change' })
|
||||||
|
previous_year_amount_change: boolean;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Show previous year percentage change' })
|
||||||
|
previous_year_percentage_change: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class ProfitLossSheetResponseDto {
|
||||||
|
@ApiProperty({ description: 'Query parameters used to generate the report', type: ProfitLossSheetQueryResponseDto })
|
||||||
|
query: ProfitLossSheetQueryResponseDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Hierarchical profit/loss data', type: [ProfitLossSheetDataNodeDto] })
|
||||||
|
data: ProfitLossSheetDataNodeDto[];
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Report metadata', type: ProfitLossSheetMetaDto })
|
||||||
|
meta: ProfitLossSheetMetaDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Re-export table DTOs for convenience
|
||||||
|
export {
|
||||||
|
FinancialTableCellDto as ProfitLossSheetTableCellDto,
|
||||||
|
FinancialTableRowDto as ProfitLossSheetTableRowDto,
|
||||||
|
FinancialTableColumnDto as ProfitLossSheetTableColumnDto,
|
||||||
|
FinancialTableDataDto as ProfitLossSheetTableDataDto,
|
||||||
|
} from '../../dtos/FinancialReportResponse.dto';
|
||||||
|
|
||||||
|
export class ProfitLossSheetTableResponseDto {
|
||||||
|
@ApiProperty({ description: 'Table data structure', type: () => FinancialTableDataDto })
|
||||||
|
table: FinancialTableDataDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Query parameters used to generate the report', type: ProfitLossSheetQueryResponseDto })
|
||||||
|
query: ProfitLossSheetQueryResponseDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Report metadata', type: ProfitLossSheetMetaDto })
|
||||||
|
meta: ProfitLossSheetMetaDto;
|
||||||
|
}
|
||||||
+18
-2
@@ -2,20 +2,36 @@ import { Response } from 'express';
|
|||||||
import { Controller, Get, Headers, Query, Res } from '@nestjs/common';
|
import { Controller, Get, Headers, Query, Res } from '@nestjs/common';
|
||||||
import { PurchasesByItemsApplication } from './PurchasesByItemsApplication';
|
import { PurchasesByItemsApplication } from './PurchasesByItemsApplication';
|
||||||
import { AcceptType } from '@/constants/accept-type';
|
import { AcceptType } from '@/constants/accept-type';
|
||||||
import { ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';
|
import { ApiExtraModels, ApiOperation, ApiResponse, ApiTags, getSchemaPath } from '@nestjs/swagger';
|
||||||
import { PurchasesByItemsQueryDto } from './PurchasesByItemsQuery.dto';
|
import { PurchasesByItemsQueryDto } from './PurchasesByItemsQuery.dto';
|
||||||
|
import {
|
||||||
|
PurchasesByItemsResponseDto,
|
||||||
|
PurchasesByItemsTableResponseDto,
|
||||||
|
} from './PurchasesByItemsResponse.dto';
|
||||||
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
|
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
|
||||||
|
|
||||||
@Controller('/reports/purchases-by-items')
|
@Controller('/reports/purchases-by-items')
|
||||||
@ApiTags('Reports')
|
@ApiTags('Reports')
|
||||||
@ApiCommonHeaders()
|
@ApiCommonHeaders()
|
||||||
|
@ApiExtraModels(PurchasesByItemsResponseDto, PurchasesByItemsTableResponseDto)
|
||||||
export class PurchasesByItemReportController {
|
export class PurchasesByItemReportController {
|
||||||
constructor(
|
constructor(
|
||||||
private readonly purchasesByItemsApp: PurchasesByItemsApplication,
|
private readonly purchasesByItemsApp: PurchasesByItemsApplication,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
@Get()
|
@Get()
|
||||||
@ApiResponse({ status: 200, description: 'Purchases by items report' })
|
@ApiResponse({
|
||||||
|
status: 200,
|
||||||
|
description: 'Purchases by items report',
|
||||||
|
content: {
|
||||||
|
[AcceptType.ApplicationJson]: {
|
||||||
|
schema: { $ref: getSchemaPath(PurchasesByItemsResponseDto) },
|
||||||
|
},
|
||||||
|
[AcceptType.ApplicationJsonTable]: {
|
||||||
|
schema: { $ref: getSchemaPath(PurchasesByItemsTableResponseDto) },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
@ApiOperation({ summary: 'Get purchases by items report' })
|
@ApiOperation({ summary: 'Get purchases by items report' })
|
||||||
async purchasesByItems(
|
async purchasesByItems(
|
||||||
@Query() filter: PurchasesByItemsQueryDto,
|
@Query() filter: PurchasesByItemsQueryDto,
|
||||||
|
|||||||
+88
@@ -0,0 +1,88 @@
|
|||||||
|
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||||
|
import { NumberFormatQueryDto } from '@/modules/BankingTransactions/dtos/NumberFormatQuery.dto';
|
||||||
|
import {
|
||||||
|
FinancialReportTotalDto,
|
||||||
|
FinancialReportMetaDto,
|
||||||
|
FinancialTableDataDto,
|
||||||
|
} from '../../dtos/FinancialReportResponse.dto';
|
||||||
|
|
||||||
|
export class PurchasesByItemDto {
|
||||||
|
@ApiProperty({ description: 'Item ID', type: Number })
|
||||||
|
id: number;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Item name' })
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Item code' })
|
||||||
|
code: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Item type' })
|
||||||
|
type: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Quantity purchased', type: Number })
|
||||||
|
quantity: number;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Total purchases amount', type: FinancialReportTotalDto })
|
||||||
|
total: FinancialReportTotalDto;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Average cost', type: Number })
|
||||||
|
averageCost?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class PurchasesByItemsMetaDto extends FinancialReportMetaDto {
|
||||||
|
@ApiProperty({ description: 'Formatted from date' })
|
||||||
|
formattedFromDate: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Formatted to date' })
|
||||||
|
formattedToDate: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Formatted date range' })
|
||||||
|
formattedDateRange: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class PurchasesByItemsQueryResponseDto {
|
||||||
|
@ApiProperty({ description: 'Start date' })
|
||||||
|
fromDate: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'End date' })
|
||||||
|
toDate: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Number format settings', type: NumberFormatQueryDto })
|
||||||
|
numberFormat: NumberFormatQueryDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Item IDs to include', type: [Number] })
|
||||||
|
itemsIds: number[];
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Vendor IDs to include', type: [Number] })
|
||||||
|
vendorsIds: number[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export class PurchasesByItemsResponseDto {
|
||||||
|
@ApiProperty({ description: 'Query parameters used to generate the report', type: PurchasesByItemsQueryResponseDto })
|
||||||
|
query: PurchasesByItemsQueryResponseDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Purchases by items', type: [PurchasesByItemDto] })
|
||||||
|
data: PurchasesByItemDto[];
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Report metadata', type: PurchasesByItemsMetaDto })
|
||||||
|
meta: PurchasesByItemsMetaDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Re-export table DTOs for convenience
|
||||||
|
export {
|
||||||
|
FinancialTableCellDto as PurchasesByItemsTableCellDto,
|
||||||
|
FinancialTableRowDto as PurchasesByItemsTableRowDto,
|
||||||
|
FinancialTableColumnDto as PurchasesByItemsTableColumnDto,
|
||||||
|
FinancialTableDataDto as PurchasesByItemsTableDataDto,
|
||||||
|
} from '../../dtos/FinancialReportResponse.dto';
|
||||||
|
|
||||||
|
export class PurchasesByItemsTableResponseDto {
|
||||||
|
@ApiProperty({ description: 'Table data structure', type: () => FinancialTableDataDto })
|
||||||
|
table: FinancialTableDataDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Query parameters used to generate the report', type: PurchasesByItemsQueryResponseDto })
|
||||||
|
query: PurchasesByItemsQueryResponseDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Report metadata', type: PurchasesByItemsMetaDto })
|
||||||
|
meta: PurchasesByItemsMetaDto;
|
||||||
|
}
|
||||||
+18
-2
@@ -10,18 +10,34 @@ import {
|
|||||||
import { AcceptType } from '@/constants/accept-type';
|
import { AcceptType } from '@/constants/accept-type';
|
||||||
import { SalesByItemsApplication } from './SalesByItemsApplication';
|
import { SalesByItemsApplication } from './SalesByItemsApplication';
|
||||||
import { Response } from 'express';
|
import { Response } from 'express';
|
||||||
import { ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';
|
import { ApiExtraModels, ApiOperation, ApiResponse, ApiTags, getSchemaPath } from '@nestjs/swagger';
|
||||||
import { SalesByItemsQueryDto } from './SalesByItemsQuery.dto';
|
import { SalesByItemsQueryDto } from './SalesByItemsQuery.dto';
|
||||||
|
import {
|
||||||
|
SalesByItemsResponseDto,
|
||||||
|
SalesByItemsTableResponseDto,
|
||||||
|
} from './SalesByItemsResponse.dto';
|
||||||
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
|
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
|
||||||
|
|
||||||
@Controller('/reports/sales-by-items')
|
@Controller('/reports/sales-by-items')
|
||||||
@ApiTags('Reports')
|
@ApiTags('Reports')
|
||||||
@ApiCommonHeaders()
|
@ApiCommonHeaders()
|
||||||
|
@ApiExtraModels(SalesByItemsResponseDto, SalesByItemsTableResponseDto)
|
||||||
export class SalesByItemsController {
|
export class SalesByItemsController {
|
||||||
constructor(private readonly salesByItemsApp: SalesByItemsApplication) {}
|
constructor(private readonly salesByItemsApp: SalesByItemsApplication) {}
|
||||||
|
|
||||||
@Get()
|
@Get()
|
||||||
@ApiResponse({ status: 200, description: 'Sales by items report' })
|
@ApiResponse({
|
||||||
|
status: 200,
|
||||||
|
description: 'Sales by items report',
|
||||||
|
content: {
|
||||||
|
[AcceptType.ApplicationJson]: {
|
||||||
|
schema: { $ref: getSchemaPath(SalesByItemsResponseDto) },
|
||||||
|
},
|
||||||
|
[AcceptType.ApplicationJsonTable]: {
|
||||||
|
schema: { $ref: getSchemaPath(SalesByItemsTableResponseDto) },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
@ApiOperation({
|
@ApiOperation({
|
||||||
summary: 'Sales by items report',
|
summary: 'Sales by items report',
|
||||||
description: 'Retrieves the sales by items report.',
|
description: 'Retrieves the sales by items report.',
|
||||||
|
|||||||
+97
@@ -0,0 +1,97 @@
|
|||||||
|
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||||
|
import { NumberFormatQueryDto } from '@/modules/BankingTransactions/dtos/NumberFormatQuery.dto';
|
||||||
|
import {
|
||||||
|
FinancialReportTotalDto,
|
||||||
|
FinancialReportMetaDto,
|
||||||
|
FinancialTableDataDto,
|
||||||
|
} from '../../dtos/FinancialReportResponse.dto';
|
||||||
|
|
||||||
|
export class SalesByItemDto {
|
||||||
|
@ApiProperty({ description: 'Item ID', type: Number })
|
||||||
|
id: number;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Item name' })
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Item code' })
|
||||||
|
code: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Item type' })
|
||||||
|
type: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Quantity sold', type: Number })
|
||||||
|
quantity: number;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Total sales amount', type: FinancialReportTotalDto })
|
||||||
|
total: FinancialReportTotalDto;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Average price', type: Number })
|
||||||
|
averagePrice?: number;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'COGS', type: FinancialReportTotalDto })
|
||||||
|
cogs?: FinancialReportTotalDto;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Profit', type: FinancialReportTotalDto })
|
||||||
|
profit?: FinancialReportTotalDto;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Profit percentage', type: Number })
|
||||||
|
profitPercentage?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class SalesByItemsMetaDto extends FinancialReportMetaDto {
|
||||||
|
@ApiProperty({ description: 'Formatted from date' })
|
||||||
|
formattedFromDate: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Formatted to date' })
|
||||||
|
formattedToDate: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Formatted date range' })
|
||||||
|
formattedDateRange: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class SalesByItemsQueryResponseDto {
|
||||||
|
@ApiProperty({ description: 'Start date' })
|
||||||
|
fromDate: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'End date' })
|
||||||
|
toDate: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Number format settings', type: NumberFormatQueryDto })
|
||||||
|
numberFormat: NumberFormatQueryDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Item IDs to include', type: [Number] })
|
||||||
|
itemsIds: number[];
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Customer IDs to include', type: [Number] })
|
||||||
|
customersIds: number[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export class SalesByItemsResponseDto {
|
||||||
|
@ApiProperty({ description: 'Query parameters used to generate the report', type: SalesByItemsQueryResponseDto })
|
||||||
|
query: SalesByItemsQueryResponseDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Sales by items', type: [SalesByItemDto] })
|
||||||
|
data: SalesByItemDto[];
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Report metadata', type: SalesByItemsMetaDto })
|
||||||
|
meta: SalesByItemsMetaDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Re-export table DTOs for convenience
|
||||||
|
export {
|
||||||
|
FinancialTableCellDto as SalesByItemsTableCellDto,
|
||||||
|
FinancialTableRowDto as SalesByItemsTableRowDto,
|
||||||
|
FinancialTableColumnDto as SalesByItemsTableColumnDto,
|
||||||
|
FinancialTableDataDto as SalesByItemsTableDataDto,
|
||||||
|
} from '../../dtos/FinancialReportResponse.dto';
|
||||||
|
|
||||||
|
export class SalesByItemsTableResponseDto {
|
||||||
|
@ApiProperty({ description: 'Table data structure', type: () => FinancialTableDataDto })
|
||||||
|
table: FinancialTableDataDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Query parameters used to generate the report', type: SalesByItemsQueryResponseDto })
|
||||||
|
query: SalesByItemsQueryResponseDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Report metadata', type: SalesByItemsMetaDto })
|
||||||
|
meta: SalesByItemsMetaDto;
|
||||||
|
}
|
||||||
+15
@@ -1,19 +1,26 @@
|
|||||||
import { Response } from 'express';
|
import { Response } from 'express';
|
||||||
import {
|
import {
|
||||||
|
ApiExtraModels,
|
||||||
ApiOperation,
|
ApiOperation,
|
||||||
ApiProduces,
|
ApiProduces,
|
||||||
ApiResponse,
|
ApiResponse,
|
||||||
ApiTags,
|
ApiTags,
|
||||||
|
getSchemaPath,
|
||||||
} from '@nestjs/swagger';
|
} from '@nestjs/swagger';
|
||||||
import { Controller, Get, Headers, Query, Res } from '@nestjs/common';
|
import { Controller, Get, Headers, Query, Res } from '@nestjs/common';
|
||||||
import { AcceptType } from '@/constants/accept-type';
|
import { AcceptType } from '@/constants/accept-type';
|
||||||
import { SalesTaxLiabilitySummaryApplication } from './SalesTaxLiabilitySummaryApplication';
|
import { SalesTaxLiabilitySummaryApplication } from './SalesTaxLiabilitySummaryApplication';
|
||||||
import { SalesTaxLiabilitySummaryQueryDto } from './dtos/SalesTaxLiabilityQuery.dto';
|
import { SalesTaxLiabilitySummaryQueryDto } from './dtos/SalesTaxLiabilityQuery.dto';
|
||||||
|
import {
|
||||||
|
SalesTaxLiabilitySummaryResponseDto,
|
||||||
|
SalesTaxLiabilitySummaryTableResponseDto,
|
||||||
|
} from './SalesTaxLiabilitySummaryResponse.dto';
|
||||||
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
|
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
|
||||||
|
|
||||||
@Controller('/reports/sales-tax-liability-summary')
|
@Controller('/reports/sales-tax-liability-summary')
|
||||||
@ApiTags('Reports')
|
@ApiTags('Reports')
|
||||||
@ApiCommonHeaders()
|
@ApiCommonHeaders()
|
||||||
|
@ApiExtraModels(SalesTaxLiabilitySummaryResponseDto, SalesTaxLiabilitySummaryTableResponseDto)
|
||||||
export class SalesTaxLiabilitySummaryController {
|
export class SalesTaxLiabilitySummaryController {
|
||||||
constructor(
|
constructor(
|
||||||
private readonly salesTaxLiabilitySummaryApp: SalesTaxLiabilitySummaryApplication,
|
private readonly salesTaxLiabilitySummaryApp: SalesTaxLiabilitySummaryApplication,
|
||||||
@@ -23,6 +30,14 @@ export class SalesTaxLiabilitySummaryController {
|
|||||||
@ApiResponse({
|
@ApiResponse({
|
||||||
status: 200,
|
status: 200,
|
||||||
description: 'Sales tax liability summary report',
|
description: 'Sales tax liability summary report',
|
||||||
|
content: {
|
||||||
|
[AcceptType.ApplicationJson]: {
|
||||||
|
schema: { $ref: getSchemaPath(SalesTaxLiabilitySummaryResponseDto) },
|
||||||
|
},
|
||||||
|
[AcceptType.ApplicationJsonTable]: {
|
||||||
|
schema: { $ref: getSchemaPath(SalesTaxLiabilitySummaryTableResponseDto) },
|
||||||
|
},
|
||||||
|
},
|
||||||
})
|
})
|
||||||
@ApiOperation({ summary: 'Get sales tax liability summary report' })
|
@ApiOperation({ summary: 'Get sales tax liability summary report' })
|
||||||
@ApiProduces(
|
@ApiProduces(
|
||||||
|
|||||||
+79
@@ -0,0 +1,79 @@
|
|||||||
|
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||||
|
import { NumberFormatQueryDto } from '@/modules/BankingTransactions/dtos/NumberFormatQuery.dto';
|
||||||
|
import {
|
||||||
|
FinancialReportTotalDto,
|
||||||
|
FinancialReportMetaDto,
|
||||||
|
FinancialTableDataDto,
|
||||||
|
} from '../../dtos/FinancialReportResponse.dto';
|
||||||
|
|
||||||
|
export class TaxRateSummaryDto {
|
||||||
|
@ApiProperty({ description: 'Tax rate ID', type: Number })
|
||||||
|
id: number;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Tax rate name' })
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Tax rate percentage', type: Number })
|
||||||
|
rate: number;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Taxable amount', type: FinancialReportTotalDto })
|
||||||
|
taxableAmount: FinancialReportTotalDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Tax amount collected', type: FinancialReportTotalDto })
|
||||||
|
taxAmount: FinancialReportTotalDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Total sales (including tax)', type: FinancialReportTotalDto })
|
||||||
|
totalSales: FinancialReportTotalDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class SalesTaxLiabilitySummaryMetaDto extends FinancialReportMetaDto {
|
||||||
|
@ApiProperty({ description: 'Formatted from date' })
|
||||||
|
formattedFromDate: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Formatted to date' })
|
||||||
|
formattedToDate: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Formatted date range' })
|
||||||
|
formattedDateRange: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class SalesTaxLiabilitySummaryQueryResponseDto {
|
||||||
|
@ApiProperty({ description: 'Start date' })
|
||||||
|
fromDate: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'End date' })
|
||||||
|
toDate: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Number format settings', type: NumberFormatQueryDto })
|
||||||
|
numberFormat: NumberFormatQueryDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class SalesTaxLiabilitySummaryResponseDto {
|
||||||
|
@ApiProperty({ description: 'Query parameters used to generate the report', type: SalesTaxLiabilitySummaryQueryResponseDto })
|
||||||
|
query: SalesTaxLiabilitySummaryQueryResponseDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Tax rate summaries', type: [TaxRateSummaryDto] })
|
||||||
|
data: TaxRateSummaryDto[];
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Report metadata', type: SalesTaxLiabilitySummaryMetaDto })
|
||||||
|
meta: SalesTaxLiabilitySummaryMetaDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Re-export table DTOs for convenience
|
||||||
|
export {
|
||||||
|
FinancialTableCellDto as SalesTaxLiabilitySummaryTableCellDto,
|
||||||
|
FinancialTableRowDto as SalesTaxLiabilitySummaryTableRowDto,
|
||||||
|
FinancialTableColumnDto as SalesTaxLiabilitySummaryTableColumnDto,
|
||||||
|
FinancialTableDataDto as SalesTaxLiabilitySummaryTableDataDto,
|
||||||
|
} from '../../dtos/FinancialReportResponse.dto';
|
||||||
|
|
||||||
|
export class SalesTaxLiabilitySummaryTableResponseDto {
|
||||||
|
@ApiProperty({ description: 'Table data structure', type: () => FinancialTableDataDto })
|
||||||
|
table: FinancialTableDataDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Query parameters used to generate the report', type: SalesTaxLiabilitySummaryQueryResponseDto })
|
||||||
|
query: SalesTaxLiabilitySummaryQueryResponseDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Report metadata', type: SalesTaxLiabilitySummaryMetaDto })
|
||||||
|
meta: SalesTaxLiabilitySummaryMetaDto;
|
||||||
|
}
|
||||||
+18
-2
@@ -1,5 +1,9 @@
|
|||||||
import { Controller, Get, Headers, Query, Res } from '@nestjs/common';
|
import { Controller, Get, Headers, Query, Res } from '@nestjs/common';
|
||||||
import { ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';
|
import { ApiExtraModels, ApiOperation, ApiResponse, ApiTags, getSchemaPath } from '@nestjs/swagger';
|
||||||
|
import {
|
||||||
|
TransactionsByCustomerResponseDto,
|
||||||
|
TransactionsByCustomerTableResponseDto,
|
||||||
|
} from './TransactionsByCustomerResponse.dto';
|
||||||
import { ITransactionsByCustomersFilter } from './TransactionsByCustomer.types';
|
import { ITransactionsByCustomersFilter } from './TransactionsByCustomer.types';
|
||||||
import { TransactionsByCustomerApplication } from './TransactionsByCustomersApplication';
|
import { TransactionsByCustomerApplication } from './TransactionsByCustomersApplication';
|
||||||
import { AcceptType } from '@/constants/accept-type';
|
import { AcceptType } from '@/constants/accept-type';
|
||||||
@@ -10,6 +14,7 @@ import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
|
|||||||
@Controller('/reports/transactions-by-customers')
|
@Controller('/reports/transactions-by-customers')
|
||||||
@ApiTags('Reports')
|
@ApiTags('Reports')
|
||||||
@ApiCommonHeaders()
|
@ApiCommonHeaders()
|
||||||
|
@ApiExtraModels(TransactionsByCustomerResponseDto, TransactionsByCustomerTableResponseDto)
|
||||||
export class TransactionsByCustomerController {
|
export class TransactionsByCustomerController {
|
||||||
constructor(
|
constructor(
|
||||||
private readonly transactionsByCustomersApp: TransactionsByCustomerApplication,
|
private readonly transactionsByCustomersApp: TransactionsByCustomerApplication,
|
||||||
@@ -17,7 +22,18 @@ export class TransactionsByCustomerController {
|
|||||||
|
|
||||||
@Get()
|
@Get()
|
||||||
@ApiOperation({ summary: 'Get transactions by customer' })
|
@ApiOperation({ summary: 'Get transactions by customer' })
|
||||||
@ApiResponse({ status: 200, description: 'Transactions by customer' })
|
@ApiResponse({
|
||||||
|
status: 200,
|
||||||
|
description: 'Transactions by customer',
|
||||||
|
content: {
|
||||||
|
[AcceptType.ApplicationJson]: {
|
||||||
|
schema: { $ref: getSchemaPath(TransactionsByCustomerResponseDto) },
|
||||||
|
},
|
||||||
|
[AcceptType.ApplicationJsonTable]: {
|
||||||
|
schema: { $ref: getSchemaPath(TransactionsByCustomerTableResponseDto) },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
async transactionsByCustomer(
|
async transactionsByCustomer(
|
||||||
@Query() filter: TransactionsByCustomerQueryDto,
|
@Query() filter: TransactionsByCustomerQueryDto,
|
||||||
@Res({ passthrough: true }) res: Response,
|
@Res({ passthrough: true }) res: Response,
|
||||||
|
|||||||
+117
@@ -0,0 +1,117 @@
|
|||||||
|
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||||
|
import { NumberFormatQueryDto } from '@/modules/BankingTransactions/dtos/NumberFormatQuery.dto';
|
||||||
|
import {
|
||||||
|
FinancialReportTotalDto,
|
||||||
|
FinancialReportMetaDto,
|
||||||
|
FinancialTableDataDto,
|
||||||
|
} from '../../dtos/FinancialReportResponse.dto';
|
||||||
|
|
||||||
|
export class CustomerTransactionDto {
|
||||||
|
@ApiProperty({ description: 'Transaction date' })
|
||||||
|
date: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Formatted date' })
|
||||||
|
dateFormatted: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Transaction type' })
|
||||||
|
transactionType: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Transaction number' })
|
||||||
|
transactionNumber: string;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Reference type' })
|
||||||
|
referenceType?: string;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Reference ID', type: Number })
|
||||||
|
referenceId?: number;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Transaction description' })
|
||||||
|
description?: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Transaction amount', type: FinancialReportTotalDto })
|
||||||
|
amount: FinancialReportTotalDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Running balance', type: FinancialReportTotalDto })
|
||||||
|
runningBalance: FinancialReportTotalDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class CustomerWithTransactionsDto {
|
||||||
|
@ApiProperty({ description: 'Customer ID', type: Number })
|
||||||
|
customerId: number;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Customer name' })
|
||||||
|
customerName: string;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Opening balance', type: FinancialReportTotalDto })
|
||||||
|
openingBalance?: FinancialReportTotalDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Customer transactions', type: [CustomerTransactionDto] })
|
||||||
|
transactions: CustomerTransactionDto[];
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Closing balance', type: FinancialReportTotalDto })
|
||||||
|
closingBalance: FinancialReportTotalDto;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Total debit', type: FinancialReportTotalDto })
|
||||||
|
totalDebit?: FinancialReportTotalDto;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Total credit', type: FinancialReportTotalDto })
|
||||||
|
totalCredit?: FinancialReportTotalDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class TransactionsByCustomerMetaDto extends FinancialReportMetaDto {
|
||||||
|
@ApiProperty({ description: 'Formatted from date' })
|
||||||
|
formattedFromDate: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Formatted to date' })
|
||||||
|
formattedToDate: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Formatted date range' })
|
||||||
|
formattedDateRange: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class TransactionsByCustomerQueryResponseDto {
|
||||||
|
@ApiProperty({ description: 'Start date' })
|
||||||
|
fromDate: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'End date' })
|
||||||
|
toDate: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Number format settings', type: NumberFormatQueryDto })
|
||||||
|
numberFormat: NumberFormatQueryDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Customer IDs to include', type: [Number] })
|
||||||
|
customersIds: number[];
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Exclude zero balance customers' })
|
||||||
|
noneZero: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class TransactionsByCustomerResponseDto {
|
||||||
|
@ApiProperty({ description: 'Query parameters used to generate the report', type: TransactionsByCustomerQueryResponseDto })
|
||||||
|
query: TransactionsByCustomerQueryResponseDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Customers with transactions', type: [CustomerWithTransactionsDto] })
|
||||||
|
data: CustomerWithTransactionsDto[];
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Report metadata', type: TransactionsByCustomerMetaDto })
|
||||||
|
meta: TransactionsByCustomerMetaDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Re-export table DTOs for convenience
|
||||||
|
export {
|
||||||
|
FinancialTableCellDto as TransactionsByCustomerTableCellDto,
|
||||||
|
FinancialTableRowDto as TransactionsByCustomerTableRowDto,
|
||||||
|
FinancialTableColumnDto as TransactionsByCustomerTableColumnDto,
|
||||||
|
FinancialTableDataDto as TransactionsByCustomerTableDataDto,
|
||||||
|
} from '../../dtos/FinancialReportResponse.dto';
|
||||||
|
|
||||||
|
export class TransactionsByCustomerTableResponseDto {
|
||||||
|
@ApiProperty({ description: 'Table data structure', type: () => FinancialTableDataDto })
|
||||||
|
table: FinancialTableDataDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Query parameters used to generate the report', type: TransactionsByCustomerQueryResponseDto })
|
||||||
|
query: TransactionsByCustomerQueryResponseDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Report metadata', type: TransactionsByCustomerMetaDto })
|
||||||
|
meta: TransactionsByCustomerMetaDto;
|
||||||
|
}
|
||||||
+18
-2
@@ -3,13 +3,18 @@ import { ITransactionsByVendorsFilter } from './TransactionsByVendor.types';
|
|||||||
import { AcceptType } from '@/constants/accept-type';
|
import { AcceptType } from '@/constants/accept-type';
|
||||||
import { Response } from 'express';
|
import { Response } from 'express';
|
||||||
import { TransactionsByVendorApplication } from './TransactionsByVendorApplication';
|
import { TransactionsByVendorApplication } from './TransactionsByVendorApplication';
|
||||||
import { ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';
|
import { ApiExtraModels, ApiOperation, ApiResponse, ApiTags, getSchemaPath } from '@nestjs/swagger';
|
||||||
|
import {
|
||||||
|
TransactionsByVendorResponseDto,
|
||||||
|
TransactionsByVendorTableResponseDto,
|
||||||
|
} from './TransactionsByVendorResponse.dto';
|
||||||
import { TransactionsByVendorQueryDto } from './TransactionsByVendorQuery.dto';
|
import { TransactionsByVendorQueryDto } from './TransactionsByVendorQuery.dto';
|
||||||
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
|
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
|
||||||
|
|
||||||
@Controller('/reports/transactions-by-vendors')
|
@Controller('/reports/transactions-by-vendors')
|
||||||
@ApiTags('Reports')
|
@ApiTags('Reports')
|
||||||
@ApiCommonHeaders()
|
@ApiCommonHeaders()
|
||||||
|
@ApiExtraModels(TransactionsByVendorResponseDto, TransactionsByVendorTableResponseDto)
|
||||||
export class TransactionsByVendorController {
|
export class TransactionsByVendorController {
|
||||||
constructor(
|
constructor(
|
||||||
private readonly transactionsByVendorsApp: TransactionsByVendorApplication,
|
private readonly transactionsByVendorsApp: TransactionsByVendorApplication,
|
||||||
@@ -17,7 +22,18 @@ export class TransactionsByVendorController {
|
|||||||
|
|
||||||
@Get()
|
@Get()
|
||||||
@ApiOperation({ summary: 'Get transactions by vendor' })
|
@ApiOperation({ summary: 'Get transactions by vendor' })
|
||||||
@ApiResponse({ status: 200, description: 'Transactions by vendor' })
|
@ApiResponse({
|
||||||
|
status: 200,
|
||||||
|
description: 'Transactions by vendor',
|
||||||
|
content: {
|
||||||
|
[AcceptType.ApplicationJson]: {
|
||||||
|
schema: { $ref: getSchemaPath(TransactionsByVendorResponseDto) },
|
||||||
|
},
|
||||||
|
[AcceptType.ApplicationJsonTable]: {
|
||||||
|
schema: { $ref: getSchemaPath(TransactionsByVendorTableResponseDto) },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
async transactionsByVendor(
|
async transactionsByVendor(
|
||||||
@Query() filter: TransactionsByVendorQueryDto,
|
@Query() filter: TransactionsByVendorQueryDto,
|
||||||
@Res({ passthrough: true }) res: Response,
|
@Res({ passthrough: true }) res: Response,
|
||||||
|
|||||||
+117
@@ -0,0 +1,117 @@
|
|||||||
|
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||||
|
import { NumberFormatQueryDto } from '@/modules/BankingTransactions/dtos/NumberFormatQuery.dto';
|
||||||
|
import {
|
||||||
|
FinancialReportTotalDto,
|
||||||
|
FinancialReportMetaDto,
|
||||||
|
FinancialTableDataDto,
|
||||||
|
} from '../../dtos/FinancialReportResponse.dto';
|
||||||
|
|
||||||
|
export class VendorTransactionDto {
|
||||||
|
@ApiProperty({ description: 'Transaction date' })
|
||||||
|
date: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Formatted date' })
|
||||||
|
dateFormatted: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Transaction type' })
|
||||||
|
transactionType: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Transaction number' })
|
||||||
|
transactionNumber: string;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Reference type' })
|
||||||
|
referenceType?: string;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Reference ID', type: Number })
|
||||||
|
referenceId?: number;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Transaction description' })
|
||||||
|
description?: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Transaction amount', type: FinancialReportTotalDto })
|
||||||
|
amount: FinancialReportTotalDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Running balance', type: FinancialReportTotalDto })
|
||||||
|
runningBalance: FinancialReportTotalDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class VendorWithTransactionsDto {
|
||||||
|
@ApiProperty({ description: 'Vendor ID', type: Number })
|
||||||
|
vendorId: number;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Vendor name' })
|
||||||
|
vendorName: string;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Opening balance', type: FinancialReportTotalDto })
|
||||||
|
openingBalance?: FinancialReportTotalDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Vendor transactions', type: [VendorTransactionDto] })
|
||||||
|
transactions: VendorTransactionDto[];
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Closing balance', type: FinancialReportTotalDto })
|
||||||
|
closingBalance: FinancialReportTotalDto;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Total debit', type: FinancialReportTotalDto })
|
||||||
|
totalDebit?: FinancialReportTotalDto;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Total credit', type: FinancialReportTotalDto })
|
||||||
|
totalCredit?: FinancialReportTotalDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class TransactionsByVendorMetaDto extends FinancialReportMetaDto {
|
||||||
|
@ApiProperty({ description: 'Formatted from date' })
|
||||||
|
formattedFromDate: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Formatted to date' })
|
||||||
|
formattedToDate: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Formatted date range' })
|
||||||
|
formattedDateRange: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class TransactionsByVendorQueryResponseDto {
|
||||||
|
@ApiProperty({ description: 'Start date' })
|
||||||
|
fromDate: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'End date' })
|
||||||
|
toDate: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Number format settings', type: NumberFormatQueryDto })
|
||||||
|
numberFormat: NumberFormatQueryDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Vendor IDs to include', type: [Number] })
|
||||||
|
vendorsIds: number[];
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Exclude zero balance vendors' })
|
||||||
|
noneZero: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class TransactionsByVendorResponseDto {
|
||||||
|
@ApiProperty({ description: 'Query parameters used to generate the report', type: TransactionsByVendorQueryResponseDto })
|
||||||
|
query: TransactionsByVendorQueryResponseDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Vendors with transactions', type: [VendorWithTransactionsDto] })
|
||||||
|
data: VendorWithTransactionsDto[];
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Report metadata', type: TransactionsByVendorMetaDto })
|
||||||
|
meta: TransactionsByVendorMetaDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Re-export table DTOs for convenience
|
||||||
|
export {
|
||||||
|
FinancialTableCellDto as TransactionsByVendorTableCellDto,
|
||||||
|
FinancialTableRowDto as TransactionsByVendorTableRowDto,
|
||||||
|
FinancialTableColumnDto as TransactionsByVendorTableColumnDto,
|
||||||
|
FinancialTableDataDto as TransactionsByVendorTableDataDto,
|
||||||
|
} from '../../dtos/FinancialReportResponse.dto';
|
||||||
|
|
||||||
|
export class TransactionsByVendorTableResponseDto {
|
||||||
|
@ApiProperty({ description: 'Table data structure', type: () => FinancialTableDataDto })
|
||||||
|
table: FinancialTableDataDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Query parameters used to generate the report', type: TransactionsByVendorQueryResponseDto })
|
||||||
|
query: TransactionsByVendorQueryResponseDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Report metadata', type: TransactionsByVendorMetaDto })
|
||||||
|
meta: TransactionsByVendorMetaDto;
|
||||||
|
}
|
||||||
+16
-1
@@ -1,9 +1,11 @@
|
|||||||
import { Controller, Get, Headers, Query, Res } from '@nestjs/common';
|
import { Controller, Get, Headers, Query, Res } from '@nestjs/common';
|
||||||
import {
|
import {
|
||||||
|
ApiExtraModels,
|
||||||
ApiOperation,
|
ApiOperation,
|
||||||
ApiProduces,
|
ApiProduces,
|
||||||
ApiResponse,
|
ApiResponse,
|
||||||
ApiTags,
|
ApiTags,
|
||||||
|
getSchemaPath,
|
||||||
} from '@nestjs/swagger';
|
} from '@nestjs/swagger';
|
||||||
import { castArray } from 'lodash';
|
import { castArray } from 'lodash';
|
||||||
import { Response } from 'express';
|
import { Response } from 'express';
|
||||||
@@ -11,11 +13,16 @@ import { AcceptType } from '@/constants/accept-type';
|
|||||||
import { TrialBalanceSheetApplication } from './TrialBalanceSheetApplication';
|
import { TrialBalanceSheetApplication } from './TrialBalanceSheetApplication';
|
||||||
import { TrialBalanceSheetQueryDto } from './TrialBalanceSheetQuery.dto';
|
import { TrialBalanceSheetQueryDto } from './TrialBalanceSheetQuery.dto';
|
||||||
import { TrialBalanceSheetResponseExample } from './TrialBalanceSheet.swagger';
|
import { TrialBalanceSheetResponseExample } from './TrialBalanceSheet.swagger';
|
||||||
|
import {
|
||||||
|
TrialBalanceSheetResponseDto,
|
||||||
|
TrialBalanceSheetTableResponseDto,
|
||||||
|
} from './TrialBalanceSheetResponse.dto';
|
||||||
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
|
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
|
||||||
|
|
||||||
@Controller('reports/trial-balance-sheet')
|
@Controller('reports/trial-balance-sheet')
|
||||||
@ApiTags('Reports')
|
@ApiTags('Reports')
|
||||||
@ApiCommonHeaders()
|
@ApiCommonHeaders()
|
||||||
|
@ApiExtraModels(TrialBalanceSheetResponseDto, TrialBalanceSheetTableResponseDto)
|
||||||
export class TrialBalanceSheetController {
|
export class TrialBalanceSheetController {
|
||||||
constructor(
|
constructor(
|
||||||
private readonly trialBalanceSheetApp: TrialBalanceSheetApplication,
|
private readonly trialBalanceSheetApp: TrialBalanceSheetApplication,
|
||||||
@@ -26,7 +33,15 @@ export class TrialBalanceSheetController {
|
|||||||
@ApiResponse({
|
@ApiResponse({
|
||||||
status: 200,
|
status: 200,
|
||||||
description: 'Trial balance sheet',
|
description: 'Trial balance sheet',
|
||||||
example: TrialBalanceSheetResponseExample,
|
content: {
|
||||||
|
[AcceptType.ApplicationJson]: {
|
||||||
|
schema: { $ref: getSchemaPath(TrialBalanceSheetResponseDto) },
|
||||||
|
example: TrialBalanceSheetResponseExample,
|
||||||
|
},
|
||||||
|
[AcceptType.ApplicationJsonTable]: {
|
||||||
|
schema: { $ref: getSchemaPath(TrialBalanceSheetTableResponseDto) },
|
||||||
|
},
|
||||||
|
},
|
||||||
})
|
})
|
||||||
@ApiProduces(
|
@ApiProduces(
|
||||||
AcceptType.ApplicationJson,
|
AcceptType.ApplicationJson,
|
||||||
|
|||||||
+123
@@ -0,0 +1,123 @@
|
|||||||
|
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||||
|
import {
|
||||||
|
FinancialReportTotalDto,
|
||||||
|
FinancialReportMetaDto,
|
||||||
|
FinancialTableDataDto,
|
||||||
|
} from '../../dtos/FinancialReportResponse.dto';
|
||||||
|
|
||||||
|
export class TrialBalanceSheetAccountDto {
|
||||||
|
@ApiProperty({ description: 'Account ID', type: Number })
|
||||||
|
id: number;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Account name' })
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Account code' })
|
||||||
|
code: string;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Opening balance', type: FinancialReportTotalDto })
|
||||||
|
openingBalance?: FinancialReportTotalDto;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Closing balance', type: FinancialReportTotalDto })
|
||||||
|
closingBalance?: FinancialReportTotalDto;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Debit total', type: FinancialReportTotalDto })
|
||||||
|
debitTotal?: FinancialReportTotalDto;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Credit total', type: FinancialReportTotalDto })
|
||||||
|
creditTotal?: FinancialReportTotalDto;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Debit/change', type: FinancialReportTotalDto })
|
||||||
|
debit?: FinancialReportTotalDto;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Credit/change', type: FinancialReportTotalDto })
|
||||||
|
credit?: FinancialReportTotalDto;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Period balance', type: FinancialReportTotalDto })
|
||||||
|
periodBalance?: FinancialReportTotalDto;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Account normal', enum: ['debit', 'credit'] })
|
||||||
|
accountNormal?: string;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Account index', type: Number })
|
||||||
|
index?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class TrialBalanceSheetMetaDto extends FinancialReportMetaDto {
|
||||||
|
@ApiProperty({ description: 'Formatted from date' })
|
||||||
|
formattedFromDate: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Formatted to date' })
|
||||||
|
formattedToDate: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Formatted date range' })
|
||||||
|
formattedDateRange: string;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Opening balance at', type: Date })
|
||||||
|
openingBalanceAt?: Date;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Closing balance at', type: Date })
|
||||||
|
closingBalanceAt?: Date;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Formatted opening balance date' })
|
||||||
|
formattedOpeningBalanceDate?: string;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Formatted closing balance date' })
|
||||||
|
formattedClosingBalanceDate?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class TrialBalanceSheetQueryResponseDto {
|
||||||
|
@ApiProperty({ description: 'Start date' })
|
||||||
|
fromDate: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'End date' })
|
||||||
|
toDate: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Account IDs to include', type: [Number] })
|
||||||
|
accountIds: number[];
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Exclude zero balance accounts' })
|
||||||
|
noneZero: boolean;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Exclude accounts with no transactions' })
|
||||||
|
noneTransactions: boolean;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Accounting basis', enum: ['cash', 'accrual'] })
|
||||||
|
basis: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Column display type', enum: ['total', 'date_periods'] })
|
||||||
|
displayColumnsType: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Column grouping', enum: ['day', 'month', 'year', 'quarter'] })
|
||||||
|
displayColumnsBy: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class TrialBalanceSheetResponseDto {
|
||||||
|
@ApiProperty({ description: 'Query parameters used to generate the report', type: TrialBalanceSheetQueryResponseDto })
|
||||||
|
query: TrialBalanceSheetQueryResponseDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Trial balance sheet data', type: [TrialBalanceSheetAccountDto] })
|
||||||
|
data: TrialBalanceSheetAccountDto[];
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Report metadata', type: TrialBalanceSheetMetaDto })
|
||||||
|
meta: TrialBalanceSheetMetaDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Re-export table DTOs for convenience
|
||||||
|
export {
|
||||||
|
FinancialTableCellDto as TrialBalanceSheetTableCellDto,
|
||||||
|
FinancialTableRowDto as TrialBalanceSheetTableRowDto,
|
||||||
|
FinancialTableColumnDto as TrialBalanceSheetTableColumnDto,
|
||||||
|
FinancialTableDataDto as TrialBalanceSheetTableDataDto,
|
||||||
|
} from '../../dtos/FinancialReportResponse.dto';
|
||||||
|
|
||||||
|
export class TrialBalanceSheetTableResponseDto {
|
||||||
|
@ApiProperty({ description: 'Table data structure', type: () => FinancialTableDataDto })
|
||||||
|
table: FinancialTableDataDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Query parameters used to generate the report', type: TrialBalanceSheetQueryResponseDto })
|
||||||
|
query: TrialBalanceSheetQueryResponseDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Report metadata', type: TrialBalanceSheetMetaDto })
|
||||||
|
meta: TrialBalanceSheetMetaDto;
|
||||||
|
}
|
||||||
+19
-1
@@ -4,17 +4,24 @@ import { VendorBalanceSummaryApplication } from './VendorBalanceSummaryApplicati
|
|||||||
import { Response } from 'express';
|
import { Response } from 'express';
|
||||||
import { AcceptType } from '@/constants/accept-type';
|
import { AcceptType } from '@/constants/accept-type';
|
||||||
import {
|
import {
|
||||||
|
ApiExtraModels,
|
||||||
ApiOperation,
|
ApiOperation,
|
||||||
ApiProduces,
|
ApiProduces,
|
||||||
ApiResponse,
|
ApiResponse,
|
||||||
ApiTags,
|
ApiTags,
|
||||||
|
getSchemaPath,
|
||||||
} from '@nestjs/swagger';
|
} from '@nestjs/swagger';
|
||||||
import { VendorBalanceSummaryQueryDto } from './VendorBalanceSummaryQuery.dto';
|
import { VendorBalanceSummaryQueryDto } from './VendorBalanceSummaryQuery.dto';
|
||||||
|
import {
|
||||||
|
VendorBalanceSummaryResponseDto,
|
||||||
|
VendorBalanceSummaryTableResponseDto,
|
||||||
|
} from './VendorBalanceSummaryResponse.dto';
|
||||||
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
|
import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
|
||||||
|
|
||||||
@Controller('/reports/vendor-balance-summary')
|
@Controller('/reports/vendor-balance-summary')
|
||||||
@ApiTags('Reports')
|
@ApiTags('Reports')
|
||||||
@ApiCommonHeaders()
|
@ApiCommonHeaders()
|
||||||
|
@ApiExtraModels(VendorBalanceSummaryResponseDto, VendorBalanceSummaryTableResponseDto)
|
||||||
export class VendorBalanceSummaryController {
|
export class VendorBalanceSummaryController {
|
||||||
constructor(
|
constructor(
|
||||||
private readonly vendorBalanceSummaryApp: VendorBalanceSummaryApplication,
|
private readonly vendorBalanceSummaryApp: VendorBalanceSummaryApplication,
|
||||||
@@ -22,7 +29,18 @@ export class VendorBalanceSummaryController {
|
|||||||
|
|
||||||
@Get()
|
@Get()
|
||||||
@ApiOperation({ summary: 'Get vendor balance summary' })
|
@ApiOperation({ summary: 'Get vendor balance summary' })
|
||||||
@ApiResponse({ status: 200, description: 'Vendor balance summary' })
|
@ApiResponse({
|
||||||
|
status: 200,
|
||||||
|
description: 'Vendor balance summary',
|
||||||
|
content: {
|
||||||
|
[AcceptType.ApplicationJson]: {
|
||||||
|
schema: { $ref: getSchemaPath(VendorBalanceSummaryResponseDto) },
|
||||||
|
},
|
||||||
|
[AcceptType.ApplicationJsonTable]: {
|
||||||
|
schema: { $ref: getSchemaPath(VendorBalanceSummaryTableResponseDto) },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
@ApiProduces(
|
@ApiProduces(
|
||||||
AcceptType.ApplicationJson,
|
AcceptType.ApplicationJson,
|
||||||
AcceptType.ApplicationJsonTable,
|
AcceptType.ApplicationJsonTable,
|
||||||
|
|||||||
+82
@@ -0,0 +1,82 @@
|
|||||||
|
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||||
|
import { NumberFormatQueryDto } from '@/modules/BankingTransactions/dtos/NumberFormatQuery.dto';
|
||||||
|
import {
|
||||||
|
FinancialReportTotalDto,
|
||||||
|
FinancialReportMetaDto,
|
||||||
|
FinancialTableDataDto,
|
||||||
|
} from '../../dtos/FinancialReportResponse.dto';
|
||||||
|
|
||||||
|
export class VendorBalanceDto {
|
||||||
|
@ApiProperty({ description: 'Vendor ID', type: Number })
|
||||||
|
vendorId: number;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Vendor name' })
|
||||||
|
vendorName: string;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Opening balance', type: FinancialReportTotalDto })
|
||||||
|
openingBalance?: FinancialReportTotalDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Closing balance', type: FinancialReportTotalDto })
|
||||||
|
closingBalance: FinancialReportTotalDto;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Total debit', type: FinancialReportTotalDto })
|
||||||
|
totalDebit?: FinancialReportTotalDto;
|
||||||
|
|
||||||
|
@ApiPropertyOptional({ description: 'Total credit', type: FinancialReportTotalDto })
|
||||||
|
totalCredit?: FinancialReportTotalDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class VendorBalanceSummaryMetaDto extends FinancialReportMetaDto {
|
||||||
|
@ApiProperty({ description: 'Formatted as-of date' })
|
||||||
|
formattedAsDate: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Formatted date range' })
|
||||||
|
formattedDateRange: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class VendorBalanceSummaryQueryResponseDto {
|
||||||
|
@ApiProperty({ description: 'As-of date' })
|
||||||
|
asDate: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Number format settings', type: NumberFormatQueryDto })
|
||||||
|
numberFormat: NumberFormatQueryDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Vendor IDs to include', type: [Number] })
|
||||||
|
vendorsIds: number[];
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Exclude zero balance vendors' })
|
||||||
|
noneZero: boolean;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Exclude inactive vendors' })
|
||||||
|
noneInactive: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class VendorBalanceSummaryResponseDto {
|
||||||
|
@ApiProperty({ description: 'Query parameters used to generate the report', type: VendorBalanceSummaryQueryResponseDto })
|
||||||
|
query: VendorBalanceSummaryQueryResponseDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Vendor balances', type: [VendorBalanceDto] })
|
||||||
|
data: VendorBalanceDto[];
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Report metadata', type: VendorBalanceSummaryMetaDto })
|
||||||
|
meta: VendorBalanceSummaryMetaDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Re-export table DTOs for convenience
|
||||||
|
export {
|
||||||
|
FinancialTableCellDto as VendorBalanceSummaryTableCellDto,
|
||||||
|
FinancialTableRowDto as VendorBalanceSummaryTableRowDto,
|
||||||
|
FinancialTableColumnDto as VendorBalanceSummaryTableColumnDto,
|
||||||
|
FinancialTableDataDto as VendorBalanceSummaryTableDataDto,
|
||||||
|
} from '../../dtos/FinancialReportResponse.dto';
|
||||||
|
|
||||||
|
export class VendorBalanceSummaryTableResponseDto {
|
||||||
|
@ApiProperty({ description: 'Table data structure', type: () => FinancialTableDataDto })
|
||||||
|
table: FinancialTableDataDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Query parameters used to generate the report', type: VendorBalanceSummaryQueryResponseDto })
|
||||||
|
query: VendorBalanceSummaryQueryResponseDto;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Report metadata', type: VendorBalanceSummaryMetaDto })
|
||||||
|
meta: VendorBalanceSummaryMetaDto;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user