$value) { $returnvalue += convertfinancialtabdatatodollars($value[value], $propertyid, $column); } } else { $returnvalue = convertfinancialtabdatatodollars($data[value], $propertyid, $column, $propertyextensionofferacceptedamount); } } return $returnvalue; } //Financcial tab function convertfinancialtabdatatodollars(). function convertfinancialtabdatatodollars($currentvalue, $propertyid = 0, $column = '', $propertyextensionofferacceptedamount = false) { if(substr($currentvalue,0,1) == '$') { $currentvalue = strip_dollar_format($currentvalue); } if(substr($currentvalue,-1) == '%') { $currentvalue = substr($currentvalue,0,-1); switch($column) { case commissionstr: $currentvalue = ($currentvalue * .01) * convertfinancialtabdatatodollars($propertyextensionofferacceptedamount); break; case inoffagentsplit: case additonalcomm: case braddoutref: case brokercommissionssp: $gci=fntab_calculate($propertyid, 'GCI'); $currentvalue = ($currentvalue * .01) * $gci; break; default: return false; } } return $currentvalue; } //CDA function financialtabcdadataparser(). function financialtabcdadataparser($propertyid, $data, $column='', $propertyextensionofferacceptedamount = false, $staffid = 0) { if($data) { if($column == referralsplitanddeductions || $column == additionalcommission)//Sum all values. { if(!is_null($data)) { foreach($data as $key => $value) { $returnvalue += convertfinancialtabcdadatatodollars($value[value], $propertyid, $column, $propertyextensionofferacceptedamount, $value[type]); } } } else if($column == lessadditionaldeductions)//Sum all values that belong to this staffid. { if(!is_null($data)) foreach($data as $key=>$value) { if($value[staffid] == $staffid) { $returnvalue += convertfinancialtabcdadatatodollars($value[value], $propertyid, $column, $propertyextensionofferacceptedamount); } } } else { $returnvalue = convertfinancialtabcdadatatodollars($data[value], $propertyid, $column, $propertyextensionofferacceptedamount, $data[splittype]); } } return $returnvalue; } //CDA function convertfinancialtabcdadatatodollars(). function convertfinancialtabcdadatatodollars($currentvalue, $propertyid = 0, $column = '', $propertyextensionofferacceptedamount = false, $percentage = null) { if(substr($currentvalue,0,1) == '$' || $percentage != 'Percentage') { $returnvalue = strip_dollar_format($currentvalue); d_dev('$returnvalue_fromdollar_'.microtime(),$returnvalue);d_dev('$taci_'.microtime(),$taci); } else if(substr($currentvalue,-1) == '%' || $percentage == 'Percentage') { $currentvalue = strip_numberformatting($currentvalue); switch($column) { //lessadditionaldeductions can only be a dollar amount and not a percentage, so not in the cases below. case additionalcommission: $returnvalue = ($currentvalue * .01) * convertfinancialtabcdadatatodollars($propertyextensionofferacceptedamount); break; case agentsplit: $taci=fntab_calculate($propertyid, 'TACI'); $returnvalue = ($currentvalue * .01) * $taci; break; case referralsplitanddeductions: $gci=fntab_calculate($propertyid, 'GCI'); $returnvalue = ($currentvalue * .01) * $gci; break; default: return false; } } return $returnvalue; } function agent_addeddeduction($agid,$fintabcalcs) { //d($fintabcalcs); $dedus=$fintabcalcs[br_additionaldeduction]; if(is_array($dedus)) foreach($dedus as $dk=>$dv) { if($dv[agent]==$agid) $addup+= db_number($dv[value]); } if($addup) return $addup; return 0; } function echojsscript($jsscript,$timeout=0) { $scriptopen=""; $out=""; $outend=""; if($timeout) { $out="setTimeout(function(){"; $endout="},500)"; } $runit=$scriptopen.$out.$jsscript.$endout.$scriptclose; echo $runit; } ?>