The SimpleInvoices forum has moved to Google Plus - this forum is now read-only

dumnew

invoice, selecting customer

on new invoice screen, customer currently by Alphabet. Possible to change to a field contain command instead of field begin with?

also in search function -be it customer or invoice number, could it be change to a field contain code ?
  • dumnew
    dumnew
    invoice, selecting customer

    on new invoice screen, customer currently by Alphabet. Possible to change to a field contain command instead of field begin with?

    also in search function -be it customer or invoice number, could it be change to a field contain code ?
    September 2011
  • dumnew
    i copied your code, named it function.get_duedate.php in si/templates/invoices/default/plugins folder.

    <?php<br />/**
    * Smarty plugin
    * @package Smarty
    * @subpackage plugins
    * @author Thomas Hilburger, www.tnt-designstudio.de
    */

    /**
    * Due date plugin
    *
    * @param mixed $params Array with 'invoiceId' and 'length'. Length will be defaulted to 6, if not set.
    * @param Object $smarty
    * @example {invoiceNumber invoiceId=$invoice.id length=8}
    */
    function smarty_function_get_duedate($params, &$smarty)
    {

    if(empty($params['days']))
    {
    $params['days'] = 14;
    }

    $timeInvoice = strtotime($params['invoiceDate']."+".$params['days']." days");

    echo date("d.m.Y", $timeInvoice);
    }
    ?>

    then i add a line
    {get_duedate invoiceDate=$invoice.date days=14} to si/templates/invoices/defaults/template.tpl

    give me a blank page. what did i do wrong?
    September 2011
  • dumnew
    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) {

    $today = htmlsafe($params[date]);
    $days_to_add = htmlsafe($params[days]);

    $timestamp = strtotime($today);
    $due_date_stamp = strtotime($days_to_add.' day', $timestamp);
    echo date('d M Y', $due_date_stamp);
    }
    }
    ?>

    then I put this line in si/templates/invoice/default/template.tpl

    result : blank page, what did i do wrong?
    September 2011
  • dumnew
    dumnew joined.
    Welcome Aboard!
    September 2011

About

Username
dumnew
Joined
September 2011
Visits
10
Last Active
October 2011
Roles
Member