From 9c5361e6c2b6a139dcbc48052ff601346e572013 Mon Sep 17 00:00:00 2001 From: Joellensilva Date: Wed, 7 Feb 2024 16:11:55 -0300 Subject: [PATCH] =?UTF-8?q?corrigindo=20diferen=C3=A7a=20entre=20tabelas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/main.go b/main.go index 2a07705..fc6c24b 100644 --- a/main.go +++ b/main.go @@ -142,7 +142,7 @@ func main() { Workplace: p.LocalTrabalho, Salary: salary, Benefits: benefits, - Discounts: math.Abs(discounts), + Discounts: discounts, Remuneration: remuneration, Situation: ativoInativo(p.Ativo, er.Rc.Coleta.Orgao), }) @@ -262,7 +262,6 @@ func summary(employees []*coleta.ContraCheque, itemValues map[string]float64) *m // updateSummary auxiliary function that updates the summary data at each employee value func updateSummary(s *models.Summary, emp coleta.ContraCheque) { updateData := func(d *models.DataSummary, value float64, count int) { - value = math.Abs(value) if count == 1 { d.Min = value d.Max = value @@ -305,14 +304,14 @@ func calcBaseSalary(emp coleta.ContraCheque) (float64, float64, float64, float64 var discounts float64 for _, v := range emp.Remuneracoes.Remuneracao { if v.TipoReceita == coleta.Remuneracao_B && v.Natureza == coleta.Remuneracao_R { - salaryBase += v.Valor + salaryBase += math.Abs(v.Valor) } else if v.TipoReceita == coleta.Remuneracao_O && v.Natureza == coleta.Remuneracao_R { - benefits += v.Valor + benefits += math.Abs(v.Valor) } else if v.Natureza == coleta.Remuneracao_D { - discounts += v.Valor + discounts += math.Abs(v.Valor) } } - remuneration := salaryBase + benefits - math.Abs(discounts) + remuneration := salaryBase + benefits - discounts return salaryBase, benefits, discounts, remuneration }