@silexpert/core 1.1.34 → 1.1.36

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 (256) hide show
  1. package/es/api/resources/AccountingFiles.d.ts +2 -1
  2. package/es/api/resources/AccountingFiles.d.ts.map +1 -1
  3. package/es/api/resources/AccountingFiles.js +3 -0
  4. package/es/api/resources/AccountingFiles.js.map +1 -1
  5. package/es/api/resources/Rule.d.ts +1 -0
  6. package/es/api/resources/Rule.d.ts.map +1 -1
  7. package/es/api/resources/Rule.js +3 -0
  8. package/es/api/resources/Rule.js.map +1 -1
  9. package/es/types/Enum/BrandLegalstart.js +20 -20
  10. package/es/types/Enum/BrandLegalstart.js.map +1 -1
  11. package/es/types/Enum/ConnectorType.d.ts +0 -1
  12. package/es/types/Enum/ConnectorType.d.ts.map +1 -1
  13. package/es/types/Enum/ConnectorType.js +1 -1
  14. package/es/types/Enum/ConnectorType.js.map +1 -1
  15. package/es/types/Enum/Unit.d.ts +2 -1
  16. package/es/types/Enum/Unit.d.ts.map +1 -1
  17. package/es/types/Enum/Unit.js +11 -0
  18. package/es/types/Enum/Unit.js.map +1 -1
  19. package/es/types/Interface/api/accountingFiles/Read.d.ts +6 -0
  20. package/es/types/Interface/api/accountingFiles/Read.d.ts.map +1 -0
  21. package/es/types/Interface/api/accountingFiles/Read.js +2 -0
  22. package/es/types/Interface/api/accountingFiles/Read.js.map +1 -0
  23. package/es/types/Interface/api/archive/ImportSocietyArchive.d.ts +1 -1
  24. package/es/types/Interface/api/archive/ImportSocietyArchive.d.ts.map +1 -1
  25. package/es/types/Interface/api/archive/ImportSocietyArchive.js +1 -1
  26. package/es/types/Interface/api/archive/ImportSocietyArchive.js.map +1 -1
  27. package/es/types/Interface/api/exercice/CreateExercice.d.ts +1 -0
  28. package/es/types/Interface/api/exercice/CreateExercice.d.ts.map +1 -1
  29. package/es/types/Interface/api/exercice/CreateExercice.js +7 -0
  30. package/es/types/Interface/api/exercice/CreateExercice.js.map +1 -1
  31. package/es/types/Interface/api/exercice/UpdateExercice.d.ts +1 -0
  32. package/es/types/Interface/api/exercice/UpdateExercice.d.ts.map +1 -1
  33. package/es/types/Interface/api/exercice/UpdateExercice.js +7 -0
  34. package/es/types/Interface/api/exercice/UpdateExercice.js.map +1 -1
  35. package/es/types/Interface/api/registration/ReadRegistration.d.ts +2 -2
  36. package/es/types/Interface/api/registration/ReadRegistration.d.ts.map +1 -1
  37. package/es/types/Interface/api/registration/ReadRegistration.js +2 -1
  38. package/es/types/Interface/api/registration/ReadRegistration.js.map +1 -1
  39. package/es/types/Interface/models/IAccountingEntry.d.ts +0 -2
  40. package/es/types/Interface/models/IAccountingEntry.d.ts.map +1 -1
  41. package/es/types/Interface/models/IAccountingEntry.js.map +1 -1
  42. package/es/types/Interface/models/IApiError.d.ts +1 -0
  43. package/es/types/Interface/models/IApiError.d.ts.map +1 -1
  44. package/es/types/Interface/models/IApiError.js +1 -0
  45. package/es/types/Interface/models/IApiError.js.map +1 -1
  46. package/es/types/Interface/models/ISociety.d.ts +0 -2
  47. package/es/types/Interface/models/ISociety.d.ts.map +1 -1
  48. package/es/types/Interface/models/ISociety.js.map +1 -1
  49. package/es/types/Interface/models/ISupervision.d.ts +0 -4
  50. package/es/types/Interface/models/ISupervision.d.ts.map +1 -1
  51. package/es/types/Interface/models/ISupervision.js.map +1 -1
  52. package/es/types/index.d.ts +1 -20
  53. package/es/types/index.d.ts.map +1 -1
  54. package/es/types/index.js +1 -20
  55. package/es/types/index.js.map +1 -1
  56. package/es/utils/vat/3310/century23.d.ts.map +1 -1
  57. package/es/utils/vat/3310/century23.js +31 -31
  58. package/es/utils/vat/3310/century23.js.map +1 -1
  59. package/es/utils/vat/3517/century23.d.ts.map +1 -1
  60. package/es/utils/vat/3517/century23.js +11 -11
  61. package/es/utils/vat/3517/century23.js.map +1 -1
  62. package/es/utils/vat/utils.d.ts +1 -0
  63. package/es/utils/vat/utils.d.ts.map +1 -1
  64. package/es/utils/vat/utils.js +3 -0
  65. package/es/utils/vat/utils.js.map +1 -1
  66. package/js/api/resources/AccountingFiles.js +3 -0
  67. package/js/api/resources/AccountingFiles.js.map +1 -1
  68. package/js/api/resources/Rule.js +3 -0
  69. package/js/api/resources/Rule.js.map +1 -1
  70. package/js/types/Enum/BrandLegalstart.js +20 -20
  71. package/js/types/Enum/BrandLegalstart.js.map +1 -1
  72. package/js/types/Enum/ConnectorType.js +1 -1
  73. package/js/types/Enum/ConnectorType.js.map +1 -1
  74. package/js/types/Enum/Unit.js +10 -0
  75. package/js/types/Enum/Unit.js.map +1 -1
  76. package/js/types/Interface/{models/IFaq.js → api/accountingFiles/Read.js} +1 -1
  77. package/js/types/Interface/api/accountingFiles/Read.js.map +1 -0
  78. package/js/types/Interface/api/archive/ImportSocietyArchive.js +1 -1
  79. package/js/types/Interface/api/archive/ImportSocietyArchive.js.map +1 -1
  80. package/js/types/Interface/api/exercice/CreateExercice.js +1 -0
  81. package/js/types/Interface/api/exercice/CreateExercice.js.map +1 -1
  82. package/js/types/Interface/api/exercice/UpdateExercice.js +1 -0
  83. package/js/types/Interface/api/exercice/UpdateExercice.js.map +1 -1
  84. package/js/types/Interface/api/registration/ReadRegistration.js +2 -0
  85. package/js/types/Interface/api/registration/ReadRegistration.js.map +1 -1
  86. package/js/types/Interface/models/IAccountingEntry.js.map +1 -1
  87. package/js/types/Interface/models/IApiError.js +1 -0
  88. package/js/types/Interface/models/IApiError.js.map +1 -1
  89. package/js/types/Interface/models/ISociety.js.map +1 -1
  90. package/js/types/Interface/models/ISupervision.js.map +1 -1
  91. package/js/types/index.js +34 -224
  92. package/js/types/index.js.map +1 -1
  93. package/js/utils/vat/3310/century23.js +25 -25
  94. package/js/utils/vat/3310/century23.js.map +1 -1
  95. package/js/utils/vat/3517/century23.js +10 -10
  96. package/js/utils/vat/3517/century23.js.map +1 -1
  97. package/js/utils/vat/utils.js +4 -0
  98. package/js/utils/vat/utils.js.map +1 -1
  99. package/package.json +1 -1
  100. package/ts/api/resources/AccountingFiles.ts +5 -1
  101. package/ts/api/resources/Rule.ts +4 -0
  102. package/ts/types/Enum/BrandLegalstart.ts +20 -20
  103. package/ts/types/Enum/ConnectorType.ts +1 -1
  104. package/ts/types/Enum/Unit.ts +11 -0
  105. package/ts/types/Interface/api/accountingFiles/Read.ts +6 -0
  106. package/ts/types/Interface/api/archive/ImportSocietyArchive.ts +1 -1
  107. package/ts/types/Interface/api/exercice/CreateExercice.ts +6 -0
  108. package/ts/types/Interface/api/exercice/UpdateExercice.ts +6 -0
  109. package/ts/types/Interface/api/registration/ReadRegistration.ts +4 -1
  110. package/ts/types/Interface/models/IAccountingEntry.ts +0 -2
  111. package/ts/types/Interface/models/IApiError.ts +1 -0
  112. package/ts/types/Interface/models/ISociety.ts +0 -2
  113. package/ts/types/Interface/models/ISupervision.ts +0 -4
  114. package/ts/types/index.ts +1 -20
  115. package/ts/utils/vat/3310/century23.ts +34 -32
  116. package/ts/utils/vat/3517/century23.ts +13 -11
  117. package/ts/utils/vat/utils.ts +4 -0
  118. package/es/types/Interface/models/IAccountingTransaction_new.d.ts +0 -18
  119. package/es/types/Interface/models/IAccountingTransaction_new.d.ts.map +0 -1
  120. package/es/types/Interface/models/IAccountingTransaction_new.js +0 -2
  121. package/es/types/Interface/models/IAccountingTransaction_new.js.map +0 -1
  122. package/es/types/Interface/models/IAutoLoginToken.d.ts +0 -10
  123. package/es/types/Interface/models/IAutoLoginToken.d.ts.map +0 -1
  124. package/es/types/Interface/models/IAutoLoginToken.js +0 -2
  125. package/es/types/Interface/models/IAutoLoginToken.js.map +0 -1
  126. package/es/types/Interface/models/IBankTransaction.d.ts +0 -34
  127. package/es/types/Interface/models/IBankTransaction.d.ts.map +0 -1
  128. package/es/types/Interface/models/IBankTransaction.js +0 -2
  129. package/es/types/Interface/models/IBankTransaction.js.map +0 -1
  130. package/es/types/Interface/models/ICallDirectly.d.ts +0 -26
  131. package/es/types/Interface/models/ICallDirectly.d.ts.map +0 -1
  132. package/es/types/Interface/models/ICallDirectly.js +0 -2
  133. package/es/types/Interface/models/ICallDirectly.js.map +0 -1
  134. package/es/types/Interface/models/IFaq.d.ts +0 -15
  135. package/es/types/Interface/models/IFaq.d.ts.map +0 -1
  136. package/es/types/Interface/models/IFaq.js +0 -2
  137. package/es/types/Interface/models/IFaq.js.map +0 -1
  138. package/es/types/Interface/models/IFaqCategory.d.ts +0 -5
  139. package/es/types/Interface/models/IFaqCategory.d.ts.map +0 -1
  140. package/es/types/Interface/models/IFaqCategory.js +0 -2
  141. package/es/types/Interface/models/IFaqCategory.js.map +0 -1
  142. package/es/types/Interface/models/IFollowedQualityMail.d.ts +0 -13
  143. package/es/types/Interface/models/IFollowedQualityMail.d.ts.map +0 -1
  144. package/es/types/Interface/models/IFollowedQualityMail.js +0 -2
  145. package/es/types/Interface/models/IFollowedQualityMail.js.map +0 -1
  146. package/es/types/Interface/models/IFollowedQualityMailType.d.ts +0 -7
  147. package/es/types/Interface/models/IFollowedQualityMailType.d.ts.map +0 -1
  148. package/es/types/Interface/models/IFollowedQualityMailType.js +0 -2
  149. package/es/types/Interface/models/IFollowedQualityMailType.js.map +0 -1
  150. package/es/types/Interface/models/IIdentification.d.ts +0 -18
  151. package/es/types/Interface/models/IIdentification.d.ts.map +0 -1
  152. package/es/types/Interface/models/IIdentification.js +0 -2
  153. package/es/types/Interface/models/IIdentification.js.map +0 -1
  154. package/es/types/Interface/models/IJob.d.ts +0 -12
  155. package/es/types/Interface/models/IJob.d.ts.map +0 -1
  156. package/es/types/Interface/models/IJob.js +0 -2
  157. package/es/types/Interface/models/IJob.js.map +0 -1
  158. package/es/types/Interface/models/IJobCategory.d.ts +0 -9
  159. package/es/types/Interface/models/IJobCategory.d.ts.map +0 -1
  160. package/es/types/Interface/models/IJobCategory.js +0 -2
  161. package/es/types/Interface/models/IJobCategory.js.map +0 -1
  162. package/es/types/Interface/models/IPenalty.d.ts +0 -27
  163. package/es/types/Interface/models/IPenalty.d.ts.map +0 -1
  164. package/es/types/Interface/models/IPenalty.js +0 -2
  165. package/es/types/Interface/models/IPenalty.js.map +0 -1
  166. package/es/types/Interface/models/IPenaltyType.d.ts +0 -7
  167. package/es/types/Interface/models/IPenaltyType.d.ts.map +0 -1
  168. package/es/types/Interface/models/IPenaltyType.js +0 -2
  169. package/es/types/Interface/models/IPenaltyType.js.map +0 -1
  170. package/es/types/Interface/models/ISuggestion.d.ts +0 -14
  171. package/es/types/Interface/models/ISuggestion.d.ts.map +0 -1
  172. package/es/types/Interface/models/ISuggestion.js +0 -2
  173. package/es/types/Interface/models/ISuggestion.js.map +0 -1
  174. package/es/types/Interface/models/ISupervisionJob.d.ts +0 -8
  175. package/es/types/Interface/models/ISupervisionJob.d.ts.map +0 -1
  176. package/es/types/Interface/models/ISupervisionJob.js +0 -2
  177. package/es/types/Interface/models/ISupervisionJob.js.map +0 -1
  178. package/es/types/Interface/models/ITmpValidationToken.d.ts +0 -11
  179. package/es/types/Interface/models/ITmpValidationToken.d.ts.map +0 -1
  180. package/es/types/Interface/models/ITmpValidationToken.js +0 -2
  181. package/es/types/Interface/models/ITmpValidationToken.js.map +0 -1
  182. package/es/types/Interface/models/IUserSocietyTicketSupport.d.ts +0 -9
  183. package/es/types/Interface/models/IUserSocietyTicketSupport.d.ts.map +0 -1
  184. package/es/types/Interface/models/IUserSocietyTicketSupport.js +0 -2
  185. package/es/types/Interface/models/IUserSocietyTicketSupport.js.map +0 -1
  186. package/es/types/Interface/models/IVatMargin.d.ts +0 -7
  187. package/es/types/Interface/models/IVatMargin.d.ts.map +0 -1
  188. package/es/types/Interface/models/IVatMargin.js +0 -2
  189. package/es/types/Interface/models/IVatMargin.js.map +0 -1
  190. package/es/types/Interface/models/IWebMailSpam.d.ts +0 -8
  191. package/es/types/Interface/models/IWebMailSpam.d.ts.map +0 -1
  192. package/es/types/Interface/models/IWebMailSpam.js +0 -2
  193. package/es/types/Interface/models/IWebMailSpam.js.map +0 -1
  194. package/es/types/Interface/models/IWebMailSpamType.d.ts +0 -7
  195. package/es/types/Interface/models/IWebMailSpamType.d.ts.map +0 -1
  196. package/es/types/Interface/models/IWebMailSpamType.js +0 -2
  197. package/es/types/Interface/models/IWebMailSpamType.js.map +0 -1
  198. package/js/types/Interface/models/IAccountingTransaction_new.js +0 -6
  199. package/js/types/Interface/models/IAccountingTransaction_new.js.map +0 -1
  200. package/js/types/Interface/models/IAutoLoginToken.js +0 -6
  201. package/js/types/Interface/models/IAutoLoginToken.js.map +0 -1
  202. package/js/types/Interface/models/IBankTransaction.js +0 -6
  203. package/js/types/Interface/models/IBankTransaction.js.map +0 -1
  204. package/js/types/Interface/models/ICallDirectly.js +0 -6
  205. package/js/types/Interface/models/ICallDirectly.js.map +0 -1
  206. package/js/types/Interface/models/IFaq.js.map +0 -1
  207. package/js/types/Interface/models/IFaqCategory.js +0 -6
  208. package/js/types/Interface/models/IFaqCategory.js.map +0 -1
  209. package/js/types/Interface/models/IFollowedQualityMail.js +0 -6
  210. package/js/types/Interface/models/IFollowedQualityMail.js.map +0 -1
  211. package/js/types/Interface/models/IFollowedQualityMailType.js +0 -6
  212. package/js/types/Interface/models/IFollowedQualityMailType.js.map +0 -1
  213. package/js/types/Interface/models/IIdentification.js +0 -6
  214. package/js/types/Interface/models/IIdentification.js.map +0 -1
  215. package/js/types/Interface/models/IJob.js +0 -6
  216. package/js/types/Interface/models/IJob.js.map +0 -1
  217. package/js/types/Interface/models/IJobCategory.js +0 -6
  218. package/js/types/Interface/models/IJobCategory.js.map +0 -1
  219. package/js/types/Interface/models/IPenalty.js +0 -6
  220. package/js/types/Interface/models/IPenalty.js.map +0 -1
  221. package/js/types/Interface/models/IPenaltyType.js +0 -6
  222. package/js/types/Interface/models/IPenaltyType.js.map +0 -1
  223. package/js/types/Interface/models/ISuggestion.js +0 -6
  224. package/js/types/Interface/models/ISuggestion.js.map +0 -1
  225. package/js/types/Interface/models/ISupervisionJob.js +0 -6
  226. package/js/types/Interface/models/ISupervisionJob.js.map +0 -1
  227. package/js/types/Interface/models/ITmpValidationToken.js +0 -6
  228. package/js/types/Interface/models/ITmpValidationToken.js.map +0 -1
  229. package/js/types/Interface/models/IUserSocietyTicketSupport.js +0 -6
  230. package/js/types/Interface/models/IUserSocietyTicketSupport.js.map +0 -1
  231. package/js/types/Interface/models/IVatMargin.js +0 -6
  232. package/js/types/Interface/models/IVatMargin.js.map +0 -1
  233. package/js/types/Interface/models/IWebMailSpam.js +0 -6
  234. package/js/types/Interface/models/IWebMailSpam.js.map +0 -1
  235. package/js/types/Interface/models/IWebMailSpamType.js +0 -6
  236. package/js/types/Interface/models/IWebMailSpamType.js.map +0 -1
  237. package/ts/types/Interface/models/IAccountingTransaction_new.ts +0 -20
  238. package/ts/types/Interface/models/IAutoLoginToken.ts +0 -10
  239. package/ts/types/Interface/models/IBankTransaction.ts +0 -37
  240. package/ts/types/Interface/models/ICallDirectly.ts +0 -29
  241. package/ts/types/Interface/models/IFaq.ts +0 -18
  242. package/ts/types/Interface/models/IFaqCategory.ts +0 -5
  243. package/ts/types/Interface/models/IFollowedQualityMail.ts +0 -16
  244. package/ts/types/Interface/models/IFollowedQualityMailType.ts +0 -7
  245. package/ts/types/Interface/models/IIdentification.ts +0 -21
  246. package/ts/types/Interface/models/IJob.ts +0 -15
  247. package/ts/types/Interface/models/IJobCategory.ts +0 -12
  248. package/ts/types/Interface/models/IPenalty.ts +0 -30
  249. package/ts/types/Interface/models/IPenaltyType.ts +0 -7
  250. package/ts/types/Interface/models/ISuggestion.ts +0 -17
  251. package/ts/types/Interface/models/ISupervisionJob.ts +0 -8
  252. package/ts/types/Interface/models/ITmpValidationToken.ts +0 -14
  253. package/ts/types/Interface/models/IUserSocietyTicketSupport.ts +0 -9
  254. package/ts/types/Interface/models/IVatMargin.ts +0 -7
  255. package/ts/types/Interface/models/IWebMailSpam.ts +0 -8
  256. package/ts/types/Interface/models/IWebMailSpamType.ts +0 -7
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getAmountByAccountNumber = getAmountByAccountNumber;
7
+ exports.setZeroIfIsNegative = setZeroIfIsNegative;
7
8
  exports.getTaxAmountByAccountNumber = getTaxAmountByAccountNumber;
8
9
  exports.textFormatting = textFormatting;
9
10
  var _lodash = require("lodash");
@@ -23,6 +24,9 @@ function getAmountByAccountNumber(accountingEntries, accountsNumber, precision =
23
24
  }, 0), precision);
24
25
  return isAbs ? Math.abs(result) : result;
25
26
  }
27
+ function setZeroIfIsNegative(value) {
28
+ return value < 0 ? 0 : value;
29
+ }
26
30
  function getTaxAmountByAccountNumber(accountingEntries, accountsNumber, precision = 0) {
27
31
  const accountingEntriesUniq = (0, _lodash.uniqBy)(accountingEntries, 'id');
28
32
  return (0, _lodash.round)(accountingEntriesUniq.reduce((acc, accountingEntry) => {
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","names":["getAmountByAccountNumber","exports","getTaxAmountByAccountNumber","textFormatting","_lodash","require","_Vat","accountingEntries","accountsNumber","precision","isAbs","accountingEntriesUniq","_uniqBy","result","_round","reduce","acc","accountingEntry","accTmp","some","number","account","toString","startsWith","debit","credit","Math","abs","_b","_a","Object","values","Vat","find","v","id","idVat","value","length","formattedValue","replace","slice"],"sources":["../../../ts/utils/vat/utils.ts"],"sourcesContent":["import { round as _round, uniqBy as _uniqBy } from 'lodash';\nimport { IAccountingEntry } from '../../types/Interface/models/IAccountingEntry';\nimport { Vat } from '../../types/Enum/Vat';\n\nexport function getAmountByAccountNumber(accountingEntries: IAccountingEntry[], accountsNumber: string[], precision = 0, isAbs = false): number {\n const accountingEntriesUniq = _uniqBy(accountingEntries, 'id');\n const result = _round(accountingEntriesUniq.reduce((acc, accountingEntry) => {\n let accTmp = acc;\n accountsNumber.some((number) => {\n if (accountingEntry.account && accountingEntry.account.number && accountingEntry.account.number.toString().startsWith(number)) {\n accTmp += accountingEntry.debit - accountingEntry.credit;\n return true;\n }\n return false;\n });\n return accTmp;\n }, 0), precision);\n return isAbs ? Math.abs(result) : result;\n}\n\nexport function getTaxAmountByAccountNumber(accountingEntries: IAccountingEntry[], accountsNumber: string[], precision = 0): number {\n const accountingEntriesUniq = _uniqBy(accountingEntries, 'id');\n return _round(accountingEntriesUniq.reduce((acc, accountingEntry) => {\n let accTmp = acc;\n accountsNumber.some((number) => {\n if (accountingEntry.account && accountingEntry.account.number && accountingEntry.account.number.toString().startsWith(number)) {\n accTmp += ((accountingEntry.debit - accountingEntry.credit) * (((Object.values(Vat).find((v) => v.id === accountingEntry.idVat)?.value ?? 0) / 100)));\n return true;\n }\n return false;\n });\n return accTmp;\n }, precision));\n}\n\nexport function textFormatting(value: any, length: number | null = null): string | null {\n if (value && typeof value === 'string') {\n let formattedValue = value.replace(/[\\u2018\\u2019]/g, '\\''); // Suppression des \"Curly Quotes\"\n formattedValue = formattedValue.replace(/&/g, ''); // Suppression des &\n formattedValue = formattedValue.replace(/!/g, ''); // Suppression des !\n formattedValue = formattedValue.replace(/[\\t]/g, ''); // Suppression des tabulations\n formattedValue = formattedValue.replace(/`/g, '\\''); // Suppression des `\n formattedValue = formattedValue.replace(/\"/g, ''); // Suppression des \"\n formattedValue = formattedValue.replace(/^ */, ''); // Suppression des espaces de début\n formattedValue = formattedValue.replace(/ *$/, ''); // Suppression des espaces de fin\n if (length) formattedValue = formattedValue.slice(0, length);\n return formattedValue;\n }\n return null;\n}"],"mappings":"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"}
1
+ {"version":3,"file":"utils.js","names":["getAmountByAccountNumber","exports","setZeroIfIsNegative","getTaxAmountByAccountNumber","textFormatting","_lodash","require","_Vat","accountingEntries","accountsNumber","precision","isAbs","accountingEntriesUniq","_uniqBy","result","_round","reduce","acc","accountingEntry","accTmp","some","number","account","toString","startsWith","debit","credit","Math","abs","value","_b","_a","Object","values","Vat","find","v","id","idVat","length","formattedValue","replace","slice"],"sources":["../../../ts/utils/vat/utils.ts"],"sourcesContent":["import { round as _round, uniqBy as _uniqBy } from 'lodash';\nimport { IAccountingEntry } from '../../types/Interface/models/IAccountingEntry';\nimport { Vat } from '../../types/Enum/Vat';\n\nexport function getAmountByAccountNumber(accountingEntries: IAccountingEntry[], accountsNumber: string[], precision = 0, isAbs = false): number {\n const accountingEntriesUniq = _uniqBy(accountingEntries, 'id');\n const result = _round(accountingEntriesUniq.reduce((acc, accountingEntry) => {\n let accTmp = acc;\n accountsNumber.some((number) => {\n if (accountingEntry.account && accountingEntry.account.number && accountingEntry.account.number.toString().startsWith(number)) {\n accTmp += accountingEntry.debit - accountingEntry.credit;\n return true;\n }\n return false;\n });\n return accTmp;\n }, 0), precision);\n return isAbs ? Math.abs(result) : result;\n}\n\nexport function setZeroIfIsNegative(value: number): number {\n return value < 0 ? 0 : value;\n}\n\nexport function getTaxAmountByAccountNumber(accountingEntries: IAccountingEntry[], accountsNumber: string[], precision = 0): number {\n const accountingEntriesUniq = _uniqBy(accountingEntries, 'id');\n return _round(accountingEntriesUniq.reduce((acc, accountingEntry) => {\n let accTmp = acc;\n accountsNumber.some((number) => {\n if (accountingEntry.account && accountingEntry.account.number && accountingEntry.account.number.toString().startsWith(number)) {\n accTmp += ((accountingEntry.debit - accountingEntry.credit) * (((Object.values(Vat).find((v) => v.id === accountingEntry.idVat)?.value ?? 0) / 100)));\n return true;\n }\n return false;\n });\n return accTmp;\n }, precision));\n}\n\nexport function textFormatting(value: any, length: number | null = null): string | null {\n if (value && typeof value === 'string') {\n let formattedValue = value.replace(/[\\u2018\\u2019]/g, '\\''); // Suppression des \"Curly Quotes\"\n formattedValue = formattedValue.replace(/&/g, ''); // Suppression des &\n formattedValue = formattedValue.replace(/!/g, ''); // Suppression des !\n formattedValue = formattedValue.replace(/[\\t]/g, ''); // Suppression des tabulations\n formattedValue = formattedValue.replace(/`/g, '\\''); // Suppression des `\n formattedValue = formattedValue.replace(/\"/g, ''); // Suppression des \"\n formattedValue = formattedValue.replace(/^ */, ''); // Suppression des espaces de début\n formattedValue = formattedValue.replace(/ *$/, ''); // Suppression des espaces de fin\n if (length) formattedValue = formattedValue.slice(0, length);\n return formattedValue;\n }\n return null;\n}"],"mappings":"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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@silexpert/core",
3
- "version": "1.1.34",
3
+ "version": "1.1.36",
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",
@@ -1,6 +1,6 @@
1
1
  import { Resource } from '../Resource';
2
2
  import {
3
- BasePaginate, IAccountingFile, QueryAccountingFiles, QueryTransaction, ReadFormattedAccountingTransaction,
3
+ BasePaginate, IAccountingFile, QueryAccountingFiles, QueryTransaction, ReadFormattedAccountingTransaction, ReadUpdateAccouningFile,
4
4
  } from '../../types';
5
5
 
6
6
  export class AccountingFiles extends Resource {
@@ -29,4 +29,8 @@ export class AccountingFiles extends Resource {
29
29
  getPaginated(idSociety: number, params: QueryTransaction): Promise<BasePaginate<IAccountingFile>> {
30
30
  return this.axios.$get(`/society/${idSociety}/accountingFiles`, { params });
31
31
  }
32
+
33
+ update(id:number, payload: Partial<IAccountingFile>): Promise<ReadUpdateAccouningFile> {
34
+ return this.axios.$put(`/accounting-files/${id}`, payload);
35
+ }
32
36
  }
@@ -21,4 +21,8 @@ export class Rule extends Resource {
21
21
  update(idRule: number, params: UpdateRule): Promise<IRule> {
22
22
  return this.axios.$post(`rules/${idRule}`, params);
23
23
  }
24
+
25
+ delete(idRule: number): Promise<number> {
26
+ return this.axios.$delete(`rules/${idRule}`);
27
+ }
24
28
  }
@@ -13,23 +13,23 @@ export const BrandLegalstart = [
13
13
  juridique: '01 76 39 00 60',
14
14
  },
15
15
  listMails: {
16
- administratif: 'comptastart@legalstart.fr',
17
- app: 'comptastart@legalstart.fr',
18
- bonjour: 'comptastart@legalstart.fr',
19
- contact: 'comptastart@legalstart.fr',
20
- facturation: 'comptastart@legalstart.fr',
21
- feedback: 'comptastart@legalstart.fr',
22
- juridique: 'comptastart@legalstart.fr',
23
- informatique: 'comptastart@legalstart.fr',
24
- msd: 'comptastart@legalstart.fr',
25
- noreply: 'comptastart@legalstart.fr',
26
- qualite: 'comptastart@legalstart.fr',
27
- paiement: 'comptastart@legalstart.fr',
28
- rh: 'comptastart@legalstart.fr',
29
- social: 'comptastart@legalstart.fr',
30
- support: 'comptastart@legalstart.fr',
31
- tva: 'comptastart@legalstart.fr',
32
- wb: 'comptastart@legalstart.fr',
16
+ administratif: 'comptastart@comptastartbyclementine.fr',
17
+ app: 'comptastart@comptastartbyclementine.fr',
18
+ bonjour: 'bonjour@comptastartbyclementine.fr',
19
+ contact: 'contact@comptastartbyclementine.fr',
20
+ facturation: 'facturation@comptastartbyclementine.fr',
21
+ feedback: 'comptastart@comptastartbyclementine.fr',
22
+ juridique: 'juridique@comptastartbyclementine.fr',
23
+ informatique: 'informatique@comptastartbyclementine.fr',
24
+ msd: 'comptastart@comptastartbyclementine.fr',
25
+ noreply: 'noreply@comptastartbyclementine.fr',
26
+ qualite: 'comptastart@comptastartbyclementine.fr',
27
+ paiement: 'comptastart@comptastartbyclementine.fr',
28
+ rh: 'comptastart@comptastartbyclementine.fr',
29
+ social: 'social@comptastartbyclementine.fr',
30
+ support: 'comptastart@comptastartbyclementine.fr',
31
+ tva: 'comptastart@comptastartbyclementine.fr',
32
+ wb: 'comptastart@comptastartbyclementine.fr',
33
33
  },
34
34
  companyInformation: {
35
35
  ape: '6920Z',
@@ -54,7 +54,7 @@ export const BrandLegalstart = [
54
54
  urlApi1: 'https://api-legalstart.compta-clementine.fr',
55
55
  urlApi2: 'https://api-next-legalstart.compta-clementine.fr',
56
56
  urlExpert: 'https://pro.comptalib.com',
57
- urlClient: 'https://www.pourcentage.fr',
57
+ urlClient: 'https://clementine.fr',
58
58
  bank: {
59
59
  IBAN: 'FR7616106840138646838239863',
60
60
  BIC: 'AGRIFRPP861',
@@ -74,10 +74,10 @@ export const BrandLegalstart = [
74
74
  rcs: '752 566 687',
75
75
  phone: '03 83 93 14 14',
76
76
  vatIntracom: 'FR47752566687',
77
- email: 'facturation@compta-clementine.fr',
77
+ email: 'facturation@comptastartbyclementine.fr',
78
78
  },
79
79
  webmail: {
80
- domain: '@legalstart.fr',
80
+ domain: '@comptastartbyclementine.fr',
81
81
  },
82
82
  offices: {
83
83
  LAXOU: {
@@ -6,7 +6,7 @@ export enum ConnectorType {
6
6
  STRIPE_CONNECT = 5,
7
7
  STRIPE = 6,
8
8
  JS = 7,
9
- AUTOLOGIN = 8,
9
+ // AUTOLOGIN = 8,
10
10
  SHOPIFY = 9,
11
11
  WOOCOMMERCE = 10,
12
12
  ACTIVATION = 11,
@@ -26,6 +26,7 @@ export enum UnitId {
26
26
  SUBSCRIPTION = 17,
27
27
  NIGHT = 18,
28
28
  TON = 19,
29
+ HECTARE = 20,
29
30
  }
30
31
 
31
32
  export type IUnitList = Array<{ name: string; id: number; shortName: string; }>;
@@ -126,6 +127,11 @@ export const Unit: IUnit = {
126
127
  name: 'Tonne',
127
128
  shortName: 't',
128
129
  },
130
+ HECTARE: {
131
+ id: UnitId.HECTARE,
132
+ name: 'Hectare',
133
+ shortName: 'ha',
134
+ },
129
135
  };
130
136
 
131
137
  export const UnitList = [
@@ -224,4 +230,9 @@ export const UnitList = [
224
230
  name: 'Tonne',
225
231
  shortName: 't',
226
232
  },
233
+ {
234
+ id: UnitId.HECTARE,
235
+ name: 'Hectare',
236
+ shortName: 'ha',
237
+ },
227
238
  ];
@@ -0,0 +1,6 @@
1
+ import { IAccountingFile } from '../../models/IAccountingFile';
2
+
3
+ export interface ReadUpdateAccouningFile {
4
+ newAf: IAccountingFile,
5
+ hasEstimateBeenUpdated: boolean
6
+ }
@@ -4,5 +4,5 @@ import { ApiPropertyOptional } from '../../../../utils';
4
4
  export class ImportSocietyArchive {
5
5
  @ApiPropertyOptional()
6
6
  @IsOptional()
7
- sourceBucket: string | null;
7
+ idSocietyAlreadyExist: number | null;
8
8
  }
@@ -77,4 +77,10 @@ export class CreateExercice {
77
77
  @IsNumber()
78
78
  @IsOptional()
79
79
  idSociety: number;
80
+
81
+ @ApiPropertyOptional()
82
+ @IsBoolean()
83
+ @ToBoolean()
84
+ @IsOptional()
85
+ isDefault?: boolean;
80
86
  }
@@ -83,4 +83,10 @@ export class UpdateExercice {
83
83
  @IsNumber()
84
84
  @IsOptional()
85
85
  benefit?: number;
86
+
87
+ @ApiPropertyOptional()
88
+ @IsBoolean()
89
+ @ToBoolean()
90
+ @IsOptional()
91
+ isDefault?: boolean;
86
92
  }
@@ -39,6 +39,9 @@ export interface ReadVatEntry {
39
39
  entry?: IAccountingEntry
40
40
  }
41
41
 
42
- export type UpdatedAnnotationObject = { old: IAccountingEntry[]; new: IAccountingEntry[] };
42
+ export class UpdatedAnnotationObject {
43
+ old: IAccountingEntry[];
44
+ new: IAccountingEntry[];
45
+ }
43
46
 
44
47
  export type UpdatedAnnotation = UpdatedAnnotationObject[];
@@ -3,7 +3,6 @@ import { IThirdParty } from './IThirdParty';
3
3
  import { IAccountingTransaction } from './IAccountingTransaction';
4
4
  import { IVat } from './IVat';
5
5
  import { IImmobilization } from './IImmobilization';
6
- import { ISuggestion } from './ISuggestion';
7
6
 
8
7
  // accountingEntries
9
8
  export interface IAccountingEntry {
@@ -34,5 +33,4 @@ export interface IAccountingEntry {
34
33
  accountingTransaction?: IAccountingTransaction;
35
34
  vat?: IVat;
36
35
  immobilization?: IImmobilization;
37
- suggestions?: ISuggestion[];
38
36
  }
@@ -179,6 +179,7 @@ export enum Code {
179
179
  INVALID_BRAND = 'invalid_brand',
180
180
  INVALID_DAY = 'invalid_day',
181
181
  ENTITY_ALREADY_EXIST = 'entity_already_exist',
182
+ ENTITY_USED = 'entity_used',
182
183
 
183
184
  // Gescom
184
185
  CAN_NOT_DELETE_DOCUMENT = 'can_not_delete_document',
@@ -4,7 +4,6 @@ import { IThirdParty } from './IThirdParty';
4
4
  import { IReport } from './IReport';
5
5
  import { IConnector } from './IConnector';
6
6
  import { IBankConnection } from './IBankConnection';
7
- import { IFollowedQualityMail } from './IFollowedQualityMail';
8
7
  import { IFollow } from './IFollow';
9
8
  import { IPaymentExpectation } from './IPaymentExpectation';
10
9
  import { ILegalForm } from './ILegalForm';
@@ -165,7 +164,6 @@ export interface ISociety {
165
164
  reports?: IReport[];
166
165
  connectors?: IConnector[];
167
166
  bankConnections?: IBankConnection[];
168
- societiesFollowedQualityMail?: IFollowedQualityMail[];
169
167
  societyConfigBalanceSheet?: ISocietyConfigBalanceSheet[];
170
168
  societyFollow?: IFollow[];
171
169
  paymentsExpectations?: IPaymentExpectation[];
@@ -1,10 +1,8 @@
1
1
  import { IExercice } from './IExercice';
2
- import { ISupervisionJob } from './ISupervisionJob';
3
2
  import { IUser } from './IUser';
4
3
  import { IBalanceSheet } from './IBalanceSheet';
5
4
  import { IFile } from './IFile';
6
5
  import { IPendingPoint } from './IPendingPoint';
7
- import { IJob } from './IJob';
8
6
  import { ILetter } from './ILetter';
9
7
 
10
8
  // supervisions
@@ -28,7 +26,6 @@ export interface ISupervision {
28
26
 
29
27
  // Associations
30
28
  exercice: IExercice;
31
- supervisionsToJobs: ISupervisionJob[];
32
29
  supervisionUsers: IUser;
33
30
  supervisionExpertUsers: IUser;
34
31
  supervisionAccountant: IUser;
@@ -36,5 +33,4 @@ export interface ISupervision {
36
33
  file: IFile;
37
34
  letter: ILetter;
38
35
  pendingPoints: IPendingPoint[];
39
- jobs: IJob[];
40
36
  }
package/ts/types/index.ts CHANGED
@@ -25,7 +25,6 @@ export * from './Interface/models/IAbsenceRequestTime';
25
25
  export * from './Interface/models/IAttachmentFile';
26
26
  export * from './Interface/models/IAttestation';
27
27
  export * from './Interface/models/IAttributionHistory';
28
- export * from './Interface/models/IAutoLoginToken';
29
28
  export * from './Interface/models/IBalanceBankAccount';
30
29
  export * from './Interface/models/IBalanceSheet';
31
30
  export * from './Interface/models/IAccountingStatementHistory';
@@ -33,12 +32,10 @@ export * from './Interface/models/IBankAccountSynchroHistory';
33
32
  export * from './Interface/models/IBankAccount';
34
33
  export * from './Interface/models/IBankConnection';
35
34
  export * from './Interface/models/IBankList';
36
- export * from './Interface/models/IBankTransaction';
37
35
  export * from './Interface/models/IBusinessLine';
38
36
  export * from './Interface/models/IBusinessPartner';
39
37
  export * from './Interface/models/ICalendarEvent';
40
38
  export * from './Interface/models/ICalendarEventUser';
41
- export * from './Interface/models/ICallDirectly';
42
39
  export * from './Interface/models/ICategory';
43
40
  export * from './Interface/models/ICerfaType';
44
41
  export * from './Interface/models/ICerfaValue';
@@ -71,14 +68,11 @@ export * from './Interface/models/IExerciceComment';
71
68
  export * from './Interface/models/IExercice';
72
69
  export * from './Interface/models/IExercicePrestation';
73
70
  export * from './Interface/models/IFailedLoginAttempt';
74
- export * from './Interface/models/IFaqCategory';
75
- export * from './Interface/models/IFaq';
76
71
  export * from './Interface/models/IFileType';
77
72
  export * from './Interface/models/IFile';
78
73
  export * from './Interface/models/IFileMissing';
79
74
  export * from './Interface/models/IFiscalRegime';
80
75
  export * from './Interface/models/IFolderFile';
81
- export * from './Interface/models/IFollowedQualityMail';
82
76
  export * from './Interface/models/IFollow';
83
77
  export * from './Interface/models/IFollowList';
84
78
  export * from './Interface/models/IFormalismValue';
@@ -88,14 +82,11 @@ export * from './Interface/models/IFuel';
88
82
  export * from './Interface/models/IGedCategory';
89
83
  export * from './Interface/models/IGedFile';
90
84
  export * from './Interface/models/IGedFolder';
91
- export * from './Interface/models/IIdentification';
92
85
  export * from './Interface/models/IIndependentReview';
93
86
  export * from './Interface/models/IInternalEstimate';
94
87
  export * from './Interface/models/IIpTmpBlocked';
95
88
  export * from './Interface/models/IProductInvoice';
96
- export * from './Interface/models/IJobCategory';
97
89
  export * from './Interface/models/IImmobilization';
98
- export * from './Interface/models/IJob';
99
90
  export * from './Interface/models/IKilometricAllowanceScale';
100
91
  export * from './Interface/models/ILabelPaymentWaiting';
101
92
  export * from './Interface/models/ILegalForm';
@@ -132,7 +123,6 @@ export * from './Interface/models/IPaymentExpectation';
132
123
  export * from './Interface/models/IPaymentExpectationCustomer';
133
124
  export * from './Interface/models/IPaymentMethod';
134
125
  export * from './Interface/models/IPaymentWaiting';
135
- export * from './Interface/models/IPenalty';
136
126
  export * from './Interface/models/IPendingPoint';
137
127
  export * from './Interface/models/IPermission';
138
128
  export * from './Interface/models/IPhoneNumber';
@@ -207,7 +197,6 @@ export * from './Interface/models/ISponsorshipCheck';
207
197
  export * from './Interface/models/IStatusSignature';
208
198
  export * from './Interface/models/IStripeEvent';
209
199
  export * from './Interface/models/ISupervision';
210
- export * from './Interface/models/ISupervisionJob';
211
200
  export * from './Interface/models/ISupervisionPendingPoint';
212
201
  export * from './Interface/models/ISurvey';
213
202
  export * from './Interface/models/ITag';
@@ -221,9 +210,7 @@ export * from './Interface/models/IThirdParty';
221
210
  export * from './Interface/models/IThirdPartySociety';
222
211
  export * from './Interface/models/ITimeTracking';
223
212
  export * from './Interface/models/ITimeTrackingSource';
224
- export * from './Interface/models/ITmpValidationToken';
225
213
  export * from './Interface/models/IAccountantTracker';
226
- export * from './Interface/models/IVatMargin';
227
214
  export * from './Interface/models/IVatRegime';
228
215
  export * from './Interface/models/IVat';
229
216
  export * from './Interface/models/IAbsenceType';
@@ -242,7 +229,6 @@ export * from './Interface/models/IContractType';
242
229
  export * from './Interface/models/ICustomizationType';
243
230
  export * from './Interface/models/IDocumentWaitingType';
244
231
  export * from './Interface/models/IEstimateInvoiceType';
245
- export * from './Interface/models/IFollowedQualityMailType';
246
232
  export * from './Interface/models/IFirstStep';
247
233
  export * from './Interface/models/IGedFileType';
248
234
  export * from './Interface/models/ILetterType';
@@ -250,7 +236,6 @@ export * from './Interface/models/ILogType';
250
236
  export * from './Interface/models/INotificationCodeType';
251
237
  export * from './Interface/models/INotificationType';
252
238
  export * from './Interface/models/IPartnerTransactionType';
253
- export * from './Interface/models/IPenaltyType';
254
239
  export * from './Interface/models/IRepeatType';
255
240
  export * from './Interface/models/IReportType';
256
241
  export * from './Interface/models/IAdjustment';
@@ -262,7 +247,6 @@ export * from './Interface/models/IVehicleType';
262
247
  export * from './Interface/models/IUser';
263
248
  export * from './Interface/models/IUserNotification';
264
249
  export * from './Interface/models/IUserSocietyPermission';
265
- export * from './Interface/models/IUserSocietyTicketSupport';
266
250
  export * from './Interface/models/IUserTeam';
267
251
  export * from './Interface/models/IUserFile';
268
252
  export * from './Interface/models/IUserTest';
@@ -277,14 +261,11 @@ export * from './Interface/models/ITaskAttachment';
277
261
  export * from './Interface/models/IMailContent';
278
262
  export * from './Interface/models/IWebMail';
279
263
  export * from './Interface/models/IWebMailAttachment';
280
- export * from './Interface/models/IWebMailSpam';
281
264
  export * from './Interface/models/IWebMailStat';
282
265
  export * from './Interface/models/IWebMailType';
283
- export * from './Interface/models/IWebMailSpamType';
284
266
  export * from './Interface/models/IWorkingSchedule';
285
267
  export * from './Interface/models/IField';
286
268
  export * from './Interface/models/IFecFile';
287
- export * from './Interface/models/ISuggestion';
288
269
  export * from './Interface/models/ISalariesFile';
289
270
  export * from './Interface/models/IPromoCode';
290
271
  export * from './Interface/models/ILoan';
@@ -292,7 +273,6 @@ export * from './Interface/models/IBalanceSheetModule';
292
273
  export * from './Interface/models/IStock';
293
274
  export * from './Interface/models/ISocietyPromoCode';
294
275
  export * from './Interface/models/IZTicket';
295
- export * from './Interface/models/IAccountingTransaction_new';
296
276
  export * from './Interface/models/IExerciceNote';
297
277
  export * from './Interface/models/IRevisionGuide';
298
278
  export * from './Interface/models/ISponsorshipWithSponsorInfo';
@@ -587,6 +567,7 @@ export * from './Interface/api/accountingFiles/queryAccountingFiles';
587
567
  export * from './Interface/api/accountingFiles/Ocr';
588
568
  export * from './Interface/api/accountingFiles/OcrPayload';
589
569
  export * from './Interface/api/accountingFiles/OcrValue';
570
+ export * from './Interface/api/accountingFiles/Read';
590
571
  export * from './Interface/api/stock/StockEntries';
591
572
  export * from './Interface/api/dashboard/QueryTurnoverProfitAndLoss';
592
573
  export * from './Interface/api/dashboard/ReadTurnOverProfitAndLossAndVats';
@@ -4,7 +4,9 @@ import { round as _round, flatten, uniqBy } from 'lodash';
4
4
  import { IAccountingEntry } from '../../../types/Interface/models/IAccountingEntry';
5
5
  import { Cerfa3310_2023, PayloadCerfa3310_2023 } from '../../../types/Interface/api/cerfa/3310';
6
6
  import { Vat } from '../../../types/Enum/Vat';
7
- import { getAmountByAccountNumber, getTaxAmountByAccountNumber, textFormatting } from '../utils';
7
+ import {
8
+ getAmountByAccountNumber, getTaxAmountByAccountNumber, setZeroIfIsNegative, textFormatting,
9
+ } from '../utils';
8
10
  import { AsponeFormFields, CerfaPayloadForm } from '../../../types/Interface/api/cerfa/ReadCerfa';
9
11
  import { UpdatedAnnotation } from '../../../types/Interface/api/registration/ReadRegistration';
10
12
 
@@ -44,61 +46,61 @@ export function getCerfa3310Century23Payload(accountingEntries: IAccountingEntry
44
46
  // Opérations taxées
45
47
  const taxedServicesEntries = vatEntries.filter((ae) => frenchVat.includes(ae.idVat) && withTaxVat.includes(ae.idVat));
46
48
  const servicesAccounts = ['701', '702', '703', '704', '705', '706', '707', '708', '472'];
47
- const taxedServicesFromFrance = getAmountByAccountNumber(taxedServicesEntries, servicesAccounts, 0, true);
48
- const taxedOther = getAmountByAccountNumber(vatEntries.filter((ae) => withTaxVat.includes(ae.idVat)), ['775'], 0, true);
49
+ const taxedServicesFromFrance = setZeroIfIsNegative(getAmountByAccountNumber(taxedServicesEntries, servicesAccounts, 0, true));
50
+ const taxedOther = setZeroIfIsNegative(getAmountByAccountNumber(vatEntries.filter((ae) => withTaxVat.includes(ae.idVat)), ['775'], 0, true));
49
51
  const intracommunityServiceAccounts = ['604', '611', '612', '613', '614', '615', '616', '617', '618', '619', '62'];
50
52
  const intracommunityServiceEntries = vatEntries.filter((ae) => withTaxVat.includes(ae.idVat) && intracomVat.includes(ae.idVat));
51
- const taxedPurchaseOfIntracommunityService = getAmountByAccountNumber(intracommunityServiceEntries, intracommunityServiceAccounts, 0, true);
53
+ const taxedPurchaseOfIntracommunityService = setZeroIfIsNegative(getAmountByAccountNumber(intracommunityServiceEntries, intracommunityServiceAccounts, 0, true));
52
54
  const taxedImportEntries = vatEntries.filter((ae) => importationVat.includes(ae.idVat) && withTaxVat.includes(ae.idVat));
53
55
  const taxedImportAccounts = ['6'];
54
- const taxedImport = getAmountByAccountNumber(taxedImportEntries, taxedImportAccounts, 0, true);
55
- const taxedIntracommunityAcquisitions = getAmountByAccountNumber(vatEntries.filter((ae) => intracomVat.includes(ae.idVat) && withTaxVat.includes(ae.idVat)), ['601', '602', '603', '605', '606', '607'], 0, true);
56
+ const taxedImport = setZeroIfIsNegative(getAmountByAccountNumber(taxedImportEntries, taxedImportAccounts, 0, true));
57
+ const taxedIntracommunityAcquisitions = setZeroIfIsNegative(getAmountByAccountNumber(vatEntries.filter((ae) => intracomVat.includes(ae.idVat) && withTaxVat.includes(ae.idVat)), ['601', '602', '603', '605', '606', '607'], 0, true));
56
58
  // Opérations non taxées
57
- const untaxedExportationNotInEurope = getAmountByAccountNumber(vatEntries.filter((ae) => importationVat.includes(ae.idVat) && withoutTaxVat.includes(ae.idVat)), servicesAccounts, 0, true);
58
- const untaxedOther = getAmountByAccountNumber(vatEntries.filter((ae) => frenchVat.includes(ae.idVat) && withoutTaxVat.includes(ae.idVat)), ['7'], 0, true);
59
- const untaxedImport = getAmountByAccountNumber(vatEntries.filter((ae) => importationVat.includes(ae.idVat) && withoutTaxVat.includes(ae.idVat)), ['6'], 0, true);
60
- const untaxedIntracomunity = getAmountByAccountNumber(vatEntries.filter((ae) => intracomVat.includes(ae.idVat) && withoutTaxVat.includes(ae.idVat)), ['601', '602', '603', '605', '606', '607'], 0, true);
61
- const untaxedIntracommunityDelivery = getAmountByAccountNumber(vatEntries.filter((ae) => withoutTaxVat.includes(ae.idVat) && intracomVat.includes(ae.idVat)), ['701', '707'], 0, true);
59
+ const untaxedExportationNotInEurope = setZeroIfIsNegative(getAmountByAccountNumber(vatEntries.filter((ae) => importationVat.includes(ae.idVat) && withoutTaxVat.includes(ae.idVat)), servicesAccounts, 0, true));
60
+ const untaxedOther = setZeroIfIsNegative(getAmountByAccountNumber(vatEntries.filter((ae) => frenchVat.includes(ae.idVat) && withoutTaxVat.includes(ae.idVat)), ['7'], 0, true));
61
+ const untaxedImport = setZeroIfIsNegative(getAmountByAccountNumber(vatEntries.filter((ae) => importationVat.includes(ae.idVat) && withoutTaxVat.includes(ae.idVat)), ['6'], 0, true));
62
+ const untaxedIntracomunity = setZeroIfIsNegative(getAmountByAccountNumber(vatEntries.filter((ae) => intracomVat.includes(ae.idVat) && withoutTaxVat.includes(ae.idVat)), ['601', '602', '603', '605', '606', '607'], 0, true));
63
+ const untaxedIntracommunityDelivery = setZeroIfIsNegative(getAmountByAccountNumber(vatEntries.filter((ae) => withoutTaxVat.includes(ae.idVat) && intracomVat.includes(ae.idVat)), ['701', '707'], 0, true));
62
64
  // TVA brute
63
- const normalRate = getAmountByAccountNumber(taxedServicesEntries.filter((e) => vats.filter((v) => v.value === 20).map((v) => v.id).includes(e.idVat)), servicesAccounts, 0, true)
64
- + getAmountByAccountNumber(intracommunityServiceEntries.filter((e) => vats.filter((v) => v.value === 20).map((v) => v.id).includes(e.idVat)), ['6'], 0, true);
65
-
65
+ const normalRate = setZeroIfIsNegative(getAmountByAccountNumber(taxedServicesEntries.filter((e) => vats.filter((v) => v.value === 20).map((v) => v.id).includes(e.idVat)), servicesAccounts, 0, true)
66
+ + getAmountByAccountNumber(intracommunityServiceEntries.filter((e) => vats.filter((v) => v.value === 20).map((v) => v.id).includes(e.idVat)), ['6'], 0, true));
67
+
66
68
  const normalRateTax = _round(normalRate * 0.2);
67
69
 
68
- const reducedRate5Dot5 = getAmountByAccountNumber(taxedServicesEntries.filter((e) => vats.filter((v) => v.value === 5.5).map((v) => v.id).includes(e.idVat)), servicesAccounts, 0, true)
69
- + getAmountByAccountNumber(intracommunityServiceEntries.filter((e) => vats.filter((v) => v.value === 5.5).map((v) => v.id).includes(e.idVat)), ['6'], 0, true);
70
+ const reducedRate5Dot5 = setZeroIfIsNegative(getAmountByAccountNumber(taxedServicesEntries.filter((e) => vats.filter((v) => v.value === 5.5).map((v) => v.id).includes(e.idVat)), servicesAccounts, 0, true)
71
+ + getAmountByAccountNumber(intracommunityServiceEntries.filter((e) => vats.filter((v) => v.value === 5.5).map((v) => v.id).includes(e.idVat)), ['6'], 0, true));
70
72
  const reducedRate5Dot5Tax = _round(reducedRate5Dot5 * 0.055);
71
73
 
72
- const reducedRate10 = getAmountByAccountNumber(taxedServicesEntries.filter((e) => vats.filter((v) => v.value === 10).map((v) => v.id).includes(e.idVat)), servicesAccounts, 0, true)
73
- + getAmountByAccountNumber(intracommunityServiceEntries.filter((e) => vats.filter((v) => v.value === 10).map((v) => v.id).includes(e.idVat)), ['6'], 0, true);
74
+ const reducedRate10 = setZeroIfIsNegative(getAmountByAccountNumber(taxedServicesEntries.filter((e) => vats.filter((v) => v.value === 10).map((v) => v.id).includes(e.idVat)), servicesAccounts, 0, true)
75
+ + getAmountByAccountNumber(intracommunityServiceEntries.filter((e) => vats.filter((v) => v.value === 10).map((v) => v.id).includes(e.idVat)), ['6'], 0, true));
74
76
  const reducedRate10Tax = _round(reducedRate10 * 0.1);
75
77
 
76
- const reducedRate8Dot5 = getAmountByAccountNumber(taxedServicesEntries.filter((e) => vats.filter((v) => v.value === 8.5).map((v) => v.id).includes(e.idVat)), servicesAccounts, 0, true)
77
- + getAmountByAccountNumber(intracommunityServiceEntries.filter((e) => vats.filter((v) => v.value === 8.5).map((v) => v.id).includes(e.idVat)), ['6'], 0, true);
78
+ const reducedRate8Dot5 = setZeroIfIsNegative(getAmountByAccountNumber(taxedServicesEntries.filter((e) => vats.filter((v) => v.value === 8.5).map((v) => v.id).includes(e.idVat)), servicesAccounts, 0, true)
79
+ + getAmountByAccountNumber(intracommunityServiceEntries.filter((e) => vats.filter((v) => v.value === 8.5).map((v) => v.id).includes(e.idVat)), ['6'], 0, true));
78
80
  const reducedRate8Dot5Tax = _round(reducedRate8Dot5 * 0.085);
79
81
 
80
- const reducedRate2Dot1 = getAmountByAccountNumber(taxedServicesEntries.filter((e) => vats.filter((v) => v.value === 2.1).map((v) => v.id).includes(e.idVat)), servicesAccounts, 0, true)
81
- + getAmountByAccountNumber(intracommunityServiceEntries.filter((e) => vats.filter((v) => v.value === 2.1).map((v) => v.id).includes(e.idVat)), ['6'], 0, true);
82
+ const reducedRate2Dot1 = setZeroIfIsNegative(getAmountByAccountNumber(taxedServicesEntries.filter((e) => vats.filter((v) => v.value === 2.1).map((v) => v.id).includes(e.idVat)), servicesAccounts, 0, true)
83
+ + getAmountByAccountNumber(intracommunityServiceEntries.filter((e) => vats.filter((v) => v.value === 2.1).map((v) => v.id).includes(e.idVat)), ['6'], 0, true));
82
84
  const reducedRate2Dot1Tax = _round(reducedRate2Dot1 * 0.021);
83
85
 
84
- const importNormalRate = getAmountByAccountNumber(taxedImportEntries.filter((e) => vats.filter((v) => v.value === 20).map((v) => v.id).includes(e.idVat)), taxedImportAccounts, 0, true);
86
+ const importNormalRate = setZeroIfIsNegative(getAmountByAccountNumber(taxedImportEntries.filter((e) => vats.filter((v) => v.value === 20).map((v) => v.id).includes(e.idVat)), taxedImportAccounts, 0, true));
85
87
  const importNormalRateTax = _round(importNormalRate * 0.2);
86
- const importReducedRate10 = getAmountByAccountNumber(taxedImportEntries.filter((e) => vats.filter((v) => v.value === 10).map((v) => v.id).includes(e.idVat)), taxedImportAccounts, 0, true);
88
+ const importReducedRate10 = setZeroIfIsNegative(getAmountByAccountNumber(taxedImportEntries.filter((e) => vats.filter((v) => v.value === 10).map((v) => v.id).includes(e.idVat)), taxedImportAccounts, 0, true));
87
89
  const importReducedRate10Tax = _round(importReducedRate10 * 0.1);
88
- const importReducedRate8Dot5 = getAmountByAccountNumber(taxedImportEntries.filter((e) => vats.filter((v) => v.value === 8.5).map((v) => v.id).includes(e.idVat)), taxedImportAccounts, 0, true);
90
+ const importReducedRate8Dot5 = setZeroIfIsNegative(getAmountByAccountNumber(taxedImportEntries.filter((e) => vats.filter((v) => v.value === 8.5).map((v) => v.id).includes(e.idVat)), taxedImportAccounts, 0, true));
89
91
  const importReducedRate8Dot5Tax = _round(importReducedRate8Dot5 * 0.085);
90
- const importReducedRate5Dot5 = getAmountByAccountNumber(taxedImportEntries.filter((e) => vats.filter((v) => v.value === 5.5).map((v) => v.id).includes(e.idVat)), taxedImportAccounts, 0, true);
92
+ const importReducedRate5Dot5 = setZeroIfIsNegative(getAmountByAccountNumber(taxedImportEntries.filter((e) => vats.filter((v) => v.value === 5.5).map((v) => v.id).includes(e.idVat)), taxedImportAccounts, 0, true));
91
93
  const importReducedRate5Dot5Tax = _round(importReducedRate8Dot5 * 0.055);
92
- const importReducedRate2Dot1 = getAmountByAccountNumber(taxedImportEntries.filter((e) => vats.filter((v) => v.value === 2.1).map((v) => v.id).includes(e.idVat)), taxedImportAccounts, 0, true);
94
+ const importReducedRate2Dot1 = setZeroIfIsNegative(getAmountByAccountNumber(taxedImportEntries.filter((e) => vats.filter((v) => v.value === 2.1).map((v) => v.id).includes(e.idVat)), taxedImportAccounts, 0, true));
93
95
  const importReducedRate2Dot1Tax = _round(importReducedRate2Dot1 * 0.021);
94
- const importReducedRate1Dot05 = getAmountByAccountNumber(taxedImportEntries.filter((e) => vats.filter((v) => v.value === 1.05).map((v) => v.id).includes(e.idVat)), taxedImportAccounts, 0, true);
96
+ const importReducedRate1Dot05 = setZeroIfIsNegative(getAmountByAccountNumber(taxedImportEntries.filter((e) => vats.filter((v) => v.value === 1.05).map((v) => v.id).includes(e.idVat)), taxedImportAccounts, 0, true));
95
97
  const importReducedRate1Dot05Tax = _round(importReducedRate1Dot05 * 0.0105);
96
- const intracommunityTax = getTaxAmountByAccountNumber(intracommunityServiceEntries, intracommunityServiceAccounts);
98
+ const intracommunityTax = setZeroIfIsNegative(getTaxAmountByAccountNumber(intracommunityServiceEntries, intracommunityServiceAccounts));
97
99
 
98
100
  // TVA Déductible
99
- const immobilizationTax = getTaxAmountByAccountNumber(vatEntries, ['2']);
100
- const otherGoodsAndServices = getTaxAmountByAccountNumber(vatEntries.filter((e) => vats.filter((v) => !v.isVatImportation).map((v) => v.id).includes(e.idVat)), ['6']);
101
- const otherDeductibles = getTaxAmountByAccountNumber(vatEntries.filter((e) => vats.filter((v) => v.isVatImportation).map((v) => v.id).includes(e.idVat)), ['6']);
101
+ const immobilizationTax = setZeroIfIsNegative(getTaxAmountByAccountNumber(vatEntries, ['2']));
102
+ const otherGoodsAndServices = setZeroIfIsNegative(getTaxAmountByAccountNumber(vatEntries.filter((e) => vats.filter((v) => !v.isVatImportation).map((v) => v.id).includes(e.idVat)), ['6']));
103
+ const otherDeductibles = setZeroIfIsNegative(getTaxAmountByAccountNumber(vatEntries.filter((e) => vats.filter((v) => v.isVatImportation).map((v) => v.id).includes(e.idVat)), ['6']));
102
104
  const report = payload.previousVatDeclaration?.credit?.toReport ?? 0;
103
105
 
104
106
  const coefficient = _round(payload.vat?.deductible?.coefficient ?? 100, 2);
@@ -4,7 +4,9 @@ import { round as _round, uniqBy } from 'lodash';
4
4
  import { Cerfa3517_2023, PayloadCerfa3517_2023 } from '../../../types/Interface/api/cerfa/3517';
5
5
  import { IAccountingEntry } from '../../../types/Interface/models/IAccountingEntry';
6
6
  import { Vat } from '../../../types/Enum/Vat';
7
- import { getAmountByAccountNumber, getTaxAmountByAccountNumber, textFormatting } from '../utils';
7
+ import {
8
+ getAmountByAccountNumber, getTaxAmountByAccountNumber, setZeroIfIsNegative, textFormatting,
9
+ } from '../utils';
8
10
  import { Cerfa3514_2022, CerfaPayloadForm, IRegistration } from '../../../types';
9
11
 
10
12
  export function getCerfa3517Century23Payload(accountingEntries: IAccountingEntry[], payload: PayloadCerfa3517_2023): Cerfa3517_2023 {
@@ -22,21 +24,21 @@ export function getCerfa3517Century23Payload(accountingEntries: IAccountingEntry
22
24
 
23
25
  const taxedOperationsAccounts = ['701', '702', '703', '704', '705', '706', '707', '708', '472'];
24
26
 
25
- const vatNormalRate20 = getAmountByAccountNumber(vatEntries.filter((ae) => ae.idVat === Vat.TX_20.id), taxedOperationsAccounts, 0, true);
26
- const vatReducedRate5Dot5 = getAmountByAccountNumber(vatEntries.filter((ae) => ae.idVat === Vat.TX_5_5.id), taxedOperationsAccounts, 0, true);
27
- const vatReducedRate10 = getAmountByAccountNumber(vatEntries.filter((ae) => ae.idVat === Vat.TX_10.id), taxedOperationsAccounts, 0, true);
28
- const vatReducedRate8Dot5 = getAmountByAccountNumber(vatEntries.filter((ae) => ae.idVat === Vat.TX_8_5.id), taxedOperationsAccounts, 0, true);
29
- const vatReducedRate2Dot1 = getAmountByAccountNumber(vatEntries.filter((ae) => ae.idVat === Vat.TX_2_1.id), taxedOperationsAccounts, 0, true);
27
+ const vatNormalRate20 = setZeroIfIsNegative(getAmountByAccountNumber(vatEntries.filter((ae) => ae.idVat === Vat.TX_20.id), taxedOperationsAccounts, 0, true));
28
+ const vatReducedRate5Dot5 = setZeroIfIsNegative(getAmountByAccountNumber(vatEntries.filter((ae) => ae.idVat === Vat.TX_5_5.id), taxedOperationsAccounts, 0, true));
29
+ const vatReducedRate10 = setZeroIfIsNegative(getAmountByAccountNumber(vatEntries.filter((ae) => ae.idVat === Vat.TX_10.id), taxedOperationsAccounts, 0, true));
30
+ const vatReducedRate8Dot5 = setZeroIfIsNegative(getAmountByAccountNumber(vatEntries.filter((ae) => ae.idVat === Vat.TX_8_5.id), taxedOperationsAccounts, 0, true));
31
+ const vatReducedRate2Dot1 = setZeroIfIsNegative(getAmountByAccountNumber(vatEntries.filter((ae) => ae.idVat === Vat.TX_2_1.id), taxedOperationsAccounts, 0, true));
30
32
 
31
33
  const prestation2Entries = vatEntries.filter((ae) => intracomVat.includes(ae.idVat));
32
34
  const presta2Accounts = ['604', '61', '62'];
33
- const prestation2Base = getAmountByAccountNumber(prestation2Entries, presta2Accounts, 0, true);
34
- const prestation2AmountOfVat = getTaxAmountByAccountNumber(prestation2Entries, presta2Accounts);
35
+ const prestation2Base = setZeroIfIsNegative(getAmountByAccountNumber(prestation2Entries, presta2Accounts, 0, true));
36
+ const prestation2AmountOfVat = setZeroIfIsNegative(getTaxAmountByAccountNumber(prestation2Entries, presta2Accounts));
35
37
 
36
- const saleOfImmobilization = getAmountByAccountNumber(vatEntries.filter((ae) => !withoutTaxVat.includes(ae.idVat) && frenchVat.includes(ae.idVat)), ['775'], 0, true);
38
+ const saleOfImmobilization = setZeroIfIsNegative(getAmountByAccountNumber(vatEntries.filter((ae) => !withoutTaxVat.includes(ae.idVat) && frenchVat.includes(ae.idVat)), ['775'], 0, true));
37
39
 
38
- const onInvoiceDeductible = getTaxAmountByAccountNumber(vatEntries.filter(ae => !importationVat.includes(ae.idVat)), ['6']);
39
- const onImmobilizationDeductible = getTaxAmountByAccountNumber(vatEntries, ['2']);
40
+ const onInvoiceDeductible = setZeroIfIsNegative(getTaxAmountByAccountNumber(vatEntries.filter((ae) => !importationVat.includes(ae.idVat)), ['6']));
41
+ const onImmobilizationDeductible = setZeroIfIsNegative(getTaxAmountByAccountNumber(vatEntries, ['2']));
40
42
 
41
43
  const julyAdvance: IRegistration | null = payload?.exerciceAdvanceRegistrations?.find((a) => [5, 6].includes(dayjs(a.endDate).month())) ?? null;
42
44
  const julyAdvancePayload: Cerfa3514_2022 | null = julyAdvance?.payload?.cerfa3514 ?? null;
@@ -18,6 +18,10 @@ export function getAmountByAccountNumber(accountingEntries: IAccountingEntry[],
18
18
  return isAbs ? Math.abs(result) : result;
19
19
  }
20
20
 
21
+ export function setZeroIfIsNegative(value: number): number {
22
+ return value < 0 ? 0 : value;
23
+ }
24
+
21
25
  export function getTaxAmountByAccountNumber(accountingEntries: IAccountingEntry[], accountsNumber: string[], precision = 0): number {
22
26
  const accountingEntriesUniq = _uniqBy(accountingEntries, 'id');
23
27
  return _round(accountingEntriesUniq.reduce((acc, accountingEntry) => {