@senior-gestao-empresarial/erpx-components 4.4.0 → 4.6.0

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 (57) hide show
  1. package/bundles/senior-gestao-empresarial-erpx-components.umd.js +1060 -184
  2. package/bundles/senior-gestao-empresarial-erpx-components.umd.js.map +1 -1
  3. package/bundles/senior-gestao-empresarial-erpx-components.umd.min.js +2 -2
  4. package/bundles/senior-gestao-empresarial-erpx-components.umd.min.js.map +1 -1
  5. package/components/rateio-editor/erp-rateio-editor.component.d.ts +117 -0
  6. package/components/rateio-editor/erp-rateio-editor.converter.d.ts +18 -0
  7. package/components/rateio-editor/erp-rateio-editor.module.d.ts +2 -0
  8. package/components/rateio-editor/erp-rateio-editor.service.d.ts +17 -0
  9. package/components/rateio-editor/erp-rateio-editor.types.d.ts +149 -0
  10. package/components/rateio-editor/index.d.ts +4 -0
  11. package/components/tributos/calculators/gross-amount-calculator.d.ts +5 -0
  12. package/components/tributos/calculators/tax-amount-calculator.d.ts +5 -1
  13. package/components/tributos/erp-tributos.component.d.ts +12 -3
  14. package/components/tributos/services/tax-rounding.service.d.ts +5 -0
  15. package/components/tributos/stores/tax.store.d.ts +10 -0
  16. package/components/utils/loading-context.d.ts +7 -0
  17. package/esm2015/components/rateio-editor/erp-rateio-editor.component.js +555 -0
  18. package/esm2015/components/rateio-editor/erp-rateio-editor.converter.js +52 -0
  19. package/esm2015/components/rateio-editor/erp-rateio-editor.module.js +40 -0
  20. package/esm2015/components/rateio-editor/erp-rateio-editor.service.js +49 -0
  21. package/esm2015/components/rateio-editor/erp-rateio-editor.types.js +5 -0
  22. package/esm2015/components/rateio-editor/index.js +4 -0
  23. package/esm2015/components/tributos/calculators/gross-amount-calculator.js +18 -3
  24. package/esm2015/components/tributos/calculators/tax-amount-calculator.js +26 -7
  25. package/esm2015/components/tributos/erp-tributos.component.js +59 -15
  26. package/esm2015/components/tributos/rules/calculation/rules/gross-amount-calculation-rule.js +2 -4
  27. package/esm2015/components/tributos/services/tax-rounding.service.js +18 -0
  28. package/esm2015/components/tributos/stores/tax.store.js +19 -0
  29. package/esm2015/components/utils/loading-context.js +20 -0
  30. package/esm2015/locale/fallback.js +18 -2
  31. package/esm2015/public-api.js +2 -1
  32. package/esm2015/senior-gestao-empresarial-erpx-components.js +47 -43
  33. package/esm5/components/rateio-editor/erp-rateio-editor.component.js +601 -0
  34. package/esm5/components/rateio-editor/erp-rateio-editor.converter.js +68 -0
  35. package/esm5/components/rateio-editor/erp-rateio-editor.module.js +43 -0
  36. package/esm5/components/rateio-editor/erp-rateio-editor.service.js +51 -0
  37. package/esm5/components/rateio-editor/erp-rateio-editor.types.js +5 -0
  38. package/esm5/components/rateio-editor/index.js +4 -0
  39. package/esm5/components/tributos/calculators/gross-amount-calculator.js +17 -4
  40. package/esm5/components/tributos/calculators/tax-amount-calculator.js +26 -7
  41. package/esm5/components/tributos/erp-tributos.component.js +60 -15
  42. package/esm5/components/tributos/rules/calculation/rules/gross-amount-calculation-rule.js +2 -4
  43. package/esm5/components/tributos/services/tax-rounding.service.js +23 -0
  44. package/esm5/components/tributos/stores/tax.store.js +26 -0
  45. package/esm5/components/utils/loading-context.js +22 -0
  46. package/esm5/locale/fallback.js +18 -2
  47. package/esm5/public-api.js +2 -1
  48. package/esm5/senior-gestao-empresarial-erpx-components.js +47 -43
  49. package/fesm2015/senior-gestao-empresarial-erpx-components.js +926 -132
  50. package/fesm2015/senior-gestao-empresarial-erpx-components.js.map +1 -1
  51. package/fesm5/senior-gestao-empresarial-erpx-components.js +1014 -143
  52. package/fesm5/senior-gestao-empresarial-erpx-components.js.map +1 -1
  53. package/locale/fallback.d.ts +16 -0
  54. package/package.json +1 -1
  55. package/public-api.d.ts +1 -0
  56. package/senior-gestao-empresarial-erpx-components.d.ts +46 -42
  57. package/senior-gestao-empresarial-erpx-components.metadata.json +1 -1
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('primeng/breadcrumb'), require('@angular/router'), require('rxjs'), require('rxjs/operators'), require('@ngx-translate/core'), require('@senior-gestao-empresarial/angular-components'), require('@seniorsistemas/angular-components'), require('primeng/accordion'), require('@angular/forms'), require('@seniorsistemas/platform-utils'), require('bignumber.js'), require('primeng/api'), require('@angular/common/http'), require('primeng'), require('moment'), require('primeng/confirmdialog'), require('primeng/messages'), require('primeng/panel'), require('primeng/table'), require('primeng/tabview'), require('@seniorsistemas/platform-components')) :
3
- typeof define === 'function' && define.amd ? define('@senior-gestao-empresarial/erpx-components', ['exports', '@angular/core', '@angular/common', 'primeng/breadcrumb', '@angular/router', 'rxjs', 'rxjs/operators', '@ngx-translate/core', '@senior-gestao-empresarial/angular-components', '@seniorsistemas/angular-components', 'primeng/accordion', '@angular/forms', '@seniorsistemas/platform-utils', 'bignumber.js', 'primeng/api', '@angular/common/http', 'primeng', 'moment', 'primeng/confirmdialog', 'primeng/messages', 'primeng/panel', 'primeng/table', 'primeng/tabview', '@seniorsistemas/platform-components'], factory) :
4
- (global = global || self, factory((global['senior-gestao-empresarial'] = global['senior-gestao-empresarial'] || {}, global['senior-gestao-empresarial']['erpx-components'] = {}), global.ng.core, global.ng.common, global.breadcrumb, global.ng.router, global.rxjs, global.rxjs.operators, global.core$1, global.angularComponents, global.angularComponents$1, global.accordion, global.ng.forms, global.platformUtils, global.BigNumber, global.api, global.ng.common.http, global.primeng, global.moment, global.confirmdialog, global.messages, global.panel, global.table, global.tabview, global.platformComponents));
5
- }(this, (function (exports, core, common, breadcrumb, router, rxjs, operators, core$1, angularComponents, angularComponents$1, accordion, forms, platformUtils, BigNumber, api, http, primeng, moment, confirmdialog, messages, panel, table, tabview, platformComponents) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('primeng/breadcrumb'), require('@angular/router'), require('rxjs'), require('rxjs/operators'), require('@ngx-translate/core'), require('@senior-gestao-empresarial/angular-components'), require('@seniorsistemas/angular-components'), require('primeng/accordion'), require('@angular/forms'), require('@seniorsistemas/platform-components'), require('@seniorsistemas/platform-utils'), require('bignumber.js'), require('primeng/api'), require('@ngrx/component-store'), require('@angular/common/http'), require('primeng'), require('moment'), require('primeng/confirmdialog'), require('primeng/messages'), require('primeng/panel'), require('primeng/table'), require('primeng/tabview'), require('primeng/dialog')) :
3
+ typeof define === 'function' && define.amd ? define('@senior-gestao-empresarial/erpx-components', ['exports', '@angular/core', '@angular/common', 'primeng/breadcrumb', '@angular/router', 'rxjs', 'rxjs/operators', '@ngx-translate/core', '@senior-gestao-empresarial/angular-components', '@seniorsistemas/angular-components', 'primeng/accordion', '@angular/forms', '@seniorsistemas/platform-components', '@seniorsistemas/platform-utils', 'bignumber.js', 'primeng/api', '@ngrx/component-store', '@angular/common/http', 'primeng', 'moment', 'primeng/confirmdialog', 'primeng/messages', 'primeng/panel', 'primeng/table', 'primeng/tabview', 'primeng/dialog'], factory) :
4
+ (global = global || self, factory((global['senior-gestao-empresarial'] = global['senior-gestao-empresarial'] || {}, global['senior-gestao-empresarial']['erpx-components'] = {}), global.ng.core, global.ng.common, global.breadcrumb, global.ng.router, global.rxjs, global.rxjs.operators, global.core$1, global.angularComponents, global.angularComponents$1, global.accordion, global.ng.forms, global.platformComponents, global.platformUtils, global.BigNumber, global.api, global.componentStore, global.ng.common.http, global.primeng, global.moment, global.confirmdialog, global.messages, global.panel, global.table, global.tabview, global.dialog));
5
+ }(this, (function (exports, core, common, breadcrumb, router, rxjs, operators, core$1, angularComponents, angularComponents$1, accordion, forms, platformComponents, platformUtils, BigNumber, api, componentStore, http, primeng, moment, confirmdialog, messages, panel, table, tabview, dialog) { 'use strict';
6
6
 
7
7
  BigNumber = BigNumber && Object.prototype.hasOwnProperty.call(BigNumber, 'default') ? BigNumber['default'] : BigNumber;
8
8
 
@@ -536,6 +536,199 @@
536
536
  EnumIndicativoPadrao["INDIFERENTE"] = "INDIFERENTE";
537
537
  })(EnumIndicativoPadrao || (EnumIndicativoPadrao = {}));
538
538
 
539
+ var LoadingContext = /** @class */ (function () {
540
+ function LoadingContext() {
541
+ this.contexts = [];
542
+ }
543
+ LoadingContext.prototype.push = function (context) {
544
+ if (!context)
545
+ context = 'default context';
546
+ this.contexts.push(context);
547
+ };
548
+ LoadingContext.prototype.pop = function () {
549
+ this.contexts.pop();
550
+ };
551
+ LoadingContext.prototype.isLoading = function () {
552
+ return this.contexts.length > 0;
553
+ };
554
+ LoadingContext.prototype.getContext = function () {
555
+ return this.contexts;
556
+ };
557
+ return LoadingContext;
558
+ }());
559
+
560
+ var EffectiveTaxRateCalculator = /** @class */ (function () {
561
+ function EffectiveTaxRateCalculator() {
562
+ }
563
+ /**
564
+ * Calculates the effective tax rate by applying both the tax rate reduction and the governmental tax rate reduction factors.
565
+ *
566
+ * @param params - An object containing the following properties:
567
+ * @param params.taxRate - The base tax rate as a BigNumber.
568
+ * @param params.taxRateReduction - The tax rate reduction percentage as a BigNumber.
569
+ * @param params.governamentalTaxRateReduction - The governmental tax rate reduction percentage as a BigNumber.
570
+ * @returns The effective tax rate as a BigNumber after applying the reduction factors.
571
+ */
572
+ EffectiveTaxRateCalculator.prototype.calculateEffectiveTaxRate = function (_a) {
573
+ var taxRate = _a.taxRate, taxRateReduction = _a.taxRateReduction, governamentalTaxRateReduction = _a.governamentalTaxRateReduction;
574
+ var taxRateReductionFactor = taxRateReduction.isGreaterThan(0)
575
+ ? new BigNumber(1).minus(new BigNumber(taxRateReduction).dividedBy(100))
576
+ : new BigNumber(1);
577
+ var governamentalTaxRateReductionFactor = governamentalTaxRateReduction.isGreaterThan(0)
578
+ ? new BigNumber(1).minus(new BigNumber(governamentalTaxRateReduction).dividedBy(100))
579
+ : new BigNumber(1);
580
+ return taxRateReductionFactor
581
+ .multipliedBy(taxRate)
582
+ .multipliedBy(governamentalTaxRateReductionFactor);
583
+ };
584
+ /**
585
+ * Calculates the effective tax rate by applying a reduction factor to the given tax rate,
586
+ * excluding any governmental tax rate reductions.
587
+ *
588
+ * If the `taxRateReduction` is not a valid number, it defaults to zero.
589
+ * The reduction factor is computed as (1 - taxRateReduction / 100) if `taxRateReduction` is greater than zero,
590
+ * otherwise it is 1 (no reduction).
591
+ *
592
+ * @param params - An object containing:
593
+ * - taxRate: The original tax rate as a BigNumber.
594
+ * - taxRateReduction: The tax rate reduction percentage as a BigNumber.
595
+ * @returns The effective tax rate as a BigNumber after applying the reduction factor.
596
+ */
597
+ EffectiveTaxRateCalculator.prototype.calculateEffectiveTaxRateWithoutGovernamentalTaxRateReduction = function (_a) {
598
+ var taxRate = _a.taxRate, taxRateReduction = _a.taxRateReduction;
599
+ if (taxRateReduction.isNaN())
600
+ taxRateReduction = new BigNumber(0);
601
+ var taxRateReductionFactor = taxRateReduction.isGreaterThan(0)
602
+ ? new BigNumber(1).minus(new BigNumber(taxRateReduction).dividedBy(100))
603
+ : new BigNumber(1);
604
+ return taxRateReductionFactor.multipliedBy(taxRate);
605
+ };
606
+ EffectiveTaxRateCalculator.ɵprov = core.ɵɵdefineInjectable({ factory: function EffectiveTaxRateCalculator_Factory() { return new EffectiveTaxRateCalculator(); }, token: EffectiveTaxRateCalculator, providedIn: "root" });
607
+ EffectiveTaxRateCalculator = __decorate([
608
+ core.Injectable({ providedIn: 'root' })
609
+ ], EffectiveTaxRateCalculator);
610
+ return EffectiveTaxRateCalculator;
611
+ }());
612
+
613
+ var TaxRoundingService = /** @class */ (function () {
614
+ function TaxRoundingService() {
615
+ }
616
+ TaxRoundingService.prototype.halfEven = function (value, decimalPlaces) {
617
+ if (decimalPlaces === void 0) { decimalPlaces = 2; }
618
+ return new BigNumber(value).decimalPlaces(decimalPlaces, BigNumber.ROUND_HALF_EVEN);
619
+ };
620
+ TaxRoundingService.prototype.halfUp = function (value, decimalPlaces) {
621
+ if (decimalPlaces === void 0) { decimalPlaces = 2; }
622
+ return new BigNumber(value).decimalPlaces(decimalPlaces, BigNumber.ROUND_HALF_UP);
623
+ };
624
+ TaxRoundingService.ɵprov = core.ɵɵdefineInjectable({ factory: function TaxRoundingService_Factory() { return new TaxRoundingService(); }, token: TaxRoundingService, providedIn: "root" });
625
+ TaxRoundingService = __decorate([
626
+ core.Injectable({ providedIn: 'root' })
627
+ ], TaxRoundingService);
628
+ return TaxRoundingService;
629
+ }());
630
+
631
+ var TaxStore = /** @class */ (function (_super) {
632
+ __extends(TaxStore, _super);
633
+ function TaxStore() {
634
+ var _this = _super.call(this, {
635
+ arredondamentoAbnt: false
636
+ }) || this;
637
+ _this.getArredondamentoAbnt = function () {
638
+ return _this.get(function (state) { return state.arredondamentoAbnt; });
639
+ };
640
+ _this.setArredondamentoAbnt = function (arredondamentoAbnt) {
641
+ return _this.setState(function (state) { return (__assign(__assign({}, state), { arredondamentoAbnt: arredondamentoAbnt })); });
642
+ };
643
+ return _this;
644
+ }
645
+ TaxStore.ɵprov = core.ɵɵdefineInjectable({ factory: function TaxStore_Factory() { return new TaxStore(); }, token: TaxStore, providedIn: "root" });
646
+ TaxStore = __decorate([
647
+ core.Injectable({ providedIn: 'root' })
648
+ ], TaxStore);
649
+ return TaxStore;
650
+ }(componentStore.ComponentStore));
651
+
652
+ var TaxAmountCalculator = /** @class */ (function () {
653
+ function TaxAmountCalculator(effectiveTaxRateCalculator, taxRoundingService, taxStore) {
654
+ this.effectiveTaxRateCalculator = effectiveTaxRateCalculator;
655
+ this.taxRoundingService = taxRoundingService;
656
+ this.taxStore = taxStore;
657
+ }
658
+ /**
659
+ * Calculates the tax amount based on a taxable base and a tax rate.
660
+ *
661
+ * @param params - An object containing:
662
+ * @param params.taxableBase - The base amount on which the tax is calculated (as a BigNumber).
663
+ * @param params.taxRate - The tax rate to apply (as a BigNumber, representing a percentage).
664
+ * @returns The calculated tax amount as a BigNumber.
665
+ */
666
+ TaxAmountCalculator.prototype.calculateTaxAmount = function (_a) {
667
+ var taxableBase = _a.taxableBase, taxRate = _a.taxRate;
668
+ var taxAmount = new BigNumber(taxableBase)
669
+ .multipliedBy(taxRate)
670
+ .dividedBy(100);
671
+ return this.taxStore.getArredondamentoAbnt()
672
+ ? this.taxRoundingService.halfEven(taxAmount)
673
+ : this.taxRoundingService.halfUp(taxAmount.toNumber());
674
+ };
675
+ /**
676
+ * Calculates the tax amount considering a deferred tax value.
677
+ *
678
+ * @param params - The parameters for the calculation.
679
+ * @param params.taxableBase - The base amount on which tax is calculated.
680
+ * @param params.taxRate - The tax rate as a percentage.
681
+ * @param params.deferredTaxAmount - The amount of tax that is deferred and should be subtracted from the result.
682
+ * @returns The calculated tax amount after subtracting the deferred tax.
683
+ */
684
+ TaxAmountCalculator.prototype.calculateTaxAmountWithDeferredTax = function (_a) {
685
+ var taxableBase = _a.taxableBase, taxRate = _a.taxRate, deferredTaxAmount = _a.deferredTaxAmount;
686
+ var taxAmount = new BigNumber(taxableBase)
687
+ .multipliedBy(taxRate)
688
+ .dividedBy(100)
689
+ .minus(deferredTaxAmount);
690
+ return this.taxStore.getArredondamentoAbnt()
691
+ ? this.taxRoundingService.halfEven(taxAmount)
692
+ : this.taxRoundingService.halfUp(taxAmount.toNumber());
693
+ };
694
+ /**
695
+ * Calculates the tax amount based on the provided tax base, tax rate, and tax rate reduction,
696
+ * excluding deferred tax and governamental tax rate reductions.
697
+ *
698
+ * This method uses the effective tax rate calculated without considering governamental tax rate reductions,
699
+ * and applies it to the tax base to determine the final tax amount.
700
+ *
701
+ * @param params - The parameters for tax calculation.
702
+ * @param params.taxBase - The base amount on which the tax is calculated.
703
+ * @param params.taxRate - The initial tax rate before any reductions.
704
+ * @param params.taxRateReduction - The reduction applied to the tax rate.
705
+ * @returns The calculated tax amount as a BigNumber.
706
+ */
707
+ TaxAmountCalculator.prototype.calculateTaxAmountWithoutDeferredTaxAndWithoutGovernamentalTaxRate = function (_a) {
708
+ var taxBase = _a.taxBase, taxRate = _a.taxRate, taxRateReduction = _a.taxRateReduction;
709
+ var effectiveTaxRate = this.effectiveTaxRateCalculator.calculateEffectiveTaxRateWithoutGovernamentalTaxRateReduction({
710
+ taxRate: taxRate,
711
+ taxRateReduction: taxRateReduction
712
+ });
713
+ var taxAmount = new BigNumber(taxBase)
714
+ .multipliedBy(effectiveTaxRate)
715
+ .dividedBy(100);
716
+ return this.taxStore.getArredondamentoAbnt()
717
+ ? this.taxRoundingService.halfEven(taxAmount)
718
+ : this.taxRoundingService.halfUp(taxAmount.toNumber());
719
+ };
720
+ TaxAmountCalculator.ctorParameters = function () { return [
721
+ { type: EffectiveTaxRateCalculator },
722
+ { type: TaxRoundingService },
723
+ { type: TaxStore }
724
+ ]; };
725
+ TaxAmountCalculator.ɵprov = core.ɵɵdefineInjectable({ factory: function TaxAmountCalculator_Factory() { return new TaxAmountCalculator(core.ɵɵinject(EffectiveTaxRateCalculator), core.ɵɵinject(TaxRoundingService), core.ɵɵinject(TaxStore)); }, token: TaxAmountCalculator, providedIn: "root" });
726
+ TaxAmountCalculator = __decorate([
727
+ core.Injectable({ providedIn: 'root' })
728
+ ], TaxAmountCalculator);
729
+ return TaxAmountCalculator;
730
+ }());
731
+
539
732
  var ErpTributosService = /** @class */ (function () {
540
733
  function ErpTributosService(http, messageService) {
541
734
  this.http = http;
@@ -1086,59 +1279,6 @@
1086
1279
  return group.item.find(function (item) { return item.name === getGovernamentalTaxByBaseTax(baseTax); });
1087
1280
  };
1088
1281
 
1089
- var EffectiveTaxRateCalculator = /** @class */ (function () {
1090
- function EffectiveTaxRateCalculator() {
1091
- }
1092
- /**
1093
- * Calculates the effective tax rate by applying both the tax rate reduction and the governmental tax rate reduction factors.
1094
- *
1095
- * @param params - An object containing the following properties:
1096
- * @param params.taxRate - The base tax rate as a BigNumber.
1097
- * @param params.taxRateReduction - The tax rate reduction percentage as a BigNumber.
1098
- * @param params.governamentalTaxRateReduction - The governmental tax rate reduction percentage as a BigNumber.
1099
- * @returns The effective tax rate as a BigNumber after applying the reduction factors.
1100
- */
1101
- EffectiveTaxRateCalculator.prototype.calculateEffectiveTaxRate = function (_a) {
1102
- var taxRate = _a.taxRate, taxRateReduction = _a.taxRateReduction, governamentalTaxRateReduction = _a.governamentalTaxRateReduction;
1103
- var taxRateReductionFactor = taxRateReduction.isGreaterThan(0)
1104
- ? new BigNumber(1).minus(new BigNumber(taxRateReduction).dividedBy(100))
1105
- : new BigNumber(1);
1106
- var governamentalTaxRateReductionFactor = governamentalTaxRateReduction.isGreaterThan(0)
1107
- ? new BigNumber(1).minus(new BigNumber(governamentalTaxRateReduction).dividedBy(100))
1108
- : new BigNumber(1);
1109
- return taxRateReductionFactor
1110
- .multipliedBy(taxRate)
1111
- .multipliedBy(governamentalTaxRateReductionFactor);
1112
- };
1113
- /**
1114
- * Calculates the effective tax rate by applying a reduction factor to the given tax rate,
1115
- * excluding any governmental tax rate reductions.
1116
- *
1117
- * If the `taxRateReduction` is not a valid number, it defaults to zero.
1118
- * The reduction factor is computed as (1 - taxRateReduction / 100) if `taxRateReduction` is greater than zero,
1119
- * otherwise it is 1 (no reduction).
1120
- *
1121
- * @param params - An object containing:
1122
- * - taxRate: The original tax rate as a BigNumber.
1123
- * - taxRateReduction: The tax rate reduction percentage as a BigNumber.
1124
- * @returns The effective tax rate as a BigNumber after applying the reduction factor.
1125
- */
1126
- EffectiveTaxRateCalculator.prototype.calculateEffectiveTaxRateWithoutGovernamentalTaxRateReduction = function (_a) {
1127
- var taxRate = _a.taxRate, taxRateReduction = _a.taxRateReduction;
1128
- if (taxRateReduction.isNaN())
1129
- taxRateReduction = new BigNumber(0);
1130
- var taxRateReductionFactor = taxRateReduction.isGreaterThan(0)
1131
- ? new BigNumber(1).minus(new BigNumber(taxRateReduction).dividedBy(100))
1132
- : new BigNumber(1);
1133
- return taxRateReductionFactor.multipliedBy(taxRate);
1134
- };
1135
- EffectiveTaxRateCalculator.ɵprov = core.ɵɵdefineInjectable({ factory: function EffectiveTaxRateCalculator_Factory() { return new EffectiveTaxRateCalculator(); }, token: EffectiveTaxRateCalculator, providedIn: "root" });
1136
- EffectiveTaxRateCalculator = __decorate([
1137
- core.Injectable({ providedIn: 'root' })
1138
- ], EffectiveTaxRateCalculator);
1139
- return EffectiveTaxRateCalculator;
1140
- }());
1141
-
1142
1282
  var EffectiveTaxRateCalculationRule = /** @class */ (function () {
1143
1283
  function EffectiveTaxRateCalculationRule(effectiveTaxRateCalculator) {
1144
1284
  this.effectiveTaxRateCalculator = effectiveTaxRateCalculator;
@@ -1222,7 +1362,9 @@
1222
1362
  }());
1223
1363
 
1224
1364
  var GrossAmountCalculator = /** @class */ (function () {
1225
- function GrossAmountCalculator() {
1365
+ function GrossAmountCalculator(taxRoundingService, taxStore) {
1366
+ this.taxRoundingService = taxRoundingService;
1367
+ this.taxStore = taxStore;
1226
1368
  }
1227
1369
  /**
1228
1370
  * Calculates the gross amount based on the provided taxable base and tax rate.
@@ -1234,9 +1376,16 @@
1234
1376
  */
1235
1377
  GrossAmountCalculator.prototype.calculateGrossAmount = function (_a) {
1236
1378
  var taxableBase = _a.taxableBase, taxRate = _a.taxRate;
1237
- return taxableBase.multipliedBy(taxRate).dividedBy(100);
1379
+ var taxAmount = taxableBase.multipliedBy(taxRate).dividedBy(100);
1380
+ return this.taxStore.getArredondamentoAbnt()
1381
+ ? this.taxRoundingService.halfEven(taxAmount)
1382
+ : this.taxRoundingService.halfUp(taxAmount.toNumber());
1238
1383
  };
1239
- GrossAmountCalculator.ɵprov = core.ɵɵdefineInjectable({ factory: function GrossAmountCalculator_Factory() { return new GrossAmountCalculator(); }, token: GrossAmountCalculator, providedIn: "root" });
1384
+ GrossAmountCalculator.ctorParameters = function () { return [
1385
+ { type: TaxRoundingService },
1386
+ { type: TaxStore }
1387
+ ]; };
1388
+ GrossAmountCalculator.ɵprov = core.ɵɵdefineInjectable({ factory: function GrossAmountCalculator_Factory() { return new GrossAmountCalculator(core.ɵɵinject(TaxRoundingService), core.ɵɵinject(TaxStore)); }, token: GrossAmountCalculator, providedIn: "root" });
1240
1389
  GrossAmountCalculator = __decorate([
1241
1390
  core.Injectable({ providedIn: 'root' })
1242
1391
  ], GrossAmountCalculator);
@@ -1285,9 +1434,7 @@
1285
1434
  taxableBase: taxableBase,
1286
1435
  taxRate: taxRate
1287
1436
  });
1288
- return grossAmount
1289
- .decimalPlaces(2)
1290
- .toNumber();
1437
+ return grossAmount.toNumber();
1291
1438
  }), operators.filter(function (grossAmount) {
1292
1439
  return grossAmount !==
1293
1440
  formGroup.get('valorBrutoImposto').value;
@@ -1396,71 +1543,6 @@
1396
1543
  return ManualTaxCalculationRule;
1397
1544
  }());
1398
1545
 
1399
- var TaxAmountCalculator = /** @class */ (function () {
1400
- function TaxAmountCalculator(effectiveTaxRateCalculator) {
1401
- this.effectiveTaxRateCalculator = effectiveTaxRateCalculator;
1402
- }
1403
- /**
1404
- * Calculates the tax amount based on a taxable base and a tax rate.
1405
- *
1406
- * @param params - An object containing:
1407
- * @param params.taxableBase - The base amount on which the tax is calculated (as a BigNumber).
1408
- * @param params.taxRate - The tax rate to apply (as a BigNumber, representing a percentage).
1409
- * @returns The calculated tax amount as a BigNumber.
1410
- */
1411
- TaxAmountCalculator.prototype.calculateTaxAmount = function (_a) {
1412
- var taxableBase = _a.taxableBase, taxRate = _a.taxRate;
1413
- return new BigNumber(taxableBase).multipliedBy(taxRate).dividedBy(100);
1414
- };
1415
- /**
1416
- * Calculates the tax amount considering a deferred tax value.
1417
- *
1418
- * @param params - The parameters for the calculation.
1419
- * @param params.taxableBase - The base amount on which tax is calculated.
1420
- * @param params.taxRate - The tax rate as a percentage.
1421
- * @param params.deferredTaxAmount - The amount of tax that is deferred and should be subtracted from the result.
1422
- * @returns The calculated tax amount after subtracting the deferred tax.
1423
- */
1424
- TaxAmountCalculator.prototype.calculateTaxAmountWithDeferredTax = function (_a) {
1425
- var taxableBase = _a.taxableBase, taxRate = _a.taxRate, deferredTaxAmount = _a.deferredTaxAmount;
1426
- return new BigNumber(taxableBase)
1427
- .multipliedBy(taxRate)
1428
- .dividedBy(100)
1429
- .minus(deferredTaxAmount);
1430
- };
1431
- /**
1432
- * Calculates the tax amount based on the provided tax base, tax rate, and tax rate reduction,
1433
- * excluding deferred tax and governamental tax rate reductions.
1434
- *
1435
- * This method uses the effective tax rate calculated without considering governamental tax rate reductions,
1436
- * and applies it to the tax base to determine the final tax amount.
1437
- *
1438
- * @param params - The parameters for tax calculation.
1439
- * @param params.taxBase - The base amount on which the tax is calculated.
1440
- * @param params.taxRate - The initial tax rate before any reductions.
1441
- * @param params.taxRateReduction - The reduction applied to the tax rate.
1442
- * @returns The calculated tax amount as a BigNumber.
1443
- */
1444
- TaxAmountCalculator.prototype.calculateTaxAmountWithoutDeferredTaxAndWithoutGovernamentalTaxRate = function (_a) {
1445
- var taxBase = _a.taxBase, taxRate = _a.taxRate, taxRateReduction = _a.taxRateReduction;
1446
- var effectiveTaxRate = this.effectiveTaxRateCalculator.calculateEffectiveTaxRateWithoutGovernamentalTaxRateReduction({
1447
- taxRate: taxRate,
1448
- taxRateReduction: taxRateReduction
1449
- });
1450
- return new BigNumber(taxBase)
1451
- .multipliedBy(effectiveTaxRate)
1452
- .dividedBy(100);
1453
- };
1454
- TaxAmountCalculator.ctorParameters = function () { return [
1455
- { type: EffectiveTaxRateCalculator }
1456
- ]; };
1457
- TaxAmountCalculator.ɵprov = core.ɵɵdefineInjectable({ factory: function TaxAmountCalculator_Factory() { return new TaxAmountCalculator(core.ɵɵinject(EffectiveTaxRateCalculator)); }, token: TaxAmountCalculator, providedIn: "root" });
1458
- TaxAmountCalculator = __decorate([
1459
- core.Injectable({ providedIn: 'root' })
1460
- ], TaxAmountCalculator);
1461
- return TaxAmountCalculator;
1462
- }());
1463
-
1464
1546
  var TaxAmountCalculationRule = /** @class */ (function () {
1465
1547
  function TaxAmountCalculationRule(taxAmountCalculator) {
1466
1548
  this.taxAmountCalculator = taxAmountCalculator;
@@ -25641,7 +25723,8 @@
25641
25723
  }());
25642
25724
 
25643
25725
  var ErpTributosComponent = /** @class */ (function () {
25644
- function ErpTributosComponent(messageService, formBuilder, changeDetector, translate, e027StrLookup, beneficioFiscalLookup, e027eqiLookup, naturezaReceitaLookup, classificacaoTributariaLookup, lookupUtils, erpTributosService, gtag, rulesService, localeService) {
25726
+ function ErpTributosComponent(loadingContext, messageService, formBuilder, changeDetector, translate, e027StrLookup, beneficioFiscalLookup, e027eqiLookup, naturezaReceitaLookup, classificacaoTributariaLookup, lookupUtils, erpTributosService, gtag, rulesService, localeService, taxRoundingService, taxAmountCalculator, featureToggleService, taxStore) {
25727
+ this.loadingContext = loadingContext;
25645
25728
  this.messageService = messageService;
25646
25729
  this.formBuilder = formBuilder;
25647
25730
  this.changeDetector = changeDetector;
@@ -25656,6 +25739,10 @@
25656
25739
  this.gtag = gtag;
25657
25740
  this.rulesService = rulesService;
25658
25741
  this.localeService = localeService;
25742
+ this.taxRoundingService = taxRoundingService;
25743
+ this.taxAmountCalculator = taxAmountCalculator;
25744
+ this.featureToggleService = featureToggleService;
25745
+ this.taxStore = taxStore;
25659
25746
  this.camposBloqueados = false;
25660
25747
  this.currencyLocaleOptions = {
25661
25748
  currencySymbol: '',
@@ -25671,7 +25758,6 @@
25671
25758
  this.tributosValue = [];
25672
25759
  this.reload = true;
25673
25760
  this.indexAccordion = [];
25674
- this.isLoading = false;
25675
25761
  this.menuItemPis = false;
25676
25762
  this.menuItemCofins = false;
25677
25763
  this.menuItemIpi = false;
@@ -25765,6 +25851,7 @@
25765
25851
  decimalSeparator: this.currencyLocaleOptions.decimalSeparator,
25766
25852
  thousandsSeparator: this.currencyLocaleOptions.thousandsSeparator
25767
25853
  };
25854
+ this.getArredondamentoAbnt();
25768
25855
  };
25769
25856
  ErpTributosComponent.prototype.ngOnChanges = function (changes) {
25770
25857
  var variaveisAlteradas = Object.keys(changes);
@@ -28892,10 +28979,6 @@
28892
28979
  imposto != exports.EnumTipoTributo.FCP_ST_RETIDO_ANT &&
28893
28980
  imposto != exports.EnumTipoTributo.FUNRURAL_TOTAL);
28894
28981
  };
28895
- ErpTributosComponent.prototype.roundImposto = function (number, decimals) {
28896
- var x = Math.pow(10, Number(decimals) + 1);
28897
- return (Number(number) + 1 / x).toFixed(decimals);
28898
- };
28899
28982
  ErpTributosComponent.prototype.addMessageErrorBaseDiferente = function (impostos, grupo, summaryMessage, detailMessage) {
28900
28983
  var impostoFiltrado = impostos.filter(function (imposto) {
28901
28984
  return ![
@@ -28949,7 +29032,12 @@
28949
29032
  .value;
28950
29033
  if (base != undefined &&
28951
29034
  aliquota != undefined)
28952
- it.formGroup.controls.valor.patchValue(_this.roundImposto((base * aliquota) / 100, 2));
29035
+ it.formGroup.controls.valor.patchValue(_this.taxAmountCalculator
29036
+ .calculateTaxAmount({
29037
+ taxableBase: new BigNumber(Number(base)),
29038
+ taxRate: new BigNumber(Number(aliquota))
29039
+ })
29040
+ .toNumber());
28953
29041
  }
28954
29042
  else if (tributo == exports.EnumTipoTributo.ICMS &&
28955
29043
  it.formGroup.controls.situacaoTributaria
@@ -28960,7 +29048,12 @@
28960
29048
  .value;
28961
29049
  if (base != undefined &&
28962
29050
  aliquota != undefined)
28963
- it.formGroup.controls.valor.patchValue(_this.roundImposto((base * aliquota) / 100, 2));
29051
+ it.formGroup.controls.valor.patchValue(_this.taxAmountCalculator
29052
+ .calculateTaxAmount({
29053
+ taxableBase: new BigNumber(Number(base)),
29054
+ taxRate: new BigNumber(Number(aliquota))
29055
+ })
29056
+ .toNumber());
28964
29057
  }
28965
29058
  else if (tributo ===
28966
29059
  exports.EnumTipoTributo.FUNRURAL_INSS ||
@@ -28981,7 +29074,12 @@
28981
29074
  .value;
28982
29075
  if (base != undefined &&
28983
29076
  aliquota != undefined) {
28984
- it.formGroup.controls.valor.patchValue(_this.roundImposto((base * aliquota) / 100, 2));
29077
+ it.formGroup.controls.valor.patchValue(_this.taxAmountCalculator
29078
+ .calculateTaxAmount({
29079
+ taxableBase: new BigNumber(Number(base)),
29080
+ taxRate: new BigNumber(Number(aliquota))
29081
+ })
29082
+ .toNumber());
28985
29083
  }
28986
29084
  else {
28987
29085
  it.formGroup.controls.valor.reset(null);
@@ -29037,8 +29135,10 @@
29037
29135
  : valores.base;
29038
29136
  }
29039
29137
  if (!angularComponents$1.isNullOrUndefined(imposto === null || imposto === void 0 ? void 0 : imposto.formGroup.value.valor)) {
29040
- valores.valor = Number(this_1.roundImposto(Number(valores.valor) +
29041
- Number(imposto.formGroup.value.valor), 2));
29138
+ valores.valor = this_1.taxRoundingService
29139
+ .halfUp(Number(valores.valor) +
29140
+ Number(imposto.formGroup.value.valor), 2)
29141
+ .toNumber();
29042
29142
  }
29043
29143
  };
29044
29144
  var this_1 = this;
@@ -30681,7 +30781,24 @@
30681
30781
  .setValue(EnumTipoCalculoImposto.MANUAL, { emitEvent: false });
30682
30782
  }
30683
30783
  };
30784
+ ErpTributosComponent.prototype.getArredondamentoAbnt = function () {
30785
+ var _this = this;
30786
+ this.loadingContext.push();
30787
+ this.featureToggleService
30788
+ .isEnabled({
30789
+ domain: 'erpx_cpl_imp',
30790
+ service: 'calculo_impostos',
30791
+ name: 'arredondamentoAbnt'
30792
+ })
30793
+ .pipe(operators.first(), operators.finalize(function () { return _this.loadingContext.pop(); }))
30794
+ .subscribe({
30795
+ next: function (arredondamentoAbnt) {
30796
+ _this.taxStore.setArredondamentoAbnt(arredondamentoAbnt);
30797
+ }
30798
+ });
30799
+ };
30684
30800
  ErpTributosComponent.ctorParameters = function () { return [
30801
+ { type: LoadingContext },
30685
30802
  { type: api.MessageService },
30686
30803
  { type: forms.FormBuilder },
30687
30804
  { type: core.ChangeDetectorRef },
@@ -30695,7 +30812,11 @@
30695
30812
  { type: ErpTributosService },
30696
30813
  { type: platformUtils.GTagService },
30697
30814
  { type: RulesService },
30698
- { type: angularComponents$1.LocaleService }
30815
+ { type: angularComponents$1.LocaleService },
30816
+ { type: TaxRoundingService },
30817
+ { type: TaxAmountCalculator },
30818
+ { type: platformComponents.FeatureToggleService },
30819
+ { type: TaxStore }
30699
30820
  ]; };
30700
30821
  __decorate([
30701
30822
  core.Input()
@@ -30730,7 +30851,8 @@
30730
30851
  ErpTributosComponent = __decorate([
30731
30852
  core.Component({
30732
30853
  selector: 'erp-tributos',
30733
- template: "<s-loading-state [loading]=\"isLoading\">\n <div class=\"ui-fluid\">\n <div class=\"ui-g\">\n <div class=\"ui-g-3\">\n <s-button\n [priority]=\"ButtonPriority.Default\"\n [model]=\"getActions()\"\n [auxiliary]=\"false\"\n [label]=\"'erpx.tributos.actions_label' | translate\"\n [disabled]=\"camposBloqueados == true\"\n >\n </s-button>\n </div>\n </div>\n </div>\n\n <div class=\"ui-g\">\n <div class=\"ui-g-12\">\n <p-accordion [(activeIndex)]=\"indexAccordion\" [multiple]=\"true\">\n <p-accordionTab *ngFor=\"let grupo of grupos\">\n <p-header>\n <span\n *ngIf=\"isGroupInvalid(grupo)\"\n class=\"sds-badge-error\"\n >\n </span>\n {{ grupo.grupo | translate }}\n </p-header>\n\n <div *ngFor=\"let item of grupo.item\">\n <div\n class=\"flex flex-wrap justify-between items-center mt-8\"\n >\n <div class=\"flex items-center flex-wrap\">\n <h3>{{ item.label | translate }}</h3>\n\n <s-button\n *ngIf=\"\n permissionMemoriaCalculo &&\n hideButton(item.name)\n \"\n [priority]=\"ButtonPriority.Link\"\n [label]=\"\n getTranslateButton(item.name)\n | translate\n \"\n (onClick)=\"memoriaCalculo(item)\"\n [size]=\"ButtonSize.Small\"\n [disabled]=\"disabledButton(item)\"\n iconClass=\"far fa-cog\"\n [slide]=\"true\"\n [animation]=\"ButtonAnimation.Rotate\"\n ></s-button>\n </div>\n\n <s-badge\n *ngIf=\"isBadgeVisible(item)\"\n [color]=\"getBadgeColor(item)\"\n [text]=\"getBadgeText(item)\"\n [infoSign]=\"getBadgeInfoSign(item)\"\n >\n </s-badge>\n </div>\n\n <hr />\n\n <form novalidate [formGroup]=\"item.formGroup\">\n <s-dynamic-form\n [form]=\"item.formGroup\"\n [fields]=\"item.formField\"\n [errorMessages]=\"{\n required:\n 'erpx.tributos.fields_required_validator'\n | translate\n }\"\n >\n </s-dynamic-form>\n </form>\n </div>\n </p-accordionTab>\n </p-accordion>\n </div>\n </div>\n</s-loading-state>\n",
30854
+ template: "<s-loading-state [loading]=\"loadingContext.isLoading()\">\n <div class=\"ui-fluid\">\n <div class=\"ui-g\">\n <div class=\"ui-g-3\">\n <s-button\n [priority]=\"ButtonPriority.Default\"\n [model]=\"getActions()\"\n [auxiliary]=\"false\"\n [label]=\"'erpx.tributos.actions_label' | translate\"\n [disabled]=\"camposBloqueados == true\"\n >\n </s-button>\n </div>\n </div>\n </div>\n\n <div class=\"ui-g\">\n <div class=\"ui-g-12\">\n <p-accordion [(activeIndex)]=\"indexAccordion\" [multiple]=\"true\">\n <p-accordionTab *ngFor=\"let grupo of grupos\">\n <p-header>\n <span\n *ngIf=\"isGroupInvalid(grupo)\"\n class=\"sds-badge-error\"\n >\n </span>\n {{ grupo.grupo | translate }}\n </p-header>\n\n <div *ngFor=\"let item of grupo.item\">\n <div\n class=\"flex flex-wrap justify-between items-center mt-8\"\n >\n <div class=\"flex items-center flex-wrap\">\n <h3>{{ item.label | translate }}</h3>\n\n <s-button\n *ngIf=\"\n permissionMemoriaCalculo &&\n hideButton(item.name)\n \"\n [priority]=\"ButtonPriority.Link\"\n [label]=\"\n getTranslateButton(item.name)\n | translate\n \"\n (onClick)=\"memoriaCalculo(item)\"\n [size]=\"ButtonSize.Small\"\n [disabled]=\"disabledButton(item)\"\n iconClass=\"far fa-cog\"\n [slide]=\"true\"\n [animation]=\"ButtonAnimation.Rotate\"\n ></s-button>\n </div>\n\n <s-badge\n *ngIf=\"isBadgeVisible(item)\"\n [color]=\"getBadgeColor(item)\"\n [text]=\"getBadgeText(item)\"\n [infoSign]=\"getBadgeInfoSign(item)\"\n >\n </s-badge>\n </div>\n\n <hr />\n\n <form novalidate [formGroup]=\"item.formGroup\">\n <s-dynamic-form\n [form]=\"item.formGroup\"\n [fields]=\"item.formField\"\n [errorMessages]=\"{\n required:\n 'erpx.tributos.fields_required_validator'\n | translate\n }\"\n >\n </s-dynamic-form>\n </form>\n </div>\n </p-accordionTab>\n </p-accordion>\n </div>\n </div>\n</s-loading-state>\n",
30855
+ providers: [LoadingContext],
30734
30856
  styles: [".flex{display:-ms-flexbox;display:flex}.items-center{-ms-flex-align:center;align-items:center}.justify-between{-ms-flex-pack:justify;justify-content:space-between}.mt-8{margin-top:1rem}.flex-wrap{-ms-flex-wrap:wrap;flex-wrap:wrap}"]
30735
30857
  })
30736
30858
  ], ErpTributosComponent);
@@ -32841,13 +32963,760 @@
32841
32963
  return ErpLoteSerieModule;
32842
32964
  }());
32843
32965
 
32966
+ var ErpRateioEditorService = /** @class */ (function () {
32967
+ function ErpRateioEditorService(http, messageService) {
32968
+ this.http = http;
32969
+ this.messageService = messageService;
32970
+ this.baseQueries = 'erpx_fin_rat/rateio/queries';
32971
+ this.baseActions = 'erpx_fin_rat/rateio/actions';
32972
+ }
32973
+ ErpRateioEditorService.prototype.retornarRateio = function (input) {
32974
+ return this.http
32975
+ .post(this.baseQueries + "/retornarRateio", input)
32976
+ .pipe(this.defaultCatch());
32977
+ };
32978
+ ErpRateioEditorService.prototype.sugerirRateio = function (input) {
32979
+ return this.http
32980
+ .post(this.baseQueries + "/sugerirRateio", input)
32981
+ .pipe(this.defaultCatch());
32982
+ };
32983
+ ErpRateioEditorService.prototype.gravarRateioManual = function (input) {
32984
+ return this.http
32985
+ .post(this.baseActions + "/gravarRateioManual", input)
32986
+ .pipe(this.defaultCatch());
32987
+ };
32988
+ ErpRateioEditorService.prototype.defaultCatch = function () {
32989
+ var _this = this;
32990
+ return operators.catchError(function (err) {
32991
+ var _a;
32992
+ if (err) {
32993
+ var summary = (err === null || err === void 0 ? void 0 : err.status) ? String(err.status) : 'Error';
32994
+ var detail = ((_a = err === null || err === void 0 ? void 0 : err.error) === null || _a === void 0 ? void 0 : _a.message) || (err === null || err === void 0 ? void 0 : err.statusText) || (err === null || err === void 0 ? void 0 : err.message) || 'Error';
32995
+ _this.messageService.add({ severity: 'error', summary: summary, detail: detail });
32996
+ }
32997
+ return rxjs.throwError(err);
32998
+ });
32999
+ };
33000
+ ErpRateioEditorService.ctorParameters = function () { return [
33001
+ { type: http.HttpClient },
33002
+ { type: api.MessageService }
33003
+ ]; };
33004
+ ErpRateioEditorService = __decorate([
33005
+ core.Injectable()
33006
+ ], ErpRateioEditorService);
33007
+ return ErpRateioEditorService;
33008
+ }());
33009
+
33010
+ var ErpRateioEditorComponent = /** @class */ (function () {
33011
+ function ErpRateioEditorComponent(fb, service, translate, e091PlfLookup, e044CcuLookup) {
33012
+ this.fb = fb;
33013
+ this.service = service;
33014
+ this.translate = translate;
33015
+ this.e091PlfLookup = e091PlfLookup;
33016
+ this.e044CcuLookup = e044CcuLookup;
33017
+ this.readOnly = false;
33018
+ this.showSugestaoButton = true;
33019
+ /**
33020
+ * Critério de rateio padrão usado pela API de sugestão.
33021
+ * Default: 'V3' (Despesas — Conta X C. Custos).
33022
+ */
33023
+ this.criRat = 'V3';
33024
+ // === OUTPUTS ===
33025
+ this.save = new core.EventEmitter();
33026
+ this.cancel = new core.EventEmitter();
33027
+ this.change = new core.EventEmitter();
33028
+ this.error = new core.EventEmitter();
33029
+ // === CONSTANTES EXPOSTAS AO TEMPLATE ===
33030
+ this.ButtonPriority = angularComponents$1.ButtonPriority;
33031
+ this.ButtonSize = angularComponents$1.ButtonSize;
33032
+ this.loading = false;
33033
+ this.selection = [];
33034
+ this.contasDataSource = [];
33035
+ this.editingRowBackup = null;
33036
+ this.editingCCBackup = null;
33037
+ // === MODAL CONTA FINANCEIRA ===
33038
+ this.displayContaDialog = false;
33039
+ this.editingContaIndex = null;
33040
+ // === MODAL CENTRO DE CUSTO ===
33041
+ this.displayCCDialog = false;
33042
+ this.editingCCContaIndex = null;
33043
+ this.editingCCIndex = null;
33044
+ this.ngUnsubscribe = new rxjs.Subject();
33045
+ this.formGroup = this.fb.group({
33046
+ contas: this.fb.array([])
33047
+ });
33048
+ }
33049
+ Object.defineProperty(ErpRateioEditorComponent.prototype, "effectiveReadOnly", {
33050
+ get: function () {
33051
+ var _a;
33052
+ var ic = (_a = this.loadedContext) === null || _a === void 0 ? void 0 : _a.integracaoControladoria;
33053
+ var hasIntegracao = !!ic && (ic.contabilidade === true ||
33054
+ ic.tributos === true ||
33055
+ ic.patrimonio === true);
33056
+ return this.readOnly || hasIntegracao;
33057
+ },
33058
+ enumerable: true,
33059
+ configurable: true
33060
+ });
33061
+ Object.defineProperty(ErpRateioEditorComponent.prototype, "contasFormArray", {
33062
+ get: function () {
33063
+ return this.formGroup.get('contas');
33064
+ },
33065
+ enumerable: true,
33066
+ configurable: true
33067
+ });
33068
+ Object.defineProperty(ErpRateioEditorComponent.prototype, "valorBase", {
33069
+ get: function () {
33070
+ var _a, _b;
33071
+ return (_b = (_a = this.loadedContext) === null || _a === void 0 ? void 0 : _a.valorBase) !== null && _b !== void 0 ? _b : 0;
33072
+ },
33073
+ enumerable: true,
33074
+ configurable: true
33075
+ });
33076
+ Object.defineProperty(ErpRateioEditorComponent.prototype, "percentualRestante", {
33077
+ get: function () {
33078
+ var _a;
33079
+ var soma = this.contasDataSource.reduce(function (acc, conta) { return acc + (conta.percentual || 0); }, 0);
33080
+ return +(100 - soma).toFixed((_a = this.config.percentageScale) !== null && _a !== void 0 ? _a : 4);
33081
+ },
33082
+ enumerable: true,
33083
+ configurable: true
33084
+ });
33085
+ Object.defineProperty(ErpRateioEditorComponent.prototype, "valorRestante", {
33086
+ get: function () {
33087
+ var _a;
33088
+ var soma = this.contasDataSource.reduce(function (acc, conta) { return acc + (conta.valorRateadoConta || 0); }, 0);
33089
+ return +(this.valorBase - soma).toFixed((_a = this.config.currencyScale) !== null && _a !== void 0 ? _a : 2);
33090
+ },
33091
+ enumerable: true,
33092
+ configurable: true
33093
+ });
33094
+ Object.defineProperty(ErpRateioEditorComponent.prototype, "numberFormatOptions", {
33095
+ get: function () {
33096
+ var _a, _b;
33097
+ if (this.currencyCode) {
33098
+ return {
33099
+ numberFormatOptions: {
33100
+ style: 'currency',
33101
+ currency: this.currencyCode
33102
+ }
33103
+ };
33104
+ }
33105
+ return {
33106
+ numberFormatOptions: {
33107
+ style: 'decimal',
33108
+ minimumFractionDigits: (_a = this.config.currencyScale) !== null && _a !== void 0 ? _a : 2,
33109
+ maximumFractionDigits: (_b = this.config.currencyScale) !== null && _b !== void 0 ? _b : 2
33110
+ }
33111
+ };
33112
+ },
33113
+ enumerable: true,
33114
+ configurable: true
33115
+ });
33116
+ ErpRateioEditorComponent.prototype.ngOnChanges = function (changes) {
33117
+ var movimentoChanged = changes.idMovimento || changes.tipoMovimento;
33118
+ if (movimentoChanged && this.idMovimento && this.tipoMovimento) {
33119
+ // Modo conectado: carrega via API
33120
+ this.carregarRateio();
33121
+ }
33122
+ else if (this.isStandalone && (changes.initialContext || changes.initialRateios || movimentoChanged)) {
33123
+ // Modo standalone: usa inputs diretos (mesmo que vazios)
33124
+ this.inicializarStandalone();
33125
+ }
33126
+ };
33127
+ Object.defineProperty(ErpRateioEditorComponent.prototype, "rateios", {
33128
+ /** Retorna o conteúdo atual da grid (uso standalone — quem consome lê os rateios daqui). */
33129
+ get: function () {
33130
+ return this.contasDataSource;
33131
+ },
33132
+ enumerable: true,
33133
+ configurable: true
33134
+ });
33135
+ Object.defineProperty(ErpRateioEditorComponent.prototype, "isStandalone", {
33136
+ /** Indica se o componente está operando sem idMovimento (modo standalone). */
33137
+ get: function () {
33138
+ return !this.idMovimento;
33139
+ },
33140
+ enumerable: true,
33141
+ configurable: true
33142
+ });
33143
+ Object.defineProperty(ErpRateioEditorComponent.prototype, "isReady", {
33144
+ /** Indica se o componente está pronto para exibir UI (modo conectado carregou OU modo standalone inicializado). */
33145
+ get: function () {
33146
+ return !!this.loadedContext || this.isStandalone;
33147
+ },
33148
+ enumerable: true,
33149
+ configurable: true
33150
+ });
33151
+ ErpRateioEditorComponent.prototype.ngOnDestroy = function () {
33152
+ this.ngUnsubscribe.next();
33153
+ this.ngUnsubscribe.complete();
33154
+ };
33155
+ // === AÇÕES PÚBLICAS ===
33156
+ ErpRateioEditorComponent.prototype.onSalvar = function () {
33157
+ var _this = this;
33158
+ if (this.effectiveReadOnly) {
33159
+ return;
33160
+ }
33161
+ var ctx = this.loadedContext;
33162
+ var input = {
33163
+ idMovimento: this.idMovimento,
33164
+ tipoMovimento: this.tipoMovimento,
33165
+ agrupadorId: ctx.agrupadorId,
33166
+ e070fil_id: ctx.e070fil.id,
33167
+ criterioRateio: ctx.criRat,
33168
+ dataBase: ctx.dataBase,
33169
+ dataMovimento: ctx.dataMovimento,
33170
+ rateios: this.contasDataSource
33171
+ };
33172
+ this.loading = true;
33173
+ this.service.gravarRateioManual(input)
33174
+ .pipe(operators.takeUntil(this.ngUnsubscribe), operators.finalize(function () { return (_this.loading = false); }))
33175
+ .subscribe(function () {
33176
+ _this.save.emit({ idMovimento: _this.idMovimento, tipoMovimento: _this.tipoMovimento, rateios: _this.contasDataSource });
33177
+ }, function (err) { var _a; return _this.error.emit({ operacao: 'save', message: ((_a = err === null || err === void 0 ? void 0 : err.error) === null || _a === void 0 ? void 0 : _a.message) || (err === null || err === void 0 ? void 0 : err.message) || 'Erro ao salvar rateio', originalError: err }); });
33178
+ };
33179
+ ErpRateioEditorComponent.prototype.onSugerir = function () {
33180
+ var _this = this;
33181
+ var _a, _b;
33182
+ if (this.effectiveReadOnly || !this.showSugestaoButton) {
33183
+ return;
33184
+ }
33185
+ var ctx = this.loadedContext;
33186
+ var e070fil_id = this.filialId || ((_a = ctx === null || ctx === void 0 ? void 0 : ctx.e070fil) === null || _a === void 0 ? void 0 : _a.id);
33187
+ var criterio = this.criRat || (ctx === null || ctx === void 0 ? void 0 : ctx.criRat);
33188
+ var valorBase = (_b = ctx === null || ctx === void 0 ? void 0 : ctx.valorBase) !== null && _b !== void 0 ? _b : 0;
33189
+ if (!e070fil_id || !criterio) {
33190
+ return;
33191
+ }
33192
+ var parametro = {
33193
+ e070fil_id: e070fil_id,
33194
+ valorBase: valorBase,
33195
+ criRat: criterio,
33196
+ dataBase: ctx === null || ctx === void 0 ? void 0 : ctx.dataBase,
33197
+ dataMovimento: ctx === null || ctx === void 0 ? void 0 : ctx.dataMovimento
33198
+ };
33199
+ if (this.idMovimento) {
33200
+ parametro.idMovimento = this.idMovimento;
33201
+ }
33202
+ var input = {
33203
+ tipo: this.tipoMovimento,
33204
+ parametros: [parametro]
33205
+ };
33206
+ this.loading = true;
33207
+ this.service.sugerirRateio(input)
33208
+ .pipe(operators.takeUntil(this.ngUnsubscribe), operators.finalize(function () { return (_this.loading = false); }))
33209
+ .subscribe(function (resp) {
33210
+ var sugestao = (resp.sugestao || [])
33211
+ .find(function (s) { return !_this.idMovimento || s.idMovimento === _this.idMovimento; })
33212
+ || (resp.sugestao || [])[0];
33213
+ var rateio = sugestao === null || sugestao === void 0 ? void 0 : sugestao.rateio;
33214
+ if (!sugestao || !rateio || rateio.length === 0) {
33215
+ return;
33216
+ }
33217
+ _this.popularComRateios(rateio);
33218
+ _this.emitChange();
33219
+ }, function (err) { var _a; return _this.error.emit({ operacao: 'suggest', message: ((_a = err === null || err === void 0 ? void 0 : err.error) === null || _a === void 0 ? void 0 : _a.message) || (err === null || err === void 0 ? void 0 : err.message) || 'Erro ao sugerir rateio', originalError: err }); });
33220
+ };
33221
+ // === MODAL CONTA FINANCEIRA ===
33222
+ ErpRateioEditorComponent.prototype.openContaDialog = function (editIndex) {
33223
+ var _this = this;
33224
+ var _a;
33225
+ this.editingContaIndex = editIndex != null ? editIndex : null;
33226
+ var remainingPct = this.editingContaIndex != null
33227
+ ? this.percentualRestante + this.contasDataSource[this.editingContaIndex].percentual
33228
+ : this.percentualRestante;
33229
+ var contaValue = null;
33230
+ var percentualValue = remainingPct > 0 ? remainingPct : null;
33231
+ var valorValue = percentualValue != null
33232
+ ? +((percentualValue / 100) * this.valorBase).toFixed((_a = this.config.currencyScale) !== null && _a !== void 0 ? _a : 2)
33233
+ : null;
33234
+ if (this.editingContaIndex != null) {
33235
+ var conta = this.contasDataSource[this.editingContaIndex];
33236
+ contaValue = { id: conta.idContaFinanceira, label: conta.contaFinanceira };
33237
+ percentualValue = conta.percentual;
33238
+ valorValue = conta.valorRateadoConta;
33239
+ }
33240
+ this.contaDialogFormGroup = this.fb.group({
33241
+ contaFinanceira: [{ value: contaValue, disabled: this.editingContaIndex != null }, forms.Validators.required],
33242
+ percentual: [{ value: percentualValue, disabled: false }, forms.Validators.required],
33243
+ valor: [{ value: valorValue, disabled: false }, forms.Validators.required]
33244
+ });
33245
+ this.setupPercentualValorSync(this.contaDialogFormGroup, function () { return _this.valorBase; });
33246
+ this.contaDialogFields = this.getContaDialogFields();
33247
+ this.displayContaDialog = true;
33248
+ };
33249
+ ErpRateioEditorComponent.prototype.onSaveContaDialog = function () {
33250
+ var _a;
33251
+ if (this.contaDialogFormGroup.invalid) {
33252
+ return;
33253
+ }
33254
+ var data = this.contaDialogFormGroup.getRawValue();
33255
+ var contaFinanceira = data.contaFinanceira;
33256
+ var percentual = Number(data.percentual) || 0;
33257
+ var valor = +(Number(data.valor) || 0).toFixed((_a = this.config.currencyScale) !== null && _a !== void 0 ? _a : 2);
33258
+ if (this.editingContaIndex != null) {
33259
+ var conta = this.contasDataSource[this.editingContaIndex];
33260
+ conta.percentual = percentual;
33261
+ conta.valorRateadoConta = valor;
33262
+ this.contasDataSource = __spread(this.contasDataSource);
33263
+ }
33264
+ else {
33265
+ var idContaFinanceira_1 = (contaFinanceira === null || contaFinanceira === void 0 ? void 0 : contaFinanceira.id) || '';
33266
+ var labelConta = (contaFinanceira === null || contaFinanceira === void 0 ? void 0 : contaFinanceira.label) || '';
33267
+ // Validação extra: bloqueia duplicidade
33268
+ var jaExiste = this.contasDataSource.some(function (c) { return c.idContaFinanceira === idContaFinanceira_1; });
33269
+ if (jaExiste) {
33270
+ this.contaDialogFormGroup.get('contaFinanceira').setErrors({ duplicate: true });
33271
+ return;
33272
+ }
33273
+ var novaConta = {
33274
+ idContaFinanceira: idContaFinanceira_1,
33275
+ contaFinanceira: labelConta,
33276
+ percentual: percentual,
33277
+ valorRateadoConta: valor,
33278
+ rateiosCCusto: []
33279
+ };
33280
+ this.contasDataSource = __spread(this.contasDataSource, [novaConta]);
33281
+ }
33282
+ this.displayContaDialog = false;
33283
+ this.emitChange();
33284
+ };
33285
+ ErpRateioEditorComponent.prototype.onHideContaDialog = function () {
33286
+ this.displayContaDialog = false;
33287
+ };
33288
+ // === MODAL CENTRO DE CUSTO ===
33289
+ ErpRateioEditorComponent.prototype.openCCDialog = function (contaIndex, editCCIndex) {
33290
+ var _this = this;
33291
+ var _a, _b;
33292
+ this.editingCCContaIndex = contaIndex;
33293
+ this.editingCCIndex = editCCIndex != null ? editCCIndex : null;
33294
+ var conta = this.contasDataSource[contaIndex];
33295
+ var ccList = conta.rateiosCCusto || [];
33296
+ var somaCC = ccList.reduce(function (acc, cc, i) { return acc + (i === _this.editingCCIndex ? 0 : (cc.percentual || 0)); }, 0);
33297
+ var remainingPct = +(100 - somaCC).toFixed((_a = this.config.percentageScale) !== null && _a !== void 0 ? _a : 4);
33298
+ var valorBaseCC = conta.valorRateadoConta || 0;
33299
+ var ccValue = null;
33300
+ var percentualValue = remainingPct > 0 ? remainingPct : null;
33301
+ var valorValue = percentualValue != null
33302
+ ? +((percentualValue / 100) * valorBaseCC).toFixed((_b = this.config.currencyScale) !== null && _b !== void 0 ? _b : 2)
33303
+ : null;
33304
+ if (this.editingCCIndex != null) {
33305
+ var cc = ccList[this.editingCCIndex];
33306
+ ccValue = { id: cc.idCentroCusto, label: cc.descCCusto || cc.idCentroCusto };
33307
+ percentualValue = cc.percentual;
33308
+ valorValue = cc.valor;
33309
+ }
33310
+ this.ccDialogFormGroup = this.fb.group({
33311
+ centroCusto: [{ value: ccValue, disabled: this.editingCCIndex != null }, forms.Validators.required],
33312
+ percentual: [{ value: percentualValue, disabled: false }, forms.Validators.required],
33313
+ valor: [{ value: valorValue, disabled: false }, forms.Validators.required]
33314
+ });
33315
+ this.setupPercentualValorSync(this.ccDialogFormGroup, function () { return valorBaseCC; });
33316
+ this.ccDialogFields = this.getCCDialogFields();
33317
+ this.displayCCDialog = true;
33318
+ };
33319
+ ErpRateioEditorComponent.prototype.onSaveCCDialog = function () {
33320
+ var _a;
33321
+ if (this.ccDialogFormGroup.invalid) {
33322
+ return;
33323
+ }
33324
+ var data = this.ccDialogFormGroup.getRawValue();
33325
+ var centroCusto = data.centroCusto;
33326
+ var percentual = Number(data.percentual) || 0;
33327
+ var valor = +(Number(data.valor) || 0).toFixed((_a = this.config.currencyScale) !== null && _a !== void 0 ? _a : 2);
33328
+ var conta = this.contasDataSource[this.editingCCContaIndex];
33329
+ if (this.editingCCIndex != null) {
33330
+ var cc = conta.rateiosCCusto[this.editingCCIndex];
33331
+ cc.percentual = percentual;
33332
+ cc.valor = valor;
33333
+ }
33334
+ else {
33335
+ var idCentroCusto_1 = (centroCusto === null || centroCusto === void 0 ? void 0 : centroCusto.id) || '';
33336
+ var labelCCusto = (centroCusto === null || centroCusto === void 0 ? void 0 : centroCusto.label) || '';
33337
+ // Validação extra: bloqueia duplicidade dentro da mesma conta
33338
+ var ccList = conta.rateiosCCusto || [];
33339
+ var jaExiste = ccList.some(function (cc) { return cc.idCentroCusto === idCentroCusto_1; });
33340
+ if (jaExiste) {
33341
+ this.ccDialogFormGroup.get('centroCusto').setErrors({ duplicate: true });
33342
+ return;
33343
+ }
33344
+ conta.rateiosCCusto = __spread(ccList, [{ idCentroCusto: idCentroCusto_1, descCCusto: labelCCusto, percentual: percentual, valor: valor }]);
33345
+ }
33346
+ this.contasDataSource = __spread(this.contasDataSource);
33347
+ this.displayCCDialog = false;
33348
+ this.emitChange();
33349
+ };
33350
+ ErpRateioEditorComponent.prototype.onHideCCDialog = function () {
33351
+ this.displayCCDialog = false;
33352
+ };
33353
+ // === AÇÕES DA TABELA ===
33354
+ ErpRateioEditorComponent.prototype.onDeleteSelected = function () {
33355
+ if (!this.selection.length) {
33356
+ return;
33357
+ }
33358
+ var idsToRemove = new Set(this.selection.map(function (s) { return s.idContaFinanceira; }));
33359
+ this.contasDataSource = this.contasDataSource.filter(function (c) { return !idsToRemove.has(c.idContaFinanceira); });
33360
+ this.selection = [];
33361
+ this.emitChange();
33362
+ };
33363
+ ErpRateioEditorComponent.prototype.removerConta = function (index) {
33364
+ this.contasDataSource = this.contasDataSource.filter(function (_, i) { return i !== index; });
33365
+ this.emitChange();
33366
+ };
33367
+ ErpRateioEditorComponent.prototype.removerCentroCusto = function (contaIndex, ccIndex) {
33368
+ var conta = this.contasDataSource[contaIndex];
33369
+ conta.rateiosCCusto = conta.rateiosCCusto.filter(function (_, i) { return i !== ccIndex; });
33370
+ this.contasDataSource = __spread(this.contasDataSource);
33371
+ this.emitChange();
33372
+ };
33373
+ ErpRateioEditorComponent.prototype.getMenuOptionsPerRow = function (rowData, rowIndex) {
33374
+ var _this = this;
33375
+ return [
33376
+ { label: this.translate.instant('erpx.rateio_editor.editar'), command: function () { return _this.openContaDialog(rowIndex); } },
33377
+ { label: this.translate.instant('erpx.rateio_editor.adicionar_centro_custo'), command: function () { return _this.openCCDialog(rowIndex); } },
33378
+ { label: this.translate.instant('erpx.rateio_editor.excluir'), command: function () { return _this.removerConta(rowIndex); } }
33379
+ ];
33380
+ };
33381
+ ErpRateioEditorComponent.prototype.getCCMenuOptions = function (contaIndex, ccIndex) {
33382
+ var _this = this;
33383
+ return [
33384
+ { label: this.translate.instant('erpx.rateio_editor.editar'), command: function () { return _this.openCCDialog(contaIndex, ccIndex); } },
33385
+ { label: this.translate.instant('erpx.rateio_editor.excluir'), command: function () { return _this.removerCentroCusto(contaIndex, ccIndex); } }
33386
+ ];
33387
+ };
33388
+ ErpRateioEditorComponent.prototype.getContaIndex = function (rowData) {
33389
+ return this.contasDataSource.indexOf(rowData);
33390
+ };
33391
+ // === PRIVADOS ===
33392
+ /** Inicializa o componente em modo standalone (sem chamada à API). */
33393
+ ErpRateioEditorComponent.prototype.inicializarStandalone = function () {
33394
+ var _a, _b, _c;
33395
+ this.loadedContext = (this.initialContext || {});
33396
+ this.popularComRateios(this.initialRateios || []);
33397
+ if (!this.empresaId) {
33398
+ this.empresaId = (_c = (_b = (_a = this.initialContext) === null || _a === void 0 ? void 0 : _a.e070fil) === null || _b === void 0 ? void 0 : _b.e070emp) === null || _c === void 0 ? void 0 : _c.id;
33399
+ }
33400
+ this.gridColumns = this.getGridColumns();
33401
+ };
33402
+ ErpRateioEditorComponent.prototype.carregarRateio = function () {
33403
+ var _this = this;
33404
+ this.loading = true;
33405
+ this.service
33406
+ .retornarRateio({ idMovimento: this.idMovimento, tipoMovimento: this.tipoMovimento })
33407
+ .pipe(operators.takeUntil(this.ngUnsubscribe), operators.finalize(function () { return (_this.loading = false); }))
33408
+ .subscribe(function (output) {
33409
+ _this.loadedContext = output;
33410
+ _this.popularComRateios(output.rateio || []);
33411
+ if (!_this.empresaId) {
33412
+ _this.empresaId = output.e070fil.e070emp.id;
33413
+ }
33414
+ _this.gridColumns = _this.getGridColumns();
33415
+ }, function (err) { var _a; return _this.error.emit({ operacao: 'load', message: ((_a = err === null || err === void 0 ? void 0 : err.error) === null || _a === void 0 ? void 0 : _a.message) || (err === null || err === void 0 ? void 0 : err.message) || 'Erro ao carregar rateio', originalError: err }); });
33416
+ };
33417
+ ErpRateioEditorComponent.prototype.popularComRateios = function (rateios) {
33418
+ this.contasDataSource = __spread(rateios);
33419
+ };
33420
+ ErpRateioEditorComponent.prototype.getContaDialogFields = function () {
33421
+ var _this = this;
33422
+ var _a, _b;
33423
+ return [
33424
+ new angularComponents$1.FormField(__assign(__assign({}, this.e091PlfLookup.mountOptions({
33425
+ multiple: false,
33426
+ formGroup: 'contaFinanceira',
33427
+ defaultFilter: [
33428
+ { field: 'excluido', operator: angularComponents.EnumLogicalOperator.Eq, values: ['false'] },
33429
+ { field: 'e070emp', operator: angularComponents.EnumLogicalOperator.Eq, values: [this.empresaId] }
33430
+ ]
33431
+ })), { size: { sm: 12, md: 12, lg: 12, xl: 12 }, required: function () { return true; } })),
33432
+ new angularComponents$1.FormField({
33433
+ name: 'percentual',
33434
+ label: this.translate.instant('erpx.rateio_editor.percentual'),
33435
+ size: { sm: 12, md: 6, lg: 6, xl: 6 },
33436
+ type: angularComponents$1.FieldType.Double,
33437
+ precision: 7,
33438
+ scale: (_a = this.config.percentageScale) !== null && _a !== void 0 ? _a : 4,
33439
+ rightAddon: { label: '%' },
33440
+ required: function () { return true; }
33441
+ }),
33442
+ new angularComponents$1.FormField({
33443
+ name: 'valor',
33444
+ label: this.translate.instant('erpx.rateio_editor.valor'),
33445
+ size: { sm: 12, md: 6, lg: 6, xl: 6 },
33446
+ type: angularComponents$1.FieldType.Money,
33447
+ currenncy: function () { return _this.currencyCode; },
33448
+ precision: 18,
33449
+ scale: (_b = this.config.currencyScale) !== null && _b !== void 0 ? _b : 2,
33450
+ required: function () { return true; }
33451
+ })
33452
+ ];
33453
+ };
33454
+ ErpRateioEditorComponent.prototype.getCCDialogFields = function () {
33455
+ var _this = this;
33456
+ var _a, _b;
33457
+ return [
33458
+ new angularComponents$1.FormField(__assign(__assign({}, this.e044CcuLookup.mountOptions({
33459
+ multiple: false,
33460
+ formGroup: 'centroCusto',
33461
+ defaultFilter: [
33462
+ { field: 'excluido', operator: angularComponents.EnumLogicalOperator.Eq, values: ['false'] },
33463
+ { field: 'e070emp', operator: angularComponents.EnumLogicalOperator.Eq, values: [this.empresaId] }
33464
+ ]
33465
+ })), { size: { sm: 12, md: 12, lg: 12, xl: 12 }, required: function () { return true; } })),
33466
+ new angularComponents$1.FormField({
33467
+ name: 'percentual',
33468
+ label: this.translate.instant('erpx.rateio_editor.percentual'),
33469
+ size: { sm: 12, md: 6, lg: 6, xl: 6 },
33470
+ type: angularComponents$1.FieldType.Double,
33471
+ precision: 7,
33472
+ scale: (_a = this.config.percentageScale) !== null && _a !== void 0 ? _a : 4,
33473
+ rightAddon: { label: '%' },
33474
+ required: function () { return true; }
33475
+ }),
33476
+ new angularComponents$1.FormField({
33477
+ name: 'valor',
33478
+ label: this.translate.instant('erpx.rateio_editor.valor'),
33479
+ size: { sm: 12, md: 6, lg: 6, xl: 6 },
33480
+ type: angularComponents$1.FieldType.Money,
33481
+ currenncy: function () { return _this.currencyCode; },
33482
+ precision: 18,
33483
+ scale: (_b = this.config.currencyScale) !== null && _b !== void 0 ? _b : 2,
33484
+ required: function () { return true; }
33485
+ })
33486
+ ];
33487
+ };
33488
+ /**
33489
+ * Sincroniza os campos percentual e valor de um FormGroup de modal.
33490
+ * Quando o usuário altera percentual, recalcula valor (percentual/100 * base).
33491
+ * Quando o usuário altera valor, recalcula percentual (valor/base * 100).
33492
+ * O argumento getBase retorna a base usada no cálculo (valorBase global ou valorRateadoConta da conta pai).
33493
+ */
33494
+ ErpRateioEditorComponent.prototype.setupPercentualValorSync = function (form, getBase) {
33495
+ var _a, _b;
33496
+ var percentualScale = (_a = this.config.percentageScale) !== null && _a !== void 0 ? _a : 4;
33497
+ var currencyScale = (_b = this.config.currencyScale) !== null && _b !== void 0 ? _b : 2;
33498
+ form.get('percentual').valueChanges
33499
+ .pipe(operators.takeUntil(this.ngUnsubscribe))
33500
+ .subscribe(function (pct) {
33501
+ var base = getBase();
33502
+ if (pct == null || base == null) {
33503
+ return;
33504
+ }
33505
+ var novoValor = +((Number(pct) / 100) * base).toFixed(currencyScale);
33506
+ if (Number(form.get('valor').value) !== novoValor) {
33507
+ form.get('valor').setValue(novoValor, { emitEvent: false });
33508
+ }
33509
+ });
33510
+ form.get('valor').valueChanges
33511
+ .pipe(operators.takeUntil(this.ngUnsubscribe))
33512
+ .subscribe(function (val) {
33513
+ var base = getBase();
33514
+ if (val == null || !base) {
33515
+ return;
33516
+ }
33517
+ var novoPct = +((Number(val) / base) * 100).toFixed(percentualScale);
33518
+ if (Number(form.get('percentual').value) !== novoPct) {
33519
+ form.get('percentual').setValue(novoPct, { emitEvent: false });
33520
+ }
33521
+ });
33522
+ };
33523
+ ErpRateioEditorComponent.prototype.getGridColumns = function () {
33524
+ return [
33525
+ { field: 'contaFinanceira', header: this.translate.instant('erpx.rateio_editor.conta_financeira') },
33526
+ { field: 'percentual', header: this.translate.instant('erpx.rateio_editor.percentual') },
33527
+ { field: 'valorRateadoConta', header: this.translate.instant('erpx.rateio_editor.valor') }
33528
+ ];
33529
+ };
33530
+ ErpRateioEditorComponent.prototype.emitChange = function () {
33531
+ this.change.emit({
33532
+ isDirty: true,
33533
+ isValid: this.percentualRestante === 0 && this.valorRestante === 0,
33534
+ rateios: this.contasDataSource
33535
+ });
33536
+ };
33537
+ ErpRateioEditorComponent.ctorParameters = function () { return [
33538
+ { type: forms.FormBuilder },
33539
+ { type: ErpRateioEditorService },
33540
+ { type: core$1.TranslateService },
33541
+ { type: angularComponents.E091PlfLookup },
33542
+ { type: angularComponents.E044CcuLookup }
33543
+ ]; };
33544
+ __decorate([
33545
+ core.Input()
33546
+ ], ErpRateioEditorComponent.prototype, "idMovimento", void 0);
33547
+ __decorate([
33548
+ core.Input()
33549
+ ], ErpRateioEditorComponent.prototype, "tipoMovimento", void 0);
33550
+ __decorate([
33551
+ core.Input()
33552
+ ], ErpRateioEditorComponent.prototype, "readOnly", void 0);
33553
+ __decorate([
33554
+ core.Input()
33555
+ ], ErpRateioEditorComponent.prototype, "showSugestaoButton", void 0);
33556
+ __decorate([
33557
+ core.Input()
33558
+ ], ErpRateioEditorComponent.prototype, "config", void 0);
33559
+ __decorate([
33560
+ core.Input()
33561
+ ], ErpRateioEditorComponent.prototype, "initialContext", void 0);
33562
+ __decorate([
33563
+ core.Input()
33564
+ ], ErpRateioEditorComponent.prototype, "initialRateios", void 0);
33565
+ __decorate([
33566
+ core.Input()
33567
+ ], ErpRateioEditorComponent.prototype, "empresaId", void 0);
33568
+ __decorate([
33569
+ core.Input()
33570
+ ], ErpRateioEditorComponent.prototype, "filialId", void 0);
33571
+ __decorate([
33572
+ core.Input()
33573
+ ], ErpRateioEditorComponent.prototype, "criRat", void 0);
33574
+ __decorate([
33575
+ core.Input()
33576
+ ], ErpRateioEditorComponent.prototype, "currencyCode", void 0);
33577
+ __decorate([
33578
+ core.Output()
33579
+ ], ErpRateioEditorComponent.prototype, "save", void 0);
33580
+ __decorate([
33581
+ core.Output()
33582
+ ], ErpRateioEditorComponent.prototype, "cancel", void 0);
33583
+ __decorate([
33584
+ core.Output()
33585
+ ], ErpRateioEditorComponent.prototype, "change", void 0);
33586
+ __decorate([
33587
+ core.Output()
33588
+ ], ErpRateioEditorComponent.prototype, "error", void 0);
33589
+ __decorate([
33590
+ core.ViewChild('tableRateio')
33591
+ ], ErpRateioEditorComponent.prototype, "table", void 0);
33592
+ ErpRateioEditorComponent = __decorate([
33593
+ core.Component({
33594
+ selector: 'erp-rateio-editor',
33595
+ template: "<s-loading-state [loading]=\"loading\" [blockWindow]=\"true\">\n<p-panel styleClass=\"form-group\" [toggleable]=\"false\">\n\n <!-- Se\u00E7\u00E3o 1: Informa\u00E7\u00F5es do movimento -->\n <div class=\"sds-section-title\" *ngIf=\"isReady\">\n {{ 'erpx.rateio_editor.titulo' | translate }}\n </div>\n\n <div class=\"ui-g custom-stats\" *ngIf=\"isReady\">\n <div class=\"ui-sm-12 ui-md-4\">\n <s-stats-card\n [animateNumbers]=\"true\"\n color=\"#0C9348\"\n [lightMode]=\"true\"\n [lightVersion]=\"true\"\n iconClass=\"far fa-dollar-sign\"\n [label]=\"'erpx.rateio_editor.valor_base' | translate\"\n [value]=\"valorBase | numeric:numberFormatOptions | async\"\n ></s-stats-card>\n </div>\n <div class=\"ui-sm-12 ui-md-4\">\n <s-stats-card\n [animateNumbers]=\"true\"\n color=\"#428BCA\"\n [lightMode]=\"true\"\n [lightVersion]=\"true\"\n iconClass=\"far fa-percent\"\n [label]=\"'erpx.rateio_editor.percentual_restante' | translate\"\n [value]=\"percentualRestante + '%'\"\n ></s-stats-card>\n </div>\n <div class=\"ui-sm-12 ui-md-4\">\n <s-stats-card\n [animateNumbers]=\"true\"\n [color]=\"valorRestante === 0 ? '#0C9348' : '#C13018'\"\n [lightMode]=\"true\"\n [lightVersion]=\"true\"\n iconClass=\"far fa-dollar-sign\"\n [label]=\"'erpx.rateio_editor.valor_restante' | translate\"\n [value]=\"valorRestante | numeric:numberFormatOptions | async\"\n ></s-stats-card>\n </div>\n </div>\n\n <!-- Se\u00E7\u00E3o 2: Tabela de rateios -->\n <div class=\"sds-section-title\" *ngIf=\"isReady\">\n {{ 'erpx.rateio_editor.lista_rateios' | translate }}\n </div>\n\n <s-empty-state\n *ngIf=\"isReady && contasDataSource?.length === 0\"\n iconClass=\"far fa-dollar-sign\"\n [title]=\"'erpx.rateio_editor.sem_rateios_titulo' | translate\"\n [description]=\"'erpx.rateio_editor.sem_rateios_descricao' | translate\"\n ></s-empty-state>\n\n <div class=\"ui-g\" *ngIf=\"isReady && contasDataSource?.length > 0\">\n <div class=\"ui-g-12\" *ngIf=\"!effectiveReadOnly\">\n <s-button\n [label]=\"'erpx.rateio_editor.adicionar_conta' | translate\"\n iconClass=\"fa fa-plus\"\n (onClick)=\"openContaDialog()\"\n ></s-button>\n <s-button\n *ngIf=\"showSugestaoButton\"\n [label]=\"'erpx.rateio_editor.sugerir_rateio' | translate\"\n [priority]=\"ButtonPriority.Secondary\"\n iconClass=\"fa fa-magic\"\n (onClick)=\"onSugerir()\"\n ></s-button>\n <s-button\n [label]=\"'erpx.rateio_editor.remover_conta' | translate\"\n [priority]=\"ButtonPriority.Secondary\"\n (onClick)=\"onDeleteSelected()\"\n [disabled]=\"!selection.length\"\n ></s-button>\n </div>\n <div class=\"ui-g-12\">\n <p-table\n #tableRateio\n [value]=\"contasDataSource\"\n [columns]=\"gridColumns\"\n dataKey=\"idContaFinanceira\"\n [resizableColumns]=\"true\"\n [totalRecords]=\"contasDataSource.length\"\n [(selection)]=\"selection\"\n [paginator]=\"false\"\n [rows]=\"10\"\n >\n <ng-template pTemplate=\"header\" let-columns>\n <tr>\n <th scope=\"col\" style=\"width: 3em\"></th>\n <th scope=\"col\" class=\"col-checkbox\">\n <p-tableHeaderCheckbox *ngIf=\"!effectiveReadOnly\"></p-tableHeaderCheckbox>\n </th>\n <th *ngFor=\"let col of columns\" scope=\"col\" pResizableColumn>\n <div class=\"senior-header\">\n <span class=\"senior-header-title\">{{ col.header }}</span>\n </div>\n </th>\n <th scope=\"col\" *ngIf=\"!effectiveReadOnly\">\n <div class=\"senior-header\">\n <span class=\"senior-header-title\">{{ 'erpx.rateio_editor.acoes' | translate }}</span>\n </div>\n </th>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"body\" let-rowData let-rowIndex=\"rowIndex\" let-expanded=\"expanded\">\n <tr>\n <td style=\"width: 3em; text-align: center\">\n <a *ngIf=\"rowData.rateiosCCusto?.length\" [pRowToggler]=\"rowData\" role=\"button\" tabindex=\"0\">\n <i [class]=\"expanded ? 'fa fa-minus' : 'fa fa-plus'\"></i>\n </a>\n </td>\n <td class=\"col-checkbox\">\n <p-tableCheckbox *ngIf=\"!effectiveReadOnly\" [value]=\"rowData\"></p-tableCheckbox>\n </td>\n <td>{{ rowData.contaFinanceira || rowData.idContaFinanceira }}</td>\n <td style=\"text-align: right\">{{ rowData.percentual }}</td>\n <td style=\"text-align: right\">{{ rowData.valorRateadoConta | numeric:numberFormatOptions | async }}</td>\n <td *ngIf=\"!effectiveReadOnly\">\n <s-button\n [auxiliary]=\"true\"\n [priority]=\"ButtonPriority.Default\"\n [size]=\"ButtonSize.Small\"\n [label]=\"'erpx.rateio_editor.acoes' | translate\"\n [menuOptions]=\"getMenuOptionsPerRow(rowData, rowIndex)\"\n ></s-button>\n </td>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"rowexpansion\" let-rowData let-rowIndex=\"rowIndex\">\n <tr>\n <td [attr.colspan]=\"effectiveReadOnly ? gridColumns.length + 2 : gridColumns.length + 3\">\n <div class=\"ui-g\" style=\"padding: 8px 16px\">\n <p-table [value]=\"rowData.rateiosCCusto\" [responsive]=\"true\">\n <ng-template pTemplate=\"header\">\n <tr>\n <th scope=\"col\">{{ 'erpx.rateio_editor.centro_custo' | translate }}</th>\n <th scope=\"col\">{{ 'erpx.rateio_editor.percentual' | translate }}</th>\n <th scope=\"col\">{{ 'erpx.rateio_editor.valor' | translate }}</th>\n <th scope=\"col\" *ngIf=\"!effectiveReadOnly\">{{ 'erpx.rateio_editor.acoes' | translate }}</th>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"body\" let-cc let-ccIndex=\"rowIndex\">\n <tr>\n <td>{{ cc.descCCusto || cc.idCentroCusto }}</td>\n <td style=\"text-align: right\">{{ cc.percentual }}</td>\n <td style=\"text-align: right\">{{ cc.valor | numeric:numberFormatOptions | async }}</td>\n <td *ngIf=\"!effectiveReadOnly\">\n <s-button\n [auxiliary]=\"true\"\n [priority]=\"ButtonPriority.Default\"\n [size]=\"ButtonSize.Small\"\n [label]=\"'erpx.rateio_editor.acoes' | translate\"\n [menuOptions]=\"getCCMenuOptions(getContaIndex(rowData), ccIndex)\"\n ></s-button>\n </td>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"emptymessage\">\n <tr>\n <td [attr.colspan]=\"effectiveReadOnly ? 3 : 4\">\n {{ 'erpx.rateio_editor.sem_centros_custo' | translate }}\n </td>\n </tr>\n </ng-template>\n </p-table>\n </div>\n </td>\n </tr>\n </ng-template>\n </p-table>\n </div>\n </div>\n\n <!-- Bot\u00F5es de a\u00E7\u00E3o -->\n <div *ngIf=\"isReady\" class=\"ui-g rateio-editor-actions\">\n <div class=\"ui-g-12\">\n <div *ngIf=\"!effectiveReadOnly && contasDataSource?.length === 0\" style=\"margin-bottom: 8px\">\n <s-button\n [label]=\"'erpx.rateio_editor.adicionar_conta' | translate\"\n iconClass=\"fa fa-plus\"\n (onClick)=\"openContaDialog()\"\n ></s-button>\n <s-button\n *ngIf=\"showSugestaoButton\"\n [label]=\"'erpx.rateio_editor.sugerir_rateio' | translate\"\n [priority]=\"ButtonPriority.Secondary\"\n iconClass=\"fa fa-magic\"\n (onClick)=\"onSugerir()\"\n ></s-button>\n </div>\n <s-button\n *ngIf=\"!effectiveReadOnly && !isStandalone\"\n priority=\"primary\"\n iconClass=\"fa fa-check\"\n [label]=\"'erpx.rateio_editor.salvar' | translate\"\n (onClick)=\"onSalvar()\"\n ></s-button>\n </div>\n </div>\n\n</p-panel>\n</s-loading-state>\n\n<!-- Modal: Adicionar/Editar Conta Financeira -->\n<p-dialog\n [header]=\"'erpx.rateio_editor.adicionar_conta' | translate\"\n appendTo=\"body\"\n [modal]=\"true\"\n [(visible)]=\"displayContaDialog\"\n (onHide)=\"onHideContaDialog()\"\n [blockScroll]=\"true\"\n [focusOnShow]=\"false\"\n styleClass=\"custom-dialog\"\n [draggable]=\"false\"\n [resizable]=\"false\"\n [style]=\"{width: '40%'}\"\n>\n <form *ngIf=\"contaDialogFormGroup\" [formGroup]=\"contaDialogFormGroup\" (ngSubmit)=\"onSaveContaDialog()\">\n <div class=\"ui-fluid\">\n <s-dynamic-form\n [fields]=\"contaDialogFields\"\n [form]=\"contaDialogFormGroup\"\n [errorMessages]=\"{\n required: ('erpx.rateio_editor.erro_obrigatorio' | translate),\n duplicate: ('erpx.rateio_editor.conta_duplicada' | translate)\n }\"\n ></s-dynamic-form>\n </div>\n </form>\n <p-footer>\n <s-button\n id=\"dialog-conta-save\"\n type=\"button\"\n priority=\"primary\"\n [label]=\"'erpx.rateio_editor.salvar' | translate\"\n (onClick)=\"onSaveContaDialog()\"\n ></s-button>\n <s-button\n id=\"dialog-conta-cancel\"\n type=\"button\"\n priority=\"secondary\"\n [label]=\"'erpx.rateio_editor.cancelar' | translate\"\n (onClick)=\"onHideContaDialog()\"\n ></s-button>\n </p-footer>\n</p-dialog>\n\n<!-- Modal: Adicionar/Editar Centro de Custo -->\n<p-dialog\n [header]=\"'erpx.rateio_editor.adicionar_centro_custo' | translate\"\n appendTo=\"body\"\n [modal]=\"true\"\n [(visible)]=\"displayCCDialog\"\n (onHide)=\"onHideCCDialog()\"\n [blockScroll]=\"true\"\n [focusOnShow]=\"false\"\n styleClass=\"custom-dialog\"\n [draggable]=\"false\"\n [resizable]=\"false\"\n [style]=\"{width: '40%'}\"\n>\n <form *ngIf=\"ccDialogFormGroup\" [formGroup]=\"ccDialogFormGroup\" (ngSubmit)=\"onSaveCCDialog()\">\n <div class=\"ui-fluid\">\n <s-dynamic-form\n [fields]=\"ccDialogFields\"\n [form]=\"ccDialogFormGroup\"\n [errorMessages]=\"{\n required: ('erpx.rateio_editor.erro_obrigatorio' | translate),\n duplicate: ('erpx.rateio_editor.centro_custo_duplicado' | translate)\n }\"\n ></s-dynamic-form>\n </div>\n </form>\n <p-footer>\n <s-button\n id=\"dialog-cc-save\"\n type=\"button\"\n priority=\"primary\"\n [label]=\"'erpx.rateio_editor.salvar' | translate\"\n (onClick)=\"onSaveCCDialog()\"\n ></s-button>\n <s-button\n id=\"dialog-cc-cancel\"\n type=\"button\"\n priority=\"secondary\"\n [label]=\"'erpx.rateio_editor.cancelar' | translate\"\n (onClick)=\"onHideCCDialog()\"\n ></s-button>\n </p-footer>\n</p-dialog>\n"
33596
+ })
33597
+ ], ErpRateioEditorComponent);
33598
+ return ErpRateioEditorComponent;
33599
+ }());
33600
+
33601
+ var ErpRateioEditorModule = /** @class */ (function () {
33602
+ function ErpRateioEditorModule() {
33603
+ }
33604
+ ErpRateioEditorModule = __decorate([
33605
+ core.NgModule({
33606
+ declarations: [ErpRateioEditorComponent],
33607
+ imports: [
33608
+ common.CommonModule,
33609
+ forms.FormsModule,
33610
+ forms.ReactiveFormsModule,
33611
+ core$1.TranslateModule,
33612
+ angularComponents$1.ButtonModule,
33613
+ angularComponents$1.DynamicFormModule,
33614
+ angularComponents$1.EmptyStateModule,
33615
+ angularComponents$1.LoadingStateModule,
33616
+ angularComponents$1.LocaleModule.forChild(),
33617
+ angularComponents.ErpLookupsModule,
33618
+ angularComponents$1.StatsCardModule,
33619
+ table.TableModule,
33620
+ angularComponents$1.TableModule,
33621
+ panel.PanelModule,
33622
+ dialog.DialogModule
33623
+ ],
33624
+ providers: [ErpRateioEditorService],
33625
+ exports: [ErpRateioEditorComponent]
33626
+ })
33627
+ ], ErpRateioEditorModule);
33628
+ return ErpRateioEditorModule;
33629
+ }());
33630
+
33631
+ /**
33632
+ * Converte entre o modelo plano (recDistribuicaoRateioManual — output de sugerirRateio)
33633
+ * e o modelo hierárquico (recRateioConta + recRateioCCusto — usado pelo form e pela gravação).
33634
+ */
33635
+ var ErpRateioEditorConverter = /** @class */ (function () {
33636
+ function ErpRateioEditorConverter() {
33637
+ }
33638
+ /**
33639
+ * Agrupa itens planos por conta financeira (e091plf_id), gerando a estrutura
33640
+ * hierárquica esperada pelo form e pela API gravarRateioManual.
33641
+ *
33642
+ * Regras:
33643
+ * - Itens com mesmo e091plf_id são agrupados em uma única RateioConta.
33644
+ * - Se e044ccu_id estiver preenchido, gera um RateioCCusto dentro da conta.
33645
+ * - Percentual e valor da conta são a soma dos itens agrupados.
33646
+ * - Labels (contaFinanceira, descCCusto) ficam vazios — devem ser resolvidos via lookup pelo componente.
33647
+ */
33648
+ ErpRateioEditorConverter.sugestaoPlanaParaHierarquica = function (planas) {
33649
+ var e_1, _a;
33650
+ if (!planas || planas.length === 0) {
33651
+ return [];
33652
+ }
33653
+ var porConta = new Map();
33654
+ try {
33655
+ for (var planas_1 = __values(planas), planas_1_1 = planas_1.next(); !planas_1_1.done; planas_1_1 = planas_1.next()) {
33656
+ var item = planas_1_1.value;
33657
+ var conta = porConta.get(item.e091plf_id);
33658
+ if (!conta) {
33659
+ conta = {
33660
+ idContaFinanceira: item.e091plf_id,
33661
+ contaFinanceira: '',
33662
+ idContaContabil: item.e045pla_id || null,
33663
+ contaContabil: null,
33664
+ idProjeto: item.e615prj_id || null,
33665
+ projeto: null,
33666
+ idFaseProjeto: item.e615fpj_id || null,
33667
+ faseProjeto: null,
33668
+ percentual: 0,
33669
+ valorRateadoConta: 0,
33670
+ rateiosCCusto: []
33671
+ };
33672
+ porConta.set(item.e091plf_id, conta);
33673
+ }
33674
+ conta.percentual += item.percentual;
33675
+ conta.valorRateadoConta += item.valor;
33676
+ if (item.e044ccu_id) {
33677
+ conta.rateiosCCusto.push({
33678
+ idCentroCusto: item.e044ccu_id,
33679
+ percentual: item.percentual,
33680
+ valor: item.valor
33681
+ });
33682
+ }
33683
+ }
33684
+ }
33685
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
33686
+ finally {
33687
+ try {
33688
+ if (planas_1_1 && !planas_1_1.done && (_a = planas_1.return)) _a.call(planas_1);
33689
+ }
33690
+ finally { if (e_1) throw e_1.error; }
33691
+ }
33692
+ return Array.from(porConta.values());
33693
+ };
33694
+ return ErpRateioEditorConverter;
33695
+ }());
33696
+
32844
33697
  var fallback = {
32845
33698
  "erpx.tributos.badge_tipo_calculo_imposto_info_sign_text_calculado": "Valor calculado pelo sistema conforme regras fiscais",
32846
33699
  "erpx.tributos.badge_tipo_calculo_imposto_info_sign_text_herdado": "Valor gerado por um processo de origem",
32847
33700
  "erpx.tributos.badge_tipo_calculo_imposto_info_sign_text_manual": "Valor informado manualmente pelo usuário",
32848
33701
  "erpx.tributos.badge_tipo_calculo_imposto_calculo_manual": "Cálculo manual",
32849
33702
  "erpx.tributos.badge_tipo_calculo_imposto_calculo_automatico": "Cálculo automático",
32850
- "erpx.tributos.badge_tipo_calculo_imposto_calculo_gerado_via_processo": "Cálculo gerado via processo"
33703
+ "erpx.tributos.badge_tipo_calculo_imposto_calculo_gerado_via_processo": "Cálculo gerado via processo",
33704
+ "erpx.rateio_editor.titulo": "Edição de Rateio",
33705
+ "erpx.rateio_editor.valor_base": "Valor base",
33706
+ "erpx.rateio_editor.valor_restante": "Valor restante",
33707
+ "erpx.rateio_editor.percentual_restante": "Percentual restante",
33708
+ "erpx.rateio_editor.adicionar_conta": "Adicionar conta financeira",
33709
+ "erpx.rateio_editor.remover_conta": "Remover conta",
33710
+ "erpx.rateio_editor.adicionar_centro_custo": "Adicionar centro de custo",
33711
+ "erpx.rateio_editor.remover_centro_custo": "Remover centro de custo",
33712
+ "erpx.rateio_editor.sugerir_rateio": "Sugerir rateio",
33713
+ "erpx.rateio_editor.salvar": "Salvar",
33714
+ "erpx.rateio_editor.cancelar": "Cancelar",
33715
+ "erpx.rateio_editor.error_soma_percentual_invalida": "A soma dos percentuais deve ser 100%",
33716
+ "erpx.rateio_editor.error_soma_valor_invalida": "A soma dos valores deve ser igual ao valor base",
33717
+ "erpx.rateio_editor.sem_parametrizacao": "Não há parametrização de rateio cadastrada para este movimento",
33718
+ "erpx.rateio_editor.salvo_com_sucesso_titulo": "Rateio salvo",
33719
+ "erpx.rateio_editor.salvo_com_sucesso_detalhe": "A distribuição foi gravada com sucesso"
32851
33720
  };
32852
33721
 
32853
33722
  exports.BreadcrumbComponent = BreadcrumbComponent;
@@ -32855,6 +33724,9 @@
32855
33724
  exports.Breakpoints = Breakpoints;
32856
33725
  exports.ErpLoteSerieComponent = ErpLoteSerieComponent;
32857
33726
  exports.ErpLoteSerieModule = ErpLoteSerieModule;
33727
+ exports.ErpRateioEditorComponent = ErpRateioEditorComponent;
33728
+ exports.ErpRateioEditorConverter = ErpRateioEditorConverter;
33729
+ exports.ErpRateioEditorModule = ErpRateioEditorModule;
32858
33730
  exports.ErpResumoModule = ErpResumoModule;
32859
33731
  exports.ErpTributosComponent = ErpTributosComponent;
32860
33732
  exports.ErpTributosModule = ErpTributosModule;
@@ -32866,48 +33738,52 @@
32866
33738
  exports.nonNullish = nonNullish;
32867
33739
  exports.ɵa = ErpResumoComponent;
32868
33740
  exports.ɵb = ErpResumoService;
32869
- exports.ɵba = TaxRateCalculationRule;
32870
- exports.ɵbb = EffectiveTaxRateCalculationRule;
32871
- exports.ɵbc = TaxAmountCalculationRule;
32872
- exports.ɵbd = GrossAmountCalculationRule;
32873
- exports.ɵbe = GrossAmountCalculator;
32874
- exports.ɵbf = TaxSituationCalculationRule;
32875
- exports.ɵbg = TaxClassificationCalculationRule;
32876
- exports.ɵbh = TaxCalculationTypeCalculationRule;
32877
- exports.ɵbi = ManualTaxCalculationRule;
32878
- exports.ɵbj = OutgoingInvoiceCalculationRulesRegistry;
32879
- exports.ɵbk = AssessmentPeriodCalculationRule;
32880
- exports.ɵbl = SaleOrderCalculationRulesRegistry;
32881
- exports.ɵbm = PurchaseOrderCalculationRulesRegistry;
32882
- exports.ɵbn = FocusService;
32883
- exports.ɵbo = ErpLoteSeriesService;
32884
- exports.ɵbp = QuantidadeDisponivelDemandaService;
32885
- exports.ɵbq = EntityService;
32886
- exports.ɵbr = QuantidadeDisponivelDemandaModule;
32887
- exports.ɵc = ErpTributosService;
32888
- exports.ɵd = RulesService;
32889
- exports.ɵe = StatusRulesRegistry;
32890
- exports.ɵf = IncomingInvoiceStatusRulesRegistry;
32891
- exports.ɵg = TaxClassificationStatusRule;
32892
- exports.ɵh = OutgoingInvoiceStatusRulesRegistry;
32893
- exports.ɵi = SaleOrderStatusRulesRegistry;
32894
- exports.ɵj = PurchaseOrderStatusRulesRegistry;
32895
- exports.ɵk = ValidationRulesRegistry;
32896
- exports.ɵl = IncomingInvoiceValidationRulesRegistry;
32897
- exports.ɵm = TaxableBaseRequiredValidationRule;
32898
- exports.ɵn = TaxRateRequiredValidationRule;
32899
- exports.ɵo = TaxClassificationRequiredValidationRule;
32900
- exports.ɵp = TaxAmountRequiredValidationRule;
32901
- exports.ɵq = TaxSituationRequiredValidationRule;
32902
- exports.ɵr = OutgoingInvoiceValidationRulesRegistry;
32903
- exports.ɵs = AssessmentPeriodRequiredValidationRule;
32904
- exports.ɵt = SaleOrderValidationRulesRegistry;
32905
- exports.ɵu = PurchaseOrderValidationRulesRegistry;
32906
- exports.ɵv = CalculationRulesRegistry;
32907
- exports.ɵw = IncomingInvoiceCalculationRulesRegistry;
32908
- exports.ɵx = TaxableBaseCalculationRule;
32909
- exports.ɵy = TaxAmountCalculator;
32910
- exports.ɵz = EffectiveTaxRateCalculator;
33741
+ exports.ɵba = EffectiveTaxRateCalculator;
33742
+ exports.ɵbb = TaxRoundingService;
33743
+ exports.ɵbc = TaxStore;
33744
+ exports.ɵbd = TaxRateCalculationRule;
33745
+ exports.ɵbe = EffectiveTaxRateCalculationRule;
33746
+ exports.ɵbf = TaxAmountCalculationRule;
33747
+ exports.ɵbg = GrossAmountCalculationRule;
33748
+ exports.ɵbh = GrossAmountCalculator;
33749
+ exports.ɵbi = TaxSituationCalculationRule;
33750
+ exports.ɵbj = TaxClassificationCalculationRule;
33751
+ exports.ɵbk = TaxCalculationTypeCalculationRule;
33752
+ exports.ɵbl = ManualTaxCalculationRule;
33753
+ exports.ɵbm = OutgoingInvoiceCalculationRulesRegistry;
33754
+ exports.ɵbn = AssessmentPeriodCalculationRule;
33755
+ exports.ɵbo = SaleOrderCalculationRulesRegistry;
33756
+ exports.ɵbp = PurchaseOrderCalculationRulesRegistry;
33757
+ exports.ɵbq = FocusService;
33758
+ exports.ɵbr = ErpLoteSeriesService;
33759
+ exports.ɵbs = QuantidadeDisponivelDemandaService;
33760
+ exports.ɵbt = EntityService;
33761
+ exports.ɵbu = QuantidadeDisponivelDemandaModule;
33762
+ exports.ɵbv = ErpRateioEditorService;
33763
+ exports.ɵc = LoadingContext;
33764
+ exports.ɵd = ErpTributosService;
33765
+ exports.ɵe = RulesService;
33766
+ exports.ɵf = StatusRulesRegistry;
33767
+ exports.ɵg = IncomingInvoiceStatusRulesRegistry;
33768
+ exports.ɵh = TaxClassificationStatusRule;
33769
+ exports.ɵi = OutgoingInvoiceStatusRulesRegistry;
33770
+ exports.ɵj = SaleOrderStatusRulesRegistry;
33771
+ exports.ɵk = PurchaseOrderStatusRulesRegistry;
33772
+ exports.ɵl = ValidationRulesRegistry;
33773
+ exports.ɵm = IncomingInvoiceValidationRulesRegistry;
33774
+ exports.ɵn = TaxableBaseRequiredValidationRule;
33775
+ exports.ɵo = TaxRateRequiredValidationRule;
33776
+ exports.ɵp = TaxClassificationRequiredValidationRule;
33777
+ exports.ɵq = TaxAmountRequiredValidationRule;
33778
+ exports.ɵr = TaxSituationRequiredValidationRule;
33779
+ exports.ɵs = OutgoingInvoiceValidationRulesRegistry;
33780
+ exports.ɵt = AssessmentPeriodRequiredValidationRule;
33781
+ exports.ɵu = SaleOrderValidationRulesRegistry;
33782
+ exports.ɵv = PurchaseOrderValidationRulesRegistry;
33783
+ exports.ɵw = CalculationRulesRegistry;
33784
+ exports.ɵx = IncomingInvoiceCalculationRulesRegistry;
33785
+ exports.ɵy = TaxableBaseCalculationRule;
33786
+ exports.ɵz = TaxAmountCalculator;
32911
33787
 
32912
33788
  Object.defineProperty(exports, '__esModule', { value: true });
32913
33789