Discussions

Calculating a labour cost

Hi,

I have playing around with line item types and product types today to try and achieve the following.

I would like to create orders that you can add and hrly rate to and time spent and it works out the total cost. I'm going to use this to generate orders and pdf invoices for customers I do work for.

I was thinking about a product but the price per hour may change depending on type of work and client etc.

Any help would be appreciated.

Posted: Feb 7, 2012

Comments

Yuri on March 2, 2012

What i tried was this:
Create a vocabulary 'Rates' with some terms like cheap standard expensive. Added a custom decimal field 'rate', create three terms.
In the commerce product (not the display): create an integer Hours field, and an entity/taxonomy reference field linked to the term.
In Rules, after bringing the fields into scope in conditions, add action 'calculate a value' and multiply the two field values, storing as a variable. After that, Set a data value, bringing in the variable.

Altogether, I have spend quite some time trying to make this work in Rules, but either the custom fields were not visible in the last step, or data was not set. Maybe should try to make all fields integer, dunno.

So thats where I'm at. If you have more info let me know thanks