Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reference Number... pls help!

Status
Not open for further replies.

garfield11

IS-IT--Management
Jul 4, 2002
44
SG
Hi.

I need to create a quotation but I have some problen with the ref num. I want the ref num to be display as for e.g. Q/001/02. Q stands for quotation. 001 is the ID and I want it to be like everytime a new user opens a new quotation, the ID will increase by 1. 02 is the year e.g. year 2002 and if it reaches year 2003 i want it to automatically change to 03. So is there any way to do it?

Thanks!

Love_Garfield =)
 
hi

this is the code for you

<%@ Language=VBScript %>
<HTML>
<HEAD>
<META NAME=&quot;GENERATOR&quot; Content=&quot;Microsoft Visual Studio 6.0&quot;>
</HEAD>
<BODY>
<%

cnt = Application(&quot;Cnt&quot;)+1
Application(&quot;Cnt&quot;) = cnt

clen = Len(cStr(cnt))

Select Case Clen
Case 1
zadd = &quot;00&quot;
Case 2
zadd = &quot;0&quot;
End Select

CurDate=Mid(year(Date),3,2)

midstr=&quot;Q/&quot;+zadd+cstr(cnt)+&quot;/&quot;+CurDate

Response.Write midstr



%>
</BODY>
</HTML>
____________________________________________________________
'global.asa file
<SCRIPT LANGUAGE=VBScript RUNAT=Server>
Sub Application_OnStart
'Add your Application_OnStart code here
Application(&quot;Cnt&quot;) = 0
End Sub
</SCRIPT>
____________________________________________________________

here i use Application global variable to store value
u can store it into database too get maximum no trhouh sql qery and u can use it to increase the number

if you want more help plz email me at sawantprasad2001@yahoo.com
 
Hi all,

Above codes work very well but i wanna my program to work like everytime i open a NEW quotation the number will increase by 1 and not everytime i refresh the page.

Can any please advise? Thanks.

Love_Garfield [thumbsup2]
 
Get the last quotation put into the db then Split your id like this

strQuoteID = Split(QuoteID, &quot;/&quot;)

'Q/001/02
strQuoteID(0) would equal Q
strQuoteID(1) would equal 001
strQuoteID(2) would equal 02

then just put it all back together an add values to it..

NewStrQuoteID = &quot;Q/&quot; & CInt(strQuoteID(1)) + 1 & &quot;/&quot; & Right(year(date),2)

'# this part takes the right 2 numbers of this years date.
'# Right(year(date),2)


Then when you make your new &quot;quotation&quot; record use NewStrQuoteID for the new id..


Hope that helps,
Jason



www.vzio.com
ASP WEB DEVELOPMENT



 
hi,
thanx for ur help. it has really helped me.hope to be in touch in future.
kaushik
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top