@silexpert/core 1.0.164 → 1.0.168

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 (93) hide show
  1. package/es/api/resources/Prestations.d.ts +24 -0
  2. package/es/api/resources/Prestations.d.ts.map +1 -0
  3. package/es/api/resources/Prestations.js +29 -0
  4. package/es/api/resources/Prestations.js.map +1 -0
  5. package/es/api/resources/Quotation.d.ts +6 -0
  6. package/es/api/resources/Quotation.d.ts.map +1 -1
  7. package/es/api/resources/Quotation.js +8 -0
  8. package/es/api/resources/Quotation.js.map +1 -1
  9. package/es/api/resources.d.ts +2 -0
  10. package/es/api/resources.d.ts.map +1 -1
  11. package/es/api/resources.js +2 -0
  12. package/es/api/resources.js.map +1 -1
  13. package/es/types/Enum/AdminAcceptance.d.ts +11 -0
  14. package/es/types/Enum/AdminAcceptance.d.ts.map +1 -0
  15. package/es/types/Enum/AdminAcceptance.js +26 -0
  16. package/es/types/Enum/AdminAcceptance.js.map +1 -0
  17. package/es/types/Enum/BalanceSheet.d.ts.map +1 -1
  18. package/es/types/Enum/BalanceSheet.js +1 -0
  19. package/es/types/Enum/BalanceSheet.js.map +1 -1
  20. package/es/types/Enum/ConstitutionState.d.ts.map +1 -1
  21. package/es/types/Enum/ConstitutionState.js +8 -2
  22. package/es/types/Enum/ConstitutionState.js.map +1 -1
  23. package/es/types/Enum/PrestationListType.d.ts +11 -0
  24. package/es/types/Enum/PrestationListType.d.ts.map +1 -0
  25. package/es/types/Enum/PrestationListType.js +26 -0
  26. package/es/types/Enum/PrestationListType.js.map +1 -0
  27. package/es/types/Interface/api/immobilization/ReadFormattedImmobilization.d.ts +1 -0
  28. package/es/types/Interface/api/immobilization/ReadFormattedImmobilization.d.ts.map +1 -1
  29. package/es/types/Interface/api/immobilization/ReadFormattedImmobilization.js.map +1 -1
  30. package/es/types/Interface/api/prestations/QueryCreate.d.ts +20 -0
  31. package/es/types/Interface/api/prestations/QueryCreate.d.ts.map +1 -0
  32. package/es/types/Interface/api/prestations/QueryCreate.js +116 -0
  33. package/es/types/Interface/api/prestations/QueryCreate.js.map +1 -0
  34. package/es/types/Interface/api/prestations/QueryGetAllPrestations.d.ts +6 -0
  35. package/es/types/Interface/api/prestations/QueryGetAllPrestations.d.ts.map +1 -0
  36. package/es/types/Interface/api/prestations/QueryGetAllPrestations.js +36 -0
  37. package/es/types/Interface/api/prestations/QueryGetAllPrestations.js.map +1 -0
  38. package/es/types/Interface/api/prestations/QueryUpdate.d.ts +22 -0
  39. package/es/types/Interface/api/prestations/QueryUpdate.d.ts.map +1 -0
  40. package/es/types/Interface/api/prestations/QueryUpdate.js +131 -0
  41. package/es/types/Interface/api/prestations/QueryUpdate.js.map +1 -0
  42. package/es/types/Interface/models/IPrestationList.d.ts +3 -0
  43. package/es/types/Interface/models/IPrestationList.d.ts.map +1 -1
  44. package/es/types/Interface/models/IPrestationList.js.map +1 -1
  45. package/es/types/index.d.ts +5 -0
  46. package/es/types/index.d.ts.map +1 -1
  47. package/es/types/index.js +5 -0
  48. package/es/types/index.js.map +1 -1
  49. package/es/utils/quotation.d.ts +2 -2
  50. package/es/utils/quotation.d.ts.map +1 -1
  51. package/es/utils/quotation.js +10 -10
  52. package/es/utils/quotation.js.map +1 -1
  53. package/js/api/resources/Prestations.js +38 -0
  54. package/js/api/resources/Prestations.js.map +1 -0
  55. package/js/api/resources/Quotation.js +10 -0
  56. package/js/api/resources/Quotation.js.map +1 -1
  57. package/js/api/resources.js +3 -1
  58. package/js/api/resources.js.map +1 -1
  59. package/js/types/Enum/AdminAcceptance.js +26 -0
  60. package/js/types/Enum/AdminAcceptance.js.map +1 -0
  61. package/js/types/Enum/BalanceSheet.js +1 -0
  62. package/js/types/Enum/BalanceSheet.js.map +1 -1
  63. package/js/types/Enum/ConstitutionState.js +8 -2
  64. package/js/types/Enum/ConstitutionState.js.map +1 -1
  65. package/js/types/Enum/PrestationListType.js +26 -0
  66. package/js/types/Enum/PrestationListType.js.map +1 -0
  67. package/js/types/Interface/api/immobilization/ReadFormattedImmobilization.js.map +1 -1
  68. package/js/types/Interface/api/prestations/QueryCreate.js +39 -0
  69. package/js/types/Interface/api/prestations/QueryCreate.js.map +1 -0
  70. package/js/types/Interface/api/prestations/QueryGetAllPrestations.js +26 -0
  71. package/js/types/Interface/api/prestations/QueryGetAllPrestations.js.map +1 -0
  72. package/js/types/Interface/api/prestations/QueryUpdate.js +40 -0
  73. package/js/types/Interface/api/prestations/QueryUpdate.js.map +1 -0
  74. package/js/types/Interface/models/IPrestationList.js.map +1 -1
  75. package/js/types/index.js +50 -0
  76. package/js/types/index.js.map +1 -1
  77. package/js/utils/quotation.js +9 -10
  78. package/js/utils/quotation.js.map +1 -1
  79. package/package.json +1 -1
  80. package/ts/api/resources/Prestations.ts +34 -0
  81. package/ts/api/resources/Quotation.ts +9 -0
  82. package/ts/api/resources.ts +2 -0
  83. package/ts/types/Enum/AdminAcceptance.ts +25 -0
  84. package/ts/types/Enum/BalanceSheet.ts +1 -0
  85. package/ts/types/Enum/ConstitutionState.ts +8 -2
  86. package/ts/types/Enum/PrestationListType.ts +25 -0
  87. package/ts/types/Interface/api/immobilization/ReadFormattedImmobilization.ts +1 -0
  88. package/ts/types/Interface/api/prestations/QueryCreate.ts +91 -0
  89. package/ts/types/Interface/api/prestations/QueryGetAllPrestations.ts +25 -0
  90. package/ts/types/Interface/api/prestations/QueryUpdate.ts +106 -0
  91. package/ts/types/Interface/models/IPrestationList.ts +5 -0
  92. package/ts/types/index.ts +5 -1
  93. package/ts/utils/quotation.ts +10 -10
@@ -112,7 +112,7 @@ function getLeadQuotation(params) {
112
112
  return quotation;
113
113
  }
114
114
  /* besoin en entré de la société concerné avec les différents imports (society), ainsi que la liste des autres sociétés ou l'owner est owner (otherSocieties) */
115
- function getClientQuotation(society, otherSocieties, lastNotice, unpaidDetails, reports, societyProcedings, tabBankAccount) {
115
+ function getClientQuotation(society, otherSocieties, lastNotice, unpaidDetails, reports, societyProcedings, tabBankAccount, firstPaiement) {
116
116
  var _a, _b, _c, _d, _e, _f;
117
117
  let quotationPositive = 0;
118
118
  let quotationNegative = 0;
@@ -133,7 +133,7 @@ function getClientQuotation(society, otherSocieties, lastNotice, unpaidDetails,
133
133
  created: 0
134
134
  };
135
135
  // calcul de l'ancienneté de la société
136
- const anciennete = dayjs().diff(dayjs(society.dateIsClient, 'YYYY-MM-DD'), 'years');
136
+ const anciennete = (firstPaiement === null || firstPaiement === void 0 ? void 0 : firstPaiement.length) > 0 ? dayjs().diff(dayjs(firstPaiement[0].datePayment, 'YYYY-MM-DD'), 'years') : 0;
137
137
  const ponderation = anciennete * 0.1 + 1;
138
138
  /* Type de comptabilité du client (Tresorerie (+10) / Engagement (+15)) */
139
139
  if (society.idComptaType) {
@@ -145,16 +145,15 @@ function getClientQuotation(society, otherSocieties, lastNotice, unpaidDetails,
145
145
  detailQuotation.signature += 15;
146
146
  }
147
147
  }
148
- /* Ancienneté (1 ans < dateIsClient < 2 ans (+10) / 2 ans < dateIsClient (+15 / année)) */
149
- if (society.dateIsClient) {
150
- const yearAsClient = Number(new Date().getFullYear()) - Number(new Date(society.dateIsClient).getFullYear());
151
- if (yearAsClient > 0) {
148
+ /* Ancienneté (1 ans < firstPaiement < 2 ans (+10) / 2 ans < firstPaiement (+20 / année)) */
149
+ if ((firstPaiement === null || firstPaiement === void 0 ? void 0 : firstPaiement.length) > 0) {
150
+ const yearAsClient = Number(new Date().getFullYear()) - Number(new Date(firstPaiement[0].datePayment).getFullYear());
151
+ if (yearAsClient === 1) {
152
152
  quotationPositive += 10;
153
153
  detailQuotation.seniority += 10;
154
- if (yearAsClient > 1) {
155
- quotationPositive += 15 * (yearAsClient - 1);
156
- detailQuotation.seniority += 15 * (yearAsClient - 1);
157
- }
154
+ } else if (yearAsClient > 1) {
155
+ quotationPositive += 20 * (yearAsClient - 1) + 10;
156
+ detailQuotation.seniority += 20 * (yearAsClient - 1) + 10;
158
157
  }
159
158
  }
160
159
  /* Prestations Complémentaires (+5 / prestation) */
@@ -1 +1 @@
1
- {"version":3,"file":"quotation.js","names":["getLeadQuotation","exports","getClientQuotation","compareTwoCotation","_dayjs","require","dayjs","_interopRequireWildcard","_MailDomainType","_Activity","_ComptaType","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","params","firstname","lastname","phone","mail","annualTurnover","source","alreadyExist","activitySector","includes","quotation","substr","BasicDomain","find","domain","ForbidenDomain","Date","getDay","dateTime","year","getFullYear","month","getMonth","day","getDate","startTime","endTime","getTime","fieldNumber","filter","data","length","Activity","INFORMATIQUE","CONSEIL","TRANSPORT","BTP","RESTAURATION","COMMERCANT","MEDICAL","PROF_LIB","society","otherSocieties","lastNotice","unpaidDetails","reports","societyProcedings","tabBankAccount","quotationPositive","quotationNegative","detailQuotation","signature","seniority","additionalBenefits","additionalCompanies","unpayed","updatedAnnotations","bankSynchronization","rating","labRefused","ongoingProceedings","report","termination","created","anciennete","diff","dateIsClient","ponderation","idComptaType","ComptaType","CASH_BASED","CASH_BASED_ASSISTANCE","CASH_BASED_SEIZURE","ACCRUALS","ACCRUALS_ASSISTANCE","ACCRUALS_SEIZURE","yearAsClient","Number","_a","prestationsSocieties","prestationsCompl","prestation","idPrestationComplementary","forEach","Math","ceil","_b","societyAccountingTransactions","countNotAnnoted","percentageAnnotations","map","na","dateLocked","_c","_d","societyActivatedBankAccounts","synchro","desactivatedBankAccount","average","_e","societyDetail","acceptation","isWaitingEnd","_f","prestationsCreation","idPrestationList","cotation","idSociety","id","cotations","higher"],"sources":["../../ts/utils/quotation.ts"],"sourcesContent":["import * as dayjs from 'dayjs';\nimport { ForbidenDomain, BasicDomain } from '../types/Enum/MailDomainType';\nimport { Activity } from '../types/Enum/Activity';\nimport { ComptaType } from '../types/Enum/ComptaType';\nimport { ISociety } from '../types/Interface/models/ISociety';\nimport { ICotation } from '../types/Interface/models/ICotation';\nimport {\n BasePaginate,\n IRating, IReport, ISocietyProceding, ReadClientQuotation,\n} from '../types';\n\ntype getLeadQuotationParams = {\n firstname: string,\n lastname: string,\n phone: string,\n mail: string,\n annualTurnover: number,\n source: number,\n alreadyExist: boolean,\n activitySector: number,\n};\n\nexport function getLeadQuotation(params: getLeadQuotationParams):number {\n const {\n firstname, lastname, phone, mail, annualTurnover, source, alreadyExist, activitySector,\n } = params;\n if (\n firstname === 'test'\n || lastname === 'test'\n || mail?.includes('test')\n || ['606060606', '707070707', '612345678', '712345678', '687654321', '787654321'].includes(phone)\n ) {\n return 0;\n }\n let quotation = 0;\n\n /* cotation du prénom */\n if (firstname) quotation += 5;\n\n /* cotation du nom */\n if (lastname) quotation += 5;\n\n /* cotation du numéro de téléphone */\n if (['6', '7'].includes(phone.substr(0, 1))) {\n quotation += 15;\n } else {\n quotation += 5;\n }\n\n /* cotation de l'adresse email */\n if (BasicDomain.find((domain) => mail?.includes(domain))) {\n quotation += 5;\n } else\n if (!ForbidenDomain.find((domain) => mail?.includes(domain))) {\n quotation += 15;\n }\n\n /* cotation du CA annuel */\n if ([0, 150000, 400000, 783000, 783001].includes(annualTurnover)) {\n quotation += 10;\n } else if ([50000, 234000].includes(annualTurnover)) {\n quotation += 5;\n }\n\n /* cotation de la date d'ajout */\n if ([1, 2, 3, 4, 5].includes(new Date().getDay())) {\n const dateTime = new Date();\n const year = dateTime.getFullYear();\n const month = dateTime.getMonth();\n const day = dateTime.getDate();\n const startTime = new Date(`${year}-${month + 1}-${day} 08:45:00`);\n const endTime = new Date(`${year}-${month + 1}-${day} 18:45:00`);\n if ((startTime.getTime() <= dateTime.getTime()) && (endTime.getTime() >= dateTime.getTime())) {\n quotation += 15;\n } else {\n quotation += 5;\n }\n } else {\n quotation += 5;\n }\n\n /* cotation de la source */\n /* Parrainage */\n if (source === 49) {\n quotation += 10;\n\n /* calendly, appel entrant */\n } else if (source === 2) {\n quotation += 8;\n\n /* adWords, Bing, Formulaire */\n } else if (source === 4) {\n quotation += 6;\n\n /* Chat, Whatsapp */\n } else if ([29, 92].includes(source)) {\n quotation += 2;\n }\n\n /* cotation de la qualité (nombre de champs remplis) */\n const fieldNumber = [firstname, lastname, phone, mail, annualTurnover, activitySector].filter((data) => !!data).length;\n switch (fieldNumber) {\n case 6:\n quotation += 10;\n break;\n case 5:\n quotation += 8;\n break;\n case 4:\n quotation += 6;\n break;\n case 3:\n quotation += 4;\n break;\n case 2:\n quotation += 2;\n break;\n default:\n break;\n }\n\n /* cotation de l'existence du lead (déjà existant ou non) */\n if (alreadyExist) quotation += 8;\n\n /* cotation du secteur d'activité */\n if ([Activity.INFORMATIQUE, Activity.CONSEIL].includes(activitySector)) {\n quotation += 10;\n } else if ([Activity.TRANSPORT, Activity.BTP, Activity.RESTAURATION, Activity.COMMERCANT, Activity.MEDICAL, Activity.PROF_LIB].includes(activitySector)) {\n quotation += 5;\n }\n\n return quotation;\n}\n\n/* besoin en entré de la société concerné avec les différents imports (society), ainsi que la liste des autres sociétés ou l'owner est owner (otherSocieties) */\nexport function getClientQuotation(society: ISociety, otherSocieties: ISociety[], lastNotice: BasePaginate<IRating>, unpaidDetails: [], reports: IReport[], societyProcedings: ISocietyProceding[], tabBankAccount: any): ReadClientQuotation {\n let quotationPositive = 0;\n let quotationNegative = 0;\n let quotation = 0;\n const detailQuotation = {\n signature: 0,\n seniority: 0,\n additionalBenefits: 0,\n additionalCompanies: 0,\n unpayed: 0,\n updatedAnnotations: 0,\n bankSynchronization: 0,\n rating: 0,\n labRefused: 0,\n ongoingProceedings: 0,\n report: 0,\n termination: 0,\n created: 0,\n };\n\n // calcul de l'ancienneté de la société\n const anciennete = dayjs().diff(dayjs(society.dateIsClient, 'YYYY-MM-DD'), 'years');\n const ponderation = (anciennete * 0.1) + 1;\n\n /* Type de comptabilité du client (Tresorerie (+10) / Engagement (+15)) */\n if (society.idComptaType) {\n if ([ComptaType.CASH_BASED, ComptaType.CASH_BASED_ASSISTANCE, ComptaType.CASH_BASED_SEIZURE].includes(society.idComptaType)) {\n quotationPositive += 10;\n detailQuotation.signature += 10;\n } else if ([ComptaType.ACCRUALS, ComptaType.ACCRUALS_ASSISTANCE, ComptaType.ACCRUALS_SEIZURE].includes(society.idComptaType)) {\n quotationPositive += 15;\n detailQuotation.signature += 15;\n }\n }\n\n /* Ancienneté (1 ans < dateIsClient < 2 ans (+10) / 2 ans < dateIsClient (+15 / année)) */\n if (society.dateIsClient) {\n const yearAsClient = Number(new Date().getFullYear()) - Number(new Date(society.dateIsClient).getFullYear());\n if (yearAsClient > 0) {\n quotationPositive += 10;\n detailQuotation.seniority += 10;\n if (yearAsClient > 1) {\n quotationPositive += 15 * (yearAsClient - 1);\n detailQuotation.seniority += 15 * (yearAsClient - 1);\n }\n }\n }\n\n /* Prestations Complémentaires (+5 / prestation) */\n if (society.prestationsSocieties?.length) {\n const prestationsCompl = society.prestationsSocieties.filter((prestation) => prestation.idPrestationComplementary);\n prestationsCompl.forEach(() => {\n quotationPositive += Math.ceil(5 * ponderation);\n detailQuotation.additionalBenefits += Math.ceil(5 * ponderation);\n });\n }\n\n /* Sociétés supplémentaires (+8 / société) */\n if (otherSocieties.length) {\n quotationPositive += Math.ceil(8 * otherSocieties.length * ponderation);\n detailQuotation.additionalCompanies += Math.ceil(8 * otherSocieties.length * ponderation);\n }\n\n /* Impayés (-15 / mois) */\n if (unpaidDetails.length) {\n quotationNegative -= Math.ceil(15 * unpaidDetails.length * ponderation);\n detailQuotation.unpayed -= Math.ceil(15 * unpaidDetails.length * ponderation);\n }\n\n /* annotations à jour */\n if (tabBankAccount.societyAccountingTransactions?.length) {\n // on check s'il y a 80% des lignes annotées (dateLocked)\n let countNotAnnoted = 0;\n let percentageAnnotations = 100;\n tabBankAccount.societyAccountingTransactions.map((na:any) => {\n if (na.dateLocked === null) {\n countNotAnnoted += 1;\n }\n return countNotAnnoted;\n });\n if (countNotAnnoted !== 0) percentageAnnotations = (countNotAnnoted / tabBankAccount.societyAccountingTransactions?.length) * 100;\n if (percentageAnnotations >= 80) {\n quotationPositive += Math.ceil(12 * ponderation);\n detailQuotation.updatedAnnotations += Math.ceil(12 * ponderation);\n } else {\n quotationNegative -= Math.ceil(12 * ponderation);\n detailQuotation.updatedAnnotations -= Math.ceil(12 * ponderation);\n }\n }\n\n /* synchronisation bancaire */\n if (tabBankAccount.societyActivatedBankAccounts?.length) {\n // comptes synchro\n const synchro = tabBankAccount.societyActivatedBankAccounts.length - tabBankAccount.desactivatedBankAccount.length;\n quotationPositive += Math.ceil(12 * synchro * ponderation);\n detailQuotation.bankSynchronization += Math.ceil(12 * synchro * ponderation);\n\n // comptes desynchro\n quotationNegative -= Math.ceil(12 * tabBankAccount.desactivatedBankAccount.length * ponderation);\n detailQuotation.bankSynchronization -= Math.ceil(12 * tabBankAccount.desactivatedBankAccount.length * ponderation);\n }\n\n /* avis */\n if (lastNotice && lastNotice.data.length === 1) {\n if (lastNotice.data[0].average === 5) {\n quotationPositive += Math.ceil(10 * ponderation);\n detailQuotation.rating += Math.ceil(10 * ponderation);\n } else {\n quotationNegative -= 10;\n detailQuotation.rating -= 10;\n }\n }\n\n /* LAB refusée */\n if (!society.societyDetail?.acceptation) {\n quotationNegative -= 10;\n detailQuotation.labRefused -= 10;\n }\n\n /* Cessation de paiement - redressement judiciaire - procédure en cours / signalements / résiliation */\n if (societyProcedings?.length) {\n quotationNegative -= 5 * societyProcedings.length;\n detailQuotation.ongoingProceedings -= 5 * societyProcedings.length;\n }\n\n if (reports?.length) {\n quotationNegative -= 10;\n detailQuotation.report -= 10;\n }\n\n if (society.isWaitingEnd) {\n quotationNegative -= 50;\n detailQuotation.termination -= 50;\n }\n\n /* Création chez nous */\n if (society.prestationsSocieties?.length) {\n const prestationsCreation = society.prestationsSocieties.filter((prestation) => prestation.idPrestationList === 15); // creation pas d'enum\n prestationsCreation.forEach(() => {\n quotationPositive += 10;\n detailQuotation.created += 10;\n });\n }\n\n if (quotationPositive > 100) quotationPositive = 100;\n if (quotationNegative > 100) quotationNegative = 100;\n\n quotation = quotationPositive + quotationNegative;\n\n if (quotation < 0) quotation = 0;\n\n return {\n cotation: quotation,\n data: detailQuotation,\n idSociety: society.id as number,\n };\n}\n\nexport function compareTwoCotation(cotations: ICotation[]):boolean | null {\n // on recupere les 2 dernieres cotations de la societe\n const higher = false;\n if (cotations[0].cotation === cotations[1].cotation) {\n return null;\n } if (cotations[0].cotation > cotations[1].cotation) {\n return true;\n }\n return higher;\n}"],"mappings":";;;;;QAsBgBA,gBAAgB,GAAhBA,gBAAgB;AAAAC,OAAA,CAiHhBC,kBAAkB,GAAlBA,kBAAkB;AAAAD,OAAA,CA8JlBE,kBAAkB,GAAlBA,kBAAkB;AArSlC,IAAAC,MAAA,GAAAC,OAAA;AAA+B,IAAnBC,KAAK,GAAAC,uBAAA,CAAAH,MAAA;AACjB,IAAAI,eAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AAAsD,SAAAM,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAL,wBAAAS,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SAAAM,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA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AiB,GAAGC,iBAAiB;EAEjD,IAAIvC,SAAS,GAAG,CAAC,EAAEA,SAAS,GAAG,CAAC;EAEhC,OAAO;IACLgG,QAAQ,EAAEhG,SAAS;IACnBoB,IAAI,EAAEoB,eAAe;IACrByD,SAAS,EAAElE,OAAO,CAACmE;GACpB;AACH;AAEM,SAAU1I,kBAAkBA,CAAC2I,SAAsB;EACvD;EACA,MAAMC,MAAM,GAAG,KAAK;EACpB,IAAID,SAAS,CAAC,CAAC,CAAC,CAACH,QAAQ,KAAKG,SAAS,CAAC,CAAC,CAAC,CAACH,QAAQ,EAAE;IACnD,OAAO,IAAI;;EACX,IAAIG,SAAS,CAAC,CAAC,CAAC,CAACH,QAAQ,GAAGG,SAAS,CAAC,CAAC,CAAC,CAACH,QAAQ,EAAE;IACnD,OAAO,IAAI;;EAEb,OAAOI,MAAM;AACf"}
1
+ {"version":3,"file":"quotation.js","names":["getLeadQuotation","exports","getClientQuotation","compareTwoCotation","_dayjs","require","dayjs","_interopRequireWildcard","_MailDomainType","_Activity","_ComptaType","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","params","firstname","lastname","phone","mail","annualTurnover","source","alreadyExist","activitySector","includes","quotation","substr","BasicDomain","find","domain","ForbidenDomain","Date","getDay","dateTime","year","getFullYear","month","getMonth","day","getDate","startTime","endTime","getTime","fieldNumber","filter","data","length","Activity","INFORMATIQUE","CONSEIL","TRANSPORT","BTP","RESTAURATION","COMMERCANT","MEDICAL","PROF_LIB","society","otherSocieties","lastNotice","unpaidDetails","reports","societyProcedings","tabBankAccount","firstPaiement","quotationPositive","quotationNegative","detailQuotation","signature","seniority","additionalBenefits","additionalCompanies","unpayed","updatedAnnotations","bankSynchronization","rating","labRefused","ongoingProceedings","report","termination","created","anciennete","diff","datePayment","ponderation","idComptaType","ComptaType","CASH_BASED","CASH_BASED_ASSISTANCE","CASH_BASED_SEIZURE","ACCRUALS","ACCRUALS_ASSISTANCE","ACCRUALS_SEIZURE","yearAsClient","Number","_a","prestationsSocieties","prestationsCompl","prestation","idPrestationComplementary","forEach","Math","ceil","_b","societyAccountingTransactions","countNotAnnoted","percentageAnnotations","map","na","dateLocked","_c","_d","societyActivatedBankAccounts","synchro","desactivatedBankAccount","average","_e","societyDetail","acceptation","isWaitingEnd","_f","prestationsCreation","idPrestationList","cotation","idSociety","id","cotations","higher"],"sources":["../../ts/utils/quotation.ts"],"sourcesContent":["import * as dayjs from 'dayjs';\nimport { ForbidenDomain, BasicDomain } from '../types/Enum/MailDomainType';\nimport { Activity } from '../types/Enum/Activity';\nimport { ComptaType } from '../types/Enum/ComptaType';\nimport { ISociety } from '../types/Interface/models/ISociety';\nimport { ICotation } from '../types/Interface/models/ICotation';\nimport {\n BasePaginate,\n IPayment,\n IRating, IReport, ISocietyProceding, ReadClientQuotation,\n} from '../types';\n\ntype getLeadQuotationParams = {\n firstname: string,\n lastname: string,\n phone: string,\n mail: string,\n annualTurnover: number,\n source: number,\n alreadyExist: boolean,\n activitySector: number,\n};\n\nexport function getLeadQuotation(params: getLeadQuotationParams):number {\n const {\n firstname, lastname, phone, mail, annualTurnover, source, alreadyExist, activitySector,\n } = params;\n if (\n firstname === 'test'\n || lastname === 'test'\n || mail?.includes('test')\n || ['606060606', '707070707', '612345678', '712345678', '687654321', '787654321'].includes(phone)\n ) {\n return 0;\n }\n let quotation = 0;\n\n /* cotation du prénom */\n if (firstname) quotation += 5;\n\n /* cotation du nom */\n if (lastname) quotation += 5;\n\n /* cotation du numéro de téléphone */\n if (['6', '7'].includes(phone.substr(0, 1))) {\n quotation += 15;\n } else {\n quotation += 5;\n }\n\n /* cotation de l'adresse email */\n if (BasicDomain.find((domain) => mail?.includes(domain))) {\n quotation += 5;\n } else\n if (!ForbidenDomain.find((domain) => mail?.includes(domain))) {\n quotation += 15;\n }\n\n /* cotation du CA annuel */\n if ([0, 150000, 400000, 783000, 783001].includes(annualTurnover)) {\n quotation += 10;\n } else if ([50000, 234000].includes(annualTurnover)) {\n quotation += 5;\n }\n\n /* cotation de la date d'ajout */\n if ([1, 2, 3, 4, 5].includes(new Date().getDay())) {\n const dateTime = new Date();\n const year = dateTime.getFullYear();\n const month = dateTime.getMonth();\n const day = dateTime.getDate();\n const startTime = new Date(`${year}-${month + 1}-${day} 08:45:00`);\n const endTime = new Date(`${year}-${month + 1}-${day} 18:45:00`);\n if ((startTime.getTime() <= dateTime.getTime()) && (endTime.getTime() >= dateTime.getTime())) {\n quotation += 15;\n } else {\n quotation += 5;\n }\n } else {\n quotation += 5;\n }\n\n /* cotation de la source */\n /* Parrainage */\n if (source === 49) {\n quotation += 10;\n\n /* calendly, appel entrant */\n } else if (source === 2) {\n quotation += 8;\n\n /* adWords, Bing, Formulaire */\n } else if (source === 4) {\n quotation += 6;\n\n /* Chat, Whatsapp */\n } else if ([29, 92].includes(source)) {\n quotation += 2;\n }\n\n /* cotation de la qualité (nombre de champs remplis) */\n const fieldNumber = [firstname, lastname, phone, mail, annualTurnover, activitySector].filter((data) => !!data).length;\n switch (fieldNumber) {\n case 6:\n quotation += 10;\n break;\n case 5:\n quotation += 8;\n break;\n case 4:\n quotation += 6;\n break;\n case 3:\n quotation += 4;\n break;\n case 2:\n quotation += 2;\n break;\n default:\n break;\n }\n\n /* cotation de l'existence du lead (déjà existant ou non) */\n if (alreadyExist) quotation += 8;\n\n /* cotation du secteur d'activité */\n if ([Activity.INFORMATIQUE, Activity.CONSEIL].includes(activitySector)) {\n quotation += 10;\n } else if ([Activity.TRANSPORT, Activity.BTP, Activity.RESTAURATION, Activity.COMMERCANT, Activity.MEDICAL, Activity.PROF_LIB].includes(activitySector)) {\n quotation += 5;\n }\n\n return quotation;\n}\n\n/* besoin en entré de la société concerné avec les différents imports (society), ainsi que la liste des autres sociétés ou l'owner est owner (otherSocieties) */\nexport function getClientQuotation(society: ISociety, otherSocieties: ISociety[], lastNotice: BasePaginate<IRating>, unpaidDetails: [], reports: IReport[], societyProcedings: ISocietyProceding[], tabBankAccount: any, firstPaiement: IPayment[]): ReadClientQuotation {\n let quotationPositive = 0;\n let quotationNegative = 0;\n let quotation = 0;\n const detailQuotation = {\n signature: 0,\n seniority: 0,\n additionalBenefits: 0,\n additionalCompanies: 0,\n unpayed: 0,\n updatedAnnotations: 0,\n bankSynchronization: 0,\n rating: 0,\n labRefused: 0,\n ongoingProceedings: 0,\n report: 0,\n termination: 0,\n created: 0,\n };\n\n // calcul de l'ancienneté de la société\n const anciennete = firstPaiement?.length > 0 ? dayjs().diff(dayjs(firstPaiement[0].datePayment, 'YYYY-MM-DD'), 'years') : 0;\n const ponderation = (anciennete * 0.1) + 1;\n\n /* Type de comptabilité du client (Tresorerie (+10) / Engagement (+15)) */\n if (society.idComptaType) {\n if ([ComptaType.CASH_BASED, ComptaType.CASH_BASED_ASSISTANCE, ComptaType.CASH_BASED_SEIZURE].includes(society.idComptaType)) {\n quotationPositive += 10;\n detailQuotation.signature += 10;\n } else if ([ComptaType.ACCRUALS, ComptaType.ACCRUALS_ASSISTANCE, ComptaType.ACCRUALS_SEIZURE].includes(society.idComptaType)) {\n quotationPositive += 15;\n detailQuotation.signature += 15;\n }\n }\n\n /* Ancienneté (1 ans < firstPaiement < 2 ans (+10) / 2 ans < firstPaiement (+20 / année)) */\n if (firstPaiement?.length > 0) {\n const yearAsClient = Number(new Date().getFullYear()) - Number(new Date(firstPaiement[0].datePayment).getFullYear());\n if (yearAsClient === 1) {\n quotationPositive += 10;\n detailQuotation.seniority += 10;\n } else if (yearAsClient > 1) {\n quotationPositive += (20 * (yearAsClient - 1) + 10);\n detailQuotation.seniority += (20 * (yearAsClient - 1) + 10);\n }\n }\n\n /* Prestations Complémentaires (+5 / prestation) */\n if (society.prestationsSocieties?.length) {\n const prestationsCompl = society.prestationsSocieties.filter((prestation) => prestation.idPrestationComplementary);\n prestationsCompl.forEach(() => {\n quotationPositive += Math.ceil(5 * ponderation);\n detailQuotation.additionalBenefits += Math.ceil(5 * ponderation);\n });\n }\n\n /* Sociétés supplémentaires (+8 / société) */\n if (otherSocieties.length) {\n quotationPositive += Math.ceil(8 * otherSocieties.length * ponderation);\n detailQuotation.additionalCompanies += Math.ceil(8 * otherSocieties.length * ponderation);\n }\n\n /* Impayés (-15 / mois) */\n if (unpaidDetails.length) {\n quotationNegative -= Math.ceil(15 * unpaidDetails.length * ponderation);\n detailQuotation.unpayed -= Math.ceil(15 * unpaidDetails.length * ponderation);\n }\n\n /* annotations à jour */\n if (tabBankAccount.societyAccountingTransactions?.length) {\n // on check s'il y a 80% des lignes annotées (dateLocked)\n let countNotAnnoted = 0;\n let percentageAnnotations = 100;\n tabBankAccount.societyAccountingTransactions.map((na:any) => {\n if (na.dateLocked === null) {\n countNotAnnoted += 1;\n }\n return countNotAnnoted;\n });\n if (countNotAnnoted !== 0) percentageAnnotations = (countNotAnnoted / tabBankAccount.societyAccountingTransactions?.length) * 100;\n if (percentageAnnotations >= 80) {\n quotationPositive += Math.ceil(12 * ponderation);\n detailQuotation.updatedAnnotations += Math.ceil(12 * ponderation);\n } else {\n quotationNegative -= Math.ceil(12 * ponderation);\n detailQuotation.updatedAnnotations -= Math.ceil(12 * ponderation);\n }\n }\n\n /* synchronisation bancaire */\n if (tabBankAccount.societyActivatedBankAccounts?.length) {\n // comptes synchro\n const synchro = tabBankAccount.societyActivatedBankAccounts.length - tabBankAccount.desactivatedBankAccount.length;\n quotationPositive += Math.ceil(12 * synchro * ponderation);\n detailQuotation.bankSynchronization += Math.ceil(12 * synchro * ponderation);\n\n // comptes desynchro\n quotationNegative -= Math.ceil(12 * tabBankAccount.desactivatedBankAccount.length * ponderation);\n detailQuotation.bankSynchronization -= Math.ceil(12 * tabBankAccount.desactivatedBankAccount.length * ponderation);\n }\n\n /* avis */\n if (lastNotice && lastNotice.data.length === 1) {\n if (lastNotice.data[0].average === 5) {\n quotationPositive += Math.ceil(10 * ponderation);\n detailQuotation.rating += Math.ceil(10 * ponderation);\n } else {\n quotationNegative -= 10;\n detailQuotation.rating -= 10;\n }\n }\n\n /* LAB refusée */\n if (!society.societyDetail?.acceptation) {\n quotationNegative -= 10;\n detailQuotation.labRefused -= 10;\n }\n\n /* Cessation de paiement - redressement judiciaire - procédure en cours / signalements / résiliation */\n if (societyProcedings?.length) {\n quotationNegative -= 5 * societyProcedings.length;\n detailQuotation.ongoingProceedings -= 5 * societyProcedings.length;\n }\n\n if (reports?.length) {\n quotationNegative -= 10;\n detailQuotation.report -= 10;\n }\n\n if (society.isWaitingEnd) {\n quotationNegative -= 50;\n detailQuotation.termination -= 50;\n }\n\n /* Création chez nous */\n if (society.prestationsSocieties?.length) {\n const prestationsCreation = society.prestationsSocieties.filter((prestation) => prestation.idPrestationList === 15); // creation pas d'enum\n prestationsCreation.forEach(() => {\n quotationPositive += 10;\n detailQuotation.created += 10;\n });\n }\n\n if (quotationPositive > 100) quotationPositive = 100;\n if (quotationNegative > 100) quotationNegative = 100;\n\n quotation = quotationPositive + quotationNegative;\n\n if (quotation < 0) quotation = 0;\n\n return {\n cotation: quotation,\n data: detailQuotation,\n idSociety: society.id as number,\n };\n}\n\nexport function compareTwoCotation(cotations: ICotation[]):boolean | null {\n // on recupere les 2 dernieres cotations de la societe\n const higher = false;\n if (cotations[0].cotation === cotations[1].cotation) {\n return null;\n } if (cotations[0].cotation > cotations[1].cotation) {\n return true;\n }\n return higher;\n}"],"mappings":";;;;;QAuBgBA,gBAAgB,GAAhBA,gBAAgB;AAAAC,OAAA,CAiHhBC,kBAAkB,GAAlBA,kBAAkB;AAAAD,OAAA,CA6JlBE,kBAAkB,GAAlBA,kBAAkB;AArSlC,IAAAC,MAAA,GAAAC,OAAA;AAA+B,IAAnBC,KAAK,GAAAC,uBAAA,CAAAH,MAAA;AACjB,IAAAI,eAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AAAsD,S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AACH,QAAQ,GAAGG,SAAS,CAAC,CAAC,CAAC,CAACH,QAAQ,EAAE;IACnD,OAAO,IAAI;;EAEb,OAAOI,MAAM;AACf"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@silexpert/core",
3
- "version": "1.0.164",
3
+ "version": "1.0.168",
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",
@@ -0,0 +1,34 @@
1
+ import {
2
+ IPrestationList, QueryCreatePrestations, QueryUpdatePrestations, QueryGetAllPrestations,
3
+ } from '../../types';
4
+ import { Resource } from '../Resource';
5
+
6
+ export class Prestations extends Resource {
7
+ /**
8
+ * Crée un enregistrement dans la table prestationList
9
+ * @param { QueryUpdatePrestations } data
10
+ * @returns { IPrestationList }
11
+ */
12
+ create(data: QueryCreatePrestations): Promise<IPrestationList> {
13
+ return this.axios.$post('prestations', data);
14
+ }
15
+
16
+ /**
17
+ * update un enregistrement dans la table prestationList
18
+ * @param { number } id
19
+ * @param { QueryCreatePrestations } data
20
+ * @returns { boolean }
21
+ */
22
+ update(id: number, data: QueryUpdatePrestations): Promise<boolean> {
23
+ return this.axios.$put(`prestations/${id}`, data);
24
+ }
25
+
26
+ /**
27
+ * update un enregistrement dans la table prestationList
28
+ * @param { QueryGetAllPrestations } data
29
+ * @returns { boolean }
30
+ */
31
+ getAll(params: QueryGetAllPrestations): Promise<IPrestationList[]> {
32
+ return this.axios.$get('prestations/all', { params });
33
+ }
34
+ }
@@ -19,4 +19,13 @@ export class Quotation extends Resource {
19
19
  getLast(idSociety: number): Promise<ICotation> {
20
20
  return this.axios.$get(`/quotation/${idSociety}`);
21
21
  }
22
+
23
+ /**
24
+ * Regénère la cotation d'une société donnée
25
+ * @param { number } idSociety
26
+ * @returns { ICotation }
27
+ */
28
+ regenerateQuotation(idSociety: number): Promise<ICotation> {
29
+ return this.axios.$post('/quotation/societies/quotations', { idSociety });
30
+ }
22
31
  }
@@ -119,6 +119,7 @@ import { VatRegimeHistory } from './resources/VatRegimeHistory';
119
119
  import { Acceptance } from './resources/Acceptance';
120
120
  import { Rating } from './resources/Rating';
121
121
  import { Quotation } from './resources/Quotation';
122
+ import { Prestations } from './resources/Prestations';
122
123
 
123
124
  export const resources = {
124
125
  simulation: Simulation,
@@ -242,4 +243,5 @@ export const resources = {
242
243
  rating: Rating,
243
244
  acceptance: Acceptance,
244
245
  quotation: Quotation,
246
+ prestations: Prestations,
245
247
  };
@@ -0,0 +1,25 @@
1
+ export enum AdminAcceptance {
2
+ BEING_ACCEPTED = 0,
3
+ ACCEPTED = 1,
4
+ TO_PROCESSED = 2,
5
+ REFUSED = 3,
6
+ }
7
+
8
+ export const AdminAcceptanceList: Array<{ id: AdminAcceptance; text: string }> = [
9
+ {
10
+ id: AdminAcceptance.BEING_ACCEPTED,
11
+ text: 'En cours d\'acceptation',
12
+ },
13
+ {
14
+ id: AdminAcceptance.ACCEPTED,
15
+ text: 'Accepté',
16
+ },
17
+ {
18
+ id: AdminAcceptance.TO_PROCESSED,
19
+ text: 'À traiter',
20
+ },
21
+ {
22
+ id: AdminAcceptance.REFUSED,
23
+ text: 'Refusé',
24
+ },
25
+ ];
@@ -707,6 +707,7 @@ export const BALANCE_SHEET_LIST_PASSIVE: BalanceSheetList = [
707
707
  },
708
708
  {
709
709
  name: 'TOTAL GENERAL (I+II+III+IV)',
710
+ key: 'total5',
710
711
  total: 0,
711
712
  calculation: true,
712
713
  calculationAdd: ['subscribedCapital', 'issuePremiums', 'equivalenceGap', 'revaluationGap', 'reservations', 'postponement', 'resultExercice', 'subsidies', 'subsidiesRegulated', 'provisions', 'debts', 'total4'],
@@ -5,9 +5,12 @@ export enum ConstitutionState {
5
5
  WAITING_INFORMATION_SHEET = 4,
6
6
  WAITING_DEPOSIT_CERTIFICATE = 5,
7
7
  WAITING_SIGNED_DOCS_OR_AL_PAYMENT_OR_COURT_FEES = 6,
8
+ // TODO : A delete une fois plus utilisé
9
+ // ========================
8
10
  WAITING_KBIS = 7,
9
11
  WAITING_RIB_OR_SEPA = 8,
10
12
  INVOICING_TO_D0 = 9,
13
+ // ========================
11
14
  ABANDONED_CASE = 10,
12
15
  }
13
16
 
@@ -22,7 +25,7 @@ export type ConstitutionStateType = {
22
25
  export const ConstitutionStateDetail: ConstitutionStateType = {
23
26
  TO_CONTACT: {
24
27
  value: ConstitutionState.TO_CONTACT,
25
- text: 'À contacter',
28
+ text: 'À contacter et à facturer',
26
29
  color: 'grey lighten-4',
27
30
  },
28
31
  WAITING_INFORMATION_SHEET: {
@@ -40,6 +43,8 @@ export const ConstitutionStateDetail: ConstitutionStateType = {
40
43
  text: 'Attente doc signés / paiement AL / frais de Greffe',
41
44
  color: 'blue lighten-4',
42
45
  },
46
+ // TODO : A delete une fois plus utilisé
47
+ // ========================================
43
48
  WAITING_KBIS: {
44
49
  value: ConstitutionState.WAITING_KBIS,
45
50
  text: 'Attente KBIS',
@@ -55,6 +60,7 @@ export const ConstitutionStateDetail: ConstitutionStateType = {
55
60
  text: 'Facturation à faire',
56
61
  color: 'primary lighten-2',
57
62
  },
63
+ // ========================================
58
64
  ABANDONED_CASE: {
59
65
  value: ConstitutionState.ABANDONED_CASE,
60
66
  text: 'Dossier en abandon',
@@ -67,7 +73,7 @@ export const ConstitutionStateDetail: ConstitutionStateType = {
67
73
  },
68
74
  FINISHED: {
69
75
  value: ConstitutionState.FINISHED,
70
- text: 'Dossier terminé',
76
+ text: 'Dossier Conforme (Envoi KBIS, information & documents et RIB pro)',
71
77
  color: 'success',
72
78
  },
73
79
  };
@@ -0,0 +1,25 @@
1
+ export enum PrestationListType {
2
+ ACCOUNTANT = 1,
3
+ JURIDIC = 2,
4
+ SOCIAL = 3,
5
+ ATTESTATION = 4,
6
+ }
7
+
8
+ export const PrestationListTypeDetail = [
9
+ {
10
+ id: PrestationListType.ACCOUNTANT,
11
+ label: 'Comptable',
12
+ },
13
+ {
14
+ id: PrestationListType.JURIDIC,
15
+ label: 'Juridique',
16
+ },
17
+ {
18
+ id: PrestationListType.SOCIAL,
19
+ label: 'Sociale',
20
+ },
21
+ {
22
+ id: PrestationListType.ATTESTATION,
23
+ label: 'Attestation',
24
+ },
25
+ ];
@@ -37,6 +37,7 @@ export interface ReadFormattedImmobilizationsByAccount {
37
37
  export type ReadImmobilizationWithDetails = FormattedImmobilization & {
38
38
  vatAmount: number;
39
39
  cessionEntries: IAccountingEntry[];
40
+ trashedEntries: IAccountingEntry[];
40
41
  shortTermValue: number;
41
42
  longTermValue: number;
42
43
  residualValue: number;
@@ -0,0 +1,91 @@
1
+ import {
2
+ IsOptional, IsNumber, IsString, IsBoolean,
3
+ } from 'class-validator';
4
+ import { ApiProperty, ApiPropertyOptional } from '../../../../utils';
5
+ import { ToBoolean } from '../../../../utils/transforms/boolean.transform';
6
+
7
+ export class QueryCreatePrestations {
8
+ @ApiProperty()
9
+ @IsString()
10
+ name: string;
11
+
12
+ @ApiPropertyOptional()
13
+ @IsNumber()
14
+ @IsOptional()
15
+ idFile?: number;
16
+
17
+ @ApiProperty()
18
+ @IsBoolean()
19
+ @ToBoolean()
20
+ isComptable: boolean;
21
+
22
+ @ApiProperty()
23
+ @IsBoolean()
24
+ @ToBoolean()
25
+ isJuridique: boolean;
26
+
27
+ @ApiProperty()
28
+ @IsBoolean()
29
+ @ToBoolean()
30
+ isSocial: boolean;
31
+
32
+ @ApiProperty()
33
+ @IsBoolean()
34
+ @ToBoolean()
35
+ isAttestation: boolean;
36
+
37
+ @ApiProperty()
38
+ @IsBoolean()
39
+ @ToBoolean()
40
+ inAverageCart: boolean;
41
+
42
+ @ApiProperty()
43
+ @IsBoolean()
44
+ @ToBoolean()
45
+ isBack: boolean;
46
+
47
+ @ApiPropertyOptional()
48
+ @IsNumber()
49
+ @IsOptional()
50
+ price?: number;
51
+
52
+ @ApiProperty()
53
+ @IsBoolean()
54
+ @ToBoolean()
55
+ isCatalog: boolean;
56
+
57
+ @ApiProperty()
58
+ @IsBoolean()
59
+ @ToBoolean()
60
+ hidden: boolean;
61
+
62
+ @ApiProperty()
63
+ @IsBoolean()
64
+ @ToBoolean()
65
+ isComplementary: boolean;
66
+
67
+ @ApiPropertyOptional()
68
+ @IsString()
69
+ @IsOptional()
70
+ signaturePosition?: string;
71
+
72
+ @ApiPropertyOptional()
73
+ @IsNumber()
74
+ @IsOptional()
75
+ signaturePage?: number;
76
+
77
+ @ApiPropertyOptional()
78
+ @IsString()
79
+ @IsOptional()
80
+ textDefault?: string;
81
+
82
+ @ApiPropertyOptional()
83
+ @IsString()
84
+ @IsOptional()
85
+ color?: string;
86
+
87
+ @ApiPropertyOptional()
88
+ @IsNumber()
89
+ @IsOptional()
90
+ point?: number;
91
+ }
@@ -0,0 +1,25 @@
1
+ import {
2
+ IsOptional, IsString, IsInt, IsIn, IsBoolean,
3
+ } from 'class-validator';
4
+ import { ApiPropertyOptional } from '../../../../utils';
5
+ import { PrestationListType } from '../../../Enum/PrestationListType';
6
+ import { ToBoolean } from '../../../../utils/transforms/boolean.transform';
7
+
8
+ export class QueryGetAllPrestations {
9
+ @ApiPropertyOptional()
10
+ @IsOptional()
11
+ @IsString()
12
+ search?: string;
13
+
14
+ @ApiPropertyOptional()
15
+ @IsOptional()
16
+ @IsInt()
17
+ @IsIn([PrestationListType.ACCOUNTANT, PrestationListType.JURIDIC, PrestationListType.SOCIAL, PrestationListType.ATTESTATION])
18
+ idType?: number;
19
+
20
+ @ApiPropertyOptional()
21
+ @IsOptional()
22
+ @IsBoolean()
23
+ @ToBoolean()
24
+ isHidden?: boolean;
25
+ }
@@ -0,0 +1,106 @@
1
+ import {
2
+ IsOptional, IsNumber, IsString, IsBoolean,
3
+ } from 'class-validator';
4
+ import { ApiPropertyOptional } from '../../../../utils';
5
+ import { ToBoolean } from '../../../../utils/transforms/boolean.transform';
6
+ import { TFile } from '../file/TFile';
7
+
8
+ export class QueryUpdatePrestations {
9
+ @ApiPropertyOptional()
10
+ @IsString()
11
+ @IsOptional()
12
+ name?: string;
13
+
14
+ @ApiPropertyOptional()
15
+ @IsNumber()
16
+ @IsOptional()
17
+ idFile?: number;
18
+
19
+ @ApiPropertyOptional()
20
+ @IsBoolean()
21
+ @ToBoolean()
22
+ @IsOptional()
23
+ isComptable?: boolean;
24
+
25
+ @ApiPropertyOptional()
26
+ @IsBoolean()
27
+ @ToBoolean()
28
+ @IsOptional()
29
+ isJuridique?: boolean;
30
+
31
+ @ApiPropertyOptional()
32
+ @IsBoolean()
33
+ @ToBoolean()
34
+ @IsOptional()
35
+ isSocial?: boolean;
36
+
37
+ @ApiPropertyOptional()
38
+ @IsBoolean()
39
+ @ToBoolean()
40
+ @IsOptional()
41
+ isAttestation?: boolean;
42
+
43
+ @ApiPropertyOptional()
44
+ @IsBoolean()
45
+ @ToBoolean()
46
+ @IsOptional()
47
+ inAverageCart?: boolean;
48
+
49
+ @ApiPropertyOptional()
50
+ @IsBoolean()
51
+ @ToBoolean()
52
+ @IsOptional()
53
+ isBack?: boolean;
54
+
55
+ @ApiPropertyOptional()
56
+ @IsNumber()
57
+ @IsOptional()
58
+ price?: number;
59
+
60
+ @ApiPropertyOptional()
61
+ @IsBoolean()
62
+ @ToBoolean()
63
+ @IsOptional()
64
+ isCatalog?: boolean;
65
+
66
+ @ApiPropertyOptional()
67
+ @IsBoolean()
68
+ @ToBoolean()
69
+ @IsOptional()
70
+ hidden?: boolean;
71
+
72
+ @ApiPropertyOptional()
73
+ @IsBoolean()
74
+ @ToBoolean()
75
+ @IsOptional()
76
+ isComplementary?: boolean;
77
+
78
+ @ApiPropertyOptional()
79
+ @IsString()
80
+ @IsOptional()
81
+ signaturePosition?: string;
82
+
83
+ @ApiPropertyOptional()
84
+ @IsNumber()
85
+ @IsOptional()
86
+ signaturePage?: number;
87
+
88
+ @ApiPropertyOptional()
89
+ @IsString()
90
+ @IsOptional()
91
+ textDefault?: string;
92
+
93
+ @ApiPropertyOptional()
94
+ @IsString()
95
+ @IsOptional()
96
+ color?: string;
97
+
98
+ @ApiPropertyOptional()
99
+ @IsNumber()
100
+ @IsOptional()
101
+ point?: number;
102
+
103
+ @ApiPropertyOptional()
104
+ @IsOptional()
105
+ files?: TFile[];
106
+ }
@@ -1,7 +1,10 @@
1
+ import { IFile } from './IFile';
2
+
1
3
  // prestationsList
2
4
  export interface IPrestationList {
3
5
  id?: number;
4
6
  name: string;
7
+ idFile?: number;
5
8
  isComptable: boolean;
6
9
  isJuridique: boolean;
7
10
  isSocial: boolean;
@@ -19,4 +22,6 @@ export interface IPrestationList {
19
22
  point?: number;
20
23
  createdAt?: Date | null;
21
24
  updatedAt?: Date | null;
25
+
26
+ file?: IFile;
22
27
  }
package/ts/types/index.ts CHANGED
@@ -477,7 +477,8 @@ export * from './Enum/MailDomainType';
477
477
  export * from './Enum/TextMessageType';
478
478
  export * from './Enum/JobTitle';
479
479
  export * from './Enum/Holidays';
480
-
480
+ export * from './Enum/AdminAcceptance';
481
+ export * from './Enum/PrestationListType';
481
482
  // Interfaces API
482
483
  export * from './Interface/api/partnerTransactionType/ReadPartnerTransactionType';
483
484
  export * from './Interface/api/jeDeclare/ReadJeDeclare';
@@ -884,6 +885,9 @@ export * from './Interface/api/rule/Read';
884
885
  export * from './Interface/api/revive/PostRevive';
885
886
  export * from './Interface/api/acceptance/CreateAcceptance';
886
887
  export * from './Interface/api/quotation/ReadClientQuotation';
888
+ export * from './Interface/api/prestations/QueryCreate';
889
+ export * from './Interface/api/prestations/QueryUpdate';
890
+ export * from './Interface/api/prestations/QueryGetAllPrestations';
887
891
 
888
892
  // Enums types
889
893
  export * from './Interface/enum/Util';
@@ -6,6 +6,7 @@ import { ISociety } from '../types/Interface/models/ISociety';
6
6
  import { ICotation } from '../types/Interface/models/ICotation';
7
7
  import {
8
8
  BasePaginate,
9
+ IPayment,
9
10
  IRating, IReport, ISocietyProceding, ReadClientQuotation,
10
11
  } from '../types';
11
12
 
@@ -133,7 +134,7 @@ export function getLeadQuotation(params: getLeadQuotationParams):number {
133
134
  }
134
135
 
135
136
  /* besoin en entré de la société concerné avec les différents imports (society), ainsi que la liste des autres sociétés ou l'owner est owner (otherSocieties) */
136
- export function getClientQuotation(society: ISociety, otherSocieties: ISociety[], lastNotice: BasePaginate<IRating>, unpaidDetails: [], reports: IReport[], societyProcedings: ISocietyProceding[], tabBankAccount: any): ReadClientQuotation {
137
+ export function getClientQuotation(society: ISociety, otherSocieties: ISociety[], lastNotice: BasePaginate<IRating>, unpaidDetails: [], reports: IReport[], societyProcedings: ISocietyProceding[], tabBankAccount: any, firstPaiement: IPayment[]): ReadClientQuotation {
137
138
  let quotationPositive = 0;
138
139
  let quotationNegative = 0;
139
140
  let quotation = 0;
@@ -154,7 +155,7 @@ export function getClientQuotation(society: ISociety, otherSocieties: ISociety[]
154
155
  };
155
156
 
156
157
  // calcul de l'ancienneté de la société
157
- const anciennete = dayjs().diff(dayjs(society.dateIsClient, 'YYYY-MM-DD'), 'years');
158
+ const anciennete = firstPaiement?.length > 0 ? dayjs().diff(dayjs(firstPaiement[0].datePayment, 'YYYY-MM-DD'), 'years') : 0;
158
159
  const ponderation = (anciennete * 0.1) + 1;
159
160
 
160
161
  /* Type de comptabilité du client (Tresorerie (+10) / Engagement (+15)) */
@@ -168,16 +169,15 @@ export function getClientQuotation(society: ISociety, otherSocieties: ISociety[]
168
169
  }
169
170
  }
170
171
 
171
- /* Ancienneté (1 ans < dateIsClient < 2 ans (+10) / 2 ans < dateIsClient (+15 / année)) */
172
- if (society.dateIsClient) {
173
- const yearAsClient = Number(new Date().getFullYear()) - Number(new Date(society.dateIsClient).getFullYear());
174
- if (yearAsClient > 0) {
172
+ /* Ancienneté (1 ans < firstPaiement < 2 ans (+10) / 2 ans < firstPaiement (+20 / année)) */
173
+ if (firstPaiement?.length > 0) {
174
+ const yearAsClient = Number(new Date().getFullYear()) - Number(new Date(firstPaiement[0].datePayment).getFullYear());
175
+ if (yearAsClient === 1) {
175
176
  quotationPositive += 10;
176
177
  detailQuotation.seniority += 10;
177
- if (yearAsClient > 1) {
178
- quotationPositive += 15 * (yearAsClient - 1);
179
- detailQuotation.seniority += 15 * (yearAsClient - 1);
180
- }
178
+ } else if (yearAsClient > 1) {
179
+ quotationPositive += (20 * (yearAsClient - 1) + 10);
180
+ detailQuotation.seniority += (20 * (yearAsClient - 1) + 10);
181
181
  }
182
182
  }
183
183