How to change Currency Fields on the DetailView using the bean

I have some fields I am wanting to add the ‘$’ sign too.

So I did the following in view.detail.php:

<?php 
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); 

require_once('include/MVC/View/views/view.detail.php'); 
require_once('custom/include/utilities.php');

class OpportunitiesViewDetail extends ViewDetail {

	// function displaySubPanels() {
	// 	return '';
	// }

	
	function display(){

		var_dump($this->bean->final_sale_amount_c);

		$this->bean->initial_deposit_c = '$' . $this->bean->initial_deposit_c;
		$this->bean->fees_escrowed_c = '$' . $this->bean->fees_escrowed_c;
		$this->bean->amount = '$' . $this->bean->amount;

		$this->bean->final_sale_amount_c = '$' . $this->bean->final_sale_amount_c;
		$this->bean->a_deposit_c = ($this->bean->a_deposit_c * 100) . '%';
		$this->bean->b_deposit_c = ($this->bean->b_deposit_c * 100) . '%';
		$this->bean->c_deposit_c = ($this->bean->c_deposit_c * 100) . '%';

		$this->bean->a_quarterly_hosting_fees_c = '$' . $this->bean->a_quarterly_hosting_fees_c;
		$this->bean->b_quarterly_hosting_fees_c = '$' . $this->bean->b_quarterly_hosting_fees_c;
		$this->bean->c_quarterly_hosting_fees_c = '$' . $this->bean->c_quarterly_hosting_fees_c;

		$js = <<<JS

				<script src="custom/include/javascript/js.cookie.js?version=1" type="text/javascript"></script>
                <script src="custom/include/javascript/utilities.js" type="text/javascript"></script>
				<script type="text/javascript">
				var \$ = jQuery.noConflict();


                    

				</script>


JS;
		parent::display();
		echo $js;
		
	}
	
}
?>

For some reason, the fields that are currency fields, initial_deposit_c, amount, final_sale_amount_c. Don’t work correctly, they instead show ‘0.00’ instead of their original values.

When I do a var_dump of $this->bean->final_sale_amount_c I get back "string (12) “75000.0000”.

I also noticed that the that contains the actual text on the DetailView generally has a class of “sugar_field”, but the Currency Fields do not have that class.

Anyone know what I might be doing wrong?

I am aware I could easily do this with javascript as a work-around, but I was trying to do this using the bean.

Here was the solution:

Go to detailviewdefs.php:

array (
            'name' => 'amount',
            'label' => '{$MOD.LBL_AMOUNT} ({$CURRENCY})',
            'customCode' => '{$custom_value}',
          ),

Then go to view.detail.php and add:

$this->dv->process();
$this->ss->assign('custom_value', '$'.$this->bean->amount);