Create Tax report of OrangeHRM with Powershell

This code is only usefull if there is only one employee.

Export four seperate CSV files out of the database of OrangeHRM. The tables you should export are the following:

ohrm_customer
ohrm_project
ohrm_project_acitivity
ohrm_timesheet_item

You should use the following settings for the export ni PHPMyAdmin:

OrangeHRM

Export each table with the following names:

ohrm_customer                  – Customers.csv
ohrm_project                       – Projects.csv
ohrm_project_acitivity   – Activities.csv
ohrm_timesheet_item     – Items.csv

Place the CSV files and the script below in the same directory.

$Activities = import-csv ".\Activities.csv" -Delimiter ";"
$Customers = import-csv ".\Customers.csv" -Delimiter ";"
$Items = import-csv ".\Items.csv" -Delimiter ";"
$Projects = import-csv ".\Projects.csv" -Delimiter ";"
$Export = @()
Foreach ($item in $Projects){[int]$count = $item.customer_id
$count--
$item.customer_id = $Customers[$count].name
}
Foreach ($item in $items){
[int]$count = $item.Activity_id
$count--
$item.Activity_id = $Activities[$count].name

[int]$count = $item.project_id
$count--
$item.Employee_id = $Projects[$count].customer_id
[int]$count = $item.project_id
$count--
$item.project_id = $Projects[$count].name
}
$items | Export-CSV -path ".\Export.csv" -Delimiter ";"

This will export a CSV file in the same directory. The only thing you have to do now is replace the header of employee_id to something more meaningful. In fact you will probably have to replace all the headers to something a bit more meaning full.