Hi all
I've been working on an overdue stamp, in the same style as the http://simpleinvoices.org/forum/discussion/462 - paid stamp which will add a stamp to any unpaid invoice over a user-set age (in days). Hopefully it might be of use to someone else.
Instructions: Backup your files before starting this mod.
Edit /modules/invoices/template.php
After the line
$customFieldLabels = getCustomFieldLabels();
Paste the following and save
#invoice overdue stamp
if ($invoice['owing'] > 0 ) {
$invoice_age_days = number_format((strtotime(date('Y-m-d')) - strtotime($invoice['calc_date'])) / (60 * 60 * 24),0);
$invoice_age = "$invoice_age_days {$LANG['days']}";
}
else {
$invoice_age ="";
}
$smarty -> assign("invoice_age",$invoice_age);
$smarty -> assign("invoice_age_days",$invoice_age_days);
#end overdue stamp
Then edit your template/invoices/default (or custom)/template.tpl
After the </head> paste one of the options below and save
1. If you are using the paid.gif mod, then paste the following to replace the current {if}...{/if} statement and modify the '>7' (greater than 7) to suit your needs. It's measured in days.
{if $invoice.owing == 0.00 }
<body class="rec">
{elseif $invoice_age_days >7}
<body class="due">
{else}
<body>
{/if}
2. If you're not using the paid.gif mod, then paste the following to replace your current tag and modify the '>7' (greater than 7) to suit your needs. It's measured in days.{if $invoice_age_days >7}
<body class="due">
{else}
<body>
{/if}
Then edit /templates/invoices/default (or custom) /style.css and add the following to the end of the file and edit the 'path-to-overdue.gif' and save
.due {background-image: url("path-to-overdue.gif"); background-repeat: no-repeat; background-position: 50% 20%; }
Save the image overdue.gif and upload to your server to the path detailed above
img src="http://www.it-repairs.com/overdue.gif' />
Now test it and let me know if it works OK..
Thanks to Justin for his help...
Cheers
Chris
Thanks Chris
awesome work!!
i'll look at including an option to have a due date/overdue in invoices
- i've added into out 'dreamtime' roadmap http://simpleinvoices.org/roadmap/dreamtime
i currently don't have this option as personally as soon as i sent an invoice out i consider it overdue (ie. to be paid asap)
Cheers
Justin
hey bobbys
just upload the image to the simple invoices directory and modify the code to point to your file - and should work
let us know how you go
cheers
justin
thanks for the update
cheers
justin
only issue is when people use Simple Invoices in languages other than english
if you had an invoice in german and then had 'OVERDUE' in english printed on it - would look out of place
if anyone can think of a solution other than have images per language please let me know
cheers
justin
Hey justin, I've modified by 2010.1 version to have a paid stamp, and the ability to set the language of the client...
Then I created invoices types invoice german and quote german and set them to not active. - they have all the german text in their fields etc.
Then I made a bunch of changes to export.php
so that if the customers custom_field1 is german, it loads the german language file, and invoicesPreferences for the german invoice types instead.
then, if it's a reciept I set a smartytemplate item with the image of the stamp (with de prepended to it in german)
It's a soloution, but a pretty hacky messy one - I needed it - I have english and german clients :-)
I also replaced the date of the reciept with the date of the final payment for that invoice in the db, which I thought was better.
$sql ="SELECT ac_date FROM ".TB_PREFIX."payment WHERE ac_inv_id = :invoice_id ORDER BY ac_date DESC LIMIT 0,1";
$sth = dbQuery($sql, ':invoice_id', $this->id);
$res = $sth->fetch();
$invoice['date']= date('M d, Y',strtotime($res['ac_date']));
unfortunately all of my changes are to core files and rely on my database items...
thanks for the update james
i might try and see if the date stamp can be done with css - that way can be easily translated
-- if you have time and are familiar with css any help with this would be appreciated
cheers
justin
It looks like you're new here. If you want to get involved, click one of these buttons!