@silexpert/core 1.0.34 → 1.0.39

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.
Files changed (55) hide show
  1. package/es/api/resources/CommercialDocument.js +1 -1
  2. package/es/api/resources/CommercialDocument.js.map +1 -1
  3. package/es/types/Enum/RecurrenceType.d.ts +1 -1
  4. package/es/types/Enum/RecurrenceType.d.ts.map +1 -1
  5. package/es/types/Enum/RecurrenceType.js +2 -2
  6. package/es/types/Enum/RecurrenceType.js.map +1 -1
  7. package/es/types/Interface/api/commercialManagement/Create.d.ts +6 -6
  8. package/es/types/Interface/api/commercialManagement/Create.d.ts.map +1 -1
  9. package/es/types/Interface/api/commercialManagement/Create.js.map +1 -1
  10. package/es/types/Interface/api/commercialManagement/Query.d.ts +4 -2
  11. package/es/types/Interface/api/commercialManagement/Query.d.ts.map +1 -1
  12. package/es/types/Interface/api/commercialManagement/Query.js +10 -3
  13. package/es/types/Interface/api/commercialManagement/Query.js.map +1 -1
  14. package/es/types/Interface/api/thirdParty/CreateThirdPartyForm.d.ts +3 -3
  15. package/es/types/Interface/api/thirdParty/CreateThirdPartyForm.d.ts.map +1 -1
  16. package/es/types/Interface/api/thirdParty/CreateThirdPartyForm.js +1 -3
  17. package/es/types/Interface/api/thirdParty/CreateThirdPartyForm.js.map +1 -1
  18. package/es/types/Interface/api/thirdParty/UpdateThirdPartyForm.d.ts +3 -3
  19. package/es/types/Interface/api/thirdParty/UpdateThirdPartyForm.d.ts.map +1 -1
  20. package/es/types/Interface/api/thirdParty/UpdateThirdPartyForm.js +1 -3
  21. package/es/types/Interface/api/thirdParty/UpdateThirdPartyForm.js.map +1 -1
  22. package/es/utils/commercialManagement/document.d.ts.map +1 -1
  23. package/es/utils/commercialManagement/document.js +6 -14
  24. package/es/utils/commercialManagement/document.js.map +1 -1
  25. package/es/utils/commercialManagement/product.js +2 -2
  26. package/es/utils/commercialManagement/product.js.map +1 -1
  27. package/es/utils/commercialManagement/recurrence.js +1 -1
  28. package/es/utils/commercialManagement/recurrence.js.map +1 -1
  29. package/js/api/resources/CommercialDocument.js +1 -1
  30. package/js/api/resources/CommercialDocument.js.map +1 -1
  31. package/js/types/Enum/RecurrenceType.js +2 -2
  32. package/js/types/Enum/RecurrenceType.js.map +1 -1
  33. package/js/types/Interface/api/commercialManagement/Create.js.map +1 -1
  34. package/js/types/Interface/api/commercialManagement/Query.js +6 -4
  35. package/js/types/Interface/api/commercialManagement/Query.js.map +1 -1
  36. package/js/types/Interface/api/thirdParty/CreateThirdPartyForm.js +2 -2
  37. package/js/types/Interface/api/thirdParty/CreateThirdPartyForm.js.map +1 -1
  38. package/js/types/Interface/api/thirdParty/UpdateThirdPartyForm.js +2 -2
  39. package/js/types/Interface/api/thirdParty/UpdateThirdPartyForm.js.map +1 -1
  40. package/js/utils/commercialManagement/document.js +13 -21
  41. package/js/utils/commercialManagement/document.js.map +1 -1
  42. package/js/utils/commercialManagement/product.js +2 -2
  43. package/js/utils/commercialManagement/product.js.map +1 -1
  44. package/js/utils/commercialManagement/recurrence.js +1 -1
  45. package/js/utils/commercialManagement/recurrence.js.map +1 -1
  46. package/package.json +1 -1
  47. package/ts/api/resources/CommercialDocument.ts +1 -1
  48. package/ts/types/Enum/RecurrenceType.ts +2 -2
  49. package/ts/types/Interface/api/commercialManagement/Create.ts +17 -17
  50. package/ts/types/Interface/api/commercialManagement/Query.ts +12 -5
  51. package/ts/types/Interface/api/thirdParty/CreateThirdPartyForm.ts +4 -6
  52. package/ts/types/Interface/api/thirdParty/UpdateThirdPartyForm.ts +4 -6
  53. package/ts/utils/commercialManagement/document.ts +5 -14
  54. package/ts/utils/commercialManagement/product.ts +1 -1
  55. package/ts/utils/commercialManagement/recurrence.ts +1 -1
@@ -204,13 +204,13 @@ export class CreateCommercialSetting {
204
204
 
205
205
  @ApiPropertyOptional()
206
206
  @IsOptional()
207
- accountingCategory: AccountingCategoryId;
207
+ accountingCategory?: AccountingCategoryId;
208
208
 
209
209
  @ApiPropertyOptional()
210
210
  @IsOptional()
211
211
  @IsBoolean()
212
212
  @ToBoolean()
213
- shouldPayTaxAfterDebit: boolean;
213
+ shouldPayTaxAfterDebit?: boolean;
214
214
  }
215
215
 
216
216
  export class CreateCommercialMail {
@@ -258,18 +258,18 @@ export class CommercialDocumentInputs {
258
258
 
259
259
  @ApiProperty()
260
260
  @IsString()
261
- reference: string; //
261
+ reference: string;
262
262
 
263
263
  @ApiProperty()
264
- thirdParty: IThirdParty; //
264
+ thirdParty: IThirdParty;
265
265
 
266
266
  @ApiProperty()
267
267
  @IsDateString()
268
- emissionDate: string; //
268
+ emissionDate: string;
269
269
 
270
270
  @ApiProperty()
271
271
  @IsDateString()
272
- dueDate: string; //
272
+ dueDate: string;
273
273
 
274
274
  @ApiProperty({ description: 'Date d\'expiration pour la facture d\'acompte' })
275
275
  expirationDate: string | null;
@@ -283,23 +283,23 @@ export class CommercialDocumentInputs {
283
283
 
284
284
  @ApiProperty({ description: 'Escompte' })
285
285
  @IsString()
286
- discount: string; //
286
+ discount: string;
287
287
 
288
288
  @ApiProperty()
289
- comment: string | null; //
289
+ comment: string | null;
290
290
 
291
291
  @ApiProperty({ description: 'Pénalité de retard' })
292
- penalties: string | null; //
292
+ penalties: string | null;
293
293
 
294
294
  @ApiProperty({ description: 'Remise globale' })
295
295
  @IsNumber()
296
- generalDiscount2: number; //
296
+ generalDiscount2: number;
297
297
 
298
298
  @ApiProperty({ description: 'Indemnité forfaitaire' })
299
- compensation: string | null; //
299
+ compensation: string | null;
300
300
 
301
301
  @ApiProperty()
302
- vatMention: string | null; //
302
+ vatMention: string | null;
303
303
 
304
304
  @ApiProperty()
305
305
  @IsBoolean()
@@ -307,7 +307,7 @@ export class CommercialDocumentInputs {
307
307
  disableVat: boolean;
308
308
 
309
309
  @ApiProperty()
310
- title: string | null; //
310
+ title: string | null;
311
311
 
312
312
  @ApiProperty({ description: 'Commercial name of seller' })
313
313
  @IsString()
@@ -326,7 +326,7 @@ export class CommercialDocumentInputs {
326
326
  city: string | null;
327
327
 
328
328
  @ApiProperty()
329
- settings?: ISocietyGescom;
329
+ settings: ISocietyGescom;
330
330
 
331
331
  @ApiProperty()
332
332
  cgv: string | null;
@@ -337,12 +337,12 @@ export class CommercialDocumentInputs {
337
337
  @ApiProperty()
338
338
  @IsBoolean()
339
339
  @ToBoolean()
340
- isStripeAllowed?: boolean;
340
+ isStripeAllowed: boolean;
341
341
 
342
342
  @ApiProperty()
343
343
  @IsBoolean()
344
344
  @ToBoolean()
345
- isDraft?: boolean;
345
+ isDraft: boolean;
346
346
 
347
347
  @ApiProperty()
348
348
  idEstimateInvoiceType: EstimateInvoiceType;
@@ -353,7 +353,7 @@ export class CommercialDocumentInputs {
353
353
  @ApiProperty()
354
354
  @IsBoolean()
355
355
  @ToBoolean()
356
- shouldPayTaxAfterDebit: boolean;
356
+ shouldPayTaxAfterDebit?: boolean;
357
357
  }
358
358
 
359
359
  export class CreatePreSaleDocument extends CommercialDocumentInputs {
@@ -1,5 +1,5 @@
1
1
  import {
2
- IsArray, IsBoolean, IsDateString, IsNumber, IsOptional, IsString,
2
+ IsArray, IsBoolean, IsDateString, IsOptional, IsString,
3
3
  } from 'class-validator';
4
4
  import { Order } from '../../..';
5
5
  import { ApiProperty, ApiPropertyOptional } from '../../../../utils';
@@ -37,6 +37,13 @@ export class QueryInvoice {
37
37
  @ApiPropertyOptional()
38
38
  @IsBoolean()
39
39
  @ToBoolean()
40
+ @IsOptional()
41
+ toAnnotate?: boolean;
42
+
43
+ @ApiPropertyOptional()
44
+ @IsOptional()
45
+ @IsBoolean()
46
+ @ToBoolean()
40
47
  isDescending?: boolean;
41
48
  }
42
49
 
@@ -49,19 +56,18 @@ export interface ParamPaginatedInvoices {
49
56
  status?: InvoiceStatus;
50
57
  search?: string;
51
58
  pagination: QueryPaginate;
59
+ toAnnotate?: boolean;
52
60
  order?: Order;
53
61
  }
54
62
 
55
63
  export class QueryGetDefaultPayload {
56
64
  @ApiProperty()
57
- @IsNumber()
58
- idEstimateInvoiceType: number;
65
+ idEstimateInvoiceType: EstimateInvoiceType;
59
66
  }
60
67
 
61
68
  export class QueryNextReference {
62
69
  @ApiProperty()
63
- @IsNumber()
64
- idEstimateInvoiceType: number;
70
+ idEstimateInvoiceType: EstimateInvoiceType;
65
71
 
66
72
  @ApiPropertyOptional()
67
73
  @IsBoolean()
@@ -119,6 +125,7 @@ export class QueryDocumentPaginated {
119
125
  @ApiPropertyOptional()
120
126
  @IsBoolean()
121
127
  @ToBoolean()
128
+ @IsOptional()
122
129
  isDraft?: boolean;
123
130
  }
124
131
 
@@ -1,4 +1,4 @@
1
- import { IsEnum, IsOptional, IsString } from 'class-validator';
1
+ import { IsEnum, IsOptional } from 'class-validator';
2
2
  import { ThirdPartyType } from '../../..';
3
3
  import { ApiProperty, ApiPropertyOptional } from '../../../../utils';
4
4
 
@@ -66,15 +66,13 @@ export class CreateThirdPartyForm {
66
66
 
67
67
  @ApiPropertyOptional()
68
68
  @IsOptional()
69
- @IsString()
70
- deliveryAddress: string | null;
69
+ deliveryAddress?: string | null;
71
70
 
72
71
  @ApiPropertyOptional()
73
72
  @IsOptional()
74
- @IsString()
75
- deliveryCity: string | null;
73
+ deliveryCity?: string | null;
76
74
 
77
75
  @ApiPropertyOptional()
78
76
  @IsOptional()
79
- deliveryZipCode: string | null;
77
+ deliveryZipCode?: string | null;
80
78
  }
@@ -1,4 +1,4 @@
1
- import { IsEnum, IsOptional, IsString } from 'class-validator';
1
+ import { IsEnum, IsOptional } from 'class-validator';
2
2
  import { ThirdPartyType } from '../../..';
3
3
  import { ApiPropertyOptional } from '../../../../utils';
4
4
 
@@ -86,15 +86,13 @@ export class UpdateThirdPartyForm {
86
86
 
87
87
  @ApiPropertyOptional()
88
88
  @IsOptional()
89
- @IsString()
90
- deliveryAddress: string | null;
89
+ deliveryAddress?: string | null;
91
90
 
92
91
  @ApiPropertyOptional()
93
92
  @IsOptional()
94
- @IsString()
95
- deliveryCity: string | null;
93
+ deliveryCity?: string | null;
96
94
 
97
95
  @ApiPropertyOptional()
98
96
  @IsOptional()
99
- deliveryZipCode: string | null;
97
+ deliveryZipCode?: string | null;
100
98
  }
@@ -26,12 +26,12 @@ export function generateCommercialDocument(idEstimateInvoiceType: EstimateInvoic
26
26
  phoneContact: payload.settings?.phoneContact ?? null,
27
27
  products,
28
28
  vats,
29
- totalTaxExcluded: _sumBy(products, 'totalTaxExcluded'),
30
- totalTaxIncluded: _sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount'),
31
- totalTaxAndDiscountIncluded: _sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount') - (payload.generalDiscount2 ?? 0),
29
+ totalTaxExcluded: _sumBy(products, 'totalTaxExcluded') - (payload.deposit ?? 0),
30
+ totalTaxIncluded: _sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount') - (payload.deposit ?? 0),
31
+ totalTaxAndDiscountIncluded: _sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount') - (payload.generalDiscount2 ?? 0) - (payload.deposit ?? 0),
32
32
  generalDiscountFormatted: payload.generalDiscount2 ? integerToFormattedAmountString(payload.generalDiscount2) : null,
33
33
  depositFormatted: payload.deposit ? integerToFormattedAmountString(payload.deposit) : null,
34
- totalTaxExcludedFormatted: integerToFormattedAmountString(_sumBy(products, 'totalTaxExcluded')),
34
+ totalTaxExcludedFormatted: integerToFormattedAmountString(_sumBy(products, 'totalTaxExcluded') - (payload.deposit ?? 0)),
35
35
  totalTaxIncludedFormatted: integerToFormattedAmountString(_sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount') - (payload.deposit ?? 0)),
36
36
  totalTaxAndDiscountIncludedFormatted: integerToFormattedAmountString(_sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount') - (payload.generalDiscount2 ?? 0) - (payload.deposit ?? 0)),
37
37
  totalVatAmountFormatted: integerToFormattedAmountString(_sumBy(vats, 'amount')),
@@ -50,16 +50,7 @@ export function generateCommercialDocument(idEstimateInvoiceType: EstimateInvoic
50
50
  };
51
51
 
52
52
  const commonTemplate = new CommercialDocumentCommonHTML();
53
-
54
- let documentFreeText: string | null | undefined;
55
-
56
- // A GERER EN FONCTION DU DOCUMENT
57
- if ([EstimateInvoiceType.DEVIS, EstimateInvoiceType.BON].includes(idEstimateInvoiceType)) {
58
- documentFreeText = payload?.settings?.freeEstimateText;
59
- } else {
60
- documentFreeText = payload?.settings?.freeInvoiceText;
61
- }
62
- //
53
+ const documentFreeText = [EstimateInvoiceType.DEVIS, EstimateInvoiceType.BON].includes(idEstimateInvoiceType) ? payload?.settings?.freeEstimateText : payload?.settings?.freeInvoiceText;
63
54
 
64
55
  return {
65
56
  header: ejs.render(commonTemplate.header, data),
@@ -19,7 +19,7 @@ export function getDiscount(product: IProductInvoice): number {
19
19
 
20
20
  export function getTotalTaxExcluded(product: IProductInvoice): number {
21
21
  const discount = product.discount2 && product.discount2 > 0 ? getDiscount(product) : 0;
22
- return (product.priceTaxExcluded ?? 0) * (product.quantity ?? 1) - (discount * (product.quantity ?? 1));
22
+ return ((product.priceTaxExcluded ?? 0) - discount) * (product.quantity ?? 1);
23
23
  }
24
24
 
25
25
  export function productToReadProductEditing(payload: IProductInvoice): ReadProductEditing {
@@ -22,7 +22,7 @@ export function getAllRecurrences(params: {
22
22
 
23
23
  if (type === RecurrenceType.MONHLY) recurrency = 'month';
24
24
  // @ts-ignore
25
- else if (type === RecurrenceType.QUATERLY) recurrency = 'quarter';
25
+ else if (type === RecurrenceType.QUARTERLY) recurrency = 'quarter';
26
26
  else if (type === RecurrenceType.WEEKLY) recurrency = 'week';
27
27
  else if (type === RecurrenceType.YEARLY) recurrency = 'year';
28
28