Simple Invoices logo
    • CommentAuthornilla
    • CommentTimeNov 14th 2008
     permalink
    Hi,

    I have two more questions to answer, then I am ready to use the simple invoice.

    1. How do delete the decimals in the quantity field? In the database the quantity type is float. I have tried to change it to Int, but it didn´t work.

    2. How do I get a date of payment - invoice date + 30 days? I have a custom field row for the date of payment, but I have to count and write it by myself. Is it possible to get an automatic date?

    Nilla
    • CommentAuthorjustin
    • CommentTimeNov 18th 2008 edited
     permalink
    hey nilla,

    re 1
    - easiest is to just edit the invoice template and change the formating in there
    - edit ./teamplates/invoices/default/ and find the quantity bit

    and change it from
    <td class="tbl1">{$invoiceItem.quantity|number_format:2}</td>
    to
    <td class="tbl1">{$invoiceItem.quantity|number_format:0}</td>

    refer: http://au.php.net/number_format for more info on number_format

    re 2
    - refer ./modules/invoices/template.php
    $invoice contains the main invoice details -
    and $invoice['date'] will be in YYYY-MM-DD format - so you should be able to do $invoice['date']

    $invoice['new_date'] = strtotime("+30 days", mktime(0, 0, 0, substr($invoice['date'],8, 2), substr($invoice['date'], 5, 2), substr($invoice['date'], 0, 4)));

    and then format the date with:

    $invoice['new_date'] = date('Y m d', $invoice['new_date']);

    theres probably a better way - but i not thinking to straight right now :)

    cheers

    justin
    • CommentAuthornilla
    • CommentTimeNov 21st 2008
     permalink
    Hi Justin,

    Thank you, item 1 works fine now, but I have still problems with item 2.

    The file template.php does not have any $invoice['date'] variable. Do I have to define both the invoice['date'] and the invoice['new_date'] variables myself. The invoice['date'] variable ought to be defined somewhre else?

    Nilla
    • CommentAuthorjustin
    • CommentTimeNov 23rd 2008
     permalink
    hey nilla

    in template.php there should be something like
    $invoice = invoice::getInvoice($invoiceID);

    $invoice is an array containing the main details of the invoices - not the line items though

    do print_r($invoice); in the .php to see all the details of the array

    hope this helps - let us know how you go

    cheers

    justin
    • CommentAuthornilla
    • CommentTimeNov 24th 2008
     permalink
    Hi Justin,

    Sorry, but my programming knowledge is not enough to solve the problem with pay date until I get detailed instructions.

    It is suprising to me that pay date isn´t included in the simple invoice program. I hope it will be in the future.

    Nilla