UNPKG

@accounter/shaam6111-generator

Version:

Fully typed application that generates, parses, and validates SHAAM 6111 tax reports.

48 lines (47 loc) 2.22 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.validateCode104 = validateCode104; exports.code104Description = code104Description; exports.validateCode400 = validateCode400; exports.code400Description = code400Description; const index_js_1 = require("../types/index.js"); function validateCode104(amounts, ifrsReportingOption = index_js_1.IFRSReportingOption.NONE) { // Rule 2.6: Validate code 104 if (ifrsReportingOption === index_js_1.IFRSReportingOption.OPTION_2_ADJUSTMENTS) { return amounts[100] + amounts[103] === amounts[104]; } return amounts[100] === amounts[104]; } function code104Description(ifrsReportingOption = index_js_1.IFRSReportingOption.NONE) { // Rule 2.6: Validate code 104 if (ifrsReportingOption === index_js_1.IFRSReportingOption.OPTION_2_ADJUSTMENTS) { return 'Code 104 must equal the sum of codes 100 and 103'; } return 'Code 104 must equal code 100'; } function validateCode400(amounts, ifrsReportingOption = index_js_1.IFRSReportingOption.NONE) { // Rule 2.7: Validate code 400 if (ifrsReportingOption === index_js_1.IFRSReportingOption.OPTION_1) { return amounts[100] + amounts[370] === amounts[400]; } if (ifrsReportingOption === index_js_1.IFRSReportingOption.OPTION_2_ADJUSTMENTS) { return amounts[100] + amounts[370] + amounts[103] === amounts[400]; } if (ifrsReportingOption === index_js_1.IFRSReportingOption.OPTION_3_ADJUSTMENTS) { return amounts[100] + amounts[370] + amounts[383] === amounts[400]; } return true; } function code400Description(ifrsReportingOption = index_js_1.IFRSReportingOption.NONE) { // Rule 2.7: Validate code 400 if (ifrsReportingOption === index_js_1.IFRSReportingOption.OPTION_1) { return 'Code 400 must equal the sum of codes 100 and 370'; } if (ifrsReportingOption === index_js_1.IFRSReportingOption.OPTION_2_ADJUSTMENTS) { return 'Code 400 must equal the sum of codes 100, 370, and 103'; } if (ifrsReportingOption === index_js_1.IFRSReportingOption.OPTION_3_ADJUSTMENTS) { return 'Code 400 must equal the sum of codes 100, 370, and 383'; } return ''; }