@silexpert/core 1.1.26 → 1.1.28
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/api/resources/Vat.d.ts +2 -2
- package/es/api/resources/Vat.d.ts.map +1 -1
- package/es/api/resources/Vat.js +2 -4
- package/es/api/resources/Vat.js.map +1 -1
- package/es/utils/vat/3514/century22.js +3 -3
- package/es/utils/vat/3514/century22.js.map +1 -1
- package/es/utils/vat/3517/century23.js +97 -97
- package/es/utils/vat/3517/century23.js.map +1 -1
- package/es/utils/vat/utils.d.ts +1 -1
- package/es/utils/vat/utils.d.ts.map +1 -1
- package/es/utils/vat/utils.js +3 -3
- package/es/utils/vat/utils.js.map +1 -1
- package/js/api/resources/Vat.js +2 -4
- package/js/api/resources/Vat.js.map +1 -1
- package/js/utils/vat/3514/century22.js +3 -3
- package/js/utils/vat/3514/century22.js.map +1 -1
- package/js/utils/vat/3517/century23.js +97 -97
- package/js/utils/vat/3517/century23.js.map +1 -1
- package/js/utils/vat/utils.js +3 -3
- package/js/utils/vat/utils.js.map +1 -1
- package/package.json +1 -1
- package/ts/api/resources/Vat.ts +3 -5
- package/ts/utils/vat/3514/century22.ts +3 -3
- package/ts/utils/vat/3517/century23.ts +2 -2
- package/ts/utils/vat/utils.ts +3 -3
package/js/utils/vat/utils.js
CHANGED
|
@@ -8,20 +8,20 @@ exports.getTaxAmountByAccountNumber = getTaxAmountByAccountNumber;
|
|
|
8
8
|
exports.textFormatting = textFormatting;
|
|
9
9
|
var _lodash = require("lodash");
|
|
10
10
|
var _Vat = require("../../types/Enum/Vat");
|
|
11
|
-
function getAmountByAccountNumber(accountingEntries, accountsNumber, precision = 0,
|
|
11
|
+
function getAmountByAccountNumber(accountingEntries, accountsNumber, precision = 0, isCreditVsDebit = false) {
|
|
12
12
|
const accountingEntriesUniq = (0, _lodash.uniqBy)(accountingEntries, 'id');
|
|
13
13
|
const result = (0, _lodash.round)(accountingEntriesUniq.reduce((acc, accountingEntry) => {
|
|
14
14
|
let accTmp = acc;
|
|
15
15
|
accountsNumber.some(number => {
|
|
16
16
|
if (accountingEntry.account && accountingEntry.account.number && accountingEntry.account.number.toString().startsWith(number)) {
|
|
17
|
-
accTmp += accountingEntry.debit - accountingEntry.credit;
|
|
17
|
+
accTmp += isCreditVsDebit ? accountingEntry.credit - accountingEntry.debit : accountingEntry.debit - accountingEntry.credit;
|
|
18
18
|
return true;
|
|
19
19
|
}
|
|
20
20
|
return false;
|
|
21
21
|
});
|
|
22
22
|
return accTmp;
|
|
23
23
|
}, 0), precision);
|
|
24
|
-
return
|
|
24
|
+
return result;
|
|
25
25
|
}
|
|
26
26
|
function getTaxAmountByAccountNumber(accountingEntries, accountsNumber, precision = 0) {
|
|
27
27
|
const accountingEntriesUniq = (0, _lodash.uniqBy)(accountingEntries, 'id');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["getAmountByAccountNumber","exports","getTaxAmountByAccountNumber","textFormatting","_lodash","require","_Vat","accountingEntries","accountsNumber","precision","
|
|
1
|
+
{"version":3,"file":"utils.js","names":["getAmountByAccountNumber","exports","getTaxAmountByAccountNumber","textFormatting","_lodash","require","_Vat","accountingEntries","accountsNumber","precision","isCreditVsDebit","accountingEntriesUniq","_uniqBy","result","_round","reduce","acc","accountingEntry","accTmp","some","number","account","toString","startsWith","credit","debit","_b","_a","Object","values","Vat","find","v","id","idVat","value","length","formattedValue","replace","slice"],"sources":["../../../ts/utils/vat/utils.ts"],"sourcesContent":["import { round as _round, uniqBy as _uniqBy } from 'lodash';\nimport { IAccountingEntry } from '../../types/Interface/models/IAccountingEntry';\nimport { Vat } from '../../types/Enum/Vat';\n\nexport function getAmountByAccountNumber(accountingEntries: IAccountingEntry[], accountsNumber: string[], precision = 0, isCreditVsDebit = false): number {\n const accountingEntriesUniq = _uniqBy(accountingEntries, 'id');\n const result = _round(accountingEntriesUniq.reduce((acc, accountingEntry) => {\n let accTmp = acc;\n accountsNumber.some((number) => {\n if (accountingEntry.account && accountingEntry.account.number && accountingEntry.account.number.toString().startsWith(number)) {\n accTmp += isCreditVsDebit ? (accountingEntry.credit - accountingEntry.debit) : (accountingEntry.debit - accountingEntry.credit);\n return true;\n }\n return false;\n });\n return accTmp;\n }, 0), precision);\n return result;\n}\n\nexport function getTaxAmountByAccountNumber(accountingEntries: IAccountingEntry[], accountsNumber: string[], precision = 0): number {\n const accountingEntriesUniq = _uniqBy(accountingEntries, 'id');\n return _round(accountingEntriesUniq.reduce((acc, accountingEntry) => {\n let accTmp = acc;\n accountsNumber.some((number) => {\n if (accountingEntry.account && accountingEntry.account.number && accountingEntry.account.number.toString().startsWith(number)) {\n accTmp += ((accountingEntry.debit - accountingEntry.credit) * (((Object.values(Vat).find((v) => v.id === accountingEntry.idVat)?.value ?? 0) / 100)));\n return true;\n }\n return false;\n });\n return accTmp;\n }, precision));\n}\n\nexport function textFormatting(value: any, length: number | null = null): string | null {\n if (value && typeof value === 'string') {\n let formattedValue = value.replace(/[\\u2018\\u2019]/g, '\\''); // Suppression des \"Curly Quotes\"\n formattedValue = formattedValue.replace(/&/g, ''); // Suppression des &\n formattedValue = formattedValue.replace(/!/g, ''); // Suppression des !\n formattedValue = formattedValue.replace(/[\\t]/g, ''); // Suppression des tabulations\n formattedValue = formattedValue.replace(/`/g, '\\''); // Suppression des `\n formattedValue = formattedValue.replace(/\"/g, ''); // Suppression des \"\n formattedValue = formattedValue.replace(/^ */, ''); // Suppression des espaces de début\n formattedValue = formattedValue.replace(/ *$/, ''); // Suppression des espaces de fin\n if (length) formattedValue = formattedValue.slice(0, length);\n return formattedValue;\n }\n return null;\n}"],"mappings":";;;;;QAIgBA,wBAAwB,GAAxBA,wBAAwB;AAAAC,OAAA,CAgBxBC,2BAA2B,GAA3BA,2BAA2B;AAAAD,OAAA,CAe3BE,cAAc,GAAdA,cAAc;AAnC9B,IAAAC,OAAA,GAAAC,OAAA;AAEA,IAAAC,IAAA,GAAAD,OAAA;AAEM,S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AE,EAAE,CAAC,CAAC,CAAC;IACpD,IAAIF,MAAM,EAAEC,cAAc,GAAGA,cAAc,CAACE,KAAK,CAAC,CAAC,EAAEH,MAAM,CAAC;IAC5D,OAAOC,cAAc;;EAEvB,OAAO,IAAI;AACb"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@silexpert/core",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.28",
|
|
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",
|
package/ts/api/resources/Vat.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
BasePaginate, CreateRegistrationDetail, IAccountingTransaction, ICustomerVat, QueryCerfa, QueryPaginatedRegistration, QueryPreviousVatDeclaration, QueryVatEntry, ReadFormattedAccountingTransaction, ReadRegistration, ReadVatDeclarationUpdatedEntry, ReadVatEntry, ReadVatVariousOperations, UpdateOrCreateVatAdvance, UpdateOrCreateVatRegistration, UpdateRegistration,
|
|
2
|
+
BasePaginate, CreateRegistrationDetail, IAccountingTransaction, ICustomerVat, QueryCerfa, QueryPaginatedRegistration, QueryPreviousVatDeclaration, QueryVatEntry, QueryVatMigrationEntry, ReadFormattedAccountingTransaction, ReadRegistration, ReadVatDeclarationUpdatedEntry, ReadVatEntry, ReadVatVariousOperations, UpdateOrCreateVatAdvance, UpdateOrCreateVatRegistration, UpdateRegistration,
|
|
3
3
|
} from '../..';
|
|
4
4
|
import { Resource } from '../Resource';
|
|
5
5
|
|
|
@@ -31,11 +31,9 @@ export class Vat extends Resource {
|
|
|
31
31
|
return this.axios.$post(`/societies/${idSociety}/vat/preview`, payload);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
migrateEntries(
|
|
34
|
+
migrateEntries(query: QueryVatMigrationEntry): Promise<ReadFormattedAccountingTransaction[]> {
|
|
35
35
|
return this.axios.$post('vat-declarations/migrate-entries', null, {
|
|
36
|
-
params:
|
|
37
|
-
id: idSociety,
|
|
38
|
-
},
|
|
36
|
+
params: query,
|
|
39
37
|
});
|
|
40
38
|
}
|
|
41
39
|
|
|
@@ -10,7 +10,7 @@ export function getCerfa3514Century22Payload(payload: PayloadCerfa3514_2022): Ce
|
|
|
10
10
|
const currentMonth = dayjs(payload.startDate).month() + 1;
|
|
11
11
|
|
|
12
12
|
const previousCA12Rate = round(currentMonth === 7 ? (payload.previousCA12?.total ?? 0) * 0.55 : currentMonth === 1 ? (payload.previousCA12?.total ?? 0) * 0.4 : 0);
|
|
13
|
-
const previousCA12Credit = round(payload.previousCA12?.recapitulation?.balance ?? 0 + payload.previousCA12?.recapitulation?.imputedCredit ?? 0);
|
|
13
|
+
const previousCA12Credit = round((payload.previousCA12?.recapitulation?.balance ?? 0) + (payload.previousCA12?.recapitulation?.imputedCredit ?? 0));
|
|
14
14
|
|
|
15
15
|
const data: Cerfa3514_2022 = {
|
|
16
16
|
declaration: {
|
|
@@ -50,8 +50,8 @@ export function getCerfa3514Century22Payload(payload: PayloadCerfa3514_2022): Ce
|
|
|
50
50
|
isPayment: true,
|
|
51
51
|
byImputation: false,
|
|
52
52
|
},
|
|
53
|
-
amountWanted: typeof payload.amountWanted === 'number' ? payload.amountWanted : previousCA12Rate,
|
|
54
|
-
amountOfCredit: typeof payload.amountOfCredit === 'number' ? payload.amountOfCredit : previousCA12Credit,
|
|
53
|
+
amountWanted: typeof payload.amountWanted === 'number' ? payload.amountWanted : previousCA12Rate ?? 0,
|
|
54
|
+
amountOfCredit: typeof payload.amountOfCredit === 'number' ? payload.amountOfCredit : previousCA12Credit ?? 0,
|
|
55
55
|
vatAmountToPay: 0, // Calculé plus bas
|
|
56
56
|
shouldCancelAdvance: false,
|
|
57
57
|
vatAmountCollected: payload.vatAmountCollected ?? 0,
|
|
@@ -38,9 +38,9 @@ export function getCerfa3517Century23Payload(accountingEntries: IAccountingEntry
|
|
|
38
38
|
const onImmobilizationDeductible = getAmountByAccountNumber(vatEntries, ['445662'], 0, true);
|
|
39
39
|
|
|
40
40
|
const julyAdvance: IRegistration | null = payload?.exerciceAdvanceRegistrations?.find((a) => dayjs(a.endDate).month() === 6) ?? null;
|
|
41
|
-
const julyAdvancePayload: Cerfa3514_2022 | null = julyAdvance?.payload ?? null;
|
|
41
|
+
const julyAdvancePayload: Cerfa3514_2022 | null = julyAdvance?.payload?.cerfa3514 ?? null;
|
|
42
42
|
const decemberAdvance: IRegistration | null = payload?.exerciceAdvanceRegistrations?.find((a) => dayjs(a.endDate).month() === 11) ?? null;
|
|
43
|
-
const decemberAdvancePayload: Cerfa3514_2022 | null = decemberAdvance?.payload ?? null;
|
|
43
|
+
const decemberAdvancePayload: Cerfa3514_2022 | null = decemberAdvance?.payload?.cerfa3514 ?? null;
|
|
44
44
|
|
|
45
45
|
const data:Cerfa3517_2023 = {
|
|
46
46
|
isNil: payload.isNil === true,
|
package/ts/utils/vat/utils.ts
CHANGED
|
@@ -2,20 +2,20 @@ import { round as _round, uniqBy as _uniqBy } from 'lodash';
|
|
|
2
2
|
import { IAccountingEntry } from '../../types/Interface/models/IAccountingEntry';
|
|
3
3
|
import { Vat } from '../../types/Enum/Vat';
|
|
4
4
|
|
|
5
|
-
export function getAmountByAccountNumber(accountingEntries: IAccountingEntry[], accountsNumber: string[], precision = 0,
|
|
5
|
+
export function getAmountByAccountNumber(accountingEntries: IAccountingEntry[], accountsNumber: string[], precision = 0, isCreditVsDebit = false): number {
|
|
6
6
|
const accountingEntriesUniq = _uniqBy(accountingEntries, 'id');
|
|
7
7
|
const result = _round(accountingEntriesUniq.reduce((acc, accountingEntry) => {
|
|
8
8
|
let accTmp = acc;
|
|
9
9
|
accountsNumber.some((number) => {
|
|
10
10
|
if (accountingEntry.account && accountingEntry.account.number && accountingEntry.account.number.toString().startsWith(number)) {
|
|
11
|
-
accTmp += (accountingEntry.debit - accountingEntry.credit);
|
|
11
|
+
accTmp += isCreditVsDebit ? (accountingEntry.credit - accountingEntry.debit) : (accountingEntry.debit - accountingEntry.credit);
|
|
12
12
|
return true;
|
|
13
13
|
}
|
|
14
14
|
return false;
|
|
15
15
|
});
|
|
16
16
|
return accTmp;
|
|
17
17
|
}, 0), precision);
|
|
18
|
-
return
|
|
18
|
+
return result;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export function getTaxAmountByAccountNumber(accountingEntries: IAccountingEntry[], accountsNumber: string[], precision = 0): number {
|