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
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'] = a rel="nofollow" href="http://www.php.net/manual/en/function.strtotime.php'>strtotime ("+30 days", a rel="nofollow" href="http://www.php.net/manual/en/function.mktime.php'>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'] = a rel="nofollow" href="http://www.php.net/manual/en/function.date.php'>date ('Y m d', $invoice['new_date']);
theres probably a better way - but i not thinking to straight right now :)
cheers
justin
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
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