@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
|
@@ -10,6 +10,9 @@ export class GeneralLedger extends Resource {
|
|
|
10
10
|
params,
|
|
11
11
|
});
|
|
12
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated use exportCsv instead
|
|
15
|
+
*/
|
|
13
16
|
getCsv(params) {
|
|
14
17
|
return this.axios.$get('/generalLedger/csv', {
|
|
15
18
|
params,
|
|
@@ -19,6 +22,16 @@ export class GeneralLedger extends Resource {
|
|
|
19
22
|
},
|
|
20
23
|
});
|
|
21
24
|
}
|
|
25
|
+
exportCsv(idSociety, query) {
|
|
26
|
+
return this.axios.$post(`/societies/${idSociety}/general-ledgers/csv`, null, {
|
|
27
|
+
params: query,
|
|
28
|
+
responseType: 'arraybuffer',
|
|
29
|
+
headers: {
|
|
30
|
+
Accept: 'application/csv',
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
/** @deprecated use exportBalanceCsv() instead */
|
|
22
35
|
getBalanceCsv(params) {
|
|
23
36
|
return this.axios.$get('/generalLedger/balance/csv', {
|
|
24
37
|
params,
|
|
@@ -28,6 +41,15 @@ export class GeneralLedger extends Resource {
|
|
|
28
41
|
},
|
|
29
42
|
});
|
|
30
43
|
}
|
|
44
|
+
exportBalanceCsv(idSociety, params) {
|
|
45
|
+
return this.axios.$post(`/societies/${idSociety}/general-ledgers/balances/csv`, null, {
|
|
46
|
+
params,
|
|
47
|
+
responseType: 'arraybuffer',
|
|
48
|
+
headers: {
|
|
49
|
+
Accept: 'application/pdf',
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
}
|
|
31
53
|
getPdf(idSociety, params) {
|
|
32
54
|
return this.axios.$get(`/societies/${idSociety}/general-ledger/pdf`, {
|
|
33
55
|
params,
|
|
@@ -37,6 +59,7 @@ export class GeneralLedger extends Resource {
|
|
|
37
59
|
},
|
|
38
60
|
});
|
|
39
61
|
}
|
|
62
|
+
/** @deprecated use exportBalancePdf() instead */
|
|
40
63
|
getBalancePdf(params) {
|
|
41
64
|
return this.axios.$get('/generalLedger/balance/pdf', {
|
|
42
65
|
params,
|
|
@@ -46,6 +69,15 @@ export class GeneralLedger extends Resource {
|
|
|
46
69
|
},
|
|
47
70
|
});
|
|
48
71
|
}
|
|
72
|
+
exportBalancePdf(idSociety, params) {
|
|
73
|
+
return this.axios.$post(`/societies/${idSociety}/general-ledgers/balances/pdf`, null, {
|
|
74
|
+
params,
|
|
75
|
+
responseType: 'arraybuffer',
|
|
76
|
+
headers: {
|
|
77
|
+
Accept: 'application/pdf',
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
}
|
|
49
81
|
getAuxiliary(params) {
|
|
50
82
|
return this.axios.$get('/generalLedger/auxiliary', { params });
|
|
51
83
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GeneralLedger.js","sourceRoot":"","sources":["../../../../ts/api/resources/GeneralLedger.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,MAAM,OAAO,aAAc,SAAQ,QAAQ;IACzC,YAAY,CAAC,MAA0B;QACrC,OAAO,IAAI,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KAAK,CAAC,IAAI,CAAC,qCAAqC,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IAC5E,CAAC;IAED,aAAa,CAAC,EAAU,EAAE,MAAoC;QAC5D,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,iCAAiC,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IAC5E,CAAC;CACF","sourcesContent":["import {\n BasePaginateInterface, IGeneralLedgerAccount, IGeneralLedgerThirdParty, QueryGeneralLedgerAuxiliary, QueryGeneralLedgerThirdParty, ReadGeneralLedgerSummary, ReadIGeneralLedgerThirdPartyPaginated,\n} from '../../types';\nimport { QueryGeneralLedger } from '../../types/Interface/api/generalLedger/QueryGeneralLedger';\nimport { Resource } from '../Resource';\n\nexport class GeneralLedger extends Resource {\n getBySociety(params: QueryGeneralLedger): Promise<BasePaginateInterface<IGeneralLedgerAccount[]>> {\n return this.axios.$get('/generalLedger', {\n params,\n });\n }\n\n getBalanceBySociety(params: QueryGeneralLedger): Promise<BasePaginateInterface<IGeneralLedgerAccount[]>> {\n return this.axios.$get('/generalLedger/balance', {\n params,\n });\n }\n\n getCsv(params: QueryGeneralLedger):Promise<Buffer> {\n return this.axios.$get('/generalLedger/csv', {\n params,\n responseType: 'arraybuffer',\n headers: {\n Accept: 'application/csv',\n },\n });\n }\n\n getBalanceCsv(params: QueryGeneralLedger):Promise<Buffer> {\n return this.axios.$get('/generalLedger/balance/csv', {\n params,\n responseType: 'arraybuffer',\n headers: {\n Accept: 'application/csv',\n },\n });\n }\n\n getPdf(idSociety: number, params: QueryGeneralLedger):Promise<Buffer> {\n return this.axios.$get(`/societies/${idSociety}/general-ledger/pdf`, {\n params,\n responseType: 'arraybuffer',\n headers: {\n Accept: 'application/pdf',\n },\n });\n }\n\n getBalancePdf(params: QueryGeneralLedger): Promise<Buffer> {\n return this.axios.$get('/generalLedger/balance/pdf', {\n params,\n responseType: 'arraybuffer',\n headers: {\n Accept: 'application/pdf',\n },\n });\n }\n\n getAuxiliary(params: QueryGeneralLedgerAuxiliary): Promise<BasePaginateInterface<IGeneralLedgerThirdParty[]>> {\n return this.axios.$get('/generalLedger/auxiliary', { params });\n }\n\n getAuxiliarySummaries(params: QueryGeneralLedgerAuxiliary): Promise<BasePaginateInterface<ReadGeneralLedgerSummary[]>> {\n return this.axios.$get('/general-ledger/auxiliary/summaries', { params });\n }\n\n getThirdParty(id: number, params: QueryGeneralLedgerThirdParty): Promise<ReadIGeneralLedgerThirdPartyPaginated> {\n return this.axios.$get(`/general-ledger/third-parties/${id}`, { params });\n }\n}"]}
|
|
1
|
+
{"version":3,"file":"GeneralLedger.js","sourceRoot":"","sources":["../../../../ts/api/resources/GeneralLedger.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,MAAM,OAAO,aAAc,SAAQ,QAAQ;IACzC,YAAY,CAAC,MAA0B;QACrC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,gBAAgB,EAAE;YACvC,MAAM;SACP,CAAC,CAAC;IACL,CAAC;IAED,mBAAmB,CAAC,MAA0B;QAC5C,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,wBAAwB,EAAE;YAC/C,MAAM;SACP,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,MAA0B;QAC/B,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,oBAAoB,EAAE;YAC3C,MAAM;YACN,YAAY,EAAE,aAAa;YAC3B,OAAO,EAAE;gBACP,MAAM,EAAE,iBAAiB;aAC1B;SACF,CAAC,CAAC;IACL,CAAC;IAED,SAAS,CAAC,SAAiB,EAAE,KAAyB;QACpD,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,cAAc,SAAS,sBAAsB,EAAE,IAAI,EAAE;YAC3E,MAAM,EAAE,KAAK;YACb,YAAY,EAAE,aAAa;YAC3B,OAAO,EAAE;gBACP,MAAM,EAAE,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I,CAAC,KAAK,CAAC,IAAI,CAAC,0BAA0B,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IACjE,CAAC;IAED,qBAAqB,CAAC,MAAmC;QACvD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,qCAAqC,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IAC5E,CAAC;IAED,aAAa,CAAC,EAAU,EAAE,MAAoC;QAC5D,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,iCAAiC,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IAC5E,CAAC;CACF","sourcesContent":["import {\n BasePaginateInterface, IGeneralLedgerAccount, IGeneralLedgerThirdParty, QueryGeneralLedgerAuxiliary, QueryGeneralLedgerThirdParty, ReadGeneralLedgerSummary, ReadIGeneralLedgerThirdPartyPaginated,\n} from '../../types';\nimport { QueryGeneralLedger } from '../../types/Interface/api/generalLedger/QueryGeneralLedger';\nimport { Resource } from '../Resource';\n\nexport class GeneralLedger extends Resource {\n getBySociety(params: QueryGeneralLedger): Promise<BasePaginateInterface<IGeneralLedgerAccount[]>> {\n return this.axios.$get('/generalLedger', {\n params,\n });\n }\n\n getBalanceBySociety(params: QueryGeneralLedger): Promise<BasePaginateInterface<IGeneralLedgerAccount[]>> {\n return this.axios.$get('/generalLedger/balance', {\n params,\n });\n }\n\n /**\n * @deprecated use exportCsv instead\n */\n getCsv(params: QueryGeneralLedger):Promise<Buffer> {\n return this.axios.$get('/generalLedger/csv', {\n params,\n responseType: 'arraybuffer',\n headers: {\n Accept: 'application/csv',\n },\n });\n }\n\n exportCsv(idSociety: number, query: QueryGeneralLedger): Promise<Buffer> {\n return this.axios.$post(`/societies/${idSociety}/general-ledgers/csv`, null, {\n params: query,\n responseType: 'arraybuffer',\n headers: {\n Accept: 'application/csv',\n },\n });\n }\n\n\n /** @deprecated use exportBalanceCsv() instead */\n getBalanceCsv(params: QueryGeneralLedger):Promise<Buffer> {\n return this.axios.$get('/generalLedger/balance/csv', {\n params,\n responseType: 'arraybuffer',\n headers: {\n Accept: 'application/csv',\n },\n });\n }\n\n exportBalanceCsv(idSociety: number, params: QueryGeneralLedger): Promise<Buffer> {\n return this.axios.$post(`/societies/${idSociety}/general-ledgers/balances/csv`, null, {\n params,\n responseType: 'arraybuffer',\n headers: {\n Accept: 'application/pdf',\n },\n });\n }\n\n getPdf(idSociety: number, params: QueryGeneralLedger):Promise<Buffer> {\n return this.axios.$get(`/societies/${idSociety}/general-ledger/pdf`, {\n params,\n responseType: 'arraybuffer',\n headers: {\n Accept: 'application/pdf',\n },\n });\n }\n\n /** @deprecated use exportBalancePdf() instead */\n getBalancePdf(params: QueryGeneralLedger): Promise<Buffer> {\n return this.axios.$get('/generalLedger/balance/pdf', {\n params,\n responseType: 'arraybuffer',\n headers: {\n Accept: 'application/pdf',\n },\n });\n }\n\n exportBalancePdf(idSociety: number, params: QueryGeneralLedger): Promise<Buffer> {\n return this.axios.$post(`/societies/${idSociety}/general-ledgers/balances/pdf`, null, {\n params,\n responseType: 'arraybuffer',\n headers: {\n Accept: 'application/pdf',\n },\n });\n }\n\n getAuxiliary(params: QueryGeneralLedgerAuxiliary): Promise<BasePaginateInterface<IGeneralLedgerThirdParty[]>> {\n return this.axios.$get('/generalLedger/auxiliary', { params });\n }\n\n getAuxiliarySummaries(params: QueryGeneralLedgerAuxiliary): Promise<BasePaginateInterface<ReadGeneralLedgerSummary[]>> {\n return this.axios.$get('/general-ledger/auxiliary/summaries', { params });\n }\n\n getThirdParty(id: number, params: QueryGeneralLedgerThirdParty): Promise<ReadIGeneralLedgerThirdPartyPaginated> {\n return this.axios.$get(`/general-ledger/third-parties/${id}`, { params });\n }\n}"]}
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
import { Resource } from '../Resource';
|
|
3
3
|
import { QueryIncomeStatementPdf } from '../../types';
|
|
4
4
|
export declare class IncomeStatement extends Resource {
|
|
5
|
+
/** @deprecated use exportPdf() instead */
|
|
5
6
|
getPdf(query: QueryIncomeStatementPdf): Promise<Buffer>;
|
|
7
|
+
exportPdf(idSociety: number, query: QueryIncomeStatementPdf): Promise<Buffer>;
|
|
6
8
|
}
|
|
7
9
|
//# sourceMappingURL=IncomeStatement.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IncomeStatement.d.ts","sourceRoot":"","sources":["../../../../ts/api/resources/IncomeStatement.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAEtD,qBAAa,eAAgB,SAAQ,QAAQ;
|
|
1
|
+
{"version":3,"file":"IncomeStatement.d.ts","sourceRoot":"","sources":["../../../../ts/api/resources/IncomeStatement.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAEtD,qBAAa,eAAgB,SAAQ,QAAQ;IAE3C,0CAA0C;IAC1C,MAAM,CAAC,KAAK,EAAE,uBAAuB,GAAI,OAAO,CAAC,MAAM,CAAC;IAUxD,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,uBAAuB,GAAI,OAAO,CAAC,MAAM,CAAC;CAU/E"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Resource } from '../Resource';
|
|
2
2
|
export class IncomeStatement extends Resource {
|
|
3
|
+
/** @deprecated use exportPdf() instead */
|
|
3
4
|
getPdf(query) {
|
|
4
5
|
return this.axios.$get('/incomeStatement/pdf', {
|
|
5
6
|
params: query,
|
|
@@ -9,5 +10,14 @@ export class IncomeStatement extends Resource {
|
|
|
9
10
|
},
|
|
10
11
|
});
|
|
11
12
|
}
|
|
13
|
+
exportPdf(idSociety, query) {
|
|
14
|
+
return this.axios.$post(`/societies/${idSociety}/income-statements/pdf`, null, {
|
|
15
|
+
params: query,
|
|
16
|
+
responseType: 'arraybuffer',
|
|
17
|
+
headers: {
|
|
18
|
+
Accept: 'application/pdf',
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
}
|
|
12
22
|
}
|
|
13
23
|
//# sourceMappingURL=IncomeStatement.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IncomeStatement.js","sourceRoot":"","sources":["../../../../ts/api/resources/IncomeStatement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGvC,MAAM,OAAO,eAAgB,SAAQ,QAAQ;
|
|
1
|
+
{"version":3,"file":"IncomeStatement.js","sourceRoot":"","sources":["../../../../ts/api/resources/IncomeStatement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGvC,MAAM,OAAO,eAAgB,SAAQ,QAAQ;IAE3C,0CAA0C;IAC1C,MAAM,CAAC,KAA8B;QACnC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,sBAAsB,EAAE;YAC7C,MAAM,EAAE,KAAK;YACb,YAAY,EAAE,aAAa;YAC3B,OAAO,EAAE;gBACP,MAAM,EAAE,iBAAiB;aAC1B;SACF,CAAC,CAAC;IACL,CAAC;IAED,SAAS,CAAC,SAAiB,EAAE,KAA8B;QACzD,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,cAAc,SAAS,wBAAwB,EAAE,IAAI,EAAE;YAC7E,MAAM,EAAE,KAAK;YACb,YAAY,EAAE,aAAa;YAC3B,OAAO,EAAE;gBACP,MAAM,EAAE,iBAAiB;aAC1B;SACF,CAAC,CAAC;IACL,CAAC;CAEF","sourcesContent":["import { Resource } from '../Resource';\nimport { QueryIncomeStatementPdf } from '../../types';\n\nexport class IncomeStatement extends Resource {\n\n /** @deprecated use exportPdf() instead */\n getPdf(query: QueryIncomeStatementPdf) : Promise<Buffer> {\n return this.axios.$get('/incomeStatement/pdf', {\n params: query,\n responseType: 'arraybuffer',\n headers: {\n Accept: 'application/pdf',\n },\n });\n }\n\n exportPdf(idSociety: number, query: QueryIncomeStatementPdf) : Promise<Buffer> {\n return this.axios.$post(`/societies/${idSociety}/income-statements/pdf`, null, {\n params: query,\n responseType: 'arraybuffer',\n headers: {\n Accept: 'application/pdf',\n },\n });\n }\n\n}"]}
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
import { Resource } from '../Resource';
|
|
3
3
|
import { Journals, QueryJournal } from '../../types';
|
|
4
4
|
export declare class Journal extends Resource {
|
|
5
|
+
/** @deprecated use export() instead */
|
|
5
6
|
getExport(exportType: 'pdf' | 'json', params: QueryJournal): Promise<Journals | Buffer>;
|
|
7
|
+
export(idSociety: number, exportType: 'pdf' | 'json', params: QueryJournal): Promise<Buffer | Journals>;
|
|
6
8
|
}
|
|
7
9
|
//# sourceMappingURL=Journal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Journal.d.ts","sourceRoot":"","sources":["../../../../ts/api/resources/Journal.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAErD,qBAAa,OAAQ,SAAQ,QAAQ;
|
|
1
|
+
{"version":3,"file":"Journal.d.ts","sourceRoot":"","sources":["../../../../ts/api/resources/Journal.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAErD,qBAAa,OAAQ,SAAQ,QAAQ;IAEnC,uCAAuC;IACvC,SAAS,CAAC,UAAU,EAAE,KAAK,GAAG,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,QAAQ,GAAG,MAAM,CAAC;IAOvF,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,GAAG,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,GAAG,QAAQ,CAAC;CAMxG"}
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import { Resource } from '../Resource';
|
|
2
2
|
export class Journal extends Resource {
|
|
3
|
+
/** @deprecated use export() instead */
|
|
3
4
|
getExport(exportType, params) {
|
|
4
5
|
return this.axios.$get(`/balance-sheets/journals/export/${exportType}`, {
|
|
5
6
|
params,
|
|
6
7
|
responseType: 'arraybuffer',
|
|
7
8
|
});
|
|
8
9
|
}
|
|
10
|
+
export(idSociety, exportType, params) {
|
|
11
|
+
return this.axios.$get(`/societies/${idSociety}/journals/export/${exportType}`, {
|
|
12
|
+
params,
|
|
13
|
+
responseType: 'arraybuffer',
|
|
14
|
+
});
|
|
15
|
+
}
|
|
9
16
|
}
|
|
10
17
|
//# sourceMappingURL=Journal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Journal.js","sourceRoot":"","sources":["../../../../ts/api/resources/Journal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGvC,MAAM,OAAO,OAAQ,SAAQ,QAAQ;
|
|
1
|
+
{"version":3,"file":"Journal.js","sourceRoot":"","sources":["../../../../ts/api/resources/Journal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGvC,MAAM,OAAO,OAAQ,SAAQ,QAAQ;IAEnC,uCAAuC;IACvC,SAAS,CAAC,UAA0B,EAAE,MAAoB;QACxD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,mCAAmC,UAAU,EAAE,EAAE;YACtE,MAAM;YACN,YAAY,EAAE,aAAa;SAC5B,CAAC,CAAC;IACL,CAAC;IAED,MAAM,CAAC,SAAiB,EAAE,UAA0B,EAAE,MAAoB;QACxE,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,cAAc,SAAS,oBAAoB,UAAU,EAAE,EAAE;YAC9E,MAAM;YACN,YAAY,EAAE,aAAa;SAC5B,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import { Resource } from '../Resource';\nimport { Journals, QueryJournal } from '../../types';\n\nexport class Journal extends Resource {\n\n /** @deprecated use export() instead */\n getExport(exportType: 'pdf' | 'json', params: QueryJournal): Promise<Journals | Buffer> {\n return this.axios.$get(`/balance-sheets/journals/export/${exportType}`, {\n params,\n responseType: 'arraybuffer',\n });\n }\n\n export(idSociety: number, exportType: 'pdf' | 'json', params: QueryJournal): Promise<Buffer | Journals> {\n return this.axios.$get(`/societies/${idSociety}/journals/export/${exportType}`, {\n params,\n responseType: 'arraybuffer',\n });\n }\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CancelToken } from 'axios';
|
|
2
2
|
import { Resource } from '../Resource';
|
|
3
|
-
import { BasePaginate, IPrestation, ISociety, QueryCreatePrestation, QueryGetPaginatedSocietiesFromPrestation, QueryPrestation, QueryUpdatePrestation } from '../../types';
|
|
3
|
+
import { BasePaginate, CreateSocietyPrestationComplementary, IPrestation, ISociety, QueryCreatePrestation, QueryGetPaginatedSocietiesFromPrestation, QueryPrestation, QueryUpdatePrestation } from '../../types';
|
|
4
4
|
export declare class Prestation extends Resource {
|
|
5
5
|
/**
|
|
6
6
|
* Crée une prestationavec tous les éléments lié à celle-ci.
|
|
@@ -24,5 +24,6 @@ export declare class Prestation extends Resource {
|
|
|
24
24
|
getPaginatedSocietiesFromPrestation(params: QueryGetPaginatedSocietiesFromPrestation): Promise<BasePaginate<ISociety>>;
|
|
25
25
|
getAllFromSociety(id: number, params?: QueryPrestation, cancelToken?: CancelToken, signal?: AbortSignal): Promise<IPrestation[]>;
|
|
26
26
|
getAllSocialFromSociety(id: number, cancelToken?: CancelToken, signal?: AbortSignal): Promise<IPrestation[]>;
|
|
27
|
+
createCustomerPrestation(idSociety: number, payload: CreateSocietyPrestationComplementary): Promise<IPrestation>;
|
|
27
28
|
}
|
|
28
29
|
//# sourceMappingURL=prestation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prestation.d.ts","sourceRoot":"","sources":["../../../../ts/api/resources/prestation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EACL,YAAY,EACZ,WAAW,EAAE,QAAQ,EAAkB,qBAAqB,EAAE,wCAAwC,EAAE,eAAe,EAAE,qBAAqB,EAC/I,MAAM,aAAa,CAAC;AAErB,qBAAa,UAAW,SAAQ,QAAQ;IAEtC;;;;OAIG;IACI,MAAM,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,WAAW,CAAC;IAIlE;;;;;OAKG;IACI,MAAM,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,WAAW,CAAC;IAIxF;;;;OAIG;IACI,wBAAwB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAI5D,mCAAmC,CAAC,MAAM,EAAE,wCAAwC,GAAG,OAAO,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IAItH,iBAAiB,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,eAAe,EAAE,WAAW,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAIhI,uBAAuB,CAAC,EAAE,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"prestation.d.ts","sourceRoot":"","sources":["../../../../ts/api/resources/prestation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EACL,YAAY,EACZ,oCAAoC,EACpC,WAAW,EAAE,QAAQ,EAAkB,qBAAqB,EAAE,wCAAwC,EAAE,eAAe,EAAE,qBAAqB,EAC/I,MAAM,aAAa,CAAC;AAErB,qBAAa,UAAW,SAAQ,QAAQ;IAEtC;;;;OAIG;IACI,MAAM,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,WAAW,CAAC;IAIlE;;;;;OAKG;IACI,MAAM,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,WAAW,CAAC;IAIxF;;;;OAIG;IACI,wBAAwB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAI5D,mCAAmC,CAAC,MAAM,EAAE,wCAAwC,GAAG,OAAO,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IAItH,iBAAiB,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,eAAe,EAAE,WAAW,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAIhI,uBAAuB,CAAC,EAAE,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAsB5G,wBAAwB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,oCAAoC,GAAG,OAAO,CAAC,WAAW,CAAC;CAIxH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prestation.js","sourceRoot":"","sources":["../../../../ts/api/resources/prestation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,
|
|
1
|
+
{"version":3,"file":"prestation.js","sourceRoot":"","s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AAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACvC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC7B,MAAM,EAAE;gBACN,iBAAiB,EAAE;oBACjB,cAAc,CAAC,UAAU;oBACzB,cAAc,CAAC,MAAM;oBACrB,cAAc,CAAC,qBAAqB;oBACpC,cAAc,CAAC,6BAA6B;oBAC5C,cAAc,CAAC,sCAAsC;oBACrD,cAAc,CAAC,8BAA8B;oBAC7C,cAAc,CAAC,2BAA2B;oBAC1C,cAAc,CAAC,mBAAmB;oBAClC,cAAc,CAAC,eAAe;oBAC9B,cAAc,CAAC,uBAAuB;oBACtC,cAAc,CAAC,sBAAsB;oBACrC,cAAc,CAAC,8BAA8B;iBAAC;aACjD;SACF,CAAC,CAAC;IACL,CAAC;IAEM,wBAAwB,CAAC,SAAiB,EAAE,OAA6C;QAC9F,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,cAAc,SAAS,cAAc,EAAE,OAAO,CAAC,CAAC;IAC1E,CAAC;CAEF","sourcesContent":["import { CancelToken } from 'axios';\nimport { Resource } from '../Resource';\nimport {\n BasePaginate,\n CreateSocietyPrestationComplementary,\n IPrestation, ISociety, PrestationType, QueryCreatePrestation, QueryGetPaginatedSocietiesFromPrestation, QueryPrestation, QueryUpdatePrestation,\n} from '../../types';\n\nexport class Prestation extends Resource {\n\n /**\n * Crée une prestationavec tous les éléments lié à celle-ci.\n * @param { QueryCreatePrestation } params \n * @returns { IPrestation }\n */\n public create(params: QueryCreatePrestation): Promise<IPrestation> {\n return this.axios.$post('/prestation', params);\n }\n\n /**\n * Crée une prestationavec tous les éléments lié à celle-ci.\n * @param { number } id\n * @param { QueryUpdatePrestation } params \n * @returns { IPrestation }\n */\n public update(idPrestation: number, params: QueryUpdatePrestation): Promise<IPrestation> {\n return this.axios.$put(`/prestation/${idPrestation}`, params);\n }\n \n /**\n * retourne toutes les prestations juridique d'une société\n * @param { number } id\n * @returns { IPrestation }\n */\n public getAllJuridicFromSociety(id: number): Promise<IPrestation[]> {\n return this.axios.$get(`/prestation/society/${id}/juridicals`);\n }\n\n public getPaginatedSocietiesFromPrestation(params: QueryGetPaginatedSocietiesFromPrestation): Promise<BasePaginate<ISociety>> {\n return this.axios.$get('/prestation/societies', { params });\n }\n\n public getAllFromSociety(id: number, params?: QueryPrestation, cancelToken?: CancelToken, signal?: AbortSignal): Promise<IPrestation[]> {\n return this.axios.$get(`/societies/${id}/prestations`, { ...(cancelToken ? { cancelToken } : {}), ...(signal ? { signal } : {}), params });\n }\n\n public getAllSocialFromSociety(id: number, cancelToken?: CancelToken, signal?: AbortSignal): Promise<IPrestation[]> {\n return this.axios.$get(`/societies/${id}/prestations`, {\n ...(cancelToken ? { cancelToken } : {}),\n ...(signal ? { signal } : {}),\n params: {\n prestationListIds: [\n PrestationType.FRUCTUPAIE,\n PrestationType.SOCIAL,\n PrestationType.MYFRUCTUCOMPTA_SOCIAL,\n PrestationType.MYFRUCTUCOMPTA_EXPRESS_SOCIAL,\n PrestationType.FRUCTUCOMPTA_ASSISTANCE_EXPRESS_SOCIAL,\n PrestationType.FRUCTUCOMPTA_ASSISTANCE_SOCIAL,\n PrestationType.FRUCTUCOMPTA_EXPRESS_SOCIAL,\n PrestationType.FRUCTUCOMPTA_SOCIAL,\n PrestationType.COMPTA_PRO_PAIE,\n PrestationType.COMPTA_PRO_EXPRESS_PAIE,\n PrestationType.COMPTA_ENTREPRISE_PAIE,\n PrestationType.COMPTA_ENTREPRISE_EXPRESS_PAIE],\n },\n });\n }\n\n public createCustomerPrestation(idSociety: number, payload: CreateSocietyPrestationComplementary): Promise<IPrestation> {\n return this.axios.$post(`/societies/${idSociety}/prestations`, payload);\n }\n\n}"]}
|
package/dist/mjs/index.d.ts
CHANGED
package/dist/mjs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../ts/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../ts/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,sCAAsC,CAAC;AACrD,cAAc,kCAAkC,CAAC;AAEjD,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC"}
|
package/dist/mjs/index.js
CHANGED
package/dist/mjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,sCAAsC,CAAC;AACrD,2BAA2B;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC","sourcesContent":["export * from './utils';\nexport * from './utils/commercialManagement/product';\n// eslint-disable-next-line\nexport * from './types';\nexport * from './api';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,sCAAsC,CAAC;AACrD,cAAc,kCAAkC,CAAC;AACjD,2BAA2B;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC","sourcesContent":["export * from './utils';\nexport * from './utils/commercialManagement/product';\nexport * from './utils/commercialManagement/vat';\n// eslint-disable-next-line\nexport * from './types';\nexport * from './api';\n"]}
|
|
@@ -3,4 +3,9 @@ export declare class CreatePrestation {
|
|
|
3
3
|
amountTtc: number;
|
|
4
4
|
label?: string;
|
|
5
5
|
}
|
|
6
|
+
export declare class CreateSocietyPrestationComplementary {
|
|
7
|
+
idPrestationList: number;
|
|
8
|
+
idExercice: number;
|
|
9
|
+
totalTaxExcluded: number;
|
|
10
|
+
}
|
|
6
11
|
//# sourceMappingURL=CreatePrestation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreatePrestation.d.ts","sourceRoot":"","sources":["../../../../../../ts/types/Interface/api/prestation/CreatePrestation.ts"],"names":[],"mappings":"AAGA,qBAAa,gBAAgB;IAGzB,WAAW,EAAE,MAAM,CAAC;IAIpB,SAAS,EAAE,MAAM,CAAC;IAGlB,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB"}
|
|
1
|
+
{"version":3,"file":"CreatePrestation.d.ts","sourceRoot":"","sources":["../../../../../../ts/types/Interface/api/prestation/CreatePrestation.ts"],"names":[],"mappings":"AAGA,qBAAa,gBAAgB;IAGzB,WAAW,EAAE,MAAM,CAAC;IAIpB,SAAS,EAAE,MAAM,CAAC;IAGlB,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,oCAAoC;IAG7C,gBAAgB,EAAE,MAAM,CAAC;IAIzB,UAAU,EAAE,MAAM,CAAC;IAInB,gBAAgB,EAAE,MAAM,CAAC;CAC5B"}
|
|
@@ -28,4 +28,24 @@ __decorate([
|
|
|
28
28
|
ApiPropertyOptional(),
|
|
29
29
|
__metadata("design:type", String)
|
|
30
30
|
], CreatePrestation.prototype, "label", void 0);
|
|
31
|
+
export class CreateSocietyPrestationComplementary {
|
|
32
|
+
idPrestationList;
|
|
33
|
+
idExercice;
|
|
34
|
+
totalTaxExcluded;
|
|
35
|
+
}
|
|
36
|
+
__decorate([
|
|
37
|
+
ApiProperty(),
|
|
38
|
+
IsNumber(),
|
|
39
|
+
__metadata("design:type", Number)
|
|
40
|
+
], CreateSocietyPrestationComplementary.prototype, "idPrestationList", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
ApiProperty(),
|
|
43
|
+
IsNumber(),
|
|
44
|
+
__metadata("design:type", Number)
|
|
45
|
+
], CreateSocietyPrestationComplementary.prototype, "idExercice", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
ApiProperty(),
|
|
48
|
+
IsNumber(),
|
|
49
|
+
__metadata("design:type", Number)
|
|
50
|
+
], CreateSocietyPrestationComplementary.prototype, "totalTaxExcluded", void 0);
|
|
31
51
|
//# sourceMappingURL=CreatePrestation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreatePrestation.js","sourceRoot":"","sources":["../../../../../../ts/types/Interface/api/prestation/CreatePrestation.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAE/D,MAAM,OAAO,gBAAgB;IAGzB,WAAW,CAAS;IAIpB,SAAS,CAAS;IAGlB,KAAK,CAAU;CAClB;AAVC;IAAC,WAAW,EAAE;IACb,QAAQ,EAAE;;qDACW;AAEtB;IAAC,WAAW,EAAE;IACb,QAAQ,EAAE;;mDACS;AAEpB;IAAC,mBAAmB,EAAE;;+CACL","sourcesContent":["import { IsNumber } from 'class-validator';\nimport { ApiProperty, ApiPropertyOptional } from '../../../..';\n\nexport class CreatePrestation {\n @ApiProperty()\n @IsNumber()\n orderStatus: number;\n\n @ApiProperty()\n @IsNumber()\n amountTtc: number;\n\n @ApiPropertyOptional()\n label?: string;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"CreatePrestation.js","sourceRoot":"","sources":["../../../../../../ts/types/Interface/api/prestation/CreatePrestation.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAE/D,MAAM,OAAO,gBAAgB;IAGzB,WAAW,CAAS;IAIpB,SAAS,CAAS;IAGlB,KAAK,CAAU;CAClB;AAVC;IAAC,WAAW,EAAE;IACb,QAAQ,EAAE;;qDACW;AAEtB;IAAC,WAAW,EAAE;IACb,QAAQ,EAAE;;mDACS;AAEpB;IAAC,mBAAmB,EAAE;;+CACL;AAGnB,MAAM,OAAO,oCAAoC;IAG7C,gBAAgB,CAAS;IAIzB,UAAU,CAAS;IAInB,gBAAgB,CAAS;CAC5B;AAXC;IAAC,WAAW,EAAE;IACb,QAAQ,EAAE;;8EACgB;AAE3B;IAAC,WAAW,EAAE;IACb,QAAQ,EAAE;;wEACU;AAErB;IAAC,WAAW,EAAE;IACb,QAAQ,EAAE;;8EACgB","sourcesContent":["import { IsNumber } from 'class-validator';\nimport { ApiProperty, ApiPropertyOptional } from '../../../..';\n\nexport class CreatePrestation {\n @ApiProperty()\n @IsNumber()\n orderStatus: number;\n\n @ApiProperty()\n @IsNumber()\n amountTtc: number;\n\n @ApiPropertyOptional()\n label?: string;\n}\n\nexport class CreateSocietyPrestationComplementary {\n @ApiProperty()\n @IsNumber()\n idPrestationList: number;\n\n @ApiProperty()\n @IsNumber()\n idExercice: number;\n\n @ApiProperty()\n @IsNumber()\n totalTaxExcluded: number;\n}\n"]}
|
|
@@ -2,31 +2,32 @@ 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
|
export interface IPrestationComplementary {
|
|
6
7
|
id?: number;
|
|
7
8
|
generateLink: boolean;
|
|
8
|
-
deadline
|
|
9
|
-
dateEstimateSigned
|
|
10
|
-
dateSendToClient
|
|
11
|
-
dateInvoice
|
|
12
|
-
datePayment
|
|
13
|
-
dateTransmission
|
|
14
|
-
idGedFile
|
|
15
|
-
idCollaborater
|
|
16
|
-
idUser
|
|
17
|
-
idPaymentExpectation
|
|
18
|
-
description
|
|
19
|
-
note
|
|
20
|
-
forOtherMission
|
|
21
|
-
statePrestationJuridique
|
|
22
|
-
acceptationAdmin:
|
|
9
|
+
deadline?: Date | null;
|
|
10
|
+
dateEstimateSigned?: Date | null;
|
|
11
|
+
dateSendToClient?: Date | null;
|
|
12
|
+
dateInvoice?: Date | null;
|
|
13
|
+
datePayment?: Date | null;
|
|
14
|
+
dateTransmission?: Date | null;
|
|
15
|
+
idGedFile?: number | null;
|
|
16
|
+
idCollaborater?: number | null;
|
|
17
|
+
idUser?: number | null;
|
|
18
|
+
idPaymentExpectation?: number | null;
|
|
19
|
+
description?: string | null;
|
|
20
|
+
note?: string | null;
|
|
21
|
+
forOtherMission?: string | null;
|
|
22
|
+
statePrestationJuridique?: number | null;
|
|
23
|
+
acceptationAdmin: AcceptationAdmin;
|
|
23
24
|
createdAt?: Date | null;
|
|
24
25
|
updatedAt?: Date | null;
|
|
25
26
|
deletedAt?: Date | null;
|
|
26
|
-
prestationUser
|
|
27
|
-
prestationCollaborater
|
|
28
|
-
prestationPaymentExpectation
|
|
29
|
-
prestationGedFile
|
|
30
|
-
prestation
|
|
27
|
+
prestationUser?: IUser;
|
|
28
|
+
prestationCollaborater?: IUser;
|
|
29
|
+
prestationPaymentExpectation?: IPaymentExpectation;
|
|
30
|
+
prestationGedFile?: IGedFile;
|
|
31
|
+
prestation?: IPrestation;
|
|
31
32
|
}
|
|
32
33
|
//# sourceMappingURL=IPrestationComplementary.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IPrestationComplementary.d.ts","sourceRoot":"","sources":["../../../../../ts/types/Interface/models/IPrestationComplementary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"IPrestationComplementary.d.ts","sourceRoot":"","sources":["../../../../../ts/types/Interface/models/IPrestationComplementary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,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AC;IACvB,sBAAsB,CAAC,EAAE,KAAK,CAAC;IAC/B,4BAA4B,CAAC,EAAE,mBAAmB,CAAC;IACnD,iBAAiB,CAAC,EAAE,QAAQ,CAAC;IAC7B,UAAU,CAAC,EAAE,WAAW,CAAC;CAC1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IPrestationComplementary.js","sourceRoot":"","sources":["../../../../../ts/types/Interface/models/IPrestationComplementary.ts"],"names":[],"mappings":"","sourcesContent":["import { IUser } from './IUser';\nimport { IPaymentExpectation } from './IPaymentExpectation';\nimport { IGedFile } from './IGedFile';\nimport { IPrestation } from './IPrestation';\n\n// prestationsCompl\nexport interface IPrestationComplementary {\n id?: number;\n generateLink: boolean;\n deadline
|
|
1
|
+
{"version":3,"file":"IPrestationComplementary.js","sourceRoot":"","sources":["../../../../../ts/types/Interface/models/IPrestationComplementary.ts"],"names":[],"mappings":"","sourcesContent":["import { IUser } from './IUser';\nimport { IPaymentExpectation } from './IPaymentExpectation';\nimport { IGedFile } from './IGedFile';\nimport { IPrestation } from './IPrestation';\nimport { AcceptationAdmin } from '../../Enum/AdditionnalSells';\n\n// prestationsCompl\nexport interface IPrestationComplementary {\n id?: number;\n generateLink: boolean;\n deadline?: Date | null;\n dateEstimateSigned?: Date | null;\n dateSendToClient?: Date | null;\n dateInvoice?: Date | null;\n datePayment?: Date | null;\n dateTransmission?: Date | null;\n idGedFile?: number | null;\n idCollaborater?: number | null;\n idUser?: number | null;\n idPaymentExpectation?: number | null;\n description?: string | null;\n note?: string | null;\n forOtherMission?: string | null;\n statePrestationJuridique?: number | null;\n acceptationAdmin: AcceptationAdmin;\n createdAt?: Date | null;\n updatedAt?: Date | null;\n deletedAt?: Date | null;\n\n // Associations\n prestationUser?: IUser;\n prestationCollaborater?: IUser;\n prestationPaymentExpectation?: IPaymentExpectation;\n prestationGedFile?: IGedFile;\n prestation?: IPrestation;\n}\n"]}
|
|
@@ -2,6 +2,5 @@ import { ReadCommercialDocumentTemplate } from '../../types/Interface/api/commer
|
|
|
2
2
|
import { EstimateInvoiceType } from '../../types/Enum/EstimateInvoice';
|
|
3
3
|
import { CreateInvoiceDocument, CreateMailHeader, CreatePreSaleDocument, ReadCommercialMailTemplate } from '../../types';
|
|
4
4
|
export declare function generateCommercialDocument(idEstimateInvoiceType: EstimateInvoiceType, payload: CreateInvoiceDocument | CreatePreSaleDocument, shouldHideBrandName?: boolean, nodeEnv?: string | undefined): ReadCommercialDocumentTemplate;
|
|
5
|
-
export declare function generateAdvanceDocument(payload: CreateInvoiceDocument, shouldHideBrandName?: boolean, nodeEnv?: string | undefined): ReadCommercialDocumentTemplate;
|
|
6
5
|
export declare function generateMailHeader(params: CreateMailHeader, shouldHideBrandName?: boolean, nodeEnv?: string | undefined): ReadCommercialMailTemplate;
|
|
7
6
|
//# sourceMappingURL=document.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../../../../ts/utils/commercialManagement/document.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,8BAA8B,EAAuB,MAAM,qDAAqD,CAAC;AAI1H,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAOvE,OAAO,EACL,qBAAqB,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,0BAA0B,EAC3F,MAAM,aAAa,CAAC;AAgBrB,wBAAgB,0BAA0B,CAAC,qBAAqB,EAAE,mBAAmB,EAAE,OAAO,EAAE,qBAAqB,GAAG,qBAAqB,EAAE,mBAAmB,UAAQ,EAAE,OAAO,GAAE,MAAM,GAAG,SAAqB,GAAG,8BAA8B,CAyFnP;AAED,wBAAgB,
|
|
1
|
+
{"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../../../../ts/utils/commercialManagement/document.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,8BAA8B,EAAuB,MAAM,qDAAqD,CAAC;AAI1H,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAOvE,OAAO,EACL,qBAAqB,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,0BAA0B,EAC3F,MAAM,aAAa,CAAC;AAgBrB,wBAAgB,0BAA0B,CAAC,qBAAqB,EAAE,mBAAmB,EAAE,OAAO,EAAE,qBAAqB,GAAG,qBAAqB,EAAE,mBAAmB,UAAQ,EAAE,OAAO,GAAE,MAAM,GAAG,SAAqB,GAAG,8BAA8B,CAyFnP;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,gBAAgB,EAAE,mBAAmB,UAAQ,EAAE,OAAO,GAAE,MAAM,GAAG,SAAqB,GAAG,0BAA0B,CAuB7J"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { orderBy as _orderBy, groupBy as _groupBy, sumBy as _sumBy, uniq as _uniq, } from 'lodash';
|
|
2
2
|
import * as dayjs from 'dayjs';
|
|
3
|
-
import { AccountingCategoryList, FontIds, fontList,
|
|
3
|
+
import { AccountingCategoryList, FontIds, fontList, } from '../../types/Enum/CommercialManagement';
|
|
4
4
|
import { EstimateInvoiceType } from '../../types/Enum/EstimateInvoice';
|
|
5
5
|
import { Vat } from '../../types/Enum/Vat';
|
|
6
6
|
import { integerToFormattedAmountString, integerToFormattedAmountObject } from '../amount';
|
|
@@ -92,81 +92,6 @@ export function generateCommercialDocument(idEstimateInvoiceType, payload, shoul
|
|
|
92
92
|
data,
|
|
93
93
|
};
|
|
94
94
|
}
|
|
95
|
-
export function generateAdvanceDocument(payload, shouldHideBrandName = false, nodeEnv = undefined) {
|
|
96
|
-
if (!payload.deposit)
|
|
97
|
-
throw new Error('Aucun acompte défini');
|
|
98
|
-
const data = {
|
|
99
|
-
...payload,
|
|
100
|
-
title: payload.title ?? null,
|
|
101
|
-
paymentLink: payload.paymentLink ?? '#',
|
|
102
|
-
idEstimateInvoiceType: EstimateInvoiceType.ACOMPTE,
|
|
103
|
-
phoneContact: payload.settings?.phoneContact ?? null,
|
|
104
|
-
products: [],
|
|
105
|
-
vats: [],
|
|
106
|
-
totalTaxExcluded: payload.deposit,
|
|
107
|
-
totalTaxIncluded: payload.deposit,
|
|
108
|
-
totalTaxAndDiscountIncluded: payload.deposit,
|
|
109
|
-
generalDiscountFormatted: null,
|
|
110
|
-
depositFormatted: integerToFormattedAmountString(payload.deposit),
|
|
111
|
-
totalTaxExcludedFormatted: integerToFormattedAmountString(payload.deposit),
|
|
112
|
-
totalTaxIncludedFormatted: integerToFormattedAmountString(payload.deposit),
|
|
113
|
-
totalTaxAndDiscountIncludedFormatted: integerToFormattedAmountString(payload.deposit),
|
|
114
|
-
totalVatAmountFormatted: integerToFormattedAmountString(0),
|
|
115
|
-
font: {
|
|
116
|
-
id: payload.settings?.idFont ?? FontIds.CIRCULAR_STD,
|
|
117
|
-
name: fontList.find((f) => f.id === payload.settings?.idFont)?.name
|
|
118
|
-
?? fontList[0].name,
|
|
119
|
-
url: fontList.find((f) => f.id === payload.settings?.idFont)?.link
|
|
120
|
-
?? fontList[0].link,
|
|
121
|
-
},
|
|
122
|
-
capitalFormatted: payload.capital
|
|
123
|
-
? `${payload.capital}`
|
|
124
|
-
.split('')
|
|
125
|
-
.reduceRight((acc, char, i, { length }) => `${char}${(length - (i + 1)) % 3 === 0 ? ' ' : ''}${acc}`, '')
|
|
126
|
-
.trim()
|
|
127
|
-
: null,
|
|
128
|
-
dueDateFormatted: payload.dueDate
|
|
129
|
-
? dayjs(payload.dueDate).format('DD/MM/YYYY')
|
|
130
|
-
: null,
|
|
131
|
-
expirationDateFormatted: payload.expirationDate
|
|
132
|
-
? dayjs(payload.expirationDate).format('DD/MM/YYYY')
|
|
133
|
-
: null,
|
|
134
|
-
emissionDateFormatted: payload.emissionDate
|
|
135
|
-
? dayjs(payload.emissionDate).format('DD/MM/YYYY')
|
|
136
|
-
: null,
|
|
137
|
-
shouldDisplayDiscountColumn: false,
|
|
138
|
-
disableVat: true,
|
|
139
|
-
// @ts-ignore
|
|
140
|
-
marginVats: _uniq((payload.assetMarginVatIds ?? []).map((m) => VatMarginCategyList.find((c) => c.id === m)?.label ?? null)),
|
|
141
|
-
accountingCategoryFormatted: AccountingCategoryList.find((a) => a.id === payload.accountingCategory)
|
|
142
|
-
?.label ?? null,
|
|
143
|
-
// @ts-ignore
|
|
144
|
-
brandColors: getBrandConfig({ objectWaited: 'colors', nodeEnv }),
|
|
145
|
-
brandName: `${getBrandConfig({ objectWaited: 'name', nodeEnv })}`,
|
|
146
|
-
shouldHideBrandName,
|
|
147
|
-
};
|
|
148
|
-
const commonTemplate = new CommercialDocumentCommonHTML();
|
|
149
|
-
return {
|
|
150
|
-
header: ejs?.render(commonTemplate.header, data),
|
|
151
|
-
body: ejs?.render(bodyTemplate, {
|
|
152
|
-
...data,
|
|
153
|
-
comment: data.comment && typeof data.comment === 'string'
|
|
154
|
-
? data.comment?.replace(/\n/g, '<br/>')
|
|
155
|
-
: null,
|
|
156
|
-
products: data.products.map((p) => ({
|
|
157
|
-
...p,
|
|
158
|
-
comment: p.comment && typeof p.comment === 'string'
|
|
159
|
-
? p.comment?.replace(/\n/g, '<br/>')
|
|
160
|
-
: null,
|
|
161
|
-
})),
|
|
162
|
-
}),
|
|
163
|
-
footer: ejs?.render(commonTemplate.footer, {
|
|
164
|
-
...data,
|
|
165
|
-
freeText: payload?.settings?.freeInvoiceText ?? null,
|
|
166
|
-
}),
|
|
167
|
-
data,
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
95
|
export function generateMailHeader(params, shouldHideBrandName = false, nodeEnv = undefined) {
|
|
171
96
|
dayjs.locale('fr');
|
|
172
97
|
const data = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document.js","sourceRoot":"","sources":["../../../../ts/utils/commercialManagement/document.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,IAAI,QAAQ,EAAE,OAAO,IAAI,QAAQ,EAAE,KAAK,IAAI,MAAM,EAAE,IAAI,IAAI,KAAK,GACzE,MAAM,QAAQ,CAAC;AAChB,OAAO,KAA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ayjs';\nimport { ReadCommercialDocumentTemplate, ReadDocumentEditing } from '../../types/Interface/api/commercialManagement/Read';\nimport {\n AccountingCategoryList, FontIds, fontList, VatMarginCategyList,\n} from '../../types/Enum/CommercialManagement';\nimport { EstimateInvoiceType } from '../../types/Enum/EstimateInvoice';\nimport { Vat } from '../../types/Enum/Vat';\nimport { integerToFormattedAmountString, integerToFormattedAmountObject } from '../amount';\nimport { CommercialDocumentCommonHTML, CommercialDocumentMailHTML } from './templates/common';\nimport { bodyTemplate } from './templates/body';\nimport { productToReadProductEditing } from './product';\nimport { vatToReadVatEditing } from './vat';\nimport {\n CreateInvoiceDocument, CreateMailHeader, CreatePreSaleDocument, ReadCommercialMailTemplate,\n} from '../../types';\nimport { thirdPartyToReadThirdPartyEditing } from './thirdParty';\nimport { getBrandConfig } from '../brands';\n\nconst ejs = require('ejs');\nrequire('dayjs/locale/fr');\n\ntype brandColorType = {\n primary: string,\n primary50: string,\n primary100: string,\n primary300: string,\n primary500: string,\n primary700: string\n};\n\nexport function generateCommercialDocument(idEstimateInvoiceType: EstimateInvoiceType, payload: CreateInvoiceDocument | CreatePreSaleDocument, shouldHideBrandName = false, nodeEnv: string | undefined = undefined): ReadCommercialDocumentTemplate {\n const products = _orderBy(payload.products.map((product) => productToReadProductEditing(product), 'reorder'));\n const vats = _orderBy(Object.values(_groupBy(products, 'vatFormatted')).map((v) => (vatToReadVatEditing(v)), 'value')).filter((v) => v.id !== Vat.MARGE.id);\n const thirdParty = thirdPartyToReadThirdPartyEditing(payload.thirdParty);\n\n const data: ReadDocumentEditing & { brandColors: brandColorType, brandName: string, shouldHideBrandName: boolean } = {\n ...payload,\n thirdParty,\n paymentLink: payload.paymentLink ?? '#',\n idEstimateInvoiceType,\n title: payload.title ?? null,\n penalties: payload.penalties ?? null,\n compensation: payload.compensation ?? null,\n discount: payload.discount ?? null,\n vatMention: payload.vatMention ?? null,\n phoneContact: payload.settings?.phoneContact ?? null,\n products,\n vats,\n totalTaxExcluded: _sumBy(products, 'totalTaxExcluded'),\n totalTaxIncluded: _sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount'),\n totalTaxAndDiscountIncluded: _sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount'),\n generalDiscountFormatted: payload.generalDiscount2 ? integerToFormattedAmountString(payload.generalDiscount2) : null,\n depositFormatted: payload.deposit ? integerToFormattedAmountString(payload.deposit) : null,\n totalTaxExcludedFormatted: integerToFormattedAmountString(_sumBy(products, 'totalTaxExcluded')),\n totalTaxIncludedFormatted: integerToFormattedAmountString(_sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount')),\n totalTaxAndDiscountIncludedFormatted: integerToFormattedAmountString(_sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount') - (payload.generalDiscount2 ?? 0) - (payload.deposit ?? 0)),\n totalVatAmountFormatted: integerToFormattedAmountString(_sumBy(vats, 'amount')),\n font: {\n id: payload.settings?.idFont ?? FontIds.CIRCULAR_STD,\n name: fontList.find((f) => f.id === payload.settings?.idFont)?.name ?? fontList[0].name,\n url: fontList.find((f) => f.id === payload.settings?.idFont)?.link ?? fontList[0].link,\n },\n capitalFormatted: payload.capital\n ? `${payload.capital}`.split('')\n .reduceRight((acc, char, i, { length }) => `${char}${(length - (i + 1)) % 3 === 0 ? ' ' : ''}${acc}`, '')\n .trim()\n : null,\n dueDateFormatted: payload.dueDate ? dayjs(payload.dueDate).format('DD/MM/YYYY') : null,\n expirationDateFormatted: payload.expirationDate ? dayjs(payload.expirationDate).format('DD/MM/YYYY') : null,\n emissionDateFormatted: payload.emissionDate ? dayjs(payload.emissionDate).format('DD/MM/YYYY') : null,\n shouldDisplayDiscountColumn: !!products.find(\n (p) => p.discount2 && p.discount2 > 0,\n ),\n // @ts-ignore\n marginVats: _uniq(\n products\n .filter((p) => p.marginVatFormatted !== null)\n .map((p) => p.marginVatFormatted),\n ),\n accountingCategoryFormatted:\n AccountingCategoryList.find((a) => a.id === payload.accountingCategory)\n ?.label ?? null,\n // @ts-ignore\n brandColors: getBrandConfig({ objectWaited: 'colors', nodeEnv }) as brandColorType,\n brandName: `${getBrandConfig({ objectWaited: 'name', nodeEnv })}`,\n shouldHideBrandName,\n paymentType: payload.paymentType,\n };\n\n const commonTemplate = new CommercialDocumentCommonHTML();\n const documentFreeText = [\n EstimateInvoiceType.DEVIS,\n EstimateInvoiceType.BON,\n ].includes(idEstimateInvoiceType)\n ? payload?.settings?.freeEstimateText\n : payload?.settings?.freeInvoiceText;\n\n return {\n header: ejs.render(commonTemplate.header, data),\n body: ejs.render(bodyTemplate, {\n ...data,\n comment:\n data.comment && typeof data.comment === 'string'\n ? data.comment?.replace(/\\n/g, '<br/>')\n : null,\n products: data.products.map((p) => ({\n ...p,\n comment:\n p.comment && typeof p.comment === 'string'\n ? p.comment?.replace(/\\n/g, '<br/>')\n : null,\n })),\n }),\n footer: ejs.render(commonTemplate.footer, {\n ...data,\n freeText: documentFreeText ?? null,\n }),\n data,\n };\n}\n\nexport function generateAdvanceDocument(payload: CreateInvoiceDocument, shouldHideBrandName = false, nodeEnv: string | undefined = undefined): ReadCommercialDocumentTemplate {\n if (!payload.deposit) throw new Error('Aucun acompte défini');\n\n const data: ReadDocumentEditing & { brandColors: brandColorType, brandName: string, shouldHideBrandName: boolean } = {\n ...payload,\n title: payload.title ?? null,\n paymentLink: payload.paymentLink ?? '#',\n idEstimateInvoiceType: EstimateInvoiceType.ACOMPTE,\n phoneContact: payload.settings?.phoneContact ?? null,\n products: [],\n vats: [],\n totalTaxExcluded: payload.deposit,\n totalTaxIncluded: payload.deposit,\n totalTaxAndDiscountIncluded: payload.deposit,\n generalDiscountFormatted: null,\n depositFormatted: integerToFormattedAmountString(payload.deposit),\n totalTaxExcludedFormatted: integerToFormattedAmountString(payload.deposit),\n totalTaxIncludedFormatted: integerToFormattedAmountString(payload.deposit),\n totalTaxAndDiscountIncludedFormatted: integerToFormattedAmountString(\n payload.deposit,\n ),\n totalVatAmountFormatted: integerToFormattedAmountString(0),\n font: {\n id: payload.settings?.idFont ?? FontIds.CIRCULAR_STD,\n name:\n fontList.find((f) => f.id === payload.settings?.idFont)?.name\n ?? fontList[0].name,\n url:\n fontList.find((f) => f.id === payload.settings?.idFont)?.link\n ?? fontList[0].link,\n },\n capitalFormatted: payload.capital\n ? `${payload.capital}`\n .split('')\n .reduceRight(\n (acc, char, i, { length }) => `${char}${(length - (i + 1)) % 3 === 0 ? ' ' : ''}${acc}`,\n '',\n )\n .trim()\n : null,\n dueDateFormatted: payload.dueDate\n ? dayjs(payload.dueDate).format('DD/MM/YYYY')\n : null,\n expirationDateFormatted: payload.expirationDate\n ? dayjs(payload.expirationDate).format('DD/MM/YYYY')\n : null,\n emissionDateFormatted: payload.emissionDate\n ? dayjs(payload.emissionDate).format('DD/MM/YYYY')\n : null,\n shouldDisplayDiscountColumn: false,\n disableVat: true,\n // @ts-ignore\n marginVats: _uniq(\n (payload.assetMarginVatIds ?? []).map(\n (m) => VatMarginCategyList.find((c) => c.id === m)?.label ?? null,\n ),\n ),\n accountingCategoryFormatted:\n AccountingCategoryList.find((a) => a.id === payload.accountingCategory)\n ?.label ?? null,\n // @ts-ignore\n brandColors: getBrandConfig({ objectWaited: 'colors', nodeEnv }) as brandColorType,\n brandName: `${getBrandConfig({ objectWaited: 'name', nodeEnv })}`,\n shouldHideBrandName,\n };\n\n const commonTemplate = new CommercialDocumentCommonHTML();\n\n return {\n header: ejs?.render(commonTemplate.header, data),\n body: ejs?.render(bodyTemplate, {\n ...data,\n comment:\n data.comment && typeof data.comment === 'string'\n ? data.comment?.replace(/\\n/g, '<br/>')\n : null,\n products: data.products.map((p) => ({\n ...p,\n comment:\n p.comment && typeof p.comment === 'string'\n ? p.comment?.replace(/\\n/g, '<br/>')\n : null,\n })),\n }),\n footer: ejs?.render(commonTemplate.footer, {\n ...data,\n freeText: payload?.settings?.freeInvoiceText ?? null,\n }),\n data,\n };\n}\n\nexport function generateMailHeader(params: CreateMailHeader, shouldHideBrandName = false, nodeEnv: string | undefined = undefined): ReadCommercialMailTemplate {\n dayjs.locale('fr');\n const data = {\n ...params.payload,\n totalTaxExcludedFormatted: integerToFormattedAmountObject(params.payload.totalTaxExcluded),\n totalTaxIncludedFormatted: integerToFormattedAmountObject(params.payload.totalTaxIncluded),\n totalVatFormatted: integerToFormattedAmountObject(params.payload.totalTaxIncluded - params.payload.totalTaxExcluded),\n dueDateFormatted: params.payload.dueDate ? dayjs(params.payload.dueDate).format('DD MMMM YYYY') : null,\n hasVat: params.hasVat,\n hostS3: params.hostS3,\n logoUrl: params.logoUrl,\n companyName: params.companyName,\n fileUrl: params.fileUrl,\n // @ts-ignore\n brandColors: getBrandConfig({ objectWaited: 'colors', nodeEnv }) as brandColorType,\n shouldHideBrandName,\n };\n\n const mailTemplate = new CommercialDocumentMailHTML();\n\n return {\n header: ejs.render(mailTemplate.header, data),\n };\n}"]}
|
|
1
|
+
{"version":3,"file":"document.js","sourceRoot":"","sources":["../../../../ts/utils/commercialManagement/document.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,IAAI,QAAQ,EAAE,OAAO,IAAI,QAAQ,EAAE,KAAK,IAAI,MAAM,EAAE,IAAI,IAAI,KAAK,GACzE,MAAM,QAAQ,CAAC;AAChB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EACL,sBAAsB,EAAE,OAAO,EAAE,QAAQ,GAC1C,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAC;AAC3C,OAAO,EAAE,8BAA8B,EAAE,8BAA8B,EAAE,MAAM,WAAW,CAAC;AAC3F,OAAO,EAAE,4BAA4B,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAC9F,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,2BAA2B,EAAE,MAAM,WAAW,CAAC;AACxD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AAC,OAAO,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,IAAI;QACtG,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,aAAa;QACb,WAAW,EAAE,cAAc,CAAC,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAmB;QAClF,mBAAmB;KACpB,CAAC;IAEF,MAAM,YAAY,GAAG,IAAI,0BAA0B,EAAE,CAAC;IAEtD,OAAO;QACL,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC;KAC9C,CAAC;AACJ,CAAC","sourcesContent":["import {\n orderBy as _orderBy, groupBy as _groupBy, sumBy as _sumBy, uniq as _uniq,\n} from 'lodash';\nimport * as dayjs from 'dayjs';\nimport { ReadCommercialDocumentTemplate, ReadDocumentEditing } from '../../types/Interface/api/commercialManagement/Read';\nimport {\n AccountingCategoryList, FontIds, fontList,\n} from '../../types/Enum/CommercialManagement';\nimport { EstimateInvoiceType } from '../../types/Enum/EstimateInvoice';\nimport { Vat } from '../../types/Enum/Vat';\nimport { integerToFormattedAmountString, integerToFormattedAmountObject } from '../amount';\nimport { CommercialDocumentCommonHTML, CommercialDocumentMailHTML } from './templates/common';\nimport { bodyTemplate } from './templates/body';\nimport { productToReadProductEditing } from './product';\nimport { vatToReadVatEditing } from './vat';\nimport {\n CreateInvoiceDocument, CreateMailHeader, CreatePreSaleDocument, ReadCommercialMailTemplate,\n} from '../../types';\nimport { thirdPartyToReadThirdPartyEditing } from './thirdParty';\nimport { getBrandConfig } from '../brands';\n\nconst ejs = require('ejs');\nrequire('dayjs/locale/fr');\n\ntype brandColorType = {\n primary: string,\n primary50: string,\n primary100: string,\n primary300: string,\n primary500: string,\n primary700: string\n};\n\nexport function generateCommercialDocument(idEstimateInvoiceType: EstimateInvoiceType, payload: CreateInvoiceDocument | CreatePreSaleDocument, shouldHideBrandName = false, nodeEnv: string | undefined = undefined): ReadCommercialDocumentTemplate {\n const products = _orderBy(payload.products.map((product) => productToReadProductEditing(product), 'reorder'));\n const vats = _orderBy(Object.values(_groupBy(products, 'vatFormatted')).map((v) => (vatToReadVatEditing(v)), 'value')).filter((v) => v.id !== Vat.MARGE.id);\n const thirdParty = thirdPartyToReadThirdPartyEditing(payload.thirdParty);\n\n const data: ReadDocumentEditing & { brandColors: brandColorType, brandName: string, shouldHideBrandName: boolean } = {\n ...payload,\n thirdParty,\n paymentLink: payload.paymentLink ?? '#',\n idEstimateInvoiceType,\n title: payload.title ?? null,\n penalties: payload.penalties ?? null,\n compensation: payload.compensation ?? null,\n discount: payload.discount ?? null,\n vatMention: payload.vatMention ?? null,\n phoneContact: payload.settings?.phoneContact ?? null,\n products,\n vats,\n totalTaxExcluded: _sumBy(products, 'totalTaxExcluded'),\n totalTaxIncluded: _sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount'),\n totalTaxAndDiscountIncluded: _sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount'),\n generalDiscountFormatted: payload.generalDiscount2 ? integerToFormattedAmountString(payload.generalDiscount2) : null,\n depositFormatted: payload.deposit ? integerToFormattedAmountString(payload.deposit) : null,\n totalTaxExcludedFormatted: integerToFormattedAmountString(_sumBy(products, 'totalTaxExcluded')),\n totalTaxIncludedFormatted: integerToFormattedAmountString(_sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount')),\n totalTaxAndDiscountIncludedFormatted: integerToFormattedAmountString(_sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount') - (payload.generalDiscount2 ?? 0) - (payload.deposit ?? 0)),\n totalVatAmountFormatted: integerToFormattedAmountString(_sumBy(vats, 'amount')),\n font: {\n id: payload.settings?.idFont ?? FontIds.CIRCULAR_STD,\n name: fontList.find((f) => f.id === payload.settings?.idFont)?.name ?? fontList[0].name,\n url: fontList.find((f) => f.id === payload.settings?.idFont)?.link ?? fontList[0].link,\n },\n capitalFormatted: payload.capital\n ? `${payload.capital}`.split('')\n .reduceRight((acc, char, i, { length }) => `${char}${(length - (i + 1)) % 3 === 0 ? ' ' : ''}${acc}`, '')\n .trim()\n : null,\n dueDateFormatted: payload.dueDate ? dayjs(payload.dueDate).format('DD/MM/YYYY') : null,\n expirationDateFormatted: payload.expirationDate ? dayjs(payload.expirationDate).format('DD/MM/YYYY') : null,\n emissionDateFormatted: payload.emissionDate ? dayjs(payload.emissionDate).format('DD/MM/YYYY') : null,\n shouldDisplayDiscountColumn: !!products.find(\n (p) => p.discount2 && p.discount2 > 0,\n ),\n // @ts-ignore\n marginVats: _uniq(\n products\n .filter((p) => p.marginVatFormatted !== null)\n .map((p) => p.marginVatFormatted),\n ),\n accountingCategoryFormatted:\n AccountingCategoryList.find((a) => a.id === payload.accountingCategory)\n ?.label ?? null,\n // @ts-ignore\n brandColors: getBrandConfig({ objectWaited: 'colors', nodeEnv }) as brandColorType,\n brandName: `${getBrandConfig({ objectWaited: 'name', nodeEnv })}`,\n shouldHideBrandName,\n paymentType: payload.paymentType,\n };\n\n const commonTemplate = new CommercialDocumentCommonHTML();\n const documentFreeText = [\n EstimateInvoiceType.DEVIS,\n EstimateInvoiceType.BON,\n ].includes(idEstimateInvoiceType)\n ? payload?.settings?.freeEstimateText\n : payload?.settings?.freeInvoiceText;\n\n return {\n header: ejs.render(commonTemplate.header, data),\n body: ejs.render(bodyTemplate, {\n ...data,\n comment:\n data.comment && typeof data.comment === 'string'\n ? data.comment?.replace(/\\n/g, '<br/>')\n : null,\n products: data.products.map((p) => ({\n ...p,\n comment:\n p.comment && typeof p.comment === 'string'\n ? p.comment?.replace(/\\n/g, '<br/>')\n : null,\n })),\n }),\n footer: ejs.render(commonTemplate.footer, {\n ...data,\n freeText: documentFreeText ?? null,\n }),\n data,\n };\n}\n\nexport function generateMailHeader(params: CreateMailHeader, shouldHideBrandName = false, nodeEnv: string | undefined = undefined): ReadCommercialMailTemplate {\n dayjs.locale('fr');\n const data = {\n ...params.payload,\n totalTaxExcludedFormatted: integerToFormattedAmountObject(params.payload.totalTaxExcluded),\n totalTaxIncludedFormatted: integerToFormattedAmountObject(params.payload.totalTaxIncluded),\n totalVatFormatted: integerToFormattedAmountObject(params.payload.totalTaxIncluded - params.payload.totalTaxExcluded),\n dueDateFormatted: params.payload.dueDate ? dayjs(params.payload.dueDate).format('DD MMMM YYYY') : null,\n hasVat: params.hasVat,\n hostS3: params.hostS3,\n logoUrl: params.logoUrl,\n companyName: params.companyName,\n fileUrl: params.fileUrl,\n // @ts-ignore\n brandColors: getBrandConfig({ objectWaited: 'colors', nodeEnv }) as brandColorType,\n shouldHideBrandName,\n };\n\n const mailTemplate = new CommercialDocumentMailHTML();\n\n return {\n header: ejs.render(mailTemplate.header, data),\n };\n}"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../../ts/utils/commercialManagement/templates/common.ts"],"names":[],"mappings":"AAMA,qBAAa,4BAA4B;IACvC,MAAM,SAIG;IAET,MAAM,SAcE;IAER,IAAI,SAEI;IAER,OAAO,SAMiF;IAExF,QAAQ,
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../../ts/utils/commercialManagement/templates/common.ts"],"names":[],"mappings":"AAMA,qBAAa,4BAA4B;IACvC,MAAM,SAIG;IAET,MAAM,SAcE;IAER,IAAI,SAEI;IAER,OAAO,SAMiF;IAExF,QAAQ,SAiCA;IAER,iBAAiB,SAeP;IAEV,oBAAoB,SA+CZ;IAER,aAAa,SAUD;IAEZ,KAAK,SA6HI;IAET,YAAY,SAeV;CACH;AAED,qBAAa,0BAA0B;IACrC,KAAK,SAWL;IAEA,MAAM,SA0FJ;CACH"}
|