@senior-gestao-empresarial/erpx-components 3.28.0 → 3.29.1

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.
@@ -689,14 +689,14 @@
689
689
  EnumTipoDocumento["NF_ENTRADA_CONTROLADORIA"] = "nf_entrada_controladoria";
690
690
  EnumTipoDocumento["NF_ENTRADA_COMPLEMENTAR"] = "nf_entrada_complementar";
691
691
  EnumTipoDocumento["NF_ENTRADA_AJUSTE"] = "nf_entrada_ajuste";
692
+ EnumTipoDocumento["NF_ENTRADA_CREDITO"] = "nf_entrada_credito";
692
693
  EnumTipoDocumento["NF_SAIDA"] = "nf_saida";
693
694
  EnumTipoDocumento["NF_SAIDA_COMPLEMENTAR"] = "nf_saida_complementar";
694
695
  EnumTipoDocumento["NF_SAIDA_AJUSTE"] = "nf_saida_ajuste";
695
696
  EnumTipoDocumento["NF_SAIDA_CONTROLADORIA"] = "nf_saida_controladoria";
697
+ EnumTipoDocumento["NF_SAIDA_DEBITO"] = "nf_saida_debito";
696
698
  EnumTipoDocumento["PEDIDO_COMPRA"] = "pedido_compra";
697
699
  EnumTipoDocumento["PEDIDO_VENDA"] = "pedido_venda";
698
- EnumTipoDocumento["NF_ENTRADA_CREDITO"] = "nf_entrada_credito";
699
- EnumTipoDocumento["NF_SAIDA_DEBITO"] = "nf_saida_debito";
700
700
  })(exports.EnumTipoDocumento || (exports.EnumTipoDocumento = {}));
701
701
 
702
702
  (function (EnumModBc) {
@@ -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);
@@ -5511,6 +5541,18 @@
5511
5541
  var groups = _a.groups, group = _a.group, documentType = _a.documentType;
5512
5542
  if (!isTaxFromTaxReform(getBaseTaxByGroupTax(group.grupoTributo)))
5513
5543
  return;
5544
+ // Quebra galho para tratar débitos e créditos como entradas e saídas,
5545
+ // caso seja necessário um tratamento específico para débitos e créditos, deve ser implementado nas regras.
5546
+ switch (documentType) {
5547
+ case exports.EnumTipoDocumento.NF_ENTRADA_CREDITO:
5548
+ documentType = exports.EnumTipoDocumento.NF_ENTRADA;
5549
+ break;
5550
+ case exports.EnumTipoDocumento.NF_SAIDA_DEBITO:
5551
+ documentType = exports.EnumTipoDocumento.NF_SAIDA;
5552
+ break;
5553
+ default:
5554
+ break;
5555
+ }
5514
5556
  this.applyStatusRules({ groups: groups, group: group, documentType: documentType });
5515
5557
  this.applyValidationRules({ groups: groups, group: group, documentType: documentType });
5516
5558
  this.applyCalculationRules({ groups: groups, group: group, documentType: documentType });