@senior-gestao-empresarial/erpx-components 3.6.0 → 3.6.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.
- package/bundles/senior-gestao-empresarial-erpx-components.umd.js +49 -39
- package/bundles/senior-gestao-empresarial-erpx-components.umd.js.map +1 -1
- package/bundles/senior-gestao-empresarial-erpx-components.umd.min.js +1 -1
- package/bundles/senior-gestao-empresarial-erpx-components.umd.min.js.map +1 -1
- package/components/tributos/erp-tributos.component.d.ts +1 -1
- package/components/tributos/erp-tributos.types.d.ts +1 -0
- package/esm2015/components/tributos/erp-tributos.component.js +45 -40
- package/esm2015/components/tributos/erp-tributos.types.js +1 -1
- package/esm5/components/tributos/erp-tributos.component.js +50 -40
- package/esm5/components/tributos/erp-tributos.types.js +1 -1
- package/fesm2015/senior-gestao-empresarial-erpx-components.js +44 -39
- package/fesm2015/senior-gestao-empresarial-erpx-components.js.map +1 -1
- package/fesm5/senior-gestao-empresarial-erpx-components.js +49 -39
- package/fesm5/senior-gestao-empresarial-erpx-components.js.map +1 -1
- package/package.json +1 -1
- package/senior-gestao-empresarial-erpx-components.metadata.json +1 -1
|
@@ -2418,6 +2418,7 @@
|
|
|
2418
2418
|
}
|
|
2419
2419
|
};
|
|
2420
2420
|
ErpTributosComponent.prototype.montaCBS = function () {
|
|
2421
|
+
var _this = this;
|
|
2421
2422
|
if (this.menuItemCBS)
|
|
2422
2423
|
return;
|
|
2423
2424
|
this.menuItemCBS = true;
|
|
@@ -2436,7 +2437,9 @@
|
|
|
2436
2437
|
{ campo: exports.EnumCampoTributo.Aliquota },
|
|
2437
2438
|
{ campo: exports.EnumCampoTributo.Valor, disabled: true }
|
|
2438
2439
|
], exports.EnumTipoTributo.CBS_DIFERIDO)), __assign({ name: exports.EnumTipoTributo.CBS_DESONERADO, label: 'erpx.tributos.enum_tipo_tributo_cbs_desonerado' }, this.montaCampos([
|
|
2439
|
-
{ campo: exports.EnumCampoTributo.Valor
|
|
2440
|
+
{ campo: exports.EnumCampoTributo.Valor, previousAction: function () {
|
|
2441
|
+
return _this.refreshValorImpostoEfetivoEBruto(exports.EnumGrupoTributo.CBS, exports.EnumTipoTributo.CBS, exports.EnumTipoTributo.CBS_DESONERADO);
|
|
2442
|
+
} },
|
|
2440
2443
|
{ campo: exports.EnumCampoTributo.CstDesoneracao },
|
|
2441
2444
|
{ campo: exports.EnumCampoTributo.ClassificacaoTributariaDesoneracao },
|
|
2442
2445
|
], exports.EnumTipoTributo.CBS_DESONERADO)));
|
|
@@ -2449,7 +2452,30 @@
|
|
|
2449
2452
|
});
|
|
2450
2453
|
return item;
|
|
2451
2454
|
};
|
|
2455
|
+
ErpTributosComponent.prototype.refreshValorImpostoEfetivoEBruto = function (grupoTributo, tipoImposto, tipoImpostoDesonerado) {
|
|
2456
|
+
var grupo = this.grupos.find(function (g) { return g.grupoTributo === grupoTributo; });
|
|
2457
|
+
var itemImposto = grupo.item.find(function (i) { return i.name === tipoImposto; });
|
|
2458
|
+
var desonerado = grupo.item.find(function (i) { return i.name === tipoImpostoDesonerado; }).formGroup.get('valor');
|
|
2459
|
+
this.addPathCalculoValorRounded(itemImposto, 'baseCalculo', 'aliquota', 'valorBrutoImposto');
|
|
2460
|
+
this.addPathCalculoValorRounded(itemImposto, 'baseCalculo', 'aliquotaEfetiva', 'valor');
|
|
2461
|
+
var impostoBruto = itemImposto.formGroup.get('valorBrutoImposto');
|
|
2462
|
+
var impostoEfetivo = itemImposto.formGroup.get('valor');
|
|
2463
|
+
var reducaoAliquota = itemImposto.formGroup.get('reducaoAliquota');
|
|
2464
|
+
var aliquota = itemImposto.formGroup.get('aliquota');
|
|
2465
|
+
var aliquotaEfetiva = itemImposto.formGroup.get('aliquotaEfetiva');
|
|
2466
|
+
if (impostoEfetivo && impostoBruto && desonerado && impostoBruto.value && desonerado.value > 0) {
|
|
2467
|
+
var newValue = Math.max(impostoBruto.value - desonerado.value, 0);
|
|
2468
|
+
impostoEfetivo.setValue(newValue);
|
|
2469
|
+
reducaoAliquota.setValue(null);
|
|
2470
|
+
reducaoAliquota.disable({ emitEvent: false });
|
|
2471
|
+
aliquotaEfetiva.setValue(aliquota.value);
|
|
2472
|
+
}
|
|
2473
|
+
else {
|
|
2474
|
+
reducaoAliquota.enable({ emitEvent: false });
|
|
2475
|
+
}
|
|
2476
|
+
};
|
|
2452
2477
|
ErpTributosComponent.prototype.montaIBSEstadual = function () {
|
|
2478
|
+
var _this = this;
|
|
2453
2479
|
if (this.menuItemIBSEstadual)
|
|
2454
2480
|
return;
|
|
2455
2481
|
this.menuItemIBSEstadual = true;
|
|
@@ -2467,7 +2493,10 @@
|
|
|
2467
2493
|
{ campo: exports.EnumCampoTributo.BaseCalculo },
|
|
2468
2494
|
{ campo: exports.EnumCampoTributo.Aliquota },
|
|
2469
2495
|
{ campo: exports.EnumCampoTributo.Valor, disabled: true }
|
|
2470
|
-
], exports.EnumTipoTributo.IBS_ESTADUAL_DIFERIDO)), __assign({ name: exports.EnumTipoTributo.IBS_ESTADUAL_DESONERADO, label: 'erpx.tributos.enum_tipo_tributo_ibs_estadual_desonerado' }, this.montaCampos([{ campo: exports.EnumCampoTributo.Valor,
|
|
2496
|
+
], exports.EnumTipoTributo.IBS_ESTADUAL_DIFERIDO)), __assign({ name: exports.EnumTipoTributo.IBS_ESTADUAL_DESONERADO, label: 'erpx.tributos.enum_tipo_tributo_ibs_estadual_desonerado' }, this.montaCampos([{ campo: exports.EnumCampoTributo.Valor,
|
|
2497
|
+
grupo: exports.EnumGrupoTributo.IBS_ESTADUAL,
|
|
2498
|
+
previousAction: function () { return _this.refreshValorImpostoEfetivoEBruto(exports.EnumGrupoTributo.IBS_ESTADUAL, exports.EnumTipoTributo.IBS_ESTADUAL, exports.EnumTipoTributo.IBS_ESTADUAL_DESONERADO); }
|
|
2499
|
+
}], exports.EnumTipoTributo.IBS_ESTADUAL_DESONERADO)));
|
|
2471
2500
|
this.grupos.unshift({
|
|
2472
2501
|
grupo: "" + ('erpx.tributos.enum_grupo_tributo_' +
|
|
2473
2502
|
exports.EnumGrupoTributo.IBS_ESTADUAL +
|
|
@@ -2478,6 +2507,7 @@
|
|
|
2478
2507
|
return item;
|
|
2479
2508
|
};
|
|
2480
2509
|
ErpTributosComponent.prototype.montaIBSMunicipal = function () {
|
|
2510
|
+
var _this = this;
|
|
2481
2511
|
if (this.menuItemIBSMunicipal)
|
|
2482
2512
|
return;
|
|
2483
2513
|
this.menuItemIBSMunicipal = true;
|
|
@@ -2495,7 +2525,9 @@
|
|
|
2495
2525
|
{ campo: exports.EnumCampoTributo.BaseCalculo },
|
|
2496
2526
|
{ campo: exports.EnumCampoTributo.Aliquota },
|
|
2497
2527
|
{ campo: exports.EnumCampoTributo.Valor, disabled: true }
|
|
2498
|
-
], exports.EnumTipoTributo.IBS_MUNICIPAL_DIFERIDO)), __assign({ name: exports.EnumTipoTributo.IBS_MUNICIPAL_DESONERADO, label: 'erpx.tributos.enum_tipo_tributo_ibs_municipal_desonerado' }, this.montaCampos([{ campo: exports.EnumCampoTributo.Valor, grupo: exports.EnumGrupoTributo.IBS_MUNICIPAL
|
|
2528
|
+
], exports.EnumTipoTributo.IBS_MUNICIPAL_DIFERIDO)), __assign({ name: exports.EnumTipoTributo.IBS_MUNICIPAL_DESONERADO, label: 'erpx.tributos.enum_tipo_tributo_ibs_municipal_desonerado' }, this.montaCampos([{ campo: exports.EnumCampoTributo.Valor, grupo: exports.EnumGrupoTributo.IBS_MUNICIPAL,
|
|
2529
|
+
previousAction: function () { return _this.refreshValorImpostoEfetivoEBruto(exports.EnumGrupoTributo.IBS_MUNICIPAL, exports.EnumTipoTributo.IBS_MUNICIPAL, exports.EnumTipoTributo.IBS_MUNICIPAL_DESONERADO); }
|
|
2530
|
+
}], exports.EnumTipoTributo.IBS_MUNICIPAL_DESONERADO)));
|
|
2499
2531
|
this.grupos.unshift({
|
|
2500
2532
|
grupo: "" + ('erpx.tributos.enum_grupo_tributo_' +
|
|
2501
2533
|
exports.EnumGrupoTributo.IBS_MUNICIPAL +
|
|
@@ -3191,6 +3223,10 @@
|
|
|
3191
3223
|
});
|
|
3192
3224
|
if (hasValue && _this.impostoCalculado(tributo)) {
|
|
3193
3225
|
if ([exports.EnumGrupoTributo.CBS, exports.EnumGrupoTributo.IBS_ESTADUAL, exports.EnumGrupoTributo.IBS_MUNICIPAL].includes(grupo.grupoTributo)) {
|
|
3226
|
+
var imposto = grupo.grupoTributo.toUpperCase();
|
|
3227
|
+
var diferido = grupo.grupoTributo.toUpperCase() + "_DIFERIDO";
|
|
3228
|
+
var desonerado = grupo.grupoTributo.toUpperCase() + "_DESONERADO";
|
|
3229
|
+
var impostos = [imposto, diferido];
|
|
3194
3230
|
if ([exports.EnumTipoTributo.CBS, exports.EnumTipoTributo.IBS_ESTADUAL, exports.EnumTipoTributo.IBS_MUNICIPAL].includes(tributo)) {
|
|
3195
3231
|
it.formGroup.get('aliquotaEfetiva').patchValue(_this.roundImposto(new BigNumber(1)
|
|
3196
3232
|
.minus(it.formGroup.get('reducaoAliquota').value
|
|
@@ -3198,11 +3234,15 @@
|
|
|
3198
3234
|
: 0)
|
|
3199
3235
|
.multipliedBy(it.formGroup.get('aliquota').value)
|
|
3200
3236
|
.toNumber(), 2));
|
|
3201
|
-
_this.
|
|
3237
|
+
_this.refreshValorImpostoEfetivoEBruto(grupo.grupoTributo, imposto, desonerado);
|
|
3202
3238
|
}
|
|
3203
|
-
var impostos = [grupo.grupoTributo.toUpperCase(), grupo.grupoTributo.toUpperCase() + "_DIFERIDO"];
|
|
3204
3239
|
_this.addMessageErrorBaseDiferente(impostos, grupo, "erpx.tributos.error_base_" + grupo.grupoTributo + "_diferente_summary", "erpx.tributos.error_base_" + grupo.grupoTributo + "_diferente_detail");
|
|
3205
|
-
|
|
3240
|
+
if (imposto === tributo) {
|
|
3241
|
+
_this.refreshValorImpostoEfetivoEBruto(grupo.grupoTributo, imposto, desonerado);
|
|
3242
|
+
}
|
|
3243
|
+
else if (diferido === tributo) {
|
|
3244
|
+
_this.addPathCalculoValorRounded(it, 'baseCalculo', 'aliquota', 'valor');
|
|
3245
|
+
}
|
|
3206
3246
|
return;
|
|
3207
3247
|
}
|
|
3208
3248
|
if ((it.formGroup.controls.baseCalculo != undefined) &&
|
|
@@ -3255,36 +3295,6 @@
|
|
|
3255
3295
|
});
|
|
3256
3296
|
}
|
|
3257
3297
|
};
|
|
3258
|
-
ErpTributosComponent.prototype.verificarValorDesonerado = function (grupo) {
|
|
3259
|
-
if (![exports.EnumGrupoTributo.CBS, exports.EnumGrupoTributo.IBS_ESTADUAL, exports.EnumGrupoTributo.IBS_MUNICIPAL].includes(grupo)) {
|
|
3260
|
-
return;
|
|
3261
|
-
}
|
|
3262
|
-
var impostos = [grupo.toUpperCase(), grupo.toUpperCase() + "_DESONERADO"];
|
|
3263
|
-
var valorVsDesonerado = this.grupos.filter(function (g) { return g.grupoTributo === grupo; })
|
|
3264
|
-
.reduce(function (acc, grupo) {
|
|
3265
|
-
grupo.item.filter(function (i) { return impostos.includes(i.name); })
|
|
3266
|
-
.forEach(function (item) {
|
|
3267
|
-
var _a, _b, _c;
|
|
3268
|
-
var isDesonerado = item.name.search('DESONERADO') > 0;
|
|
3269
|
-
if (((_b = (_a = item.formGroup.controls) === null || _a === void 0 ? void 0 : _a.valorBrutoImposto) === null || _b === void 0 ? void 0 : _b.value) != undefined && !isDesonerado) {
|
|
3270
|
-
acc.valorBruto = item.formGroup.controls.valorBrutoImposto.value;
|
|
3271
|
-
}
|
|
3272
|
-
if (isDesonerado && ((_c = item.formGroup.value) === null || _c === void 0 ? void 0 : _c.valor) != undefined) {
|
|
3273
|
-
acc.valorDesonerado = item.formGroup.value.valor;
|
|
3274
|
-
}
|
|
3275
|
-
});
|
|
3276
|
-
return acc;
|
|
3277
|
-
}, { valorBruto: null, valorDesonerado: null });
|
|
3278
|
-
var tolerance = 0.0001;
|
|
3279
|
-
if (valorVsDesonerado.valorBruto && valorVsDesonerado.valorDesonerado &&
|
|
3280
|
-
Math.abs(valorVsDesonerado.valorBruto - valorVsDesonerado.valorDesonerado) > tolerance) {
|
|
3281
|
-
this.messageService.add({
|
|
3282
|
-
severity: 'error',
|
|
3283
|
-
summary: this.translate.instant('erpx.tributos.error_valor_desonerado_invalido_summary'),
|
|
3284
|
-
detail: this.translate.instant('erpx.tributos.error_valor_desonerado_detail')
|
|
3285
|
-
});
|
|
3286
|
-
}
|
|
3287
|
-
};
|
|
3288
3298
|
ErpTributosComponent.prototype.calcularImpostosTotal = function (impostos, grupo) {
|
|
3289
3299
|
var valores = {
|
|
3290
3300
|
funBase: 0,
|
|
@@ -3342,7 +3352,6 @@
|
|
|
3342
3352
|
_this.calcularValor(tributo);
|
|
3343
3353
|
_this.backValue();
|
|
3344
3354
|
_this.setValidators(tributo);
|
|
3345
|
-
_this.verificarValorDesonerado(it.grupo);
|
|
3346
3355
|
},
|
|
3347
3356
|
errorMessages: function () { return ({
|
|
3348
3357
|
required: _this.translate.instant('erpx.tributos.fields_required_validator')
|
|
@@ -3368,7 +3377,6 @@
|
|
|
3368
3377
|
size: { sm: 12, md: 4, lg: 4, xl: 3 },
|
|
3369
3378
|
onBlur: function () {
|
|
3370
3379
|
_this.calcularValor(tributo);
|
|
3371
|
-
_this.verificarValorDesonerado(it.grupo);
|
|
3372
3380
|
_this.backValue();
|
|
3373
3381
|
_this.setValidators(tributo);
|
|
3374
3382
|
},
|
|
@@ -3500,9 +3508,11 @@
|
|
|
3500
3508
|
numberLocaleOptions: _this.currencyLocaleOptions,
|
|
3501
3509
|
size: { sm: 12, md: 4, lg: 4, xl: 3 },
|
|
3502
3510
|
onBlur: function () {
|
|
3511
|
+
if (it.previousAction) {
|
|
3512
|
+
it.previousAction();
|
|
3513
|
+
}
|
|
3503
3514
|
_this.backValue();
|
|
3504
3515
|
_this.setValidators(tributo);
|
|
3505
|
-
_this.verificarValorDesonerado(it.grupo);
|
|
3506
3516
|
},
|
|
3507
3517
|
errorMessages: function () { return ({
|
|
3508
3518
|
required: _this.translate.instant('erpx.tributos.fields_required_validator'),
|