@silexpert/core 1.3.61 → 1.3.62

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/cjs/types/Enum/BrandClementine.js +1 -1
  2. package/dist/cjs/types/Enum/BrandClementine.js.map +1 -1
  3. package/dist/cjs/types/Interface/api/calendarEvent/calendarEventIcs.d.ts +13 -0
  4. package/dist/cjs/types/Interface/api/calendarEvent/calendarEventIcs.d.ts.map +1 -0
  5. package/dist/cjs/types/Interface/api/calendarEvent/calendarEventIcs.js +3 -0
  6. package/dist/cjs/types/Interface/api/calendarEvent/calendarEventIcs.js.map +1 -0
  7. package/dist/cjs/types/Interface/api/mail/CreateMailParams.d.ts +1 -0
  8. package/dist/cjs/types/Interface/api/mail/CreateMailParams.d.ts.map +1 -1
  9. package/dist/cjs/types/Interface/api/mail/CreateMailParams.js.map +1 -1
  10. package/dist/cjs/types/index.d.ts +1 -0
  11. package/dist/cjs/types/index.d.ts.map +1 -1
  12. package/dist/cjs/types/index.js +1 -0
  13. package/dist/cjs/types/index.js.map +1 -1
  14. package/dist/cjs/utils/prestation.d.ts +1 -1
  15. package/dist/cjs/utils/prestation.d.ts.map +1 -1
  16. package/dist/cjs/utils/prestation.js +13 -3
  17. package/dist/cjs/utils/prestation.js.map +1 -1
  18. package/dist/mjs/types/Enum/BrandClementine.js +1 -1
  19. package/dist/mjs/types/Enum/BrandClementine.js.map +1 -1
  20. package/dist/mjs/types/Interface/api/calendarEvent/calendarEventIcs.d.ts +13 -0
  21. package/dist/mjs/types/Interface/api/calendarEvent/calendarEventIcs.d.ts.map +1 -0
  22. package/dist/mjs/types/Interface/api/calendarEvent/calendarEventIcs.js +2 -0
  23. package/dist/mjs/types/Interface/api/calendarEvent/calendarEventIcs.js.map +1 -0
  24. package/dist/mjs/types/Interface/api/mail/CreateMailParams.d.ts +1 -0
  25. package/dist/mjs/types/Interface/api/mail/CreateMailParams.d.ts.map +1 -1
  26. package/dist/mjs/types/Interface/api/mail/CreateMailParams.js.map +1 -1
  27. package/dist/mjs/types/index.d.ts +1 -0
  28. package/dist/mjs/types/index.d.ts.map +1 -1
  29. package/dist/mjs/types/index.js +1 -0
  30. package/dist/mjs/types/index.js.map +1 -1
  31. package/dist/mjs/utils/prestation.d.ts +1 -1
  32. package/dist/mjs/utils/prestation.d.ts.map +1 -1
  33. package/dist/mjs/utils/prestation.js +12 -2
  34. package/dist/mjs/utils/prestation.js.map +1 -1
  35. package/package.json +1 -1
  36. package/ts/types/Enum/BrandClementine.ts +1 -1
  37. package/ts/types/Interface/api/calendarEvent/calendarEventIcs.ts +12 -0
  38. package/ts/types/Interface/api/mail/CreateMailParams.ts +1 -0
  39. package/ts/types/index.ts +1 -0
  40. package/ts/utils/prestation.ts +21 -2
@@ -48,8 +48,11 @@ const isExpress = (idPrestationList) => {
48
48
  const isConsultingHour = (idPrestationList) => !!intersection(idPrestationList, [PrestationType.CONSULTING_HOUR]).length;
49
49
  const isSoftwarePrestation = (idPrestationList) => !!intersection(idPrestationList, [PrestationType.STEERING, PrestationType.VAT, PrestationType.BALANCESHEET]).length &&
50
50
  idPrestationList.length === 1;
51
- const calculateScoringOfPrestation = (idPrestationType, prestations) => {
52
- const prestationsSignedPaid = prestations.filter((prestation) => prestation.paid && prestation.signed && prestation.terminationList === null);
51
+ const calculateScoringOfPrestation = (idPrestationType, prestations, currentIdPrestation) => {
52
+ const prestationsSignedPaid = prestations.filter((prestation) => prestation.paid &&
53
+ prestation.signed &&
54
+ prestation.terminationList === null &&
55
+ prestation.id !== currentIdPrestation);
53
56
  const currentPrestation = prestations.find((el) => el.idPrestationList === idPrestationType && el.terminationList === null);
54
57
  // Get the list of prestations that are half price
55
58
  const prestationHalfPriceList = Object.values(PrestationDetail).filter((p) => p.isComptable &&
@@ -67,6 +70,13 @@ const calculateScoringOfPrestation = (idPrestationType, prestations) => {
67
70
  currentPrestation?.exercices[0].ExercicePrestation?.totalPrestation < 80) {
68
71
  numberPoint = 0;
69
72
  }
73
+ if (
74
+ // If software prestation and annual payment then return 0 points
75
+ [PrestationType.EXPERTISE, PrestationType.SUPPORT, PrestationType.PREMIUM, PrestationType.CUSTOM_MADE].includes(idPrestationType) &&
76
+ currentPrestation?.exercices?.length &&
77
+ currentPrestation?.exercices.find((el) => el.isBack)) {
78
+ numberPoint += 100;
79
+ }
70
80
  // Get list of prestations that are already done and check if one of them is in the list of prestations that are half price
71
81
  const prestationsExistIds = prestationsSignedPaid.map((prestation) => prestation.idPrestationList);
72
82
  const prestationHalfPriceAlreadyDoneIds = prestationsExistIds.filter((id) => prestationHalfPriceIds.includes(id));
@@ -1 +1 @@
1
- {"version":3,"file":"prestation.js","sourceRoot":"","sources":["../../../ts/utils/prestation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EACL,oDAAoD,EACpD,gBAAgB,EAChB,cAAc,GACf,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAwB,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AACxF,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AA4E5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AAoB,EACpB,SAAS,EACT,gBAAgB,EAChB,oBAAoB,EACpB,4BAA4B,EAC5B,wBAAwB,EACxB,oBAAoB,EACpB,mBAAmB,EACnB,qCAAqC,EACrC,wBAAwB,EACxB,2BAA2B,GAC5B,CAAC","sourcesContent":["import { IExercice, IPrestation, IPrestationList } from '../types';\nimport { Vat } from '../types/Enum/Vat';\nimport { getTaxesIncludedAmount } from './vat/utils';\nimport { intersection } from './noLodash';\nimport {\n ClementineSubscriptionAccountancySoftwarePrestations,\n PrestationDetail,\n PrestationType,\n} from '../types/Enum/PrestationType';\nimport { LegalFormTypeEnum } from '../types/Enum/LegalForm';\nimport { PrestationOptionType, PrestationOption } from '../types/Enum/PrestationOption';\nimport { PriceGridClementine } from '../types/Enum/PriceGridClementine';\nimport { PriceGridPourcentage } from '../types/Enum/PriceGridPourcentage';\nimport { PriceGridLegalstart } from '../types/Enum/PriceGridLegalstart';\nimport { PriceGridStatutsExpress } from '../types/Enum/PriceGridStatutsExpress';\nimport { ClosingType } from '../types/Enum/ClosingType';\nimport { getBrandNameByNodeEnv } from './brands';\nimport * as dayjs from 'dayjs';\nimport { exerciceNumber } from './exercice';\n\ntype priceGridBrand = {\n idTypeBrand: number;\n price: priceGrid[];\n};\n\ntype priceGrid = {\n idPrestationList: number[];\n priceWithTaxesIncluded: boolean;\n applicationCost: number;\n monthlyNbr?: monthlyNbr[];\n exerciceNbr?: exerciceNbr[];\n turnoverCreatedYear?: turnover[];\n turnoverPastYear?: turnover[];\n turnoverMonthly?: turnover[];\n turnoverYearly?: turnover[];\n employee?: employee[];\n partner?: employee[];\n properties?: propertie[];\n vatRegimeMonthly?: vatRegime[];\n vatRegimeYearly?: vatRegime[];\n taxSystem?: taxSystem[];\n legalForm?: legalForm[];\n employeeByLegalForm?: employeeByLegalForm[];\n};\n\ntype monthlyNbr = {\n minimum: number;\n maximum: number;\n value: number;\n closingType: number[];\n};\n\ntype exerciceNbr = {\n minimum: number;\n maximum: number;\n price: number;\n};\n\ntype turnover = {\n turnoverValue: number;\n price: number;\n};\n\ntype legalForm = {\n idLegalForm: number;\n price: number;\n};\n\ntype employee = {\n amountMinimum: number;\n amountMaximum: number;\n price: number;\n};\n\ntype employeeByLegalForm = {\n idLegalForm: number;\n price: number;\n};\n\ntype propertie = {\n amount: number;\n price: number;\n};\n\ntype vatRegime = {\n type: number;\n price: number;\n};\n\ntype taxSystem = {\n id: number;\n price: number;\n};\n\nconst isOtherAccountingMissions = (idPrestationList: number): boolean =>\n [\n PrestationType.PREVISIONNEL,\n PrestationType.BILAN_INTERMEDIAIRE,\n PrestationType.AVANCE_OU_ABANDON_COMPTE_COURANT_ASSOCIE,\n PrestationType.AUTRE_MISSION_COMPTABLE,\n PrestationType.TVS,\n PrestationType.ETUDE_FISCALE,\n PrestationType.BILAN_PREVISIONNEL,\n ].includes(idPrestationList);\n\nconst isOtherJuridicalMissions = (isJuridique: boolean, isCatalog: boolean, idPrestationList: number): boolean =>\n idPrestationList !== PrestationType.GESTION_JURIDIQUE && isCatalog && isJuridique;\n\nconst isOtherSocialMission = (idPrestationList: number): boolean =>\n idPrestationList === PrestationType.AUTRE_MISSION_SOCIALE_HORS_PAIE;\n\nconst isAdditionalPresta = (hidden: boolean, isCatalog: boolean): boolean => !hidden && isCatalog;\n\nconst isOnlyPrevi = (idPrestationList: number[]): boolean =>\n !idPrestationList.filter(\n (idPL: number) =>\n ![PrestationType.PREVISIONNEL, PrestationType.BILAN_PREVISIONNEL, PrestationType.PV_AG].includes(idPL),\n ).length;\n\nconst isOnlySocial = (idPrestationList: number[]): boolean =>\n !idPrestationList.filter((idPL: number) => ![PrestationType.FRUCTUPAIE, PrestationType.SOCIAL].includes(idPL)).length;\n\nconst isOnlyJuridic = (idPrestationList: number[]): boolean =>\n !idPrestationList.filter((idPL: number) => ![PrestationType.GESTION_JURIDIQUE].includes(idPL)).length;\n\nconst isCreation = (idPrestationList: number[]): boolean =>\n !!intersection(idPrestationList, [\n PrestationType.CREATION_SOCIETE,\n PrestationType.STATUTS_FREE,\n PrestationType.STATUTS_OPTION_1,\n PrestationType.STATUTS_OPTION_2,\n PrestationType.STATUTS_OPTION_AE,\n ]).length;\n\nconst isFromStatutsExpress = (idPrestationList: number[]): boolean =>\n !idPrestationList.filter(\n (idPL: number) =>\n ![\n PrestationType.STATUTS_FREE,\n PrestationType.STATUTS_OPTION_1,\n PrestationType.STATUTS_OPTION_2,\n PrestationType.STATUTS_OPTION_AE,\n ].includes(idPL),\n ).length;\n\nconst isExpress = (idPrestationList: number): boolean => {\n const prestationDetailValues = Object.values(PrestationDetail) as any;\n const prestaList = prestationDetailValues.find((pr: any) => pr.id === idPrestationList);\n return !!prestaList.isBack;\n};\n\nconst isConsultingHour = (idPrestationList: number[]): boolean =>\n !!intersection(idPrestationList, [PrestationType.CONSULTING_HOUR]).length;\n\nconst isSoftwarePrestation = (idPrestationList: number[]): boolean =>\n !!intersection(idPrestationList, [PrestationType.STEERING, PrestationType.VAT, PrestationType.BALANCESHEET]).length &&\n idPrestationList.length === 1;\n\nconst calculateScoringOfPrestation = (idPrestationType: PrestationType, prestations: IPrestation[]): number => {\n const prestationsSignedPaid = prestations.filter(\n (prestation) => prestation.paid && prestation.signed && prestation.terminationList === null,\n );\n\n const currentPrestation = prestations.find(\n (el) => el.idPrestationList === idPrestationType && el.terminationList === null,\n );\n\n // Get the list of prestations that are half price\n const prestationHalfPriceList = Object.values(PrestationDetail).filter(\n (p) =>\n p.isComptable &&\n !p.isCatalog &&\n p.id &&\n ![PrestationType.BALANCESHEET, PrestationType.VAT, PrestationType.STEERING].includes(p.id),\n );\n const prestationHalfPriceIds = prestationHalfPriceList.map((t) => t.id);\n\n // Get the number of points for the new prestation\n const prestaDetails = Object.values(PrestationDetail).find((prestaDetail) => prestaDetail.id === idPrestationType);\n let numberPoint = prestaDetails?.point || 0;\n\n // If software prestation and annual payment then return 0 points\n if (\n [PrestationType.BALANCESHEET, PrestationType.VAT, PrestationType.STEERING].includes(idPrestationType) &&\n currentPrestation?.exercices?.length &&\n //@ts-expect-error\n currentPrestation?.exercices[0].ExercicePrestation?.totalPrestation < 80\n ) {\n numberPoint = 0;\n }\n\n // Get list of prestations that are already done and check if one of them is in the list of prestations that are half price\n const prestationsExistIds = prestationsSignedPaid.map((prestation) => prestation.idPrestationList);\n const prestationHalfPriceAlreadyDoneIds = prestationsExistIds.filter((id) => prestationHalfPriceIds.includes(id));\n\n // If one of the prestations already done is in the list of prestations that are half price and if the idPrestationType is in prestationHalfPriceIds, return 50% of points\n if (prestationHalfPriceAlreadyDoneIds.length && prestationHalfPriceIds.includes(idPrestationType))\n return Math.floor(numberPoint * 0.3);\n\n return numberPoint;\n};\n\nexport const calculateMonthlyAmount = (params: {\n monthlyPrice: number;\n monthNumber: number;\n monthOffer: number;\n idVatForInternalInvoicing?: number | null;\n returnTaxesIncludedValue?: boolean;\n}): number => {\n const { monthlyPrice, monthNumber, monthOffer, idVatForInternalInvoicing, returnTaxesIncludedValue = true } = params;\n\n if (!idVatForInternalInvoicing && returnTaxesIncludedValue)\n throw new Error('Taux de TVA manquant pour calculer le montant TTC');\n\n if (!idVatForInternalInvoicing || !returnTaxesIncludedValue) return monthlyPrice * (monthNumber - monthOffer);\n\n return (\n monthlyPrice *\n (monthNumber - monthOffer) *\n (1 + Object.values(Vat).find((el) => el.id === idVatForInternalInvoicing).value / 100)\n );\n};\n\nexport const getPriceGrid = (idTypeBrand: number, idPrestationList: number): priceGrid | undefined => {\n let currentBrandPriceGrid: priceGridBrand | undefined;\n let currentPriceGrid: priceGrid | undefined;\n\n const currentEnvName = getBrandNameByNodeEnv(process.env.NODE_ENV);\n const listEnvEnum = {\n PriceGridClementine,\n PriceGridPourcentage,\n PriceGridLegalstart,\n PriceGridStatutsExpress,\n };\n // @ts-ignore\n const currentPriceGridFile: priceGridBrand[] = listEnvEnum[`PriceGrid${currentEnvName}`];\n if (currentPriceGridFile)\n currentBrandPriceGrid = currentPriceGridFile.find(\n (priceGrid: priceGridBrand) => priceGrid.idTypeBrand === idTypeBrand,\n );\n if (currentBrandPriceGrid)\n currentPriceGrid = currentBrandPriceGrid?.price.find((price: priceGrid) =>\n price.idPrestationList.includes(idPrestationList),\n );\n return currentPriceGrid;\n};\n\nconst calculatePrestationPriceWithPriceGrid = (\n idPrestationList: number,\n endDate: string,\n NbrMonth: number /* Nbr de mois dans l'exercice */,\n turnover: number,\n rentsNumber: number,\n employeesNumber: number,\n associatesNumber: number,\n idTypeBrand: number,\n idVatRegime: number,\n pastBalanceSheet: boolean,\n isYearly: boolean /* Prestation annuel ou mensuel */,\n totalMonth: number /* Nbr de moiis offer */,\n idTaxSystem: number,\n idLegalForm: number,\n exerciceNbr: number,\n balanceSheetOffered: number = 0 /* montant du bilan offer */,\n): {\n totalPrestation: number;\n reduceMonth: number;\n canBeCreated: boolean;\n monthNbr: number;\n price: number;\n} => {\n let totalPrestation: number = 0;\n let reduceMonth: number = 0;\n let monthNbr: number = NbrMonth;\n let yearlyPrice: number | undefined;\n let finalMonthlyPrice: number | undefined;\n let canBeCreated: boolean = true;\n let recalculateMonthly: boolean = false;\n\n /* Récupération de la grille tarifaire */\n const currentPriceGrid: priceGrid | undefined = getPriceGrid(idTypeBrand, idPrestationList);\n\n if (currentPriceGrid) {\n let monthlyPrice: number | undefined;\n let vatRegimePrice: number | undefined;\n let taxSystemPrice: number | undefined;\n\n /* Gestion du régime de TVA */\n if (currentPriceGrid.vatRegimeMonthly && !isYearly)\n vatRegimePrice = currentPriceGrid.vatRegimeMonthly?.find((regime) => regime.type === idVatRegime)?.price;\n else if (currentPriceGrid.vatRegimeYearly && isYearly)\n vatRegimePrice = currentPriceGrid.vatRegimeYearly?.find((regime) => regime.type === idVatRegime)?.price;\n\n /* Gestion du Régime d'imposition */\n if (currentPriceGrid.taxSystem && idTaxSystem)\n taxSystemPrice = currentPriceGrid.taxSystem?.find((tax) => tax.id === idTaxSystem)?.price;\n\n /* Gestion des montants */\n /* Récupératioin des prix mensuels */\n if (currentPriceGrid.turnoverMonthly && !isYearly)\n monthlyPrice = currentPriceGrid.turnoverMonthly?.find((turn) => turnover < turn.turnoverValue)?.price;\n else if (currentPriceGrid.properties)\n monthlyPrice = currentPriceGrid.properties?.find((property) => property.amount === rentsNumber)?.price;\n else if (currentPriceGrid.employee) {\n monthlyPrice = currentPriceGrid.employee?.find(\n (emp) => emp.amountMinimum <= employeesNumber && emp.amountMaximum >= employeesNumber,\n )?.price;\n monthlyPrice = monthlyPrice ? monthlyPrice * employeesNumber : 0;\n } else if (currentPriceGrid.employeeByLegalForm) {\n monthlyPrice = currentPriceGrid.employeeByLegalForm?.find((emp) => emp.idLegalForm === idLegalForm)?.price;\n monthlyPrice = monthlyPrice ? monthlyPrice * employeesNumber : 0;\n /* Récupération des prix annuels */\n } else if (currentPriceGrid.turnoverYearly && isYearly)\n yearlyPrice = currentPriceGrid.turnoverYearly?.find((turn) => turnover < turn.turnoverValue)?.price;\n else if (!pastBalanceSheet && currentPriceGrid.turnoverCreatedYear)\n yearlyPrice = currentPriceGrid.turnoverCreatedYear?.find((turn) => turnover < turn.turnoverValue)?.price;\n else if (pastBalanceSheet && currentPriceGrid.turnoverPastYear)\n yearlyPrice = currentPriceGrid.turnoverPastYear?.find((turn) => turnover < turn.turnoverValue)?.price;\n else if (currentPriceGrid.partner)\n yearlyPrice = currentPriceGrid.partner?.find(\n (part) => part.amountMinimum <= associatesNumber && part.amountMaximum >= associatesNumber,\n )?.price;\n else if (currentPriceGrid.legalForm)\n yearlyPrice = currentPriceGrid.legalForm?.find((form) => form.idLegalForm === idLegalForm)?.price;\n else if (currentPriceGrid.exerciceNbr)\n yearlyPrice = currentPriceGrid.exerciceNbr?.find(\n (el) => el.minimum <= exerciceNbr && exerciceNbr <= el.maximum,\n )?.price;\n /* Calcul du prix mensuel final */\n finalMonthlyPrice =\n (monthlyPrice ? monthlyPrice : 0) + (vatRegimePrice ? vatRegimePrice : 0) + (taxSystemPrice ? taxSystemPrice : 0);\n\n /* Gestion des mois */\n let cloturedPast: boolean = false;\n if (dayjs(endDate, 'YYYY-MM-DD').subtract(15, 'day').isBefore(dayjs())) cloturedPast = true;\n let monthlyNbrList: monthlyNbr[] | undefined;\n let monthlyNbr: monthlyNbr | undefined;\n if (currentPriceGrid.monthlyNbr) {\n monthlyNbrList = currentPriceGrid.monthlyNbr?.filter((el) =>\n el.closingType.includes(cloturedPast ? ClosingType.OUTDATED : ClosingType.IN_PROGRESS),\n );\n if (monthlyNbrList) {\n monthlyNbr = monthlyNbrList.find((el) => el.minimum <= monthNbr && monthNbr <= el.maximum);\n if (monthlyNbr) {\n monthNbr = monthlyNbr.value;\n }\n }\n }\n /* Gestion des offres, mois offer */\n if (totalMonth > 0) {\n if (monthlyNbr && monthNbr - totalMonth < monthlyNbr?.minimum) canBeCreated = false;\n monthNbr = monthNbr - totalMonth;\n recalculateMonthly = true;\n }\n\n /* Calcul du nombre de mois soustraient */\n reduceMonth = monthNbr === NbrMonth - totalMonth ? totalMonth : 0;\n\n /* Gestion des offres, bilan offer */\n if (balanceSheetOffered > 0) {\n yearlyPrice = undefined;\n recalculateMonthly = false;\n finalMonthlyPrice = balanceSheetOffered / monthNbr;\n }\n\n /* Prix Final */\n totalPrestation = yearlyPrice ? yearlyPrice : finalMonthlyPrice * monthNbr;\n }\n return {\n totalPrestation,\n reduceMonth,\n canBeCreated,\n monthNbr: yearlyPrice ? 0 : recalculateMonthly ? NbrMonth : monthNbr,\n price: yearlyPrice\n ? yearlyPrice\n : recalculateMonthly\n ? totalPrestation / monthNbr\n : finalMonthlyPrice\n ? finalMonthlyPrice\n : 0,\n };\n};\n\nconst calculatePrestationPriceWithPrestationList = (prestationList: IPrestationList): number => {\n let totalPrestation: number = 0;\n\n totalPrestation = prestationList?.price || 0;\n\n return totalPrestation;\n};\n\n/**\n * From idLegalForm, get application fees amount (without taxes included if no idVat passed, or with taxes included calculated by given idVat)\n * @param idLegalForm\n * @param idVat\n * @returns amount of application fees, without taxes included\n */\nconst getApplicationFeesAmount = (idLegalForm: number, idVat?: number) => {\n let applicationFeesAmount = 50;\n if (idLegalForm === LegalFormTypeEnum.SCI) applicationFeesAmount = 150;\n\n //Sans tva, on envoie le montant HT\n if (!idVat) return applicationFeesAmount;\n\n //Avec tva, on envoie le montant TTC\n return getTaxesIncludedAmount(applicationFeesAmount, idVat);\n};\n\nconst calculatePrestationPrice = (\n idPrestationList: number,\n prestationList: IPrestationList,\n endDate: string,\n NbrMonth: number /* Nbr de mois dans l'exercice */,\n turnover: number,\n rentsNumber: number,\n employeesNumber: number,\n associatesNumber: number,\n idTypeBrand: number,\n idVatRegime: number,\n pastBalanceSheet: boolean,\n optionsList: number[],\n totalPercentage: number /* total pourcentage offer (%) */,\n totalAmount: number /* total montant offer (€) */,\n totalMonth: number /* total mois offer (mois) */,\n isWithApplicationFees: boolean /* frais de dossier */,\n idTaxSystem: number,\n idLegalForm: number,\n isYearly: boolean = false /* prestation annuel ou mensuel */,\n isSubPrestation: boolean = false,\n balanceSheetOffered: number = 0,\n exerciceList: IExercice[] = [],\n): {\n totalPrestation: number;\n reduceMonth: number;\n canBeCreated: boolean;\n calculDetail: string;\n monthlyPrice: string;\n price: number;\n} => {\n let totalPrestation: number = 0;\n let reduceMonth: number = 0;\n let canBeCreated: boolean = true;\n let monthNbr: number = 0;\n let price: number = 0;\n let totalWithReduce: {\n totalPrestation: number;\n reduceMonth: number;\n canBeCreated: boolean;\n monthNbr: number;\n price: number;\n } = { totalPrestation: 0, reduceMonth: 0, canBeCreated: true, monthNbr: 0, price: 0 };\n\n /* Gestion du prix en fonction de la prestation */\n if (\n [\n PrestationType.COMPTA_PRO,\n PrestationType.COMPTA_PRO_EXPRESS,\n PrestationType.COMPTA_ENTREPRISE,\n PrestationType.COMPTA_ENTREPRISE_EXPRESS,\n PrestationType.COMPTA_SCI,\n PrestationType.COMPTA_SCI_EXPRESS,\n PrestationType.BILAN_PREVISIONNEL,\n PrestationType.COMPTA_PREMIUM,\n PrestationType.COMPTA_POURCENTAGE_PREMIUM,\n PrestationType.COMPTA_POURCENTAGE_PREMIUM_EXPRESS,\n PrestationType.COMPTA_POURCENTAGE,\n PrestationType.COMPTA_POURCENTAGE_EXPRESS,\n PrestationType.SOCIAL,\n PrestationType.GESTION_JURIDIQUE,\n PrestationType.COMPTA_PRO_COMPTASTART,\n PrestationType.COMPTA_PRO_COMPTASTART_EXPRESS,\n PrestationType.COMPTA_EI_KLEMS,\n PrestationType.COMPTA_EI_KLEMS_EXPRESS,\n PrestationType.COMPTA_MICRO_KLEMS,\n PrestationType.COMPTA_MICRO_KLEMS_EXPRESS,\n PrestationType.COMPTA_LOUEUR_MEUBLE_NON_PRO_KLEMS,\n PrestationType.COMPTA_LOUEUR_MEUBLE_NON_PRO_KLEMS_EXPRESS,\n PrestationType.STATUTS_OPTION_2,\n PrestationType.EXPERTISE,\n PrestationType.SUPPORT,\n PrestationType.PREMIUM,\n PrestationType.CUSTOM_MADE,\n PrestationType.EI,\n PrestationType.MICRO,\n PrestationType.GESTION_IMMO,\n ].includes(idPrestationList)\n ) {\n let exerciceNbr: number = 0;\n if (exerciceList.length) exerciceNbr = exerciceNumber(dayjs(endDate, 'YYYY-MM-DD').toDate(), exerciceList);\n totalWithReduce = calculatePrestationPriceWithPriceGrid(\n idPrestationList,\n endDate,\n NbrMonth,\n turnover,\n rentsNumber,\n employeesNumber,\n associatesNumber,\n idTypeBrand,\n idVatRegime,\n pastBalanceSheet,\n isYearly,\n totalMonth,\n idTaxSystem,\n idLegalForm,\n exerciceNbr,\n balanceSheetOffered,\n );\n totalPrestation = totalWithReduce.totalPrestation;\n reduceMonth = totalWithReduce.reduceMonth;\n canBeCreated = totalWithReduce.canBeCreated;\n monthNbr = totalWithReduce.monthNbr;\n price = totalWithReduce.price;\n } else {\n totalPrestation = calculatePrestationPriceWithPrestationList(prestationList);\n if ([PrestationType.CREATION_SOCIETE].includes(idPrestationList) && !isSubPrestation) {\n // totalPrestation += 50;\n // La création est offerte désormais\n // inutile d'ajouter les frais de greffe et d'annonce légale,\n // car ne compte pas dans le calcul pour les sales\n }\n }\n /* Gestion des offres */\n /* Offre montant offer */\n if (totalAmount > 0) totalPrestation = totalPrestation - totalAmount;\n /* Offre pourcentage offer */\n if (totalPercentage > 0) totalPrestation = totalPrestation - totalPrestation * (totalPercentage / 100);\n /* Gesstioin du prix minimum acceptable pour la prestation */\n if (prestationList && prestationList.minimumPrice && totalPrestation < prestationList.minimumPrice)\n totalPrestation = prestationList.minimumPrice;\n /* Gestion des options */\n let OptionTotalPrice: number = 0;\n if (optionsList.length) {\n optionsList.forEach((optionId) => {\n const optionPrice: number | undefined = Object.values(PrestationOption).find(\n (option) => option.id === optionId,\n )?.price;\n if (optionPrice) OptionTotalPrice += optionPrice;\n });\n }\n totalPrestation += OptionTotalPrice ? OptionTotalPrice : 0;\n /* Gestion des frais de dossier */\n // if (isWithApplicationFees) {\n // const applicationFeesAmount = getApplicationFeesAmount(idLegalForm);\n // totalPrestation += applicationFeesAmount;\n // }\n\n const calculDetail = `${monthNbr > 0 ? monthNbr + ' mois x ' + Math.round(price * 100) / 100 + '€' : Math.round(price * 100) / 100 + '€'} ${totalAmount > 0 ? '- ' + totalAmount + '€' : ''} ${totalPercentage > 0 ? '- ' + totalPercentage + '%' : ''} ${isWithApplicationFees ? '+ 50€' : ''}`;\n\n return {\n totalPrestation,\n reduceMonth,\n canBeCreated,\n calculDetail,\n monthlyPrice: monthNbr > 0 ? Math.round(price * 100) / 100 + '€/mois' : Math.round(price * 100) / 100 + '€',\n price,\n };\n};\n\nconst getPrestationOptions = (idPrestationList: number): PrestationOptionType[] => {\n const PrestationOptionList: PrestationOptionType[] = Object.values(PrestationOption).filter((option) =>\n option.brand.includes(getBrandNameByNodeEnv(process.env.NODE_ENV)),\n );\n return PrestationOptionList.filter((option) => option.prestationList.includes(idPrestationList));\n};\n\nconst isAbleToUpdatePrice = (\n idTypeBrand: number,\n idPrestationList: number,\n turnover: number,\n pastBalanceSheet: boolean,\n): boolean => {\n /* Récupération de la grille tarifaire */\n const currentPriceGrid: priceGrid | undefined = getPriceGrid(idTypeBrand, idPrestationList);\n if (currentPriceGrid) {\n if (\n [\n PrestationType.COMPTA_PREMIUM,\n PrestationType.COMPTA_POURCENTAGE_PREMIUM,\n PrestationType.COMPTA_POURCENTAGE_PREMIUM_EXPRESS,\n ].includes(idPrestationList) &&\n // @ts-ignore: error after prettier formatting\n currentPriceGrid.turnoverMonthly[currentPriceGrid.turnoverMonthly.length - 2].turnoverValue < turnover\n )\n return true;\n else if (\n [PrestationType.COMPTA_POURCENTAGE, PrestationType.COMPTA_POURCENTAGE_EXPRESS].includes(idPrestationList) &&\n // @ts-ignore: error after prettier formatting\n currentPriceGrid.turnoverMonthly[currentPriceGrid.turnoverMonthly.length - 1].turnoverValue < turnover\n )\n return true;\n else if (\n [PrestationType.BILAN_PREVISIONNEL].includes(idPrestationList) &&\n !pastBalanceSheet &&\n // @ts-ignore: error after prettier formatting\n currentPriceGrid.turnoverCreatedYear[currentPriceGrid.turnoverCreatedYear.length - 1].turnoverValue < turnover\n )\n return true;\n else if (\n [PrestationType.BILAN_PREVISIONNEL].includes(idPrestationList) &&\n pastBalanceSheet &&\n // @ts-ignore: error after prettier formatting\n currentPriceGrid.turnoverPastYear[currentPriceGrid.turnoverPastYear.length - 1].turnoverValue < turnover\n )\n return true;\n else return false;\n }\n return false;\n};\n\nconst idPrestationListToOfferType = (idPrestationList: number): 'software' | 'expertise' => {\n if (ClementineSubscriptionAccountancySoftwarePrestations.includes(idPrestationList)) return 'software';\n return 'expertise';\n};\n\nexport {\n isOtherAccountingMissions,\n isOtherJuridicalMissions,\n isAdditionalPresta,\n isOtherSocialMission,\n isOnlyPrevi,\n isOnlySocial,\n isOnlyJuridic,\n isCreation,\n isFromStatutsExpress,\n isExpress,\n isConsultingHour,\n isSoftwarePrestation,\n calculateScoringOfPrestation,\n calculatePrestationPrice,\n getPrestationOptions,\n isAbleToUpdatePrice,\n calculatePrestationPriceWithPriceGrid,\n getApplicationFeesAmount,\n idPrestationListToOffer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AoB,EACpB,SAAS,EACT,gBAAgB,EAChB,oBAAoB,EACpB,4BAA4B,EAC5B,wBAAwB,EACxB,oBAAoB,EACpB,mBAAmB,EACnB,qCAAqC,EACrC,wBAAwB,EACxB,2BAA2B,GAC5B,CAAC","sourcesContent":["import { IExercice, IPrestation, IPrestationList } from '../types';\nimport { Vat } from '../types/Enum/Vat';\nimport { getTaxesIncludedAmount } from './vat/utils';\nimport { intersection } from './noLodash';\nimport {\n ClementineSubscriptionAccountancySoftwarePrestations,\n PrestationDetail,\n PrestationType,\n} from '../types/Enum/PrestationType';\nimport { LegalFormTypeEnum } from '../types/Enum/LegalForm';\nimport { PrestationOptionType, PrestationOption } from '../types/Enum/PrestationOption';\nimport { PriceGridClementine } from '../types/Enum/PriceGridClementine';\nimport { PriceGridPourcentage } from '../types/Enum/PriceGridPourcentage';\nimport { PriceGridLegalstart } from '../types/Enum/PriceGridLegalstart';\nimport { PriceGridStatutsExpress } from '../types/Enum/PriceGridStatutsExpress';\nimport { ClosingType } from '../types/Enum/ClosingType';\nimport { getBrandNameByNodeEnv } from './brands';\nimport * as dayjs from 'dayjs';\nimport { exerciceNumber } from './exercice';\n\ntype priceGridBrand = {\n idTypeBrand: number;\n price: priceGrid[];\n};\n\ntype priceGrid = {\n idPrestationList: number[];\n priceWithTaxesIncluded: boolean;\n applicationCost: number;\n monthlyNbr?: monthlyNbr[];\n exerciceNbr?: exerciceNbr[];\n turnoverCreatedYear?: turnover[];\n turnoverPastYear?: turnover[];\n turnoverMonthly?: turnover[];\n turnoverYearly?: turnover[];\n employee?: employee[];\n partner?: employee[];\n properties?: propertie[];\n vatRegimeMonthly?: vatRegime[];\n vatRegimeYearly?: vatRegime[];\n taxSystem?: taxSystem[];\n legalForm?: legalForm[];\n employeeByLegalForm?: employeeByLegalForm[];\n};\n\ntype monthlyNbr = {\n minimum: number;\n maximum: number;\n value: number;\n closingType: number[];\n};\n\ntype exerciceNbr = {\n minimum: number;\n maximum: number;\n price: number;\n};\n\ntype turnover = {\n turnoverValue: number;\n price: number;\n};\n\ntype legalForm = {\n idLegalForm: number;\n price: number;\n};\n\ntype employee = {\n amountMinimum: number;\n amountMaximum: number;\n price: number;\n};\n\ntype employeeByLegalForm = {\n idLegalForm: number;\n price: number;\n};\n\ntype propertie = {\n amount: number;\n price: number;\n};\n\ntype vatRegime = {\n type: number;\n price: number;\n};\n\ntype taxSystem = {\n id: number;\n price: number;\n};\n\nconst isOtherAccountingMissions = (idPrestationList: number): boolean =>\n [\n PrestationType.PREVISIONNEL,\n PrestationType.BILAN_INTERMEDIAIRE,\n PrestationType.AVANCE_OU_ABANDON_COMPTE_COURANT_ASSOCIE,\n PrestationType.AUTRE_MISSION_COMPTABLE,\n PrestationType.TVS,\n PrestationType.ETUDE_FISCALE,\n PrestationType.BILAN_PREVISIONNEL,\n ].includes(idPrestationList);\n\nconst isOtherJuridicalMissions = (isJuridique: boolean, isCatalog: boolean, idPrestationList: number): boolean =>\n idPrestationList !== PrestationType.GESTION_JURIDIQUE && isCatalog && isJuridique;\n\nconst isOtherSocialMission = (idPrestationList: number): boolean =>\n idPrestationList === PrestationType.AUTRE_MISSION_SOCIALE_HORS_PAIE;\n\nconst isAdditionalPresta = (hidden: boolean, isCatalog: boolean): boolean => !hidden && isCatalog;\n\nconst isOnlyPrevi = (idPrestationList: number[]): boolean =>\n !idPrestationList.filter(\n (idPL: number) =>\n ![PrestationType.PREVISIONNEL, PrestationType.BILAN_PREVISIONNEL, PrestationType.PV_AG].includes(idPL),\n ).length;\n\nconst isOnlySocial = (idPrestationList: number[]): boolean =>\n !idPrestationList.filter((idPL: number) => ![PrestationType.FRUCTUPAIE, PrestationType.SOCIAL].includes(idPL)).length;\n\nconst isOnlyJuridic = (idPrestationList: number[]): boolean =>\n !idPrestationList.filter((idPL: number) => ![PrestationType.GESTION_JURIDIQUE].includes(idPL)).length;\n\nconst isCreation = (idPrestationList: number[]): boolean =>\n !!intersection(idPrestationList, [\n PrestationType.CREATION_SOCIETE,\n PrestationType.STATUTS_FREE,\n PrestationType.STATUTS_OPTION_1,\n PrestationType.STATUTS_OPTION_2,\n PrestationType.STATUTS_OPTION_AE,\n ]).length;\n\nconst isFromStatutsExpress = (idPrestationList: number[]): boolean =>\n !idPrestationList.filter(\n (idPL: number) =>\n ![\n PrestationType.STATUTS_FREE,\n PrestationType.STATUTS_OPTION_1,\n PrestationType.STATUTS_OPTION_2,\n PrestationType.STATUTS_OPTION_AE,\n ].includes(idPL),\n ).length;\n\nconst isExpress = (idPrestationList: number): boolean => {\n const prestationDetailValues = Object.values(PrestationDetail) as any;\n const prestaList = prestationDetailValues.find((pr: any) => pr.id === idPrestationList);\n return !!prestaList.isBack;\n};\n\nconst isConsultingHour = (idPrestationList: number[]): boolean =>\n !!intersection(idPrestationList, [PrestationType.CONSULTING_HOUR]).length;\n\nconst isSoftwarePrestation = (idPrestationList: number[]): boolean =>\n !!intersection(idPrestationList, [PrestationType.STEERING, PrestationType.VAT, PrestationType.BALANCESHEET]).length &&\n idPrestationList.length === 1;\n\nconst calculateScoringOfPrestation = (\n idPrestationType: PrestationType,\n prestations: IPrestation[],\n currentIdPrestation: number,\n): number => {\n const prestationsSignedPaid = prestations.filter(\n (prestation) =>\n prestation.paid &&\n prestation.signed &&\n prestation.terminationList === null &&\n prestation.id !== currentIdPrestation,\n );\n\n const currentPrestation = prestations.find(\n (el) => el.idPrestationList === idPrestationType && el.terminationList === null,\n );\n\n // Get the list of prestations that are half price\n const prestationHalfPriceList = Object.values(PrestationDetail).filter(\n (p) =>\n p.isComptable &&\n !p.isCatalog &&\n p.id &&\n ![PrestationType.BALANCESHEET, PrestationType.VAT, PrestationType.STEERING].includes(p.id),\n );\n const prestationHalfPriceIds = prestationHalfPriceList.map((t) => t.id);\n\n // Get the number of points for the new prestation\n const prestaDetails = Object.values(PrestationDetail).find((prestaDetail) => prestaDetail.id === idPrestationType);\n let numberPoint = prestaDetails?.point || 0;\n\n // If software prestation and annual payment then return 0 points\n if (\n [PrestationType.BALANCESHEET, PrestationType.VAT, PrestationType.STEERING].includes(idPrestationType) &&\n currentPrestation?.exercices?.length &&\n //@ts-expect-error\n currentPrestation?.exercices[0].ExercicePrestation?.totalPrestation < 80\n ) {\n numberPoint = 0;\n }\n\n if (\n // If software prestation and annual payment then return 0 points\n [PrestationType.EXPERTISE, PrestationType.SUPPORT, PrestationType.PREMIUM, PrestationType.CUSTOM_MADE].includes(\n idPrestationType,\n ) &&\n currentPrestation?.exercices?.length &&\n currentPrestation?.exercices.find((el) => el.isBack)\n ) {\n numberPoint += 100;\n }\n\n // Get list of prestations that are already done and check if one of them is in the list of prestations that are half price\n const prestationsExistIds = prestationsSignedPaid.map((prestation) => prestation.idPrestationList);\n const prestationHalfPriceAlreadyDoneIds = prestationsExistIds.filter((id) => prestationHalfPriceIds.includes(id));\n\n // If one of the prestations already done is in the list of prestations that are half price and if the idPrestationType is in prestationHalfPriceIds, return 50% of points\n if (prestationHalfPriceAlreadyDoneIds.length && prestationHalfPriceIds.includes(idPrestationType))\n return Math.floor(numberPoint * 0.3);\n\n return numberPoint;\n};\n\nexport const calculateMonthlyAmount = (params: {\n monthlyPrice: number;\n monthNumber: number;\n monthOffer: number;\n idVatForInternalInvoicing?: number | null;\n returnTaxesIncludedValue?: boolean;\n}): number => {\n const { monthlyPrice, monthNumber, monthOffer, idVatForInternalInvoicing, returnTaxesIncludedValue = true } = params;\n\n if (!idVatForInternalInvoicing && returnTaxesIncludedValue)\n throw new Error('Taux de TVA manquant pour calculer le montant TTC');\n\n if (!idVatForInternalInvoicing || !returnTaxesIncludedValue) return monthlyPrice * (monthNumber - monthOffer);\n\n return (\n monthlyPrice *\n (monthNumber - monthOffer) *\n (1 + Object.values(Vat).find((el) => el.id === idVatForInternalInvoicing).value / 100)\n );\n};\n\nexport const getPriceGrid = (idTypeBrand: number, idPrestationList: number): priceGrid | undefined => {\n let currentBrandPriceGrid: priceGridBrand | undefined;\n let currentPriceGrid: priceGrid | undefined;\n\n const currentEnvName = getBrandNameByNodeEnv(process.env.NODE_ENV);\n const listEnvEnum = {\n PriceGridClementine,\n PriceGridPourcentage,\n PriceGridLegalstart,\n PriceGridStatutsExpress,\n };\n // @ts-ignore\n const currentPriceGridFile: priceGridBrand[] = listEnvEnum[`PriceGrid${currentEnvName}`];\n if (currentPriceGridFile)\n currentBrandPriceGrid = currentPriceGridFile.find(\n (priceGrid: priceGridBrand) => priceGrid.idTypeBrand === idTypeBrand,\n );\n if (currentBrandPriceGrid)\n currentPriceGrid = currentBrandPriceGrid?.price.find((price: priceGrid) =>\n price.idPrestationList.includes(idPrestationList),\n );\n return currentPriceGrid;\n};\n\nconst calculatePrestationPriceWithPriceGrid = (\n idPrestationList: number,\n endDate: string,\n NbrMonth: number /* Nbr de mois dans l'exercice */,\n turnover: number,\n rentsNumber: number,\n employeesNumber: number,\n associatesNumber: number,\n idTypeBrand: number,\n idVatRegime: number,\n pastBalanceSheet: boolean,\n isYearly: boolean /* Prestation annuel ou mensuel */,\n totalMonth: number /* Nbr de moiis offer */,\n idTaxSystem: number,\n idLegalForm: number,\n exerciceNbr: number,\n balanceSheetOffered: number = 0 /* montant du bilan offer */,\n): {\n totalPrestation: number;\n reduceMonth: number;\n canBeCreated: boolean;\n monthNbr: number;\n price: number;\n} => {\n let totalPrestation: number = 0;\n let reduceMonth: number = 0;\n let monthNbr: number = NbrMonth;\n let yearlyPrice: number | undefined;\n let finalMonthlyPrice: number | undefined;\n let canBeCreated: boolean = true;\n let recalculateMonthly: boolean = false;\n\n /* Récupération de la grille tarifaire */\n const currentPriceGrid: priceGrid | undefined = getPriceGrid(idTypeBrand, idPrestationList);\n\n if (currentPriceGrid) {\n let monthlyPrice: number | undefined;\n let vatRegimePrice: number | undefined;\n let taxSystemPrice: number | undefined;\n\n /* Gestion du régime de TVA */\n if (currentPriceGrid.vatRegimeMonthly && !isYearly)\n vatRegimePrice = currentPriceGrid.vatRegimeMonthly?.find((regime) => regime.type === idVatRegime)?.price;\n else if (currentPriceGrid.vatRegimeYearly && isYearly)\n vatRegimePrice = currentPriceGrid.vatRegimeYearly?.find((regime) => regime.type === idVatRegime)?.price;\n\n /* Gestion du Régime d'imposition */\n if (currentPriceGrid.taxSystem && idTaxSystem)\n taxSystemPrice = currentPriceGrid.taxSystem?.find((tax) => tax.id === idTaxSystem)?.price;\n\n /* Gestion des montants */\n /* Récupératioin des prix mensuels */\n if (currentPriceGrid.turnoverMonthly && !isYearly)\n monthlyPrice = currentPriceGrid.turnoverMonthly?.find((turn) => turnover < turn.turnoverValue)?.price;\n else if (currentPriceGrid.properties)\n monthlyPrice = currentPriceGrid.properties?.find((property) => property.amount === rentsNumber)?.price;\n else if (currentPriceGrid.employee) {\n monthlyPrice = currentPriceGrid.employee?.find(\n (emp) => emp.amountMinimum <= employeesNumber && emp.amountMaximum >= employeesNumber,\n )?.price;\n monthlyPrice = monthlyPrice ? monthlyPrice * employeesNumber : 0;\n } else if (currentPriceGrid.employeeByLegalForm) {\n monthlyPrice = currentPriceGrid.employeeByLegalForm?.find((emp) => emp.idLegalForm === idLegalForm)?.price;\n monthlyPrice = monthlyPrice ? monthlyPrice * employeesNumber : 0;\n /* Récupération des prix annuels */\n } else if (currentPriceGrid.turnoverYearly && isYearly)\n yearlyPrice = currentPriceGrid.turnoverYearly?.find((turn) => turnover < turn.turnoverValue)?.price;\n else if (!pastBalanceSheet && currentPriceGrid.turnoverCreatedYear)\n yearlyPrice = currentPriceGrid.turnoverCreatedYear?.find((turn) => turnover < turn.turnoverValue)?.price;\n else if (pastBalanceSheet && currentPriceGrid.turnoverPastYear)\n yearlyPrice = currentPriceGrid.turnoverPastYear?.find((turn) => turnover < turn.turnoverValue)?.price;\n else if (currentPriceGrid.partner)\n yearlyPrice = currentPriceGrid.partner?.find(\n (part) => part.amountMinimum <= associatesNumber && part.amountMaximum >= associatesNumber,\n )?.price;\n else if (currentPriceGrid.legalForm)\n yearlyPrice = currentPriceGrid.legalForm?.find((form) => form.idLegalForm === idLegalForm)?.price;\n else if (currentPriceGrid.exerciceNbr)\n yearlyPrice = currentPriceGrid.exerciceNbr?.find(\n (el) => el.minimum <= exerciceNbr && exerciceNbr <= el.maximum,\n )?.price;\n /* Calcul du prix mensuel final */\n finalMonthlyPrice =\n (monthlyPrice ? monthlyPrice : 0) + (vatRegimePrice ? vatRegimePrice : 0) + (taxSystemPrice ? taxSystemPrice : 0);\n\n /* Gestion des mois */\n let cloturedPast: boolean = false;\n if (dayjs(endDate, 'YYYY-MM-DD').subtract(15, 'day').isBefore(dayjs())) cloturedPast = true;\n let monthlyNbrList: monthlyNbr[] | undefined;\n let monthlyNbr: monthlyNbr | undefined;\n if (currentPriceGrid.monthlyNbr) {\n monthlyNbrList = currentPriceGrid.monthlyNbr?.filter((el) =>\n el.closingType.includes(cloturedPast ? ClosingType.OUTDATED : ClosingType.IN_PROGRESS),\n );\n if (monthlyNbrList) {\n monthlyNbr = monthlyNbrList.find((el) => el.minimum <= monthNbr && monthNbr <= el.maximum);\n if (monthlyNbr) {\n monthNbr = monthlyNbr.value;\n }\n }\n }\n /* Gestion des offres, mois offer */\n if (totalMonth > 0) {\n if (monthlyNbr && monthNbr - totalMonth < monthlyNbr?.minimum) canBeCreated = false;\n monthNbr = monthNbr - totalMonth;\n recalculateMonthly = true;\n }\n\n /* Calcul du nombre de mois soustraient */\n reduceMonth = monthNbr === NbrMonth - totalMonth ? totalMonth : 0;\n\n /* Gestion des offres, bilan offer */\n if (balanceSheetOffered > 0) {\n yearlyPrice = undefined;\n recalculateMonthly = false;\n finalMonthlyPrice = balanceSheetOffered / monthNbr;\n }\n\n /* Prix Final */\n totalPrestation = yearlyPrice ? yearlyPrice : finalMonthlyPrice * monthNbr;\n }\n return {\n totalPrestation,\n reduceMonth,\n canBeCreated,\n monthNbr: yearlyPrice ? 0 : recalculateMonthly ? NbrMonth : monthNbr,\n price: yearlyPrice\n ? yearlyPrice\n : recalculateMonthly\n ? totalPrestation / monthNbr\n : finalMonthlyPrice\n ? finalMonthlyPrice\n : 0,\n };\n};\n\nconst calculatePrestationPriceWithPrestationList = (prestationList: IPrestationList): number => {\n let totalPrestation: number = 0;\n\n totalPrestation = prestationList?.price || 0;\n\n return totalPrestation;\n};\n\n/**\n * From idLegalForm, get application fees amount (without taxes included if no idVat passed, or with taxes included calculated by given idVat)\n * @param idLegalForm\n * @param idVat\n * @returns amount of application fees, without taxes included\n */\nconst getApplicationFeesAmount = (idLegalForm: number, idVat?: number) => {\n let applicationFeesAmount = 50;\n if (idLegalForm === LegalFormTypeEnum.SCI) applicationFeesAmount = 150;\n\n //Sans tva, on envoie le montant HT\n if (!idVat) return applicationFeesAmount;\n\n //Avec tva, on envoie le montant TTC\n return getTaxesIncludedAmount(applicationFeesAmount, idVat);\n};\n\nconst calculatePrestationPrice = (\n idPrestationList: number,\n prestationList: IPrestationList,\n endDate: string,\n NbrMonth: number /* Nbr de mois dans l'exercice */,\n turnover: number,\n rentsNumber: number,\n employeesNumber: number,\n associatesNumber: number,\n idTypeBrand: number,\n idVatRegime: number,\n pastBalanceSheet: boolean,\n optionsList: number[],\n totalPercentage: number /* total pourcentage offer (%) */,\n totalAmount: number /* total montant offer (€) */,\n totalMonth: number /* total mois offer (mois) */,\n isWithApplicationFees: boolean /* frais de dossier */,\n idTaxSystem: number,\n idLegalForm: number,\n isYearly: boolean = false /* prestation annuel ou mensuel */,\n isSubPrestation: boolean = false,\n balanceSheetOffered: number = 0,\n exerciceList: IExercice[] = [],\n): {\n totalPrestation: number;\n reduceMonth: number;\n canBeCreated: boolean;\n calculDetail: string;\n monthlyPrice: string;\n price: number;\n} => {\n let totalPrestation: number = 0;\n let reduceMonth: number = 0;\n let canBeCreated: boolean = true;\n let monthNbr: number = 0;\n let price: number = 0;\n let totalWithReduce: {\n totalPrestation: number;\n reduceMonth: number;\n canBeCreated: boolean;\n monthNbr: number;\n price: number;\n } = { totalPrestation: 0, reduceMonth: 0, canBeCreated: true, monthNbr: 0, price: 0 };\n\n /* Gestion du prix en fonction de la prestation */\n if (\n [\n PrestationType.COMPTA_PRO,\n PrestationType.COMPTA_PRO_EXPRESS,\n PrestationType.COMPTA_ENTREPRISE,\n PrestationType.COMPTA_ENTREPRISE_EXPRESS,\n PrestationType.COMPTA_SCI,\n PrestationType.COMPTA_SCI_EXPRESS,\n PrestationType.BILAN_PREVISIONNEL,\n PrestationType.COMPTA_PREMIUM,\n PrestationType.COMPTA_POURCENTAGE_PREMIUM,\n PrestationType.COMPTA_POURCENTAGE_PREMIUM_EXPRESS,\n PrestationType.COMPTA_POURCENTAGE,\n PrestationType.COMPTA_POURCENTAGE_EXPRESS,\n PrestationType.SOCIAL,\n PrestationType.GESTION_JURIDIQUE,\n PrestationType.COMPTA_PRO_COMPTASTART,\n PrestationType.COMPTA_PRO_COMPTASTART_EXPRESS,\n PrestationType.COMPTA_EI_KLEMS,\n PrestationType.COMPTA_EI_KLEMS_EXPRESS,\n PrestationType.COMPTA_MICRO_KLEMS,\n PrestationType.COMPTA_MICRO_KLEMS_EXPRESS,\n PrestationType.COMPTA_LOUEUR_MEUBLE_NON_PRO_KLEMS,\n PrestationType.COMPTA_LOUEUR_MEUBLE_NON_PRO_KLEMS_EXPRESS,\n PrestationType.STATUTS_OPTION_2,\n PrestationType.EXPERTISE,\n PrestationType.SUPPORT,\n PrestationType.PREMIUM,\n PrestationType.CUSTOM_MADE,\n PrestationType.EI,\n PrestationType.MICRO,\n PrestationType.GESTION_IMMO,\n ].includes(idPrestationList)\n ) {\n let exerciceNbr: number = 0;\n if (exerciceList.length) exerciceNbr = exerciceNumber(dayjs(endDate, 'YYYY-MM-DD').toDate(), exerciceList);\n totalWithReduce = calculatePrestationPriceWithPriceGrid(\n idPrestationList,\n endDate,\n NbrMonth,\n turnover,\n rentsNumber,\n employeesNumber,\n associatesNumber,\n idTypeBrand,\n idVatRegime,\n pastBalanceSheet,\n isYearly,\n totalMonth,\n idTaxSystem,\n idLegalForm,\n exerciceNbr,\n balanceSheetOffered,\n );\n totalPrestation = totalWithReduce.totalPrestation;\n reduceMonth = totalWithReduce.reduceMonth;\n canBeCreated = totalWithReduce.canBeCreated;\n monthNbr = totalWithReduce.monthNbr;\n price = totalWithReduce.price;\n } else {\n totalPrestation = calculatePrestationPriceWithPrestationList(prestationList);\n if ([PrestationType.CREATION_SOCIETE].includes(idPrestationList) && !isSubPrestation) {\n // totalPrestation += 50;\n // La création est offerte désormais\n // inutile d'ajouter les frais de greffe et d'annonce légale,\n // car ne compte pas dans le calcul pour les sales\n }\n }\n /* Gestion des offres */\n /* Offre montant offer */\n if (totalAmount > 0) totalPrestation = totalPrestation - totalAmount;\n /* Offre pourcentage offer */\n if (totalPercentage > 0) totalPrestation = totalPrestation - totalPrestation * (totalPercentage / 100);\n /* Gesstioin du prix minimum acceptable pour la prestation */\n if (prestationList && prestationList.minimumPrice && totalPrestation < prestationList.minimumPrice)\n totalPrestation = prestationList.minimumPrice;\n /* Gestion des options */\n let OptionTotalPrice: number = 0;\n if (optionsList.length) {\n optionsList.forEach((optionId) => {\n const optionPrice: number | undefined = Object.values(PrestationOption).find(\n (option) => option.id === optionId,\n )?.price;\n if (optionPrice) OptionTotalPrice += optionPrice;\n });\n }\n totalPrestation += OptionTotalPrice ? OptionTotalPrice : 0;\n /* Gestion des frais de dossier */\n // if (isWithApplicationFees) {\n // const applicationFeesAmount = getApplicationFeesAmount(idLegalForm);\n // totalPrestation += applicationFeesAmount;\n // }\n\n const calculDetail = `${monthNbr > 0 ? monthNbr + ' mois x ' + Math.round(price * 100) / 100 + '€' : Math.round(price * 100) / 100 + '€'} ${totalAmount > 0 ? '- ' + totalAmount + '€' : ''} ${totalPercentage > 0 ? '- ' + totalPercentage + '%' : ''} ${isWithApplicationFees ? '+ 50€' : ''}`;\n\n return {\n totalPrestation,\n reduceMonth,\n canBeCreated,\n calculDetail,\n monthlyPrice: monthNbr > 0 ? Math.round(price * 100) / 100 + '€/mois' : Math.round(price * 100) / 100 + '€',\n price,\n };\n};\n\nconst getPrestationOptions = (idPrestationList: number): PrestationOptionType[] => {\n const PrestationOptionList: PrestationOptionType[] = Object.values(PrestationOption).filter((option) =>\n option.brand.includes(getBrandNameByNodeEnv(process.env.NODE_ENV)),\n );\n return PrestationOptionList.filter((option) => option.prestationList.includes(idPrestationList));\n};\n\nconst isAbleToUpdatePrice = (\n idTypeBrand: number,\n idPrestationList: number,\n turnover: number,\n pastBalanceSheet: boolean,\n): boolean => {\n /* Récupération de la grille tarifaire */\n const currentPriceGrid: priceGrid | undefined = getPriceGrid(idTypeBrand, idPrestationList);\n if (currentPriceGrid) {\n if (\n [\n PrestationType.COMPTA_PREMIUM,\n PrestationType.COMPTA_POURCENTAGE_PREMIUM,\n PrestationType.COMPTA_POURCENTAGE_PREMIUM_EXPRESS,\n ].includes(idPrestationList) &&\n // @ts-ignore: error after prettier formatting\n currentPriceGrid.turnoverMonthly[currentPriceGrid.turnoverMonthly.length - 2].turnoverValue < turnover\n )\n return true;\n else if (\n [PrestationType.COMPTA_POURCENTAGE, PrestationType.COMPTA_POURCENTAGE_EXPRESS].includes(idPrestationList) &&\n // @ts-ignore: error after prettier formatting\n currentPriceGrid.turnoverMonthly[currentPriceGrid.turnoverMonthly.length - 1].turnoverValue < turnover\n )\n return true;\n else if (\n [PrestationType.BILAN_PREVISIONNEL].includes(idPrestationList) &&\n !pastBalanceSheet &&\n // @ts-ignore: error after prettier formatting\n currentPriceGrid.turnoverCreatedYear[currentPriceGrid.turnoverCreatedYear.length - 1].turnoverValue < turnover\n )\n return true;\n else if (\n [PrestationType.BILAN_PREVISIONNEL].includes(idPrestationList) &&\n pastBalanceSheet &&\n // @ts-ignore: error after prettier formatting\n currentPriceGrid.turnoverPastYear[currentPriceGrid.turnoverPastYear.length - 1].turnoverValue < turnover\n )\n return true;\n else return false;\n }\n return false;\n};\n\nconst idPrestationListToOfferType = (idPrestationList: number): 'software' | 'expertise' => {\n if (ClementineSubscriptionAccountancySoftwarePrestations.includes(idPrestationList)) return 'software';\n return 'expertise';\n};\n\nexport {\n isOtherAccountingMissions,\n isOtherJuridicalMissions,\n isAdditionalPresta,\n isOtherSocialMission,\n isOnlyPrevi,\n isOnlySocial,\n isOnlyJuridic,\n isCreation,\n isFromStatutsExpress,\n isExpress,\n isConsultingHour,\n isSoftwarePrestation,\n calculateScoringOfPrestation,\n calculatePrestationPrice,\n getPrestationOptions,\n isAbleToUpdatePrice,\n calculatePrestationPriceWithPriceGrid,\n getApplicationFeesAmount,\n idPrestationListToOfferType,\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@silexpert/core",
3
- "version": "1.3.61",
3
+ "version": "1.3.62",
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": "dist/cjs/index.js",
@@ -374,7 +374,7 @@ export const BrandClementine: Brand[] = [
374
374
  {
375
375
  idTypeBrand: 7,
376
376
  name: 'Epinal',
377
- commercialName: 'Epinal',
377
+ commercialName: 'Clementine',
378
378
  urlS3: 'https://s3.eu-west-3.amazonaws.com/resources-clementine/',
379
379
  logoS3: 'config/72030539-45a0-57fb-a7bb-e151e7d2721b.svg',
380
380
  lightLogoS3: 'config/clementine-logo-blanc.svg',
@@ -0,0 +1,12 @@
1
+ export interface CalendarEventIcs {
2
+ uid: string,
3
+ now: string,
4
+ start: string,
5
+ end: string
6
+ summary: string,
7
+ description: string,
8
+ organizer: {
9
+ name: string,
10
+ email: string
11
+ }
12
+ }
@@ -18,6 +18,7 @@ export interface CreateMailParams extends IMail {
18
18
  idLetter?: number;
19
19
  filesToken?: string[];
20
20
  idCustomerIsRegime?: number;
21
+ icalEvent?: Buffer;
21
22
  }
22
23
 
23
24
  export interface ExtendedIMailAddress extends IMailAddress {
package/ts/types/index.ts CHANGED
@@ -941,6 +941,7 @@ export * from './Interface/api/calendarEvent/getLastInvalidateEvent';
941
941
  export * from './Interface/api/calendarEvent/readAllCalendarEvent';
942
942
  export * from './Interface/api/calendarEvent/readCalendarEventCall';
943
943
  export * from './Interface/api/calendarEvent/queryCalendarEventCall';
944
+ export * from './Interface/api/calendarEvent/calendarEventIcs';
944
945
  export * from './Interface/api/checklist/Read';
945
946
  export * from './Interface/api/checklist/Query';
946
947
  export * from './Interface/api/checklist/Update';
@@ -156,9 +156,17 @@ const isSoftwarePrestation = (idPrestationList: number[]): boolean =>
156
156
  !!intersection(idPrestationList, [PrestationType.STEERING, PrestationType.VAT, PrestationType.BALANCESHEET]).length &&
157
157
  idPrestationList.length === 1;
158
158
 
159
- const calculateScoringOfPrestation = (idPrestationType: PrestationType, prestations: IPrestation[]): number => {
159
+ const calculateScoringOfPrestation = (
160
+ idPrestationType: PrestationType,
161
+ prestations: IPrestation[],
162
+ currentIdPrestation: number,
163
+ ): number => {
160
164
  const prestationsSignedPaid = prestations.filter(
161
- (prestation) => prestation.paid && prestation.signed && prestation.terminationList === null,
165
+ (prestation) =>
166
+ prestation.paid &&
167
+ prestation.signed &&
168
+ prestation.terminationList === null &&
169
+ prestation.id !== currentIdPrestation,
162
170
  );
163
171
 
164
172
  const currentPrestation = prestations.find(
@@ -189,6 +197,17 @@ const calculateScoringOfPrestation = (idPrestationType: PrestationType, prestati
189
197
  numberPoint = 0;
190
198
  }
191
199
 
200
+ if (
201
+ // If software prestation and annual payment then return 0 points
202
+ [PrestationType.EXPERTISE, PrestationType.SUPPORT, PrestationType.PREMIUM, PrestationType.CUSTOM_MADE].includes(
203
+ idPrestationType,
204
+ ) &&
205
+ currentPrestation?.exercices?.length &&
206
+ currentPrestation?.exercices.find((el) => el.isBack)
207
+ ) {
208
+ numberPoint += 100;
209
+ }
210
+
192
211
  // Get list of prestations that are already done and check if one of them is in the list of prestations that are half price
193
212
  const prestationsExistIds = prestationsSignedPaid.map((prestation) => prestation.idPrestationList);
194
213
  const prestationHalfPriceAlreadyDoneIds = prestationsExistIds.filter((id) => prestationHalfPriceIds.includes(id));