Quantcast
Channel: Microsoft Dynamics RMS Forum - Recent Threads
Viewing all articles
Browse latest Browse all 4248

Need help to create asp page for reading BARCODE, ITEM DESCRIPTION AND PRICE.

$
0
0

Hi Everyone,

I need to create one asp page just to check item into web html. Can anyone favor me to send one ready made asp page. I want to get the data'barcode, item description and price' from ITEM tabe in RMS database. I will be grateful to you. Kindly review my asp codes are given below:

<html>
<body>

<%
Public Function GETDEPT (DP)
GETDEPT="GROCERY or Something"
End Function

Dim bcode1
bcode1 = Request.QueryString("barcode")

Dim cn, rs, rs2
Dim strsq, strsq2

strsq="select distinct code from (select rtrim(cast(notes as varchar)) as code from item join alias on item.id=alias.itemid "
strsq = strsq & "where alias.alias ='" & bcode1 & "' And inactive=0 union all "
strsq = strsq & "select rtrim(cast(notes as varchar)) from item where itemlookupcode='" & bcode1 & "') a1 "

'Connect to database
Set cn = CreateObject("ADODB.Connection")
cn.ConnectionString="Provider=SQLOLEDB;Persist Security Info=False;User ID=sa;Password=123;Initial Catalog=RMS;Data Source=192.168.100.11"
cn.CursorLocation = 3
cn.Open

'Run procedure
Set rs = CreateObject("ADODB.Recordset")
rs.Open strsq, cn

if rs.recordcount > 0 Then
item1=rs.Fields(0).value
else
item1=""
end if

if len(item1)>0 then

stsq33 = "SELECT distinct rtrim([itemid]),rtrim([itemname]),rtrim([dept]),rtrim(subdescription1),rtrim(subdescription2) "
stsq33 = stsq33 & "FROM [RMS].[dbo].[item] a join item b on a.[itemid]=rtrim(cast(b.notes as varchar)) "
stsq33 = stsq33 & "where [itemid]='"& item1 &"'"

stsq34 = "Select uom from [RMS].[dbo].item where [itemid]='"& item1 &"' order by price"

Set rs33 = CreateObject("ADODB.Recordset")
rs33.Open stsq33, cn

Set rs34 = CreateObject("ADODB.Recordset")
rs34.Open stsq34, cn

If rs33.recordcount > 0 Then
hd2 = "ITEM : "
Response.Write("<B>" & hd2 & "")
Response.Write("&nbsp&nbsp")
Response.Write(rs33.Fields(0).value)
Response.Write(" - ")

Response.Write(rs33.Fields(1).value)
Response.Write("</BR>")
Response.Write("<font size=""3"" face=""Arial"" font color=""red"" >")
Response.Write("DEPT : ")
Response.Write(getdept(rs33.Fields(2).value))
Response.Write("</font>")
Response.Write("</BR>")
Response.Write("CATEGORY : ")
Response.Write(rs33.Fields(3).value)
Response.Write(", SUBCATEGORY : ")
Response.Write(rs33.Fields(4).value)
end if
rs33.close

If rs34.recordcount > 0 Then
rs34.movefirst
uofm=""
do

uofm=uofm + rs34.Fields(0).value + "- "

rs34.MoveNext
Loop Until rs34.eof
end if
Response.Write("</BR>")
Response.Write("<font size=""3"" face=""Arial"" font color=""green"" >")
Response.Write("UOM : ")
Response.Write(mid(uofm,1,len(uofm)-2))
Response.Write("</BR>")
Response.Write("</font>")

Response.Write("<table border=""1"" cellspacing=""0"" cellpadding=""0"" width=""300"" style=""border:1px solid black;"">")
Response.Write("<tr bgcolor=""#AAAAAA"">")
Response.Write("<td height=""30"" width=""70"" align=""left"">UOM</td>")
Response.Write("<td width=""380"" align=""left"">BARCODE</td>")
Response.Write("<td width=""50"" align=""left"">PRICE</td>")
Response.Write("<tr>")

else
Response.Write("ITEM NOT FOUND.")
end if

cn.Close


Response.Write("</BR>")
Response.Write("</BR>")
%>
<a href="192.168.100.11/.../index.htm">NEW ITEM</a>

</body>
</html>


Viewing all articles
Browse latest Browse all 4248

Trending Articles