Hi,
We need someone to create a routine that will run through a bunch of nodes and add up CCK fields, with some variables and running on a monthly basis. It will then add this to a new 'billing' node so we can use it in other ways. I anticipate this will actually be a couple of different routines running side by side due to the way we have set this up (using multiple billing methods at the same time).
If this is of interest, read on. Any one serious will be given developer access to the site to see current setup as used right now before finalising your quote. References will be taken, so please supply one in your initial contact.
Thanks,
Paul.
---
Overview:
We use drupal v6 to track our jobs we perform as an IT repair centre. Recently we have been doing more business contracts, where instead of charging by the job, we are charging by the hour. We now want to start invoicing monthly for all our jobs finished in that month.
Against each job node we have three CCK fields, _hours_workshop, _hours_remtel, _hours_onsite. This holds a decimal figure which we input as we go through the job (we have a custom bit of code for that), so if we do an hour, we put 1.00, if its 45 minutes, we put 0.75 etc. Each job may have values in one or more of these CCKs (or none, if its just for reference etc).
In addition to hours rates, we sell parts or charge a job as priced, e.g. for reselling google apps. These are added to the job in two ways: labour is in a multigroup cck field (e.g. Workshop Hours = 1.00, Charge = 49). Charges which are for parts are added to drupal as nodes and then linked to the job by node reference cck.
We do lots of repairs for individuals and they are charged directly, only people we have agreements with will be dealt using this method. To differentiate those, we use another cck node ref field, _group which links all their jobs under a nice overview page they have access to. If its not got a group node referenced, then its not being charged in this way and can be ignored.
What We Require:
I am not a PHP expert but I imagine the best method of doing this will be to divide it into smaller routines, so have done so here.
We need a cron routine that will go through all the job nodes and add up the billing which will then be added to a new node for that month for each group. The new billing node will have the totals for each of these in the matching CCK fields so we can run views on that node later.
1. Routine to add all the hourly cck fields up so we have a total for each (Job Node -> _hourly* CCK). (e.g. total hours).
2. Routine to add all the parts up (Job Node -> Part Node (via node ref) -> Price CCK). (e.g. total value).
3. Routine to add all the chargeable labour up (Job Node -> Multigroup CCK). (e.g. total value).
As each job is processed, a CCK date field on the job needs to be populated with the cron date for archiving reasons and a node ref linking to the newly created billing node.
Cron Run:
Need advice on this, I think it would be nice to have it run daily and then either a) create and then update the billing node daily but only 'complete' the billing node at the end of the current billing month*; this means they can see their current billing usage/level before being billed OR b) The cron should be run daily but only creating the billing node once a month*.
* This would be the monthly anniversary of a CCK field in the group node (or next day if its not a valid date).
Only jobs completed as per a workflow ID will be included in that months billing so a job might last 6 weeks, but is only charged at the end of the job. Only jobs linked to a group will be processed and only jobs without existing billing node references attached so no duplications. When creating the Billing node, the groups _customer CCK field will need to be copied from the group node and a link back to the group added.
An admin page to select the workflows to include in the billing cycle and any other options would be useful.
Comments
Multigroup?
You said Drupal 6. Are you using CCK 3.x for the multigroup?
http://www.trailheadinteractive.com
Yep!
Yep!
Have you looked at the Storm
Have you looked at the Storm Module? or open atrium?
Not seen atrium before but
Not seen atrium before but did look at Storm. We wanted it to be as flexible as possible and so we are using just standard nodes, workflow and urlfil to pass node refs around. It works great, except we just want a nice way to show invoicing/billing etc. I could even manage most of what I want with views, but I want a statically made node for archiving and I think it will just be easier to achieve what we want with a custom bit of code to pull it all together.
p.