Skip to content

Instantly share code, notes, and snippets.

@rick0ff
Created December 4, 2012 07:58
Show Gist options
  • Save rick0ff/4201676 to your computer and use it in GitHub Desktop.
Save rick0ff/4201676 to your computer and use it in GitHub Desktop.
path: custom/modules/Agreements/
<?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