Skip to content

Commit

Permalink
adicionando gratificação natalina
Browse files Browse the repository at this point in the history
  • Loading branch information
joellensilva committed Feb 15, 2024
1 parent b9805fd commit d97e202
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions models/summary.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@ type ItemSummary struct {
FoodAllowance float64 `json:"auxilio_alimentacao,omitempty"`
BonusLicense float64 `json:"licenca_premio,omitempty"`
VacationCompensation float64 `json:"indenizacao_de_ferias,omitempty"`
ChristmasBonus float64 `json:"gratificacao_natalina,omitempty"`
Others float64 `json:"outras,omitempty"` // valor agregado de outras rubricas não identificadas
}
2 changes: 2 additions & 0 deletions repo/database/dto/annuaISummary.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ func NewAnnualSummaryDTO(ami models.AnnualSummary) *AnnualSummaryDTO {
FoodAllowance: ami.ItemSummary.FoodAllowance,
BonusLicense: ami.ItemSummary.BonusLicense,
VacationCompensation: ami.ItemSummary.VacationCompensation,
ChristmasBonus: ami.ItemSummary.ChristmasBonus,
Others: ami.ItemSummary.Others,
},
}
Expand All @@ -49,6 +50,7 @@ func (ami *AnnualSummaryDTO) ConvertToModel() *models.AnnualSummary {
FoodAllowance: ami.ItemSummary.FoodAllowance,
BonusLicense: ami.ItemSummary.BonusLicense,
VacationCompensation: ami.ItemSummary.VacationCompensation,
ChristmasBonus: ami.ItemSummary.ChristmasBonus,
Others: ami.ItemSummary.Others,
},
}
Expand Down
3 changes: 3 additions & 0 deletions repo/database/dto/generalMonthlyInfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type ItemSummary struct {
FoodAllowance float64 `gorm:"column:auxilio_alimentacao"`
BonusLicense float64 `gorm:"column:licenca_premio"`
VacationCompensation float64 `gorm:"column:indenizacao_de_ferias"`
ChristmasBonus float64 `gorm:"column:gratificacao_natalina"`
Others float64 `gorm:"column:outras"`
}

Expand All @@ -33,6 +34,7 @@ func NewGeneralMonthlyInfoDTO(gmi models.GeneralMonthlyInfo) *GeneralMonthlyInfo
FoodAllowance: gmi.ItemSummary.FoodAllowance,
BonusLicense: gmi.ItemSummary.BonusLicense,
VacationCompensation: gmi.ItemSummary.VacationCompensation,
ChristmasBonus: gmi.ItemSummary.ChristmasBonus,
Others: gmi.ItemSummary.Others,
},
}
Expand All @@ -50,6 +52,7 @@ func (gmi *GeneralMonthlyInfoDTO) ConvertToModel() *models.GeneralMonthlyInfo {
FoodAllowance: gmi.ItemSummary.FoodAllowance,
BonusLicense: gmi.ItemSummary.BonusLicense,
VacationCompensation: gmi.ItemSummary.VacationCompensation,
ChristmasBonus: gmi.ItemSummary.ChristmasBonus,
Others: gmi.ItemSummary.Others,
},
}
Expand Down
2 changes: 2 additions & 0 deletions repo/database/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ func (p *PostgresDB) GetAnnualSummary(agency string) ([]models.AnnualSummary, er
SUM(CAST(sumario -> 'resumo_rubricas' ->> 'auxilio_alimentacao' AS DECIMAL)) AS auxilio_alimentacao,
SUM(CAST(sumario -> 'resumo_rubricas' ->> 'licenca_premio' AS DECIMAL)) AS licenca_premio,
SUM(CAST(sumario -> 'resumo_rubricas' ->> 'indenizacao_de_ferias' AS DECIMAL)) AS indenizacao_de_ferias,
SUM(CAST(sumario -> 'resumo_rubricas' ->> 'gratificacao_natalina' AS DECIMAL)) AS gratificacao_natalina,
SUM(CAST(sumario -> 'resumo_rubricas' ->> 'outras' AS DECIMAL)) AS outras,
COUNT(*) AS meses_com_dados`
m := p.db.Model(&dtoAgmi).Select(query)
Expand Down Expand Up @@ -367,6 +368,7 @@ func (p *PostgresDB) GetGeneralMonthlyInfosFromYear(year int) ([]models.GeneralM
SUM(CAST(sumario -> 'resumo_rubricas' ->> 'auxilio_alimentacao' AS DECIMAL)) AS auxilio_alimentacao,
SUM(CAST(sumario -> 'resumo_rubricas' ->> 'licenca_premio' AS DECIMAL)) AS licenca_premio,
SUM(CAST(sumario -> 'resumo_rubricas' ->> 'indenizacao_de_ferias' AS DECIMAL)) AS indenizacao_de_ferias,
SUM(CAST(sumario -> 'resumo_rubricas' ->> 'gratificacao_natalina' AS DECIMAL)) AS gratificacao_natalina,
SUM(CAST(sumario -> 'resumo_rubricas' ->> 'outras' AS DECIMAL)) AS outras`
m := p.db.Model(&dtoAgmi).Select(query)
m = m.Where("ano = ? AND atual=true AND (procinfo IS NULL OR procinfo::text = 'null')", year)
Expand Down
7 changes: 7 additions & 0 deletions repo/database/postgres_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -994,6 +994,7 @@ func (g getAnnualSummary) testWhenMonthlyInfoExists(t *testing.T) {
Others: 100,
FoodAllowance: 150,
BonusLicense: 200,
ChristmasBonus: 175,
VacationCompensation: 50,
},
},
Expand Down Expand Up @@ -1049,6 +1050,7 @@ func (g getAnnualSummary) testWhenMonthlyInfoExists(t *testing.T) {
BonusLicense: agmi.Summary.ItemSummary.BonusLicense + agmi2.Summary.ItemSummary.BonusLicense,
FoodAllowance: agmi.Summary.ItemSummary.FoodAllowance + agmi2.Summary.ItemSummary.FoodAllowance,
VacationCompensation: agmi.Summary.ItemSummary.VacationCompensation + agmi2.Summary.ItemSummary.VacationCompensation,
ChristmasBonus: agmi.Summary.ItemSummary.ChristmasBonus + agmi2.Summary.ItemSummary.ChristmasBonus,
},
})
}
Expand All @@ -1073,6 +1075,7 @@ func (g getAnnualSummary) testWhenMonthlyInfoExists(t *testing.T) {
assert.Equal(t, amis[1].ItemSummary.BonusLicense, returnedAmis[1].ItemSummary.BonusLicense)
assert.Equal(t, amis[1].ItemSummary.FoodAllowance, returnedAmis[1].ItemSummary.FoodAllowance)
assert.Equal(t, amis[1].ItemSummary.VacationCompensation, returnedAmis[1].ItemSummary.VacationCompensation)
assert.Equal(t, amis[1].ItemSummary.ChristmasBonus, returnedAmis[1].ItemSummary.ChristmasBonus)
truncateTables()
}

Expand Down Expand Up @@ -1231,6 +1234,7 @@ func (g getGeneralMonthlyInfoFromYear) testWhenDataExists(t *testing.T) {
BonusLicense: 400,
FoodAllowance: 100,
VacationCompensation: 50,
ChristmasBonus: 75,
},
},
},
Expand Down Expand Up @@ -1266,6 +1270,7 @@ func (g getGeneralMonthlyInfoFromYear) testWhenDataExists(t *testing.T) {
FoodAllowance: agmi.Summary.ItemSummary.FoodAllowance + agmi2.Summary.ItemSummary.FoodAllowance,
BonusLicense: agmi.Summary.ItemSummary.BonusLicense + agmi2.Summary.ItemSummary.BonusLicense,
VacationCompensation: agmi.Summary.ItemSummary.VacationCompensation + agmi2.Summary.ItemSummary.VacationCompensation,
ChristmasBonus: agmi.Summary.ItemSummary.ChristmasBonus + agmi2.Summary.ItemSummary.ChristmasBonus,
},
})
}
Expand Down Expand Up @@ -1419,6 +1424,7 @@ func (s store) testWhenDataIsOK(t *testing.T) {
FoodAllowance: 100,
BonusLicense: 150,
VacationCompensation: 125,
ChristmasBonus: 175,
Others: 200,
},
},
Expand Down Expand Up @@ -1485,6 +1491,7 @@ func (s store) testWhenDataIsOK(t *testing.T) {
assert.Equal(t, agmi.Summary.ItemSummary.FoodAllowance, result.Summary.ItemSummary.FoodAllowance)
assert.Equal(t, agmi.Summary.ItemSummary.BonusLicense, result.Summary.ItemSummary.BonusLicense)
assert.Equal(t, agmi.Summary.ItemSummary.VacationCompensation, result.Summary.ItemSummary.VacationCompensation)
assert.Equal(t, agmi.Summary.ItemSummary.ChristmasBonus, result.Summary.ItemSummary.ChristmasBonus)
truncateTables()
}

Expand Down

0 comments on commit d97e202

Please sign in to comment.