Greetings,
A short background on what I am trying to do: I've created a referral site where a member receives a commission for referring contract employees.
The pay structure is based on the number of referrals a member currently has working (3 levels of payment).
1. The 1st level is paid at $.75 per hour for every hour one of their referred contract employees work. This level assumes the member has referred 1-3 contract employees.
2. The 2nd level is paid at $1.00 per hour for every hour one of their referred contract employees work. This level assumes the member has referred over 4-7 contract employees.
3. The 3rd level is paid at $1.25 per hour for every hour one of their referred contract employees work. This level assumes the member has referred over 7 contract employees
If the member is an employee, they receive .25 for every hour worked regardless if they have referred someone. They also can count themself toward their referred total. For example, if they are an employee and have referred 2 contract employees, their referred total would be 3 (the employee plus the 2 referred contract employees)
What I am trying to do is to create a field that will calculate the commission due each member based on the number of referrals that they have.
In the Value code, I have the following variables available:
$view: The view object.
$handler: The handler object.
$static: A variable that can be used to store reusable data per row.
$row: Contains the normalized record with consistent field name (e.g. $row->title).
$row->title: Title
$row->field_time_sht_type_referral_value: Type of referral (allowed values: Self referral, regular referral)
$row->field_time_sht_ref_member_nid: Referring member (the member that referred the associate)
$row->field_time_sht_assoc_name_nid: Name of associate (the working associate that was referred by the member)
$row->field_time_sheet_timeframe_value: Timeframe (the 2 week pay period)
$row->field_total_hrs_worked_tmfrm_value: Total number of hours worked during timeframe (hours worked in the 2 weeks by the associate)
$row->php: PHP
$data: Contains the raw record as created by Views (e.g. $data->nid).
If anyone can lend any insight or has a solution to how this can be accomplished, I would appreciate any help you can provide.
Thanks in advance!
Comments
Comment #1
scott859 commentedGreetings,
I was able to construct the code that is providing values that I need. The one thing I am stuck on at this point is trying to find a way to get a sum total (for the field values) of each of the php constructed columns.
Scott
Comment #2
vivdrupal commented@scott859
Hi,
It would be great if you could paste some of your code - to give others like me an insight.
Thanks
Comment #3
scott859 commentedGreetings,
Just took a peek at this, yes, as soon as I have some time I will post back the code that worked for me. Just a bit inundated with deadlines at this point. I'll post my code back here asap.
Scott
Comment #4
molave commentedAlso need help here. Getting the syntax right is tough for the unschooled. Code samples would be appreciated.
Comment #5
liam morlandDrupal 6 is no longer supported. If this applies to a later version, please re-open and update the version.