@silexpert/core 1.1.186 → 1.1.187
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/cjs/api/resources/GeneralLedger.d.ts +8 -0
- package/dist/cjs/api/resources/GeneralLedger.d.ts.map +1 -1
- package/dist/cjs/api/resources/GeneralLedger.js +32 -0
- package/dist/cjs/api/resources/GeneralLedger.js.map +1 -1
- package/dist/cjs/api/resources/IncomeStatement.d.ts +2 -0
- package/dist/cjs/api/resources/IncomeStatement.d.ts.map +1 -1
- package/dist/cjs/api/resources/IncomeStatement.js +10 -0
- package/dist/cjs/api/resources/IncomeStatement.js.map +1 -1
- package/dist/cjs/api/resources/Journal.d.ts +2 -0
- package/dist/cjs/api/resources/Journal.d.ts.map +1 -1
- package/dist/cjs/api/resources/Journal.js +7 -0
- package/dist/cjs/api/resources/Journal.js.map +1 -1
- package/dist/cjs/api/resources/prestation.d.ts +2 -1
- package/dist/cjs/api/resources/prestation.d.ts.map +1 -1
- package/dist/cjs/api/resources/prestation.js +3 -0
- package/dist/cjs/api/resources/prestation.js.map +1 -1
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/Interface/api/prestation/CreatePrestation.d.ts +5 -0
- package/dist/cjs/types/Interface/api/prestation/CreatePrestation.d.ts.map +1 -1
- package/dist/cjs/types/Interface/api/prestation/CreatePrestation.js +19 -1
- package/dist/cjs/types/Interface/api/prestation/CreatePrestation.js.map +1 -1
- package/dist/cjs/types/Interface/models/IPrestationComplementary.d.ts +21 -20
- package/dist/cjs/types/Interface/models/IPrestationComplementary.d.ts.map +1 -1
- package/dist/cjs/types/Interface/models/IPrestationComplementary.js.map +1 -1
- package/dist/cjs/utils/commercialManagement/document.d.ts +0 -1
- package/dist/cjs/utils/commercialManagement/document.d.ts.map +1 -1
- package/dist/cjs/utils/commercialManagement/document.js +1 -41
- package/dist/cjs/utils/commercialManagement/document.js.map +1 -1
- package/dist/cjs/utils/commercialManagement/templates/common.d.ts.map +1 -1
- package/dist/cjs/utils/commercialManagement/templates/common.js +34 -46
- package/dist/cjs/utils/commercialManagement/templates/common.js.map +1 -1
- package/dist/mjs/api/resources/GeneralLedger.d.ts +8 -0
- package/dist/mjs/api/resources/GeneralLedger.d.ts.map +1 -1
- package/dist/mjs/api/resources/GeneralLedger.js +32 -0
- package/dist/mjs/api/resources/GeneralLedger.js.map +1 -1
- package/dist/mjs/api/resources/IncomeStatement.d.ts +2 -0
- package/dist/mjs/api/resources/IncomeStatement.d.ts.map +1 -1
- package/dist/mjs/api/resources/IncomeStatement.js +10 -0
- package/dist/mjs/api/resources/IncomeStatement.js.map +1 -1
- package/dist/mjs/api/resources/Journal.d.ts +2 -0
- package/dist/mjs/api/resources/Journal.d.ts.map +1 -1
- package/dist/mjs/api/resources/Journal.js +7 -0
- package/dist/mjs/api/resources/Journal.js.map +1 -1
- package/dist/mjs/api/resources/prestation.d.ts +2 -1
- package/dist/mjs/api/resources/prestation.d.ts.map +1 -1
- package/dist/mjs/api/resources/prestation.js +3 -0
- package/dist/mjs/api/resources/prestation.js.map +1 -1
- package/dist/mjs/index.d.ts +1 -0
- package/dist/mjs/index.d.ts.map +1 -1
- package/dist/mjs/index.js +1 -0
- package/dist/mjs/index.js.map +1 -1
- package/dist/mjs/types/Interface/api/prestation/CreatePrestation.d.ts +5 -0
- package/dist/mjs/types/Interface/api/prestation/CreatePrestation.d.ts.map +1 -1
- package/dist/mjs/types/Interface/api/prestation/CreatePrestation.js +20 -0
- package/dist/mjs/types/Interface/api/prestation/CreatePrestation.js.map +1 -1
- package/dist/mjs/types/Interface/models/IPrestationComplementary.d.ts +21 -20
- package/dist/mjs/types/Interface/models/IPrestationComplementary.d.ts.map +1 -1
- package/dist/mjs/types/Interface/models/IPrestationComplementary.js.map +1 -1
- package/dist/mjs/utils/commercialManagement/document.d.ts +0 -1
- package/dist/mjs/utils/commercialManagement/document.d.ts.map +1 -1
- package/dist/mjs/utils/commercialManagement/document.js +1 -76
- package/dist/mjs/utils/commercialManagement/document.js.map +1 -1
- package/dist/mjs/utils/commercialManagement/templates/common.d.ts.map +1 -1
- package/dist/mjs/utils/commercialManagement/templates/common.js +34 -46
- package/dist/mjs/utils/commercialManagement/templates/common.js.map +1 -1
- package/package.json +1 -1
- package/ts/api/resources/GeneralLedger.ts +36 -0
- package/ts/api/resources/IncomeStatement.ts +13 -0
- package/ts/api/resources/Journal.ts +9 -0
- package/ts/api/resources/prestation.ts +6 -0
- package/ts/index.ts +1 -0
- package/ts/types/Interface/api/prestation/CreatePrestation.ts +14 -0
- package/ts/types/Interface/models/IPrestationComplementary.ts +21 -20
- package/ts/utils/commercialManagement/document.ts +1 -93
- package/ts/utils/commercialManagement/templates/common.ts +34 -46
|
@@ -2,6 +2,8 @@ import { Resource } from '../Resource';
|
|
|
2
2
|
import { QueryIncomeStatementPdf } from '../../types';
|
|
3
3
|
|
|
4
4
|
export class IncomeStatement extends Resource {
|
|
5
|
+
|
|
6
|
+
/** @deprecated use exportPdf() instead */
|
|
5
7
|
getPdf(query: QueryIncomeStatementPdf) : Promise<Buffer> {
|
|
6
8
|
return this.axios.$get('/incomeStatement/pdf', {
|
|
7
9
|
params: query,
|
|
@@ -11,4 +13,15 @@ export class IncomeStatement extends Resource {
|
|
|
11
13
|
},
|
|
12
14
|
});
|
|
13
15
|
}
|
|
16
|
+
|
|
17
|
+
exportPdf(idSociety: number, query: QueryIncomeStatementPdf) : Promise<Buffer> {
|
|
18
|
+
return this.axios.$post(`/societies/${idSociety}/income-statements/pdf`, null, {
|
|
19
|
+
params: query,
|
|
20
|
+
responseType: 'arraybuffer',
|
|
21
|
+
headers: {
|
|
22
|
+
Accept: 'application/pdf',
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
14
27
|
}
|
|
@@ -2,10 +2,19 @@ import { Resource } from '../Resource';
|
|
|
2
2
|
import { Journals, QueryJournal } from '../../types';
|
|
3
3
|
|
|
4
4
|
export class Journal extends Resource {
|
|
5
|
+
|
|
6
|
+
/** @deprecated use export() instead */
|
|
5
7
|
getExport(exportType: 'pdf' | 'json', params: QueryJournal): Promise<Journals | Buffer> {
|
|
6
8
|
return this.axios.$get(`/balance-sheets/journals/export/${exportType}`, {
|
|
7
9
|
params,
|
|
8
10
|
responseType: 'arraybuffer',
|
|
9
11
|
});
|
|
10
12
|
}
|
|
13
|
+
|
|
14
|
+
export(idSociety: number, exportType: 'pdf' | 'json', params: QueryJournal): Promise<Buffer | Journals> {
|
|
15
|
+
return this.axios.$get(`/societies/${idSociety}/journals/export/${exportType}`, {
|
|
16
|
+
params,
|
|
17
|
+
responseType: 'arraybuffer',
|
|
18
|
+
});
|
|
19
|
+
}
|
|
11
20
|
}
|
|
@@ -2,6 +2,7 @@ import { CancelToken } from 'axios';
|
|
|
2
2
|
import { Resource } from '../Resource';
|
|
3
3
|
import {
|
|
4
4
|
BasePaginate,
|
|
5
|
+
CreateSocietyPrestationComplementary,
|
|
5
6
|
IPrestation, ISociety, PrestationType, QueryCreatePrestation, QueryGetPaginatedSocietiesFromPrestation, QueryPrestation, QueryUpdatePrestation,
|
|
6
7
|
} from '../../types';
|
|
7
8
|
|
|
@@ -64,4 +65,9 @@ export class Prestation extends Resource {
|
|
|
64
65
|
},
|
|
65
66
|
});
|
|
66
67
|
}
|
|
68
|
+
|
|
69
|
+
public createCustomerPrestation(idSociety: number, payload: CreateSocietyPrestationComplementary): Promise<IPrestation> {
|
|
70
|
+
return this.axios.$post(`/societies/${idSociety}/prestations`, payload);
|
|
71
|
+
}
|
|
72
|
+
|
|
67
73
|
}
|
package/ts/index.ts
CHANGED
|
@@ -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
|
+
}
|
|
@@ -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
|
|
11
|
-
dateEstimateSigned
|
|
12
|
-
dateSendToClient
|
|
13
|
-
dateInvoice
|
|
14
|
-
datePayment
|
|
15
|
-
dateTransmission
|
|
16
|
-
idGedFile
|
|
17
|
-
idCollaborater
|
|
18
|
-
idUser
|
|
19
|
-
idPaymentExpectation
|
|
20
|
-
description
|
|
21
|
-
note
|
|
22
|
-
forOtherMission
|
|
23
|
-
statePrestationJuridique
|
|
24
|
-
acceptationAdmin:
|
|
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
|
|
31
|
-
prestationCollaborater
|
|
32
|
-
prestationPaymentExpectation
|
|
33
|
-
prestationGedFile
|
|
34
|
-
prestation
|
|
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,
|
|
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 (
|
|
111
|
-
|
|
112
|
-
<
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
<
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
<
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
<
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
<
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
<
|
|
142
|
-
|
|
143
|
-
|
|
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>
|