Hello I have followed the instuctions on http://developers.sugarcrm.com/tutor...AgingField.pdf to precalculate certin feilds. i am running V 6.3.1. after following the instuctions to a tee when i do a quik repair the repair modual stops at 'Rebuilding Relationships'. I am a beginner at programing and at sugar so i am gusing this old method will only work for sugar 5. can any one shed some light on this please. Below is my code
In : /custom/Extension/modules/Accounts/Ext/Vardefs
In : /custom/Extension/modules/Accounts/Ext/LanguageCode:<?php // created: 2012-01-20 11:53:18 /* $dictionary['Account']['fields']['gross_revenue_c'] = array ( 'name' => 'gross_revenue_c', 'vname' => 'LBL_GROSS_REVENUE', 'type' => 'decimal', 'function' => array('name'=>'getGrossProfit', 'returns'=>'html', 'include'=>'custom/CustomCode.php'), 'len' => '18', 'comment' => 'Automaticly calculated value for gross revenue' */ ?>
In :Code:<?php $mod_strings['LBL_GROSS_REVENUE'] = 'Gross Revenue'; ?>
Code:<?php class getgross /* trying to precalculate gross revenue */ function getGrossProfit($bean, $field, $value, $view){ $total_charge_amount_c = ($bean->total_charge_amount_c ); $cost_of_flight_c = ( $bean->cost_of_flight_c ); $miscellaneous_cost_c = ($bean->miscellaneous_cost_c ); $merchant_cost_c = ($bean->merchant_cost_c ); $miles_c = ($bean->miles_c ); $price_per_mile_c = ( $bean->price_per_mile_c); $gross_revenue_c = ( $bean->gross_revenue_c); $gross_revenue_c = $total_charge_amount_c; $gross_revenue_c -= ($cost_of_flight_c == null ) ? ($miles * $price_per_mile_c ) : $cost_of_flight_c; $gross_revenue_c -= $merchant_cost_c - $miscellaneous_cost_c ; if($view == 'EditView' || $view == 'MassUpdate') { //If this is EditView Or MassUpdate Include a field box $gross_revenue_c = '<input type=text name=Gross Revenue value={$gross_revenue_c} disabled>\n'; } return $gross_revenue_c; } ?>


LinkBack URL
About LinkBacks





Reply With Quote

Bookmarks