@salaxy/reports
Version:
Salaxy (Palkkaus.fi) reporting library
1,339 lines (1,283 loc) • 58.3 kB
TypeScript
import { AccountingData } from '@salaxy/core';
import { AuthorizationPdfParams } from '@salaxy/core';
import { Avatar } from '@salaxy/core';
import { CalcGroup } from '@salaxy/core';
import { Calculation } from '@salaxy/core';
import { CalendarDay } from '@salaxy/core';
import { CalendarMonth } from '@salaxy/core';
import { CalendarSeries } from '@salaxy/core';
import { Contact } from '@salaxy/core';
import { DateRange } from '@salaxy/core';
import { Invoice } from '@salaxy/core';
import { InvoiceListItem } from '@salaxy/core';
import { IrRow } from '@salaxy/core';
import { Language } from '@salaxy/core';
import { ReportType } from '@salaxy/core';
import { SummaryReportData } from '@salaxy/core';
import { WorkerSummaryReportData } from '@salaxy/core';
/**
* Mapper for accounting report.
*/
export declare class AccountingMapper {
/**
* Maps data to hbs supported report format
* @param data BusinessObject data for mapping
* @returns Mapped data
*/
static getAccountingReport(data: AccountingData): AccountingReport;
/**
* Creates HeaderFooterData from provided parameters
* @param businessObject AccountingData that
* @param options Report options
* @param lang gets translation with this lang, if null use current lang
* @returns HeaderFooterData for provided businessObject
*/
static getHeaderFooter(businessObject: AccountingData, options: ReportOptions, lang?: string): HeaderFooterData;
/**
* Creates ReporLayout object depending on switchToPortrait boolean
* @param switchToPortrait boolean indicating if layout should be portrait
* @returns ReportLayout object
*/
static getReportLayout(switchToPortrait: boolean, pdf?: boolean): ReportLayout;
}
/** Contains accounting data structured for easy rendering in reports. */
export declare interface AccountingReport extends AccountingData {
/** Accounting report result row displayed in report */
result?: IAccountingReportResultRow[] | null;
/** Optional data based dimension headers for report */
dimensionHeaders?: string[] | null;
/** Global pre defined dimension headers for report */
globalDimensions?: string[] | null;
}
/**
* Mapper for authorization.
*/
export declare class AuthorizationMapper {
/**
* Loads report type specific HeaderFooterData.
* @param reportOptions The AuthorizationPdf entity used to load the HeaderFooterData.
* @param lang gets translation with this lang, if null use current lang
* @returns Returns HeaderFooterData.
*/
static getHeaderFooter(reportOptions: ReportOptions, lang?: string): HeaderFooterData;
/**
* Loads report type specific HeaderFooterData.
* @param reportOptions The AuthorizationPdf entity used to load the HeaderFooterData.
* @param lang gets translation with this lang, if null use current lang
* @returns Returns HeaderFooterData.
*/
static getRaksaHeaderFooter(reportOptions: ReportOptions, lang?: string): HeaderFooterData;
/**
* Loads report type specific HeaderFooterData.
* @param reportOptions The AuthorizationPdf entity used to load the HeaderFooterData.
* @param lang gets translation with this lang, if null use current lang
* @returns Returns HeaderFooterData.
*/
static getKycHeaderFooter(reportOptions: ReportOptions, lang?: string): HeaderFooterData;
/**
* Loads the raw report that is then rendered downstream as an html or pdf report. Also handles if person or company
* @param businessObject Authorization entity
* @returns Authorization
*/
static getAuthorizationReport(businessObject: AuthorizationPdfParams): AuthorizationPdfParams;
/**
* Loads the authorization layout for pdf or html reports.
* @param pdf Are we rendering a pdf report or not.
* @returns Returns authorization layout.
*/
static loadReportLayout(pdf: boolean): ReportLayout;
}
/**
* Maps Calculation-object to report template ready objects.
*/
export declare class CalculationMapper {
/**
* Creates a new CalculationReport from the fiven Calculation.
* @param calc Calcuation for the report.
* @param reportType Report type.
*/
static getCalculationReport(calc: Calculation, reportType: ReportType, lang?: Language): CalculationReport;
/**
* Creates a new CalculationSummaryReport from the given calculations.
* @param calcs Calculations for the report.
* @param lang Language.
*/
static getCalculationSummaryReport(calcs: Calculation[], lang: Language): CalculationSummaryReport;
/**
* Creates HeaderFooterData from provided parameters
* @param type ReportType
* @param calc Calculation BusinessObject
* @param options ReportOptions
* @param lang gets translation with this lang, if null use current lang
* @returns Created HeaderFooterData
*/
static getHeaderFooter(type: ReportType, calc: Calculation, options: ReportOptions, lang?: Language): HeaderFooterData;
/**
* Creates HeaderFooterData from provided parameters
* @param calc Calculation BusinessObject
* @param options ReportOptions
* @param lang gets translation with this lang, if null use current lang
* @returns Created HeaderFooterData
*/
static getTotalReportHeaderFooter(calc: Calculation | Calculation[], options: ReportOptions, lang?: Language): HeaderFooterData;
/**
* Get ReportLayout for calculation
* @param isLandscape If true, the layout is rendered as landscape.
* @param pdf By default the mode is htmlPage. Set this to true to use pdf mode. This may affect some rendering details.
* @param watermark If provided, the watermark is shown in the report. Use "default" to show the default watermark ("SALAXY.REPORTS.document.preview").
* @returns Report task
*/
static getReportLayout(isLandscape?: boolean, pdf?: boolean, watermark?: string): ReportLayout;
/**
* Creates HeaderFooterData (for summaryreport) from provided parameters
* @param calcs Array of Calculation BusinessObjects
* @param reportOptions ReportOptions
* @param lang gets translation with this lang, if null use current lang
* @returns Created HeaderFooterData
*/
static getCalculationSummaryReportHeaderFooter(calcs: Calculation[], reportOptions: ReportOptions, lang?: Language): HeaderFooterData;
private static createSalarySlipRowGroups;
private static createEmployerReportRowGroups;
private static createPaymentReportRowGroups;
private static createHeader;
private static createSummaryHeader;
private static createValidationMessages;
private static createEmployerReportNotes;
private static createSalarySlipNotes;
private static createCumulativeData;
private static getPensionCompanyName;
private static isCompensation;
private static getEnum;
private static isRaksa;
private static calculateCalculationsResultsSummary;
private static summarizeField;
private static getYearlyChangingNumbers;
/** Current household deduction max amount. */
private static getHouseholdDeductionMaxAmount;
private static getHouseholdDeductionDeductible;
private static getTaxDeductionWorkCategories;
private static getHouseholdDeductionCategoriesExtended;
private static getPalkkausVatPercent;
private static displayVatPercent;
private static calculateVat;
private static calculatePriceExclVat;
}
/** Contains calculation data structured for easy rendering in reports. */
export declare interface CalculationReport {
/** Calculation report type. */
reportType?: ReportType | null;
/** Report header section. */
header?: CalculationReportHeader | null;
/** Cumulative data for the report. */
cumulative?: CalculationReportSimpleRow[] | null;
/** Report row groups. */
rowGroups?: ICalculationReportRowGroup[] | null;
/** Validation messages for the report. Contains for example deduction warnings. */
validationMessages?: CalculationReportText[] | null;
/** Returns true if the report has validation messages. */
readonly hasValidationMessages?: boolean | null;
/** Additional notes for the report. */
notes?: CalculationReportText[] | null;
/** Returns true if the report has notes. */
readonly hasNotes?: boolean | null;
}
/** Employer name and contact details for reports. */
export declare interface CalculationReportEmployer {
/** Finnish Business Identifier (Y-tunnus) for the company. */
businessId?: string | null;
/** Employer avatar. */
avatar?: Avatar | null;
/** Employer contact information. */
contact?: Contact | null;
}
/** Report header information for the report. Contains employer and worker details as well as further info about the work. */
export declare interface CalculationReportHeader {
/** Employer name and contact details. */
employer?: CalculationReportEmployer | null;
/** Worker name and contact details. */
worker?: CalculationReportWorker | null;
/** Start date of the work. */
workStartDate?: string | null;
/** End date of the work. */
workEndDate?: string | null;
/** Employment period: Start and potential end date of the employment relation. */
employmentPeriod?: DateRange | null;
/** Description of the work for reporting purposes. */
workDescription?: string | null;
/** The day when the total amount was paid by Employer to Palkkaus.fi */
paidAt?: string | null;
/** The estimated date for the salary in worker. */
salaryDate?: string | null;
/** The actual date for the salary in worker. */
requestedSalaryDate?: string | null;
/** Number of days may affect calculation of different payments calculated based on a Framework agreement. */
numberOfDays?: number | null;
/** If true, the worker has not given any tax card, 60% will be taken. */
workerHasNoTaxcard?: boolean | null;
/** If true, the employer is household and no withholding tax is deducted (less than 1500€/year/Worker). */
noWithholdingHousehold?: boolean | null;
/** Calculated tax percent. Please note this is a number between 0-1. */
taxPercent?: number | null;
/** Tax percent in the tax card. */
taxcardTaxPercent?: number | null;
/** Additional tax percent in the tax card. */
taxcardTaxPercent2?: number | null;
/** Income limit for the taxcard */
taxcardIncomeLimit?: number | null;
/** The cumulative income on the taxcard - including this calculation. Note that with shared taxcards, this may include income from other employers. */
taxcardCumulativeIncome?: number | null;
/** Salary slip message */
salarySlipMessage?: string | null;
/** TaxAtSource is being used */
isTaxAtSource?: boolean | null;
/** Tax at source deduction percent */
taxAtSourceDeductionPercent?: number | null;
}
/** CalculationReport implementation. */
export declare class CalculationReportImpl implements CalculationReport {
reportType: ReportType;
/** Report header section. */
header: CalculationReportHeader;
/** Report row groups. */
rowGroups: ICalculationReportRowGroup[];
/** Validation messages for the report. Contains for example deduction warnings. */
validationMessages: CalculationReportText[];
/** Returns true if the report has validation messages. */
get hasValidationMessages(): boolean;
/** Additional notes for the report. */
notes: CalculationReportText[];
/** Returns true if the report has notes. */
get hasNotes(): boolean;
/**
* Creates a new report.
* @param reportType Report type for the report.
*/
constructor(reportType: ReportType);
}
/** Extension to IR row for reporting purposes. */
export declare class CalculationReportRow<T extends ICalculationReportRowData> implements ICalculationReportRow {
data: T;
/** Contains sub rows. */
subRows: Array<CalculationReportRow<T>>;
private _mainRow;
/**
* Creates a new report row based on given row data.
* @param data The data for the row.
*/
constructor(data: T);
/** Level of the row in the row hierarchy. */
get level(): number;
/** Returns true if level is 0. */
get isLevel0(): boolean;
/** Returns true if level is 1. */
get isLevel1(): boolean;
/** Returns true if level is 2. */
get isLevel2(): boolean;
/** Returns true if level is 3. */
get isLevel3(): boolean;
/** Returns true if level is 4. */
get isLevel4(): boolean;
/** Boolean to indicate if this row has sub rows */
get hasSubRows(): boolean;
/** Sum of sub row totals. */
get subTotal(): number;
/** Parent row for this row. */
get mainRow(): CalculationReportRow<T>;
/** Parent row for this row. */
set mainRow(value: CalculationReportRow<T>);
}
/** Row group for calculation. Groups logically calculation rows. */
export declare class CalculationReportRowGroup<T extends ICalculationReportRow> implements ICalculationReportRowGroup {
/** Grouping for the row group. */
grouping: CalcGroup;
/** Grouping term */
get groupingTerm(): string;
/** Grouping term */
set groupingTerm(value: string);
/** Total term */
get totalTerm(): string;
/** Total term */
set totalTerm(value: string);
/** Additional ui data for the renderer */
params: any;
/** Returns true if the group has rows. */
get hasRows(): boolean;
/** Returns true if this is Deductions group. */
get isDeductions(): boolean;
/** Returns true if this is Totals group. */
get isTotals(): boolean;
/** Returns true if this is Benefits group. */
get isBenefits(): boolean;
/** Returns true if this is Expenses group. */
get isExpenses(): boolean;
/** Returns true if this is SalaryAdditions group. */
get isSalaryAdditions(): boolean;
/** Returns true if this is BaseSalary group. */
get isBaseSalary(): boolean;
/** Returns true if this is Disabled group. */
get isDisabled(): boolean;
/** Returns true if this is OtherNoPayment group. */
get isOtherNoPayment(): boolean;
/** Returns true if this is Undefined group. */
get isUndefined(): boolean;
/** Rows that are compatible with Incomes Register (tulorekisteri) process. */
rows: T[];
/** If true, the group is not visible in the report */
isHidden: boolean;
/** Group total. */
get total(): number;
/** Group total. */
set total(value: number | null);
/** Returns true if this the total field has value greater than 0. */
get hasTotalValue(): boolean;
private _groupingTerm;
private _totalTerm;
private _total?;
/** Constructor */
constructor(data: ICalculationReportRowGroupInput<T>);
}
/** A simple row for misc. tables in calculation. */
export declare interface CalculationReportSimpleRow {
/**
* Technical name / key for the cumulative field.
*/
key?: string | null;
/**
* Label for the row.
*/
label?: string | null;
/**
* Total for the row. This may later be extended with count and/or price.
*/
total?: number | null;
/**
* Additional data for the row.
*/
data?: {
[key: string]: any;
} | null;
/**
* Unit for the row.
*/
unit?: string | null;
}
/** Generic text object for the report. Contains heading, text and optional interpolation parameters. */
export declare interface CalculationReportText {
/** Heading for the text. */
heading?: string | null;
/** The actual content for the text. */
text?: string | null;
/** Parameters to be interpolated in the text. */
parameters?: {
[key: string]: any;
} | null;
}
/** Worker name and contact details for reports. */
export declare interface CalculationReportWorker {
/** The Person ID of the worker if known. */
socialSecurityNumberValid?: string | null;
/** Bank account number. */
ibanNumber?: string | null;
/** Employer avatar. */
avatar?: Avatar | null;
/** Worker contact information. */
contact?: Contact | null;
}
/**
* Calculation summary data for report rendering.
*/
declare interface CalculationSummaryReport extends CalculationReport {
header?: CalculationSummaryReportHeader;
}
/**
* Header data for CalculationSummaryReport.
*/
declare interface CalculationSummaryReportHeader extends CalculationReportHeader {
/** The number of workers on the report. */
workerCount?: number | null;
/** The number of calculations on the report. */
calculationCount?: number | null;
/** The total salary costa summarized from all the calculations on the report. */
totalSalaryCost?: number | null;
/** The total gross salary summarized from all the calculations on the report. */
totalGrossSalary?: number | null;
/** The total worker payment summarized from all the calculations on the report. */
totalWorkerPaymentLegacy?: number | null;
}
/** Row data for worker and employer calculation tables. */
export declare class CalculationTableRowData implements ICalculationReportRowData {
/** Ir row. */
irRow: IrRow;
/** Full total for the row. For example the original calculated version. */
fullTotal?: number;
/** Returns true if there is no enough money to pay the calculated amount. */
isTotalReduced?: boolean;
private _comment;
/** Constructor for creating row. */
constructor(data: ICalculationTableRowDataInput, lang?: Language);
/** Total amount. */
get total(): number;
/** Total amount. */
set total(value: number);
/** Returns true if the unit is percentage */
get isUnitPercent(): boolean;
/** Row further information. */
get comment(): string;
/** Row further information. */
set comment(value: string);
private getEnum;
}
/**
* The CalendarMapper class provides methods to generate and manipulate calendar data,
* including mapping months and series to a structured result, and loading report layouts
* and options for invoice reports.
*/
export declare class CalendarMapper {
/**
* Generates calendar data by mapping months and series to a structured result.
* @param {CalendarMonth[]} months - An array of calendar months to be processed.
* @param {CalendarSeries[]} series - An array of calendar series to be mapped to each month.
* @returns {CalendarResult} The structured calendar result containing mapped months with their respective days, series, title, and weeks.
*/
static getCalendarData(months: CalendarMonth[], series: CalendarSeries[]): CalendarResult;
/**
* Loads the invoice layout for pdf or html reports.
* @param pdf Are we rendering a pdf report or not.
* @returns Returns invoice layout.
*/
static loadReportLayout(pdf: boolean): ReportLayout;
/**
* Loads Invoice specific ReportOptions
* @returns ReportOptions for report
*/
static loadReportOptions(): ReportOptions;
private static getWeekNumbersForMonth;
}
/**
* Represents the result of a calendar mapping operation.
*/
export declare type CalendarResult = {
/** An array of mapped calendar months. */
months?: MappendCalendarMonth[];
};
/**
* Mapper for ESalary
*/
export declare class ESalaryMapper {
/**
* Maps input calc to hbs supported format
* @param businessObject calculation to be mapped
* @returns Extended calculation with eSalary property
*/
static getESalary(businessObject: Calculation): ESalaryReport;
/**
* get xml file name
* @returns name of eSalary xml name
*/
static getXmlFileName(): string;
/**
* Maps cumulative calculation to hbs supported format
* @param calc cumulative calculation
* @returns object containing array of current and previous earnings
*/
private static getCumulativeData;
private static addBenefitsToReportTotals;
}
/**
* Contains eSalary data structured for easy rendering in reports.
*
*/
export declare interface ESalaryReport extends Calculation {
/** Interface for hbs template data */
eSalaryHbs?: IESalaryHbs | null;
}
/**
* Represents a mapped calendar day with an additional background color property.
*/
export declare type ExtendedCalendarDay = CalendarDay & {
style?: string;
hasEvents?: boolean;
};
/**
* Represents an extended calendar series which includes a calendar day and an array of extended calendar days.
*/
export declare type ExtendedCalendarSeries = CalendarSeries & {
days: ExtendedCalendarDay[];
};
export declare const hbsTemplates: {
heartbeat: (data: any) => string;
accountingReport: (data: any) => string;
employerReportV2: (data: any) => string;
employerReportV2Page1: (data: any) => string;
paymentReportV2: (data: any) => string;
paymentSummaryReportV2: (data: any) => string;
salarySlipV2: (data: any) => string;
salarySlipV2Page1: (data: any) => string;
accountingReportHead: (data: any) => string;
accountingTable: (data: any) => string;
contractPartiesContactDetailsV2: (data: any) => string;
document: (data: any) => string;
employerCalculationAdditionalInfoV2: (data: any) => string;
employerCalculationTablesV2: (data: any) => string;
employerContractDetailsV2: (data: any) => string;
employerReportHeadV2: (data: any) => string;
page: (data: any) => string;
partial: (data: any) => string;
paymentReportHeadV2: (data: any) => string;
paymentSummaryReportHeadV2: (data: any) => string;
paymentTablesV2: (data: any) => string;
workerCalculationAdditionalInfoV2: (data: any) => string;
workerCalculationTablesV2: (data: any) => string;
workerContractDetailsV2: (data: any) => string;
workerCumulativeTables: (data: any) => string;
workerDeductionWarningsV2: (data: any) => string;
workerReportHeadV2: (data: any) => string;
defaultFooter: (data: any) => string;
defaultHeader: (data: any) => string;
img2: (data: any) => string;
logo: (data: any) => string;
pageNumber: (data: any) => string;
totalPages: (data: any) => string;
summaryReport: (data: any) => string;
summaryReportHead: (data: any) => string;
summaryReportTable: (data: any) => string;
authorizationPerson: (data: any) => string;
authorizationCompany: (data: any) => string;
authorizationRaksa: (data: any) => string;
iamPerson: (data: any) => string;
invoice: (data: any) => string;
invoiceHead: (data: any) => string;
invoiceTable: (data: any) => string;
kycCompany: (data: any) => string;
eSalary: (data: any) => string;
totalsReport: (data: any) => string;
totalsTables: (data: any) => string;
totalsHead: (data: any) => string;
workerSummaryReport: (data: any) => string;
workerSummaryReportHead: (data: any) => string;
workerSummaryReportTable: (data: any) => string;
invoiceList: (data: any) => string;
calendar: (data: any) => string;
};
/**
* Data that is avaible for the header and footer templates.
*/
export declare interface HeaderFooterData {
/** Logical report date, e.g. Salary date for salary slip. */
date?: string;
/** Printing date of the report. */
today?: string;
/** Report specific title, e.g. "Palkkalaskelma". */
title?: string;
/** Report specific sub title, e.g. "Palkkapäivä 1.6.2020". */
subTitle?: string;
/** The HTML for the logo in the header and/or footer */
logo?: string;
/** The HTML for the secondary image in the header and/or footer */
img2?: string;
}
/** Interface for result row. */
export declare interface IAccountingReportResultRow {
/** row account number */
accountNumber?: string | null;
/** row account name */
accountName?: string | null;
/** VAT */
vatPercent?: number | null;
/** row sum*/
sum?: number | null;
/** Dimensions of row */
dimensions?: {
[key: string]: number;
} | null;
}
/** Interface for report row. */
export declare interface ICalculationReportRow {
/** Level of the row in the row hierarchy. */
level?: number | null;
/** Sum of sub row totals. */
subTotal?: number | null;
}
/** Interface for report row data. */
export declare interface ICalculationReportRowData {
/** Total amount. */
total?: number | null;
}
/** Interface for report row group. */
export declare interface ICalculationReportRowGroup {
/** Group total. */
total?: number | null;
}
/** Row group for calculation. Groups logically calculation rows. */
export declare interface ICalculationReportRowGroupInput<T extends ICalculationReportRow> {
/** Grouping for the row group. */
grouping?: CalcGroup;
/** Grouping term */
groupingTerm?: string;
/** Total term */
totalTerm?: string;
/** Additional ui data for the renderer */
params?: any;
/** Rows that are compatible with Incomes Register (tulorekisteri) process. */
rows?: T[];
/** Group total. */
total?: number;
/** If true, the group is not visible in the report */
isHidden?: boolean | null;
}
/** Row data for worker and employer calculation tables. */
export declare interface ICalculationTableRowDataInput {
/** Ir row. */
irRow?: IrRow;
/** Full total for the row. For example the original calculated version. */
fullTotal?: number;
/** Returns true if there is no enough money to pay the calculated amount. */
isTotalReduced?: boolean;
/** Row further information. */
comment?: string;
}
/** Interface for eSalary bank account*/
export declare interface IESalaryBankAccount {
/** Bank account description */
heading?: string | null;
/** Account code description */
label?: string | null;
/** IBAN code without spaces */
value?: string | null;
/** Bic code */
bic?: string | null;
}
/** Interface for eSalary calculation bases*/
export declare interface IESalaryCalculationBases {
/** Payment information description */
heading?: string | null;
/** Salaryrates information */
salaryRates?: {
heading: string | null;
};
/** Taxation information */
taxationRates?: {
/** Taxation rate description */
heading?: string | null;
/** Deduction rates */
recordLabels?: {
/** Tax percent */
taxPercent: string | null;
/** Additional tax percent */
taxPercent2: string | null;
};
};
/** Label for income limit */
incomeLimitLabel?: string | null;
/** Income limit value */
incomeLimit?: string | null;
/** Label for taxcard validity */
taxcardValidityLabel?: string | null;
/** Taxcard value */
taxcardValidity?: string | null;
}
/** Interface for eSalary cumulative*/
export declare interface IESalaryCumulative {
/** Cumulative data heading */
heading?: string | null;
/** Current data */
current?: {
heading?: string | null;
data?: Array<{
label: string;
value: string;
}>;
} | null;
/** Previous data */
previous?: {
heading?: string | null;
data?: Array<{
label: string;
value: string;
}>;
} | null;
}
/** Interface for eSalary delivery*/
export declare interface IESalaryDelivery {
/** Sender element */
sender?: IESalarySender | null;
/** Recipient elemenet */
recipient?: IESalaryRecipient | null;
/** ESalary payoffice */
payOffice?: IESalaryPayOffice | null;
}
/** Interface for eSalary delivery channel. */
export declare interface IESalaryDeliveryChannel {
/** Delivery code */
deliveryMethodCode?: string | null;
/** Delivery location data. Bankcode: Unique bank identifier */
deliveryInfo?: {
bankCode: string;
} | null;
}
/** Interface for eSalary employee*/
export declare interface IESalaryEmployee {
/** Employee description */
heading?: string | null;
/** Employee identity */
identity?: {
label: string;
item: string;
} | null;
/** Employee employment date */
employmentDate?: {
label: string;
value: string;
} | null;
/** Classification information of job */
classification?: {
/** Classification description */
heading?: string | null;
/** Job title element */
jobTitle?: {
label?: string | null;
value?: string | null;
};
};
/** Name of employee */
employeeName?: {
foreName: string;
surName: string;
} | null;
}
/**
* Contains eSalary data structured for easy rendering in reports.
*
*/
export declare interface IESalaryHbs {
/** Esalary version */
version?: string | null;
/** Headerdata element*/
headerData?: IESalaryHeaderData | null;
/** Payperiod element */
payPeriod?: IESalaryPayPeriod | null;
/** Delivery element */
delivery?: IESalaryDelivery | null;
/** Employee element */
employee?: IESalaryEmployee | null;
/** Bank account element */
bankAccount?: IESalaryBankAccount | null;
/** Calculation bases element */
calculationBases?: IESalaryCalculationBases | null;
/** Pay details element */
payDetails?: IESalaryPayDetails | null;
/** Report element */
report?: CalculationReport | null;
/** Messages element */
messages?: IESalaryMessages | null;
/** Cumulative element */
cumulative?: IESalaryCumulative | null;
}
/** Interface for Esalary header data. */
export declare interface IESalaryHeaderData {
/** Unique payslip identifier */
messageId?: string | null;
/** report timestamp */
timestamp?: string | null;
/** Report title */
documentTitle?: string | null;
/** Report payment date */
payDate?: string | null;
/** Netpayment information */
netPayment?: {
label: string;
value: string;
} | null;
/** Name of payer */
payer?: string | null;
/** Payer info */
partyIdentifications?: Array<{
authority: string;
value: string;
}> | null;
/** Delivery channel information */
deliveryChannels?: IESalaryDeliveryChannel[] | null;
}
/** Interface for eSalary messages*/
export declare interface IESalaryMessages {
/** Messages description */
heading?: string | null;
/** Salaryslip message to worker */
salarySlipMessage?: {
label: string;
message: string;
} | null;
/** Transient messages */
transient?: {
heading: string;
} | null;
}
/** Interface for eSalary pay details*/
export declare interface IESalaryPayDetails {
/** Pay details description */
heading?: string | null;
}
/** Interface for eSalary pay office*/
export declare interface IESalaryPayOffice {
/** Name of pay office */
fullName?: string | null;
/** Pay office street address */
addressLine?: string | null;
/** Pay office postal code */
postalCode?: string | null;
/** Pay office post office */
postOffice?: string | null;
/** Countrycode of pay office */
countryCode?: string | null;
/** Telephone of pay office */
telephone?: Array<{
phoneNumber: string;
}> | null;
/** Pay office email */
emailAddress: string | null;
}
/** Interface for eSalary pay period. */
export declare interface IESalaryPayPeriod {
/** Pay period description */
heading?: string | null;
/** Payment date element */
dateOfPayment?: {
label: string;
date: string;
} | null;
/** Period dates element */
period?: {
label: string;
date: string;
} | null;
/** Periods dates of esalary */
periodDates?: IESalaryPeriodDates | null;
}
/** Interface for eSalary period dates */
export declare interface IESalaryPeriodDates {
/** Payperiod description */
label?: string | null;
/** Job description */
jobLabel?: string | null;
/** Message description */
messageLabel?: string | null;
/** Start date element */
startDate?: {
label: string;
date: string;
} | null;
/** Term date element */
termDate?: {
label: string;
date: string;
} | null;
}
/** Interface for eSalary recipient*/
export declare interface IESalaryRecipient {
/** Recipient description */
heading?: string;
/** Recipient name element */
recipientName?: {
foreName: string;
surName: string;
} | null;
/** Recipient street address */
addressLine?: string | null;
/** Recipient postal code */
postalCode?: string | null;
/** Recipient post office */
postOffice?: string | null;
/** Recipient country code */
countryCode?: string | null;
/** Recipient country */
country?: string | null;
}
/** Interface for eSalary sender*/
export declare interface IESalarySender {
/** Sender heading */
heading?: string | null;
/** Name of sender */
name?: string | null;
/** Street */
addressLine?: string | null;
/** Sender portal code */
postalCode?: string | null;
/** Sender post office */
postOffice?: string | null;
/** Sender country code */
countryCode?: string | null;
/** Sender country */
country?: string | null;
/** Sender telephone */
telephone?: Array<{
phoneNumber: string;
}> | null;
/** Sender email */
emailAddress?: string | null;
}
/**
* Mapper for InvoiceList.
*/
export declare class InvoiceListMapper {
/**
* Loads report type specific HeaderFooterData.
* @param businessObject - The array of invoice list items.
* @param reportOptions The ReportOptions entity used to load the HeaderFooterData.
* @param _lang gets translation with this lang, if null use current lang
* @returns Returns HeaderFooterData.
*/
static getHeaderFooter(businessObject: InvoiceListItem[], reportOptions: ReportOptions, _lang?: string): HeaderFooterData;
/**
* Loads the invoice layout for pdf or html reports.
* @param pdf Are we rendering a pdf report or not.
* @returns Returns invoice layout.
*/
static loadReportLayout(pdf: boolean): ReportLayout;
/**
* Retrieves a invoice list based on the provided business object.
* @param businessObject - The array of invoice list items.
* @param getDocumentAndSvgNode - A function that returns the document and SVG node.
* @returns A promise that resolves to an array of mapped invoices.
*/
static getInvoiceList(businessObject: InvoiceListItem[], getDocumentAndSvgNode: () => any): Promise<MappedInvoiceListItem[]>;
/**
* Loads InvoiceList specific ReportOptions
* @returns ReportOptions for report
*/
static loadReportOptions(): ReportOptions;
/**
* Calculates the invoice payment amount for a given invoice item.
* If the invoice item is of type "tax" or "union" and the total paid amount
* is different from the payment amount, it returns the rounded difference
* between the payment amount and the total paid amount.
* Otherwise, it returns the payment amount.
* @param {InvoiceListItem} item - The invoice item to calculate the payment for.
* @returns {number} - The calculated payment amount.
*/
private static getInvoicePayment;
private static getHeadingText;
private static createBarCode;
private static createQrCode;
}
/**
* Mapper for Invoice.
*/
export declare class InvoiceMapper {
/**
* Loads report type specific HeaderFooterData.
* @param businessObject The Invoice entity used to load the HeaderFooterData.
* @param reportOptions The ReportOptions entity used to load the HeaderFooterData.
* @param lang gets translation with this lang, if null use current lang
* @returns Returns HeaderFooterData.
*/
static getHeaderFooter(businessObject: Invoice, reportOptions: ReportOptions, lang?: string): HeaderFooterData;
/**
* Loads the raw report that is then rendered downstream as an html or pdf report.
* @param businessObject Invoice entity
* @returns Authorization
*/
static getInvoice(businessObject: Invoice, getDocumentAndSvgNode: () => any): Promise<MappedInvoice>;
private static getReferenceNumber;
private static getPayment;
private static createBarCode;
private static createQrCode;
private static isPreviewInvoice;
/**
* Loads the invoice layout for pdf or html reports.
* @param pdf Are we rendering a pdf report or not.
* @returns Returns invoice layout.
*/
static loadReportLayout(pdf: boolean): ReportLayout;
/**
* Loads Invoice specific ReportOptions
* @returns ReportOptions for report
*/
static loadReportOptions(businessObject: Invoice): ReportOptions;
}
/** Row data for payment tables. */
export declare interface IPaymentTableRowDataInput {
/** Name for the payment. */
label?: string;
/** Receiver of the payment. */
receiver?: string;
/** Base amount for the payment calculation. */
baseAmount?: number;
/** Worker part of the payment. */
workerPercent?: number;
/** Employer part of the payment. */
employerPercent?: number;
/** Total amount. */
total?: number;
/** Comment for the row. */
comment?: string;
}
/**
* Helper class used to create IrRowsReport config for sxy-table and create tableData for ExcelHelpers(ng1)
*/
export declare class IrRowsReportConfigGenerator {
/**
* Generates config for SxyTable component
* @param calcs Calculations for report
* @param lang Language for report
* @returns Configuration for SxyTable component
*/
static getConfig(calcs: Calculation[], lang: Language): {
options: any;
include: any[];
data: any[];
};
/** Generates tableData for ExcelHelpers.export (ng1) */
static getTableData(calcs: Calculation[], lang: Language): any[];
private static getIncomeType;
private static translateRowType;
}
/** Type used to present InvoiceMappers getInvoice() result */
export declare type MappedInvoice = {
/** Containing header related data */
header?: {
/** Date of invoice */
date: string | null;
/** Due date of invoice */
dueDate: string | null;
/** Payment reference (e.g. RF0710010831). Please note that in salary payment scenarios, this is not necessarily unique. */
referenceNumber: string | null;
/** The free text that is displayed / sent with the invoice. May have multiple lines. */
message?: string | null;
};
/** Containing total related data */
totals?: {
/** Total amount without vat */
totalExVat: number | null;
/** Total amount of vat */
totalVat: number | null;
/** Total amount with vat */
total: number | null;
/** Total amount of social security tax */
taxSocialSecurity: number | null;
/** Total amount of withholding tax */
taxWithholding: number | null;
/** Invoice total paid */
totalPaid?: number | null;
/** Invoice total remaining */
toBePaid?: number | null;
/** Helper for hbs template to show totalPaid and toBePaid */
showTotalPaid?: boolean | null;
};
/** Containing row related data */
rows?: {
/** Message (RowFreeText in Finvoice) is the message is mainly designed for accounting systems. */
message: string | null;
/** Name of the product or service. In the case of Salaxy salaries, this is language versioned text of CalculationRowType. */
articleName: string | null;
/** Count (DeliveredQuantity in Finvoice) is the quantity of product or service. */
count: number | null;
/** Price including VAT (UnitPriceVatIncludedAmount, Yksikköhinta verollinen) */
price: number | null;
/** Price of one product or service without Vat (UnitPriceAmount, Yksikköhinta veroton). Yksikköhinta voidaan ilmoittaa myös verollisena UnitPriceVatIncludedAmount- elementissä laskutuskäytännön ja verottajan ALV-ohjeistuksen mukaan. */
priceExVat: number | null;
/** Row total with VAT (RowAmount, Yhteensä verollinen) */
total: number | null;
/** Row total excluding VAT (RowVatExcludedAmount, Yhteensä veroton) */
totalExVat: number | null;
/** Vat percent related to the product or service (RowVatRatePercent, Alv%) */
vatPercent: number | null;
/** Suggested account number (RowNormalProposedAccountIdentifier). */
accountingAccountNumber: string | null;
/** Textual code for accounting mapping (RowProposedAccountText, Raportointikoodi). In Finvoice: "Accounting information agreed between seller and buyer." */
accountingCode: string | null;
}[];
/** Is this a preview invoice */
isPreview?: boolean | null;
/** Containing payer related data */
payer?: {
/** Name of payer */
name: string | null;
/** Official identifier of the party: Finnish HETU (Soc. sec. number) for a Person or Y-tunnus (Company ID for a company or association). */
officialId: string | null;
/** Street of payer */
street: string;
/** Postal code of payer */
postalCode: string;
/** City of payer */
city: string;
};
/** Containing recipient related data */
recipient?: {
/** Name of recipient */
name: string | null;
/**
* This is an official identifier of the party: Finnish Personal Id (HETU) for a Person or Company Id (Y-tunnus) for a company or association.
* WARNING: This is currently needed for Finvoice only (https://www.finanssiala.fi/finvoice/Sivut/default.aspx). As such we consider removing it from persons.
* Please inform if you use this property!
*/
officialId: string | null;
/** Street of recipient */
street: string | null;
/** Postal code of recipient */
postalCode: string | null;
/** City of recipient */
city: string | null;
/** The International Bank Account Number of the receiver. */
iban: string | null;
/** Bic of recipient */
bic: string | null;
};
/** Barcode string, svg */
barcode?: string | null;
/** QrCode, data url */
qrCode?: string | null;
};
/** Represents a mapped invoice list item. */
export declare type MappedInvoiceListItem = {
/** The heading of the invoice */
heading: string;
/** The IBAN of the receiver */
iban: string;
/** The name of the receiver. */
nameOfReceiver: string;
/** The due date of the invoice. */
dueDate: string;
/** The label for the reference or message. */
referenceOrMessageLabel: string;
/** The due date of the invoice. */
referenceOrMessageValue: string;
/** The payment amount. */
payment: number;
/** The total amount paid. */
totalPaid: number;
/** Indicates if the total amount has been paid. */
isTotalPaid: boolean;
/** The payable amount. */
payable: number;
/** The status text of the invoice. */
statusText: string;
/** The SVG representation of the QR code. */
qrCodeSvg: string;
/** The barcode of the invoice. */
barcode: string;
/** The SVG representation of the barcode. */
barcodeSvg: string;
/** Indicates if the invoice has been paid. */
isPaid: boolean;
/** Indicates if the invoice has been canceled. */
isCanceled: boolean;
/** Indicates if the invoice is in preview mode. */
isPreview: boolean;
/** The display date of the invoice. */
displayDate: string;
/** The text for unpaid invoices. */
unPaidText: string;
/** Indicates if the QR code is available. */
qrCodeAvailable: boolean;
/** Indicates if the QR code is unavailable. */
qrCodeUnavailable: boolean;
/** The end date of the invoice. */
endAt: string;
};
/**
* Represents a mapped calendar month.
*/
export declare type MappendCalendarMonth = {
/** The title of the calendar month. */
title: string;
/** An array of mapped calendar days. */
days: ExtendedCalendarDay[];
/** An array of calendar series. */
series: ExtendedCalendarSeries[];
/** An array of weeknumbers in month. */
weeks: {
weekNumber: number;
colspan: number;
}[];
};
/** Row data for payment tables. */
export declare class PaymentTableRowData implements ICalculationReportRowData {
/** Name for the payment. */
label: string;
/** Receiver of the payment. */
receiver: string;
/** Base amount for the payment calculation. */
baseAmount?: number;
/** Worker part of the payment. */
workerPercent?: number;
/** Employer part of the payment. */
employerPercent?: number;
/** Total amount. */
total: number;
/** Comment for the row. */
comment?: string;
/** Constructor */
constructor(data: IPaymentTableRowDataInput);
}
/** Data that the templates use for rendering the report */
export declare interface ReportData<T> {
/** Data that can be used in Header and footer */
headerFooter?: HeaderFooterData;
/** Layout and rendering related data: CSS etc. */
layout?: ReportLayout;
/** The actual payload: The report specific data. */
report: T;
/** Header Html*/
headerHtml?: string;
/** Footer Html*/
footerHtml?: string;
}
/** Template-level data about the layout / Rendering data */
export declare interface ReportLayout {
/** If true, the report instance has custom embedded CSS */
hasCustomCss?: boolean;
/**
* Contains custom CSS that should be used in report rendering.
* This CSS is included directly as HTML: It is not a path to external files.
*/
customCss?: string;
/** This should probably remain, but consider another root property */
date?: string;
/**
* Text to show as watermark text in the report. In the api requests, you may use text "default" to show the default watermark ("SALAXY.REPORTS.document.preview").
* Note that only some reports currently support the watermark (as of writing, the calculation reports).
*/
watermark?: string;
/**
* In the HBS template, this is used as a marker that the watermark text should be shown.
* NOTE that this property is not respected in API controller requests as it is used as flag for saving on the Salaxy server-side.
* Instead, set the `watermark` property to "default".
*/
isPreview?: boolean;
/** TODO: Sync this (and HTML / CSS that it affects) with ReportOptions.landscape */
layout?: string;
/** TODO: Sync this (and HTML / CSS that it affects) with ReportOptions.landscape */
isLayoutA4Portrait?: boolean;
/** Landscape */
isLayoutA4Landscape?: boolean;
/** TODO: Check the semantics of this with the new infra. */
mode?: "pdf" | "htmlPage";
/** TODO: Check the semantics of this with the new infra. */
isModeHtmlPage?: boolean;
/** TODO: Check the semantics of this with the new infra. */
isModePdf?: boolean;
/** This should probably remain, but consider another root property */
baseUrl?: string;
/** Page margins */
margin?: {
/** Top margin. */
top?: string | number;
/** Right margin. */
right?: string | number;
/** Bottom margin. */
bottom?: string | number;
/** Left margin. */
left?: string | number;
};
}
/** Report options that would be editable by partner / customer. */
export declare interface ReportOptions {
/**
* HTML template for the print header.
* Should add following handlebars tags to inject values into them:
* - `{{ date }}` Logical report date, e.g. Salary date for salary slip.
* - `{{ today }}` Printing date of the report.
* - `{{ title }}` Report specific title, e.g. "Palkkalaskelma".
* - `{{ subTitle}}` Report specific sub title, e.g. "Palkkapäivä 1.6.2020".
* - `{{> pageNumber }}` Current page number. Rendered as SPAN element.
* - `{{> totalPages }}` total pages in the document. Rendered as SPAN elem