Adding a calculated date to my quotes/invoices

Hey guys,

Sorry I am not great with php, so please be gentle!

Ok, so I have already created a logic_hook.php file in the custom/modules/AOS_Quotes dir and another php file named Calc_payment.php in the same directory, and this works great (it calculates Discount = total_amount * 20% discount.

The next part that I need help with is the following:

If people pay within 30 days on the invoice date (date_created) then they will get a 20% discount.

So I need to take the ‘date_entered_c’ field from suitecrm and ADD+ 30 days to it and save that date in a new custom field that I created in Studio called save_date_c .

Can anyone show me the code I need for this?


  1. what do I add and where do I add to my existing logic_hooks.php file…

  2. what do I add to the php file that I have created called Save_date.php

Thanks for your help!


If anyone is interested, here is the code that I have that works perfect to calculate the 20% of grand total:



$hook_array['before_save'][] = array(
		'Save Amount',



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

class SaveAmount

	function SaveAmount($focus, $event)
	$focus->save_amount_c = $focus->total_amount * ($focus->savex_c / 100);