implement latest changes to employee payroll process
- Add ContractDaysWeek - Add Sickness Days to employee export sheet - Add Gesundheitsbonus value per employee - Additional fixes
This commit is contained in:
@@ -275,6 +275,7 @@ type DyflexisEmployee struct {
|
||||
ContractSalaryHour float64 `json:"contractSalaryHour"`
|
||||
ContractTypeName pgtype.Text `json:"contractTypeName"`
|
||||
InternalId pgtype.UUID `json:"internalId"`
|
||||
ContractDaysWeek int32 `json:"contractDaysWeek"`
|
||||
}
|
||||
|
||||
type Employee struct {
|
||||
@@ -564,6 +565,18 @@ type Tour struct {
|
||||
Schwerlast bool `json:"schwerlast"`
|
||||
}
|
||||
|
||||
type TourFile struct {
|
||||
ID pgtype.UUID `json:"id"`
|
||||
TourId string `json:"tourId"`
|
||||
TicketId string `json:"ticketId"`
|
||||
StoragePath string `json:"storagePath"`
|
||||
OriginalFilename string `json:"originalFilename"`
|
||||
MimeType string `json:"mimeType"`
|
||||
FileSizeBytes int32 `json:"fileSizeBytes"`
|
||||
DlUploadStatus string `json:"dlUploadStatus"`
|
||||
CreatedAt *time.Time `json:"createdAt"`
|
||||
}
|
||||
|
||||
type TourSource struct {
|
||||
InternalId pgtype.UUID `json:"internalId"`
|
||||
InsertedAt time.Time `json:"insertedAt"`
|
||||
|
||||
@@ -309,6 +309,39 @@ func (q *Queries) IsEmployeesDepartmentKTW(ctx context.Context, arg IsEmployeesD
|
||||
return meets_requirements, err
|
||||
}
|
||||
|
||||
const isEmployeesDepartmentNotLeitstelle = `-- name: IsEmployeesDepartmentNotLeitstelle :one
|
||||
SELECT COALESCE(
|
||||
(
|
||||
(
|
||||
bool_or(department LIKE '%KTW%')
|
||||
OR bool_or(department LIKE '%BTW%')
|
||||
OR bool_or(department LIKE '%TSW%')
|
||||
)
|
||||
AND
|
||||
bool_and(department <> 'Leitstelle')
|
||||
),
|
||||
false
|
||||
)::bool as meets_requirements
|
||||
FROM "PlannedTime"
|
||||
WHERE
|
||||
"userId"::int = $1::bigint
|
||||
AND "startDate" BETWEEN $2 AND $3
|
||||
AND department IS NOT NULL
|
||||
`
|
||||
|
||||
type IsEmployeesDepartmentNotLeitstelleParams struct {
|
||||
EmployeeID int64 `json:"employee_id"`
|
||||
StartDate *time.Time `json:"start_date"`
|
||||
EndDate *time.Time `json:"end_date"`
|
||||
}
|
||||
|
||||
func (q *Queries) IsEmployeesDepartmentNotLeitstelle(ctx context.Context, arg IsEmployeesDepartmentNotLeitstelleParams) (bool, error) {
|
||||
row := q.db.QueryRow(ctx, isEmployeesDepartmentNotLeitstelle, arg.EmployeeID, arg.StartDate, arg.EndDate)
|
||||
var meets_requirements bool
|
||||
err := row.Scan(&meets_requirements)
|
||||
return meets_requirements, err
|
||||
}
|
||||
|
||||
const listActiveEmployees = `-- name: ListActiveEmployees :many
|
||||
SELECT
|
||||
de.id,
|
||||
@@ -316,6 +349,7 @@ SELECT
|
||||
de.surname,
|
||||
de."contractStart",
|
||||
de."contractEnd",
|
||||
de."contractDaysWeek",
|
||||
de."contractHoursWeek",
|
||||
de."contractSalaryHour",
|
||||
de."contractTypeName",
|
||||
@@ -334,6 +368,7 @@ type ListActiveEmployeesRow struct {
|
||||
Surname string `json:"surname"`
|
||||
ContractStart time.Time `json:"contractStart"`
|
||||
ContractEnd *time.Time `json:"contractEnd"`
|
||||
ContractDaysWeek int32 `json:"contractDaysWeek"`
|
||||
ContractHoursWeek float64 `json:"contractHoursWeek"`
|
||||
ContractSalaryHour float64 `json:"contractSalaryHour"`
|
||||
ContractTypeName pgtype.Text `json:"contractTypeName"`
|
||||
@@ -356,6 +391,7 @@ func (q *Queries) ListActiveEmployees(ctx context.Context) ([]ListActiveEmployee
|
||||
&i.Surname,
|
||||
&i.ContractStart,
|
||||
&i.ContractEnd,
|
||||
&i.ContractDaysWeek,
|
||||
&i.ContractHoursWeek,
|
||||
&i.ContractSalaryHour,
|
||||
&i.ContractTypeName,
|
||||
@@ -371,3 +407,47 @@ func (q *Queries) ListActiveEmployees(ctx context.Context) ([]ListActiveEmployee
|
||||
}
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const listSickdaysForEmployee = `-- name: ListSickdaysForEmployee :many
|
||||
SELECT
|
||||
"start",
|
||||
"end",
|
||||
"days",
|
||||
locked
|
||||
FROM "Sickdays"
|
||||
WHERE
|
||||
"employeeId" = $1
|
||||
ORDER BY start asc
|
||||
`
|
||||
|
||||
type ListSickdaysForEmployeeRow struct {
|
||||
Start time.Time `json:"start"`
|
||||
End time.Time `json:"end"`
|
||||
Days int32 `json:"days"`
|
||||
Locked bool `json:"locked"`
|
||||
}
|
||||
|
||||
func (q *Queries) ListSickdaysForEmployee(ctx context.Context, employeeID int32) ([]ListSickdaysForEmployeeRow, error) {
|
||||
rows, err := q.db.Query(ctx, listSickdaysForEmployee, employeeID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
var items []ListSickdaysForEmployeeRow
|
||||
for rows.Next() {
|
||||
var i ListSickdaysForEmployeeRow
|
||||
if err := rows.Scan(
|
||||
&i.Start,
|
||||
&i.End,
|
||||
&i.Days,
|
||||
&i.Locked,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
items = append(items, i)
|
||||
}
|
||||
if err := rows.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return items, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user