@silexpert/core 1.1.27 → 1.1.29
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/Enum/AdjustmentType.d.ts +4 -0
- package/es/types/Enum/AdjustmentType.d.ts.map +1 -1
- package/es/types/Enum/AdjustmentType.js +4 -0
- package/es/types/Enum/AdjustmentType.js.map +1 -1
- package/es/types/Interface/api/cerfa/3310.d.ts +4 -0
- package/es/types/Interface/api/cerfa/3310.d.ts.map +1 -1
- package/es/types/Interface/api/cerfa/3310.js.map +1 -1
- package/es/utils/vat/3310/century23.js +43 -43
- package/es/utils/vat/3310/century23.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 +98 -98
- package/es/utils/vat/3517/century23.js.map +1 -1
- package/es/utils/vat/utils.js +1 -1
- package/es/utils/vat/utils.js.map +1 -1
- package/js/types/Enum/AdjustmentType.js +7 -0
- package/js/types/Enum/AdjustmentType.js.map +1 -1
- package/js/types/Interface/api/cerfa/3310.js.map +1 -1
- package/js/utils/vat/3310/century23.js +43 -43
- package/js/utils/vat/3310/century23.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 +98 -98
- package/js/utils/vat/3517/century23.js.map +1 -1
- package/js/utils/vat/utils.js.map +1 -1
- package/package.json +1 -1
- package/ts/types/Enum/AdjustmentType.ts +5 -0
- package/ts/types/Interface/api/cerfa/3310.ts +4 -0
- package/ts/utils/vat/3310/century23.ts +2 -2
- package/ts/utils/vat/3514/century22.ts +3 -3
- package/ts/utils/vat/3517/century23.ts +5 -5
- package/ts/utils/vat/utils.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["getAmountByAccountNumber","exports","getTaxAmountByAccountNumber","textFormatting","_lodash","require","_Vat","accountingEntries","accountsNumber","precision","isAbs","accountingEntriesUniq","_uniqBy","result","_round","reduce","acc","accountingEntry","accTmp","some","number","account","toString","startsWith","debit","credit","Math","abs","_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, isAbs = 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 +=
|
|
1
|
+
{"version":3,"file":"utils.js","names":["getAmountByAccountNumber","exports","getTaxAmountByAccountNumber","textFormatting","_lodash","require","_Vat","accountingEntries","accountsNumber","precision","isAbs","accountingEntriesUniq","_uniqBy","result","_round","reduce","acc","accountingEntry","accTmp","some","number","account","toString","startsWith","debit","credit","Math","abs","_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, isAbs = 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 += accountingEntry.debit - accountingEntry.credit;\n return true;\n }\n return false;\n });\n return accTmp;\n }, 0), precision);\n return isAbs ? Math.abs(result) : 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,SAAUL,wBAAwBA,CAACO,iBAAqC,EAAEC,cAAwB,EAAEC,SAAS,GAAG,CAAC,EAAEC,KAAK,GAAG,KAAK;EACpI,MAAMC,qBAAqB,GAAG,IAAAC,cAAO,EAACL,iBA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AAI;AACb"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@silexpert/core",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.29",
|
|
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",
|
|
@@ -34,4 +34,9 @@ export const AdjustmentTypeList: Array<{ id:AdjustmentTypeId; label: string; cen
|
|
|
34
34
|
key: 'vat.deductible.toImpute',
|
|
35
35
|
inputKey: 'adjustment.notEnoughDeducted',
|
|
36
36
|
},
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
export const VatDeclarationMxAdjustment: Array<{ key: string; label: string; }> = [
|
|
40
|
+
{ key: 'mx.collected', label: 'Opérations modifiées M-X (collecté)' },
|
|
41
|
+
{ key: 'mx.deducted', label: 'Opérations modifiées M-X (déductible)' },
|
|
37
42
|
];
|
|
@@ -187,6 +187,10 @@ export type PayloadCerfa3310_2023 = {
|
|
|
187
187
|
isNil: boolean;
|
|
188
188
|
previousVatDeclaration: Cerfa3310_2023 | null;
|
|
189
189
|
sie: ServiceOfTax | null;
|
|
190
|
+
mx: {
|
|
191
|
+
collected: number;
|
|
192
|
+
deducted: number;
|
|
193
|
+
};
|
|
190
194
|
comment?: string;
|
|
191
195
|
taxedOperations?: {
|
|
192
196
|
withdrawSuspensiveRegime?: number;
|
|
@@ -82,7 +82,7 @@ export function getCerfa3310Century23Payload(accountingEntries: IAccountingEntry
|
|
|
82
82
|
const isNil = payload.isNil === true;
|
|
83
83
|
const isHolidayDeposit = payload.isHolidayDeposit === true;
|
|
84
84
|
|
|
85
|
-
const sumToAdd = isNil ? 0 : isHolidayDeposit ? (_round((payload.previousVatDeclaration?.toPay?.total ?? 0) * 0.8, 2)) : _round(payload.vat?.sumToAdd ?? 0);
|
|
85
|
+
const sumToAdd = isNil ? 0 : isHolidayDeposit ? (_round((payload.previousVatDeclaration?.toPay?.total ?? 0) * 0.8, 2)) : (_round(payload.vat?.sumToAdd ?? 0) + _round(payload.mx?.collected ?? 0));
|
|
86
86
|
const comment = isHolidayDeposit ? `ACOMPTE CONGES ${payload.comment ?? ''}` : (payload.comment ?? null);
|
|
87
87
|
|
|
88
88
|
const initialPayload: Cerfa3310_2023 = {
|
|
@@ -249,7 +249,7 @@ export function getCerfa3310Century23Payload(accountingEntries: IAccountingEntry
|
|
|
249
249
|
total: isNil || isHolidayDeposit ? 0 : otherDeductibles,
|
|
250
250
|
},
|
|
251
251
|
report,
|
|
252
|
-
toImpute: isNil || isHolidayDeposit ? 0 : _round(payload.vat?.deductible?.toImpute ?? 0),
|
|
252
|
+
toImpute: isNil || isHolidayDeposit ? 0 : (_round(payload.vat?.deductible?.toImpute ?? 0) + _round(payload.mx?.deducted ?? 0)),
|
|
253
253
|
total: 0, // Calculé plus bas
|
|
254
254
|
onImportOtherThanOilProducts: isNil || isHolidayDeposit ? 0 : otherDeductibles,
|
|
255
255
|
coefficient: isNil || isHolidayDeposit ? 100 : coefficient,
|
|
@@ -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,
|
|
@@ -35,12 +35,12 @@ export function getCerfa3517Century23Payload(accountingEntries: IAccountingEntry
|
|
|
35
35
|
const saleOfImmobilization = getAmountByAccountNumber(vatEntries.filter((ae) => !withoutTaxVat.includes(ae.idVat) && frenchVat.includes(ae.idVat)), ['775'], 0, true);
|
|
36
36
|
|
|
37
37
|
const onInvoiceDeductible = getAmountByAccountNumber(vatEntries, ['445660'], 0, true);
|
|
38
|
-
const onImmobilizationDeductible = getAmountByAccountNumber(vatEntries, ['
|
|
38
|
+
const onImmobilizationDeductible = getAmountByAccountNumber(vatEntries, ['44562'], 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,
|
|
@@ -178,11 +178,11 @@ export function getCerfa3517Century23Payload(accountingEntries: IAccountingEntry
|
|
|
178
178
|
due: 0, // Calculé plus bas
|
|
179
179
|
credit: 0, // Calculé plus bas
|
|
180
180
|
advance1: {
|
|
181
|
-
paid: isNil ? 0 : _round((julyAdvancePayload?.amountWanted ?? 0)
|
|
181
|
+
paid: isNil ? 0 : _round((julyAdvancePayload?.amountWanted ?? 0)),
|
|
182
182
|
toPay: isNil ? 0 : _round(payload.advance1?.toPay ?? 0),
|
|
183
183
|
},
|
|
184
184
|
advance2: {
|
|
185
|
-
paid: isNil ? 0 : _round((decemberAdvancePayload?.amountWanted ?? 0)
|
|
185
|
+
paid: isNil ? 0 : _round((decemberAdvancePayload?.amountWanted ?? 0)),
|
|
186
186
|
toPay: isNil ? 0 : _round(payload.advance2?.toPay ?? 0),
|
|
187
187
|
},
|
|
188
188
|
advance: {
|
package/ts/utils/vat/utils.ts
CHANGED
|
@@ -8,7 +8,7 @@ export function getAmountByAccountNumber(accountingEntries: IAccountingEntry[],
|
|
|
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 +=
|
|
11
|
+
accTmp += accountingEntry.debit - accountingEntry.credit;
|
|
12
12
|
return true;
|
|
13
13
|
}
|
|
14
14
|
return false;
|