@senior-gestao-empresarial/erpx-components 3.28.0 → 3.29.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.
@@ -1697,7 +1697,7 @@
1697
1697
  }
1698
1698
  TaxableBaseCalculationRule.prototype.apply = function (_a) {
1699
1699
  var _this = this;
1700
- var documentType = _a.documentType, groups = _a.groups, group = _a.group, _b = _a.item, taxType = _b.name, formGroup = _b.formGroup;
1700
+ var documentType = _a.documentType, groups = _a.groups, group = _a.group, _b = _a.item, taxType = _b.name, formGroup = _b.formGroup, formField = _b.formField;
1701
1701
  switch (taxType) {
1702
1702
  case exports.EnumTipoTributo.CBS_DIFERIDO:
1703
1703
  case exports.EnumTipoTributo.IBS_ESTADUAL_DIFERIDO:
@@ -1757,26 +1757,56 @@
1757
1757
  switch (documentType) {
1758
1758
  case exports.EnumTipoDocumento.NF_ENTRADA:
1759
1759
  case exports.EnumTipoDocumento.NF_SAIDA:
1760
+ {
1761
+ var baseTaxFormGroup = getBaseTaxItemFromGroup({ group: group }).formGroup;
1762
+ var dataKey_1 = formField.find(function (field) { return field.name === 'classificacaoTributaria'; }).dataKey;
1763
+ rxjs.combineLatest([
1764
+ baseTaxFormGroup
1765
+ .get('valor')
1766
+ .valueChanges.pipe(operators.startWith(baseTaxFormGroup.get('valor').value), operators.distinctUntilChanged()),
1767
+ formGroup
1768
+ .get('aliquota')
1769
+ .valueChanges.pipe(operators.startWith(formGroup.get('aliquota').value), operators.distinctUntilChanged()),
1770
+ formGroup.get('classificacaoTributaria').valueChanges.pipe(operators.startWith(formGroup.get('classificacaoTributaria').value), operators.distinctUntilChanged(function (old, current) { return (old === null || old === void 0 ? void 0 : old[dataKey_1]) === (current === null || current === void 0 ? void 0 : current[dataKey_1]); }))
1771
+ ])
1772
+ .pipe(operators.skip(1), operators.map(function (_a) {
1773
+ var _b = __read(_a, 3), baseTaxTaxAmount = _b[0], taxRate = _b[1], taxClassification = _b[2];
1774
+ return [
1775
+ new BigNumber(baseTaxTaxAmount),
1776
+ new BigNumber(taxRate),
1777
+ taxClassification
1778
+ ];
1779
+ }), operators.map(function (_a) {
1780
+ var _b = __read(_a, 3), baseTaxTaxAmount = _b[0], taxRate = _b[1], taxClassification = _b[2];
1781
+ if (taxRate.isNaN() && !taxClassification)
1782
+ return null;
1783
+ return baseTaxTaxAmount.decimalPlaces(2).toNumber();
1784
+ }), operators.filter(function (taxableBase) { return taxableBase !== formGroup.get('baseCalculo').value; }))
1785
+ .subscribe(function (taxableBase) {
1786
+ formGroup.get('baseCalculo').setValue(taxableBase);
1787
+ });
1788
+ }
1789
+ break;
1760
1790
  case exports.EnumTipoDocumento.PEDIDO_COMPRA:
1761
1791
  case exports.EnumTipoDocumento.PEDIDO_VENDA:
1762
1792
  {
1763
1793
  var baseTaxFormGroup = getBaseTaxItemFromGroup({ group: group }).formGroup;
1764
1794
  rxjs.combineLatest([
1765
1795
  baseTaxFormGroup
1766
- .get('baseCalculo')
1767
- .valueChanges.pipe(operators.startWith(baseTaxFormGroup.get('baseCalculo').value), operators.distinctUntilChanged()),
1796
+ .get('valor')
1797
+ .valueChanges.pipe(operators.startWith(baseTaxFormGroup.get('valor').value), operators.distinctUntilChanged()),
1768
1798
  formGroup
1769
1799
  .get('aliquota')
1770
1800
  .valueChanges.pipe(operators.startWith(formGroup.get('aliquota').value), operators.distinctUntilChanged())
1771
1801
  ])
1772
1802
  .pipe(operators.skip(1), operators.filter(function () { return new BigNumber(formGroup.get('baseCalculo').value).isNaN(); }), operators.map(function (_a) {
1773
- var _b = __read(_a, 2), baseTaxTaxableBase = _b[0], presumedCreditTaxTaxRate = _b[1];
1774
- return [new BigNumber(baseTaxTaxableBase), new BigNumber(presumedCreditTaxTaxRate)];
1803
+ var _b = __read(_a, 2), baseTaxTaxAmount = _b[0], taxRate = _b[1];
1804
+ return [new BigNumber(baseTaxTaxAmount), new BigNumber(taxRate)];
1775
1805
  }), operators.map(function (_a) {
1776
- var _b = __read(_a, 2), baseTaxTaxableBase = _b[0], presumedCreditTaxTaxRate = _b[1];
1777
- if (presumedCreditTaxTaxRate.isNaN())
1806
+ var _b = __read(_a, 2), baseTaxTaxAmount = _b[0], taxRate = _b[1];
1807
+ if (taxRate.isNaN())
1778
1808
  return null;
1779
- return baseTaxTaxableBase.decimalPlaces(2).toNumber();
1809
+ return baseTaxTaxAmount.decimalPlaces(2).toNumber();
1780
1810
  }), operators.filter(function (taxableBase) { return taxableBase !== formGroup.get('baseCalculo').value; }))
1781
1811
  .subscribe(function (taxableBase) {
1782
1812
  formGroup.get('baseCalculo').setValue(taxableBase);