schroedermatthias
1 year ago

How to build a worklog table by month?

Posted 1 year ago by schroedermatthias

Hi folks,

I have got worklogs, each of them are assigned to a project (1:1). A worklog consists only of a date (when the work was done) and the relation to the project.

How can I create a table, that shows all worklogs summed up for all projects of one year?

The table should be composed in a way, that the first column contains all projects (that have worklogs for this year), all further columns contain the months. The last column should sum up all months of the project. The last row should sum up all projects of one month. The cell right at the bottom should be the sum of all.

Example:

|Project|January|February|March|April|...|December| Sum |
|---|---|---|---|---|---|---|---|
|Project 1| 22 | 0 | 0 | 13.5 | ... | 38 | 73,5 |
|Project 2| 14 | 7 | 3 | 24 | ... | 0 | 48 |
|Project 3| 11 | 10 | 0 | 0 | ... | 9 | 30 |
| Sum | 47 | 17 | 3 | 27.5 | ... | 47 | 198,5 |

How would you query? Ist it possible only with querying or do I need some Model/Controller logic that build a suitable structure for the template? Or would you even calculate in the template? In general I think I could solve this myself, but I want a slim and clean approach.

I am looking forward to your ideas and really appreciate your help.

Matthias

Please sign in or create an account to participate in this conversation.