API config for Timesheet summary/Export Payroll

Discussion for TimeTrex open source community developers.
Post Reply
gimecoffee
Posts: 10
Joined: Wed Apr 14, 2010 9:38 am

API config for Timesheet summary/Export Payroll

Post by gimecoffee »

I have the report I need setup in the HTML interface as a "Payroll Export Report" to give me
"First Name","Last Name","Employee #","Pay Period","other_id4","other_id3","other_id2","other_id1","Hours Code","Hours","Hourly Rate"
for the last pay period but I'd prefer to pull this directly by API.

I've tried PayrollExportReport and TimesheetSummaryReport and with the template 'by_employee+all_time' they are both giving me
"regular_time"
"overtime_time" (Overtime and Doubletime)
"absence_time" (Holiday, sick and vacation)

I definitely need each paycode separated by line.

Then I tried creating the config array manually which then dropped "regular_time", "overtime_time" and "absence_time" .

$config = array(
"-1010-time_period" => array(
"time_period" => "last_pay_period"
),
"-5010-columns" => array(
"last_name",
"first_name",
"employee_number",
"pay_period",
"other_id4",
"other_id3",
"other_id2",
"other_id1",
"hour_code"
),
"-5011-group" => array(
"last_name",
"first_name",
"employee_number",
"pay_period",
"other_id4",
"other_id3",
"other_id2",
"other_id1"

)
);

Any suggestions (or pointers to some documentation) to get this export working through the API?

Thanks
Rois

mikeb
Posts: 609
Joined: Thu Jul 27, 2006 11:58 am

Re: API config for Timesheet summary/Export Payroll

Post by mikeb »

We always recommend that get the report working through the UI first, then its really easy to extract that setup and access it through the API.

So have you gotten the report to return all the data you need through the UI?
TimeTrex Community Edition is developed and supported by volunteers.
Help motivate us to continue by showing your appreciation!

gimecoffee
Posts: 10
Joined: Wed Apr 14, 2010 9:38 am

Re: API config for Timesheet summary/Export Payroll

Post by gimecoffee »

Yes I have it returning exactly what and how I want it through the UI in a saved report. I've attached a copy of the timetrex.log while I was running the UI version hoping to get some clues.

I pruned it down for what I didn't think mattered so hopefully I didn't over prune.

We have multiple separate companies on our TimeTrex install. I see there are lots of ids in the log that would make this customer specific. I'll go with that if that's the only option but I was hoping to make it more generic so I can re-use it directly from the API for other customers easily. Also, if it's every hour code I won't miss newly added ones.

The goal:
* Last_pay_Period
* All employees
* Hours for each hour codes being used for that employee
* Summary grouping by employee, hourcode

I realize "other_id4","other_id3","other_id2","other_id1" and "Hourly Rate"are repeated for every line of each employee and I've programmed around that in my receiving code but I'm using them for the customer to communicate ROP changes as well as other pay related items needing to be on the payroll like mileage, commissions, etc . . .

Thoughts?
Attachments
PayrollExportLog.txt
(59.57 KiB) Downloaded 168 times

mikeb
Posts: 609
Joined: Thu Jul 27, 2006 11:58 am

Re: API config for Timesheet summary/Export Payroll

Post by mikeb »

There is pretty much no way to make the reports generic across companies in TimeTrex, as even if the setup is 100% identical across them, all pay codes have different IDs. So you would either need to have your script dynamically generate the entire report config (which again could be difficult if the setup varies at all), or use a Saved Report with the same name in each company, and simply extract that saved report.

If you want to use the saved report method, please see the tools/export/export_report.php script, as you can pass it command line arguments for the type of report and the saved report name, and it will extract that report to a file. You can look at its source code to see how it grabs the report setup as well if you want.
TimeTrex Community Edition is developed and supported by volunteers.
Help motivate us to continue by showing your appreciation!

Post Reply