I want to save products serial numbers, I created a table
dbo.tStock
productType tinyint,
IdProduct int,
ItemTypeNum tinyint,
FirstSNum nchar (20),
LastSNum nchar (20),
TotalQty bigint
when the user insert the totalQty
and the first Serial Number FirstSNum
the application should calculate the last serial number in squence.
In my page i used javascript function:
function Calculate() {
var txt1 = document.getElementById('<%= txtTotalQty.ClientID%>').value
var txt2 = document.getElementById('<%= txtFirstserial.ClientID%>').value
if (txt1 != '' && txt2 != "")
document.getElementById('<%= txtLastSerial.ClientID%>').value =
eval((parseFloat(txt1)-1 + parseFloat(txt2)))
}
The problem is when the serial number start with zero (leading zero) I got a wrong calculation,eg:
totalQty: 100
Firstserial: 01000
LastSerial: 1099 (WRONG) it should be=01099
I'm using ASP.NET C#,
any idea? I appreciate any efforts ;-)