@silexpert/core 1.1.68 → 1.1.69

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.
@@ -325,6 +325,38 @@ function getCerfa3310Century23Payload(accountingEntries, payload, updatedEntries
325
325
  }
326
326
  }
327
327
  };
328
+ const totalCadreA = initialPayload.taxedOperations.services + initialPayload.taxedOperations.other + initialPayload.taxedOperations.purchaseOfIntracommunityServiceProvision + initialPayload.taxedOperations.intracommunityAcquisitions + initialPayload.taxedOperations.energyDelivery + initialPayload.taxedOperations.purchaseOfServicesNotInFrance;
329
+ const totalCadreB = initialPayload.vat.carrieredOutInFrance.normalRate20.base + initialPayload.vat.carrieredOutInFrance.reduceRate5Dot5.base + initialPayload.vat.carrieredOutInFrance.reduceRate10.base + initialPayload.vat.overseasDepartment.reduceRate8Dot5.base + initialPayload.vat.overseasDepartment.reduceRate2Dot1.base + initialPayload.vat.otherRate.at1Dot75.base + initialPayload.vat.otherRate.at1Dot05.base + initialPayload.vat.otherRate.at10.base + initialPayload.vat.otherRate.atCorse2Dot1.base + initialPayload.vat.otherRate.atCorse0Dot9.base + initialPayload.vat.otherRate.at2Dot1.base + initialPayload.vat.otherRate.author.base + initialPayload.vat.otherRate.oldRate.base;
330
+ // On tolère une différence de 3, dans ce cas on force le champ
331
+ if (totalCadreA !== totalCadreB) {
332
+ const difference = totalCadreB - totalCadreA;
333
+ if (difference >= -3 && difference <= 3) {
334
+ const cadreAFields = [{
335
+ key: 'services',
336
+ value: initialPayload.taxedOperations.services
337
+ }, {
338
+ key: 'other',
339
+ value: initialPayload.taxedOperations.other
340
+ }, {
341
+ key: 'purchaseOfIntracommunityServiceProvision',
342
+ value: initialPayload.taxedOperations.purchaseOfIntracommunityServiceProvision
343
+ }, {
344
+ key: 'intracommunityAcquisitions',
345
+ value: initialPayload.taxedOperations.intracommunityAcquisitions
346
+ }, {
347
+ key: 'energyDelivery',
348
+ value: initialPayload.taxedOperations.energyDelivery
349
+ }, {
350
+ key: 'purchaseOfServicesNotInFrance;',
351
+ value: initialPayload.taxedOperations.purchaseOfServicesNotInFrance
352
+ }];
353
+ const biggestValue = (0, _lodash.maxBy)(cadreAFields, 'value');
354
+ if (biggestValue) {
355
+ // @ts-ignore
356
+ initialPayload.taxedOperations[biggestValue.key] += difference;
357
+ }
358
+ }
359
+ }
328
360
  initialPayload.vat.grossDue = initialPayload.vat.carrieredOutInFrance.normalRate20.tax + initialPayload.vat.carrieredOutInFrance.reduceRate5Dot5.tax + initialPayload.vat.carrieredOutInFrance.reduceRate10.tax + initialPayload.vat.overseasDepartment.reduceRate8Dot5.tax + initialPayload.vat.overseasDepartment.reduceRate2Dot1.tax + initialPayload.vat.otherRate.at1Dot75.tax + initialPayload.vat.otherRate.at1Dot05.tax + initialPayload.vat.otherRate.at10.tax + initialPayload.vat.otherRate.atCorse2Dot1.tax + initialPayload.vat.otherRate.atCorse0Dot9.tax + initialPayload.vat.otherRate.at2Dot1.tax + initialPayload.vat.otherRate.author.tax + initialPayload.vat.otherRate.oldRate.tax + initialPayload.vat.oilProducts.normalRate20.tax + initialPayload.vat.oilProducts.reduceRate13.tax + initialPayload.vat.importations.normalRate20.tax + initialPayload.vat.importations.reduceRate10.tax + initialPayload.vat.importations.reduceRate8Dot5.tax + initialPayload.vat.importations.reduceRate5Dot5.tax + initialPayload.vat.importations.reduceRate2Dot1.tax + initialPayload.vat.importations.reduceRate1Dot05.tax + initialPayload.vat.previouslyDeductedToBeReturned.total + initialPayload.vat.sumToAdd;
329
361
  initialPayload.vat.deductible.total = initialPayload.vat.deductible.immobilizations + initialPayload.vat.deductible.otherGoodsAndServices + initialPayload.vat.deductible.other.total + initialPayload.vat.deductible.report + initialPayload.vat.deductible.toImpute;
330
362
  initialPayload.credit.amount = initialPayload.vat.grossDue - initialPayload.vat.deductible.total < 0 ? Math.abs(initialPayload.vat.grossDue - initialPayload.vat.deductible.total) : 0;