Selected List with Quantity


QtyIdProductNameUnitPrice
2 Chang5 $19.00
3 BigOne $10.00
4 Chef Anton's Cajun Seasoning $22.00
5 asdf $21.35
6 Grandma's Boysenberry Spread $25.00

bottom next goreload

[1 - 5 : 69]

Select List - Item and Qty
<script language="VB" runat="server">
Sub Page_Load(Src As Object, E As EventArgs)
  Dim GD As New Tornado.GetData
  Dim Sitem2 As New Tornado.z
  With Sitem2
    .dbQP = "U=34| S=5| M=G| D=NWIND.Mdb| ni=b5| Th=Tit= Selected List with Quantity"
    .dbSQL = "SELECT Productid, ProductName, UnitPrice FROM Products where discontinued =false and unitprice > 0"
    .dbGridMagicCell = "field=2|tag=align=right|macro=#2:currency#"
    .dbNameMap = "field=0|alias=Id|formula=ProductId; field=2|alias|Price|formula=UnitPrice"
    .dbSelectedItemMacro = "macro=#1#:#2# | Qtycol=true | Caption=Qty | Size=3 | Raw=true| Buttons=true"
    .ASPdbNET()
  End With
'-------------- User code to Process selected data and build shopping basket ----------------
  If GD.Get_SelectedItem <> Nothing Then
    Dim c, r As Integer
    Response.Write("<hr><Center><H3>Your Shopping Basket has...</H3><TABLE class=TS cellspacing='1'><TR><TD>Item</TD><td class=gh>Product</td><td class=GH>Qty</td><td class=GH>Unit Price</td><td class=GH>Sub-Total</td></tr>")
    Dim a(,) As String = Sitem2.dbSelectedItem()
    Dim subtotal, total As Double
    Dim p() As String
    If Not (IsNothing(a)) Then
      For r = 0 To UBound(a, 2)
        p = Split(a(0, r), ":")
        subtotal = CDec(p(1)) * Val(a(1, r))
        total += subtotal
        Response.Write("<tr><td>" & r + 1 & "</td><td>" & p(0) & "</td><td>" & a(1, r) & "</td><td align=right>" & p(1) & "</td><td align=right>" & Format(subtotal, "currency") & "</td></tr>")
      Next r
      Response.Write("<tr><td colspan=4 align=right>Total</td><td align=right>" & Format(total, "currency") & "</td></tr>")
      Response.Write("</table><p><hr>")
    End If
  End If
End Sub
</script>

Send comments on this topic.
Copyright (c) 1998-2006 ASP-db