@silexpert/core 1.1.186 → 1.1.188

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 (110) hide show
  1. package/dist/cjs/api/resources/Card.d.ts +2 -2
  2. package/dist/cjs/api/resources/Card.d.ts.map +1 -1
  3. package/dist/cjs/api/resources/Card.js +2 -2
  4. package/dist/cjs/api/resources/Card.js.map +1 -1
  5. package/dist/cjs/api/resources/GeneralLedger.d.ts +8 -0
  6. package/dist/cjs/api/resources/GeneralLedger.d.ts.map +1 -1
  7. package/dist/cjs/api/resources/GeneralLedger.js +32 -0
  8. package/dist/cjs/api/resources/GeneralLedger.js.map +1 -1
  9. package/dist/cjs/api/resources/IncomeStatement.d.ts +2 -0
  10. package/dist/cjs/api/resources/IncomeStatement.d.ts.map +1 -1
  11. package/dist/cjs/api/resources/IncomeStatement.js +10 -0
  12. package/dist/cjs/api/resources/IncomeStatement.js.map +1 -1
  13. package/dist/cjs/api/resources/Journal.d.ts +2 -0
  14. package/dist/cjs/api/resources/Journal.d.ts.map +1 -1
  15. package/dist/cjs/api/resources/Journal.js +7 -0
  16. package/dist/cjs/api/resources/Journal.js.map +1 -1
  17. package/dist/cjs/api/resources/prestation.d.ts +2 -1
  18. package/dist/cjs/api/resources/prestation.d.ts.map +1 -1
  19. package/dist/cjs/api/resources/prestation.js +3 -0
  20. package/dist/cjs/api/resources/prestation.js.map +1 -1
  21. package/dist/cjs/index.d.ts +1 -0
  22. package/dist/cjs/index.d.ts.map +1 -1
  23. package/dist/cjs/index.js +1 -0
  24. package/dist/cjs/index.js.map +1 -1
  25. package/dist/cjs/types/Enum/Card.d.ts +1 -1
  26. package/dist/cjs/types/Enum/Card.js +1 -1
  27. package/dist/cjs/types/Enum/Card.js.map +1 -1
  28. package/dist/cjs/types/Interface/api/card/UpdateCard.d.ts +2 -1
  29. package/dist/cjs/types/Interface/api/card/UpdateCard.d.ts.map +1 -1
  30. package/dist/cjs/types/Interface/api/card/UpdateCard.js +9 -2
  31. package/dist/cjs/types/Interface/api/card/UpdateCard.js.map +1 -1
  32. package/dist/cjs/types/Interface/api/prestation/CreatePrestation.d.ts +5 -0
  33. package/dist/cjs/types/Interface/api/prestation/CreatePrestation.d.ts.map +1 -1
  34. package/dist/cjs/types/Interface/api/prestation/CreatePrestation.js +19 -1
  35. package/dist/cjs/types/Interface/api/prestation/CreatePrestation.js.map +1 -1
  36. package/dist/cjs/types/Interface/models/ICard.d.ts +11 -1
  37. package/dist/cjs/types/Interface/models/ICard.d.ts.map +1 -1
  38. package/dist/cjs/types/Interface/models/ICard.js.map +1 -1
  39. package/dist/cjs/types/Interface/models/IPrestationComplementary.d.ts +21 -20
  40. package/dist/cjs/types/Interface/models/IPrestationComplementary.d.ts.map +1 -1
  41. package/dist/cjs/types/Interface/models/IPrestationComplementary.js.map +1 -1
  42. package/dist/cjs/utils/commercialManagement/document.d.ts +0 -1
  43. package/dist/cjs/utils/commercialManagement/document.d.ts.map +1 -1
  44. package/dist/cjs/utils/commercialManagement/document.js +1 -41
  45. package/dist/cjs/utils/commercialManagement/document.js.map +1 -1
  46. package/dist/cjs/utils/commercialManagement/templates/common.d.ts.map +1 -1
  47. package/dist/cjs/utils/commercialManagement/templates/common.js +34 -46
  48. package/dist/cjs/utils/commercialManagement/templates/common.js.map +1 -1
  49. package/dist/mjs/api/resources/Card.d.ts +2 -2
  50. package/dist/mjs/api/resources/Card.d.ts.map +1 -1
  51. package/dist/mjs/api/resources/Card.js +4 -2
  52. package/dist/mjs/api/resources/Card.js.map +1 -1
  53. package/dist/mjs/api/resources/GeneralLedger.d.ts +8 -0
  54. package/dist/mjs/api/resources/GeneralLedger.d.ts.map +1 -1
  55. package/dist/mjs/api/resources/GeneralLedger.js +32 -0
  56. package/dist/mjs/api/resources/GeneralLedger.js.map +1 -1
  57. package/dist/mjs/api/resources/IncomeStatement.d.ts +2 -0
  58. package/dist/mjs/api/resources/IncomeStatement.d.ts.map +1 -1
  59. package/dist/mjs/api/resources/IncomeStatement.js +10 -0
  60. package/dist/mjs/api/resources/IncomeStatement.js.map +1 -1
  61. package/dist/mjs/api/resources/Journal.d.ts +2 -0
  62. package/dist/mjs/api/resources/Journal.d.ts.map +1 -1
  63. package/dist/mjs/api/resources/Journal.js +7 -0
  64. package/dist/mjs/api/resources/Journal.js.map +1 -1
  65. package/dist/mjs/api/resources/prestation.d.ts +2 -1
  66. package/dist/mjs/api/resources/prestation.d.ts.map +1 -1
  67. package/dist/mjs/api/resources/prestation.js +3 -0
  68. package/dist/mjs/api/resources/prestation.js.map +1 -1
  69. package/dist/mjs/index.d.ts +1 -0
  70. package/dist/mjs/index.d.ts.map +1 -1
  71. package/dist/mjs/index.js +1 -0
  72. package/dist/mjs/index.js.map +1 -1
  73. package/dist/mjs/types/Enum/Card.d.ts +1 -1
  74. package/dist/mjs/types/Enum/Card.js +1 -1
  75. package/dist/mjs/types/Enum/Card.js.map +1 -1
  76. package/dist/mjs/types/Interface/api/card/UpdateCard.d.ts +2 -1
  77. package/dist/mjs/types/Interface/api/card/UpdateCard.d.ts.map +1 -1
  78. package/dist/mjs/types/Interface/api/card/UpdateCard.js +11 -3
  79. package/dist/mjs/types/Interface/api/card/UpdateCard.js.map +1 -1
  80. package/dist/mjs/types/Interface/api/prestation/CreatePrestation.d.ts +5 -0
  81. package/dist/mjs/types/Interface/api/prestation/CreatePrestation.d.ts.map +1 -1
  82. package/dist/mjs/types/Interface/api/prestation/CreatePrestation.js +20 -0
  83. package/dist/mjs/types/Interface/api/prestation/CreatePrestation.js.map +1 -1
  84. package/dist/mjs/types/Interface/models/ICard.d.ts +11 -1
  85. package/dist/mjs/types/Interface/models/ICard.d.ts.map +1 -1
  86. package/dist/mjs/types/Interface/models/ICard.js.map +1 -1
  87. package/dist/mjs/types/Interface/models/IPrestationComplementary.d.ts +21 -20
  88. package/dist/mjs/types/Interface/models/IPrestationComplementary.d.ts.map +1 -1
  89. package/dist/mjs/types/Interface/models/IPrestationComplementary.js.map +1 -1
  90. package/dist/mjs/utils/commercialManagement/document.d.ts +0 -1
  91. package/dist/mjs/utils/commercialManagement/document.d.ts.map +1 -1
  92. package/dist/mjs/utils/commercialManagement/document.js +1 -76
  93. package/dist/mjs/utils/commercialManagement/document.js.map +1 -1
  94. package/dist/mjs/utils/commercialManagement/templates/common.d.ts.map +1 -1
  95. package/dist/mjs/utils/commercialManagement/templates/common.js +34 -46
  96. package/dist/mjs/utils/commercialManagement/templates/common.js.map +1 -1
  97. package/package.json +1 -1
  98. package/ts/api/resources/Card.ts +5 -3
  99. package/ts/api/resources/GeneralLedger.ts +36 -0
  100. package/ts/api/resources/IncomeStatement.ts +13 -0
  101. package/ts/api/resources/Journal.ts +9 -0
  102. package/ts/api/resources/prestation.ts +6 -0
  103. package/ts/index.ts +1 -0
  104. package/ts/types/Enum/Card.ts +1 -1
  105. package/ts/types/Interface/api/card/UpdateCard.ts +9 -3
  106. package/ts/types/Interface/api/prestation/CreatePrestation.ts +14 -0
  107. package/ts/types/Interface/models/ICard.ts +9 -1
  108. package/ts/types/Interface/models/IPrestationComplementary.ts +21 -20
  109. package/ts/utils/commercialManagement/document.ts +1 -93
  110. package/ts/utils/commercialManagement/templates/common.ts +34 -46
@@ -1,6 +1,7 @@
1
- import { IsBoolean, IsDate, IsEnum, IsInt, IsOptional, IsString } from 'class-validator';
1
+ import { IsBoolean, IsEnum, IsInt, IsOptional, IsString } from 'class-validator';
2
2
  import { ApiPropertyOptional } from '../../../../utils';
3
3
  import { CardState, CardType } from '../../../Enum/Card';
4
+ import { ToBoolean } from '../../../../utils/transforms/boolean.transform';
4
5
 
5
6
  export class UpdateCard {
6
7
  @ApiPropertyOptional()
@@ -14,6 +15,12 @@ export class UpdateCard {
14
15
  @IsBoolean()
15
16
  isManual?: boolean;
16
17
 
18
+ @ApiPropertyOptional()
19
+ @IsOptional()
20
+ @IsBoolean()
21
+ @ToBoolean()
22
+ isBlocked?: string;
23
+
17
24
  @ApiPropertyOptional()
18
25
  @IsOptional()
19
26
  @IsInt()
@@ -22,8 +29,7 @@ export class UpdateCard {
22
29
 
23
30
  @ApiPropertyOptional()
24
31
  @IsOptional()
25
- @IsDate()
26
- plannedAt?: Date;
32
+ plannedAt?: Date | null;
27
33
 
28
34
  @ApiPropertyOptional()
29
35
  @IsOptional()
@@ -13,3 +13,17 @@ export class CreatePrestation {
13
13
  @ApiPropertyOptional()
14
14
  label?: string;
15
15
  }
16
+
17
+ export class CreateSocietyPrestationComplementary {
18
+ @ApiProperty()
19
+ @IsNumber()
20
+ idPrestationList: number;
21
+
22
+ @ApiProperty()
23
+ @IsNumber()
24
+ idExercice: number;
25
+
26
+ @ApiProperty()
27
+ @IsNumber()
28
+ totalTaxExcluded: number;
29
+ }
@@ -12,7 +12,8 @@ export interface ICard {
12
12
  type: CardType;
13
13
  state: CardState;
14
14
  isManual: boolean;
15
- plannedAt?: Date;
15
+ isBlocked: boolean;
16
+ plannedAt?: Date | null;
16
17
  idUser: number;
17
18
  idSociety: number;
18
19
  createdAt?: Date;
@@ -28,3 +29,10 @@ export interface ICard {
28
29
  history?: ICardHistory[];
29
30
  comment?: IComment;
30
31
  }
32
+
33
+ export interface CardAnnotedTransaction { total: number, nbAnnoted: number, rate: number }
34
+
35
+ export interface CardDetail {
36
+ card: ICard;
37
+ annotedTransaction: CardAnnotedTransaction;
38
+ }
@@ -2,34 +2,35 @@ import { IUser } from './IUser';
2
2
  import { IPaymentExpectation } from './IPaymentExpectation';
3
3
  import { IGedFile } from './IGedFile';
4
4
  import { IPrestation } from './IPrestation';
5
+ import { AcceptationAdmin } from '../../Enum/AdditionnalSells';
5
6
 
6
7
  // prestationsCompl
7
8
  export interface IPrestationComplementary {
8
9
  id?: number;
9
10
  generateLink: boolean;
10
- deadline: Date | null;
11
- dateEstimateSigned: Date | null;
12
- dateSendToClient: Date | null;
13
- dateInvoice: Date | null;
14
- datePayment: Date | null;
15
- dateTransmission: Date | null;
16
- idGedFile: number | null;
17
- idCollaborater: number | null;
18
- idUser: number | null;
19
- idPaymentExpectation: number | null;
20
- description: string | null;
21
- note: string | null;
22
- forOtherMission: string | null;
23
- statePrestationJuridique: number | null;
24
- acceptationAdmin: number;
11
+ deadline?: Date | null;
12
+ dateEstimateSigned?: Date | null;
13
+ dateSendToClient?: Date | null;
14
+ dateInvoice?: Date | null;
15
+ datePayment?: Date | null;
16
+ dateTransmission?: Date | null;
17
+ idGedFile?: number | null;
18
+ idCollaborater?: number | null;
19
+ idUser?: number | null;
20
+ idPaymentExpectation?: number | null;
21
+ description?: string | null;
22
+ note?: string | null;
23
+ forOtherMission?: string | null;
24
+ statePrestationJuridique?: number | null;
25
+ acceptationAdmin: AcceptationAdmin;
25
26
  createdAt?: Date | null;
26
27
  updatedAt?: Date | null;
27
28
  deletedAt?: Date | null;
28
29
 
29
30
  // Associations
30
- prestationUser: IUser;
31
- prestationCollaborater: IUser;
32
- prestationPaymentExpectation: IPaymentExpectation;
33
- prestationGedFile: IGedFile;
34
- prestation: IPrestation;
31
+ prestationUser?: IUser;
32
+ prestationCollaborater?: IUser;
33
+ prestationPaymentExpectation?: IPaymentExpectation;
34
+ prestationGedFile?: IGedFile;
35
+ prestation?: IPrestation;
35
36
  }
@@ -4,7 +4,7 @@ import {
4
4
  import * as dayjs from 'dayjs';
5
5
  import { ReadCommercialDocumentTemplate, ReadDocumentEditing } from '../../types/Interface/api/commercialManagement/Read';
6
6
  import {
7
- AccountingCategoryList, FontIds, fontList, VatMarginCategyList,
7
+ AccountingCategoryList, FontIds, fontList,
8
8
  } from '../../types/Enum/CommercialManagement';
9
9
  import { EstimateInvoiceType } from '../../types/Enum/EstimateInvoice';
10
10
  import { Vat } from '../../types/Enum/Vat';
@@ -122,98 +122,6 @@ export function generateCommercialDocument(idEstimateInvoiceType: EstimateInvoic
122
122
  };
123
123
  }
124
124
 
125
- export function generateAdvanceDocument(payload: CreateInvoiceDocument, shouldHideBrandName = false, nodeEnv: string | undefined = undefined): ReadCommercialDocumentTemplate {
126
- if (!payload.deposit) throw new Error('Aucun acompte défini');
127
-
128
- const data: ReadDocumentEditing & { brandColors: brandColorType, brandName: string, shouldHideBrandName: boolean } = {
129
- ...payload,
130
- title: payload.title ?? null,
131
- paymentLink: payload.paymentLink ?? '#',
132
- idEstimateInvoiceType: EstimateInvoiceType.ACOMPTE,
133
- phoneContact: payload.settings?.phoneContact ?? null,
134
- products: [],
135
- vats: [],
136
- totalTaxExcluded: payload.deposit,
137
- totalTaxIncluded: payload.deposit,
138
- totalTaxAndDiscountIncluded: payload.deposit,
139
- generalDiscountFormatted: null,
140
- depositFormatted: integerToFormattedAmountString(payload.deposit),
141
- totalTaxExcludedFormatted: integerToFormattedAmountString(payload.deposit),
142
- totalTaxIncludedFormatted: integerToFormattedAmountString(payload.deposit),
143
- totalTaxAndDiscountIncludedFormatted: integerToFormattedAmountString(
144
- payload.deposit,
145
- ),
146
- totalVatAmountFormatted: integerToFormattedAmountString(0),
147
- font: {
148
- id: payload.settings?.idFont ?? FontIds.CIRCULAR_STD,
149
- name:
150
- fontList.find((f) => f.id === payload.settings?.idFont)?.name
151
- ?? fontList[0].name,
152
- url:
153
- fontList.find((f) => f.id === payload.settings?.idFont)?.link
154
- ?? fontList[0].link,
155
- },
156
- capitalFormatted: payload.capital
157
- ? `${payload.capital}`
158
- .split('')
159
- .reduceRight(
160
- (acc, char, i, { length }) => `${char}${(length - (i + 1)) % 3 === 0 ? ' ' : ''}${acc}`,
161
- '',
162
- )
163
- .trim()
164
- : null,
165
- dueDateFormatted: payload.dueDate
166
- ? dayjs(payload.dueDate).format('DD/MM/YYYY')
167
- : null,
168
- expirationDateFormatted: payload.expirationDate
169
- ? dayjs(payload.expirationDate).format('DD/MM/YYYY')
170
- : null,
171
- emissionDateFormatted: payload.emissionDate
172
- ? dayjs(payload.emissionDate).format('DD/MM/YYYY')
173
- : null,
174
- shouldDisplayDiscountColumn: false,
175
- disableVat: true,
176
- // @ts-ignore
177
- marginVats: _uniq(
178
- (payload.assetMarginVatIds ?? []).map(
179
- (m) => VatMarginCategyList.find((c) => c.id === m)?.label ?? null,
180
- ),
181
- ),
182
- accountingCategoryFormatted:
183
- AccountingCategoryList.find((a) => a.id === payload.accountingCategory)
184
- ?.label ?? null,
185
- // @ts-ignore
186
- brandColors: getBrandConfig({ objectWaited: 'colors', nodeEnv }) as brandColorType,
187
- brandName: `${getBrandConfig({ objectWaited: 'name', nodeEnv })}`,
188
- shouldHideBrandName,
189
- };
190
-
191
- const commonTemplate = new CommercialDocumentCommonHTML();
192
-
193
- return {
194
- header: ejs?.render(commonTemplate.header, data),
195
- body: ejs?.render(bodyTemplate, {
196
- ...data,
197
- comment:
198
- data.comment && typeof data.comment === 'string'
199
- ? data.comment?.replace(/\n/g, '<br/>')
200
- : null,
201
- products: data.products.map((p) => ({
202
- ...p,
203
- comment:
204
- p.comment && typeof p.comment === 'string'
205
- ? p.comment?.replace(/\n/g, '<br/>')
206
- : null,
207
- })),
208
- }),
209
- footer: ejs?.render(commonTemplate.footer, {
210
- ...data,
211
- freeText: payload?.settings?.freeInvoiceText ?? null,
212
- }),
213
- data,
214
- };
215
- }
216
-
217
125
  export function generateMailHeader(params: CreateMailHeader, shouldHideBrandName = false, nodeEnv: string | undefined = undefined): ReadCommercialMailTemplate {
218
126
  dayjs.locale('fr');
219
127
  const data = {
@@ -50,16 +50,6 @@ export class CommercialDocumentCommonHTML {
50
50
  <td>Montant <%= disableVat !== true ? 'HT' : ''%></td>
51
51
  </tr>
52
52
  </thead>
53
- <% if (idEstimateInvoiceType === ${EstimateInvoiceType.ACOMPTE}) { %>
54
- <tr>
55
- <td class="product-title">
56
- <%= title %>
57
- </td>
58
- <td class="product-quantity">1</td>
59
- <td class="product-price-without-vat"><%= depositFormatted %>€</td>
60
- <td class="product-total-price-without-vat"><%= depositFormatted %>€</td>
61
- </tr>
62
- <% } %>
63
53
  <% if (products) { %>
64
54
  <% products.forEach(function (product) { %>
65
55
  <tr>
@@ -107,42 +97,40 @@ export class CommercialDocumentCommonHTML {
107
97
  <td colspan="2">Récapitulatif</td>
108
98
  </tr>
109
99
  </thead>
110
- <% if (idEstimateInvoiceType !== ${EstimateInvoiceType.ACOMPTE}) { %>
111
- <% if (disableVat !== true) { %>
112
- <tr>
113
- <td>Total HT</td>
114
- <td><%= totalTaxExcludedFormatted %>€</td>
115
- </tr>
116
- <% } %>
117
- <% if (generalDiscountFormatted) { %>
118
- <tr>
119
- <td>Remise</td>
120
- <td><%= generalDiscountFormatted %>€</td>
121
- </tr>
122
- <% } %>
123
- <% if (disableVat !== true) { %>
124
- <tr>
125
- <td>TVA</td>
126
- <td><%= totalVatAmountFormatted %>€</td>
127
- </tr>
128
- <% } %>
129
- <% if (disableVat !== true || generalDiscountFormatted || depositFormatted) { %>
130
- <tr>
131
- <td>Total <%= disableVat !== true ? 'TTC' : ''%></td>
132
- <td><%= totalTaxIncludedFormatted %>€</td>
133
- </tr>
134
- <% } else if (disableVat === true && ![${EstimateInvoiceType.FACTURE}, ${EstimateInvoiceType.RESTE}, ${EstimateInvoiceType.ACOMPTE}].includes(idEstimateInvoiceType)) { %>
135
- <tr>
136
- <td>Total</td>
137
- <td><%= totalTaxIncludedFormatted %>€</td>
138
- </tr>
139
- <% } %>
140
- <% if (depositFormatted) { %>
141
- <tr>
142
- <td>Acompte</td>
143
- <td><%= depositFormatted %>€</td>
144
- </tr>
145
- <% } %>
100
+ <% if (disableVat !== true) { %>
101
+ <tr>
102
+ <td>Total HT</td>
103
+ <td><%= totalTaxExcludedFormatted %>€</td>
104
+ </tr>
105
+ <% } %>
106
+ <% if (generalDiscountFormatted) { %>
107
+ <tr>
108
+ <td>Remise</td>
109
+ <td><%= generalDiscountFormatted %>€</td>
110
+ </tr>
111
+ <% } %>
112
+ <% if (disableVat !== true) { %>
113
+ <tr>
114
+ <td>TVA</td>
115
+ <td><%= totalVatAmountFormatted %>€</td>
116
+ </tr>
117
+ <% } %>
118
+ <% if (disableVat !== true || generalDiscountFormatted || depositFormatted) { %>
119
+ <tr>
120
+ <td>Total <%= disableVat !== true ? 'TTC' : ''%></td>
121
+ <td><%= totalTaxIncludedFormatted %>€</td>
122
+ </tr>
123
+ <% } else if (disableVat === true && ![${EstimateInvoiceType.FACTURE}, ${EstimateInvoiceType.RESTE}, ${EstimateInvoiceType.ACOMPTE}].includes(idEstimateInvoiceType)) { %>
124
+ <tr>
125
+ <td>Total</td>
126
+ <td><%= totalTaxIncludedFormatted %>€</td>
127
+ </tr>
128
+ <% } %>
129
+ <% if (depositFormatted) { %>
130
+ <tr>
131
+ <td>Acompte</td>
132
+ <td><%= depositFormatted %>€</td>
133
+ </tr>
146
134
  <% } %>
147
135
  <% if ([${EstimateInvoiceType.FACTURE}, ${EstimateInvoiceType.RESTE}, ${EstimateInvoiceType.ACOMPTE}].includes(idEstimateInvoiceType)) { %>
148
136
  <tr>