@silexpert/core 1.0.34 → 1.0.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/api/resources/CommercialDocument.js +1 -1
- package/es/api/resources/CommercialDocument.js.map +1 -1
- package/es/types/Enum/RecurrenceType.d.ts +1 -1
- package/es/types/Enum/RecurrenceType.d.ts.map +1 -1
- package/es/types/Enum/RecurrenceType.js +2 -2
- package/es/types/Enum/RecurrenceType.js.map +1 -1
- package/es/types/Interface/api/commercialManagement/Create.d.ts +6 -6
- package/es/types/Interface/api/commercialManagement/Create.d.ts.map +1 -1
- package/es/types/Interface/api/commercialManagement/Create.js.map +1 -1
- package/es/types/Interface/api/commercialManagement/Query.d.ts +4 -2
- package/es/types/Interface/api/commercialManagement/Query.d.ts.map +1 -1
- package/es/types/Interface/api/commercialManagement/Query.js +10 -3
- package/es/types/Interface/api/commercialManagement/Query.js.map +1 -1
- package/es/types/Interface/api/thirdParty/CreateThirdPartyForm.d.ts +3 -3
- package/es/types/Interface/api/thirdParty/CreateThirdPartyForm.d.ts.map +1 -1
- package/es/types/Interface/api/thirdParty/CreateThirdPartyForm.js +1 -3
- package/es/types/Interface/api/thirdParty/CreateThirdPartyForm.js.map +1 -1
- package/es/types/Interface/api/thirdParty/UpdateThirdPartyForm.d.ts +3 -3
- package/es/types/Interface/api/thirdParty/UpdateThirdPartyForm.d.ts.map +1 -1
- package/es/types/Interface/api/thirdParty/UpdateThirdPartyForm.js +1 -3
- package/es/types/Interface/api/thirdParty/UpdateThirdPartyForm.js.map +1 -1
- package/es/utils/commercialManagement/document.d.ts.map +1 -1
- package/es/utils/commercialManagement/document.js +6 -14
- package/es/utils/commercialManagement/document.js.map +1 -1
- package/es/utils/commercialManagement/product.js +2 -2
- package/es/utils/commercialManagement/product.js.map +1 -1
- package/es/utils/commercialManagement/recurrence.js +1 -1
- package/es/utils/commercialManagement/recurrence.js.map +1 -1
- package/js/api/resources/CommercialDocument.js +1 -1
- package/js/api/resources/CommercialDocument.js.map +1 -1
- package/js/types/Enum/RecurrenceType.js +2 -2
- package/js/types/Enum/RecurrenceType.js.map +1 -1
- package/js/types/Interface/api/commercialManagement/Create.js.map +1 -1
- package/js/types/Interface/api/commercialManagement/Query.js +6 -4
- package/js/types/Interface/api/commercialManagement/Query.js.map +1 -1
- package/js/types/Interface/api/thirdParty/CreateThirdPartyForm.js +2 -2
- package/js/types/Interface/api/thirdParty/CreateThirdPartyForm.js.map +1 -1
- package/js/types/Interface/api/thirdParty/UpdateThirdPartyForm.js +2 -2
- package/js/types/Interface/api/thirdParty/UpdateThirdPartyForm.js.map +1 -1
- package/js/utils/commercialManagement/document.js +13 -21
- package/js/utils/commercialManagement/document.js.map +1 -1
- package/js/utils/commercialManagement/product.js +2 -2
- package/js/utils/commercialManagement/product.js.map +1 -1
- package/js/utils/commercialManagement/recurrence.js +1 -1
- package/js/utils/commercialManagement/recurrence.js.map +1 -1
- package/package.json +1 -1
- package/ts/api/resources/CommercialDocument.ts +1 -1
- package/ts/types/Enum/RecurrenceType.ts +2 -2
- package/ts/types/Interface/api/commercialManagement/Create.ts +17 -17
- package/ts/types/Interface/api/commercialManagement/Query.ts +12 -5
- package/ts/types/Interface/api/thirdParty/CreateThirdPartyForm.ts +4 -6
- package/ts/types/Interface/api/thirdParty/UpdateThirdPartyForm.ts +4 -6
- package/ts/utils/commercialManagement/document.ts +5 -14
- package/ts/utils/commercialManagement/product.ts +1 -1
- package/ts/utils/commercialManagement/recurrence.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product.js","sourceRoot":"","sources":["../../../ts/utils/commercialManagement/product.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAC1F,OAAO,EAAE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../../types';\nimport { Unit } from '../../types/Enum/Unit';\nimport { DiscountType, VatMarginCategyList } from '../../types/Enum/CommercialManagement';\nimport { getById } from './vat';\nimport { integerToFormattedAmountString } from '../amount';\n\nexport function getDiscount(product: IProductInvoice): number {\n if (product.discount2 === null || product.discount2 === undefined || product.discount2 <= 0) return 0;\n\n if (product.discountType === DiscountType.PERCENT) {\n return ((product.priceTaxExcluded ?? 0) * ((product.discount2 ?? 0) / 100)) / 100;\n } if (product.discountType === DiscountType.AMOUNT) {\n return (product.discount2 ?? 0);\n }\n\n return 0;\n}\n\nexport function getTotalTaxExcluded(product: IProductInvoice): number {\n const discount = product.discount2 && product.discount2 > 0 ? getDiscount(product) : 0;\n return ((product.priceTaxExcluded ?? 0) - discount) * (product.quantity ?? 1);\n}\n\nexport function productToReadProductEditing(payload: IProductInvoice): ReadProductEditing {\n return {\n ...payload,\n totalTaxExcluded: getTotalTaxExcluded(payload),\n unitFormatted: Object.values(Unit).find((unit) => unit.id === payload.unit)?.shortName ?? '',\n vatFormatted: getById(payload.idVat)?.saleName ?? '',\n priceTaxExcludedFormatted: isDefined(payload.priceTaxExcluded) ? integerToFormattedAmountString(payload.priceTaxExcluded) : null,\n totalTaxExcludedFormatted: isDefined(payload.priceTaxExcluded) ? integerToFormattedAmountString(getTotalTaxExcluded(payload)) : null,\n discountFormatted: payload.discount2 && payload.discount2 > 0 ? integerToFormattedAmountString(getDiscount(payload)) : null,\n discountTypeFormatted: payload.discount2 && payload.discount2 > 0 ? payload.discountType === DiscountType.PERCENT ? `${(payload.discount2 / 100).toFixed(2)}%` : `${integerToFormattedAmountString(payload.discount2)}€` : null,\n marginVatFormatted: payload.marginVatType ? VatMarginCategyList.find((c) => c.id === payload.marginVatType)?.label ?? null : null,\n };\n}"]}
|
|
@@ -13,7 +13,7 @@ export function getAllRecurrences(params) {
|
|
|
13
13
|
if (type === RecurrenceType.MONHLY)
|
|
14
14
|
recurrency = 'month';
|
|
15
15
|
// @ts-ignore
|
|
16
|
-
else if (type === RecurrenceType.
|
|
16
|
+
else if (type === RecurrenceType.QUARTERLY)
|
|
17
17
|
recurrency = 'quarter';
|
|
18
18
|
else if (type === RecurrenceType.WEEKLY)
|
|
19
19
|
recurrency = 'week';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recurrence.js","sourceRoot":"","sources":["../../../ts/utils/commercialManagement/recurrence.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEjE,MAAM,cAAc,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAAC;AAC9D,MAAM,aAAa,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC;AAE5D,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;AAC5B,KAAK,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;AAE7B,MAAM,UAAU,iBAAiB,CAAC,MAIjC;;IACC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;IACnC,MAAM,OAAO,GAAG,MAAA,MAAM,CAAC,OAAO,mCAAI,YAAY,CAAC;IAE/C,IAAI,IAAI,GAAG,CAAC,CAAC;IAEb,IAAI,UAAU,GAAe,OAAO,CAAC;IAErC,IAAI,IAAI,KAAK,cAAc,CAAC,MAAM;QAAE,UAAU,GAAG,OAAO,CAAC;IACzD,aAAa;SACR,IAAI,IAAI,KAAK,cAAc,CAAC,
|
|
1
|
+
{"version":3,"file":"recurrence.js","sourceRoot":"","sources":["../../../ts/utils/commercialManagement/recurrence.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEjE,MAAM,cAAc,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAAC;AAC9D,MAAM,aAAa,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC;AAE5D,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;AAC5B,KAAK,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;AAE7B,MAAM,UAAU,iBAAiB,CAAC,MAIjC;;IACC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;IACnC,MAAM,OAAO,GAAG,MAAA,MAAM,CAAC,OAAO,mCAAI,YAAY,CAAC;IAE/C,IAAI,IAAI,GAAG,CAAC,CAAC;IAEb,IAAI,UAAU,GAAe,OAAO,CAAC;IAErC,IAAI,IAAI,KAAK,cAAc,CAAC,MAAM;QAAE,UAAU,GAAG,OAAO,CAAC;IACzD,aAAa;SACR,IAAI,IAAI,KAAK,cAAc,CAAC,SAAS;QAAE,UAAU,GAAG,SAAS,CAAC;SAC9D,IAAI,IAAI,KAAK,cAAc,CAAC,MAAM;QAAE,UAAU,GAAG,MAAM,CAAC;SACxD,IAAI,IAAI,KAAK,cAAc,CAAC,MAAM;QAAE,UAAU,GAAG,MAAM,CAAC;IAE7D,MAAM,YAAY,GAAa,EAAE,CAAC;IAElC,aAAa;IACb,OAAO,KAAK,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE;QACrE,MAAM,WAAW,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QAC3D,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC;QACpD,IAAI,IAAI,CAAC,CAAC;KACX;IAED,OAAO,YAAY,CAAC;AACtB,CAAC","sourcesContent":["import * as dayjs from 'dayjs';\nimport { OpUnitType } from 'dayjs';\nimport { RecurrenceType } from '../../types/Enum/RecurrenceType';\n\nconst isSameOrBefore = require('dayjs/plugin/isSameOrBefore');\nconst quarterOfYear = require('dayjs/plugin/quarterOfYear');\n\ndayjs.extend(quarterOfYear);\ndayjs.extend(isSameOrBefore);\n\nexport function getAllRecurrences(params: {\n startDate: string;\n endDate: string | null;\n type: RecurrenceType;\n}): string[] {\n const { startDate, type } = params;\n const endDate = params.endDate ?? '2100-01-01';\n\n let loop = 0;\n\n let recurrency: OpUnitType = 'month';\n\n if (type === RecurrenceType.MONHLY) recurrency = 'month';\n // @ts-ignore\n else if (type === RecurrenceType.QUARTERLY) recurrency = 'quarter';\n else if (type === RecurrenceType.WEEKLY) recurrency = 'week';\n else if (type === RecurrenceType.YEARLY) recurrency = 'year';\n\n const nextInvoices: string[] = [];\n\n // @ts-ignore\n while (dayjs(startDate).add(loop, recurrency).isSameOrBefore(endDate)) {\n const currentDate = dayjs(startDate).add(loop, recurrency);\n nextInvoices.push(currentDate.format('YYYY-MM-DD'));\n loop += 1;\n }\n\n return nextInvoices;\n}"]}
|
|
@@ -55,7 +55,7 @@ class CommercialDocument extends _Resource.Resource {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
preview(idEstimateInvoiceType, payload) {
|
|
58
|
-
return this.axios.$post('/commercial-management/preview
|
|
58
|
+
return this.axios.$post('/commercial-management/preview', Object.assign(Object.assign({}, payload), {
|
|
59
59
|
idEstimateInvoiceType
|
|
60
60
|
}));
|
|
61
61
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommercialDocument.js","mappings":";;;;;;;AAAA;;AACA;;AAgBM,MAAOA,kBAAP,SAAkCC,kBAAlC,CAA0C;EAC9CC,GAAG,CAACC,EAAD,EAAW;IACZ,OAAO,KAAKC,KAAL,CAAWC,IAAX,CAAgB,oCAAoCF,EAAE,EAAtD,CAAP;EACD;;EAEDG,MAAM,CAACH,EAAD,EAAaI,OAAb,EAA8C;IAClD,OAAO,KAAKH,KAAL,CAAWI,KAAX,CAAiB,oCAAoCL,EAAE,EAAvD,EAA2DI,OAA3D,CAAP;EACD;;EAEDE,MAAM,CAACN,EAAD,EAAW;IACf,OAAO,KAAKC,KAAL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ACR,qBAAD,EAA6CV,OAA7C,EAAmG;IACxG,OAAO,KAAKH,KAAL,CAAWW,KAAX,CAAiB,gCAAjB,EAAiDC,gCAAOT,OAAP,GAAc;MAAEU;IAAF,CAAd,CAAjD,CAAP;EACD;;EAEDS,aAAa,CAACvB,EAAD,EAAW;IACtB,OAAO,KAAKC,KAAL,CAAWC,IAAX,CAAgB,oCAAoCF,EAAE,SAAtD,CAAP;EACD;;EAEDwB,oBAAoB,CAACV,qBAAD,EAA2C;IAC7D,OAAO,KAAKb,KAAL,CAAWC,IAAX,CAAgB,yCAAhB,EAA2D;MAAEO,MAAM,EAAE;QAAEK;MAAF;IAAV,CAA3D,CAAP;EACD;;EAEDW,aAAa,CAACC,SAAD,EAAoBjB,MAApB,EAA8C;IACzD,OAAO,KAAKR,KAAL,CAAWC,IAAX,CAAgB,oCAAoCwB,SAAS,aAA7D,EAA4E;MAAEjB;IAAF,CAA5E,CAAP;EACD;;AAnD6C;;QAAnCZ,kB,GAAAA,kB","names":["CommercialDocument","Resource","get","id","axios","$get","update","payload","patch","delete","$delete","getNextReference","params","getPaginated","createEstimate","$post","Object","idEstimateInvoiceType","EstimateInvoiceType","DEVIS","createOrder","BON","updateEstimate","$put","updateOrder","preview","getFormValues","getDefaultFormValues","getStatistics","idSociety"],"sourceRoot":"","sources":["../../../ts/api/resources/CommercialDocument.ts"],"sourcesContent":["import { Resource } from '../Resource';\nimport {\n BasePaginate,\n CreateInvoiceDocument,\n CreatePreSaleDocument,\n EstimateInvoiceType,\n IEstimateInvoice,\n IFile,\n QueryCountByStatus,\n QueryDocumentPaginated,\n QueryNextReference,\n QueryPaginate,\n ReadCountDocumentByStatus,\n ReadEstimateInvoice,\n UpdateCommercialDocument,\n} from '../../types';\n\nexport class CommercialDocument extends Resource {\n get(id: number): Promise<ReadEstimateInvoice> {\n return this.axios.$get(`/commercial-management/documents/${id}`);\n }\n\n update(id: number, payload: UpdateCommercialDocument): Promise<IEstimateInvoice> {\n return this.axios.patch(`/commercial-management/documents/${id}`, payload);\n }\n\n delete(id: number): Promise<true> {\n return this.axios.$delete(`/commercial-management/documents/${id}`);\n }\n\n getNextReference(params: QueryNextReference): Promise<string> {\n return this.axios.$get('/commercial-management/documents/references', { params });\n }\n\n getPaginated(params: QueryDocumentPaginated & QueryPaginate): Promise<BasePaginate<ReadEstimateInvoice>> {\n return this.axios.$get('/commercial-management/documents', { params });\n }\n\n createEstimate(payload: Omit<CreatePreSaleDocument, 'idEstimateInvoiceType'>): Promise<IEstimateInvoice> {\n return this.axios.$post('/commercial-management/estimates', { ...payload, idEstimateInvoiceType: EstimateInvoiceType.DEVIS });\n }\n\n createOrder(payload: Omit<CreatePreSaleDocument, 'idEstimateInvoiceType'>): Promise<IEstimateInvoice> {\n return this.axios.$post('/commercial-management/orders', { ...payload, idEstimateInvoiceType: EstimateInvoiceType.BON });\n }\n\n updateEstimate(id: number, payload: CreatePreSaleDocument): Promise<IEstimateInvoice> {\n return this.axios.$put(`/commercial-management/estimates/${id}`, payload);\n }\n\n updateOrder(id: number, payload: CreatePreSaleDocument): Promise<IEstimateInvoice> {\n return this.axios.$put(`/commercial-management/orders/${id}`, payload);\n }\n\n preview(idEstimateInvoiceType: EstimateInvoiceType, payload: CreatePreSaleDocument | CreateInvoiceDocument): Promise<IFile> {\n return this.axios.$post('/commercial-management/preview', { ...payload, idEstimateInvoiceType });\n }\n\n getFormValues(id: number): Promise<CreatePreSaleDocument> {\n return this.axios.$get(`/commercial-management/documents/${id}/inputs`);\n }\n\n getDefaultFormValues(idEstimateInvoiceType: EstimateInvoiceType): Promise<CreatePreSaleDocument> {\n return this.axios.$get('/commercial-management/documents/inputs', { params: { idEstimateInvoiceType } });\n }\n\n getStatistics(idSociety: number, params: QueryCountByStatus): Promise<ReadCountDocumentByStatus> {\n return this.axios.$get(`/commercial-management/societies/${idSociety}/statistics`, { params });\n }\n}"]}
|
|
@@ -8,7 +8,7 @@ var RecurrenceType = exports.RecurrenceType = undefined;
|
|
|
8
8
|
(function (RecurrenceType) {
|
|
9
9
|
RecurrenceType[RecurrenceType["WEEKLY"] = 1] = "WEEKLY";
|
|
10
10
|
RecurrenceType[RecurrenceType["MONHLY"] = 2] = "MONHLY";
|
|
11
|
-
RecurrenceType[RecurrenceType["
|
|
11
|
+
RecurrenceType[RecurrenceType["QUARTERLY"] = 3] = "QUARTERLY";
|
|
12
12
|
RecurrenceType[RecurrenceType["YEARLY"] = 4] = "YEARLY";
|
|
13
13
|
})(RecurrenceType || (exports.RecurrenceType = RecurrenceType = {}));
|
|
14
14
|
|
|
@@ -19,7 +19,7 @@ const RecurrenceList = exports.RecurrenceList = [{
|
|
|
19
19
|
id: RecurrenceType.MONHLY,
|
|
20
20
|
label: 'Mensuelle'
|
|
21
21
|
}, {
|
|
22
|
-
id: RecurrenceType.
|
|
22
|
+
id: RecurrenceType.QUARTERLY,
|
|
23
23
|
label: 'Trimestrielle'
|
|
24
24
|
}, {
|
|
25
25
|
id: RecurrenceType.YEARLY,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecurrenceType.js","mappings":";;;;;AAAA,IAAYA,cAKX,WALWA,cAKX,YALD;;AAAA,WAAYA,cAAZ,EAA0B;EACxBA;EACAA;EACAA;EACAA;AACD,CALD,EAAYA,cAAc,aAAdA,cAAc,GAAdA,cAAc,MAA1B;;AAOO,MAAMC,cAAc,WAAdA,cAAc,GAAkD,CAC3E;EACEC,EAAE,EAAEF,cAAc,CAACG,MADrB;EAEEC,KAAK,EAAE;AAFT,CAD2E,EAK3E;EACEF,EAAE,EAAEF,cAAc,CAACK,MADrB;EAEED,KAAK,EAAE;AAFT,CAL2E,EAS3E;EACEF,EAAE,EAAEF,cAAc,CAACM,
|
|
1
|
+
{"version":3,"file":"RecurrenceType.js","mappings":";;;;;AAAA,IAAYA,cAKX,WALWA,cAKX,YALD;;AAAA,WAAYA,cAAZ,EAA0B;EACxBA;EACAA;EACAA;EACAA;AACD,CALD,EAAYA,cAAc,aAAdA,cAAc,GAAdA,cAAc,MAA1B;;AAOO,MAAMC,cAAc,WAAdA,cAAc,GAAkD,CAC3E;EACEC,EAAE,EAAEF,cAAc,CAACG,MADrB;EAEEC,KAAK,EAAE;AAFT,CAD2E,EAK3E;EACEF,EAAE,EAAEF,cAAc,CAACK,MADrB;EAEED,KAAK,EAAE;AAFT,CAL2E,EAS3E;EACEF,EAAE,EAAEF,cAAc,CAACM,SADrB;EAEEF,KAAK,EAAE;AAFT,CAT2E,EAa3E;EACEF,EAAE,EAAEF,cAAc,CAACO,MADrB;EAEEH,KAAK,EAAE;AAFT,CAb2E,CAAtE","names":["RecurrenceType","RecurrenceList","id","WEEKLY","label","MONHLY","QUARTERLY","YEARLY"],"sourceRoot":"","sources":["../../../ts/types/Enum/RecurrenceType.ts"],"sourcesContent":["export enum RecurrenceType {\n WEEKLY = 1,\n MONHLY = 2,\n QUARTERLY = 3,\n YEARLY = 4,\n}\n\nexport const RecurrenceList: Array<{ id: RecurrenceType, label: string; }> = [\n {\n id: RecurrenceType.WEEKLY,\n label: 'Hebdomadaire',\n },\n {\n id: RecurrenceType.MONHLY,\n label: 'Mensuelle',\n },\n {\n id: RecurrenceType.QUARTERLY,\n label: 'Trimestrielle',\n },\n {\n id: RecurrenceType.YEARLY,\n label: 'Annuelle',\n },\n];"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Create.js","mappings":";;;;;;;AAAA;;AAGA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;AAOM,MAAOA,uBAAP,CAA8B;;QAAvBA,uB,GAAAA,uB;;AAOXC,YANC,iCAMD,EALC,iCAKD,EAJC,+BAID,EAHC,yBAAI,CAAJ,EAAO;EACNC,OAAO,EAAE;AADH,CAAP,CAGD;;AAKAD,YAHC,iCAGD,EAFC,iCAED,EADC,+BACD;;AAKAA,YAHC,iCAGD,EAFC,iCAED,EADC,+BACD;;AAKAA,YAHC,iCAGD,EAFC,iCAED,EADC,+BACD;;AAKAA,YAHC,iCAGD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ED,EADC,+BACD;;AAGI,MAAOU,gBAAP,CAAuB;;QAAhBA,gB,GAAAA,gB;;AAGXV,YAFC,yBAED,EADC,4BAAOW,8BAAP,CACD;;AAIAX,YAFC,yBAED,EADC,mCACD;;AAIAA,YAFC,yBAED,EADC,mCACD;;AAKAA,YAHC,yBAGD,EAFC,yBAED,EADC,gCACD","names":["CreateCommercialSetting","__decorate","message","CreateCommercialMail","CommercialDocumentInputs","description","Array","CreatePreSaleDocument","CreateInvoiceDocument","CreateCgv","CreateReminder","CreateRecurrence","RecurrenceType"],"sourceRoot":"","sources":["../../../../../ts/types/Interface/api/commercialManagement/Create.ts"],"sourcesContent":["import {\n IsArray, IsBoolean, IsDateString, IsEnum, IsNumber, IsOptional, IsString, Min,\n} from 'class-validator';\nimport { ApiProperty, ApiPropertyOptional } from '../../../../utils';\nimport { ToBoolean } from '../../../../utils/transforms/boolean.transform';\nimport { AccountingCategoryId, FontIds, LogoAlignment } from '../../../Enum/CommercialManagement';\nimport { EstimateInvoiceType } from '../../../Enum/EstimateInvoice';\nimport { RecurrenceType } from '../../../Enum/RecurrenceType';\nimport { IProductInvoice } from '../../models/IProductInvoice';\nimport { ISocietyGescom } from '../../models/ISocietyGescom';\nimport { IThirdParty } from '../../models/IThirdParty';\n\nexport type IProductInvoiceToCreate = IProductInvoice & { save?: boolean };\n\nexport class CreateCommercialSetting {\n @ApiPropertyOptional()\n @IsOptional()\n @IsNumber()\n @Min(0, {\n message: 'Capital should be positive',\n })\n capital?: number | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsString()\n tvaCode?: string | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsString()\n rcs?: string | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsString()\n numberTradeDirectory?: string | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsString()\n bank?: string | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsString()\n iban?: string | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsString()\n bic?: string | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsString()\n mailContact?: string | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsString()\n phoneContact?: string | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsString()\n website?: string | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsString()\n commercialName?: string | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsString()\n penalties?: string | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsString()\n discount?: string | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsString()\n recoveryCost?: string | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsString()\n vatMention?: string | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsBoolean()\n @ToBoolean()\n generatedBy?: boolean;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsBoolean()\n @ToBoolean()\n acceptCheque?: boolean;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsBoolean()\n @ToBoolean()\n mentionAutoent?: boolean;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsNumber()\n startInvoice?: number | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsNumber()\n startEstimate?: number | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsNumber()\n dayOfValidity?: number | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsBoolean()\n @ToBoolean()\n paymentsAccepted?: boolean;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsBoolean()\n @ToBoolean()\n stripePaymentByDefault?: boolean;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsBoolean()\n @ToBoolean()\n displayLogo?: boolean;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsBoolean()\n @ToBoolean()\n invoiceCgv?: boolean;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsString()\n color?: string | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsString()\n freeInvoiceText?: string | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsString()\n freeEstimateText?: string | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsString()\n logoAlignment?: LogoAlignment | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsNumber()\n idFont?: FontIds | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsBoolean()\n @ToBoolean()\n isEdgingDisplayed?: boolean;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsString()\n edgingColor?: string;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsBoolean()\n @ToBoolean()\n isCoordinatesFrameDisplayed?: boolean;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsBoolean()\n @ToBoolean()\n areLinesSeparationHidden?: boolean;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsBoolean()\n @ToBoolean()\n areColumnsSeparationHidden?: boolean;\n\n @ApiPropertyOptional()\n @IsOptional()\n accountingCategory: AccountingCategoryId;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsBoolean()\n @ToBoolean()\n shouldPayTaxAfterDebit: boolean;\n}\n\nexport class CreateCommercialMail {\n @ApiProperty()\n @IsString()\n to: string;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsString()\n cc?: string;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsString()\n bcc?: string;\n\n @ApiProperty()\n @IsString()\n subject: string;\n\n @ApiProperty()\n @IsString()\n content: string;\n}\n\nexport class CommercialDocumentInputs {\n @ApiProperty()\n legalForm: string | null;\n\n @ApiProperty()\n capital: number | null;\n\n @ApiProperty()\n siren: string | null;\n\n @ApiProperty()\n rcs: string | null;\n\n @ApiProperty()\n vatCode: string | null;\n\n @ApiProperty()\n nafCode: string | null;\n\n @ApiProperty()\n @IsString()\n reference: string; //\n\n @ApiProperty()\n thirdParty: IThirdParty; //\n\n @ApiProperty()\n @IsDateString()\n emissionDate: string; //\n\n @ApiProperty()\n @IsDateString()\n dueDate: string; //\n\n @ApiProperty({ description: 'Date d\\'expiration pour la facture d\\'acompte' })\n expirationDate: string | null;\n\n @ApiProperty({ description: 'Conditions de réglement' })\n termsOfPayment: string | null;\n\n @ApiProperty()\n @IsArray()\n products: Array<IProductInvoiceToCreate>;\n\n @ApiProperty({ description: 'Escompte' })\n @IsString()\n discount: string; //\n\n @ApiProperty()\n comment: string | null; //\n\n @ApiProperty({ description: 'Pénalité de retard' })\n penalties: string | null; //\n\n @ApiProperty({ description: 'Remise globale' })\n @IsNumber()\n generalDiscount2: number; //\n\n @ApiProperty({ description: 'Indemnité forfaitaire' })\n compensation: string | null; //\n\n @ApiProperty()\n vatMention: string | null; //\n\n @ApiProperty()\n @IsBoolean()\n @ToBoolean()\n disableVat: boolean;\n\n @ApiProperty()\n title: string | null; //\n\n @ApiProperty({ description: 'Commercial name of seller' })\n @IsString()\n name: string;\n\n @ApiProperty({ description: 'Commercial number address of seller' })\n number?: string | null;\n\n @ApiProperty({ description: 'Commercial street address of seller' })\n street: string | null;\n\n @ApiProperty({ description: 'Commercial zip code address of seller' })\n zipCode: string | null;\n\n @ApiProperty({ description: 'Commercial city address of seller' })\n city: string | null;\n\n @ApiProperty()\n settings?: ISocietyGescom;\n\n @ApiProperty()\n cgv: string | null;\n\n @ApiProperty()\n logoUrl: string | null;\n\n @ApiProperty()\n @IsBoolean()\n @ToBoolean()\n isStripeAllowed?: boolean;\n\n @ApiProperty()\n @IsBoolean()\n @ToBoolean()\n isDraft?: boolean;\n\n @ApiProperty()\n idEstimateInvoiceType: EstimateInvoiceType;\n\n @ApiProperty()\n accountingCategory: AccountingCategoryId;\n\n @ApiProperty()\n @IsBoolean()\n @ToBoolean()\n shouldPayTaxAfterDebit: boolean;\n}\n\nexport class CreatePreSaleDocument extends CommercialDocumentInputs {\n paymentLink?: '#';\n deposit?: undefined;\n fromEstimateId: undefined;\n assetMarginVatIds?: [];\n}\nexport class CreateInvoiceDocument extends CommercialDocumentInputs {\n paymentLink?: string;\n deposit?: number;\n fromInvoiceId?: number | null; // Nécessaire lors de la création d'un avoir à partir d'une facture\n fromEstimateId: number | null; // Nécessaire lors du passage d'un devis à facture\n assetMarginVatIds?: number[]; // Laisser vide côté front, utilisé pour l'affichage des tva sur marge sur les acomptes\n}\n\nexport class CreateCgv {\n @ApiProperty()\n cgv: string | null;\n}\n\nexport class CreateReminder {\n @ApiProperty()\n @IsBoolean()\n @ToBoolean()\n beforeThree: boolean;\n\n @ApiProperty()\n @IsBoolean()\n @ToBoolean()\n dueDate: boolean;\n\n @ApiProperty()\n @IsBoolean()\n @ToBoolean()\n afterThree: boolean;\n\n @ApiProperty()\n @IsBoolean()\n @ToBoolean()\n afterSeven: boolean;\n\n @ApiPropertyOptional()\n @IsString()\n @IsOptional()\n subject?: string;\n\n @ApiPropertyOptional()\n @IsString()\n @IsOptional()\n message?: string;\n\n @ApiProperty()\n @IsString()\n email: string;\n}\n\nexport class CreateRecurrence {\n @ApiProperty()\n @IsEnum(RecurrenceType)\n type: number;\n\n @ApiProperty()\n @IsDateString()\n startDate: string;\n\n @ApiProperty()\n @IsDateString()\n endDate: string;\n\n @ApiProperty()\n @ToBoolean()\n @IsBoolean()\n isActive: boolean;\n}"]}
|
|
1
|
+
{"version":3,"file":"Create.js","mappings":";;;;;;;AAAA;;AAGA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;AAOM,MAAOA,uBAAP,CAA8B;;QAAvBA,uB,GAAAA,uB;;AAOXC,YANC,iCAMD,EALC,iCAKD,EAJC,+BAID,EAHC,yBAAI,CAAJ,EAAO;EACNC,OAAO,EAAE;AADH,CAAP,CAGD;;AAKAD,YAHC,iCAGD,EAFC,iCAED,EADC,+BACD;;AAKAA,YAHC,iCAGD,EAFC,iCAED,EADC,+BACD;;AAKAA,YAHC,iCAGD,EAFC,iCAED,EADC,+BACD;;AAKAA,YAHC,iCAGD,EAFC,iCAED,EADC,+BACD;;AAKAA,YAHC,iCAGD,EAFC,iCAED,EADC,+BACD;;AAKAA,YAHC,iCAGD,EAFC,iCAED,EADC,+BACD;;AAK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X,YAFC,yBAED,EADC,mCACD;;AAIAA,YAFC,yBAED,EADC,mCACD;;AAKAA,YAHC,yBAGD,EAFC,yBAED,EADC,gCACD","names":["CreateCommercialSetting","__decorate","message","CreateCommercialMail","CommercialDocumentInputs","description","Array","CreatePreSaleDocument","CreateInvoiceDocument","CreateCgv","CreateReminder","CreateRecurrence","RecurrenceType"],"sourceRoot":"","sources":["../../../../../ts/types/Interface/api/commercialManagement/Create.ts"],"sourcesContent":["import {\n IsArray, IsBoolean, IsDateString, IsEnum, IsNumber, IsOptional, IsString, Min,\n} from 'class-validator';\nimport { ApiProperty, ApiPropertyOptional } from '../../../../utils';\nimport { ToBoolean } from '../../../../utils/transforms/boolean.transform';\nimport { AccountingCategoryId, FontIds, LogoAlignment } from '../../../Enum/CommercialManagement';\nimport { EstimateInvoiceType } from '../../../Enum/EstimateInvoice';\nimport { RecurrenceType } from '../../../Enum/RecurrenceType';\nimport { IProductInvoice } from '../../models/IProductInvoice';\nimport { ISocietyGescom } from '../../models/ISocietyGescom';\nimport { IThirdParty } from '../../models/IThirdParty';\n\nexport type IProductInvoiceToCreate = IProductInvoice & { save?: boolean };\n\nexport class CreateCommercialSetting {\n @ApiPropertyOptional()\n @IsOptional()\n @IsNumber()\n @Min(0, {\n message: 'Capital should be positive',\n })\n capital?: number | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsString()\n tvaCode?: string | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsString()\n rcs?: string | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsString()\n numberTradeDirectory?: string | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsString()\n bank?: string | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsString()\n iban?: string | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsString()\n bic?: string | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsString()\n mailContact?: string | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsString()\n phoneContact?: string | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsString()\n website?: string | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsString()\n commercialName?: string | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsString()\n penalties?: string | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsString()\n discount?: string | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsString()\n recoveryCost?: string | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsString()\n vatMention?: string | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsBoolean()\n @ToBoolean()\n generatedBy?: boolean;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsBoolean()\n @ToBoolean()\n acceptCheque?: boolean;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsBoolean()\n @ToBoolean()\n mentionAutoent?: boolean;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsNumber()\n startInvoice?: number | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsNumber()\n startEstimate?: number | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsNumber()\n dayOfValidity?: number | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsBoolean()\n @ToBoolean()\n paymentsAccepted?: boolean;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsBoolean()\n @ToBoolean()\n stripePaymentByDefault?: boolean;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsBoolean()\n @ToBoolean()\n displayLogo?: boolean;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsBoolean()\n @ToBoolean()\n invoiceCgv?: boolean;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsString()\n color?: string | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsString()\n freeInvoiceText?: string | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsString()\n freeEstimateText?: string | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsString()\n logoAlignment?: LogoAlignment | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsNumber()\n idFont?: FontIds | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsBoolean()\n @ToBoolean()\n isEdgingDisplayed?: boolean;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsString()\n edgingColor?: string;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsBoolean()\n @ToBoolean()\n isCoordinatesFrameDisplayed?: boolean;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsBoolean()\n @ToBoolean()\n areLinesSeparationHidden?: boolean;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsBoolean()\n @ToBoolean()\n areColumnsSeparationHidden?: boolean;\n\n @ApiPropertyOptional()\n @IsOptional()\n accountingCategory?: AccountingCategoryId;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsBoolean()\n @ToBoolean()\n shouldPayTaxAfterDebit?: boolean;\n}\n\nexport class CreateCommercialMail {\n @ApiProperty()\n @IsString()\n to: string;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsString()\n cc?: string;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsString()\n bcc?: string;\n\n @ApiProperty()\n @IsString()\n subject: string;\n\n @ApiProperty()\n @IsString()\n content: string;\n}\n\nexport class CommercialDocumentInputs {\n @ApiProperty()\n legalForm: string | null;\n\n @ApiProperty()\n capital: number | null;\n\n @ApiProperty()\n siren: string | null;\n\n @ApiProperty()\n rcs: string | null;\n\n @ApiProperty()\n vatCode: string | null;\n\n @ApiProperty()\n nafCode: string | null;\n\n @ApiProperty()\n @IsString()\n reference: string;\n\n @ApiProperty()\n thirdParty: IThirdParty;\n\n @ApiProperty()\n @IsDateString()\n emissionDate: string;\n\n @ApiProperty()\n @IsDateString()\n dueDate: string;\n\n @ApiProperty({ description: 'Date d\\'expiration pour la facture d\\'acompte' })\n expirationDate: string | null;\n\n @ApiProperty({ description: 'Conditions de réglement' })\n termsOfPayment: string | null;\n\n @ApiProperty()\n @IsArray()\n products: Array<IProductInvoiceToCreate>;\n\n @ApiProperty({ description: 'Escompte' })\n @IsString()\n discount: string;\n\n @ApiProperty()\n comment: string | null;\n\n @ApiProperty({ description: 'Pénalité de retard' })\n penalties: string | null;\n\n @ApiProperty({ description: 'Remise globale' })\n @IsNumber()\n generalDiscount2: number;\n\n @ApiProperty({ description: 'Indemnité forfaitaire' })\n compensation: string | null;\n\n @ApiProperty()\n vatMention: string | null;\n\n @ApiProperty()\n @IsBoolean()\n @ToBoolean()\n disableVat: boolean;\n\n @ApiProperty()\n title: string | null;\n\n @ApiProperty({ description: 'Commercial name of seller' })\n @IsString()\n name: string;\n\n @ApiProperty({ description: 'Commercial number address of seller' })\n number?: string | null;\n\n @ApiProperty({ description: 'Commercial street address of seller' })\n street: string | null;\n\n @ApiProperty({ description: 'Commercial zip code address of seller' })\n zipCode: string | null;\n\n @ApiProperty({ description: 'Commercial city address of seller' })\n city: string | null;\n\n @ApiProperty()\n settings: ISocietyGescom;\n\n @ApiProperty()\n cgv: string | null;\n\n @ApiProperty()\n logoUrl: string | null;\n\n @ApiProperty()\n @IsBoolean()\n @ToBoolean()\n isStripeAllowed: boolean;\n\n @ApiProperty()\n @IsBoolean()\n @ToBoolean()\n isDraft: boolean;\n\n @ApiProperty()\n idEstimateInvoiceType: EstimateInvoiceType;\n\n @ApiProperty()\n accountingCategory: AccountingCategoryId;\n\n @ApiProperty()\n @IsBoolean()\n @ToBoolean()\n shouldPayTaxAfterDebit?: boolean;\n}\n\nexport class CreatePreSaleDocument extends CommercialDocumentInputs {\n paymentLink?: '#';\n deposit?: undefined;\n fromEstimateId: undefined;\n assetMarginVatIds?: [];\n}\nexport class CreateInvoiceDocument extends CommercialDocumentInputs {\n paymentLink?: string;\n deposit?: number;\n fromInvoiceId?: number | null; // Nécessaire lors de la création d'un avoir à partir d'une facture\n fromEstimateId: number | null; // Nécessaire lors du passage d'un devis à facture\n assetMarginVatIds?: number[]; // Laisser vide côté front, utilisé pour l'affichage des tva sur marge sur les acomptes\n}\n\nexport class CreateCgv {\n @ApiProperty()\n cgv: string | null;\n}\n\nexport class CreateReminder {\n @ApiProperty()\n @IsBoolean()\n @ToBoolean()\n beforeThree: boolean;\n\n @ApiProperty()\n @IsBoolean()\n @ToBoolean()\n dueDate: boolean;\n\n @ApiProperty()\n @IsBoolean()\n @ToBoolean()\n afterThree: boolean;\n\n @ApiProperty()\n @IsBoolean()\n @ToBoolean()\n afterSeven: boolean;\n\n @ApiPropertyOptional()\n @IsString()\n @IsOptional()\n subject?: string;\n\n @ApiPropertyOptional()\n @IsString()\n @IsOptional()\n message?: string;\n\n @ApiProperty()\n @IsString()\n email: string;\n}\n\nexport class CreateRecurrence {\n @ApiProperty()\n @IsEnum(RecurrenceType)\n type: number;\n\n @ApiProperty()\n @IsDateString()\n startDate: string;\n\n @ApiProperty()\n @IsDateString()\n endDate: string;\n\n @ApiProperty()\n @ToBoolean()\n @IsBoolean()\n isActive: boolean;\n}"]}
|
|
@@ -41,19 +41,21 @@ __decorate([(0, _utils.ApiPropertyOptional)(), (0, _classValidator.IsOptional)()
|
|
|
41
41
|
|
|
42
42
|
__decorate([(0, _utils.ApiPropertyOptional)(), (0, _classValidator.IsOptional)(), (0, _classValidator.IsString)(), __metadata("design:type", String)], QueryInvoice.prototype, "orderBy", void 0);
|
|
43
43
|
|
|
44
|
-
__decorate([(0, _utils.ApiPropertyOptional)(), (0, _classValidator.IsBoolean)(), (0, _boolean.ToBoolean)(), __metadata("design:type", Boolean)], QueryInvoice.prototype, "
|
|
44
|
+
__decorate([(0, _utils.ApiPropertyOptional)(), (0, _classValidator.IsBoolean)(), (0, _boolean.ToBoolean)(), (0, _classValidator.IsOptional)(), __metadata("design:type", Boolean)], QueryInvoice.prototype, "toAnnotate", void 0);
|
|
45
|
+
|
|
46
|
+
__decorate([(0, _utils.ApiPropertyOptional)(), (0, _classValidator.IsOptional)(), (0, _classValidator.IsBoolean)(), (0, _boolean.ToBoolean)(), __metadata("design:type", Boolean)], QueryInvoice.prototype, "isDescending", void 0);
|
|
45
47
|
|
|
46
48
|
class QueryGetDefaultPayload {}
|
|
47
49
|
|
|
48
50
|
exports.QueryGetDefaultPayload = QueryGetDefaultPayload;
|
|
49
51
|
|
|
50
|
-
__decorate([(0, _utils.ApiProperty)(),
|
|
52
|
+
__decorate([(0, _utils.ApiProperty)(), __metadata("design:type", Number)], QueryGetDefaultPayload.prototype, "idEstimateInvoiceType", void 0);
|
|
51
53
|
|
|
52
54
|
class QueryNextReference {}
|
|
53
55
|
|
|
54
56
|
exports.QueryNextReference = QueryNextReference;
|
|
55
57
|
|
|
56
|
-
__decorate([(0, _utils.ApiProperty)(),
|
|
58
|
+
__decorate([(0, _utils.ApiProperty)(), __metadata("design:type", Number)], QueryNextReference.prototype, "idEstimateInvoiceType", void 0);
|
|
57
59
|
|
|
58
60
|
__decorate([(0, _utils.ApiPropertyOptional)(), (0, _classValidator.IsBoolean)(), (0, _boolean.ToBoolean)(), (0, _classValidator.IsOptional)(), __metadata("design:type", Boolean)], QueryNextReference.prototype, "isDraft", void 0);
|
|
59
61
|
|
|
@@ -81,7 +83,7 @@ __decorate([(0, _utils.ApiPropertyOptional)(), (0, _classValidator.IsBoolean)(),
|
|
|
81
83
|
|
|
82
84
|
__decorate([(0, _utils.ApiPropertyOptional)(), (0, _classValidator.IsOptional)(), (0, _classValidator.IsString)(), __metadata("design:type", String)], QueryDocumentPaginated.prototype, "search", void 0);
|
|
83
85
|
|
|
84
|
-
__decorate([(0, _utils.ApiPropertyOptional)(), (0, _classValidator.IsBoolean)(), (0, _boolean.ToBoolean)(), __metadata("design:type", Boolean)], QueryDocumentPaginated.prototype, "isDraft", void 0);
|
|
86
|
+
__decorate([(0, _utils.ApiPropertyOptional)(), (0, _classValidator.IsBoolean)(), (0, _boolean.ToBoolean)(), (0, _classValidator.IsOptional)(), __metadata("design:type", Boolean)], QueryDocumentPaginated.prototype, "isDraft", void 0);
|
|
85
87
|
|
|
86
88
|
class QueryCountByStatus {}
|
|
87
89
|
|
|
@@ -1 +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C,mCAED,EADC,iCACD;;AAKAA,YAHC,iCAGD,EAFC,mCAED,EADC,iCACD;;AAKAA,YAHC,iCAGD,EAFC,iCAED,EADC,+BACD;;AAKAA,YAHC,iCAGD,EAFC,iCAED,EADC,+BACD;;AAMAA,YAJC,iCAID,EAHC,gCAGD,EAFC,yBAED,EADC,iCACD;;AAKAA,YAHC,iCAGD,EAFC,iCAED,EADC,+BACD;;AAMAA,YAJC,iCAID,EAHC,gCAGD,EAFC,yBAED,EADC,iCACD;;AAGI,MAAOK,kBAAP,CAAyB;;QAAlBA,kB,GAAAA,kB;;AAIXL,YAHC,iCAGD,EAFC,mCAED,EADC,iCACD;;AAKAA,YAHC,iCAGD,EAFC,mCAED,EADC,iCACD;;AAKAA,YAHC,iCAGD,EAFC,iCAED,EADC,+BACD;;AAMAA,YAJC,iCAID,EAHC,gCAGD,EAFC,yBAED,EADC,iCACD","names":["QueryInvoice","__decorate","QueryGetDefaultPayload","QueryNextReference","QueryPreviewDocument","QueryDocumentPaginated","QueryCountByStatus"],"sourceRoot":"","sources":["../../../../../ts/types/Interface/api/commercialManagement/Query.ts"],"sourcesContent":["import {\n IsArray, IsBoolean, IsDateString, IsOptional, IsString,\n} from 'class-validator';\nimport { Order } from '../../..';\nimport { ApiProperty, ApiPropertyOptional } from '../../../../utils';\nimport { ToBoolean } from '../../../../utils/transforms/boolean.transform';\nimport { DiscountType, EstimateStatus, InvoiceStatus } from '../../../Enum/CommercialManagement';\nimport { EstimateInvoiceType } from '../../../Enum/EstimateInvoice';\nimport { QueryPaginate } from '../BasePaginate';\n\nexport class QueryInvoice {\n @ApiPropertyOptional()\n @IsOptional()\n @IsDateString()\n minDate?: string;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsDateString()\n maxDate?: string;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsString()\n search?: string;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsString()\n status?: InvoiceStatus;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsString()\n orderBy?: string;\n\n @ApiPropertyOptional()\n @IsBoolean()\n @ToBoolean()\n @IsOptional()\n toAnnotate?: boolean;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsBoolean()\n @ToBoolean()\n isDescending?: boolean;\n}\n\nexport interface ParamPaginatedInvoices {\n idSociety: number;\n date?: {\n gte?: string;\n lte?: string;\n };\n status?: InvoiceStatus;\n search?: string;\n pagination: QueryPaginate;\n toAnnotate?: boolean;\n order?: Order;\n}\n\nexport class QueryGetDefaultPayload {\n @ApiProperty()\n idEstimateInvoiceType: EstimateInvoiceType;\n}\n\nexport class QueryNextReference {\n @ApiProperty()\n idEstimateInvoiceType: EstimateInvoiceType;\n\n @ApiPropertyOptional()\n @IsBoolean()\n @ToBoolean()\n @IsOptional()\n isDraft?: boolean;\n}\n\nexport interface Discount {\n type: DiscountType,\n amount: number\n}\n\nexport class QueryPreviewDocument {\n @ApiProperty()\n idEstimateInvoiceType: EstimateInvoiceType;\n}\n\nexport class QueryDocumentPaginated {\n @ApiProperty()\n @IsArray()\n types: EstimateInvoiceType[];\n\n @ApiPropertyOptional()\n @IsDateString()\n @IsOptional()\n minDate?: string;\n\n @ApiPropertyOptional()\n @IsDateString()\n @IsOptional()\n maxDate?: string;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsString()\n status?: EstimateStatus;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsString()\n orderBy?: string;\n\n @ApiPropertyOptional()\n @IsBoolean()\n @ToBoolean()\n @IsOptional()\n isDescending?: boolean;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsString()\n search?: string;\n\n @ApiPropertyOptional()\n @IsBoolean()\n @ToBoolean()\n @IsOptional()\n isDraft?: boolean;\n}\n\nexport class QueryCountByStatus {\n @ApiPropertyOptional()\n @IsDateString()\n @IsOptional()\n minDate?: string;\n\n @ApiPropertyOptional()\n @IsDateString()\n @IsOptional()\n maxDate?: string;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsString()\n search?: string;\n\n @ApiPropertyOptional()\n @IsBoolean()\n @ToBoolean()\n @IsOptional()\n isDraft?: boolean;\n}"]}
|
|
@@ -67,9 +67,9 @@ __decorate([(0, _utils.ApiPropertyOptional)(), __metadata("design:type", Object)
|
|
|
67
67
|
|
|
68
68
|
__decorate([(0, _utils.ApiProperty)(), (0, _classValidator.IsEnum)(_.ThirdPartyType), __metadata("design:type", Number)], CreateThirdPartyForm.prototype, "idThirdPartyType", void 0);
|
|
69
69
|
|
|
70
|
-
__decorate([(0, _utils.ApiPropertyOptional)(), (0, _classValidator.IsOptional)(),
|
|
70
|
+
__decorate([(0, _utils.ApiPropertyOptional)(), (0, _classValidator.IsOptional)(), __metadata("design:type", Object)], CreateThirdPartyForm.prototype, "deliveryAddress", void 0);
|
|
71
71
|
|
|
72
|
-
__decorate([(0, _utils.ApiPropertyOptional)(), (0, _classValidator.IsOptional)(),
|
|
72
|
+
__decorate([(0, _utils.ApiPropertyOptional)(), (0, _classValidator.IsOptional)(), __metadata("design:type", Object)], CreateThirdPartyForm.prototype, "deliveryCity", void 0);
|
|
73
73
|
|
|
74
74
|
__decorate([(0, _utils.ApiPropertyOptional)(), (0, _classValidator.IsOptional)(), __metadata("design:type", Object)], CreateThirdPartyForm.prototype, "deliveryZipCode", void 0);
|
|
75
75
|
//# sourceMappingURL=CreateThirdPartyForm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateThirdPartyForm.js","mappings":";;;;;;;AAAA;;AACA;;AACA;;;;;;;;;;;;;;AAEM,MAAOA,oBAAP,CAA2B;;QAApBA,oB,GAAAA,oB;;AAEXC,YADC,iCACD;;AAGAA,YADC,iCACD;;AAGAA,YADC,iCACD;;AAGAA,YADC,yBACD;;AAGAA,YADC,iCACD;;AAGAA,YADC,iCACD;;AAGAA,YADC,iCACD;;AAGAA,YADC,iCACD;;AAGAA,YADC,iCACD;;AAGAA,YADC,iCACD;;AAGAA,YADC,iCACD;;AAGAA,YADC,yBACD;;AAGAA,YADC,iCACD;;AAGAA,YADC,iCACD;;AAGAA,YADC,yBACD;;AAGAA,YADC,iCACD;;AAGAA,YADC,iCACD;;AAGAA,YADC,iCACD;;AAGAA,YADC,iCACD;;AAIAA,YAFC,yBAED,EADC,4BAAOC,gBAAP,CACD;;
|
|
1
|
+
{"version":3,"file":"CreateThirdPartyForm.js","mappings":";;;;;;;AAAA;;AACA;;AACA;;;;;;;;;;;;;;AAEM,MAAOA,oBAAP,CAA2B;;QAApBA,oB,GAAAA,oB;;AAEXC,YADC,iCACD;;AAGAA,YADC,iCACD;;AAGAA,YADC,iCACD;;AAGAA,YADC,yBACD;;AAGAA,YADC,iCACD;;AAGAA,YADC,iCACD;;AAGAA,YADC,iCACD;;AAGAA,YADC,iCACD;;AAGAA,YADC,iCACD;;AAGAA,YADC,iCACD;;AAGAA,YADC,iCACD;;AAGAA,YADC,yBACD;;AAGAA,YADC,iCACD;;AAGAA,YADC,iCACD;;AAGAA,YADC,yBACD;;AAGAA,YADC,iCACD;;AAGAA,YADC,iCACD;;AAGAA,YADC,iCACD;;AAGAA,YADC,iCACD;;AAIAA,YAFC,yBAED,EADC,4BAAOC,gBAAP,CACD;;AAIAD,YAFC,iCAED,EADC,iCACD;;AAIAA,YAFC,iCAED,EADC,iCACD;;AAIAA,YAFC,iCAED,EADC,iCACD","names":["CreateThirdPartyForm","__decorate","ThirdPartyType"],"sourceRoot":"","sources":["../../../../../ts/types/Interface/api/thirdParty/CreateThirdPartyForm.ts"],"sourcesContent":["import { IsEnum, IsOptional } from 'class-validator';\nimport { ThirdPartyType } from '../../..';\nimport { ApiProperty, ApiPropertyOptional } from '../../../../utils';\n\nexport class CreateThirdPartyForm {\n @ApiPropertyOptional()\n budgeaSouscriptionId?: number | null;\n\n @ApiPropertyOptional()\n fullname?: string | null;\n\n @ApiPropertyOptional()\n fullnameAccountant?: string | null;\n\n @ApiProperty()\n company: string;\n\n @ApiPropertyOptional()\n address?: string | null;\n\n @ApiPropertyOptional()\n zipCode?: string | null;\n\n @ApiPropertyOptional()\n city?: string | null;\n\n @ApiPropertyOptional()\n phone?: string | null;\n\n @ApiPropertyOptional()\n email?: string | null;\n\n @ApiPropertyOptional()\n nSiret?: string | null;\n\n @ApiPropertyOptional()\n nTva?: string | null;\n\n @ApiProperty()\n soldeInit: number;\n\n @ApiPropertyOptional()\n state?: boolean | null;\n\n @ApiPropertyOptional()\n dateImport?: Date | null;\n\n @ApiProperty()\n isGeneric: boolean;\n\n @ApiPropertyOptional()\n juridicalSociety?: number | null;\n\n @ApiPropertyOptional()\n idTypePayment?: number | null;\n\n @ApiPropertyOptional()\n idAccount?: number | null;\n\n @ApiPropertyOptional()\n idCountry?: number | null;\n\n @ApiProperty()\n @IsEnum(ThirdPartyType)\n idThirdPartyType: ThirdPartyType;\n\n @ApiPropertyOptional()\n @IsOptional()\n deliveryAddress?: string | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n deliveryCity?: string | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n deliveryZipCode?: string | null;\n}"]}
|
|
@@ -67,9 +67,9 @@ __decorate([(0, _utils.ApiPropertyOptional)(), (0, _classValidator.IsOptional)()
|
|
|
67
67
|
|
|
68
68
|
__decorate([(0, _utils.ApiPropertyOptional)(), (0, _classValidator.IsOptional)(), (0, _classValidator.IsEnum)(_.ThirdPartyType), __metadata("design:type", Number)], UpdateThirdPartyForm.prototype, "idThirdPartyType", void 0);
|
|
69
69
|
|
|
70
|
-
__decorate([(0, _utils.ApiPropertyOptional)(), (0, _classValidator.IsOptional)(),
|
|
70
|
+
__decorate([(0, _utils.ApiPropertyOptional)(), (0, _classValidator.IsOptional)(), __metadata("design:type", Object)], UpdateThirdPartyForm.prototype, "deliveryAddress", void 0);
|
|
71
71
|
|
|
72
|
-
__decorate([(0, _utils.ApiPropertyOptional)(), (0, _classValidator.IsOptional)(),
|
|
72
|
+
__decorate([(0, _utils.ApiPropertyOptional)(), (0, _classValidator.IsOptional)(), __metadata("design:type", Object)], UpdateThirdPartyForm.prototype, "deliveryCity", void 0);
|
|
73
73
|
|
|
74
74
|
__decorate([(0, _utils.ApiPropertyOptional)(), (0, _classValidator.IsOptional)(), __metadata("design:type", Object)], UpdateThirdPartyForm.prototype, "deliveryZipCode", void 0);
|
|
75
75
|
//# sourceMappingURL=UpdateThirdPartyForm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UpdateThirdPartyForm.js","mappings":";;;;;;;AAAA;;AACA;;AACA;;;;;;;;;;;;;;AAEM,MAAOA,oBAAP,CAA2B;;QAApBA,oB,GAAAA,oB;;AAGXC,YAFC,iCAED,EADC,iCACD;;AAIAA,YAFC,iCAED,EADC,iCACD;;AAIAA,YAFC,iCAED,EADC,iCACD;;AAIAA,YAFC,iCAED,EADC,iCACD;;AAIAA,YAFC,iCAED,EADC,iCACD;;AAIAA,YAFC,iCAED,EADC,iCACD;;AAIAA,YAFC,iCAED,EADC,iCACD;;AAIAA,YAFC,iCAED,EADC,iCACD;;AAIAA,YAFC,iCAED,EADC,iCACD;;AAIAA,YAFC,iCAED,EADC,iCACD;;AAIAA,YAFC,iCAED,EADC,iCACD;;AAIAA,YAFC,iCAED,EADC,iCACD;;AAIAA,YAFC,iCAED,EADC,iCACD;;AAIAA,YAFC,iCAED,EADC,iCACD;;AAIAA,YAFC,iCAED,EADC,iCACD;;AAIAA,YAFC,iCAED,EADC,iCACD;;AAIAA,YAFC,iCAED,EADC,iCACD;;AAIAA,YAFC,iCAED,EADC,iCACD;;AAIAA,YAFC,iCAED,EADC,iCACD;;AAKAA,YAHC,iCAGD,EAFC,iCAED,EADC,4BAAOC,gBAAP,CACD;;
|
|
1
|
+
{"version":3,"file":"UpdateThirdPartyForm.js","mappings":";;;;;;;AAAA;;AACA;;AACA;;;;;;;;;;;;;;AAEM,MAAOA,oBAAP,CAA2B;;QAApBA,oB,GAAAA,oB;;AAGXC,YAFC,iCAED,EADC,iCACD;;AAIAA,YAFC,iCAED,EADC,iCACD;;AAIAA,YAFC,iCAED,EADC,iCACD;;AAIAA,YAFC,iCAED,EADC,iCACD;;AAIAA,YAFC,iCAED,EADC,iCACD;;AAIAA,YAFC,iCAED,EADC,iCACD;;AAIAA,YAFC,iCAED,EADC,iCACD;;AAIAA,YAFC,iCAED,EADC,iCACD;;AAIAA,YAFC,iCAED,EADC,iCACD;;AAIAA,YAFC,iCAED,EADC,iCACD;;AAIAA,YAFC,iCAED,EADC,iCACD;;AAIAA,YAFC,iCAED,EADC,iCACD;;AAIAA,YAFC,iCAED,EADC,iCACD;;AAIAA,YAFC,iCAED,EADC,iCACD;;AAIAA,YAFC,iCAED,EADC,iCACD;;AAIAA,YAFC,iCAED,EADC,iCACD;;AAIAA,YAFC,iCAED,EADC,iCACD;;AAIAA,YAFC,iCAED,EADC,iCACD;;AAIAA,YAFC,iCAED,EADC,iCACD;;AAKAA,YAHC,iCAGD,EAFC,iCAED,EADC,4BAAOC,gBAAP,CACD;;AAIAD,YAFC,iCAED,EADC,iCACD;;AAIAA,YAFC,iCAED,EADC,iCACD;;AAIAA,YAFC,iCAED,EADC,iCACD","names":["UpdateThirdPartyForm","__decorate","ThirdPartyType"],"sourceRoot":"","sources":["../../../../../ts/types/Interface/api/thirdParty/UpdateThirdPartyForm.ts"],"sourcesContent":["import { IsEnum, IsOptional } from 'class-validator';\nimport { ThirdPartyType } from '../../..';\nimport { ApiPropertyOptional } from '../../../../utils';\n\nexport class UpdateThirdPartyForm {\n @ApiPropertyOptional()\n @IsOptional()\n budgeaSouscriptionId?: number | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n fullname?: string | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n fullnameAccountant?: string | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n company?: string;\n\n @ApiPropertyOptional()\n @IsOptional()\n address?: string | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n zipCode?: string | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n city?: string | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n phone?: string | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n email?: string | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n nSiret?: string | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n nTva?: string | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n soldeInit?: number;\n\n @ApiPropertyOptional()\n @IsOptional()\n state?: boolean | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n dateImport?: Date | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n isGeneric?: boolean;\n\n @ApiPropertyOptional()\n @IsOptional()\n juridicalSociety?: number | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n idTypePayment?: number | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n idAccount?: number | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n idCountry?: number | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsEnum(ThirdPartyType)\n idThirdPartyType?: ThirdPartyType;\n\n @ApiPropertyOptional()\n @IsOptional()\n deliveryAddress?: string | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n deliveryCity?: string | null;\n\n @ApiPropertyOptional()\n @IsOptional()\n deliveryZipCode?: string | null;\n}"]}
|
|
@@ -35,7 +35,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
35
35
|
const ejs = require('ejs');
|
|
36
36
|
|
|
37
37
|
function generateCommercialDocument(idEstimateInvoiceType, payload) {
|
|
38
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
38
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
39
39
|
|
|
40
40
|
const products = (0, _lodash.orderBy)(payload.products.map(product => (0, _product.productToReadProductEditing)(product), 'reorder'));
|
|
41
41
|
const vats = (0, _lodash.orderBy)(Object.values((0, _lodash.groupBy)(products, 'vatFormatted')).map(v => (0, _vat.vatToReadVatEditing)(v), 'value')).filter(v => v.id !== _Vat.Vat.MARGE.id);
|
|
@@ -45,26 +45,26 @@ function generateCommercialDocument(idEstimateInvoiceType, payload) {
|
|
|
45
45
|
phoneContact: (_c = (_b = payload.settings) === null || _b === void 0 ? void 0 : _b.phoneContact) !== null && _c !== void 0 ? _c : null,
|
|
46
46
|
products,
|
|
47
47
|
vats,
|
|
48
|
-
totalTaxExcluded: (0, _lodash.sumBy)(products, 'totalTaxExcluded'),
|
|
49
|
-
totalTaxIncluded: (0, _lodash.sumBy)(products, 'totalTaxExcluded') + (0, _lodash.sumBy)(vats, 'amount'),
|
|
50
|
-
totalTaxAndDiscountIncluded: (0, _lodash.sumBy)(products, 'totalTaxExcluded') + (0, _lodash.sumBy)(vats, 'amount') - ((
|
|
48
|
+
totalTaxExcluded: (0, _lodash.sumBy)(products, 'totalTaxExcluded') - ((_d = payload.deposit) !== null && _d !== void 0 ? _d : 0),
|
|
49
|
+
totalTaxIncluded: (0, _lodash.sumBy)(products, 'totalTaxExcluded') + (0, _lodash.sumBy)(vats, 'amount') - ((_e = payload.deposit) !== null && _e !== void 0 ? _e : 0),
|
|
50
|
+
totalTaxAndDiscountIncluded: (0, _lodash.sumBy)(products, 'totalTaxExcluded') + (0, _lodash.sumBy)(vats, 'amount') - ((_f = payload.generalDiscount2) !== null && _f !== void 0 ? _f : 0) - ((_g = payload.deposit) !== null && _g !== void 0 ? _g : 0),
|
|
51
51
|
generalDiscountFormatted: payload.generalDiscount2 ? (0, _amount.integerToFormattedAmountString)(payload.generalDiscount2) : null,
|
|
52
52
|
depositFormatted: payload.deposit ? (0, _amount.integerToFormattedAmountString)(payload.deposit) : null,
|
|
53
|
-
totalTaxExcludedFormatted: (0, _amount.integerToFormattedAmountString)((0, _lodash.sumBy)(products, 'totalTaxExcluded')),
|
|
54
|
-
totalTaxIncludedFormatted: (0, _amount.integerToFormattedAmountString)((0, _lodash.sumBy)(products, 'totalTaxExcluded') + (0, _lodash.sumBy)(vats, 'amount') - ((
|
|
55
|
-
totalTaxAndDiscountIncludedFormatted: (0, _amount.integerToFormattedAmountString)((0, _lodash.sumBy)(products, 'totalTaxExcluded') + (0, _lodash.sumBy)(vats, 'amount') - ((
|
|
53
|
+
totalTaxExcludedFormatted: (0, _amount.integerToFormattedAmountString)((0, _lodash.sumBy)(products, 'totalTaxExcluded') - ((_h = payload.deposit) !== null && _h !== void 0 ? _h : 0)),
|
|
54
|
+
totalTaxIncludedFormatted: (0, _amount.integerToFormattedAmountString)((0, _lodash.sumBy)(products, 'totalTaxExcluded') + (0, _lodash.sumBy)(vats, 'amount') - ((_j = payload.deposit) !== null && _j !== void 0 ? _j : 0)),
|
|
55
|
+
totalTaxAndDiscountIncludedFormatted: (0, _amount.integerToFormattedAmountString)((0, _lodash.sumBy)(products, 'totalTaxExcluded') + (0, _lodash.sumBy)(vats, 'amount') - ((_k = payload.generalDiscount2) !== null && _k !== void 0 ? _k : 0) - ((_l = payload.deposit) !== null && _l !== void 0 ? _l : 0)),
|
|
56
56
|
totalVatAmountFormatted: (0, _amount.integerToFormattedAmountString)((0, _lodash.sumBy)(vats, 'amount')),
|
|
57
57
|
font: {
|
|
58
|
-
name: (
|
|
58
|
+
name: (_o = (_m = _CommercialManagement.fontList.find(f => {
|
|
59
59
|
var _a;
|
|
60
60
|
|
|
61
61
|
return f.id === ((_a = payload.settings) === null || _a === void 0 ? void 0 : _a.idFont);
|
|
62
|
-
})) === null ||
|
|
63
|
-
url: (
|
|
62
|
+
})) === null || _m === void 0 ? void 0 : _m.name) !== null && _o !== void 0 ? _o : _CommercialManagement.fontList[0].name,
|
|
63
|
+
url: (_q = (_p = _CommercialManagement.fontList.find(f => {
|
|
64
64
|
var _a;
|
|
65
65
|
|
|
66
66
|
return f.id === ((_a = payload.settings) === null || _a === void 0 ? void 0 : _a.idFont);
|
|
67
|
-
})) === null ||
|
|
67
|
+
})) === null || _p === void 0 ? void 0 : _p.link) !== null && _q !== void 0 ? _q : _CommercialManagement.fontList[0].link
|
|
68
68
|
},
|
|
69
69
|
capitalFormatted: payload.capital ? `${payload.capital}`.split('').reduceRight((acc, char, i, {
|
|
70
70
|
length
|
|
@@ -75,18 +75,10 @@ function generateCommercialDocument(idEstimateInvoiceType, payload) {
|
|
|
75
75
|
shouldDisplayDiscountColumn: !!products.find(p => p.discount2 && p.discount2 > 0),
|
|
76
76
|
// @ts-ignore
|
|
77
77
|
marginVats: (0, _lodash.uniq)(products.filter(p => p.marginVatFormatted !== null).map(p => p.marginVatFormatted)),
|
|
78
|
-
accountingCategoryFormatted: (
|
|
78
|
+
accountingCategoryFormatted: (_s = (_r = _CommercialManagement.AccountingCategoryList.find(a => a.id === payload.accountingCategory)) === null || _r === void 0 ? void 0 : _r.label) !== null && _s !== void 0 ? _s : null
|
|
79
79
|
});
|
|
80
80
|
const commonTemplate = new _common.CommercialDocumentCommonHTML();
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
if ([_EstimateInvoice.EstimateInvoiceType.DEVIS, _EstimateInvoice.EstimateInvoiceType.BON].includes(idEstimateInvoiceType)) {
|
|
84
|
-
documentFreeText = (_p = payload === null || payload === void 0 ? void 0 : payload.settings) === null || _p === void 0 ? void 0 : _p.freeEstimateText;
|
|
85
|
-
} else {
|
|
86
|
-
documentFreeText = (_q = payload === null || payload === void 0 ? void 0 : payload.settings) === null || _q === void 0 ? void 0 : _q.freeInvoiceText;
|
|
87
|
-
} //
|
|
88
|
-
|
|
89
|
-
|
|
81
|
+
const documentFreeText = [_EstimateInvoice.EstimateInvoiceType.DEVIS, _EstimateInvoice.EstimateInvoiceType.BON].includes(idEstimateInvoiceType) ? (_t = payload === null || payload === void 0 ? void 0 : payload.settings) === null || _t === void 0 ? void 0 : _t.freeEstimateText : (_u = payload === null || payload === void 0 ? void 0 : payload.settings) === null || _u === void 0 ? void 0 : _u.freeInvoiceText;
|
|
90
82
|
return {
|
|
91
83
|
header: ejs.render(commonTemplate.header, data),
|
|
92
84
|
body: ejs.render(_body.bodyTemplate, data),
|
|
@@ -1 +1 @@
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AAH,MAAG,CAAEwF,MAAL,CAAYZ,cAAc,CAACW,MAA3B,EAAmCxE,IAAnC,CADH;IAEL0E,IAAI,EAAEzF,GAAG,SAAH,OAAG,WAAH,GAAG,MAAH,MAAG,CAAEwF,MAAL,CAAYE,kBAAZ,EAA0B3E,IAA1B,CAFD;IAGL4E,MAAM,EAAE3F,GAAG,SAAH,OAAG,WAAH,GAAG,MAAH,MAAG,CAAEwF,MAAL,CAAYZ,cAAc,CAACe,MAA3B,EAAiCnF,gCAAOO,IAAP,GAAW;MAAE6E,QAAQ,EAAE,mBAAO,SAAP,WAAO,WAAP,GAAO,MAAP,UAAO,CAAEzE,QAAT,MAAiB,IAAjB,IAAiB6B,aAAjB,GAAiB,MAAjB,GAAiBA,GAAEsC,eAAnB,MAAkC,IAAlC,IAAkCb,aAAlC,GAAkCA,EAAlC,GAAsC;IAAlD,CAAX,CAAjC,CAHH;IAIL1D;EAJK,CAAP;AAMD","names":["generateCommercialDocument","generateAdvanceDocument","dayjs","ejs","require","idEstimateInvoiceType","payload","products","map","product","vats","Object","values","v","filter","id","Vat","MARGE","data","paymentLink","_a","phoneContact","settings","_b","_c","totalTaxExcluded","totalTaxIncluded","totalTaxAndDiscountIncluded","generalDiscount2","_d","generalDiscountFormatted","depositFormatted","deposit","totalTaxExcludedFormatted","totalTaxIncludedFormatted","_e","totalTaxAndDiscountIncludedFormatted","_f","_g","totalVatAmountFormatted","font","name","find","f","idFont","_h","_j","fontList","url","_k","link","_l","capitalFormatted","capital","split","reduceRight","acc","char","i","length","trim","dueDateFormatted","dueDate","format","expirationDateFormatted","expirationDate","emissionDateFormatted","emissionDate","shouldDisplayDiscountColumn","p","discount2","marginVats","marginVatFormatted","accountingCategoryFormatted","a","accountingCategory","_m","label","_o","commonTemplate","CommercialDocumentCommonHTML","documentFreeText","EstimateInvoiceType","DEVIS","BON","includes","_p","freeEstimateText","_q","freeInvoiceText","header","render","body","bodyTemplate","footer","freeText","Error","ACOMPTE","disableVat","assetMarginVatIds","m","c"],"sourceRoot":"","sources":["../../../ts/utils/commercialManagement/document.ts"],"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 { AccountingCategoryList, fontList, VatMarginCategyList } from '../../types/Enum/CommercialManagement';\nimport { EstimateInvoiceType } from '../../types/Enum/EstimateInvoice';\nimport { Vat } from '../../types/Enum/Vat';\nimport { integerToFormattedAmountString } from '../amount';\nimport { CommercialDocumentCommonHTML } from './templates/common';\nimport { bodyTemplate } from './templates/body';\nimport { productToReadProductEditing } from './product';\nimport { vatToReadVatEditing } from './vat';\nimport { CreateInvoiceDocument, CreatePreSaleDocument } from '../../types';\n\nconst ejs = require('ejs');\n\nexport function generateCommercialDocument(idEstimateInvoiceType: EstimateInvoiceType, payload: CreateInvoiceDocument | CreatePreSaleDocument): 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\n const data: ReadDocumentEditing = {\n ...payload,\n paymentLink: payload.paymentLink ?? '#',\n idEstimateInvoiceType,\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') - (payload.generalDiscount2 ?? 0),\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') - (payload.deposit ?? 0)),\n totalTaxAndDiscountIncludedFormatted: integerToFormattedAmountString(_sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount') - (payload.generalDiscount2 ?? 0) - (payload.deposit ?? 0)),\n totalVatAmountFormatted: integerToFormattedAmountString(_sumBy(vats, 'amount')),\n font: {\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 ? `${payload.capital}`.split('').reduceRight((acc, char, i, { length }) => `${char}${(length - (i + 1)) % 3 === 0 ? ' ' : ''}${acc}`, '').trim() : 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((p) => p.discount2 && p.discount2 > 0),\n // @ts-ignore\n marginVats: _uniq(products.filter((p) => p.marginVatFormatted !== null).map((p) => p.marginVatFormatted)),\n accountingCategoryFormatted: AccountingCategoryList.find((a) => a.id === payload.accountingCategory)?.label ?? null,\n };\n\n const commonTemplate = new CommercialDocumentCommonHTML();\n\n let documentFreeText: string | null | undefined;\n\n // A GERER EN FONCTION DU DOCUMENT\n if ([EstimateInvoiceType.DEVIS, EstimateInvoiceType.BON].includes(idEstimateInvoiceType)) {\n documentFreeText = payload?.settings?.freeEstimateText;\n } else {\n documentFreeText = payload?.settings?.freeInvoiceText;\n }\n //\n\n return {\n header: ejs.render(commonTemplate.header, data),\n body: ejs.render(bodyTemplate, data),\n footer: ejs.render(commonTemplate.footer, { ...data, freeText: documentFreeText ?? null }),\n data,\n };\n}\n\nexport function generateAdvanceDocument(payload: CreateInvoiceDocument): ReadCommercialDocumentTemplate {\n if (!payload.deposit) throw new Error('Aucun acompte défini');\n\n const data: ReadDocumentEditing = {\n ...payload,\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(payload.deposit),\n totalVatAmountFormatted: integerToFormattedAmountString(0),\n font: {\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 ? `${payload.capital}`.split('').reduceRight((acc, char, i, { length }) => `${char}${(length - (i + 1)) % 3 === 0 ? ' ' : ''}${acc}`, '').trim() : 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: false,\n disableVat: true,\n // @ts-ignore\n marginVats: _uniq((payload.assetMarginVatIds ?? []).map((m) => VatMarginCategyList.find((c) => c.id === m)?.label ?? null)),\n accountingCategoryFormatted: AccountingCategoryList.find((a) => a.id === payload.accountingCategory)?.label ?? null,\n };\n\n const commonTemplate = new CommercialDocumentCommonHTML();\n\n return {\n header: ejs?.render(commonTemplate.header, data),\n body: ejs?.render(bodyTemplate, data),\n footer: ejs?.render(commonTemplate.footer, { ...data, freeText: payload?.settings?.freeInvoiceText ?? null }),\n data,\n };\n}"]}
|
|
1
|
+
{"version":3,"file":"document.js","mappings":";;;;;QAiBgBA,0B,GAAAA,0B;QA6CAC,uB,GAAAA,uB;;AA9DhB;;AAGA;;IAAYC,K;;AAEZ;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAGA,MAAMC,GAAG,GAAGC,OAAO,CAAC,KAAD,CAAnB;;AAEM,SAAUJ,0BAAV,CAAqCK,qBAArC,EAAiFC,OAAjF,EAAuI;;;EAC3I,MAAMC,QAAQ,GAAG,qBAASD,OAAO,CAACC,QAAR,CAAiBC,GAAjB,CAAsBC,OAAD,IAAa,0CAA4BA,OAA5B,CAAlC,EAAwE,SAAxE,CAAT,CAAjB;EACA,MAAMC,IAAI,GAAG,qBAASC,MAAM,CAACC,MAAP,CAAc,qBAASL,QAAT,EAAmB,cAAnB,CAAd,EAAkDC,GAAlD,CAAuDK,CAAD,IAAQ,8BAAoBA,CAApB,CAA9D,EAAuF,OAAvF,CAAT,EAA0GC,MAA1G,CAAkHD,CAAD,IAAOA,CAAC,CAACE,EAAF,KAASC,SAAIC,KAAJ,CAAUF,EAA3I,CAAb;EAEA,MAAMG,IAAI,mCACLZ,OADK,GACE;IACVa,WAAW,EAAE,aAAO,CAACA,WAAR,MAAmB,IAAnB,IAAmBC,aAAnB,GAAmBA,EAAnB,GAAuB,GAD1B;IAEVf,qBAFU;IAGVgB,YAAY,EAAE,mBAAO,CAACC,QAAR,MAAgB,IAAhB,IAAgBC,aAAhB,GAAgB,MAAhB,GAAgBA,GAAEF,YAAlB,MAA8B,IAA9B,IAA8BG,aAA9B,GAA8BA,EAA9B,GAAkC,IAHtC;IAIVjB,QAJU;IAKVG,IALU;IAMVe,gBAAgB,EAAE,mBAAOlB,QAAP,EAAiB,kBAAjB,KAAwC,aAAO,CAACmB,OAAR,MAAe,IAAf,IAAeC,aAAf,GAAeA,EAAf,GAAmB,CAA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,kBAApD,OAAuE,IAAvE,IAAuExC,aAAvE,GAAuE,MAAvE,GAAuEA,GAAE0C,KAAzE,MAA8E,IAA9E,IAA8ExC,aAA9E,GAA8EA,EAA9E,GAAkF;EA3BrG,CADF,CAAV;EA+BA,MAAM0C,cAAc,GAAG,IAAIC,oCAAJ,EAAvB;EAEA,OAAO;IACLU,MAAM,EAAE3F,GAAG,SAAH,OAAG,WAAH,GAAG,MAAH,MAAG,CAAE4F,MAAL,CAAYZ,cAAc,CAACW,MAA3B,EAAmC5E,IAAnC,CADH;IAEL8E,IAAI,EAAE7F,GAAG,SAAH,OAAG,WAAH,GAAG,MAAH,MAAG,CAAE4F,MAAL,CAAYE,kBAAZ,EAA0B/E,IAA1B,CAFD;IAGLgF,MAAM,EAAE/F,GAAG,SAAH,OAAG,WAAH,GAAG,MAAH,MAAG,CAAE4F,MAAL,CAAYZ,cAAc,CAACe,MAA3B,EAAiCvF,gCAAOO,IAAP,GAAW;MAAEiF,QAAQ,EAAE,mBAAO,SAAP,WAAO,WAAP,GAAO,MAAP,UAAO,CAAE7E,QAAT,MAAiB,IAAjB,IAAiBoB,aAAjB,GAAiB,MAAjB,GAAiBA,GAAEmD,eAAnB,MAAkC,IAAlC,IAAkC5C,aAAlC,GAAkCA,EAAlC,GAAsC;IAAlD,CAAX,CAAjC,CAHH;IAIL/B;EAJK,CAAP;AAMD","names":["generateCommercialDocument","generateAdvanceDocument","dayjs","ejs","require","idEstimateInvoiceType","payload","products","map","product","vats","Object","values","v","filter","id","Vat","MARGE","data","paymentLink","_a","phoneContact","settings","_b","_c","totalTaxExcluded","deposit","_d","totalTaxIncluded","_e","totalTaxAndDiscountIncluded","generalDiscount2","_f","_g","generalDiscountFormatted","depositFormatted","totalTaxExcludedFormatted","_h","totalTaxIncludedFormatted","_j","totalTaxAndDiscountIncludedFormatted","_k","_l","totalVatAmountFormatted","font","name","find","f","idFont","_m","_o","fontList","url","_p","link","_q","capitalFormatted","capital","split","reduceRight","acc","char","i","length","trim","dueDateFormatted","dueDate","format","expirationDateFormatted","expirationDate","emissionDateFormatted","emissionDate","shouldDisplayDiscountColumn","p","discount2","marginVats","marginVatFormatted","accountingCategoryFormatted","a","accountingCategory","_r","label","_s","commonTemplate","CommercialDocumentCommonHTML","documentFreeText","EstimateInvoiceType","DEVIS","BON","includes","_t","freeEstimateText","_u","freeInvoiceText","header","render","body","bodyTemplate","footer","freeText","Error","ACOMPTE","disableVat","assetMarginVatIds","m","c"],"sourceRoot":"","sources":["../../../ts/utils/commercialManagement/document.ts"],"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 { AccountingCategoryList, fontList, VatMarginCategyList } from '../../types/Enum/CommercialManagement';\nimport { EstimateInvoiceType } from '../../types/Enum/EstimateInvoice';\nimport { Vat } from '../../types/Enum/Vat';\nimport { integerToFormattedAmountString } from '../amount';\nimport { CommercialDocumentCommonHTML } from './templates/common';\nimport { bodyTemplate } from './templates/body';\nimport { productToReadProductEditing } from './product';\nimport { vatToReadVatEditing } from './vat';\nimport { CreateInvoiceDocument, CreatePreSaleDocument } from '../../types';\n\nconst ejs = require('ejs');\n\nexport function generateCommercialDocument(idEstimateInvoiceType: EstimateInvoiceType, payload: CreateInvoiceDocument | CreatePreSaleDocument): 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\n const data: ReadDocumentEditing = {\n ...payload,\n paymentLink: payload.paymentLink ?? '#',\n idEstimateInvoiceType,\n phoneContact: payload.settings?.phoneContact ?? null,\n products,\n vats,\n totalTaxExcluded: _sumBy(products, 'totalTaxExcluded') - (payload.deposit ?? 0),\n totalTaxIncluded: _sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount') - (payload.deposit ?? 0),\n totalTaxAndDiscountIncluded: _sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount') - (payload.generalDiscount2 ?? 0) - (payload.deposit ?? 0),\n generalDiscountFormatted: payload.generalDiscount2 ? integerToFormattedAmountString(payload.generalDiscount2) : null,\n depositFormatted: payload.deposit ? integerToFormattedAmountString(payload.deposit) : null,\n totalTaxExcludedFormatted: integerToFormattedAmountString(_sumBy(products, 'totalTaxExcluded') - (payload.deposit ?? 0)),\n totalTaxIncludedFormatted: integerToFormattedAmountString(_sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount') - (payload.deposit ?? 0)),\n totalTaxAndDiscountIncludedFormatted: integerToFormattedAmountString(_sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount') - (payload.generalDiscount2 ?? 0) - (payload.deposit ?? 0)),\n totalVatAmountFormatted: integerToFormattedAmountString(_sumBy(vats, 'amount')),\n font: {\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 ? `${payload.capital}`.split('').reduceRight((acc, char, i, { length }) => `${char}${(length - (i + 1)) % 3 === 0 ? ' ' : ''}${acc}`, '').trim() : 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((p) => p.discount2 && p.discount2 > 0),\n // @ts-ignore\n marginVats: _uniq(products.filter((p) => p.marginVatFormatted !== null).map((p) => p.marginVatFormatted)),\n accountingCategoryFormatted: AccountingCategoryList.find((a) => a.id === payload.accountingCategory)?.label ?? null,\n };\n\n const commonTemplate = new CommercialDocumentCommonHTML();\n const documentFreeText = [EstimateInvoiceType.DEVIS, EstimateInvoiceType.BON].includes(idEstimateInvoiceType) ? payload?.settings?.freeEstimateText : payload?.settings?.freeInvoiceText;\n\n return {\n header: ejs.render(commonTemplate.header, data),\n body: ejs.render(bodyTemplate, data),\n footer: ejs.render(commonTemplate.footer, { ...data, freeText: documentFreeText ?? null }),\n data,\n };\n}\n\nexport function generateAdvanceDocument(payload: CreateInvoiceDocument): ReadCommercialDocumentTemplate {\n if (!payload.deposit) throw new Error('Aucun acompte défini');\n\n const data: ReadDocumentEditing = {\n ...payload,\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(payload.deposit),\n totalVatAmountFormatted: integerToFormattedAmountString(0),\n font: {\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 ? `${payload.capital}`.split('').reduceRight((acc, char, i, { length }) => `${char}${(length - (i + 1)) % 3 === 0 ? ' ' : ''}${acc}`, '').trim() : 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: false,\n disableVat: true,\n // @ts-ignore\n marginVats: _uniq((payload.assetMarginVatIds ?? []).map((m) => VatMarginCategyList.find((c) => c.id === m)?.label ?? null)),\n accountingCategoryFormatted: AccountingCategoryList.find((a) => a.id === payload.accountingCategory)?.label ?? null,\n };\n\n const commonTemplate = new CommercialDocumentCommonHTML();\n\n return {\n header: ejs?.render(commonTemplate.header, data),\n body: ejs?.render(bodyTemplate, data),\n footer: ejs?.render(commonTemplate.footer, { ...data, freeText: payload?.settings?.freeInvoiceText ?? null }),\n data,\n };\n}"]}
|
|
@@ -34,10 +34,10 @@ function getDiscount(product) {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
function getTotalTaxExcluded(product) {
|
|
37
|
-
var _a, _b
|
|
37
|
+
var _a, _b;
|
|
38
38
|
|
|
39
39
|
const discount = product.discount2 && product.discount2 > 0 ? getDiscount(product) : 0;
|
|
40
|
-
return ((_a = product.priceTaxExcluded) !== null && _a !== void 0 ? _a : 0)
|
|
40
|
+
return (((_a = product.priceTaxExcluded) !== null && _a !== void 0 ? _a : 0) - discount) * ((_b = product.quantity) !== null && _b !== void 0 ? _b : 1);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
function productToReadProductEditing(payload) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product.js","mappings":";;;;;QAOgBA,W,GAAAA,W;QAYAC,mB,GAAAA,mB;QAKAC,2B,GAAAA,2B;;AAxBhB;;AAEA;;AACA;;AACA;;AACA;;AAEM,SAAUF,WAAV,CAAsBG,OAAtB,EAA8C;;;EAClD,IAAIA,OAAO,CAACC,SAAR,KAAsB,IAAtB,IAA8BD,OAAO,CAACC,SAAR,KAAsBC,SAApD,IAAiEF,OAAO,CAACC,SAAR,IAAqB,CAA1F,EAA6F,OAAO,CAAP;;EAE7F,IAAID,OAAO,CAACG,YAAR,KAAyBC,mCAAaC,OAA1C,EAAmD;IACjD,OAAQ,CAAC,aAAO,CAACC,gBAAR,MAAwB,IAAxB,IAA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O,OAAO,CAACP,gBAAvC,CAAtC,GAAiG,IAJlH;IAKVqB,yBAAyB,EAAE,+BAAUd,OAAO,CAACP,gBAAlB,IAAsC,4CAA+BR,mBAAmB,CAACe,OAAD,CAAlD,CAAtC,GAAqG,IALtH;IAMVe,iBAAiB,EAAEf,OAAO,CAACZ,SAAR,IAAqBY,OAAO,CAACZ,SAAR,GAAoB,CAAzC,GAA6C,4CAA+BJ,WAAW,CAACgB,OAAD,CAA1C,CAA7C,GAAoG,IAN7G;IAOVgB,qBAAqB,EAAEhB,OAAO,CAACZ,SAAR,IAAqBY,OAAO,CAACZ,SAAR,GAAoB,CAAzC,GAA6CY,OAAO,CAACV,YAAR,KAAyBC,mCAAaC,OAAtC,GAAgD,GAAG,CAACQ,OAAO,CAACZ,SAAR,GAAoB,GAArB,EAA0B6B,OAA1B,CAAkC,CAAlC,CAAoC,GAAvF,GAA6F,GAAG,4CAA+BjB,OAAO,CAACZ,SAAvC,CAAiD,GAA9L,GAAoM,IAPjN;IAQV8B,kBAAkB,EAAElB,OAAO,CAACmB,aAAR,GAAwB,sDAAoBd,IAApB,CAA0Be,CAAD,IAAOA,CAAC,CAACb,EAAF,KAASP,OAAO,CAACmB,aAAjD,OAA+D,IAA/D,IAA+DE,aAA/D,GAA+D,MAA/D,GAA+DA,GAAEC,KAAjE,MAAsE,IAAtE,IAAsEC,aAAtE,GAAsEA,EAAtE,GAA0E,IAAlG,GAAyG;EARnH,CADZ;AAWD","names":["getDiscount","getTotalTaxExcluded","productToReadProductEditing","product","discount2","undefined","discountType","DiscountType","PERCENT","priceTaxExcluded","_a","_b","AMOUNT","_c","discount","quantity","payload","totalTaxExcluded","unitFormatted","values","Unit","find","unit","id","shortName","vatFormatted","idVat","saleName","_d","priceTaxExcludedFormatted","totalTaxExcludedFormatted","discountFormatted","discountTypeFormatted","toFixed","marginVatFormatted","marginVatType","c","_e","label","_f"],"sourceRoot":"","sources":["../../../ts/utils/commercialManagement/product.ts"],"sourcesContent":["import { isDefined } from 'class-validator';\nimport { IProductInvoice, ReadProductEditing } from '../../types';\nimport { Unit } from '../../types/Enum/Unit';\nimport { DiscountType, VatMarginCategyList } from '../../types/Enum/CommercialManagement';\nimport { getById } from './vat';\nimport { integerToFormattedAmountString } from '../amount';\n\nexport function getDiscount(product: IProductInvoice): number {\n if (product.discount2 === null || product.discount2 === undefined || product.discount2 <= 0) return 0;\n\n if (product.discountType === DiscountType.PERCENT) {\n return ((product.priceTaxExcluded ?? 0) * ((product.discount2 ?? 0) / 100)) / 100;\n } if (product.discountType === DiscountType.AMOUNT) {\n return (product.discount2 ?? 0);\n }\n\n return 0;\n}\n\nexport function getTotalTaxExcluded(product: IProductInvoice): number {\n const discount = product.discount2 && product.discount2 > 0 ? getDiscount(product) : 0;\n return ((product.priceTaxExcluded ?? 0) - discount) * (product.quantity ?? 1);\n}\n\nexport function productToReadProductEditing(payload: IProductInvoice): ReadProductEditing {\n return {\n ...payload,\n totalTaxExcluded: getTotalTaxExcluded(payload),\n unitFormatted: Object.values(Unit).find((unit) => unit.id === payload.unit)?.shortName ?? '',\n vatFormatted: getById(payload.idVat)?.saleName ?? '',\n priceTaxExcludedFormatted: isDefined(payload.priceTaxExcluded) ? integerToFormattedAmountString(payload.priceTaxExcluded) : null,\n totalTaxExcludedFormatted: isDefined(payload.priceTaxExcluded) ? integerToFormattedAmountString(getTotalTaxExcluded(payload)) : null,\n discountFormatted: payload.discount2 && payload.discount2 > 0 ? integerToFormattedAmountString(getDiscount(payload)) : null,\n discountTypeFormatted: payload.discount2 && payload.discount2 > 0 ? payload.discountType === DiscountType.PERCENT ? `${(payload.discount2 / 100).toFixed(2)}%` : `${integerToFormattedAmountString(payload.discount2)}€` : null,\n marginVatFormatted: payload.marginVatType ? VatMarginCategyList.find((c) => c.id === payload.marginVatType)?.label ?? null : null,\n };\n}"]}
|
|
@@ -33,7 +33,7 @@ function getAllRecurrences(params) {
|
|
|
33
33
|
let loop = 0;
|
|
34
34
|
let recurrency = 'month';
|
|
35
35
|
if (type === _RecurrenceType.RecurrenceType.MONHLY) recurrency = 'month'; // @ts-ignore
|
|
36
|
-
else if (type === _RecurrenceType.RecurrenceType.
|
|
36
|
+
else if (type === _RecurrenceType.RecurrenceType.QUARTERLY) recurrency = 'quarter';else if (type === _RecurrenceType.RecurrenceType.WEEKLY) recurrency = 'week';else if (type === _RecurrenceType.RecurrenceType.YEARLY) recurrency = 'year';
|
|
37
37
|
const nextInvoices = []; // @ts-ignore
|
|
38
38
|
|
|
39
39
|
while (dayjs(startDate).add(loop, recurrency).isSameOrBefore(endDate)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recurrence.js","mappings":";;;;;QAUgBA,iB,GAAAA,iB;;AAVhB;;IAAYC,K;;AAEZ;;;;;;AAEA,MAAMC,cAAc,GAAGC,OAAO,CAAC,6BAAD,CAA9B;;AACA,MAAMC,aAAa,GAAGD,OAAO,CAAC,4BAAD,CAA7B;;AAEAF,KAAK,CAACI,MAAN,CAAaD,aAAb;AACAH,KAAK,CAACI,MAAN,CAAaH,cAAb;;AAEM,SAAUF,iBAAV,CAA4BM,MAA5B,EAIL;;;EACC,MAAM;IAAEC,SAAF;IAAaC;EAAb,IAAsBF,MAA5B;EACA,MAAMG,OAAO,GAAG,YAAM,CAACA,OAAP,MAAc,IAAd,IAAcC,aAAd,GAAcA,EAAd,GAAkB,YAAlC;EAEA,IAAIC,IAAI,GAAG,CAAX;EAEA,IAAIC,UAAU,GAAe,OAA7B;EAEA,IAAIJ,IAAI,KAAKK,+BAAeC,MAA5B,EAAoCF,UAAU,GAAG,OAAb,CAApC,CACA;EADA,KAEK,IAAIJ,IAAI,KAAKK,+BAAeE,
|
|
1
|
+
{"version":3,"file":"recurrence.js","mappings":";;;;;QAUgBA,iB,GAAAA,iB;;AAVhB;;IAAYC,K;;AAEZ;;;;;;AAEA,MAAMC,cAAc,GAAGC,OAAO,CAAC,6BAAD,CAA9B;;AACA,MAAMC,aAAa,GAAGD,OAAO,CAAC,4BAAD,CAA7B;;AAEAF,KAAK,CAACI,MAAN,CAAaD,aAAb;AACAH,KAAK,CAACI,MAAN,CAAaH,cAAb;;AAEM,SAAUF,iBAAV,CAA4BM,MAA5B,EAIL;;;EACC,MAAM;IAAEC,SAAF;IAAaC;EAAb,IAAsBF,MAA5B;EACA,MAAMG,OAAO,GAAG,YAAM,CAACA,OAAP,MAAc,IAAd,IAAcC,aAAd,GAAcA,EAAd,GAAkB,YAAlC;EAEA,IAAIC,IAAI,GAAG,CAAX;EAEA,IAAIC,UAAU,GAAe,OAA7B;EAEA,IAAIJ,IAAI,KAAKK,+BAAeC,MAA5B,EAAoCF,UAAU,GAAG,OAAb,CAApC,CACA;EADA,KAEK,IAAIJ,IAAI,KAAKK,+BAAeE,SAA5B,EAAuCH,UAAU,GAAG,SAAb,CAAvC,KACA,IAAIJ,IAAI,KAAKK,+BAAeG,MAA5B,EAAoCJ,UAAU,GAAG,MAAb,CAApC,KACA,IAAIJ,IAAI,KAAKK,+BAAeI,MAA5B,EAAoCL,UAAU,GAAG,MAAb;EAEzC,MAAMM,YAAY,GAAa,EAA/B,CAdD,CAgBC;;EACA,OAAOjB,KAAK,CAACM,SAAD,CAAL,CAAiBY,GAAjB,CAAqBR,IAArB,EAA2BC,UAA3B,EAAuCV,cAAvC,CAAsDO,OAAtD,CAAP,EAAuE;IACrE,MAAMW,WAAW,GAAGnB,KAAK,CAACM,SAAD,CAAL,CAAiBY,GAAjB,CAAqBR,IAArB,EAA2BC,UAA3B,CAApB;IACAM,YAAY,CAACG,IAAb,CAAkBD,WAAW,CAACE,MAAZ,CAAmB,YAAnB,CAAlB;IACAX,IAAI,IAAI,CAAR;EACD;;EAED,OAAOO,YAAP;AACD","names":["getAllRecurrences","dayjs","isSameOrBefore","require","quarterOfYear","extend","params","startDate","type","endDate","_a","loop","recurrency","RecurrenceType","MONHLY","QUARTERLY","WEEKLY","YEARLY","nextInvoices","add","currentDate","push","format"],"sourceRoot":"","sources":["../../../ts/utils/commercialManagement/recurrence.ts"],"sourcesContent":["import * as dayjs from 'dayjs';\nimport { OpUnitType } from 'dayjs';\nimport { RecurrenceType } from '../../types/Enum/RecurrenceType';\n\nconst isSameOrBefore = require('dayjs/plugin/isSameOrBefore');\nconst quarterOfYear = require('dayjs/plugin/quarterOfYear');\n\ndayjs.extend(quarterOfYear);\ndayjs.extend(isSameOrBefore);\n\nexport function getAllRecurrences(params: {\n startDate: string;\n endDate: string | null;\n type: RecurrenceType;\n}): string[] {\n const { startDate, type } = params;\n const endDate = params.endDate ?? '2100-01-01';\n\n let loop = 0;\n\n let recurrency: OpUnitType = 'month';\n\n if (type === RecurrenceType.MONHLY) recurrency = 'month';\n // @ts-ignore\n else if (type === RecurrenceType.QUARTERLY) recurrency = 'quarter';\n else if (type === RecurrenceType.WEEKLY) recurrency = 'week';\n else if (type === RecurrenceType.YEARLY) recurrency = 'year';\n\n const nextInvoices: string[] = [];\n\n // @ts-ignore\n while (dayjs(startDate).add(loop, recurrency).isSameOrBefore(endDate)) {\n const currentDate = dayjs(startDate).add(loop, recurrency);\n nextInvoices.push(currentDate.format('YYYY-MM-DD'));\n loop += 1;\n }\n\n return nextInvoices;\n}"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@silexpert/core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.39",
|
|
4
4
|
"description": "Silex Core perform HTTP Request and object binding. Silex core helps developers to retrieve and return formatted object",
|
|
5
5
|
"homepage": "https://gitlab.compta-clementine.fr/dev/silex-api",
|
|
6
6
|
"main": "js/index.js",
|
|
@@ -53,7 +53,7 @@ export class CommercialDocument extends Resource {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
preview(idEstimateInvoiceType: EstimateInvoiceType, payload: CreatePreSaleDocument | CreateInvoiceDocument): Promise<IFile> {
|
|
56
|
-
return this.axios.$post('/commercial-management/preview
|
|
56
|
+
return this.axios.$post('/commercial-management/preview', { ...payload, idEstimateInvoiceType });
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
getFormValues(id: number): Promise<CreatePreSaleDocument> {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export enum RecurrenceType {
|
|
2
2
|
WEEKLY = 1,
|
|
3
3
|
MONHLY = 2,
|
|
4
|
-
|
|
4
|
+
QUARTERLY = 3,
|
|
5
5
|
YEARLY = 4,
|
|
6
6
|
}
|
|
7
7
|
|
|
@@ -15,7 +15,7 @@ export const RecurrenceList: Array<{ id: RecurrenceType, label: string; }> = [
|
|
|
15
15
|
label: 'Mensuelle',
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
|
-
id: RecurrenceType.
|
|
18
|
+
id: RecurrenceType.QUARTERLY,
|
|
19
19
|
label: 'Trimestrielle',
|
|
20
20
|
},
|
|
21
21
|
{
|