i copy your code to si/templates/invoices/default/plugins folder
and name it function.due_date.php
<?php<br />
//function smarty_function_due_date($params, &$smarty)
/**
* Function: due_date
*
* Calculates the due date by adding the amount of days to the unix timestamp.
*
* Arguments:
*
* date - the default date output - in this format: eg: 25 May 2011
* days - amount of days to due date - eg: 14
*
* How to add to template:
*
* Paste this where you wish the due date to appear:
*
* {due_date date=$invoice.date days=14}
*
**/
function smarty_function_due_date($params, &$smarty)
{
if ($params['date'] != null AND $params['days'] != null) {