@senior-gestao-empresarial/erpx-components 4.9.2 → 4.11.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.
- package/bundles/senior-gestao-empresarial-erpx-components.umd.js +264 -48
- package/bundles/senior-gestao-empresarial-erpx-components.umd.js.map +1 -1
- package/bundles/senior-gestao-empresarial-erpx-components.umd.min.js +2 -2
- package/bundles/senior-gestao-empresarial-erpx-components.umd.min.js.map +1 -1
- package/components/rateio-editor/erp-rateio-editor.component.d.ts +78 -4
- package/components/rateio-editor/erp-rateio-editor.types.d.ts +22 -0
- package/components/rateio-editor/index.d.ts +1 -1
- package/esm2015/components/rateio-editor/erp-rateio-editor.component.js +242 -46
- package/esm2015/components/rateio-editor/erp-rateio-editor.types.js +1 -1
- package/esm2015/components/rateio-editor/index.js +1 -1
- package/esm5/components/rateio-editor/erp-rateio-editor.component.js +265 -49
- package/esm5/components/rateio-editor/erp-rateio-editor.types.js +1 -1
- package/esm5/components/rateio-editor/index.js +1 -1
- package/fesm2015/senior-gestao-empresarial-erpx-components.js +241 -45
- package/fesm2015/senior-gestao-empresarial-erpx-components.js.map +1 -1
- package/fesm5/senior-gestao-empresarial-erpx-components.js +264 -48
- 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
|
@@ -33386,9 +33386,15 @@
|
|
|
33386
33386
|
this.ButtonSize = angularComponents$1.ButtonSize;
|
|
33387
33387
|
this.loading = false;
|
|
33388
33388
|
this.selection = [];
|
|
33389
|
+
/** Seleção de centros de custo por conta financeira (keyed por idContaFinanceira). */
|
|
33390
|
+
this.ccSelection = {};
|
|
33389
33391
|
this.contasDataSource = [];
|
|
33390
33392
|
this.editingRowBackup = null;
|
|
33391
33393
|
this.editingCCBackup = null;
|
|
33394
|
+
/** Último valor selecionado no lookup de conta (carrega anaSin para validação). */
|
|
33395
|
+
this.selectedConta = null;
|
|
33396
|
+
/** Último valor selecionado no lookup de centro de custo (carrega anaSin/aceRat). */
|
|
33397
|
+
this.selectedCC = null;
|
|
33392
33398
|
// === MODAL CONTA FINANCEIRA ===
|
|
33393
33399
|
this.displayContaDialog = false;
|
|
33394
33400
|
this.editingContaIndex = null;
|
|
@@ -33401,6 +33407,7 @@
|
|
|
33401
33407
|
contas: this.fb.array([])
|
|
33402
33408
|
});
|
|
33403
33409
|
}
|
|
33410
|
+
ErpRateioEditorComponent_1 = ErpRateioEditorComponent;
|
|
33404
33411
|
Object.defineProperty(ErpRateioEditorComponent.prototype, "effectiveReadOnly", {
|
|
33405
33412
|
get: function () {
|
|
33406
33413
|
var _a;
|
|
@@ -33420,6 +33427,20 @@
|
|
|
33420
33427
|
enumerable: true,
|
|
33421
33428
|
configurable: true
|
|
33422
33429
|
});
|
|
33430
|
+
Object.defineProperty(ErpRateioEditorComponent.prototype, "requiresCentroCusto", {
|
|
33431
|
+
/**
|
|
33432
|
+
* Indica se o critério de rateio exige distribuição por centro de custo.
|
|
33433
|
+
* O critério 'V5' (Nenhum) não distribui por C. Custos; os demais exigem
|
|
33434
|
+
* ao menos um centro de custo por conta financeira.
|
|
33435
|
+
*/
|
|
33436
|
+
get: function () {
|
|
33437
|
+
var _a, _b;
|
|
33438
|
+
var criterio = (_b = (_a = this.loadedContext) === null || _a === void 0 ? void 0 : _a.criRat) !== null && _b !== void 0 ? _b : this.criRat;
|
|
33439
|
+
return criterio !== ErpRateioEditorComponent_1.CRITERIO_SEM_CENTRO_CUSTO;
|
|
33440
|
+
},
|
|
33441
|
+
enumerable: true,
|
|
33442
|
+
configurable: true
|
|
33443
|
+
});
|
|
33423
33444
|
Object.defineProperty(ErpRateioEditorComponent.prototype, "valorBase", {
|
|
33424
33445
|
get: function () {
|
|
33425
33446
|
var _a, _b;
|
|
@@ -33446,6 +33467,42 @@
|
|
|
33446
33467
|
enumerable: true,
|
|
33447
33468
|
configurable: true
|
|
33448
33469
|
});
|
|
33470
|
+
Object.defineProperty(ErpRateioEditorComponent.prototype, "valorRestanteDisplay", {
|
|
33471
|
+
/**
|
|
33472
|
+
* Valor restante a ser exibido nos cards de resumo.
|
|
33473
|
+
* Quando o critério exige centro de custo, considera o total já distribuído
|
|
33474
|
+
* nos CCs de todas as contas em vez do total das contas financeiras.
|
|
33475
|
+
* Assim o card reflete a distribuição real ponta-a-ponta.
|
|
33476
|
+
*/
|
|
33477
|
+
get: function () {
|
|
33478
|
+
var _a;
|
|
33479
|
+
if (!this.requiresCentroCusto) {
|
|
33480
|
+
return this.valorRestante;
|
|
33481
|
+
}
|
|
33482
|
+
var totalCC = this.contasDataSource.reduce(function (acc, conta) { return acc + (conta.rateiosCCusto || []).reduce(function (ccAcc, cc) { return ccAcc + (cc.valor || 0); }, 0); }, 0);
|
|
33483
|
+
return +(this.valorBase - totalCC).toFixed((_a = this.config.currencyScale) !== null && _a !== void 0 ? _a : 2);
|
|
33484
|
+
},
|
|
33485
|
+
enumerable: true,
|
|
33486
|
+
configurable: true
|
|
33487
|
+
});
|
|
33488
|
+
Object.defineProperty(ErpRateioEditorComponent.prototype, "percentualRestanteDisplay", {
|
|
33489
|
+
/**
|
|
33490
|
+
* Percentual restante a ser exibido nos cards de resumo.
|
|
33491
|
+
* Derivado de `valorRestanteDisplay` para manter consistência com o valor.
|
|
33492
|
+
*/
|
|
33493
|
+
get: function () {
|
|
33494
|
+
var _a;
|
|
33495
|
+
if (!this.requiresCentroCusto) {
|
|
33496
|
+
return this.percentualRestante;
|
|
33497
|
+
}
|
|
33498
|
+
if (!this.valorBase) {
|
|
33499
|
+
return 0;
|
|
33500
|
+
}
|
|
33501
|
+
return +(this.valorRestanteDisplay / this.valorBase * 100).toFixed((_a = this.config.percentageScale) !== null && _a !== void 0 ? _a : 4);
|
|
33502
|
+
},
|
|
33503
|
+
enumerable: true,
|
|
33504
|
+
configurable: true
|
|
33505
|
+
});
|
|
33449
33506
|
Object.defineProperty(ErpRateioEditorComponent.prototype, "numberFormatOptions", {
|
|
33450
33507
|
get: function () {
|
|
33451
33508
|
var _a, _b;
|
|
@@ -33525,6 +33582,26 @@
|
|
|
33525
33582
|
if (this.effectiveReadOnly) {
|
|
33526
33583
|
return;
|
|
33527
33584
|
}
|
|
33585
|
+
if (this.requiresCentroCusto && this.hasContaSemCentroCusto()) {
|
|
33586
|
+
var message = this.translate.instant('erpx.rateio_editor.erro_centro_custo_obrigatorio');
|
|
33587
|
+
this.messageService.add({
|
|
33588
|
+
severity: 'error',
|
|
33589
|
+
summary: this.translate.instant('erpx.rateio_editor.erro_titulo'),
|
|
33590
|
+
detail: message
|
|
33591
|
+
});
|
|
33592
|
+
this.error.emit({ operacao: 'save', message: message });
|
|
33593
|
+
return;
|
|
33594
|
+
}
|
|
33595
|
+
if (!this.isDistribuicaoCompleta()) {
|
|
33596
|
+
var message = this.translate.instant('erpx.rateio_editor.erro_distribuicao_incompleta');
|
|
33597
|
+
this.messageService.add({
|
|
33598
|
+
severity: 'error',
|
|
33599
|
+
summary: this.translate.instant('erpx.rateio_editor.erro_titulo'),
|
|
33600
|
+
detail: message
|
|
33601
|
+
});
|
|
33602
|
+
this.error.emit({ operacao: 'save', message: message });
|
|
33603
|
+
return;
|
|
33604
|
+
}
|
|
33528
33605
|
var ctx = this.loadedContext;
|
|
33529
33606
|
if (!((_a = ctx === null || ctx === void 0 ? void 0 : ctx.e070fil) === null || _a === void 0 ? void 0 : _a.id) || !(ctx === null || ctx === void 0 ? void 0 : ctx.criRat)) {
|
|
33530
33607
|
var message = this.translate.instant('erpx.rateio_editor.erro_contexto_incompleto');
|
|
@@ -33590,6 +33667,27 @@
|
|
|
33590
33667
|
if (this.idMovimento) {
|
|
33591
33668
|
parametro.idMovimento = this.idMovimento;
|
|
33592
33669
|
}
|
|
33670
|
+
if (this.e091plfId) {
|
|
33671
|
+
parametro.e091plf_id = this.e091plfId;
|
|
33672
|
+
}
|
|
33673
|
+
if (this.e044ccuId) {
|
|
33674
|
+
parametro.e044ccu_id = this.e044ccuId;
|
|
33675
|
+
}
|
|
33676
|
+
if (this.idTransacao) {
|
|
33677
|
+
parametro.idTransacao = this.idTransacao;
|
|
33678
|
+
}
|
|
33679
|
+
if (this.idFamilia) {
|
|
33680
|
+
parametro.idFamilia = this.idFamilia;
|
|
33681
|
+
}
|
|
33682
|
+
if (this.idDerivacao) {
|
|
33683
|
+
parametro.idDerivacao = this.idDerivacao;
|
|
33684
|
+
}
|
|
33685
|
+
if (this.idServico) {
|
|
33686
|
+
parametro.idServico = this.idServico;
|
|
33687
|
+
}
|
|
33688
|
+
if (this.valorExcedente != null) {
|
|
33689
|
+
parametro.valorExcedente = this.valorExcedente;
|
|
33690
|
+
}
|
|
33593
33691
|
var input = {
|
|
33594
33692
|
tipo: this.tipoMovimento,
|
|
33595
33693
|
parametros: [parametro]
|
|
@@ -33617,35 +33715,56 @@
|
|
|
33617
33715
|
var remainingPct = this.editingContaIndex != null
|
|
33618
33716
|
? this.percentualRestante + this.contasDataSource[this.editingContaIndex].percentual
|
|
33619
33717
|
: this.percentualRestante;
|
|
33718
|
+
// Usa o valor restante real em vez de recalcular via percentual, evitando
|
|
33719
|
+
// diferenças de arredondamento acumuladas nas entradas anteriores.
|
|
33720
|
+
var remainingValor = this.editingContaIndex != null
|
|
33721
|
+
? +(this.valorRestante + this.contasDataSource[this.editingContaIndex].valorRateadoConta).toFixed((_a = this.config.currencyScale) !== null && _a !== void 0 ? _a : 2)
|
|
33722
|
+
: this.valorRestante;
|
|
33620
33723
|
var contaValue = null;
|
|
33621
33724
|
var percentualValue = remainingPct > 0 ? remainingPct : null;
|
|
33622
|
-
var valorValue = percentualValue != null
|
|
33623
|
-
? +((percentualValue / 100) * this.valorBase).toFixed((_a = this.config.currencyScale) !== null && _a !== void 0 ? _a : 2)
|
|
33624
|
-
: null;
|
|
33725
|
+
var valorValue = percentualValue != null ? remainingValor : null;
|
|
33625
33726
|
if (this.editingContaIndex != null) {
|
|
33626
33727
|
var conta = this.contasDataSource[this.editingContaIndex];
|
|
33627
33728
|
contaValue = { id: conta.idContaFinanceira, label: conta.contaFinanceira };
|
|
33628
33729
|
percentualValue = conta.percentual;
|
|
33629
33730
|
valorValue = conta.valorRateadoConta;
|
|
33630
33731
|
}
|
|
33732
|
+
this.selectedConta = contaValue;
|
|
33631
33733
|
this.contaDialogFormGroup = this.fb.group({
|
|
33632
33734
|
contaFinanceira: [{ value: contaValue, disabled: this.editingContaIndex != null }, forms.Validators.required],
|
|
33633
33735
|
percentual: [{ value: percentualValue, disabled: false }, forms.Validators.required],
|
|
33634
|
-
valor: [{ value: valorValue, disabled: false }, forms.Validators.required]
|
|
33736
|
+
valor: [{ value: valorValue, disabled: false }, [forms.Validators.required, forms.Validators.max(this.valorBase)]]
|
|
33635
33737
|
});
|
|
33738
|
+
this.contaDialogFormGroup.get('contaFinanceira').valueChanges
|
|
33739
|
+
.pipe(operators.takeUntil(this.ngUnsubscribe))
|
|
33740
|
+
.subscribe(function (value) { return (_this.selectedConta = value || null); });
|
|
33636
33741
|
this.setupPercentualValorSync(this.contaDialogFormGroup, function () { return _this.valorBase; });
|
|
33637
33742
|
this.contaDialogFields = this.getContaDialogFields();
|
|
33638
33743
|
this.displayContaDialog = true;
|
|
33639
33744
|
};
|
|
33640
33745
|
ErpRateioEditorComponent.prototype.onSaveContaDialog = function () {
|
|
33641
|
-
var
|
|
33746
|
+
var _this = this;
|
|
33747
|
+
var _a, _b, _c;
|
|
33642
33748
|
if (this.contaDialogFormGroup.invalid) {
|
|
33643
33749
|
return;
|
|
33644
33750
|
}
|
|
33751
|
+
var contaControl = this.contaDialogFormGroup.get('contaFinanceira');
|
|
33645
33752
|
var data = this.contaDialogFormGroup.getRawValue();
|
|
33646
33753
|
var contaFinanceira = data.contaFinanceira;
|
|
33647
33754
|
var percentual = Number(data.percentual) || 0;
|
|
33648
33755
|
var valor = +(Number(data.valor) || 0).toFixed((_a = this.config.currencyScale) !== null && _a !== void 0 ? _a : 2);
|
|
33756
|
+
var idContaFinanceira = ((_b = this.selectedConta) === null || _b === void 0 ? void 0 : _b.id) || (contaFinanceira === null || contaFinanceira === void 0 ? void 0 : contaFinanceira.id) || '';
|
|
33757
|
+
// Validação analítica: conta sintética não pode ser usada no rateio
|
|
33758
|
+
if (((_c = this.selectedConta) === null || _c === void 0 ? void 0 : _c.anaSin) === ErpRateioEditorComponent_1.ANA_SIN_SINTETICO) {
|
|
33759
|
+
contaControl.setErrors({ contaSintetica: true });
|
|
33760
|
+
return;
|
|
33761
|
+
}
|
|
33762
|
+
// Validação de duplicidade (adição e edição, ignorando o item em edição)
|
|
33763
|
+
var duplicada = this.contasDataSource.some(function (c, i) { return i !== _this.editingContaIndex && c.idContaFinanceira === idContaFinanceira; });
|
|
33764
|
+
if (duplicada) {
|
|
33765
|
+
contaControl.setErrors({ duplicate: true });
|
|
33766
|
+
return;
|
|
33767
|
+
}
|
|
33649
33768
|
if (this.editingContaIndex != null) {
|
|
33650
33769
|
var conta = this.contasDataSource[this.editingContaIndex];
|
|
33651
33770
|
conta.percentual = percentual;
|
|
@@ -33653,22 +33772,16 @@
|
|
|
33653
33772
|
this.contasDataSource = __spread(this.contasDataSource);
|
|
33654
33773
|
}
|
|
33655
33774
|
else {
|
|
33656
|
-
var idContaFinanceira_1 = (contaFinanceira === null || contaFinanceira === void 0 ? void 0 : contaFinanceira.id) || '';
|
|
33657
33775
|
var labelConta = (contaFinanceira === null || contaFinanceira === void 0 ? void 0 : contaFinanceira.label) || '';
|
|
33658
|
-
// Validação extra: bloqueia duplicidade
|
|
33659
|
-
var jaExiste = this.contasDataSource.some(function (c) { return c.idContaFinanceira === idContaFinanceira_1; });
|
|
33660
|
-
if (jaExiste) {
|
|
33661
|
-
this.contaDialogFormGroup.get('contaFinanceira').setErrors({ duplicate: true });
|
|
33662
|
-
return;
|
|
33663
|
-
}
|
|
33664
33776
|
var novaConta = {
|
|
33665
|
-
idContaFinanceira:
|
|
33777
|
+
idContaFinanceira: idContaFinanceira,
|
|
33666
33778
|
contaFinanceira: labelConta,
|
|
33667
33779
|
percentual: percentual,
|
|
33668
33780
|
valorRateadoConta: valor,
|
|
33669
33781
|
rateiosCCusto: []
|
|
33670
33782
|
};
|
|
33671
33783
|
this.contasDataSource = __spread(this.contasDataSource, [novaConta]);
|
|
33784
|
+
this.ccSelection[novaConta.idContaFinanceira] = [];
|
|
33672
33785
|
}
|
|
33673
33786
|
this.displayContaDialog = false;
|
|
33674
33787
|
this.emitChange();
|
|
@@ -33684,55 +33797,75 @@
|
|
|
33684
33797
|
this.editingCCIndex = editCCIndex != null ? editCCIndex : null;
|
|
33685
33798
|
var conta = this.contasDataSource[contaIndex];
|
|
33686
33799
|
var ccList = conta.rateiosCCusto || [];
|
|
33687
|
-
var somaCC = ccList.reduce(function (acc, cc, i) { return acc + (i === _this.editingCCIndex ? 0 : (cc.percentual || 0)); }, 0);
|
|
33688
|
-
var remainingPct = +(100 - somaCC).toFixed((_a = this.config.percentageScale) !== null && _a !== void 0 ? _a : 4);
|
|
33689
33800
|
var valorBaseCC = conta.valorRateadoConta || 0;
|
|
33801
|
+
// Calcula o restante excluindo o item em edição (para que edição possa manter o próprio valor)
|
|
33802
|
+
var somaCCPct = ccList.reduce(function (acc, cc, i) { return acc + (i === _this.editingCCIndex ? 0 : (cc.percentual || 0)); }, 0);
|
|
33803
|
+
var somaCCValor = ccList.reduce(function (acc, cc, i) { return acc + (i === _this.editingCCIndex ? 0 : (cc.valor || 0)); }, 0);
|
|
33804
|
+
var remainingPct = +(100 - somaCCPct).toFixed((_a = this.config.percentageScale) !== null && _a !== void 0 ? _a : 4);
|
|
33805
|
+
var remainingValor = +(valorBaseCC - somaCCValor).toFixed((_b = this.config.currencyScale) !== null && _b !== void 0 ? _b : 2);
|
|
33690
33806
|
var ccValue = null;
|
|
33691
33807
|
var percentualValue = remainingPct > 0 ? remainingPct : null;
|
|
33692
|
-
|
|
33693
|
-
|
|
33694
|
-
|
|
33808
|
+
// Usa o valor restante real (já calculado acima) em vez de recalcular via percentual,
|
|
33809
|
+
// evitando diferenças de arredondamento acumuladas nos CCs anteriores.
|
|
33810
|
+
var valorValue = percentualValue != null ? remainingValor : null;
|
|
33695
33811
|
if (this.editingCCIndex != null) {
|
|
33696
33812
|
var cc = ccList[this.editingCCIndex];
|
|
33697
33813
|
ccValue = { id: cc.idCentroCusto, label: cc.descCCusto || cc.idCentroCusto };
|
|
33698
33814
|
percentualValue = cc.percentual;
|
|
33699
33815
|
valorValue = cc.valor;
|
|
33700
33816
|
}
|
|
33817
|
+
// maxPct: percentual máximo que este CC pode ter (não pode ultrapassar o restante da conta)
|
|
33818
|
+
var maxPct = remainingPct;
|
|
33819
|
+
// maxValor: valor máximo que este CC pode ter (não pode ultrapassar o restante em dinheiro)
|
|
33820
|
+
var maxValor = remainingValor;
|
|
33821
|
+
this.selectedCC = ccValue;
|
|
33701
33822
|
this.ccDialogFormGroup = this.fb.group({
|
|
33702
33823
|
centroCusto: [{ value: ccValue, disabled: this.editingCCIndex != null }, forms.Validators.required],
|
|
33703
|
-
percentual: [{ value: percentualValue, disabled: false }, forms.Validators.required],
|
|
33704
|
-
valor: [{ value: valorValue, disabled: false }, forms.Validators.required]
|
|
33824
|
+
percentual: [{ value: percentualValue, disabled: false }, [forms.Validators.required, forms.Validators.max(maxPct)]],
|
|
33825
|
+
valor: [{ value: valorValue, disabled: false }, [forms.Validators.required, forms.Validators.max(maxValor)]]
|
|
33705
33826
|
});
|
|
33827
|
+
this.ccDialogFormGroup.get('centroCusto').valueChanges
|
|
33828
|
+
.pipe(operators.takeUntil(this.ngUnsubscribe))
|
|
33829
|
+
.subscribe(function (value) { return (_this.selectedCC = value || null); });
|
|
33706
33830
|
this.setupPercentualValorSync(this.ccDialogFormGroup, function () { return valorBaseCC; });
|
|
33707
33831
|
this.ccDialogFields = this.getCCDialogFields();
|
|
33708
33832
|
this.displayCCDialog = true;
|
|
33709
33833
|
};
|
|
33710
33834
|
ErpRateioEditorComponent.prototype.onSaveCCDialog = function () {
|
|
33711
|
-
var
|
|
33835
|
+
var _this = this;
|
|
33836
|
+
var _a, _b, _c, _d;
|
|
33712
33837
|
if (this.ccDialogFormGroup.invalid) {
|
|
33713
33838
|
return;
|
|
33714
33839
|
}
|
|
33840
|
+
var ccControl = this.ccDialogFormGroup.get('centroCusto');
|
|
33715
33841
|
var data = this.ccDialogFormGroup.getRawValue();
|
|
33716
33842
|
var centroCusto = data.centroCusto;
|
|
33717
33843
|
var percentual = Number(data.percentual) || 0;
|
|
33718
33844
|
var valor = +(Number(data.valor) || 0).toFixed((_a = this.config.currencyScale) !== null && _a !== void 0 ? _a : 2);
|
|
33719
33845
|
var conta = this.contasDataSource[this.editingCCContaIndex];
|
|
33846
|
+
var idCentroCusto = ((_b = this.selectedCC) === null || _b === void 0 ? void 0 : _b.id) || (centroCusto === null || centroCusto === void 0 ? void 0 : centroCusto.id) || '';
|
|
33847
|
+
// Validação analítica: CC sintético ou que não aceita rateio é inválido
|
|
33848
|
+
var ccInvalido = ((_c = this.selectedCC) === null || _c === void 0 ? void 0 : _c.aceRat) === false
|
|
33849
|
+
|| ((_d = this.selectedCC) === null || _d === void 0 ? void 0 : _d.anaSin) === ErpRateioEditorComponent_1.ANA_SIN_SINTETICO;
|
|
33850
|
+
if (ccInvalido) {
|
|
33851
|
+
ccControl.setErrors({ centroCustoInvalido: true });
|
|
33852
|
+
return;
|
|
33853
|
+
}
|
|
33854
|
+
// Validação de duplicidade na mesma conta (adição e edição, ignorando o item em edição)
|
|
33855
|
+
var ccList = conta.rateiosCCusto || [];
|
|
33856
|
+
var duplicado = ccList.some(function (cc, i) { return i !== _this.editingCCIndex && cc.idCentroCusto === idCentroCusto; });
|
|
33857
|
+
if (duplicado) {
|
|
33858
|
+
ccControl.setErrors({ duplicate: true });
|
|
33859
|
+
return;
|
|
33860
|
+
}
|
|
33720
33861
|
if (this.editingCCIndex != null) {
|
|
33721
33862
|
var cc = conta.rateiosCCusto[this.editingCCIndex];
|
|
33722
33863
|
cc.percentual = percentual;
|
|
33723
33864
|
cc.valor = valor;
|
|
33724
33865
|
}
|
|
33725
33866
|
else {
|
|
33726
|
-
var idCentroCusto_1 = (centroCusto === null || centroCusto === void 0 ? void 0 : centroCusto.id) || '';
|
|
33727
33867
|
var labelCCusto = (centroCusto === null || centroCusto === void 0 ? void 0 : centroCusto.label) || '';
|
|
33728
|
-
|
|
33729
|
-
var ccList = conta.rateiosCCusto || [];
|
|
33730
|
-
var jaExiste = ccList.some(function (cc) { return cc.idCentroCusto === idCentroCusto_1; });
|
|
33731
|
-
if (jaExiste) {
|
|
33732
|
-
this.ccDialogFormGroup.get('centroCusto').setErrors({ duplicate: true });
|
|
33733
|
-
return;
|
|
33734
|
-
}
|
|
33735
|
-
conta.rateiosCCusto = __spread(ccList, [{ idCentroCusto: idCentroCusto_1, descCCusto: labelCCusto, percentual: percentual, valor: valor }]);
|
|
33868
|
+
conta.rateiosCCusto = __spread(ccList, [{ idCentroCusto: idCentroCusto, descCCusto: labelCCusto, percentual: percentual, valor: valor }]);
|
|
33736
33869
|
}
|
|
33737
33870
|
this.contasDataSource = __spread(this.contasDataSource);
|
|
33738
33871
|
this.displayCCDialog = false;
|
|
@@ -33743,15 +33876,38 @@
|
|
|
33743
33876
|
};
|
|
33744
33877
|
// === AÇÕES DA TABELA ===
|
|
33745
33878
|
ErpRateioEditorComponent.prototype.onDeleteSelected = function () {
|
|
33879
|
+
var _this = this;
|
|
33746
33880
|
if (!this.selection.length) {
|
|
33747
33881
|
return;
|
|
33748
33882
|
}
|
|
33749
33883
|
var idsToRemove = new Set(this.selection.map(function (s) { return s.idContaFinanceira; }));
|
|
33750
33884
|
this.contasDataSource = this.contasDataSource.filter(function (c) { return !idsToRemove.has(c.idContaFinanceira); });
|
|
33885
|
+
idsToRemove.forEach(function (id) { return delete _this.ccSelection[id]; });
|
|
33751
33886
|
this.selection = [];
|
|
33752
33887
|
this.emitChange();
|
|
33753
33888
|
};
|
|
33889
|
+
/** Remove os centros de custo selecionados de uma conta financeira. */
|
|
33890
|
+
ErpRateioEditorComponent.prototype.onDeleteSelectedCC = function (conta) {
|
|
33891
|
+
var selecionados = this.ccSelection[conta.idContaFinanceira] || [];
|
|
33892
|
+
if (!selecionados.length) {
|
|
33893
|
+
this.messageService.add({
|
|
33894
|
+
severity: 'warn',
|
|
33895
|
+
summary: this.translate.instant('erpx.rateio_editor.erro_titulo'),
|
|
33896
|
+
detail: this.translate.instant('erpx.rateio_editor.nenhum_centro_custo_selecionado')
|
|
33897
|
+
});
|
|
33898
|
+
return;
|
|
33899
|
+
}
|
|
33900
|
+
var idsToRemove = new Set(selecionados.map(function (cc) { return cc.idCentroCusto; }));
|
|
33901
|
+
conta.rateiosCCusto = conta.rateiosCCusto.filter(function (cc) { return !idsToRemove.has(cc.idCentroCusto); });
|
|
33902
|
+
this.ccSelection[conta.idContaFinanceira] = [];
|
|
33903
|
+
this.contasDataSource = __spread(this.contasDataSource);
|
|
33904
|
+
this.emitChange();
|
|
33905
|
+
};
|
|
33754
33906
|
ErpRateioEditorComponent.prototype.removerConta = function (index) {
|
|
33907
|
+
var removida = this.contasDataSource[index];
|
|
33908
|
+
if (removida) {
|
|
33909
|
+
delete this.ccSelection[removida.idContaFinanceira];
|
|
33910
|
+
}
|
|
33755
33911
|
this.contasDataSource = this.contasDataSource.filter(function (_, i) { return i !== index; });
|
|
33756
33912
|
this.emitChange();
|
|
33757
33913
|
};
|
|
@@ -33761,24 +33917,12 @@
|
|
|
33761
33917
|
this.contasDataSource = __spread(this.contasDataSource);
|
|
33762
33918
|
this.emitChange();
|
|
33763
33919
|
};
|
|
33764
|
-
ErpRateioEditorComponent.prototype.getMenuOptionsPerRow = function (rowData, rowIndex) {
|
|
33765
|
-
var _this = this;
|
|
33766
|
-
return [
|
|
33767
|
-
{ label: this.translate.instant('erpx.rateio_editor.editar'), command: function () { return _this.openContaDialog(rowIndex); } },
|
|
33768
|
-
{ label: this.translate.instant('erpx.rateio_editor.adicionar_centro_custo'), command: function () { return _this.openCCDialog(rowIndex); } },
|
|
33769
|
-
{ label: this.translate.instant('erpx.rateio_editor.excluir'), command: function () { return _this.removerConta(rowIndex); } }
|
|
33770
|
-
];
|
|
33771
|
-
};
|
|
33772
|
-
ErpRateioEditorComponent.prototype.getCCMenuOptions = function (contaIndex, ccIndex) {
|
|
33773
|
-
var _this = this;
|
|
33774
|
-
return [
|
|
33775
|
-
{ label: this.translate.instant('erpx.rateio_editor.editar'), command: function () { return _this.openCCDialog(contaIndex, ccIndex); } },
|
|
33776
|
-
{ label: this.translate.instant('erpx.rateio_editor.excluir'), command: function () { return _this.removerCentroCusto(contaIndex, ccIndex); } }
|
|
33777
|
-
];
|
|
33778
|
-
};
|
|
33779
33920
|
ErpRateioEditorComponent.prototype.getContaIndex = function (rowData) {
|
|
33780
33921
|
return this.contasDataSource.indexOf(rowData);
|
|
33781
33922
|
};
|
|
33923
|
+
ErpRateioEditorComponent.prototype.getCCIndex = function (conta, cc) {
|
|
33924
|
+
return (conta.rateiosCCusto || []).indexOf(cc);
|
|
33925
|
+
};
|
|
33782
33926
|
// === PRIVADOS ===
|
|
33783
33927
|
/** Inicializa o componente a partir dos inputs (sem chamada à API de carga). */
|
|
33784
33928
|
ErpRateioEditorComponent.prototype.inicializarPorInputs = function () {
|
|
@@ -33806,7 +33950,50 @@
|
|
|
33806
33950
|
}, function (err) { var _a; return _this.error.emit({ operacao: 'load', message: ((_a = err === null || err === void 0 ? void 0 : err.error) === null || _a === void 0 ? void 0 : _a.message) || (err === null || err === void 0 ? void 0 : err.message) || _this.translate.instant('erpx.rateio_editor.erro_carregar'), originalError: err }); });
|
|
33807
33951
|
};
|
|
33808
33952
|
ErpRateioEditorComponent.prototype.popularComRateios = function (rateios) {
|
|
33953
|
+
var _this = this;
|
|
33809
33954
|
this.contasDataSource = __spread(rateios);
|
|
33955
|
+
this.ccSelection = {};
|
|
33956
|
+
this.contasDataSource.forEach(function (conta) {
|
|
33957
|
+
_this.ccSelection[conta.idContaFinanceira] = [];
|
|
33958
|
+
});
|
|
33959
|
+
};
|
|
33960
|
+
Object.defineProperty(ErpRateioEditorComponent.prototype, "distribuicaoCompleta", {
|
|
33961
|
+
/**
|
|
33962
|
+
* Distribuição completa: restantes globais e de cada conta iguais a zero.
|
|
33963
|
+
* Exposto publicamente para que o template possa reagir ao estado real de
|
|
33964
|
+
* completude (contas + centros de custo).
|
|
33965
|
+
*/
|
|
33966
|
+
get: function () {
|
|
33967
|
+
var _this = this;
|
|
33968
|
+
if (this.percentualRestante !== 0 || this.valorRestante !== 0) {
|
|
33969
|
+
return false;
|
|
33970
|
+
}
|
|
33971
|
+
return this.contasDataSource.every(function (conta) { return _this.isContaCCCompleta(conta); });
|
|
33972
|
+
},
|
|
33973
|
+
enumerable: true,
|
|
33974
|
+
configurable: true
|
|
33975
|
+
});
|
|
33976
|
+
/** @deprecated Usar o getter `distribuicaoCompleta`. Mantido para compatibilidade interna. */
|
|
33977
|
+
ErpRateioEditorComponent.prototype.isDistribuicaoCompleta = function () {
|
|
33978
|
+
return this.distribuicaoCompleta;
|
|
33979
|
+
};
|
|
33980
|
+
/** Indica se há ao menos uma conta financeira sem nenhum centro de custo vinculado. */
|
|
33981
|
+
ErpRateioEditorComponent.prototype.hasContaSemCentroCusto = function () {
|
|
33982
|
+
return this.contasDataSource.some(function (conta) { return (conta.rateiosCCusto || []).length === 0; });
|
|
33983
|
+
};
|
|
33984
|
+
/** Restante de % e de valor dos centros de custo de uma conta igual a zero. */
|
|
33985
|
+
ErpRateioEditorComponent.prototype.isContaCCCompleta = function (conta) {
|
|
33986
|
+
var _a, _b;
|
|
33987
|
+
var ccs = conta.rateiosCCusto || [];
|
|
33988
|
+
if (ccs.length === 0) {
|
|
33989
|
+
// Sem centro de custo só é válido quando o critério não exige rateio por C. Custos.
|
|
33990
|
+
return !this.requiresCentroCusto;
|
|
33991
|
+
}
|
|
33992
|
+
var somaPct = ccs.reduce(function (acc, cc) { return acc + (cc.percentual || 0); }, 0);
|
|
33993
|
+
var somaValor = ccs.reduce(function (acc, cc) { return acc + (cc.valor || 0); }, 0);
|
|
33994
|
+
var pctRestante = +(100 - somaPct).toFixed((_a = this.config.percentageScale) !== null && _a !== void 0 ? _a : 4);
|
|
33995
|
+
var valorRestante = +((conta.valorRateadoConta || 0) - somaValor).toFixed((_b = this.config.currencyScale) !== null && _b !== void 0 ? _b : 2);
|
|
33996
|
+
return pctRestante === 0 && valorRestante === 0;
|
|
33810
33997
|
};
|
|
33811
33998
|
ErpRateioEditorComponent.prototype.getContaDialogFields = function () {
|
|
33812
33999
|
var _this = this;
|
|
@@ -33815,6 +34002,7 @@
|
|
|
33815
34002
|
new angularComponents$1.FormField(__assign(__assign({}, this.e091PlfLookup.mountOptions({
|
|
33816
34003
|
multiple: false,
|
|
33817
34004
|
formGroup: 'contaFinanceira',
|
|
34005
|
+
queryFields: ['anaSin'],
|
|
33818
34006
|
defaultFilter: [
|
|
33819
34007
|
{ field: 'excluido', operator: angularComponents.EnumLogicalOperator.Eq, values: ['false'] },
|
|
33820
34008
|
{ field: 'sitFin', operator: angularComponents.EnumLogicalOperator.Eq, values: ['VA'] },
|
|
@@ -33850,6 +34038,7 @@
|
|
|
33850
34038
|
new angularComponents$1.FormField(__assign(__assign({}, this.e044CcuLookup.mountOptions({
|
|
33851
34039
|
multiple: false,
|
|
33852
34040
|
formGroup: 'centroCusto',
|
|
34041
|
+
queryFields: ['anaSin', 'aceRat'],
|
|
33853
34042
|
defaultFilter: [
|
|
33854
34043
|
{ field: 'excluido', operator: angularComponents.EnumLogicalOperator.Eq, values: ['false'] },
|
|
33855
34044
|
{ field: 'sitCcu', operator: angularComponents.EnumLogicalOperator.Eq, values: ['VA'] },
|
|
@@ -33923,10 +34112,15 @@
|
|
|
33923
34112
|
ErpRateioEditorComponent.prototype.emitChange = function () {
|
|
33924
34113
|
this.change.emit({
|
|
33925
34114
|
isDirty: true,
|
|
33926
|
-
isValid: this.
|
|
34115
|
+
isValid: this.isDistribuicaoCompleta(),
|
|
33927
34116
|
rateios: this.contasDataSource
|
|
33928
34117
|
});
|
|
33929
34118
|
};
|
|
34119
|
+
var ErpRateioEditorComponent_1;
|
|
34120
|
+
/** Valor de anaSin que indica registro sintético (não analítico). */
|
|
34121
|
+
ErpRateioEditorComponent.ANA_SIN_SINTETICO = 'VS';
|
|
34122
|
+
/** Critério de rateio que não distribui por centro de custo (Nenhum). */
|
|
34123
|
+
ErpRateioEditorComponent.CRITERIO_SEM_CENTRO_CUSTO = 'V5';
|
|
33930
34124
|
ErpRateioEditorComponent.ctorParameters = function () { return [
|
|
33931
34125
|
{ type: forms.FormBuilder },
|
|
33932
34126
|
{ type: ErpRateioEditorService },
|
|
@@ -33968,6 +34162,27 @@
|
|
|
33968
34162
|
__decorate([
|
|
33969
34163
|
core.Input()
|
|
33970
34164
|
], ErpRateioEditorComponent.prototype, "criRat", void 0);
|
|
34165
|
+
__decorate([
|
|
34166
|
+
core.Input()
|
|
34167
|
+
], ErpRateioEditorComponent.prototype, "e091plfId", void 0);
|
|
34168
|
+
__decorate([
|
|
34169
|
+
core.Input()
|
|
34170
|
+
], ErpRateioEditorComponent.prototype, "e044ccuId", void 0);
|
|
34171
|
+
__decorate([
|
|
34172
|
+
core.Input()
|
|
34173
|
+
], ErpRateioEditorComponent.prototype, "idTransacao", void 0);
|
|
34174
|
+
__decorate([
|
|
34175
|
+
core.Input()
|
|
34176
|
+
], ErpRateioEditorComponent.prototype, "idFamilia", void 0);
|
|
34177
|
+
__decorate([
|
|
34178
|
+
core.Input()
|
|
34179
|
+
], ErpRateioEditorComponent.prototype, "idDerivacao", void 0);
|
|
34180
|
+
__decorate([
|
|
34181
|
+
core.Input()
|
|
34182
|
+
], ErpRateioEditorComponent.prototype, "idServico", void 0);
|
|
34183
|
+
__decorate([
|
|
34184
|
+
core.Input()
|
|
34185
|
+
], ErpRateioEditorComponent.prototype, "valorExcedente", void 0);
|
|
33971
34186
|
__decorate([
|
|
33972
34187
|
core.Input()
|
|
33973
34188
|
], ErpRateioEditorComponent.prototype, "currencyCode", void 0);
|
|
@@ -33986,10 +34201,11 @@
|
|
|
33986
34201
|
__decorate([
|
|
33987
34202
|
core.ViewChild('tableRateio')
|
|
33988
34203
|
], ErpRateioEditorComponent.prototype, "table", void 0);
|
|
33989
|
-
ErpRateioEditorComponent = __decorate([
|
|
34204
|
+
ErpRateioEditorComponent = ErpRateioEditorComponent_1 = __decorate([
|
|
33990
34205
|
core.Component({
|
|
33991
34206
|
selector: 'erp-rateio-editor',
|
|
33992
|
-
template: "<s-loading-state [loading]=\"loading\" [blockWindow]=\"true\">\n <!-- Se\u00E7\u00E3o 1: Informa\u00E7\u00F5es do movimento -->\n <div class=\"sds-section-title\" *ngIf=\"isReady\">\n {{ 'erpx.rateio_editor.titulo' | translate }}\n </div>\n\n <div class=\"ui-g custom-stats\" *ngIf=\"isReady\">\n <div class=\"ui-sm-12 ui-md-4\">\n <s-stats-card\n [animateNumbers]=\"true\"\n color=\"#0C9348\"\n [lightMode]=\"true\"\n [lightVersion]=\"true\"\n iconClass=\"far fa-dollar-sign\"\n [label]=\"'erpx.rateio_editor.valor_base' | translate\"\n [value]=\"valorBase | numeric:numberFormatOptions | async\"\n ></s-stats-card>\n </div>\n <div class=\"ui-sm-12 ui-md-4\">\n <s-stats-card\n [animateNumbers]=\"true\"\n color=\"#428BCA\"\n [lightMode]=\"true\"\n [lightVersion]=\"true\"\n iconClass=\"far fa-percent\"\n [label]=\"'erpx.rateio_editor.percentual_restante' | translate\"\n [value]=\"percentualRestante + '%'\"\n ></s-stats-card>\n </div>\n <div class=\"ui-sm-12 ui-md-4\">\n <s-stats-card\n [animateNumbers]=\"true\"\n [color]=\"valorRestante === 0 ? '#0C9348' : '#C13018'\"\n [lightMode]=\"true\"\n [lightVersion]=\"true\"\n iconClass=\"far fa-dollar-sign\"\n [label]=\"'erpx.rateio_editor.valor_restante' | translate\"\n [value]=\"valorRestante | numeric:numberFormatOptions | async\"\n ></s-stats-card>\n </div>\n </div>\n\n <!-- Se\u00E7\u00E3o 2: Tabela de rateios -->\n <div class=\"sds-section-title\" *ngIf=\"isReady\">\n {{ 'erpx.rateio_editor.lista_rateios' | translate }}\n </div>\n\n <s-empty-state\n *ngIf=\"isReady && contasDataSource?.length === 0\"\n iconClass=\"far fa-dollar-sign\"\n [title]=\"'erpx.rateio_editor.sem_rateios_titulo' | translate\"\n [description]=\"'erpx.rateio_editor.sem_rateios_descricao' | translate\"\n ></s-empty-state>\n\n <div class=\"ui-g\" *ngIf=\"isReady && contasDataSource?.length > 0\">\n <div class=\"ui-g-12\" *ngIf=\"!effectiveReadOnly\">\n <s-button\n [label]=\"'erpx.rateio_editor.adicionar_conta' | translate\"\n iconClass=\"fa fa-plus\"\n (onClick)=\"openContaDialog()\"\n ></s-button>\n <s-button\n *ngIf=\"showSugestaoButton\"\n [label]=\"'erpx.rateio_editor.sugerir_rateio' | translate\"\n [priority]=\"ButtonPriority.Secondary\"\n iconClass=\"fa fa-magic\"\n (onClick)=\"onSugerir()\"\n ></s-button>\n <s-button\n [label]=\"'erpx.rateio_editor.remover_conta' | translate\"\n [priority]=\"ButtonPriority.Secondary\"\n (onClick)=\"onDeleteSelected()\"\n [disabled]=\"!selection.length\"\n ></s-button>\n </div>\n <div class=\"ui-g-12\">\n <p-table\n #tableRateio\n [value]=\"contasDataSource\"\n [columns]=\"gridColumns\"\n dataKey=\"idContaFinanceira\"\n [resizableColumns]=\"true\"\n [totalRecords]=\"contasDataSource.length\"\n [(selection)]=\"selection\"\n [paginator]=\"false\"\n [rows]=\"10\"\n >\n <ng-template pTemplate=\"header\" let-columns>\n <tr>\n <th scope=\"col\" style=\"width: 3em\"></th>\n <th scope=\"col\" class=\"col-checkbox\" style=\"width: 50px\">\n <p-tableHeaderCheckbox *ngIf=\"!effectiveReadOnly\"></p-tableHeaderCheckbox>\n </th>\n <th *ngFor=\"let col of columns\" scope=\"col\" pResizableColumn>\n <div class=\"senior-header\">\n <span class=\"senior-header-title\">{{ col.header }}</span>\n </div>\n </th>\n <th scope=\"col\" *ngIf=\"!effectiveReadOnly\">\n <div class=\"senior-header\">\n <span class=\"senior-header-title\">{{ 'erpx.rateio_editor.acoes' | translate }}</span>\n </div>\n </th>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"body\" let-rowData let-rowIndex=\"rowIndex\" let-expanded=\"expanded\">\n <tr>\n <td style=\"width: 3em; text-align: center\">\n <a *ngIf=\"rowData.rateiosCCusto?.length\" [pRowToggler]=\"rowData\" role=\"button\" tabindex=\"0\">\n <i [class]=\"expanded ? 'fa fa-minus' : 'fa fa-plus'\"></i>\n </a>\n </td>\n <td class=\"col-checkbox\" style=\"width: 50px\">\n <p-tableCheckbox *ngIf=\"!effectiveReadOnly\" [value]=\"rowData\"></p-tableCheckbox>\n </td>\n <td>{{ rowData.contaFinanceira || rowData.idContaFinanceira }}</td>\n <td style=\"text-align: right\">{{ rowData.percentual }}</td>\n <td style=\"text-align: right\">{{ rowData.valorRateadoConta | numeric:numberFormatOptions | async }}</td>\n <td *ngIf=\"!effectiveReadOnly\">\n <s-button\n [auxiliary]=\"true\"\n [priority]=\"ButtonPriority.Default\"\n [size]=\"ButtonSize.Small\"\n [label]=\"'erpx.rateio_editor.acoes' | translate\"\n [menuOptions]=\"getMenuOptionsPerRow(rowData, rowIndex)\"\n ></s-button>\n </td>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"rowexpansion\" let-rowData let-rowIndex=\"rowIndex\">\n <tr>\n <td [attr.colspan]=\"effectiveReadOnly ? gridColumns.length + 2 : gridColumns.length + 3\">\n <div class=\"ui-g\" style=\"padding: 8px 16px\">\n <p-table [value]=\"rowData.rateiosCCusto\" [responsive]=\"true\">\n <ng-template pTemplate=\"header\">\n <tr>\n <th scope=\"col\">{{ 'erpx.rateio_editor.centro_custo' | translate }}</th>\n <th scope=\"col\">{{ 'erpx.rateio_editor.percentual' | translate }}</th>\n <th scope=\"col\">{{ 'erpx.rateio_editor.valor' | translate }}</th>\n <th scope=\"col\" *ngIf=\"!effectiveReadOnly\">{{ 'erpx.rateio_editor.acoes' | translate }}</th>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"body\" let-cc let-ccIndex=\"rowIndex\">\n <tr>\n <td>{{ cc.descCCusto || cc.idCentroCusto }}</td>\n <td style=\"text-align: right\">{{ cc.percentual }}</td>\n <td style=\"text-align: right\">{{ cc.valor | numeric:numberFormatOptions | async }}</td>\n <td *ngIf=\"!effectiveReadOnly\">\n <s-button\n [auxiliary]=\"true\"\n [priority]=\"ButtonPriority.Default\"\n [size]=\"ButtonSize.Small\"\n [label]=\"'erpx.rateio_editor.acoes' | translate\"\n [menuOptions]=\"getCCMenuOptions(getContaIndex(rowData), ccIndex)\"\n ></s-button>\n </td>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"emptymessage\">\n <tr>\n <td [attr.colspan]=\"effectiveReadOnly ? 3 : 4\">\n {{ 'erpx.rateio_editor.sem_centros_custo' | translate }}\n </td>\n </tr>\n </ng-template>\n </p-table>\n </div>\n </td>\n </tr>\n </ng-template>\n </p-table>\n </div>\n </div>\n\n <!-- Bot\u00F5es de a\u00E7\u00E3o -->\n <div *ngIf=\"isReady\" class=\"ui-g rateio-editor-actions\">\n <div class=\"ui-g-12\">\n <div *ngIf=\"!effectiveReadOnly && contasDataSource?.length === 0\" style=\"margin-bottom: 8px\">\n <s-button\n [label]=\"'erpx.rateio_editor.adicionar_conta' | translate\"\n iconClass=\"fa fa-plus\"\n (onClick)=\"openContaDialog()\"\n ></s-button>\n <s-button\n *ngIf=\"showSugestaoButton\"\n [label]=\"'erpx.rateio_editor.sugerir_rateio' | translate\"\n [priority]=\"ButtonPriority.Secondary\"\n iconClass=\"fa fa-magic\"\n (onClick)=\"onSugerir()\"\n ></s-button>\n </div>\n <s-button\n *ngIf=\"!effectiveReadOnly && !isStandalone\"\n priority=\"primary\"\n iconClass=\"fa fa-check\"\n [label]=\"'erpx.rateio_editor.salvar' | translate\"\n (onClick)=\"onSalvar()\"\n ></s-button>\n </div>\n </div>\n</s-loading-state>\n\n<!-- Modal: Adicionar/Editar Conta Financeira -->\n<p-dialog\n [header]=\"'erpx.rateio_editor.adicionar_conta' | translate\"\n appendTo=\"body\"\n [modal]=\"true\"\n [(visible)]=\"displayContaDialog\"\n (onHide)=\"onHideContaDialog()\"\n [blockScroll]=\"true\"\n [focusOnShow]=\"false\"\n styleClass=\"custom-dialog\"\n [draggable]=\"false\"\n [resizable]=\"false\"\n [style]=\"{width: '40%'}\"\n>\n <form *ngIf=\"contaDialogFormGroup\" [formGroup]=\"contaDialogFormGroup\" (ngSubmit)=\"onSaveContaDialog()\">\n <div class=\"ui-fluid\">\n <s-dynamic-form\n [fields]=\"contaDialogFields\"\n [form]=\"contaDialogFormGroup\"\n [errorMessages]=\"{\n required: ('erpx.rateio_editor.erro_obrigatorio' | translate),\n duplicate: ('erpx.rateio_editor.conta_duplicada' | translate)\n }\"\n ></s-dynamic-form>\n </div>\n </form>\n <p-footer>\n <s-button\n id=\"dialog-conta-save\"\n type=\"button\"\n priority=\"primary\"\n [label]=\"'erpx.rateio_editor.salvar' | translate\"\n (onClick)=\"onSaveContaDialog()\"\n ></s-button>\n <s-button\n id=\"dialog-conta-cancel\"\n type=\"button\"\n priority=\"secondary\"\n [label]=\"'erpx.rateio_editor.cancelar' | translate\"\n (onClick)=\"onHideContaDialog()\"\n ></s-button>\n </p-footer>\n</p-dialog>\n\n<!-- Modal: Adicionar/Editar Centro de Custo -->\n<p-dialog\n [header]=\"'erpx.rateio_editor.adicionar_centro_custo' | translate\"\n appendTo=\"body\"\n [modal]=\"true\"\n [(visible)]=\"displayCCDialog\"\n (onHide)=\"onHideCCDialog()\"\n [blockScroll]=\"true\"\n [focusOnShow]=\"false\"\n styleClass=\"custom-dialog\"\n [draggable]=\"false\"\n [resizable]=\"false\"\n [style]=\"{width: '40%'}\"\n>\n <form *ngIf=\"ccDialogFormGroup\" [formGroup]=\"ccDialogFormGroup\" (ngSubmit)=\"onSaveCCDialog()\">\n <div class=\"ui-fluid\">\n <s-dynamic-form\n [fields]=\"ccDialogFields\"\n [form]=\"ccDialogFormGroup\"\n [errorMessages]=\"{\n required: ('erpx.rateio_editor.erro_obrigatorio' | translate),\n duplicate: ('erpx.rateio_editor.centro_custo_duplicado' | translate)\n }\"\n ></s-dynamic-form>\n </div>\n </form>\n <p-footer>\n <s-button\n id=\"dialog-cc-save\"\n type=\"button\"\n priority=\"primary\"\n [label]=\"'erpx.rateio_editor.salvar' | translate\"\n (onClick)=\"onSaveCCDialog()\"\n ></s-button>\n <s-button\n id=\"dialog-cc-cancel\"\n type=\"button\"\n priority=\"secondary\"\n [label]=\"'erpx.rateio_editor.cancelar' | translate\"\n (onClick)=\"onHideCCDialog()\"\n ></s-button>\n </p-footer>\n</p-dialog>\n"
|
|
34207
|
+
template: "<s-loading-state [loading]=\"loading\" [blockWindow]=\"true\">\n <!-- Se\u00E7\u00E3o 1: Informa\u00E7\u00F5es do movimento -->\n <div class=\"sds-section-title\" *ngIf=\"isReady\">\n {{ 'erpx.rateio_editor.titulo' | translate }}\n </div>\n\n <div class=\"ui-g custom-stats\" *ngIf=\"isReady\">\n <div class=\"ui-sm-12 ui-md-4\">\n <s-stats-card\n [animateNumbers]=\"true\"\n color=\"#0C9348\"\n [lightMode]=\"true\"\n [lightVersion]=\"true\"\n iconClass=\"far fa-dollar-sign\"\n [label]=\"'erpx.rateio_editor.valor_base' | translate\"\n [value]=\"valorBase | numeric:numberFormatOptions | async\"\n ></s-stats-card>\n </div>\n <div class=\"ui-sm-12 ui-md-4\">\n <s-stats-card\n [animateNumbers]=\"true\"\n color=\"#428BCA\"\n [lightMode]=\"true\"\n [lightVersion]=\"true\"\n iconClass=\"far fa-percent\"\n [label]=\"'erpx.rateio_editor.percentual_restante' | translate\"\n [value]=\"percentualRestanteDisplay + '%'\"\n ></s-stats-card>\n </div>\n <div class=\"ui-sm-12 ui-md-4\">\n <s-stats-card\n [animateNumbers]=\"true\"\n [color]=\"distribuicaoCompleta ? '#0C9348' : '#C13018'\"\n [lightMode]=\"true\"\n [lightVersion]=\"true\"\n iconClass=\"far fa-dollar-sign\"\n [label]=\"'erpx.rateio_editor.valor_restante' | translate\"\n [value]=\"valorRestanteDisplay | numeric:numberFormatOptions | async\"\n ></s-stats-card>\n </div>\n </div>\n\n <!-- Se\u00E7\u00E3o 2: Tabela de rateios -->\n <div class=\"sds-section-title\" *ngIf=\"isReady\">\n {{ 'erpx.rateio_editor.lista_rateios' | translate }}\n </div>\n\n <s-empty-state\n *ngIf=\"isReady && contasDataSource?.length === 0\"\n iconClass=\"far fa-dollar-sign\"\n [title]=\"'erpx.rateio_editor.sem_rateios_titulo' | translate\"\n [description]=\"'erpx.rateio_editor.sem_rateios_descricao' | translate\"\n [showPrimaryAction]=\"!effectiveReadOnly\"\n [primaryActionLabel]=\"'erpx.rateio_editor.adicionar_conta' | translate\"\n (primaryAction)=\"openContaDialog()\"\n [showSecondaryAction]=\"!effectiveReadOnly && showSugestaoButton\"\n [secondaryActionLabel]=\"'erpx.rateio_editor.sugerir_rateio' | translate\"\n (secondaryAction)=\"onSugerir()\"\n ></s-empty-state>\n\n <div class=\"ui-g\" *ngIf=\"isReady && contasDataSource?.length > 0\">\n <div class=\"ui-g-12\" *ngIf=\"!effectiveReadOnly\">\n <s-button\n [label]=\"'erpx.rateio_editor.adicionar_conta' | translate\"\n iconClass=\"fa fa-plus\"\n (onClick)=\"openContaDialog()\"\n ></s-button>\n <s-button\n *ngIf=\"showSugestaoButton\"\n [label]=\"'erpx.rateio_editor.sugerir_rateio' | translate\"\n [priority]=\"ButtonPriority.Secondary\"\n iconClass=\"fa fa-magic\"\n (onClick)=\"onSugerir()\"\n ></s-button>\n <s-button\n [label]=\"'erpx.rateio_editor.remover_conta' | translate\"\n [priority]=\"ButtonPriority.Secondary\"\n (onClick)=\"onDeleteSelected()\"\n [disabled]=\"!selection.length\"\n ></s-button>\n </div>\n\n <div class=\"ui-g-12\">\n <p-table\n #tableRateio\n [value]=\"contasDataSource\"\n [columns]=\"gridColumns\"\n dataKey=\"idContaFinanceira\"\n [resizableColumns]=\"true\"\n [totalRecords]=\"contasDataSource.length\"\n [(selection)]=\"selection\"\n [paginator]=\"false\"\n [rows]=\"10\"\n >\n <ng-template pTemplate=\"header\" let-columns>\n <tr>\n <th scope=\"col\" style=\"width: 3em\"></th>\n <th scope=\"col\" class=\"col-checkbox\" style=\"width: 50px\">\n <p-tableHeaderCheckbox *ngIf=\"!effectiveReadOnly\"></p-tableHeaderCheckbox>\n </th>\n <th *ngFor=\"let col of columns\" scope=\"col\" pResizableColumn>\n <div class=\"senior-header\">\n <span class=\"senior-header-title\">{{ col.header }}</span>\n </div>\n </th>\n <th scope=\"col\" *ngIf=\"!effectiveReadOnly\">\n <div class=\"senior-header\">\n <span class=\"senior-header-title\">{{ 'erpx.rateio_editor.acoes' | translate }}</span>\n </div>\n </th>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"body\" let-rowData let-rowIndex=\"rowIndex\" let-expanded=\"expanded\">\n <tr>\n <td style=\"width: 3em; text-align: center\">\n <a *ngIf=\"rowData.rateiosCCusto?.length || (!effectiveReadOnly && requiresCentroCusto)\" [pRowToggler]=\"rowData\" role=\"button\" tabindex=\"0\">\n <i [class]=\"expanded ? 'fa fa-minus' : 'fa fa-plus'\"></i>\n </a>\n </td>\n <td class=\"col-checkbox\" style=\"width: 50px\">\n <p-tableCheckbox *ngIf=\"!effectiveReadOnly\" [value]=\"rowData\"></p-tableCheckbox>\n </td>\n <td>{{ rowData.contaFinanceira || rowData.idContaFinanceira }}</td>\n <td style=\"text-align: right\">{{ rowData.percentual }}</td>\n <td style=\"text-align: right\">{{ rowData.valorRateadoConta | numeric:numberFormatOptions | async }}</td>\n <td *ngIf=\"!effectiveReadOnly\">\n <s-button\n [auxiliary]=\"true\"\n [priority]=\"ButtonPriority.Default\"\n [size]=\"ButtonSize.Small\"\n iconClass=\"fa fa-pencil\"\n [label]=\"'erpx.rateio_editor.editar' | translate\"\n (onClick)=\"openContaDialog(getContaIndex(rowData))\"\n ></s-button>\n </td>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"rowexpansion\" let-rowData let-rowIndex=\"rowIndex\">\n <tr>\n <td [attr.colspan]=\"effectiveReadOnly ? gridColumns.length + 2 : gridColumns.length + 3\">\n <div class=\"ui-g\" style=\"padding: 8px 16px\">\n <div class=\"ui-g-12 rateio-cc-toolbar\" *ngIf=\"!effectiveReadOnly\">\n <s-button\n [label]=\"'erpx.rateio_editor.adicionar_centro_custo' | translate\"\n iconClass=\"fa fa-plus\"\n (onClick)=\"openCCDialog(getContaIndex(rowData))\"\n ></s-button>\n <s-button\n [label]=\"'erpx.rateio_editor.remover_centro_custo' | translate\"\n [priority]=\"ButtonPriority.Secondary\"\n (onClick)=\"onDeleteSelectedCC(rowData)\"\n [disabled]=\"!(ccSelection[rowData.idContaFinanceira]?.length)\"\n ></s-button>\n </div>\n <div class=\"ui-g-12\">\n <p-table\n [value]=\"rowData.rateiosCCusto\"\n dataKey=\"idCentroCusto\"\n [(selection)]=\"ccSelection[rowData.idContaFinanceira]\"\n [responsive]=\"true\"\n >\n <ng-template pTemplate=\"header\">\n <tr>\n <th scope=\"col\" class=\"col-checkbox\" style=\"width: 50px\">\n <p-tableHeaderCheckbox *ngIf=\"!effectiveReadOnly\"></p-tableHeaderCheckbox>\n </th>\n <th scope=\"col\">{{ 'erpx.rateio_editor.centro_custo' | translate }}</th>\n <th scope=\"col\">{{ 'erpx.rateio_editor.percentual' | translate }}</th>\n <th scope=\"col\">{{ 'erpx.rateio_editor.valor' | translate }}</th>\n <th scope=\"col\" *ngIf=\"!effectiveReadOnly\">{{ 'erpx.rateio_editor.acoes' | translate }}</th>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"body\" let-cc let-ccIndex=\"rowIndex\">\n <tr>\n <td class=\"col-checkbox\" style=\"width: 50px\">\n <p-tableCheckbox *ngIf=\"!effectiveReadOnly\" [value]=\"cc\"></p-tableCheckbox>\n </td>\n <td>{{ cc.descCCusto || cc.idCentroCusto }}</td>\n <td style=\"text-align: right\">{{ cc.percentual }}</td>\n <td style=\"text-align: right\">{{ cc.valor | numeric:numberFormatOptions | async }}</td>\n <td *ngIf=\"!effectiveReadOnly\">\n <s-button\n [auxiliary]=\"true\"\n [priority]=\"ButtonPriority.Default\"\n [size]=\"ButtonSize.Small\"\n iconClass=\"fa fa-pencil\"\n [label]=\"'erpx.rateio_editor.editar' | translate\"\n (onClick)=\"openCCDialog(getContaIndex(rowData), getCCIndex(rowData, cc))\"\n ></s-button>\n </td>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"emptymessage\">\n <tr>\n <td [attr.colspan]=\"effectiveReadOnly ? 3 : 5\">\n {{ 'erpx.rateio_editor.sem_centros_custo' | translate }}\n </td>\n </tr>\n </ng-template>\n </p-table>\n </div>\n </div>\n </td>\n </tr>\n </ng-template>\n </p-table>\n </div>\n </div>\n\n <!-- Bot\u00F5es de a\u00E7\u00E3o -->\n <div *ngIf=\"isReady\" class=\"ui-g rateio-editor-actions\">\n <div class=\"ui-g-12\">\n <s-button\n *ngIf=\"!effectiveReadOnly && !isStandalone\"\n priority=\"primary\"\n iconClass=\"fa fa-check\"\n [label]=\"'erpx.rateio_editor.salvar' | translate\"\n (onClick)=\"onSalvar()\"\n ></s-button>\n </div>\n </div>\n</s-loading-state>\n\n<!-- Modal: Adicionar/Editar Conta Financeira -->\n<p-dialog\n [header]=\"'erpx.rateio_editor.adicionar_conta' | translate\"\n appendTo=\"body\"\n [modal]=\"true\"\n [(visible)]=\"displayContaDialog\"\n (onHide)=\"onHideContaDialog()\"\n [blockScroll]=\"true\"\n [focusOnShow]=\"false\"\n styleClass=\"custom-dialog\"\n [draggable]=\"false\"\n [resizable]=\"false\"\n [style]=\"{width: '40%'}\"\n>\n <form *ngIf=\"contaDialogFormGroup\" [formGroup]=\"contaDialogFormGroup\" (ngSubmit)=\"onSaveContaDialog()\">\n <div class=\"ui-fluid\">\n <s-dynamic-form\n [fields]=\"contaDialogFields\"\n [form]=\"contaDialogFormGroup\"\n [errorMessages]=\"{\n required: ('erpx.rateio_editor.erro_obrigatorio' | translate),\n duplicate: ('erpx.rateio_editor.conta_duplicada' | translate),\n contaSintetica: ('erpx.rateio_editor.erro_conta_sintetica' | translate),\n max: ('erpx.rateio_editor.erro_valor_maximo_conta' | translate)\n }\"\n ></s-dynamic-form>\n </div>\n </form>\n <p-footer>\n <s-button\n id=\"dialog-conta-save\"\n type=\"button\"\n priority=\"primary\"\n [label]=\"'erpx.rateio_editor.salvar' | translate\"\n (onClick)=\"onSaveContaDialog()\"\n ></s-button>\n <s-button\n id=\"dialog-conta-cancel\"\n type=\"button\"\n priority=\"secondary\"\n [label]=\"'erpx.rateio_editor.cancelar' | translate\"\n (onClick)=\"onHideContaDialog()\"\n ></s-button>\n </p-footer>\n</p-dialog>\n\n<!-- Modal: Adicionar/Editar Centro de Custo -->\n<p-dialog\n [header]=\"'erpx.rateio_editor.adicionar_centro_custo' | translate\"\n appendTo=\"body\"\n [modal]=\"true\"\n [(visible)]=\"displayCCDialog\"\n (onHide)=\"onHideCCDialog()\"\n [blockScroll]=\"true\"\n [focusOnShow]=\"false\"\n styleClass=\"custom-dialog\"\n [draggable]=\"false\"\n [resizable]=\"false\"\n [style]=\"{width: '40%'}\"\n>\n <form *ngIf=\"ccDialogFormGroup\" [formGroup]=\"ccDialogFormGroup\" (ngSubmit)=\"onSaveCCDialog()\">\n <div class=\"ui-fluid\">\n <s-dynamic-form\n [fields]=\"ccDialogFields\"\n [form]=\"ccDialogFormGroup\"\n [errorMessages]=\"{\n required: ('erpx.rateio_editor.erro_obrigatorio' | translate),\n duplicate: ('erpx.rateio_editor.centro_custo_duplicado' | translate),\n centroCustoInvalido: ('erpx.rateio_editor.erro_centro_custo_invalido' | translate),\n max: ('erpx.rateio_editor.erro_maximo_centro_custo' | translate)\n }\"\n ></s-dynamic-form>\n </div>\n </form>\n <p-footer>\n <s-button\n id=\"dialog-cc-save\"\n type=\"button\"\n priority=\"primary\"\n [label]=\"'erpx.rateio_editor.salvar' | translate\"\n (onClick)=\"onSaveCCDialog()\"\n ></s-button>\n <s-button\n id=\"dialog-cc-cancel\"\n type=\"button\"\n priority=\"secondary\"\n [label]=\"'erpx.rateio_editor.cancelar' | translate\"\n (onClick)=\"onHideCCDialog()\"\n ></s-button>\n </p-footer>\n</p-dialog>\n",
|
|
34208
|
+
styles: [":host ::ng-deep .rateio-cc-toolbar .s-button-text{overflow:visible;-ms-flex-pack:start;justify-content:flex-start}"]
|
|
33993
34209
|
})
|
|
33994
34210
|
], ErpRateioEditorComponent);
|
|
33995
34211
|
return ErpRateioEditorComponent;
|