|
I have a very complicated (for me) logic to think of at this time.
This system is production system (my new project, started a week ago). One of the module is desk order system. The logic is
desk_order: desk_order_id desk_order_details: desk_order_detail_id, model_id, desk_order_id model: model_id, desk_order_id
Pseudocode
select * from model if not eof then do while not eof select * from desk_order_details where model_id = strModelID (above) if not eof then do while not eof display desk order details record next loop end if next loop end if
|
Actually, I have no problem if I were to either to display all records in group like above and seperate data entry page but the complicated area is combining both in one page. [view my attachment]
When I click Add Item, the empty field should appear in that model_id, not all, which is my current problem at this time.
My code is below (Sorry, if it's too long):
[code]
<% set rs_model = Server.CreateObject("ADODB.recordset") sql = "SELECT * FROM model" sql = sql & " WHERE desk_order_id = " & session("sDeskOrderID") & " " rs_model.CursorLocation = 3 rs_model.Open sql, conn
if not rs_model.eof then Do While not rs_model.eof strModelID = rs_model("model_id") strModelGName = rs_model("model_g_name") strModelCode = rs_model("model_code") %> <form name=myform action="deskorder_add_3.asp" method=post> <tr> <td colspan=11><br>Model general name: <%=strModelGName%> [ <a href="" class=content>Edit</a> | <a href="" class=content>Delete</a> | <a href="deskorder_add_3_form.asp?passModelID=<%=strModelID% >&passAddItem=Y" class=content>Add item</a> ] </td> </tr> <tr><td colspan=11>Model code: <%=strModelCode%></td></tr> <% set rs_desk_order_d = Server.CreateObject("ADODB.recordset") sql = "SELECT * FROM desk_order_details" sql = sql & " WHERE desk_order_id = " & session("sDeskOrderID") & " " sql = sql & " AND model_id = " & strModelID & " " rs_desk_order_d.CursorLocation = 3 rs_desk_order_d.Open sql, conn
if not rs_desk_order_d.eof then DO while not rs_desk_order_d.eof %> <tr valign=top> <td><%=rs_desk_order_d("model_size")%></td> ; ; <td><%=rs_desk_order_d("model_size_d")%></td& amp; gt; <td><%=rs_desk_order_d("deduction")%></td> <td><%=rs_desk_order_d("clr")%></td> <td align=right><%=rs_desk_order_d("qty")%></td> <td align=right><%=formatnumber(rs_desk_order_d("customer_ price"),2)%></td> <% if rs_desk_order_d("qty") > 0 then strCPrice = rs_desk_order_d("customer_price") * rs_desk_order_d("qty") else strCPrice = 0 end if %> <td align=right><%=formatnumber(strCPrice,2)%></td&a mp;g t; <td align=right><%=formatnumber(rs_desk_order_d("factory_p rice"),2)%></td> <% if rs_desk_order_d("qty") > 0 then strFPrice = rs_desk_order_d("factory_price") * rs_desk_order_d("qty") else strFPrice = 0 end if %> <td align=right><%=formatnumber(strFPrice,2)%></td&a mp;g t; <td><%=rs_desk_order_d("price_factor")%></td& amp; gt; <td>[ <a href="" class=content>Edit</a> | <a href="" class=content>X</a> ]</td> </tr> <% strTQty = strTQty + rs_desk_order_d("qty") strTCPrice = cdbl(strTCPrice) + cdbl(strCPrice) strTFPrice = cdbl(strTFPrice) + cdbl(strFPrice) 'if there is at least one record already exist in that model id. modelIDtmp = request.querystring("passModelID") strPassAddItem = request.querystring("passAddItem") if strPassAddItem = "Y" and strmodelID = modelIDtmp then %> <tr valign=top> <td> <input type=text name=model_size_fr>  
|