@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.
@@ -1 +1 @@
1
- {"version":3,"file":"century23.d.ts","sourceRoot":"","sources":["../../../../ts/utils/vat/3310/century23.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kDAAkD,CAAC;AACpF,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAKhG,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AAClG,OAAO,EAAE,iBAAiB,EAAE,MAAM,4DAA4D,CAAC;AAG/F,wBAAgB,4BAA4B,CAAC,iBAAiB,EAAE,gBAAgB,EAAE,EAAE,OAAO,EAAE,qBAAqB,EAAE,cAAc,GAAE,iBAAsB,GAAG,cAAc,CAoV1K;AAED,wBAAgB,uCAAuC,CAAC,IAAI,EAAE,cAAc,GAAG,gBAAgB,CAi7B9F;AAED,eAAO,MAAM,wBAAwB,EAAE,gBAAgB,EAyLrD,CAAC"}
1
+ {"version":3,"file":"century23.d.ts","sourceRoot":"","sources":["../../../../ts/utils/vat/3310/century23.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kDAAkD,CAAC;AACpF,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAKhG,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AAClG,OAAO,EAAE,iBAAiB,EAAE,MAAM,4DAA4D,CAAC;AAG/F,wBAAgB,4BAA4B,CAAC,iBAAiB,EAAE,gBAAgB,EAAE,EAAE,OAAO,EAAE,qBAAqB,EAAE,cAAc,GAAE,iBAAsB,GAAG,cAAc,CA6W1K;AAED,wBAAgB,uCAAuC,CAAC,IAAI,EAAE,cAAc,GAAG,gBAAgB,CAi7B9F;AAED,eAAO,MAAM,wBAAwB,EAAE,gBAAgB,EAyLrD,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import * as dayjs from 'dayjs';
2
2
  import { isDefined } from 'class-validator';
3
- import { round as _round, flatten, uniqBy } from 'lodash';
3
+ import { round as _round, flatten, uniqBy, maxBy, } from 'lodash';
4
4
  import { Vat } from '../../../types/Enum/Vat';
5
5
  import { getAmountByAccountNumber, getTaxAmountByAccountNumber, setZeroIfIsNegative, textFormatting, } from '../utils';
6
6
  export function getCerfa3310Century23Payload(accountingEntries, payload, updatedEntries = []) {
@@ -319,6 +319,27 @@ export function getCerfa3310Century23Payload(accountingEntries, payload, updated
319
319
  },
320
320
  },
321
321
  };
322
+ const totalCadreA = initialPayload.taxedOperations.services + initialPayload.taxedOperations.other + initialPayload.taxedOperations.purchaseOfIntracommunityServiceProvision + initialPayload.taxedOperations.intracommunityAcquisitions + initialPayload.taxedOperations.energyDelivery + initialPayload.taxedOperations.purchaseOfServicesNotInFrance;
323
+ 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;
324
+ // On tolère une différence de 3, dans ce cas on force le champ
325
+ if (totalCadreA !== totalCadreB) {
326
+ const difference = totalCadreB - totalCadreA;
327
+ if (difference >= -3 && difference <= 3) {
328
+ const cadreAFields = [
329
+ { key: 'services', value: initialPayload.taxedOperations.services },
330
+ { key: 'other', value: initialPayload.taxedOperations.other },
331
+ { key: 'purchaseOfIntracommunityServiceProvision', value: initialPayload.taxedOperations.purchaseOfIntracommunityServiceProvision },
332
+ { key: 'intracommunityAcquisitions', value: initialPayload.taxedOperations.intracommunityAcquisitions },
333
+ { key: 'energyDelivery', value: initialPayload.taxedOperations.energyDelivery },
334
+ { key: 'purchaseOfServicesNotInFrance;', value: initialPayload.taxedOperations.purchaseOfServicesNotInFrance },
335
+ ];
336
+ const biggestValue = maxBy(cadreAFields, 'value');
337
+ if (biggestValue) {
338
+ // @ts-ignore
339
+ initialPayload.taxedOperations[biggestValue.key] += difference;
340
+ }
341
+ }
342
+ }
322
343
  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;
323
344
  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;
324
345
  initialPayload.credit.amount = initialPayload.vat.grossDue - initialPayload.vat.deductible.total < 0 ? Math.abs(initialPayload.vat.grossDue - initialPayload.vat.deductible.total) : 0;