Skip to content

Commit

Permalink
adicionando licença compensatória
Browse files Browse the repository at this point in the history
  • Loading branch information
joellensilva committed Mar 6, 2024
1 parent 01101e0 commit cc6cc0e
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 @@ -32,5 +32,6 @@ type ItemSummary struct {
BonusLicense float64 `json:"licenca_premio,omitempty"`
VacationCompensation float64 `json:"indenizacao_de_ferias,omitempty"`
ChristmasBonus float64 `json:"gratificacao_natalina,omitempty"`
CompensatoryLicense float64 `json:"licenca_compensatoria,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 @@ -31,6 +31,7 @@ func NewAnnualSummaryDTO(ami models.AnnualSummary) *AnnualSummaryDTO {
BonusLicense: ami.ItemSummary.BonusLicense,
VacationCompensation: ami.ItemSummary.VacationCompensation,
ChristmasBonus: ami.ItemSummary.ChristmasBonus,
CompensatoryLicense: ami.ItemSummary.CompensatoryLicense,
Others: ami.ItemSummary.Others,
},
}
Expand All @@ -51,6 +52,7 @@ func (ami *AnnualSummaryDTO) ConvertToModel() *models.AnnualSummary {
BonusLicense: ami.ItemSummary.BonusLicense,
VacationCompensation: ami.ItemSummary.VacationCompensation,
ChristmasBonus: ami.ItemSummary.ChristmasBonus,
CompensatoryLicense: ami.ItemSummary.CompensatoryLicense,
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 @@ -19,6 +19,7 @@ type ItemSummary struct {
BonusLicense float64 `gorm:"column:licenca_premio"`
VacationCompensation float64 `gorm:"column:indenizacao_de_ferias"`
ChristmasBonus float64 `gorm:"column:gratificacao_natalina"`
CompensatoryLicense float64 `gorm:"column:licenca_compensatoria"`
Others float64 `gorm:"column:outras"`
}

Expand All @@ -35,6 +36,7 @@ func NewGeneralMonthlyInfoDTO(gmi models.GeneralMonthlyInfo) *GeneralMonthlyInfo
BonusLicense: gmi.ItemSummary.BonusLicense,
VacationCompensation: gmi.ItemSummary.VacationCompensation,
ChristmasBonus: gmi.ItemSummary.ChristmasBonus,
CompensatoryLicense: gmi.ItemSummary.CompensatoryLicense,
Others: gmi.ItemSummary.Others,
},
}
Expand All @@ -53,6 +55,7 @@ func (gmi *GeneralMonthlyInfoDTO) ConvertToModel() *models.GeneralMonthlyInfo {
BonusLicense: gmi.ItemSummary.BonusLicense,
VacationCompensation: gmi.ItemSummary.VacationCompensation,
ChristmasBonus: gmi.ItemSummary.ChristmasBonus,
CompensatoryLicense: gmi.ItemSummary.CompensatoryLicense,
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 @@ -319,6 +319,7 @@ func (p *PostgresDB) GetAnnualSummary(agency string) ([]models.AnnualSummary, er
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' ->> 'licenca_compensatoria' AS DECIMAL)) AS licenca_compensatoria,
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 @@ -369,6 +370,7 @@ func (p *PostgresDB) GetGeneralMonthlyInfosFromYear(year int) ([]models.GeneralM
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' ->> 'licenca_compensatoria' AS DECIMAL)) AS licenca_compensatoria,
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 @@ -995,6 +995,7 @@ func (g getAnnualSummary) testWhenMonthlyInfoExists(t *testing.T) {
FoodAllowance: 150,
BonusLicense: 200,
ChristmasBonus: 175,
CompensatoryLicense: 75,
VacationCompensation: 50,
},
},
Expand Down Expand Up @@ -1051,6 +1052,7 @@ func (g getAnnualSummary) testWhenMonthlyInfoExists(t *testing.T) {
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,
CompensatoryLicense: agmi.Summary.ItemSummary.CompensatoryLicense + agmi2.Summary.ItemSummary.CompensatoryLicense,
},
})
}
Expand All @@ -1076,6 +1078,7 @@ func (g getAnnualSummary) testWhenMonthlyInfoExists(t *testing.T) {
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)
assert.Equal(t, amis[1].ItemSummary.CompensatoryLicense, returnedAmis[1].ItemSummary.CompensatoryLicense)
truncateTables()
}

Expand Down Expand Up @@ -1235,6 +1238,7 @@ func (g getGeneralMonthlyInfoFromYear) testWhenDataExists(t *testing.T) {
FoodAllowance: 100,
VacationCompensation: 50,
ChristmasBonus: 75,
CompensatoryLicense: 175,
},
},
},
Expand Down Expand Up @@ -1271,6 +1275,7 @@ func (g getGeneralMonthlyInfoFromYear) testWhenDataExists(t *testing.T) {
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,
CompensatoryLicense: agmi.Summary.ItemSummary.CompensatoryLicense + agmi2.Summary.ItemSummary.CompensatoryLicense,
},
})
}
Expand Down Expand Up @@ -1425,6 +1430,7 @@ func (s store) testWhenDataIsOK(t *testing.T) {
BonusLicense: 150,
VacationCompensation: 125,
ChristmasBonus: 175,
CompensatoryLicense: 120,
Others: 200,
},
},
Expand Down Expand Up @@ -1492,6 +1498,7 @@ func (s store) testWhenDataIsOK(t *testing.T) {
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)
assert.Equal(t, agmi.Summary.ItemSummary.CompensatoryLicense, result.Summary.ItemSummary.CompensatoryLicense)
truncateTables()
}

Expand Down

0 comments on commit cc6cc0e

Please sign in to comment.