Page 1 of 1

expresion in recuring invoices

Posted: 06 Jan 2012, 10:29
by Piston Broke
Don't know if this is possible but here goes

I have to send several service invoices once a month with the same line on each "services for Jan 2012", now if I use recurring invoices it will always say Jan 2012 Can I add an expression so the month is always correct as the invoice is always done the month before it would be( current month +1). I have thought of using report designer so the actual service line is just "services for" and report designer puts in the month and year but can't work out how to make sage print the next month so when I do the invoices at the end of Jan the invoice comes out with Feb 2012

Thanks

Alain

Re: expresion in recuring invoices

Posted: 10 Jan 2012, 19:23
by brucedenney
I think this will work


I get the invoice date and extract the year

YearFromDate(INVOICE.INVOICE_DATE)

and the month

MonthFromDate(INVOICE.INVOICE_DATE)

make a date the first day of the month / year of the invoice.

CreateDateTime(YearFromDate(INVOICE.INVOICE_DATE),MonthFromDate(INVOICE.INVOICE_DATE),1)

I then add 31 days making it one of the first few days of the next month

CreateDateTime(YearFromDate(INVOICE.INVOICE_DATE),MonthFromDate(INVOICE.INVOICE_DATE),1)+31

format to just give me month and year

DateTimeToFormattedString(CreateDateTime(YearFromDate(INVOICE.INVOICE_DATE),MonthFromDate(INVOICE.INVOICE_DATE),1)+31
, "MMM yyyy")


Append that to the fixed text.

"services for "+DateTimeToFormattedString(CreateDateTime(YearFromDate(INVOICE.INVOICE_DATE),MonthFromDate(INVOICE.INVOICE_DATE),1)+31
, "MMM yyyy")

Re: expresion in recuring invoices

Posted: 17 Jan 2012, 12:58
by Piston Broke
Sorry it took so long to get back to you but thanks

I had also asked the same question on SageForum.co.uk and some guy came up with this

Code: Select all

INVOICE.DESCRIPTION + " " + DateTimeToFormattedString(CreateDateTime(YearFromDate(Now()), MonthFromDate(Now()), 1) + DaysInMonth(YearFromDate(Now()), MonthFromDate(Now())), "MMM yyyy")
And it works exactly how I wanted it to

Thanks again for the help

Alain

Re: expresion in recuring invoices

Posted: 17 Jan 2012, 14:34
by brucedenney
They are subtly different.

The one you suggested uses todays date to work out the text, so if you reprint and old invoice it will have the wrong period on it.

My version uses the invoice date so even when re-printing an old invoice will put the right text on it.

Re: expresion in recuring invoices

Posted: 18 Jan 2012, 11:50
by Piston Broke
Thanks

Never thought of the reprint issue so if I use

Code: Select all

services for "+DateTimeToFormattedString(CreateDateTime(YearFromDate(INVOICE.INVOICE_DATE),MonthFromDate(INVOICE.INVOICE_DATE),1)+31
, "MMM yyyy")
But then remove the "services for" and replace it with INVOICE.DESCRIPTION + " " so I can alter the preceding string using the description I type on the invoice screen as mostly it's "services for" but some times it's "rent for"

Re: expresion in recuring invoices

Posted: 18 Jan 2012, 13:54
by brucedenney
This is what you want

Code: Select all

INVOICE.DESCRIPTION + " " + DateTimeToFormattedString(CreateDateTime(YearFromDate(INVOICE.INVOICE_DATE),MonthFromDate(INVOICE.INVOICE_DATE),1)+31
, "MMM yyyy")

Re: expresion in recuring invoices

Posted: 18 Jan 2012, 14:19
by Piston Broke
Cheers Bruce

You're a star

Is there any way of getting the full invoice text to print on the statement, now it just prints good/services using "AUDIT_SPLIT.STMT_TEXT" I would like it to print the line of text on invoice including the date

Re: expresion in recuring invoices

Posted: 19 Jan 2012, 19:21
by brucedenney
Full text, would mean showing each item and splitting each invoice into all its parts, I can't think of a reason why it could not be done.

Re: expresion in recuring invoices

Posted: 20 Jan 2012, 09:41
by Piston Broke
Sorry didn't explain properly

At the moment every statement just puts goods/services in details I would like it to put in details the actual invoice line like " rent for Jan 2012 "

I'm using a standard sage statement report and in report designer under details the expression is "AUDIT_SPLIT.STMT_TEXT" but I can't find another option I can use

The statement list is all Service invoices using V2009

Re: expresion in recuring invoices

Posted: 20 Jan 2012, 14:17
by brucedenney
AUDIT_HEADER.DESCRIPTION perhaps?

Re: expresion in recuring invoices

Posted: 27 Jan 2012, 10:03
by Piston Broke
Thanks Bruce you've done it again

That's me sorted for now

Really appreciate your help