@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.
@@ -26557,7 +26557,15 @@ var ErpTributosComponent = /** @class */ (function () {
26557
26557
  (_this.indexAccordion = [0]));
26558
26558
  _this.changeDetector.detectChanges();
26559
26559
  }
26560
- }, {
26560
+ });
26561
+ }
26562
+ if (this.context.document === 'Incoming Invoice' ||
26563
+ this.context.document === 'Outgoing Invoice' ||
26564
+ (this.context.document === 'Purchase Order' &&
26565
+ this.context.order.item.type === 'Service') ||
26566
+ (this.context.document === 'Sale Order' &&
26567
+ this.context.order.item.type === 'Service')) {
26568
+ menu.push({
26561
26569
  id: 'retencoes',
26562
26570
  label: this.translate.instant('erpx.tributos.actions_retencoes_label'),
26563
26571
  disabled: this.menuItemRetencoes,
@@ -30291,7 +30299,7 @@ var ErpTributosComponent = /** @class */ (function () {
30291
30299
  };
30292
30300
  ErpTributosComponent.prototype.initializeValueChanges = function (_a) {
30293
30301
  var _this = this;
30294
- var item = _a.item;
30302
+ var item = _a.item, group = _a.group;
30295
30303
  item.formGroup.valueChanges
30296
30304
  .pipe(startWith(item.formGroup.getRawValue()),
30297
30305
  // We are using debounceTime here because our Lookup Component is emitting two events unfortunately.
@@ -30327,6 +30335,7 @@ var ErpTributosComponent = /** @class */ (function () {
30327
30335
  item.formGroup
30328
30336
  .get('impostoManual')
30329
30337
  .setValue(true, { emitEvent: false });
30338
+ _this.markICMSSimplesAsManual(item.name, group, EnumCampoTributo.ImpostoManual);
30330
30339
  }
30331
30340
  }
30332
30341
  if (startingValue[EnumCampoTributo.TipoCalculoImposto] !==
@@ -30355,6 +30364,7 @@ var ErpTributosComponent = /** @class */ (function () {
30355
30364
  .setValue(EnumTipoCalculoImposto.MANUAL, {
30356
30365
  emitEvent: false
30357
30366
  });
30367
+ _this.markICMSSimplesAsManual(item.name, group, EnumCampoTributo.TipoCalculoImposto);
30358
30368
  }
30359
30369
  }
30360
30370
  _this.updateTwoWayDataBinding();
@@ -30449,6 +30459,26 @@ var ErpTributosComponent = /** @class */ (function () {
30449
30459
  .item.find(function (item) { return item.name === taxType; });
30450
30460
  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;
30451
30461
  };
30462
+ // Work-around pra resolver a #ERPPEQ-20595.
30463
+ // No futuro mover para o ManualTaxCalculationRule e TaxCalculationTypeCalculationRule
30464
+ // quando os impostos legados forem migrados para o novo padrão.
30465
+ ErpTributosComponent.prototype.markICMSSimplesAsManual = function (tax, group, field) {
30466
+ if (tax !== EnumTipoTributo.ICMS)
30467
+ return;
30468
+ var ICMS_SIMPLES_ITEM = group.item.find(function (item) { return item.name === EnumTipoTributo.ICMS_SIMPLES; });
30469
+ if (!ICMS_SIMPLES_ITEM)
30470
+ return;
30471
+ if (field === EnumCampoTributo.ImpostoManual) {
30472
+ ICMS_SIMPLES_ITEM.formGroup
30473
+ .get('impostoManual')
30474
+ .setValue(true, { emitEvent: false });
30475
+ }
30476
+ else if (field === EnumCampoTributo.TipoCalculoImposto) {
30477
+ ICMS_SIMPLES_ITEM.formGroup
30478
+ .get(field)
30479
+ .setValue(EnumTipoCalculoImposto.MANUAL, { emitEvent: false });
30480
+ }
30481
+ };
30452
30482
  ErpTributosComponent.ctorParameters = function () { return [
30453
30483
  { type: MessageService$1 },
30454
30484
  { type: FormBuilder },