Advertisement
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: |
Javascript (checkbox enables/disables form fields):
<script type="text/javascript">
function toggle(){
var args=toggle.arguments, els=typeof args[0]=='object'? args[0].elements : document.forms[args[0]].elements;
for (var i = els.length-1; i > -1; --i)
for (var j = args.length-2; j > 0; --j)
if(els[i].name==args[j])
els[i].disabled=args[args.length-1];
}
toggle.init=function(){
for (var f=document.forms, i = f.length-1; i > -1; --i)
for (var e=f[i].elements, j = e.length-1; j > -1; --j)
if(e[j].className&&/disabled/.test(e[j].className))
e[j].disabled=true;
};
</script>
------------------------------------------------------------
ASP (index.asp):
<%
Set cmd = Server.CreateObject("ADODB.Command")
Set rs = Server.CreateObject("ADODB.Recordset")
Set rs2 = Server.CreateObject("ADODB.Recordset")
Set Connection = Server.CreateObject("ADODB.Connection")
Connection.Open "User ID=user;Password=pass;Data Source=dsn;"
SQLSTMT = "SELECT KPKIT, KPSEQ, KPCOM, DESCP, DSCPS, LSTPC, KPQTY from demo where kit = '103'"
SQL = "SELECT SUM(LSTPC) AS Total FROM demo where kit = '103'"
Set RS = Connection.Execute(SQLSTMT)
Response.Write("<table>")
Do While Not RS.EOF
if background = "" or Background = "#F7F7F7" then
background = "#FFFFFF"
else
background = "#F7F7F7"
end if
%>
<form id="form1" name="form1" method="post" action="index1.asp">
<tr id="row">
<td width=25px>
<input type="checkbox" name="check" onclick="toggle(this.form, '<%=rs.fields("KPSEQ")%>', '<%=rs.fields("DESCP")%>', '<%=rs.fields("KPCOM")%>', !this.checked)" />
</td>
<td width=80px>
<input type="text" name="<%=rs.fields("KPSEQ")%>" value="<%=(RS.Fields("KPCOM"))%>" size="13" maxlength="13">
</td>
<%
Response.Write("<td width=500px>")
Response.Write(RS.Fields("DESCP"))
Response.Write(RS.Fields("DSCPS"))
Response.Write("</td>")
%>
<td width=66px>
<input type="text" name="<%=rs.fields("DESCP")%>" value="1" size="4" maxlength="4">
</td>
<td width=66px>
<input type="text" name="<%=rs.fields("KPCOM")%>" value="$<%=(RS.Fields("LSTPC"))%>.00" size="10" maxlength="10">
</td>
</tr>
<%
rs.MoveNext
loop
rs.Close
Response.Write("</table>")
Response.Write("<p>")
Response.Write("</p>")
Set RS2 = Connection.Execute(SQL)
If Not RS2.EOF THEN
Response.Write("Total Cost: $")
Response.Write RS2("Total")
END IF
%>
<p> </p>
<input type="submit" name="Submit2" value="Export to Excel" />
<input type=reset name=Submit3 value=Reset Values />
</form>
<script type="text/javascript">
toggle.init();
</script>
------------------------------------------------------------
ASP (index1.asp - Export to Excel):
<%@LANGUAGE="VBSCRIPT" %>
<%
Response.Buffer = TRUE
Response.ContentType = "application/vnd.ms-excel"
%>
<TABLE WIDTH=920 BORDER=1 CELLPADDING=5 CELLSPACING=5 bordercolor="#000000">
<TR>
<TD width="120" bgcolor="#f16122"><strong><font color="#FFFFFF" size="2" face="Verdana, Arial, Helvetica, sans-serif">Part Number</font></strong></TD>
<TD width="524" bgcolor="#f16122"><strong><font color="#FFFFFF" size="2" face="Verdana, Arial, Helvetica, sans-serif">Description</font></strong></TD>
<TD width="89" bgcolor="#f16122"><div align="right"><font color="#FFFFFF" size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Quantity</strong></font></div></TD>
<TD width="115" bgcolor="#f16122"><div align="right"><font color="#FFFFFF" size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Price</strong></font></div></TD>
</TR>
<% CurrentItem = 0
do while not rs.EOF %>
<TR>
<%CurrentItem = CurrentItem +1%>
<TD><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><%=request.form(cstr(rs.fields("KPSEQ")))%></font></TD>
<TD><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><%=rs("DESCP")%><%=rs("DSCPS")%></font></TD>
<TD><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><%=request.form(cstr(rs.fields("DESCP")))%></font></TD>
<TD><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><%=request.form(cstr(rs.fields("KPCOM")))%></font></TD>
</TR>
<%
rs.MoveNext
loop
rs.Close
%>
<p></p>
<tr>
<td bgcolor="#f16122"><font size="2"> </font></td>
<td bgcolor="#f16122"><font size="2"> </font></td>
<td bgcolor="#f16122"><div align="right"><font size="2"><strong><font color="#FFFFFF" face="Verdana, Arial, Helvetica, sans-serif">Total Cost:</font></strong></font></div></td>
<td bgcolor="#f16122"><strong><font color="#FFFFFF" size="2" face="Verdana, Arial, Helvetica, sans-serif">=sum(d10:d134)</font></strong></td>
</tr>
</TABLE>
|
|
[x]
The Solution Rating System
|
||
|
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
|
Loading Advertisement... |