|
-
Jul 21st, 2005, 12:21 AM
#1
Thread Starter
Lively Member
Date
hi,
i want to write a function that to generate the invoice by checking the singnup_date. for example: the singup_date = '15-01-2005' . the invoice will be generated on very 15th of the month. But the problems is if the day is fall on 29,30 and 31. and that month is feb, april, june, sept and nov., the invoice will not generated. So, to solve this problem, i want to write a function which on 1st of march, may, july, oct,and dec. will check for the previous month (feb, april, june, sept and nov) .
for example:
today date is 01/march 2005. the invoice will generated for the signup_date which the day is 29, 30 and 31.
if today date is 01/may 2005 , 01/july 2005 , 01/oct 2005 and 01/dec 2005, the invoice will be generated for the signup_date which the day is 31.
Please help in the coding.
Thanks
-
Jul 21st, 2005, 12:37 AM
#2
Re: Date
Vivian, no-one is going to tell you how to write the function or write it for you... but we can help you with any more specific problems that you have 
Are you using a database?
Last edited by penagate; Jul 21st, 2005 at 12:41 AM.
-
Jul 21st, 2005, 12:38 AM
#3
Re: Date
When are you running this to generate invoces? Sounds like every day. I would run them monthly on the same day, but you could do it weekly to solve your problem.
You can use the DateAdd() function along with the Day() function to compute dates.
-
Jul 21st, 2005, 01:19 AM
#4
Thread Starter
Lively Member
Re: Date
yes, i m using the database. and this is a daily invoice generated. I only need the function which can get the correct invoice for the months which is only 30 days and feb.
-
Jul 21st, 2005, 01:28 AM
#5
Thread Starter
Lively Member
Re: Date
Dim strDateRange
strDateRange = DatePart("d", Date)
strSQL = "SELECT ent_id, signup_date FROM ENT_PROFILE WHERE
DatePart(day, signup_date ) in (" & strDateRange & ")"
rs.Open strSQL, objConn_Enterprise
the invoice will not negerated for feb, april, june, sept and nov if the signup_date is 31.
-
Jul 21st, 2005, 01:40 AM
#6
Lively Member
Re: Date
You could put some if statements in you code to check the month and if its only got 28 or 30 days then print the invoices for the next couple of dates
Eg.
VB Code:
'Do processing for today
If Month = "february" then
If day = 28 then
'Process invoices for 29,30,31
End if
Else if Month = "april" then
If day = 30 then
'Process invoices for 30,31
End if
Etc.. etc... etc...
then if its the end of the month it will just process the rest of the dates
You may want to fiddle with feb if you don't want the 29th feb processed on the 28th feb during a leap year, but if you don't care then wolah.
Hope this sheads some light
Cheers
hojo
Last edited by Hojo; Jul 21st, 2005 at 01:43 AM.
Reason: typo
Despite body and mind, my youth will never die!
Everytime I learn something new it pushes some old stuff out of my brain!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|