Click here to Skip to main content
14,303,059 members
Rate this:
Please Sign up or sign in to vote.
See more:
Invoice Number Automation i am doing computer shop management each and every time after selling a product the invoice number should change automatically like cs102 for one customer and another customer should get cs103 how to do it........i don't know basic for this please give coding or link in case you know ....don't ask show your coding....i don't know even a single line
Posted
Comments
Varun Sareen 22-Feb-12 1:59am
   
Who you are? a shopkeeper or a programmer?
Rate this:
Please Sign up or sign in to vote.

Solution 2

You need the 'CSS' part and the numerical part to be separate - so store one as
Dim prefix as string = "CS"

And the number as an int,
Dim num as Integer = 103

Then you make up your invoice number as

Dim inv as string = prefix + num.ToString()

Of curse you probably need to store the invoice numbers to a db somewhere rather than hard coding e values as I have, but if you've any chance of doing what you wish, that should give you a start.

Oh I nearly forgot ... Then you need to

Num += 1

To lincrement the numerical part
   
v2
Comments
morrish7 22-Feb-12 12:43pm
   
Thanks _Maxxx_
Rate this:
Please Sign up or sign in to vote.

Solution 1

Hi, First fetch last inserted record value suppose that is 102. then increase this by 1 then it will be 103 and make a string and assign value to this "cs"+val.ToString() and show this string in text box. do this process for each time when you insert a new record or invoice.

Hopefully, it will help you.
   
Comments
karthikh87 22-Feb-12 4:20am
   
hi i too have similar issue with C# so can u give me code for this and i tried with incrementing in database but issue is that it will re-write on previously entered value
Sarvesh Kumar Gupta 22-Feb-12 12:51pm
   
hi you also use above process, if any issue then you can tell me.
Rate this:
Please Sign up or sign in to vote.

Solution 4

Here

http://winform-net.blogspot.in/2011/06/auto-increment-invoice-number-for-vbnet.html[^]

is a sample to Auto Increment Invoice Number For Vb.Net, which may be helpful to you

PES
   
Comments
morrish7 22-Feb-12 12:45pm
   
Thanks proEnggSoft dude..
ProEnggSoft 22-Feb-12 18:50pm
   
Thank you
Rate this:
Please Sign up or sign in to vote.

Solution 3

Hi morrish7,
Use auto_increment in your database for invoice field.

Eg:
CREATE TABLE customer (
     Inv_no INT NOT NULL AUTO_INCREMENT, other fields like name,product,...
     PRIMARY KEY (Inv_no)
);
   
Comments
morrish7 22-Feb-12 12:44pm
   
Thanks vishnupriyaraju..by the way ms access anyway thanks
Sarvesh Kumar Gupta 22-Feb-12 12:53pm
   
There is alphanumeric field so you can't use this.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100