@accounter/server
Version:
Accounter GraphQL server
41 lines (40 loc) • 1.83 kB
TypeScript
import type { Injector } from 'graphql-modules';
import type { AccountantStatus, Pcn874RecordType } from '../../../__generated__/types.js';
import { type Currency } from '../../../shared/enums.js';
import type { IGetChargesByIdsResult } from '../../charges/types.js';
import type { IGetDocumentsByFiltersResult } from '../../documents/types.js';
import type { IGetBusinessesByIdsResult } from '../../financial-entities/types.js';
export type VatReportRecordSources = {
charge: IGetChargesByIdsResult;
doc: IGetDocumentsByFiltersResult;
business: IGetBusinessesByIdsResult;
};
export type RawVatReportRecord = {
localAmountBeforeVAT?: number;
foreignAmountBeforeVAT?: number;
businessId: string | null;
chargeAccountantStatus: AccountantStatus;
chargeDate: Date;
chargeId: string;
currencyCode: Currency;
documentAmount: string;
documentId: string;
documentDate: Date | null;
documentSerial: string | null;
documentUrl: string | null;
eventLocalAmount?: number;
isExpense: boolean;
isProperty: boolean;
roundedVATToAdd?: number;
foreignVat: number | null;
localVat: number | null;
foreignVatAfterDeduction?: number;
localVatAfterDeduction?: number;
vatNumber?: string | null;
allocationNumber?: string | null;
pcn874RecordType?: Pcn874RecordType;
};
export declare const MONTHLY_VAT_AMOUNT_TOLERANCE = 0.01;
export declare function calculateMonthlyVatTotalAmount(incomeRecords: Array<RawVatReportRecord>, expenseRecords: Array<RawVatReportRecord>): number;
export declare function isWithinMonthlyVatAmountTolerance(expectedVatAmount: number, transactionsAmount: number, tolerance?: number): boolean;
export declare function adjustTaxRecord(rawRecord: VatReportRecordSources, injector: Injector): Promise<RawVatReportRecord>;