@silexpert/core 1.1.33 → 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.
- package/es/types/Interface/api/registration/ReadRegistration.d.ts +4 -2
- package/es/types/Interface/api/registration/ReadRegistration.d.ts.map +1 -1
- package/es/types/Interface/api/registration/ReadRegistration.js.map +1 -1
- package/es/utils/vat/3310/century23.d.ts.map +1 -1
- package/es/utils/vat/3310/century23.js +2 -2
- package/es/utils/vat/3310/century23.js.map +1 -1
- package/es/utils/vat/3517/century23.d.ts.map +1 -1
- package/es/utils/vat/3517/century23.js +8 -7
- package/es/utils/vat/3517/century23.js.map +1 -1
- package/js/types/Interface/api/registration/ReadRegistration.js.map +1 -1
- package/js/utils/vat/3310/century23.js +1 -1
- package/js/utils/vat/3310/century23.js.map +1 -1
- package/js/utils/vat/3517/century23.js +7 -6
- package/js/utils/vat/3517/century23.js.map +1 -1
- package/package.json +1 -1
- package/ts/types/Interface/api/registration/ReadRegistration.ts +4 -1
- package/ts/utils/vat/3310/century23.ts +3 -2
- package/ts/utils/vat/3517/century23.ts +8 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@silexpert/core",
|
|
3
|
-
"version": "1.1.
|
|
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
|
|
42
|
+
export type UpdatedAnnotationObject = { old: IAccountingEntry[]; new: IAccountingEntry[] };
|
|
43
|
+
|
|
44
|
+
export type UpdatedAnnotation = UpdatedAnnotationObject[];
|
|
@@ -1,6 +1,6 @@
|
|
|
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';
|
|
@@ -18,7 +18,7 @@ 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
23
|
const oldEntries = flatten(updatedEntries?.map((u) => u.old));
|
|
24
24
|
const newEntries = flatten(updatedEntries?.map((u) => u.new));
|
|
@@ -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 =
|
|
38
|
-
const onImmobilizationDeductible =
|
|
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()
|
|
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()
|
|
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 = {
|