Expenses Filter
Response:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
[ { "id": 3, "class": "Currency", "url_path": "\/currencies\/3", "name": "British Pound", "updated_on": null, "code": "GBP", "is_default": false, "decimal_spaces": 2, "decimal_rounding": 0 }, { "id": 1, "class": "Currency", "url_path": "\/currencies\/1", "name": "Euro", "updated_on": null, "code": "EUR", "is_default": false, "decimal_spaces": 2, "decimal_rounding": 0 }, { "id": 4, "class": "Currency", "url_path": "\/currencies\/4", "name": "Japanese Yen", "updated_on": null, "code": "JPY", "is_default": false, "decimal_spaces": 2, "decimal_rounding": 0 }, { "id": 2, "class": "Currency", "url_path": "\/currencies\/2", "name": "US Dollar", "updated_on": null, "code": "USD", "is_default": true, "decimal_spaces": 2, "decimal_rounding": 0 } ]
We'll use this simple scenario to check how tracking report can be used to filter and report on project expenses. To make this test possible, we have created one two projects:
Response:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
[ { "id": 1, "class": "Project", "url_path": "\/projects\/1", "name": "Project in Default Currency", "completed_on": null, "completed_by_id": null, "is_completed": false, "members": [ 1 ], "category_id": 0, "label_id": 0, "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "created_on": 1430165049, "created_by_id": 1, "updated_on": 1430165050, "updated_by_id": 1, "body": null, "body_formatted": "", "company_id": 1, "leader_id": 0, "currency_id": 2, "template_id": 0, "based_on_type": null, "based_on_id": null, "email": "notifications+m2p-gtx1FpU@mail.manageprojects.com", "is_tracking_enabled": true, "is_client_reporting_enabled": false, "budget": null, "count_tasks": 2, "count_discussions": 0, "count_files": 0, "count_notes": 0 }, { "id": 2, "class": "Project", "url_path": "\/projects\/2", "name": "Project for EU Customer", "completed_on": null, "completed_by_id": null, "is_completed": false, "members": [ 1 ], "category_id": 0, "label_id": 0, "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "created_on": 1430165050, "created_by_id": 1, "updated_on": 1430165050, "updated_by_id": 1, "body": null, "body_formatted": "", "company_id": 1, "leader_id": 0, "currency_id": 1, "template_id": 0, "based_on_type": null, "based_on_id": null, "email": "notifications+m2p-NfdKUca@mail.manageprojects.com", "is_tracking_enabled": true, "is_client_reporting_enabled": false, "budget": null, "count_tasks": 0, "count_discussions": 0, "count_files": 0, "count_notes": 0 } ]
and two tasks in the first project:
Response:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
{ "tasks": [ { "id": 1, "class": "Task", "url_path": "\/projects\/1\/tasks\/1", "name": "Test Task #1", "assignee_id": 0, "delegated_by_id": 0, "completed_on": null, "completed_by_id": null, "is_completed": false, "comments_count": 0, "attachments": [], "labels": [], "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "project_id": 1, "is_hidden_from_clients": false, "body": "", "body_formatted": "", "created_on": 1430165050, "created_by_id": 1, "updated_on": 1430165050, "updated_by_id": 1, "task_number": 1, "task_list_id": 0, "position": 1, "is_important": false, "due_on": null, "estimate": 0, "job_type_id": 0, "total_subtasks": 0, "completed_subtasks": 0, "open_subtasks": 0 }, { "id": 2, "class": "Task", "url_path": "\/projects\/1\/tasks\/2", "name": "Test Task #2", "assignee_id": 0, "delegated_by_id": 0, "completed_on": null, "completed_by_id": null, "is_completed": false, "comments_count": 0, "attachments": [], "labels": [], "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "project_id": 1, "is_hidden_from_clients": false, "body": "", "body_formatted": "", "created_on": 1430165050, "created_by_id": 1, "updated_on": 1430165050, "updated_by_id": 1, "task_number": 2, "task_list_id": 0, "position": 2, "is_important": false, "due_on": null, "estimate": 0, "job_type_id": 0, "total_subtasks": 0, "completed_subtasks": 0, "open_subtasks": 0 } ], "task_lists": [], "label_ids": [], "project": { "id": 1, "class": "Project", "url_path": "\/projects\/1", "name": "Project in Default Currency", "completed_on": null, "completed_by_id": null, "is_completed": false, "members": [ 1 ], "category_id": 0, "label_id": 0, "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "created_on": 1430165049, "created_by_id": 1, "updated_on": 1430165050, "updated_by_id": 1, "body": null, "body_formatted": "", "company_id": 1, "leader_id": 0, "currency_id": 2, "template_id": 0, "based_on_type": null, "based_on_id": null, "email": "notifications+m2p-gtx1FpU@mail.manageprojects.com", "is_tracking_enabled": true, "is_client_reporting_enabled": false, "budget": null, "count_tasks": 2, "count_discussions": 0, "count_files": 0, "count_notes": 0 }, "completed_tasks_count": 0 }
We also have one expense category defined:
Response:
1 2 3 4 5 6 7 8 9
[ { "id": 1, "class": "ExpenseCategory", "url_path": "\/expense-categories\/1", "name": "General", "is_default": true } ]
Now, lets start adding expenses:
Payload:
1 2 3 4 5 6
{ "value": 250, "user_id": 1, "category_id": 1, "record_date": "2015-04-27" }
Response:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
{ "single": { "id": 1, "class": "Expense", "url_path": "\/projects\/1\/expenses\/1", "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "billable_status": 1, "value": 250, "record_date": 1430092800, "summary": null, "user_id": 1, "parent_type": "Project", "parent_id": 1, "created_on": 1430165051, "created_by_id": 1, "updated_on": 1430165051, "updated_by_id": 1, "category_id": 1, "currency_id": 2 } }
Payload:
1 2 3 4 5 6 7
{ "task_id": 1, "value": 350, "user_id": 1, "category_id": 1, "record_date": "2015-04-27" }
Response:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
{ "single": { "id": 2, "class": "Expense", "url_path": "\/projects\/1\/expenses\/2", "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "billable_status": 1, "value": 350, "record_date": 1430092800, "summary": null, "user_id": 1, "parent_type": "Task", "parent_id": 1, "created_on": 1430165051, "created_by_id": 1, "updated_on": 1430165051, "updated_by_id": 1, "category_id": 1, "currency_id": 2 } }
Payload:
1 2 3 4 5 6 7
{ "task_id": 2, "value": 450, "user_id": 1, "category_id": 1, "record_date": "2015-04-27" }
Response:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
{ "single": { "id": 3, "class": "Expense", "url_path": "\/projects\/1\/expenses\/3", "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "billable_status": 1, "value": 450, "record_date": 1430092800, "summary": null, "user_id": 1, "parent_type": "Task", "parent_id": 2, "created_on": 1430165051, "created_by_id": 1, "updated_on": 1430165051, "updated_by_id": 1, "category_id": 1, "currency_id": 2 } }
Payload:
1 2 3 4 5 6
{ "value": 550, "user_id": 1, "category_id": 1, "record_date": "2015-04-27" }
Response:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
{ "single": { "id": 4, "class": "Expense", "url_path": "\/projects\/2\/expenses\/4", "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "billable_status": 1, "value": 550, "record_date": 1430092800, "summary": null, "user_id": 1, "parent_type": "Project", "parent_id": 2, "created_on": 1430165051, "created_by_id": 1, "updated_on": 1430165051, "updated_by_id": 1, "category_id": 1, "currency_id": 1 } }
Now we'll throw in one time record, to make sure that our filter is properly filtering out the data that we do not need:
Payload:
1 2 3 4 5 6 7
{ "value": 1.5, "user_id": 1, "job_type_id": 1, "record_date": "2014-05-14", "billable_status": 0 }
Response:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
{ "single": { "id": 1, "class": "TimeRecord", "url_path": "\/projects\/1\/time-records\/1", "is_trashed": false, "trashed_on": null, "trashed_by_id": 0, "billable_status": 0, "value": 1.5, "record_date": 1400025600, "summary": null, "user_id": 1, "parent_type": "Project", "parent_id": 1, "created_on": 1430165052, "created_by_id": 1, "updated_on": 1430165052, "updated_by_id": 1, "job_type_id": 1 } }
Lets run a general report:
Query Parameters:
1 2 3
{ "type": "TrackingReport" }
Response:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
{ "all": { "label": "All Records", "records": [ { "id": 1, "type": "TimeRecord", "parent_type": "Project", "parent_id": 1, "group_id": 1, "record_date": 1400025600, "user_id": 1, "user_name": "ilija.studen", "user_email": null, "summary": null, "value": 1.5, "billable_status": 0, "project_id": 1, "project_name": "Project in Default Currency", "project_url": "http:\/\/feather.dev\/projects\/1", "client_id": 1, "client_name": "Owner Company", "currency_id": 2, "parent_name": "Project in Default Currency", "parent_url": "http:\/\/feather.dev\/projects\/1", "group_name": "General" }, { "id": 1, "type": "Expense", "parent_type": "Project", "parent_id": 1, "group_id": 1, "record_date": 1430092800, "user_id": 1, "user_name": "ilija.studen", "user_email": null, "summary": null, "value": 250, "billable_status": 1, "project_id": 1, "project_name": "Project in Default Currency", "project_url": "http:\/\/feather.dev\/projects\/1", "client_id": 1, "client_name": "Owner Company", "currency_id": 2, "parent_name": "Project in Default Currency", "parent_url": "http:\/\/feather.dev\/projects\/1", "group_name": "General" }, { "id": 2, "type": "Expense", "parent_type": "Task", "parent_id": 1, "group_id": 1, "record_date": 1430092800, "user_id": 1, "user_name": "ilija.studen", "user_email": null, "summary": null, "value": 350, "billable_status": 1, "project_id": 1, "project_name": "Project in Default Currency", "project_url": "http:\/\/feather.dev\/projects\/1", "client_id": 1, "client_name": "Owner Company", "currency_id": 2, "parent_name": "Test Task #1", "parent_url": "http:\/\/feather.dev\/projects\/1\/tasks\/1", "group_name": "General" }, { "id": 3, "type": "Expense", "parent_type": "Task", "parent_id": 2, "group_id": 1, "record_date": 1430092800, "user_id": 1, "user_name": "ilija.studen", "user_email": null, "summary": null, "value": 450, "billable_status": 1, "project_id": 1, "project_name": "Project in Default Currency", "project_url": "http:\/\/feather.dev\/projects\/1", "client_id": 1, "client_name": "Owner Company", "currency_id": 2, "parent_name": "Test Task #2", "parent_url": "http:\/\/feather.dev\/projects\/1\/tasks\/2", "group_name": "General" }, { "id": 4, "type": "Expense", "parent_type": "Project", "parent_id": 2, "group_id": 1, "record_date": 1430092800, "user_id": 1, "user_name": "ilija.studen", "user_email": null, "summary": null, "value": 550, "billable_status": 1, "project_id": 2, "project_name": "Project for EU Customer", "project_url": "http:\/\/feather.dev\/projects\/2", "client_id": 1, "client_name": "Owner Company", "currency_id": 1, "parent_name": "Project for EU Customer", "parent_url": "http:\/\/feather.dev\/projects\/2", "group_name": "General" } ], "total_time": 1.5, "total_expenses": { "3": { "value": 0, "verbose": "0" }, "1": { "value": 550, "verbose": "550.00 EUR" }, "4": { "value": 0, "verbose": "0" }, "2": { "value": 1050, "verbose": "USD 1,050.00" } }, "has_expenses": true } }
As we can see, it will mix tracked time and expenses. To make sure that we only get expenses, we should set type_filter
to expenses
:
Query Parameters:
1 2 3 4
{ "type": "TrackingReport", "type_filter": "expenses" }
Response:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
{ "all": { "label": "All Records", "records": [ { "id": 1, "type": "Expense", "parent_type": "Project", "parent_id": 1, "group_id": 1, "record_date": 1430092800, "user_id": 1, "user_name": "ilija.studen", "user_email": null, "summary": null, "value": 250, "billable_status": 1, "project_id": 1, "project_name": "Project in Default Currency", "project_url": "http:\/\/feather.dev\/projects\/1", "client_id": 1, "client_name": "Owner Company", "currency_id": 2, "parent_name": "Project in Default Currency", "parent_url": "http:\/\/feather.dev\/projects\/1", "group_name": "General" }, { "id": 2, "type": "Expense", "parent_type": "Task", "parent_id": 1, "group_id": 1, "record_date": 1430092800, "user_id": 1, "user_name": "ilija.studen", "user_email": null, "summary": null, "value": 350, "billable_status": 1, "project_id": 1, "project_name": "Project in Default Currency", "project_url": "http:\/\/feather.dev\/projects\/1", "client_id": 1, "client_name": "Owner Company", "currency_id": 2, "parent_name": "Test Task #1", "parent_url": "http:\/\/feather.dev\/projects\/1\/tasks\/1", "group_name": "General" }, { "id": 3, "type": "Expense", "parent_type": "Task", "parent_id": 2, "group_id": 1, "record_date": 1430092800, "user_id": 1, "user_name": "ilija.studen", "user_email": null, "summary": null, "value": 450, "billable_status": 1, "project_id": 1, "project_name": "Project in Default Currency", "project_url": "http:\/\/feather.dev\/projects\/1", "client_id": 1, "client_name": "Owner Company", "currency_id": 2, "parent_name": "Test Task #2", "parent_url": "http:\/\/feather.dev\/projects\/1\/tasks\/2", "group_name": "General" }, { "id": 4, "type": "Expense", "parent_type": "Project", "parent_id": 2, "group_id": 1, "record_date": 1430092800, "user_id": 1, "user_name": "ilija.studen", "user_email": null, "summary": null, "value": 550, "billable_status": 1, "project_id": 2, "project_name": "Project for EU Customer", "project_url": "http:\/\/feather.dev\/projects\/2", "client_id": 1, "client_name": "Owner Company", "currency_id": 1, "parent_name": "Project for EU Customer", "parent_url": "http:\/\/feather.dev\/projects\/2", "group_name": "General" } ], "total_time": 0, "total_expenses": { "3": { "value": 0, "verbose": "0" }, "1": { "value": 550, "verbose": "550.00 EUR" }, "4": { "value": 0, "verbose": "0" }, "2": { "value": 1050, "verbose": "USD 1,050.00" } }, "has_expenses": true } }
Lets group the result by project, to see how that affected summarized expenses:
Query Parameters:
1 2 3 4 5
{ "type": "TrackingReport", "type_filter": "expenses", "group_by": "project" }
Response:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
{ "project-2": { "label": "Project for EU Customer", "records": [ { "id": 4, "type": "Expense", "parent_type": "Project", "parent_id": 2, "group_id": 1, "record_date": 1430092800, "user_id": 1, "user_name": "ilija.studen", "user_email": null, "summary": null, "value": 550, "billable_status": 1, "project_id": 2, "project_name": "Project for EU Customer", "project_url": "http:\/\/feather.dev\/projects\/2", "client_id": 1, "client_name": "Owner Company", "currency_id": 1, "parent_name": "Project for EU Customer", "parent_url": "http:\/\/feather.dev\/projects\/2", "group_name": "General" } ], "total_time": 0, "total_expenses": { "3": { "value": 0, "verbose": "0" }, "1": { "value": 550, "verbose": "550.00 EUR" }, "4": { "value": 0, "verbose": "0" }, "2": { "value": 0, "verbose": "0" } }, "has_expenses": true }, "project-1": { "label": "Project in Default Currency", "records": [ { "id": 1, "type": "Expense", "parent_type": "Project", "parent_id": 1, "group_id": 1, "record_date": 1430092800, "user_id": 1, "user_name": "ilija.studen", "user_email": null, "summary": null, "value": 250, "billable_status": 1, "project_id": 1, "project_name": "Project in Default Currency", "project_url": "http:\/\/feather.dev\/projects\/1", "client_id": 1, "client_name": "Owner Company", "currency_id": 2, "parent_name": "Project in Default Currency", "parent_url": "http:\/\/feather.dev\/projects\/1", "group_name": "General" }, { "id": 2, "type": "Expense", "parent_type": "Task", "parent_id": 1, "group_id": 1, "record_date": 1430092800, "user_id": 1, "user_name": "ilija.studen", "user_email": null, "summary": null, "value": 350, "billable_status": 1, "project_id": 1, "project_name": "Project in Default Currency", "project_url": "http:\/\/feather.dev\/projects\/1", "client_id": 1, "client_name": "Owner Company", "currency_id": 2, "parent_name": "Test Task #1", "parent_url": "http:\/\/feather.dev\/projects\/1\/tasks\/1", "group_name": "General" }, { "id": 3, "type": "Expense", "parent_type": "Task", "parent_id": 2, "group_id": 1, "record_date": 1430092800, "user_id": 1, "user_name": "ilija.studen", "user_email": null, "summary": null, "value": 450, "billable_status": 1, "project_id": 1, "project_name": "Project in Default Currency", "project_url": "http:\/\/feather.dev\/projects\/1", "client_id": 1, "client_name": "Owner Company", "currency_id": 2, "parent_name": "Test Task #2", "parent_url": "http:\/\/feather.dev\/projects\/1\/tasks\/2", "group_name": "General" } ], "total_time": 0, "total_expenses": { "3": { "value": 0, "verbose": "0" }, "1": { "value": 0, "verbose": "0" }, "4": { "value": 0, "verbose": "0" }, "2": { "value": 1050, "verbose": "USD 1,050.00" } }, "has_expenses": true } }