<System.Web.Services.WebMethod(EnableSession:=True)>
Public Shared Function GetTopItems() As List(Of TopItems)
Dim DTEmployees As DataTable = _clsGlobal.Get1ParameterizedDatatable(JTConnectionString, "OUSRSelectByUserName", "@UserName", Membership.GetUser.UserName)
If DTEmployees.Rows.Count > 0 Then
Dim RowsEmployees As DataRow = DTEmployees.Rows(0)
Session("Branch") = RowsEmployees.Item("BranchKey")
End If
Dim constr As String = ConfigurationManager.ConnectionStrings("JTConnectionString").ConnectionString
Using con As New SqlConnection(constr)
Using cmd As New SqlCommand("dbo.INV1SelectTopItems", con)
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Add("@PrjCode", SqlDbType.Int).Value = Session("Branch")
cmd.Connection = con
Dim topitems As New List(Of TopItems)()
con.Open()
Using sdr As SqlDataReader = cmd.ExecuteReader()
While sdr.Read()
topitems.Add(New TopItems() With {
.dscription = sdr("dscription").ToString(),
.Totalqty = sdr("Totalqty"),
.TotalPurchase = sdr("TotalPurchase"),
.TotalSales = sdr("TotalSales")
})
End While
End Using
con.Close()
Return topitems
End Using
End Using
End Function