@silexpert/core 2.0.67 → 2.0.68-2
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/dist/api/resources/Acd.d.ts +2 -1
- package/dist/api/resources/Acd.d.ts.map +1 -1
- package/dist/api/resources/Acd.js +3 -0
- package/dist/api/resources/Acd.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/types/Interface/api/acd/Vat.d.ts +52 -0
- package/dist/types/Interface/api/acd/Vat.d.ts.map +1 -0
- package/dist/types/Interface/api/acd/Vat.js +14 -0
- package/dist/types/Interface/api/acd/Vat.js.map +1 -0
- package/dist/types/Interface/api/commercialManagement/Create.d.ts +1 -0
- package/dist/types/Interface/api/commercialManagement/Create.d.ts.map +1 -1
- package/dist/types/Interface/api/commercialManagement/Create.js +7 -0
- package/dist/types/Interface/api/commercialManagement/Create.js.map +1 -1
- package/dist/types/Interface/api/product/CreateProduct.d.ts +1 -0
- package/dist/types/Interface/api/product/CreateProduct.d.ts.map +1 -1
- package/dist/types/Interface/api/product/CreateProduct.js +8 -1
- package/dist/types/Interface/api/product/CreateProduct.js.map +1 -1
- package/dist/types/Interface/api/thirdParty/CreateThirdPartyForm.d.ts +2 -0
- package/dist/types/Interface/api/thirdParty/CreateThirdPartyForm.d.ts.map +1 -1
- package/dist/types/Interface/api/thirdParty/CreateThirdPartyForm.js +11 -0
- package/dist/types/Interface/api/thirdParty/CreateThirdPartyForm.js.map +1 -1
- package/dist/types/Interface/api/thirdParty/UpdateThirdPartyForm.d.ts +2 -0
- package/dist/types/Interface/api/thirdParty/UpdateThirdPartyForm.d.ts.map +1 -1
- package/dist/types/Interface/api/thirdParty/UpdateThirdPartyForm.js +12 -0
- package/dist/types/Interface/api/thirdParty/UpdateThirdPartyForm.js.map +1 -1
- package/dist/types/Interface/models/IAccount.d.ts +1 -0
- package/dist/types/Interface/models/IAccount.d.ts.map +1 -1
- package/dist/types/Interface/models/IAccount.js +1 -0
- package/dist/types/Interface/models/IAccount.js.map +1 -1
- package/dist/types/Interface/models/IProduct.d.ts +3 -0
- package/dist/types/Interface/models/IProduct.d.ts.map +1 -1
- package/dist/types/Interface/models/IProduct.js +2 -0
- package/dist/types/Interface/models/IProduct.js.map +1 -1
- package/dist/types/Interface/models/IProductInvoice.d.ts +3 -0
- package/dist/types/Interface/models/IProductInvoice.d.ts.map +1 -1
- package/dist/types/Interface/models/IProductInvoice.js +2 -0
- package/dist/types/Interface/models/IProductInvoice.js.map +1 -1
- package/dist/types/Interface/models/ISocietyGescom.d.ts +1 -0
- package/dist/types/Interface/models/ISocietyGescom.d.ts.map +1 -1
- package/dist/types/Interface/models/ISocietyGescom.js +2 -0
- package/dist/types/Interface/models/ISocietyGescom.js.map +1 -1
- package/dist/types/Interface/models/IThirdParty.d.ts +2 -0
- package/dist/types/Interface/models/IThirdParty.d.ts.map +1 -1
- package/dist/types/Interface/models/IThirdParty.js +2 -0
- package/dist/types/Interface/models/IThirdParty.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -0
- package/dist/types/index.js.map +1 -1
- package/dist/utils/acdVat.d.ts +4 -0
- package/dist/utils/acdVat.d.ts.map +1 -0
- package/dist/utils/acdVat.js +57 -0
- package/dist/utils/acdVat.js.map +1 -0
- package/dist/utils/commercialManagement/document.d.ts.map +1 -1
- package/dist/utils/commercialManagement/document.js +1 -0
- package/dist/utils/commercialManagement/document.js.map +1 -1
- package/dist/utils/commercialManagement/templates/body.d.ts.map +1 -1
- package/dist/utils/commercialManagement/templates/body.js +9 -5
- package/dist/utils/commercialManagement/templates/body.js.map +1 -1
- package/dist/utils/commercialManagement/templates/common.d.ts.map +1 -1
- package/dist/utils/commercialManagement/templates/common.js +1 -0
- package/dist/utils/commercialManagement/templates/common.js.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/tests/acdVat.spec.d.ts +2 -0
- package/dist/utils/tests/acdVat.spec.d.ts.map +1 -0
- package/dist/utils/tests/acdVat.spec.js +25 -0
- package/dist/utils/tests/acdVat.spec.js.map +1 -0
- package/package.json +1 -1
- package/ts/api/resources/Acd.ts +5 -1
- package/ts/index.ts +1 -0
- package/ts/types/Interface/api/acd/Vat.ts +52 -0
- package/ts/types/Interface/api/commercialManagement/Create.ts +5 -0
- package/ts/types/Interface/api/product/CreateProduct.ts +6 -1
- package/ts/types/Interface/api/thirdParty/CreateThirdPartyForm.ts +7 -0
- package/ts/types/Interface/api/thirdParty/UpdateThirdPartyForm.ts +8 -0
- package/ts/types/Interface/models/IAccount.ts +1 -0
- package/ts/types/Interface/models/IProduct.ts +3 -0
- package/ts/types/Interface/models/IProductInvoice.ts +3 -0
- package/ts/types/Interface/models/ISocietyGescom.ts +2 -0
- package/ts/types/Interface/models/IThirdParty.ts +2 -0
- package/ts/types/index.ts +1 -0
- package/ts/utils/acdVat.ts +63 -0
- package/ts/utils/commercialManagement/document.ts +1 -0
- package/ts/utils/commercialManagement/templates/body.ts +9 -5
- package/ts/utils/commercialManagement/templates/common.ts +1 -0
- package/ts/utils/index.ts +1 -0
- package/ts/utils/tests/acdVat.spec.ts +26 -0
package/package.json
CHANGED
package/ts/api/resources/Acd.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import { CreateAcdAuthentication } from '../../index.js';
|
|
1
|
+
import type { CreateAcdAuthentication, IAccount } from '../../index.js';
|
|
2
2
|
import { Resource } from '../Resource.js';
|
|
3
3
|
|
|
4
4
|
export class Acd extends Resource {
|
|
5
5
|
authenticate(body: CreateAcdAuthentication): Promise<{ token: string }> {
|
|
6
6
|
return this.axios.$post('/connectors/acd/authenticate', body);
|
|
7
7
|
}
|
|
8
|
+
|
|
9
|
+
getAccounts(): Promise<IAccount[]> {
|
|
10
|
+
return this.axios.$get('/connectors/acd/accounts');
|
|
11
|
+
}
|
|
8
12
|
}
|
package/ts/index.ts
CHANGED
|
@@ -2,5 +2,6 @@ export * from './utils/index.js';
|
|
|
2
2
|
export * from './utils/commercialManagement/product.js';
|
|
3
3
|
export * from './utils/commercialManagement/vat.js';
|
|
4
4
|
export * from './utils/commercialManagement/recovery.js';
|
|
5
|
+
export * from './utils/acdVat.js';
|
|
5
6
|
export * from './types/index.js';
|
|
6
7
|
export * from './api/index.js';
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export enum AcdVatCode {
|
|
2
|
+
AUTOL = 'AUTOL',
|
|
3
|
+
INTRACOM = 'INTRACOM',
|
|
4
|
+
NON_AFFECTE = 'NON_AFFECTE',
|
|
5
|
+
ONI = 'ONI',
|
|
6
|
+
SUR_IMMOBILISATION = 'TI',
|
|
7
|
+
NORMAL = 'TN',
|
|
8
|
+
REDUIT_5_5 = 'TR1',
|
|
9
|
+
REDUIT_10 = 'TR2',
|
|
10
|
+
REDUIT_2_1 = 'TSR',
|
|
11
|
+
SPECIAL = 'TS',
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type AcdCompte = {
|
|
15
|
+
Code: string | null;
|
|
16
|
+
Categ: string | null;
|
|
17
|
+
Lib: string | null;
|
|
18
|
+
Let: string | null;
|
|
19
|
+
RegEc: string | null;
|
|
20
|
+
Qte: string | null;
|
|
21
|
+
Coll: boolean;
|
|
22
|
+
CptCptCol: string | null;
|
|
23
|
+
CodeTVA: string | null;
|
|
24
|
+
CompteHorsTaxe: string | null;
|
|
25
|
+
CptInactif: boolean;
|
|
26
|
+
UniteQte1: Array<string> | null;
|
|
27
|
+
UniteQte2: Array<string> | null;
|
|
28
|
+
ActivationAnalytique: boolean;
|
|
29
|
+
CleRepartition: {
|
|
30
|
+
Code: string | null;
|
|
31
|
+
Lib: string | null;
|
|
32
|
+
Auto: boolean;
|
|
33
|
+
} | null;
|
|
34
|
+
Tiers: {
|
|
35
|
+
Code: number;
|
|
36
|
+
RaisonSociale: string | null;
|
|
37
|
+
Siren: string | null;
|
|
38
|
+
Siret: string | null;
|
|
39
|
+
Telephone: string | null;
|
|
40
|
+
Email: string | null;
|
|
41
|
+
Fax: string | null;
|
|
42
|
+
NumeroIntracom: string | null;
|
|
43
|
+
Adresse?: {
|
|
44
|
+
Numero: string | null;
|
|
45
|
+
Nature: string | null;
|
|
46
|
+
Complement: string | null;
|
|
47
|
+
Hameau: string | null;
|
|
48
|
+
CodePostal: string | null;
|
|
49
|
+
Pays: string | null;
|
|
50
|
+
};
|
|
51
|
+
} | null;
|
|
52
|
+
};
|
|
@@ -462,6 +462,11 @@ export class CommercialDocumentInputs {
|
|
|
462
462
|
@ApiProperty({ description: 'Commercial street address of seller' })
|
|
463
463
|
street: string | null;
|
|
464
464
|
|
|
465
|
+
@ApiPropertyOptional({ description: 'Commercial address complement of seller' })
|
|
466
|
+
@IsOptional()
|
|
467
|
+
@IsString()
|
|
468
|
+
addressComplement?: string | null;
|
|
469
|
+
|
|
465
470
|
@ApiProperty({ description: 'Commercial zip code address of seller' })
|
|
466
471
|
zipCode: string | null;
|
|
467
472
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IsBoolean, IsNumber, IsOptional, IsString, Min } from 'class-validator';
|
|
1
|
+
import { IsBoolean, IsInt, IsNumber, IsOptional, IsString, Min } from 'class-validator';
|
|
2
2
|
import { ProductType, Unit } from '../../../index.js';
|
|
3
3
|
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
4
4
|
import { ToBoolean } from '../../../../utils/transforms/boolean.transform.js';
|
|
@@ -54,4 +54,9 @@ export class CreateProduct {
|
|
|
54
54
|
@IsString()
|
|
55
55
|
@IsOptional()
|
|
56
56
|
codeProduct?: string;
|
|
57
|
+
|
|
58
|
+
@ApiPropertyOptional()
|
|
59
|
+
@IsInt()
|
|
60
|
+
@IsOptional()
|
|
61
|
+
idAccount?: number;
|
|
57
62
|
}
|
|
@@ -18,6 +18,9 @@ export class CreateThirdPartyForm {
|
|
|
18
18
|
@ApiPropertyOptional()
|
|
19
19
|
address?: string | null;
|
|
20
20
|
|
|
21
|
+
@ApiPropertyOptional()
|
|
22
|
+
addressComplement?: string | null;
|
|
23
|
+
|
|
21
24
|
@ApiPropertyOptional()
|
|
22
25
|
zipCode?: string | null;
|
|
23
26
|
|
|
@@ -77,6 +80,10 @@ export class CreateThirdPartyForm {
|
|
|
77
80
|
@IsOptional()
|
|
78
81
|
deliveryAddress?: string | null;
|
|
79
82
|
|
|
83
|
+
@ApiPropertyOptional()
|
|
84
|
+
@IsOptional()
|
|
85
|
+
deliveryAddressComplement?: string | null;
|
|
86
|
+
|
|
80
87
|
@ApiPropertyOptional()
|
|
81
88
|
@IsOptional()
|
|
82
89
|
deliveryCity?: string | null;
|
|
@@ -23,6 +23,10 @@ export class UpdateThirdPartyForm {
|
|
|
23
23
|
@IsOptional()
|
|
24
24
|
address?: string | null;
|
|
25
25
|
|
|
26
|
+
@ApiPropertyOptional()
|
|
27
|
+
@IsOptional()
|
|
28
|
+
addressComplement?: string | null;
|
|
29
|
+
|
|
26
30
|
@ApiPropertyOptional()
|
|
27
31
|
@IsOptional()
|
|
28
32
|
zipCode?: string | null;
|
|
@@ -99,6 +103,10 @@ export class UpdateThirdPartyForm {
|
|
|
99
103
|
@IsOptional()
|
|
100
104
|
deliveryAddress?: string | null;
|
|
101
105
|
|
|
106
|
+
@ApiPropertyOptional()
|
|
107
|
+
@IsOptional()
|
|
108
|
+
deliveryAddressComplement?: string | null;
|
|
109
|
+
|
|
102
110
|
@ApiPropertyOptional()
|
|
103
111
|
@IsOptional()
|
|
104
112
|
deliveryCity?: string | null;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IVat } from './IVat.js';
|
|
2
2
|
import { ISociety } from './ISociety.js';
|
|
3
|
+
import { IAccount } from './IAccount.js';
|
|
3
4
|
|
|
4
5
|
// products
|
|
5
6
|
export class IProduct {
|
|
@@ -15,6 +16,7 @@ export class IProduct {
|
|
|
15
16
|
amountOfPurchase: number | null;
|
|
16
17
|
marginVatType?: number;
|
|
17
18
|
idSociety: number;
|
|
19
|
+
idAccount?: number | null;
|
|
18
20
|
createdAt?: Date | null;
|
|
19
21
|
updatedAt?: Date | null;
|
|
20
22
|
deletedAt?: Date | null;
|
|
@@ -22,4 +24,5 @@ export class IProduct {
|
|
|
22
24
|
// Associations
|
|
23
25
|
vat?: IVat;
|
|
24
26
|
society?: ISociety;
|
|
27
|
+
account?: IAccount;
|
|
25
28
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IVat } from './IVat.js';
|
|
2
2
|
import { IProduct } from './IProduct.js';
|
|
3
|
+
import type { IAccount } from './IAccount.js';
|
|
3
4
|
import { DiscountType } from '../../Enum/CommercialManagement.js';
|
|
4
5
|
|
|
5
6
|
// itemsEstimates
|
|
@@ -7,6 +8,7 @@ export class IProductInvoice {
|
|
|
7
8
|
id?: number;
|
|
8
9
|
idEstimateInvoice: number;
|
|
9
10
|
idProduct: number | null;
|
|
11
|
+
idAccount?: number | null;
|
|
10
12
|
idVat: number;
|
|
11
13
|
marginVatType?: number;
|
|
12
14
|
amountOfPurchase: number | null;
|
|
@@ -26,4 +28,5 @@ export class IProductInvoice {
|
|
|
26
28
|
// Associations
|
|
27
29
|
vat?: IVat;
|
|
28
30
|
product?: IProduct;
|
|
31
|
+
account?: IAccount;
|
|
29
32
|
}
|
|
@@ -47,6 +47,8 @@ export class ISocietyGescom {
|
|
|
47
47
|
idSociety?: number | null;
|
|
48
48
|
shouldHideBrandName?: boolean;
|
|
49
49
|
shouldHideEmailHeader?: boolean;
|
|
50
|
+
// Regroupe les ecritures comptables par compte pour l export des ecritures comptables.
|
|
51
|
+
areEntriesGroupedByAccount?: boolean;
|
|
50
52
|
customerBlockBorderThickness?: number | null;
|
|
51
53
|
customerBlockBorderColor?: string | null;
|
|
52
54
|
lineSeparationThickness?: number | null;
|
|
@@ -13,6 +13,7 @@ export class IThirdParty {
|
|
|
13
13
|
fullnameAccountant?: string | null;
|
|
14
14
|
company: string;
|
|
15
15
|
address?: string | null;
|
|
16
|
+
addressComplement?: string | null;
|
|
16
17
|
zipCode?: string | null;
|
|
17
18
|
city?: string | null;
|
|
18
19
|
phone?: string | null;
|
|
@@ -33,6 +34,7 @@ export class IThirdParty {
|
|
|
33
34
|
idCountry?: number | null;
|
|
34
35
|
idThirdPartyType: ThirdPartyType;
|
|
35
36
|
deliveryAddress?: string | null;
|
|
37
|
+
deliveryAddressComplement?: string | null;
|
|
36
38
|
deliveryZipCode?: string | null;
|
|
37
39
|
deliveryCity?: string | null;
|
|
38
40
|
deliveryIdCountry?: number | null;
|
package/ts/types/index.ts
CHANGED
|
@@ -540,6 +540,7 @@ export * from './Enum/Kyc.js';
|
|
|
540
540
|
|
|
541
541
|
// Interfaces API
|
|
542
542
|
export * from './Interface/api/accountingTransaction/Create.js';
|
|
543
|
+
export * from './Interface/api/acd/Vat.js';
|
|
543
544
|
export * from './Interface/api/acd/Create.js';
|
|
544
545
|
export * from './Interface/api/authentification/AuthenticationResponse.js';
|
|
545
546
|
export * from './Interface/api/exercice/ReadExercice.js';
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Vat } from '../types/Enum/Vat.js';
|
|
2
|
+
import { AcdVatCode } from '../types/Interface/api/acd/Vat.js';
|
|
3
|
+
|
|
4
|
+
export function idVatToAcdVatCode(idVat?: number | null): AcdVatCode | null {
|
|
5
|
+
if (!idVat) {
|
|
6
|
+
return null;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const vat = Object.values(Vat).find((currentVat) => currentVat.id === idVat);
|
|
10
|
+
|
|
11
|
+
if (!vat) {
|
|
12
|
+
return AcdVatCode.NON_AFFECTE;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (vat.isVatIntracom) {
|
|
16
|
+
return AcdVatCode.INTRACOM;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (vat.isVatImportation) {
|
|
20
|
+
return AcdVatCode.AUTOL;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
switch (vat.value) {
|
|
24
|
+
case 2.1:
|
|
25
|
+
return AcdVatCode.REDUIT_2_1;
|
|
26
|
+
case 5.5:
|
|
27
|
+
return AcdVatCode.REDUIT_5_5;
|
|
28
|
+
case 10:
|
|
29
|
+
return AcdVatCode.REDUIT_10;
|
|
30
|
+
case 20:
|
|
31
|
+
return AcdVatCode.NORMAL;
|
|
32
|
+
case 0:
|
|
33
|
+
return null;
|
|
34
|
+
default:
|
|
35
|
+
return AcdVatCode.NON_AFFECTE;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function acdVatCodeToIdVat(acdVatCode?: AcdVatCode | null): number | null {
|
|
40
|
+
switch (acdVatCode) {
|
|
41
|
+
case AcdVatCode.NORMAL:
|
|
42
|
+
return Vat.TX_20.id;
|
|
43
|
+
case AcdVatCode.REDUIT_10:
|
|
44
|
+
return Vat.TX_10.id;
|
|
45
|
+
case AcdVatCode.REDUIT_5_5:
|
|
46
|
+
return Vat.TX_5_5.id;
|
|
47
|
+
case AcdVatCode.REDUIT_2_1:
|
|
48
|
+
return Vat.TX_2_1.id;
|
|
49
|
+
case AcdVatCode.INTRACOM:
|
|
50
|
+
// L'information de taux est perdue dans le code ACD, on retombe sur l'intracom a 20% par defaut.
|
|
51
|
+
return Vat.INTRACOM_TX_20.id;
|
|
52
|
+
case AcdVatCode.AUTOL:
|
|
53
|
+
// L'information de taux est perdue dans le code ACD, on retombe sur l'importation a 20% par defaut.
|
|
54
|
+
return Vat.IMPORTATION_TX_20.id;
|
|
55
|
+
case AcdVatCode.NON_AFFECTE:
|
|
56
|
+
case AcdVatCode.ONI:
|
|
57
|
+
case AcdVatCode.SUR_IMMOBILISATION:
|
|
58
|
+
case AcdVatCode.SPECIAL:
|
|
59
|
+
case null:
|
|
60
|
+
case undefined:
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -138,6 +138,7 @@ export function generateCommercialDocument(
|
|
|
138
138
|
brandColors: getBrandConfig({ objectWaited: 'colors', nodeEnv }) as brandColorType,
|
|
139
139
|
brandName: `${getBrandConfig({ objectWaited: 'name', nodeEnv }) as unknown as string}`,
|
|
140
140
|
shouldHideBrandName,
|
|
141
|
+
addressComplement: payload.addressComplement ?? null,
|
|
141
142
|
paymentType: payload.paymentType
|
|
142
143
|
? (internationalizationConsistency(locale, payload.paymentType, 'paymentType') ?? payload.paymentType)
|
|
143
144
|
: null,
|
|
@@ -56,8 +56,9 @@ const headOfDocument = `<div class="row space-between">
|
|
|
56
56
|
<% if(thirdParty.company) {%><b><%= thirdParty.company %></b><br/><% } %>
|
|
57
57
|
<% if(thirdParty.fullname) {%><%= thirdParty.fullname %><br/><% } %>
|
|
58
58
|
<% if(thirdParty.address) {%><%= thirdParty.address %><br/><% } %>
|
|
59
|
+
<% if(thirdParty.addressComplement) {%><%= thirdParty.addressComplement %><br/><% } %>
|
|
59
60
|
<% if(thirdParty.zipCode) {%><%= thirdParty.zipCode + ' ' %><% } %><%= thirdParty.city %> <%= thirdParty.country %><br/>
|
|
60
|
-
<% if(thirdParty.deliveryAddress && thirdParty.deliveryCity && thirdParty.deliveryZipCode) {%>Adresse de livraison : <%= thirdParty.deliveryAddress %> <%= thirdParty.deliveryZipCode %> <%= thirdParty.deliveryCity %> <%= thirdParty.deliveryCountry %><br/><% } %>
|
|
61
|
+
<% if(thirdParty.deliveryAddress && thirdParty.deliveryCity && thirdParty.deliveryZipCode) {%>Adresse de livraison : <%= thirdParty.deliveryAddress %><% if(thirdParty.deliveryAddressComplement) {%> <%= thirdParty.deliveryAddressComplement %><% } %> <%= thirdParty.deliveryZipCode %> <%= thirdParty.deliveryCity %> <%= thirdParty.deliveryCountry %><br/><% } %>
|
|
61
62
|
<% if(thirdParty.nSiret) {%>SIRET : <%= thirdParty.nSiret %><br/><% } %>
|
|
62
63
|
<% if(thirdParty.nTva) {%>N° TVA : <%= thirdParty.nTva %><% } %>
|
|
63
64
|
</div>
|
|
@@ -103,10 +104,13 @@ export const bodyTemplate = `<html class="pdf-content">
|
|
|
103
104
|
<div class="row mt-30 space-between" style="page-break-inside: avoid !important;">
|
|
104
105
|
<div>
|
|
105
106
|
<% if ((settings && (settings.iban || settings.bic || settings.bank)) || paymentType) { %>
|
|
106
|
-
<% if(paymentType) { %><%= languageTemplate.template.common.options.paymentType %> : <%= paymentType %><br
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
107
|
+
<% if(paymentType) { %><%= languageTemplate.template.common.options.paymentType %> : <%= paymentType %><br/>
|
|
108
|
+
<% if (!['Carte bancaire', 'Espèces', 'Chèque'].includes(paymentType)) { %>
|
|
109
|
+
<% if(settings.bank) { %><%= languageTemplate.template.common.options.bank %> : <%= settings.bank %><br/><% } %>
|
|
110
|
+
<% if(settings.iban) { %>IBAN : <%= settings.iban %><br/><% } %>
|
|
111
|
+
<% if(settings.bic) { %>BIC : <%= settings.bic %><% } %>
|
|
112
|
+
<% } %>
|
|
113
|
+
<% } %>
|
|
110
114
|
<% } %>
|
|
111
115
|
</div>
|
|
112
116
|
</div>
|
|
@@ -33,6 +33,7 @@ export class CommercialDocumentCommonHTML {
|
|
|
33
33
|
company = `<div>
|
|
34
34
|
<% if (name) { %><p><%= name %></p><% } %>
|
|
35
35
|
<% if (number || street) { %><p><% } %><% if (number) { %><%= number + ' ' %><% } if (street) { %><%= street %><% } if (number || street) { %></p><% } %>
|
|
36
|
+
<% if (addressComplement) { %><p><%= addressComplement %></p><% } %>
|
|
36
37
|
<% if (zipCode || city) { %><p><% } %><% if (zipCode) { %><%= zipCode + ' ' %><% } if (city) { %><%= city %><% } if (zipCode || city) { %></p><% } %>
|
|
37
38
|
</div>
|
|
38
39
|
<% if (phoneContact) { %><p><%= phoneContact %><p><% } %>
|
package/ts/utils/index.ts
CHANGED
|
@@ -20,5 +20,6 @@ export * from './bankAccount.js';
|
|
|
20
20
|
export * from './commercialOffer.js';
|
|
21
21
|
export * from './societyApproval.js';
|
|
22
22
|
export * from './commercialManagement/saleEmail.js';
|
|
23
|
+
export * from './acdVat.js';
|
|
23
24
|
export * from './transforms/boolean.transform.js';
|
|
24
25
|
export * from './transforms/number.transform.js';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { describe, expect, test } from 'vitest';
|
|
2
|
+
import { Vat } from '../../types/Enum/Vat.js';
|
|
3
|
+
import { AcdVatCode } from '../../types/Interface/api/acd/Vat.js';
|
|
4
|
+
import { acdVatCodeToIdVat, idVatToAcdVatCode } from '../acdVat.js';
|
|
5
|
+
|
|
6
|
+
describe('acdVat utils', () => {
|
|
7
|
+
test('should map internal VAT ids to ACD VAT codes', () => {
|
|
8
|
+
expect(idVatToAcdVatCode(Vat.TX_20.id)).toBe(AcdVatCode.NORMAL);
|
|
9
|
+
expect(idVatToAcdVatCode(Vat.TX_10.id)).toBe(AcdVatCode.REDUIT_10);
|
|
10
|
+
expect(idVatToAcdVatCode(Vat.TX_5_5.id)).toBe(AcdVatCode.REDUIT_5_5);
|
|
11
|
+
expect(idVatToAcdVatCode(Vat.TX_2_1.id)).toBe(AcdVatCode.REDUIT_2_1);
|
|
12
|
+
expect(idVatToAcdVatCode(Vat.INTRACOM_TX_20.id)).toBe(AcdVatCode.INTRACOM);
|
|
13
|
+
expect(idVatToAcdVatCode(Vat.IMPORTATION_TX_20.id)).toBe(AcdVatCode.AUTOL);
|
|
14
|
+
expect(idVatToAcdVatCode(Vat.WITHOUT_TAXE.id)).toBeNull();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
test('should map ACD VAT codes back to internal VAT ids', () => {
|
|
18
|
+
expect(acdVatCodeToIdVat(AcdVatCode.NORMAL)).toBe(Vat.TX_20.id);
|
|
19
|
+
expect(acdVatCodeToIdVat(AcdVatCode.REDUIT_10)).toBe(Vat.TX_10.id);
|
|
20
|
+
expect(acdVatCodeToIdVat(AcdVatCode.REDUIT_5_5)).toBe(Vat.TX_5_5.id);
|
|
21
|
+
expect(acdVatCodeToIdVat(AcdVatCode.REDUIT_2_1)).toBe(Vat.TX_2_1.id);
|
|
22
|
+
expect(acdVatCodeToIdVat(AcdVatCode.INTRACOM)).toBe(Vat.INTRACOM_TX_20.id);
|
|
23
|
+
expect(acdVatCodeToIdVat(AcdVatCode.AUTOL)).toBe(Vat.IMPORTATION_TX_20.id);
|
|
24
|
+
expect(acdVatCodeToIdVat(AcdVatCode.NON_AFFECTE)).toBeNull();
|
|
25
|
+
});
|
|
26
|
+
});
|