@silexpert/core 1.1.30 → 1.1.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -20,7 +20,7 @@ const vatDocuments = [{
20
20
  name: '3310',
21
21
  century: '23',
22
22
  centuries: [2022, 2023, 2024, 2025],
23
- payload: (accountingEntries, payload) => (0, _century.getCerfa3310Century23Payload)(accountingEntries, payload),
23
+ payload: (accountingEntries, payload, updatedEntries) => (0, _century.getCerfa3310Century23Payload)(accountingEntries, payload, updatedEntries),
24
24
  asponePayload: data => (0, _century.getCerfa3310Century23RegistrationFields)(data),
25
25
  fields: _century.cerfa3310Century23Fields,
26
26
  fileName: '3310-2023',
@@ -1 +1 @@
1
- {"version":3,"file":"centuries.js","names":["_dayjs","require","dayjs","_interopRequireWildcard","_CerfaType","_century","_century2","_century3","_century4","_century5","_century6","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","vatDocuments","idCerfaType","CerfaType","CERFA_3310","name","century","centuries","payload","accountingEntries","getCerfa3310Century23Payload","asponePayload","data","getCerfa3310Century23RegistrationFields","fields","cerfa3310Century23Fields","fileName","annex","shouldInclude","_a","Boolean","credit","refundAsked","amount","getCerfa3519Century17Payload","getCerfa3519Century23RegistrationFields","cerfa3519Century17Fields","CERFA_3514","getCerfa3514Century22Payload","getCerfa3514Century23RegistrationFields","cerfa3514Century22Fields","CERFA_3517","getCerfa3517Century23Payload","getCerfa3517CenturyRegistrationField","cerfa3517Century23Fields","getVatCerfaObject","exports","startDate","year","format","cerfa","find","v","c","Error"],"sources":["../../../ts/utils/vat/centuries.ts"],"sourcesContent":["import * as dayjs from 'dayjs';\nimport { CerfaType } from '../../types/Enum/CerfaType';\nimport { VatDocument } from '../../types/Interface/api/cerfa/ReadCerfa';\nimport { cerfa3310Century23Fields, getCerfa3310Century23Payload, getCerfa3310Century23RegistrationFields } from './3310/century23';\nimport { IAccountingEntry } from '../../types/Interface/models/IAccountingEntry';\nimport { Cerfa3310_2023, PayloadCerfa3310_2023 } from '../../types/Interface/api/cerfa/3310';\nimport {\n Cerfa3514_2022, Cerfa3519_2017, PayloadCerfa3514_2022, PayloadCerfa3519_2017,\n} from '../../types';\nimport { cerfa3519Century17Fields, getCerfa3519Century17Payload } from './3519/century17';\nimport { getCerfa3519Century23RegistrationFields } from './3519/century23';\nimport { cerfa3514Century22Fields, getCerfa3514Century22Payload } from './3514/century22';\nimport { getCerfa3514Century23RegistrationFields } from './3514/century23';\nimport { Cerfa3517_2023, PayloadCerfa3517_2023 } from '../../types/Interface/api/cerfa/3517';\nimport { cerfa3517Century23Fields, getCerfa3517Century23Payload, getCerfa3517CenturyRegistrationField } from './3517/century23';\n\nconst vatDocuments: VatDocument[] = [\n {\n idCerfaType: CerfaType.CERFA_3310,\n name: '3310',\n century: '23',\n centuries: [2022, 2023, 2024, 2025],\n payload: (accountingEntries: IAccountingEntry[], payload: PayloadCerfa3310_2023) => getCerfa3310Century23Payload(accountingEntries, payload),\n asponePayload: (data: Cerfa3310_2023) => getCerfa3310Century23RegistrationFields(data),\n fields: cerfa3310Century23Fields,\n fileName: '3310-2023',\n annex: {\n name: '3519',\n century: '23',\n shouldInclude: (data: Cerfa3310_2023) => Boolean(data.credit?.refundAsked && data.credit.refundAsked > 0),\n payload: (amount: number, payload: PayloadCerfa3519_2017) => getCerfa3519Century17Payload(amount, payload),\n asponePayload: (data: Cerfa3519_2017) => getCerfa3519Century23RegistrationFields(data),\n fields: cerfa3519Century17Fields,\n fileName: '3519-2017',\n },\n },\n {\n idCerfaType: CerfaType.CERFA_3514,\n name: '3514',\n century: '23',\n centuries: [2022, 2023, 2024, 2025],\n payload: (payload: PayloadCerfa3514_2022) => getCerfa3514Century22Payload(payload),\n asponePayload: (data: Cerfa3514_2022) => getCerfa3514Century23RegistrationFields(data),\n fields: cerfa3514Century22Fields,\n fileName: '3514-2022',\n },\n {\n idCerfaType: CerfaType.CERFA_3517,\n name: '3517',\n century: '23',\n centuries: [2022, 2023, 2024, 2025],\n payload: (accountingEntries: IAccountingEntry[], payload: PayloadCerfa3517_2023) => getCerfa3517Century23Payload(accountingEntries, payload),\n asponePayload: (data: Cerfa3517_2023) => getCerfa3517CenturyRegistrationField(data),\n fields: cerfa3517Century23Fields,\n fileName: '3517-2023',\n },\n];\n\nexport const getVatCerfaObject = (idCerfaType: CerfaType, startDate: string): VatDocument => {\n const year = +dayjs(startDate).format('YYYY');\n\n const cerfa = vatDocuments.find((v) => v.idCerfaType === idCerfaType && v.centuries.find((c) => c === year));\n if (!cerfa) throw new Error(`Cerfa type #${idCerfaType} with century ${year} is not managed yet.`);\n\n return cerfa;\n};"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAA+B,IAAnBC,KAAK,GAAAC,uBAAA,CAAAH,MAAA;AACjB,IAAAI,UAAA,GAAAH,OAAA;AAEA,IAAAI,QAAA,GAAAJ,OAAA;AAMA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AACA,IAAAQ,SAAA,GAAAR,OAAA;AAEA,IAAAS,SAAA,GAAAT,OAAA;AAAgI,SAAAU,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAT,wBAAAa,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,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AAEmC,SAAiB,KAAiB;EAC1F,MAAMC,IAAI,GAAG,CAACpE,KAAK,CAACmE,SAAS,CAAC,CAACE,MAAM,CAAC,MAAM,CAAC;EAE7C,MAAMC,KAAK,GAAGvC,YAAY,CAACwC,IAAI,CAAEC,CAAC,IAAKA,CAAC,CAACxC,WAAW,KAAKA,WAAW,IAAIwC,CAAC,CAACnC,SAAS,CAACkC,IAAI,CAAEE,CAAC,IAAKA,CAAC,KAAKL,IAAI,CAAC,CAAC;EAC5G,IAAI,CAACE,KAAK,EAAE,MAAM,IAAII,KAAK,CAAC,eAAe1C,WAAW,iBAAiBoC,IAAI,sBAAsB,CAAC;EAElG,OAAOE,KAAK;AACd,CAAC"}
1
+ {"version":3,"file":"centuries.js","names":["_dayjs","require","dayjs","_interopRequireWildcard","_CerfaType","_century","_century2","_century3","_century4","_century5","_century6","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","vatDocuments","idCerfaType","CerfaType","CERFA_3310","name","century","centuries","payload","accountingEntries","updatedEntries","getCerfa3310Century23Payload","asponePayload","data","getCerfa3310Century23RegistrationFields","fields","cerfa3310Century23Fields","fileName","annex","shouldInclude","_a","Boolean","credit","refundAsked","amount","getCerfa3519Century17Payload","getCerfa3519Century23RegistrationFields","cerfa3519Century17Fields","CERFA_3514","getCerfa3514Century22Payload","getCerfa3514Century23RegistrationFields","cerfa3514Century22Fields","CERFA_3517","getCerfa3517Century23Payload","getCerfa3517CenturyRegistrationField","cerfa3517Century23Fields","getVatCerfaObject","exports","startDate","year","format","cerfa","find","v","c","Error"],"sources":["../../../ts/utils/vat/centuries.ts"],"sourcesContent":["import * as dayjs from 'dayjs';\nimport { CerfaType } from '../../types/Enum/CerfaType';\nimport { VatDocument } from '../../types/Interface/api/cerfa/ReadCerfa';\nimport { cerfa3310Century23Fields, getCerfa3310Century23Payload, getCerfa3310Century23RegistrationFields } from './3310/century23';\nimport { IAccountingEntry } from '../../types/Interface/models/IAccountingEntry';\nimport { Cerfa3310_2023, PayloadCerfa3310_2023 } from '../../types/Interface/api/cerfa/3310';\nimport {\n Cerfa3514_2022, Cerfa3519_2017, PayloadCerfa3514_2022, PayloadCerfa3519_2017, UpdatedAnnotation,\n} from '../../types';\nimport { cerfa3519Century17Fields, getCerfa3519Century17Payload } from './3519/century17';\nimport { getCerfa3519Century23RegistrationFields } from './3519/century23';\nimport { cerfa3514Century22Fields, getCerfa3514Century22Payload } from './3514/century22';\nimport { getCerfa3514Century23RegistrationFields } from './3514/century23';\nimport { Cerfa3517_2023, PayloadCerfa3517_2023 } from '../../types/Interface/api/cerfa/3517';\nimport { cerfa3517Century23Fields, getCerfa3517Century23Payload, getCerfa3517CenturyRegistrationField } from './3517/century23';\n\nconst vatDocuments: VatDocument[] = [\n {\n idCerfaType: CerfaType.CERFA_3310,\n name: '3310',\n century: '23',\n centuries: [2022, 2023, 2024, 2025],\n payload: (accountingEntries: IAccountingEntry[], payload: PayloadCerfa3310_2023, updatedEntries: UpdatedAnnotation) => getCerfa3310Century23Payload(accountingEntries, payload, updatedEntries),\n asponePayload: (data: Cerfa3310_2023) => getCerfa3310Century23RegistrationFields(data),\n fields: cerfa3310Century23Fields,\n fileName: '3310-2023',\n annex: {\n name: '3519',\n century: '23',\n shouldInclude: (data: Cerfa3310_2023) => Boolean(data.credit?.refundAsked && data.credit.refundAsked > 0),\n payload: (amount: number, payload: PayloadCerfa3519_2017) => getCerfa3519Century17Payload(amount, payload),\n asponePayload: (data: Cerfa3519_2017) => getCerfa3519Century23RegistrationFields(data),\n fields: cerfa3519Century17Fields,\n fileName: '3519-2017',\n },\n },\n {\n idCerfaType: CerfaType.CERFA_3514,\n name: '3514',\n century: '23',\n centuries: [2022, 2023, 2024, 2025],\n payload: (payload: PayloadCerfa3514_2022) => getCerfa3514Century22Payload(payload),\n asponePayload: (data: Cerfa3514_2022) => getCerfa3514Century23RegistrationFields(data),\n fields: cerfa3514Century22Fields,\n fileName: '3514-2022',\n },\n {\n idCerfaType: CerfaType.CERFA_3517,\n name: '3517',\n century: '23',\n centuries: [2022, 2023, 2024, 2025],\n payload: (accountingEntries: IAccountingEntry[], payload: PayloadCerfa3517_2023) => getCerfa3517Century23Payload(accountingEntries, payload),\n asponePayload: (data: Cerfa3517_2023) => getCerfa3517CenturyRegistrationField(data),\n fields: cerfa3517Century23Fields,\n fileName: '3517-2023',\n },\n];\n\nexport const getVatCerfaObject = (idCerfaType: CerfaType, startDate: string): VatDocument => {\n const year = +dayjs(startDate).format('YYYY');\n\n const cerfa = vatDocuments.find((v) => v.idCerfaType === idCerfaType && v.centuries.find((c) => c === year));\n if (!cerfa) throw new Error(`Cerfa type #${idCerfaType} with century ${year} is not managed yet.`);\n\n return cerfa;\n};"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAA+B,IAAnBC,KAAK,GAAAC,uBAAA,CAAAH,MAAA;AACjB,IAAAI,UAAA,GAAAH,OAAA;AAEA,IAAAI,QAAA,GAAAJ,OAAA;AAMA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AACA,IAAAQ,SAAA,GAAAR,OAAA;AAEA,IAAAS,SAAA,GAAAT,OAAA;AAAgI,SAAAU,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAT,wBAAAa,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAA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MmB,iBAAiB,GAAAC,OAAA,CAAjBD,iBAAiB,GAAG,CAAClC,WAAsB,EAAEoC,SAAiB,KAAiB;EAC1F,MAAMC,IAAI,GAAG,CAACrE,KAAK,CAACoE,SAAS,CAAC,CAACE,MAAM,CAAC,MAAM,CAAC;EAE7C,MAAMC,KAAK,GAAGxC,YAAY,CAACyC,IAAI,CAAEC,CAAC,IAAKA,CAAC,CAACzC,WAAW,KAAKA,WAAW,IAAIyC,CAAC,CAACpC,SAAS,CAACmC,IAAI,CAAEE,CAAC,IAAKA,CAAC,KAAKL,IAAI,CAAC,CAAC;EAC5G,IAAI,CAACE,KAAK,EAAE,MAAM,IAAII,KAAK,CAAC,eAAe3C,WAAW,iBAAiBqC,IAAI,sBAAsB,CAAC;EAElG,OAAOE,KAAK;AACd,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@silexpert/core",
3
- "version": "1.1.30",
3
+ "version": "1.1.34",
4
4
  "description": "Silex Core perform HTTP Request and object binding. Silex core helps developers to retrieve and return formatted object",
5
5
  "homepage": "https://gitlab.compta-clementine.fr/dev/silex-api",
6
6
  "main": "js/index.js",
@@ -26,6 +26,7 @@ export interface ReadRegistrationTick {
26
26
  }
27
27
 
28
28
  export interface ReadVatEntry {
29
+ isAsset: boolean;
29
30
  idVat: number | null;
30
31
  account: IAccount | null;
31
32
  totalTaxIncluded: number;
@@ -38,4 +39,6 @@ export interface ReadVatEntry {
38
39
  entry?: IAccountingEntry
39
40
  }
40
41
 
41
- export type UpdatedAnnotation = Array<{ old: IAccountingEntry[]; new: IAccountingEntry[] }>;
42
+ export type UpdatedAnnotationObject = { old: IAccountingEntry[]; new: IAccountingEntry[] };
43
+
44
+ export type UpdatedAnnotation = UpdatedAnnotationObject[];
@@ -1,14 +1,14 @@
1
1
  import * as dayjs from 'dayjs';
2
2
  import { isDefined } from 'class-validator';
3
- import { round as _round, flatten } from 'lodash';
3
+ import { round as _round, flatten, uniqBy } from 'lodash';
4
4
  import { IAccountingEntry } from '../../../types/Interface/models/IAccountingEntry';
5
5
  import { Cerfa3310_2023, PayloadCerfa3310_2023 } from '../../../types/Interface/api/cerfa/3310';
6
6
  import { Vat } from '../../../types/Enum/Vat';
7
7
  import { getAmountByAccountNumber, getTaxAmountByAccountNumber, textFormatting } from '../utils';
8
8
  import { AsponeFormFields, CerfaPayloadForm } from '../../../types/Interface/api/cerfa/ReadCerfa';
9
- import { ReadVatDeclarationUpdatedEntry } from '../../../types/Interface/api/vatDeclaration/ReadVatDeclaration';
9
+ import { UpdatedAnnotation } from '../../../types/Interface/api/registration/ReadRegistration';
10
10
 
11
- export function getCerfa3310Century23Payload(accountingEntries: IAccountingEntry[], payload: PayloadCerfa3310_2023, updatedEntries: ReadVatDeclarationUpdatedEntry[] = []): Cerfa3310_2023 {
11
+ export function getCerfa3310Century23Payload(accountingEntries: IAccountingEntry[], payload: PayloadCerfa3310_2023, updatedEntries: UpdatedAnnotation = []): Cerfa3310_2023 {
12
12
  const shouldHaveVatCode = isDefined(payload.setting?.tvaCode) && isDefined(payload.society.siret);
13
13
  const vats = Object.values(Vat);
14
14
 
@@ -18,10 +18,10 @@ export function getCerfa3310Century23Payload(accountingEntries: IAccountingEntry
18
18
  const withoutTaxVat = vats.filter((v) => v.value === 0).map((v) => v.id);
19
19
  const importationVat = vats.filter((v) => v.isVatImportation && !v.isVatIntracom).map((v) => v.id);
20
20
 
21
- const vatEntries = accountingEntries.filter((ae) => typeof ae.idVat === 'number') as Array<IAccountingEntry & { idVat: number }>;
21
+ const vatEntries = uniqBy(accountingEntries.filter((ae) => typeof ae.idVat === 'number'), 'id') as Array<IAccountingEntry & { idVat: number }>;
22
22
 
23
- const oldEntries = flatten(updatedEntries?.map((u) => u.old.entries));
24
- const newEntries = flatten(updatedEntries?.map((u) => u.new.entries));
23
+ const oldEntries = flatten(updatedEntries?.map((u) => u.old));
24
+ const newEntries = flatten(updatedEntries?.map((u) => u.new));
25
25
 
26
26
  const collectedOldAmount = getAmountByAccountNumber(oldEntries, ['4457'], 0);
27
27
  const collectedNewAmount = getAmountByAccountNumber(newEntries, ['4457'], 0);
@@ -62,6 +62,7 @@ export function getCerfa3310Century23Payload(accountingEntries: IAccountingEntry
62
62
  // TVA brute
63
63
  const normalRate = getAmountByAccountNumber(taxedServicesEntries.filter((e) => vats.filter((v) => v.value === 20).map((v) => v.id).includes(e.idVat)), servicesAccounts, 0, true)
64
64
  + getAmountByAccountNumber(intracommunityServiceEntries.filter((e) => vats.filter((v) => v.value === 20).map((v) => v.id).includes(e.idVat)), ['6'], 0, true);
65
+
65
66
  const normalRateTax = _round(normalRate * 0.2);
66
67
 
67
68
  const reducedRate5Dot5 = getAmountByAccountNumber(taxedServicesEntries.filter((e) => vats.filter((v) => v.value === 5.5).map((v) => v.id).includes(e.idVat)), servicesAccounts, 0, true)
@@ -1,6 +1,6 @@
1
1
  import * as dayjs from 'dayjs';
2
2
  import { isDefined } from 'class-validator';
3
- import { round as _round } from 'lodash';
3
+ import { round as _round, uniqBy } from 'lodash';
4
4
  import { Cerfa3517_2023, PayloadCerfa3517_2023 } from '../../../types/Interface/api/cerfa/3517';
5
5
  import { IAccountingEntry } from '../../../types/Interface/models/IAccountingEntry';
6
6
  import { Vat } from '../../../types/Enum/Vat';
@@ -13,13 +13,14 @@ export function getCerfa3517Century23Payload(accountingEntries: IAccountingEntry
13
13
  const isNil = payload.isNil === true;
14
14
  const vats = Object.values(Vat);
15
15
 
16
- const vatEntries = accountingEntries.filter((ae) => typeof ae.idVat === 'number') as Array<IAccountingEntry & { idVat: number }>;
16
+ const vatEntries = uniqBy(accountingEntries.filter((ae) => typeof ae.idVat === 'number'), 'id') as Array<IAccountingEntry & { idVat: number }>;
17
17
 
18
18
  const withoutTaxVat = vats.filter((v) => v.value === 0).map((v) => v.id);
19
19
  const intracomVat = vats.filter((v) => v.isVatIntracom && !v.isVatImportation).map((v) => v.id);
20
20
  const frenchVat = vats.filter((v) => !v.isVatImportation && !v.isVatIntracom).map((v) => v.id);
21
+ const importationVat = vats.filter((v) => v.isVatImportation && !v.isVatIntracom).map((v) => v.id);
21
22
 
22
- const taxedOperationsAccounts = ['701', '702', '703', '704', '705', '706', '707', '708'];
23
+ const taxedOperationsAccounts = ['701', '702', '703', '704', '705', '706', '707', '708', '472'];
23
24
 
24
25
  const vatNormalRate20 = getAmountByAccountNumber(vatEntries.filter((ae) => ae.idVat === Vat.TX_20.id), taxedOperationsAccounts, 0, true);
25
26
  const vatReducedRate5Dot5 = getAmountByAccountNumber(vatEntries.filter((ae) => ae.idVat === Vat.TX_5_5.id), taxedOperationsAccounts, 0, true);
@@ -34,12 +35,12 @@ export function getCerfa3517Century23Payload(accountingEntries: IAccountingEntry
34
35
 
35
36
  const saleOfImmobilization = getAmountByAccountNumber(vatEntries.filter((ae) => !withoutTaxVat.includes(ae.idVat) && frenchVat.includes(ae.idVat)), ['775'], 0, true);
36
37
 
37
- const onInvoiceDeductible = getAmountByAccountNumber(vatEntries, ['445660'], 0, true);
38
- const onImmobilizationDeductible = getAmountByAccountNumber(vatEntries, ['44562'], 0, true);
38
+ const onInvoiceDeductible = getTaxAmountByAccountNumber(vatEntries.filter(ae => !importationVat.includes(ae.idVat)), ['6']);
39
+ const onImmobilizationDeductible = getTaxAmountByAccountNumber(vatEntries, ['2']);
39
40
 
40
- const julyAdvance: IRegistration | null = payload?.exerciceAdvanceRegistrations?.find((a) => dayjs(a.endDate).month() === 6) ?? null;
41
+ const julyAdvance: IRegistration | null = payload?.exerciceAdvanceRegistrations?.find((a) => [5, 6].includes(dayjs(a.endDate).month())) ?? null;
41
42
  const julyAdvancePayload: Cerfa3514_2022 | null = julyAdvance?.payload?.cerfa3514 ?? null;
42
- const decemberAdvance: IRegistration | null = payload?.exerciceAdvanceRegistrations?.find((a) => dayjs(a.endDate).month() === 11) ?? null;
43
+ const decemberAdvance: IRegistration | null = payload?.exerciceAdvanceRegistrations?.find((a) => [10, 11].includes(dayjs(a.endDate).month())) ?? null;
43
44
  const decemberAdvancePayload: Cerfa3514_2022 | null = decemberAdvance?.payload?.cerfa3514 ?? null;
44
45
 
45
46
  const data:Cerfa3517_2023 = {
@@ -5,7 +5,7 @@ import { cerfa3310Century23Fields, getCerfa3310Century23Payload, getCerfa3310Cen
5
5
  import { IAccountingEntry } from '../../types/Interface/models/IAccountingEntry';
6
6
  import { Cerfa3310_2023, PayloadCerfa3310_2023 } from '../../types/Interface/api/cerfa/3310';
7
7
  import {
8
- Cerfa3514_2022, Cerfa3519_2017, PayloadCerfa3514_2022, PayloadCerfa3519_2017,
8
+ Cerfa3514_2022, Cerfa3519_2017, PayloadCerfa3514_2022, PayloadCerfa3519_2017, UpdatedAnnotation,
9
9
  } from '../../types';
10
10
  import { cerfa3519Century17Fields, getCerfa3519Century17Payload } from './3519/century17';
11
11
  import { getCerfa3519Century23RegistrationFields } from './3519/century23';
@@ -20,7 +20,7 @@ const vatDocuments: VatDocument[] = [
20
20
  name: '3310',
21
21
  century: '23',
22
22
  centuries: [2022, 2023, 2024, 2025],
23
- payload: (accountingEntries: IAccountingEntry[], payload: PayloadCerfa3310_2023) => getCerfa3310Century23Payload(accountingEntries, payload),
23
+ payload: (accountingEntries: IAccountingEntry[], payload: PayloadCerfa3310_2023, updatedEntries: UpdatedAnnotation) => getCerfa3310Century23Payload(accountingEntries, payload, updatedEntries),
24
24
  asponePayload: (data: Cerfa3310_2023) => getCerfa3310Century23RegistrationFields(data),
25
25
  fields: cerfa3310Century23Fields,
26
26
  fileName: '3310-2023',