Skip to content

Commit

Permalink
corrigindo diferença entre tabelas
Browse files Browse the repository at this point in the history
  • Loading branch information
joellensilva committed Feb 7, 2024
1 parent 52dd7f5 commit 9c5361e
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
})
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 9c5361e

Please sign in to comment.