@senior-gestao-empresarial/erpx-components 3.0.1 → 3.0.2

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.
@@ -4104,6 +4104,8 @@
4104
4104
  this.isSaida = false;
4105
4105
  this.disableDataValidade = false;
4106
4106
  this.prefix = 'erpx.lote_serie.';
4107
+ this.sum = function (a, b, positions) { var factor = Math.pow(10, positions); return (a.toFixed(positions) * factor + b.toFixed(positions) * factor) / factor; };
4108
+ this.sub = function (a, b, positions) { var factor = Math.pow(10, positions); return (a.toFixed(positions) * factor - b.toFixed(positions) * factor) / factor; };
4107
4109
  }
4108
4110
  ErpLoteSerieComponent.prototype.ngOnChanges = function () {
4109
4111
  var _this = this;
@@ -4897,7 +4899,7 @@
4897
4899
  }
4898
4900
  var distributedQuantity = this.formGroupBatchOrSeries.get('quantidade').value ? Number(this.formGroupBatchOrSeries.get('quantidade').value) : 0;
4899
4901
  if (distributedQuantity > 0) {
4900
- if (this.qtdDistribuida + distributedQuantity > this.qtdAdistribuir) {
4902
+ if (this.sum(this.qtdDistribuida, distributedQuantity, this.locale.number.scale) > this.qtdAdistribuir) {
4901
4903
  this.messageService.add({
4902
4904
  severity: 'error',
4903
4905
  summary: this.translate.instant(this.prefix + "distribution_error"),
@@ -4977,8 +4979,8 @@
4977
4979
  dataFabricacao: value.datFabSep,
4978
4980
  dataValidade: value.datVltSep
4979
4981
  });
4980
- this.qtdDistribuida += value.qtdDisponivel;
4981
- this.qtdRestante -= value.qtdDisponivel;
4982
+ this.qtdDistribuida = this.sum(this.qtdDistribuida, value.qtdDisponivel, this.locale.number.scale);
4983
+ this.qtdRestante = this.sub(this.qtdRestante, value.qtdDisponivel, this.locale.number.scale);
4982
4984
  }
4983
4985
  }
4984
4986
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
@@ -4997,8 +4999,8 @@
4997
4999
  dataFabricacao: loteOrSerieValues.serie.datFabSep,
4998
5000
  dataValidade: loteOrSerieValues.serie.datVltSep
4999
5001
  });
5000
- this.qtdDistribuida += Number(loteOrSerieValues.serie.qtdDisponivel);
5001
- this.qtdRestante -= Number(loteOrSerieValues.serie.qtdDisponivel);
5002
+ this.qtdDistribuida = this.sum(this.qtdDistribuida, Number(loteOrSerieValues.serie.qtdDisponivel), this.locale.number.scale);
5003
+ this.qtdRestante = this.sub(this.qtdRestante, Number(loteOrSerieValues.serie.qtdDisponivel), this.locale.number.scale);
5002
5004
  }
5003
5005
  }
5004
5006
  else {
@@ -5009,8 +5011,8 @@
5009
5011
  dataFabricacao: loteOrSerieValues.dataFabricacao,
5010
5012
  dataValidade: loteOrSerieValues.dataValidade
5011
5013
  });
5012
- this.qtdDistribuida += Number(loteOrSerieValues.quantidade);
5013
- this.qtdRestante -= Number(loteOrSerieValues.quantidade);
5014
+ this.qtdDistribuida = this.sum(this.qtdDistribuida, Number(loteOrSerieValues.quantidade), this.locale.number.scale);
5015
+ this.qtdRestante = this.sub(this.qtdRestante, Number(loteOrSerieValues.quantidade), this.locale.number.scale);
5014
5016
  }
5015
5017
  this.clearBatchSeries();
5016
5018
  this.loteSerieParams.lotesOrSeries = this.gridData;
@@ -5398,9 +5400,9 @@
5398
5400
  var qtd = 0;
5399
5401
  this.loteSerieParams.lotesOrSeries.forEach(function (val) {
5400
5402
  if (!_this.isSerie)
5401
- qtd += val.quantidade;
5403
+ qtd = _this.sum(qtd, val.quantidade, _this.locale.number.scale);
5402
5404
  else
5403
- qtd += 1;
5405
+ qtd = _this.sum(qtd, 1, _this.locale.number.scale);
5404
5406
  });
5405
5407
  return qtd;
5406
5408
  };