diff --git a/reconciler/ManualReviewExport.dtsx b/reconciler/ManualReviewExport.dtsx index d47cef4..1bef9b4 100644 --- a/reconciler/ManualReviewExport.dtsx +++ b/reconciler/ManualReviewExport.dtsx @@ -11,8 +11,8 @@ DTS:LocaleID="1033" DTS:ObjectName="ManualReviewExport" DTS:PackageType="5" - DTS:VersionBuild="33" - DTS:VersionGUID="{98FD7D14-0AA2-476F-B1F7-2762A8541125}"> + DTS:VersionBuild="34" + DTS:VersionGUID="{09CBCBA0-EDAF-4ED0-B21D-D9F7486039D0}"> 8 @@ -38,7 +38,7 @@ + DTS:ConnectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\\retreathealthcare.org\network\Share\datahub\pharmacy\reconciliation\weekly\ManualReviewTemplate.xlsx;Extended Properties="EXCEL 12.0 XML;HDR=YES";" /> + DTS:ConnectionString="\\retreathealthcare.org\network\Share\datahub\pharmacy\reconciliation\weekly\ManualReviewTemplate.xlsx" /> @@ -79,12 +79,12 @@ DTS:CreationName="" DTS:DTSID="{B4CCCD0F-2125-47FC-BFE5-F420AF9BC857}" DTS:EvaluateAsExpression="True" - DTS:Expression=""-ExecutionPolicy Bypass -File \"S:\\datahub\\pharmacy\\reconciliation\\weekly\\FormatManualReviewWorkbook.ps1\" -WorkbookPath \"" + @[User::OutputFile] + "\""" + DTS:Expression=""-ExecutionPolicy Bypass -File \"\\\\retreathealthcare.org\\network\\Share\\datahub\\pharmacy\\reconciliation\\weekly\\FormatManualReviewWorkbook.ps1\" -WorkbookPath \"" + @[User::OutputFile] + "\""" DTS:IncludeInDebugDump="2345" DTS:Namespace="User" DTS:ObjectName="FormatArguments"> -ExecutionPolicy Bypass -File "S:\datahub\pharmacy\reconciliation\weekly\FormatManualReviewWorkbook.ps1" -WorkbookPath "S:\datahub\pharmacy\reconciliation\weekly\ManualReviewTemplate.xlsx" + DTS:DataType="8">-ExecutionPolicy Bypass -File "\\retreathealthcare.org\network\Share\datahub\pharmacy\reconciliation\weekly\FormatManualReviewWorkbook.ps1" -WorkbookPath "\\retreathealthcare.org\network\Share\datahub\pharmacy\reconciliation\weekly\ManualReviewTemplate.xlsx" S:\datahub\pharmacy\reconciliation\weekly\ManualReviewTemplate.xlsx + DTS:DataType="8">\\retreathealthcare.org\network\Share\datahub\pharmacy\reconciliation\weekly\ManualReviewTemplate.xlsx S:\datahub\pharmacy\reconciliation\weekly\pending + DTS:DataType="8">\\retreathealthcare.org\network\Share\datahub\pharmacy\reconciliation\weekly\pending DTS:Namespace="User" DTS:ObjectName="TemplateFile"> S:\datahub\pharmacy\reconciliation\weekly\ManualReviewTemplate.xlsx + DTS:DataType="8">\\retreathealthcare.org\network\Share\datahub\pharmacy\reconciliation\weekly\ManualReviewTemplate.xlsx @@ -236,7 +236,7 @@ ORDER BY ReviewGroupID, ReviewID; + Arguments="-ExecutionPolicy Bypass -File "\\retreathealthcare.org\network\Share\datahub\pharmacy\reconciliation\weekly\FormatManualReviewWorkbook.ps1" -WorkbookPath "\\retreathealthcare.org\network\Share\datahub\pharmacy\reconciliation\weekly\ManualReviewTemplate.xlsx"" /> - - Size="184,42" Id="Package\For Each Loop Review Run\Mark Review Exported" TopLeft="23,258" /> + @@ -1203,6 +1199,10 @@ ORDER BY ReviewGroupID, ReviewID; Size="351,422" Id="Package\For Each Loop Review Run" TopLeft="484,171" /> + diff --git a/reconciler/ManualReviewImport.dtsx b/reconciler/ManualReviewImport.dtsx index f450c30..8d0186d 100644 --- a/reconciler/ManualReviewImport.dtsx +++ b/reconciler/ManualReviewImport.dtsx @@ -11,8 +11,8 @@ DTS:LocaleID="1033" DTS:ObjectName="ManualReviewImport" DTS:PackageType="5" - DTS:VersionBuild="22" - DTS:VersionGUID="{9BD7A0FF-3AA6-45A3-86BD-A5C6FD2EFF6B}"> + DTS:VersionBuild="25" + DTS:VersionGUID="{244CEC55-CC67-4A6F-9D29-E2CCB83ED199}"> 8 @@ -36,7 +36,7 @@ DTS:Name="ConnectionString">@[User::CurrentReviewFile] + DTS:ConnectionString="\\retreathealthcare.org\network\Share\datahub\pharmacy\reconciliation\weekly\ManualReviewTemplate.xlsx" /> + DTS:ConnectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\\retreathealthcare.org\network\Share\datahub\pharmacy\reconciliation\weekly\ManualReviewTemplate.xlsx;Extended Properties="EXCEL 12.0 XML;HDR=YES";" /> + DTS:ConnectionString="\\retreathealthcare.org\network\Share\datahub\pharmacy\reconciliation\weekly\processed" /> @@ -74,7 +74,7 @@ DTS:Namespace="User" DTS:ObjectName="CurrentReviewFile"> S:\datahub\pharmacy\reconciliation\weekly\ManualReviewTemplate.xlsx + DTS:DataType="8">\\retreathealthcare.org\network\Share\datahub\pharmacy\reconciliation\weekly\ManualReviewTemplate.xlsx + Folder="\\retreathealthcare.org\network\Share\datahub\pharmacy\reconciliation\weekly\completed" /> @@ -990,10 +990,18 @@ Size="192,42" Id="Package\For Each Completed Review Workbook\Finalize Manual Reviews" TopLeft="86,292" /> + + @@ -1016,32 +1024,6 @@ - - - - - - - - - - - - - - - @@ -1064,6 +1046,28 @@ + + + + + + + + + + + + + + @@ -1098,10 +1102,6 @@ - diff --git a/reconciler/reconciler.dtproj b/reconciler/reconciler.dtproj index 73cb68e..01e7254 100644 --- a/reconciler/reconciler.dtproj +++ b/reconciler/reconciler.dtproj @@ -26,7 +26,7 @@ BRT1-RDS01 - AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAO6XIHfjZM0evaVyi8h5QcgAAAAACAAAAAAADZgAAwAAAABAAAABmqbR3I8+jxL0oB+2MHRgDAAAAAASAAACgAAAAEAAAAH9RBUKcyhzhRrJmxGsHhxmIAAAAh66nlyeO/S0yOf4tuPh/eMJ+LIKgs8tMszoZDw4R3S3llzYLAe0PljY7NtqzODvbhSFyFSU5I2GFdEzvhbdBYKmXewg3Yoic5HSlLz8bbti5fxH94zIshiU0Spf/UZCi4Bj/9IDw4+cf6k4Vy6eK5SKLgZzFkHdH6r6Q8Y2CcgPVWr9PV+kC2BQAAACKzIOgR9VWcJUTGQT2oiMMS2MoQA== + AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAO6XIHfjZM0evaVyi8h5QcgAAAAACAAAAAAADZgAAwAAAABAAAAC5SHmjX/PPqd1vCOWt4UU1AAAAAASAAACgAAAAEAAAAHfjaXMXepM6tJStS37YFaeIAAAAE+fkTSrqLHYL5FcMDpE58yo05kA6PgzkhHUYt1V+ETX99M3qjCeBmPsdKe66w8RTxaGyvn5OilyCHdWQaTmNdsYHanCw1xtrduGThAYWrTtEFBuVmhq4koaem7p9R7E3XmDWbBB12FuywY5/352vAldx+4ssC3Ttn8gAGqzTqpuSU+OVdLpOrRQAAACQ0zWIMhnZLwD73WsnkRjERf3mRQ== 1 @@ -428,10 +428,10 @@ ManualReviewImport 1 0 - 22 + 25 - {9BD7A0FF-3AA6-45A3-86BD-A5C6FD2EFF6B} + {244CEC55-CC67-4A6F-9D29-E2CCB83ED199} 8 @@ -597,7 +597,7 @@ 0 0 0 - Provider=Microsoft.ACE.OLEDB.12.0;Data Source=S:\datahub\pharmacy\reconciliation\weekly\ManualReviewTemplate.xlsx;Extended Properties="EXCEL 12.0 XML;HDR=YES"; + Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\\retreathealthcare.org\network\Share\datahub\pharmacy\reconciliation\weekly\ManualReviewTemplate.xlsx;Extended Properties="EXCEL 12.0 XML;HDR=YES"; 18 @@ -670,7 +670,7 @@ 0 0 0 - S:\datahub\pharmacy\reconciliation\weekly\ManualReviewTemplate.xlsx + \\retreathealthcare.org\network\Share\datahub\pharmacy\reconciliation\weekly\ManualReviewTemplate.xlsx 18 @@ -714,7 +714,7 @@ 0 0 0 - S:\datahub\pharmacy\reconciliation\weekly\processed + \\retreathealthcare.org\network\Share\datahub\pharmacy\reconciliation\weekly\processed 18 @@ -726,10 +726,10 @@ ManualReviewExport 1 0 - 33 + 34 - {98FD7D14-0AA2-476F-B1F7-2762A8541125} + {09CBCBA0-EDAF-4ED0-B21D-D9F7486039D0} 8 @@ -880,7 +880,7 @@ 0 0 0 - Provider=Microsoft.ACE.OLEDB.12.0;Data Source=S:\datahub\pharmacy\reconciliation\weekly\ManualReviewTemplate.xlsx;Extended Properties="EXCEL 12.0 XML;HDR=YES"; + Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\\retreathealthcare.org\network\Share\datahub\pharmacy\reconciliation\weekly\ManualReviewTemplate.xlsx;Extended Properties="EXCEL 12.0 XML;HDR=YES"; 18 @@ -953,7 +953,7 @@ 0 0 0 - S:\datahub\pharmacy\reconciliation\weekly\ManualReviewTemplate.xlsx + \\retreathealthcare.org\network\Share\datahub\pharmacy\reconciliation\weekly\ManualReviewTemplate.xlsx 18 diff --git a/reconciler/scripts/FormatManualReviewWorkbook.ps1 b/reconciler/scripts/FormatManualReviewWorkbook.ps1 new file mode 100644 index 0000000..a1be323 --- /dev/null +++ b/reconciler/scripts/FormatManualReviewWorkbook.ps1 @@ -0,0 +1,167 @@ +param( + [Parameter(Mandatory = $true)] + [string]$WorkbookPath +) + +$ErrorActionPreference = 'Stop' + +# ImportExcel lives on the network share, but .NET will not load EPPlus.dll +# directly from a UNC path. Copy the module to this account's local TEMP +# directory before importing it. + +$ImportExcelSource = "\\retreathealthcare.org\network\Share\datahub\pharmacy\reconciliation\weekly\tools\ImportExcel\7.8.10" + +$LocalModuleRoot = Join-Path $env:TEMP "Reconciler\ImportExcel\7.8.10" +$LocalModuleManifest = Join-Path $LocalModuleRoot "ImportExcel.psd1" + +if (-not (Test-Path $LocalModuleManifest)) { + + if (Test-Path $LocalModuleRoot) { + Remove-Item $LocalModuleRoot -Recurse -Force + } + + New-Item ` + -ItemType Directory ` + -Path $LocalModuleRoot ` + -Force | + Out-Null + + Copy-Item ` + -Path "$ImportExcelSource\*" ` + -Destination $LocalModuleRoot ` + -Recurse ` + -Force +} + +# Remove downloaded/network security marking from the LOCAL copy. +Get-ChildItem $LocalModuleRoot -Recurse -File | + Unblock-File -ErrorAction SilentlyContinue + +Import-Module $LocalModuleManifest -Force -ErrorAction Stop + +if (-not (Test-Path $WorkbookPath)) { + throw "Workbook not found: $WorkbookPath" +} + +$sheetName = "Manual Review" + +# Load workbook +$pkg = Open-ExcelPackage -Path $WorkbookPath + +try { + $ws = $pkg.Workbook.Worksheets[$sheetName] + + if (-not $ws) { + throw "Worksheet '$sheetName' was not found." + } + + # Determine last populated review row based on ReviewID in column B + $lastRow = 1 + + for ($row = 2; $row -le $ws.Dimension.End.Row; $row++) { + if ($null -ne $ws.Cells[$row, 2].Value -and + "$($ws.Cells[$row, 2].Value)".Trim() -ne "") { + $lastRow = $row + } + } + + if ($lastRow -lt 2) { + throw "No manual-review rows were found in the workbook." + } + + # Freeze header row + $ws.View.FreezePanes(2, 1) + + # Header formatting + $header = $ws.Cells["A1:P1"] + $header.Style.Font.Bold = $true + $header.Style.Font.Color.SetColor([System.Drawing.Color]::White) + $header.Style.Fill.PatternType = "Solid" + $header.Style.Fill.BackgroundColor.SetColor( + [System.Drawing.Color]::FromArgb(31, 78, 121) + ) + + # Reviewer-entry headers + $reviewHeaders = $ws.Cells["N1:P1"] + $reviewHeaders.Style.Font.Color.SetColor( + [System.Drawing.Color]::FromArgb(255, 128, 0) + ) + + # Reviewer-entry cells only for actual review rows + $reviewRange = $ws.Cells["N2:P$lastRow"] + $reviewRange.Style.Fill.PatternType = "Solid" + $reviewRange.Style.Fill.BackgroundColor.SetColor( + [System.Drawing.Color]::FromArgb(226, 239, 218) + ) + + # Data validation on ReviewerDecision + $validationRange = "N2:N$lastRow" + + # Remove any existing validation overlapping column N + $existingValidations = @($ws.DataValidations) + + foreach ($dv in $existingValidations) { + if ($dv.Address.Address -like "N*") { + $ws.DataValidations.Remove($dv) + } + } + + $validation = $ws.DataValidations.AddListValidation($validationRange) + $validation.Formula.Values.Add("MATCH") + $validation.Formula.Values.Add("NO_MATCH") + $validation.Formula.Values.Add("VARIANCE") + $validation.ShowErrorMessage = $true + $validation.ErrorTitle = "Invalid review decision" + $validation.Error = "Choose MATCH, NO_MATCH, or VARIANCE." + $validation.ShowInputMessage = $true + $validation.PromptTitle = "Reviewer Decision" + $validation.Prompt = "Select MATCH, NO_MATCH, or VARIANCE." + + # Date/time formats + $ws.Cells["G2:G$lastRow"].Style.Numberformat.Format = "yyyy-mm-dd hh:mm:ss" + $ws.Cells["I2:I$lastRow"].Style.Numberformat.Format = "yyyy-mm-dd hh:mm:ss" + + # Quantity/time formats + $ws.Cells["H2:H$lastRow"].Style.Numberformat.Format = "0.0000" + $ws.Cells["J2:J$lastRow"].Style.Numberformat.Format = "0.0000000" + $ws.Cells["K2:K$lastRow"].Style.Numberformat.Format = "0.00" + + # Wrap long fields + $ws.Cells["L2:L$lastRow"].Style.WrapText = $true + $ws.Cells["O2:O$lastRow"].Style.WrapText = $true + + # Column widths + $ws.Column(1).Width = 14 + $ws.Column(2).Width = 12 + $ws.Column(3).Width = 10 + $ws.Column(4).Width = 18 + $ws.Column(5).Width = 18 + $ws.Column(6).Width = 32 + $ws.Column(7).Width = 22 + $ws.Column(8).Width = 14 + $ws.Column(9).Width = 22 + $ws.Column(10).Width = 16 + $ws.Column(11).Width = 14 + $ws.Column(12).Width = 55 + $ws.Column(13).Width = 20 + $ws.Column(14).Width = 20 + $ws.Column(15).Width = 40 + $ws.Column(16).Width = 20 + + # Autofilter on populated review range + $ws.Cells["A1:P$lastRow"].AutoFilter = $true + + # Save + Close-ExcelPackage $pkg + + Write-Host "Formatted workbook:" + Write-Host $WorkbookPath + Write-Host "Review rows: $($lastRow - 1)" +} +catch { + if ($pkg) { + $pkg.Dispose() + } + + throw +} \ No newline at end of file