Public/PayCodes/Update-AspirePayCode.ps1
|
<#
.SYNOPSIS Updates an existing pay code in the Aspire API. .DESCRIPTION Uses Invoke-AspireRequest to perform a PUT request to the /PayCodes endpoint. .PARAMETER PayCodeID The ID of the pay code to update (required). .PARAMETER PayCodeName The name of the pay code (required, max 60 characters). .PARAMETER PremiumDollars Optional premium dollars amount. .PARAMETER PremiumPercent Optional premium percentage. .PARAMETER FixedRate Optional fixed rate. .PARAMETER ExcludeFromOT Optional boolean indicating if excluded from overtime. .PARAMETER PayCode Optional pay code string (max 10 characters). .PARAMETER OTPaycode Optional boolean indicating if it's an OT pay code. .PARAMETER Active Optional boolean indicating if active. .PARAMETER PayCodeType Optional pay code type. .OUTPUTS The response from the API containing the updated pay code details. .EXAMPLE Update-AspirePayCode -PayCodeID 1 -PayCodeName "Updated Pay Code" -Active $false #> function Update-AspirePayCode { [CmdletBinding()] param( [Parameter(Mandatory = $true)] [int]$PayCodeID, [Parameter(Mandatory = $true)] [string]$PayCodeName, [decimal]$PremiumDollars = $null, [decimal]$PremiumPercent = $null, [decimal]$FixedRate = $null, [bool]$ExcludeFromOT = $null, [string]$PayCode = $null, [bool]$OTPaycode = $null, [bool]$Active = $null, [string]$PayCodeType = $null ) $body = @{ PayCodeID = $PayCodeID PayCodeName = $PayCodeName } if ($PremiumDollars) { $body.PremiumDollars = $PremiumDollars } if ($PremiumPercent) { $body.PremiumPercent = $PremiumPercent } if ($FixedRate) { $body.FixedRate = $FixedRate } if ($ExcludeFromOT -ne $null) { $body.ExcludeFromOT = $ExcludeFromOT } if ($PayCode) { $body.PayCode = $PayCode } if ($OTPaycode -ne $null) { $body.OTPaycode = $OTPaycode } if ($Active -ne $null) { $body.Active = $Active } if ($PayCodeType) { $body.PayCodeType = $PayCodeType } return Invoke-AspireRequest -Method PUT -Path "/PayCodes" -Body $body -ApiVersion $null } |