Created
December 4, 2012 07:58
-
-
Save rick0ff/4201676 to your computer and use it in GitHub Desktop.
path: custom/modules/Agreements/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class SumAgreementsHook | |
{ | |
protected static $sum = 0; | |
/** | |
* Called as process_record logic hook on the Opportunities module | |
*/ | |
public function sumTotalFromEachRow($bean, $event, $arguments) | |
{ | |
self::$sum += $bean->hourly_rate_c; | |
} | |
/** | |
* Called as a after_ui_frame logic hook on the Opportunities module | |
*/ | |
public function displaySumTotal($event, $arguments) | |
{ | |
if ($GLOBALS['action'] == 'index' || $GLOBALS['action'] == 'ListView') { | |
$sum = currency_format_number(self::$sum); | |
echo <<<EOHTML | |
<script type="text/javascript"> | |
<!-- | |
$('<p>Total Hours Rate is {$sum}</p>').insertAfter('.moduleTitle'); | |
--> | |
</script> | |
EOHTML; | |
} | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment