ontarget
Active Member
I have a calc element that is working out the value of catering based on numbers served. The catering options are checkbox as they require multi selection. The 'other' option is a field which can take any numerical value.
So typically they could choose
scones = ?3
lunch = ?14.00
= ?17.00 * 10 persons served = ?170
I then need to calculate what they are paying the catering firm e.g
scones = ?2
lunch = ?10
= ?12 * 10 = ?120
How can i run a second calc which changes the values of the same checkboxes to the catering firms values?
I think I need to do an array to get the checkbox values then reencode the array with the new values then do the calc on those - am I correct? How do i get checkbox values into an array in fabrik?
PHP:
$catering = array_sum($data['aaa_maindatabase___main_catering_detail_raw']) + '{aaa_maindatabase___main_other_catering}';
$totalcatering = $catering * (int)'{aaa_maindatabase___main_served}';
return $totalcatering;
So typically they could choose
scones = ?3
lunch = ?14.00
= ?17.00 * 10 persons served = ?170
I then need to calculate what they are paying the catering firm e.g
scones = ?2
lunch = ?10
= ?12 * 10 = ?120
How can i run a second calc which changes the values of the same checkboxes to the catering firms values?
I think I need to do an array to get the checkbox values then reencode the array with the new values then do the calc on those - am I correct? How do i get checkbox values into an array in fabrik?