Open gises opened 3 years ago
I don't think so. Grandtotal calculates the unit cost from cost and minutes. The Kimai import view in Grandtotal shows the correct values for "Quantity, Unit, Unitprice, Cost". Are you sure your invoice template is correct?
Hi Kevin, I quickly made two test entries for better understanding. An hourly rate of 75.25 is stored in Kimai with time entries of 15 and 30 minutes. When importing into GrandTotal, i.e. before the invoice is created, it looks like this.
Screenshot aus der Kimai DB
Yes, and what is the problem now? Einzelpreis = 72,25 for one complete item. Grandtotal sees that it is just half of an item (30 minutes) so it Kosten is 37,63. Looks correct to me.
The hourly rate is fixed but is now displayed differently. Even if the differences are only minor, they are not accepted. If the expenses are then summed up in GrandTotal, it looks like this. This is wrong and leads to questions from the client. That is why I asked why the hourly rate stored cannot be transmitted. In addition, the rounding in Switzerland is to 5 centimes and this works in GrandTotal.
Aha, I was concentrating on the logic, not the cents. Kimai rounds to 2 decimals, that can't be changed. I would transfer the hourly rate, but Grandtotal cannot use it AFAIK.
Talk to the Grandtotal developer please and explain the problem, maybe he allows to set the Einzelpreis instead of the costs in plugins.
Hi Kevin, i talked to Stefan from GrandTotal. His answer Das müsste es fixen: 'cost': aEntry['hourly_rate'] * (aItemResult["minutes"] / 60);
Could you check this
You can try it yourself. Clone the repository, change the line and then double click the directory Kimai2.grandtotalplugin
.
This will import the plugin into Grandtotal.
Hi Kevin
Following results: If i use the fix as proposed from Stefan i got an error message.
Then i tried this, and i can import in GrandTotal, but still with the false Rate since i use "rate" instead" of "hourly_rate"
When i switch from "rate" to "hourly_rate" there is no log or import in GrandTotal. Seems that "hourly_rate" is not transferd or maybe the wrong format. Do you have any further idea? Thanks in advance!
Hm, true. The hourly_rate is missing in these objects. That needs to be fixed in Kimai first.
You could try to calculate the hourly_rate first (var hourlyRate = aEntry['rate'] / aEntry['duration'] * 3600
) and then apply the next steps.
Hi Kevin
I think this is a dead end. Even if I calculate it this way, the rounding problem remains. The only solution in my eyes would be if the "hourly_rate" can be transferred to GrandTotal as stored in Kimai. I write this again to Stefan from GrandTotal
Maybe I am wrong, but I don't think that it matter if you calculate the hourly rate or if it comes from Kimai. There should be no difference for the algorithm.
var hourlyRate = aEntry['rate'] / aEntry['duration'] * 3600
var minutes = Math.round(aEntry['duration'] / 60);
var aItemResult = {
'startDate': aEntry['begin'],
'client': '',
'project': '',
'minutes': minutes,
'notes': aEntry['description'] !== null ? aEntry['description'] : '',
'label': aEntry['tags'].join(", "),
'user': aEntry['user'],
'cost': hourlyRate * minutes / 60,
'uid': 'com.kimai2.' + aEntry['id'],
};
Currently, a calculated hourly rate is transferred to GrandTotal. This leads to different hourly rates being shown in the invoice. According to the database, the field "hourly_rate" should be used instead of "rate" for the entry "Cost".
Many thanks
for (var aEntry of aItems) { var aItemResult = { 'startDate': aEntry['begin'], 'client': '', 'project': '', 'minutes': Math.round(aEntry['duration'] / 60), 'notes': aEntry['description'] !== null ? aEntry['description'] : '', 'label': aEntry['tags'].join(", "), 'user': aEntry['user'], 'cost': aEntry['rate'], 'uid': 'com.kimai2.' + aEntry['id'],