@senior-gestao-empresarial/erpx-components 4.2.2 → 4.4.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.
@@ -25823,7 +25823,15 @@ let ErpTributosComponent = class ErpTributosComponent {
25823
25823
  (this.indexAccordion = [0]));
25824
25824
  this.changeDetector.detectChanges();
25825
25825
  }
25826
- }, {
25826
+ });
25827
+ }
25828
+ if (this.context.document === 'Incoming Invoice' ||
25829
+ this.context.document === 'Outgoing Invoice' ||
25830
+ (this.context.document === 'Purchase Order' &&
25831
+ this.context.order.item.type === 'Service') ||
25832
+ (this.context.document === 'Sale Order' &&
25833
+ this.context.order.item.type === 'Service')) {
25834
+ menu.push({
25827
25835
  id: 'retencoes',
25828
25836
  label: this.translate.instant('erpx.tributos.actions_retencoes_label'),
25829
25837
  disabled: this.menuItemRetencoes,
@@ -29538,7 +29546,7 @@ let ErpTributosComponent = class ErpTributosComponent {
29538
29546
  ] }));
29539
29547
  return retorno;
29540
29548
  }
29541
- initializeValueChanges({ item }) {
29549
+ initializeValueChanges({ item, group }) {
29542
29550
  item.formGroup.valueChanges
29543
29551
  .pipe(startWith(item.formGroup.getRawValue()),
29544
29552
  // We are using debounceTime here because our Lookup Component is emitting two events unfortunately.
@@ -29571,6 +29579,7 @@ let ErpTributosComponent = class ErpTributosComponent {
29571
29579
  item.formGroup
29572
29580
  .get('impostoManual')
29573
29581
  .setValue(true, { emitEvent: false });
29582
+ this.markICMSSimplesAsManual(item.name, group, EnumCampoTributo.ImpostoManual);
29574
29583
  }
29575
29584
  }
29576
29585
  if (startingValue[EnumCampoTributo.TipoCalculoImposto] !==
@@ -29597,6 +29606,7 @@ let ErpTributosComponent = class ErpTributosComponent {
29597
29606
  .setValue(EnumTipoCalculoImposto.MANUAL, {
29598
29607
  emitEvent: false
29599
29608
  });
29609
+ this.markICMSSimplesAsManual(item.name, group, EnumCampoTributo.TipoCalculoImposto);
29600
29610
  }
29601
29611
  }
29602
29612
  this.updateTwoWayDataBinding();
@@ -29691,6 +29701,26 @@ let ErpTributosComponent = class ErpTributosComponent {
29691
29701
  .item.find((item) => item.name === taxType);
29692
29702
  return (_c = (_b = (_a = item.formGroup.get(field)).validator) === null || _b === void 0 ? void 0 : _b.call(_a, {})) === null || _c === void 0 ? void 0 : _c.required;
29693
29703
  }
29704
+ // Work-around pra resolver a #ERPPEQ-20595.
29705
+ // No futuro mover para o ManualTaxCalculationRule e TaxCalculationTypeCalculationRule
29706
+ // quando os impostos legados forem migrados para o novo padrão.
29707
+ markICMSSimplesAsManual(tax, group, field) {
29708
+ if (tax !== EnumTipoTributo.ICMS)
29709
+ return;
29710
+ const ICMS_SIMPLES_ITEM = group.item.find((item) => item.name === EnumTipoTributo.ICMS_SIMPLES);
29711
+ if (!ICMS_SIMPLES_ITEM)
29712
+ return;
29713
+ if (field === EnumCampoTributo.ImpostoManual) {
29714
+ ICMS_SIMPLES_ITEM.formGroup
29715
+ .get('impostoManual')
29716
+ .setValue(true, { emitEvent: false });
29717
+ }
29718
+ else if (field === EnumCampoTributo.TipoCalculoImposto) {
29719
+ ICMS_SIMPLES_ITEM.formGroup
29720
+ .get(field)
29721
+ .setValue(EnumTipoCalculoImposto.MANUAL, { emitEvent: false });
29722
+ }
29723
+ }
29694
29724
  };
29695
29725
  ErpTributosComponent.ctorParameters = () => [
29696
29726
  { type: MessageService$1 },