Skip to content

Commit

Permalink
Updating breaking change in ImportExcel total rows.
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjantzen committed Dec 13, 2022
1 parent 455d283 commit 656f8ca
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
4 changes: 2 additions & 2 deletions User Audit.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3562,7 +3562,7 @@ if ($ExportChoice -eq 'Yes') {
Set-ExcelRange -Range "A3:C3" -Value "Totals" @xlParams

# totals table
Add-ExcelTable -PassThru -Range $ws.Cells["A4:C$($totalsTblLastRow)"] -TableName Totals -TableStyle "Light21" -ShowFilter:$false -ShowTotal -ShowFirstColumn -TotalSettings @{"Billed" = "Sum"; "Unbilled" = "Sum"} | Out-Null
Add-ExcelTable -PassThru -Range $ws.Cells["A4:C$($totalsTblLastRow)"] -TableName Totals -TableStyle "Light21" -ShowFilter:$false -ShowTotal -ShowFirstColumn -TableTotalSettings @{"Billed" = "Sum"; "Unbilled" = "Sum"} | Out-Null
$totalsTblLastRow += 1
$xlParams = @{WorkSheet=$ws; BackgroundColor=[System.Drawing.ColorTranslator]::FromHtml("#A9D08E")}
Set-ExcelRange -Range "B$($totalsTblLastRow):C$($totalsTblLastRow)" @xlParams
Expand Down Expand Up @@ -3598,7 +3598,7 @@ if ($ExportChoice -eq 'Yes') {

$totalsTblLastRow = $totalsByLocFirstRow + ($TotalsByLoc | Measure-Object).Count
$excel = $TotalsByLoc | Export-Excel -PassThru -ExcelPackage $excel -WorksheetName $ws -AutoSize -StartRow $totalsByLocFirstRow
Add-ExcelTable -PassThru -Range $ws.Cells["A$($totalsByLocFirstRow):C$($totalsTblLastRow)"] -TableName TotalsByLoc -TableStyle "Light21" -ShowFilter:$false -ShowTotal -ShowFirstColumn -TotalSettings @{"Billed" = "Sum"; "Unbilled" = "Sum"} | Out-Null
Add-ExcelTable -PassThru -Range $ws.Cells["A$($totalsByLocFirstRow):C$($totalsTblLastRow)"] -TableName TotalsByLoc -TableStyle "Light21" -ShowFilter:$false -ShowTotal -ShowFirstColumn -TableTotalSettings @{"Billed" = "Sum"; "Unbilled" = "Sum"} | Out-Null
$totalsTblLastRow += 1
$xlParams = @{WorkSheet=$ws; BackgroundColor=[System.Drawing.ColorTranslator]::FromHtml("#A9D08E")}
Set-ExcelRange -Range "B$($totalsTblLastRow):C$($totalsTblLastRow)" @xlParams
Expand Down
12 changes: 10 additions & 2 deletions User_Billing_Update.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1541,6 +1541,14 @@ if ($UserAudit) {
if ($BillingUpdate) {
Write-PSFMessage -Level Verbose -Message "Starting Billing Update."
If (Get-Module -ListAvailable -Name "ImportExcel") {Import-module ImportExcel} Else { install-module ImportExcel -Force; import-module ImportExcel}

$Version = (Get-Module -ListAvailable -Name "ImportExcel").Version
if ($Version.Major -lt 7 -or $Version.Minor -lt 8 -or $Version.Build -lt 4) {
Remove-Module ImportExcel
Uninstall-Module ImportExcel
Install-Module -Name ImportExcel
Import-Module ImportExcel -Force
}

# Get a fresh list of contacts from IT Glue
$FullContactList = (Get-ITGlueContacts -page_size 1000 -organization_id $OrgID).data
Expand Down Expand Up @@ -1826,7 +1834,7 @@ if ($BillingUpdate) {
Set-ExcelRange -Range "A3:C3" -Value "Totals" @xlParams

# totals table
Add-ExcelTable -PassThru -Range $ws.Cells["A4:C$($totalsTblLastRow)"] -TableName Totals -TableStyle "Light21" -ShowFilter:$false -ShowTotal -ShowFirstColumn -TotalSettings @{"Billed" = "Sum"; "Unbilled" = "Sum"} | Out-Null
Add-ExcelTable -PassThru -Range $ws.Cells["A4:C$($totalsTblLastRow)"] -TableName Totals -TableStyle "Light21" -ShowFilter:$false -ShowTotal -ShowFirstColumn -TableTotalSettings @{"Billed" = "Sum"; "Unbilled" = "Sum"} | Out-Null
$totalsTblLastRow += 1
$xlParams = @{WorkSheet=$ws; BackgroundColor=[System.Drawing.ColorTranslator]::FromHtml("#A9D08E")}
Set-ExcelRange -Range "B$($totalsTblLastRow):C$($totalsTblLastRow)" @xlParams
Expand Down Expand Up @@ -1862,7 +1870,7 @@ if ($BillingUpdate) {

$totalsTblLastRow = $totalsByLocFirstRow + ($TotalsByLoc | Measure-Object).Count
$excel = $TotalsByLoc | Export-Excel -PassThru -ExcelPackage $excel -WorksheetName $ws -AutoSize -StartRow $totalsByLocFirstRow
Add-ExcelTable -PassThru -Range $ws.Cells["A$($totalsByLocFirstRow):C$($totalsTblLastRow)"] -TableName TotalsByLoc -TableStyle "Light21" -ShowFilter:$false -ShowTotal -ShowFirstColumn -TotalSettings @{"Billed" = "Sum"; "Unbilled" = "Sum"} | Out-Null
Add-ExcelTable -PassThru -Range $ws.Cells["A$($totalsByLocFirstRow):C$($totalsTblLastRow)"] -TableName TotalsByLoc -TableStyle "Light21" -ShowFilter:$false -ShowTotal -ShowFirstColumn -TableTotalSettings @{"Billed" = "Sum"; "Unbilled" = "Sum"} | Out-Null
$totalsTblLastRow += 1
$xlParams = @{WorkSheet=$ws; BackgroundColor=[System.Drawing.ColorTranslator]::FromHtml("#A9D08E")}
Set-ExcelRange -Range "B$($totalsTblLastRow):C$($totalsTblLastRow)" @xlParams
Expand Down
2 changes: 1 addition & 1 deletion currentversion.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.13.0
2.14.0

0 comments on commit 656f8ca

Please sign in to comment.