Jump to content

[Help] Any expert here can explain these asp file?


Guest lokan

Recommended Posts

I need to make a flowchart to my boss, yet actually, i am not familiar with ASP,the following is the programming code:(((Relocating.asp)))<!--#include file="../include/checklogin.asp"--><!--#include file="../include/function.asp"--><!--#include file="../include/rep.asp"--><%set objCoet=OpenDB() op=Request.Form("op") CUSTNO=Request("CUSTNO") CUSTNAME=Request("CUSTNAME") DIVINO=Request("DIVINO") DIVIDESC=Request("DIVIDESC") STOCKNO=Request("STOCKNO") STOCKNAME=Request("STOCKNAME") SMOD=Request("SMOD") if op="DoSearch" then sql="SELECT ID,LOCCODE,LOCCODE,TOTAL,SPERQTY,SHOLDCTN,SPACKQTY,STOTALCTN,DATE,PONO,SCSNO,SHIPDATE FROM dbStockKeep where CUSTCODE='"&CUSTNO&"' and DIVCODE='"&DIVINO&"' and STOCKCODE='"&STOCKNO&"' and SMOD=N'"&SMOD&"' order by CUSTCODE,DATE,SCSNO,SHIPDATE desc" Set objRS = Server.CreateObject("ADODB.Recordset") objRS.Open sql,objCoet,1,4 end if action=Request.Form("action") if action="DoRelocation" then o_loc=Trim(Request.Form("o_loc")) o_dat=Trim(Request.Form("o_dat")) o_lot=Trim(Request.Form("o_lot")) o_cs=Trim(Request.Form("o_cs")) o_ship=Trim(Request.Form("o_ship")) o_sper=Trim(Request.Form("o_sper")) n_locdesc=Trim(Request.Form("n_locdesc")) n_loc=Trim(Request.Form("n_loc")) n_qty=Trim(Request.Form("n_qty")) o_loc_Arr=split(o_loc,",") o_dat_Arr=split(o_dat,",") o_lot_Arr=split(o_lot,",") o_cs_Arr=split(o_cs,",") o_ship_Arr=split(o_ship,",") o_sper_Arr=split(o_sper,",") n_locdesc_Arr=split(n_locdesc,",") n_loc_Arr=split(n_loc,",") n_qty_Arr=split(n_qty,",") for i=0 to ubound(o_loc_Arr)-1 sql="SELECT TOTAL,AVAIL,SPERQTY,STOTALCTN,SPACKQTY,PONO,date,SCSNO,SMOD,SHIPDATE FROM dbStockKeep where CUSTCODE='"&CUSTNO&"' and DIVCODE='"&DIVINO&"' and STOCKCODE='"&STOCKNO&"' and SMOD=N'"&SMOD&"' and LOCCODE='"&trim(o_loc_Arr(i))&"' and pono='"&trim(o_lot_Arr(i))&"' AND SCSNO='"&trim(o_cs_Arr(i))&"' AND DATE='"&trim(o_dat_Arr(i))&"' AND SHIPDATE='"&trim(o_ship_Arr(i))&"' AND SPERQTY='"&trim(o_sper_Arr(i))&"' " Set objRS = Server.CreateObject("ADODB.Recordset") objRS.Open sql,objCoet,1,4 if not objRS.eof then SPERQTY=objRS("SPERQTY") PONO=objRS("PONO") DATE1=objRS("date") SHIPDATE=objRS("shipdate") SCSNO=objRS("SCSNO") SMOD=objRS("SMOD") objRs("Total")=objRs("Total")-trim(n_qty_Arr(i))*trim(o_sper_Arr(i)) objRS("Avail")=objRS("Avail")-trim(n_qty_Arr(i))*trim(o_sper_Arr(i)) objRs("SPACKQTY")=objRs("SPACKQTY")-TRIM(n_qty_Arr(i)) objRS("STOTALCTN")=objRs("STOTALCTN")-TRIM(n_qty_Arr(i)) objRS.updatebatch end if objRS.close set objRS=nothing sql="SELECT * FROM dbStockKeep where CUSTCODE='"&CUSTNO&"' and DIVCODE='"&DIVINO&"' and STOCKCODE='"&STOCKNO&"' and SMOD=N'"&SMOD&"' and LOCCODE='"&trim(n_loc_Arr(i))&"' and pono='"&trim(o_lot_Arr(i))&"' AND SCSNO='"&trim(o_cs_Arr(i))&"' AND DATE='"&trim(o_dat_Arr(i))&"' AND SHIPDATE='"&trim(o_ship_Arr(i))&"' AND SPERQTY='"&trim(o_sper_Arr(i))&"' order by CUSTCODE desc" Set objRS = Server.CreateObject("ADODB.Recordset") objRS.Open sql,objCoet,1,4 if not objRS.eof then objRs("Total")=objRs("Total")+trim(n_qty_Arr(i))*TRIM(o_sper_Arr(i)) objRS("Avail")=objRS("Avail")+trim(n_qty_Arr(i))*TRIM(o_sper_Arr(i)) objRS("STOTALCTN")=objRs("STOTALCTN")+trim(n_qty_Arr(i)) objRs("SPACKQTY")=objRs("SPACKQTY")+trim(n_qty_Arr(i)) objRS.updatebatch else stryear=year(now) objRS.Addnew objRS("YEAR")=stryear objRS("LOCCODE")=trim(n_loc_Arr(i)) objRS("LOCDESC")=trim(n_locdesc_Arr(i)) objRS("STOCKCODE")=STOCKNO objRS("STOCKNAME")=STOCKNAME objRS("SMOD")=SMOD objRS("CUSTCODE")=CUSTNO objRS("CUSTNAME")=CUSTNAME objRS("DIVCODE")=DIVINO objRS("SHIPDATE")=TRIM(o_ship_Arr(i)) objRS("STOTALCTN")=trim(n_qty_Arr(i)) objRs("SPACKQTY")=trim(n_qty_Arr(i)) objRs("SHOLDCTN")=0 objRs("PONO")=TRIM(o_lot_Arr(i)) objRs("DATE")=TRIM(o_dat_Arr(i)) objRs("SCSNO")=TRIM(o_cs_Arr(i)) objRs("SMOD")=SMOD objRs("SPERQTY")=TRIM(o_sper_Arr(i)) objRs("Total")=trim(n_qty_Arr(i))*TRIM(o_sper_Arr(i)) objRS("Avail")=trim(n_qty_Arr(i))*TRIM(o_sper_Arr(i)) objRS("Onhold")=0 objRS("CDATE")=now objRS.updatebatch end if objRS.close set objRS=nothing next call JSResultOutPut("Stock Relocation successfully !",2,"Relocating.asp") end if%><html><head><title>SANTOH HK Limited</title><meta http-equiv="Content-Type" content="text/html; charset=Shift-Jis"><script language="Javascript" src="../include/windowstatus.js"></script><script language="JavaScript" src="../include/date-picker.js"></script><link rel="stylesheet" href="../include/css.css"><script LANGUAGE="JavaScript"><!--function popWindow(){window.open('../Public/SearchC.asp?custno='+document.thisform.CUSTNO.value+'&typeid=CusCode','','toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=700,height=450,left=0,top=0');}function CheckCustNOISBlank(){with (document.thisform) { if (CUSTNO.value==""){alert("Pls Input a Customer Code first!"),CUSTNO.focus()} else {window.open('../Public/SearchD.asp?custno='+CUSTNO.value+'&Divno='+DIVINO.value+'&typeid=DivCode','','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=700,height=450,left=0,top=0');} }}function CheckISBlank(){with (document.thisform) { if (CUSTNO.value=="" || DIVINO.value=="") {alert("Pls Input a Customer Code And Division Code first!"),STOCKNO.focus()} else {window.open('../Public/SearchS.asp?CCode='+CUSTNO.value+'&DCode='+DIVINO.value+'&StockNO='+STOCKNO.value+'&typeid=StockCode','','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=700,height=450,left=0,top=0');} }}function ChoiceSelect(type,value){with (document.thisform){ var SelectArr=value.split("|~|"); switch (type) { case "CusCode": CUSTNO.value=SelectArr[0]; CUSTNAME.value=SelectArr[1]; break; case "DivCode": DIVINO.value=SelectArr[0]; DIVIDESC.value=SelectArr[1]; break; case "StockCode": STOCKNO.value=SelectArr[0]; STOCKNAME.value=SelectArr[1]; SMOD.value=SelectArr[16]; break; case "NewLoc": var i=parseInt(SelectArr[2]); var j=SelectArr[0]; if (i<0) { if (oTable.rows[1].cells[1].innerText.indexOf(j)=="-1") {RelForm.n_LOC.value=j; RelForm.n_locdesc.value=SelectArr[1]; RelForm.n_QTY.focus(); } else {alert("Cannot relocate to the same location?"); RelForm.select.checked=false; RelForm.n_QTY.value=""; } } else { if (oTable.rows[i+1].cells[1].innerText.indexOf(j)=="-1") { RelForm.n_LOC.value=j; RelForm.n_locdesc.value=RelForm.n_locdesc.value+SelectArr[1]+","; RelForm.n_QTY.focus(); } else { alert("Cannot relocate to the same location?"); RelForm.select.checked=false; RelForm.n_QTY.value=""; } } break; }}}function check(theform){with (document.thisform){ if (CUSTNO.value==""){alert("The Customer Code Cannot Be Blank!");CUSTNO.focus();return false;} if (DIVINO.value==""){alert("The Divison Code Cannot Be Blank!");DIVINO.focus();return false;} if (STOCKNO.value==""){alert("Please Stock Code Cannot Be Blank!");STOCKNO.focus();return false;} op.value="DoSearch"; return true;}}function ChoiceNewLOC(i){with (document.RelForm){ if (select.length>1) { if (select.checked) {window.open('../Public/SearchL.asp?sid='+i+'&typeid=NewLoc','','toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=700,height=450,left=50,top=50');} else {n_LOC.value="";n_QTY.value=""} } else {window.open('../Public/SearchL.asp?sid=-1&typeid=NewLoc','','toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=700,height=450,left=50,top=50')}}}java script:window.history.forward(1); function SubmitForm(){with (document.RelForm){ if (select.length>0) { for (i=0;i<select.length;i++) { if (select.checked) { if (isNaN(n_QTY.value) || n_QTY.value=="") {alert("Enter number,please");n_QTY.focus();return false;} if (parseInt(oTable.rows[i+1].cells[11].innerText)<n_QTY.value) {alert("Relocation QTY cannot greater than the Avail QTY.");n_QTY.focus();return false;} o_loc.value=o_loc.value+oTable.rows[i+1].cells[1].innerText+","; o_dat.value=o_dat.value+oTable.rows[i+1].cells[3].innerText+","; o_lot.value=o_lot.value+oTable.rows[i+1].cells[4].innerText+","; o_cs.value=o_cs.value+oTable.rows[i+1].cells[5].innerText+","; o_ship.value=o_ship.value+oTable.rows[i+1].cells[6].innerText+","; o_sper.value=o_sper.value+oTable.rows[i+1].cells[8].innerText+","; n_loc.value=n_loc.value+n_LOC.value+","; n_qty.value=n_qty.value+n_QTY.value+","; } } if (o_loc.value=="") {alert("Don't forget the selection box,Thanks");return false;} } else { if (select.checked) { if (isNaN(n_QTY.value) || n_QTY.value=="") {alert("Enter number,please");n_QTY.focus();return false;} if (parseInt(oTable.rows[1].cells[11].innerText)<n_QTY.value) {alert("Relocation QTY cannot greater than the Avail QTY.");n_QTY.focus();return false;} o_loc.value=oTable.rows[1].cells[1].innerText+","; o_dat.value=oTable.rows[1].cells[3].innerText+","; o_lot.value=oTable.rows[1].cells[4].innerText+","; o_cs.value=oTable.rows[1].cells[5].innerText+","; o_ship.value=oTable.rows[1].cells[6].innerText+","; o_sper.value=oTable.rows[1].cells[8].innerText+","; n_loc.value=n_LOC.value+","; n_qty.value=n_QTY.value+","; } else {alert("Don't forget the selection box,Thanks");return false;} }}}//--></SCRIPT><style type="text/css"><!--.STYLE1 { font-size: 16pt; color: #CCCCCC;}.STYLE2 { color: #000000; font-weight: bold;}.STYLE9 {font-size: 12px; font-family: Arial, Helvetica, sans-serif; font-weight: bold; }.STYLE11 { font-size: 10pt; font-weight: bold; color: #FFFFFF;}.STYLE20 {color: #000000; font-weight: bold; font-size: 12px; font-family: Arial, Helvetica, sans-serif; }.STYLE22 {font-size: 12px; font-family: Arial, Helvetica, sans-serif; }.STYLE24 { font-size: 12; color: #FFFFFF; font-weight: bold;}--></style></head><body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"><!--#include file="../top/top.asp"--><table width="779" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#cccccc"> <tr> <td><table width="777" height="316" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td height="42" valign="top"> <table width="96%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td height="42" bgcolor="#333333"> <div align="center"><span class="STYLE1">Stock Relocation </span></div></td> </tr> </table></td> </tr> <tr> <td valign="top"> <table width="96%" border="1" align="center" cellspacing="0" bordercolor="#666666" bgcolor="#CCCCCC"> <FORM METHOD=POST ACTION="" NAME="thisform" onSubmit="return check()"> <INPUT TYPE="hidden" name="op"><tr> <td width="130" bgcolor="#6A99C8"><span class="STYLE2"><font size="2">Customer Code</font></span></td> <td width="214"> <table width="44%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="25%"><font color="#000080"> <input type="text" name="CUSTNO" value="<%=CUSTNO%>" size="8" style="font-family: Arial; font-size: 10pt" tabindex="1"> </font></td> <td width="75%" id="SearchTD1"><font color="#000080"><a href="java script:popWindow()"><img src="../Images/go_n.gif" border="0"></a></font></td> </tr> </table></td> <td width="372"><font color="#000080" size="2"> <input type="text" name="CUSTNAME" size=49 value="<%=CUSTNAME%>" tabindex="2" style="font-family: Arial; font-size: 10pt" > </font></td> </tr> <tr> <td width="130" bgcolor="#6A99C8"><span class="STYLE2"><font size="2">Division Code</font></span></td> <td width="214"> <table width="48%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="56"><font color="#000080"> <input type="text" name="DIVINO" value="<%=DIVINO%>" size="8" style="font-family: Arial; font-size: 10pt" tabindex="4"> </font></td> <td width="71" id="SearchTD2"><a href="java script:CheckCustNOISBlank()"><img src="../Images/go_n.gif" border="0"></a></td> </tr> </table></td> <td> <input type="text" name="DIVIDESC" size=49 value="<%=DIVIDESC%>" tabindex="5" style="font-family: Arial; font-size: 10pt" > </td> </tr> <tr> <td bgcolor="#6A99C8"><span class="STYLE2"><font size="2" face="Arial">Stock Code</font></span></td> <td colspan="2"><input name="STOCKNO" type="text" id="STOCKNO" style="font-family: Arial; font-size: 10pt" tabindex="1" value="<%=STOCKNO%>" size="20"> <a href="java script:CheckISBlank();"> <img border="0" src="../images/go_n.gif"></a> </td> </tr> <tr> <td bgcolor="#6A99C8"><span class="STYLE2"><font size="2" face="Arial">Stock Name</font></span></td> <td colspan="2"><input name="STOCKNAME" type="text" id="STOCKNAME" style="font-family: Arial; font-size: 10pt" tabindex="2" value="<%=STOCKNAME%>" size=42 ></td> </tr> <tr> <td bgcolor="#6A99C8"><span class="STYLE2"><font size="2" face="Arial">Stock Model </font></span></td> <td colspan="2"><input name="SMOD" type="text" id="SMOD" style="font-family: Arial; font-size: 10pt" tabindex="2" value="<%=SMOD%>" size=42 ></td> </tr> <tr> <td colspan="3"><div align="center"> <input type="submit" value="Submit" name="B1" tabindex="20" style="font-family: Arial; font-size: 8pt; font-weight: bold"> <input type="reset" value=" Reset " name="B2" tabindex="21" style="font-family: Arial;font-size: 8pt; font-weight: bold"> </div></td> </tr></FORM> </table> <%if op="DoSearch" then%> <table width="97%" border="1" align="center" cellspacing="1" bordercolor="#666666" bgcolor="#CCCCCC" id="oTable"> <FORM METHOD=POST ACTION="" NAME="RelForm" onSubmit="return SubmitForm();"> <INPUT TYPE="hidden" name="action" value="DoRelocation"> <INPUT TYPE="hidden" name="o_loc"> <INPUT TYPE="hidden" name="o_dat"> <INPUT TYPE="hidden" name="o_lot"> <INPUT TYPE="hidden" name="o_cs"> <INPUT TYPE="hidden" name="o_ship"> <INPUT TYPE="hidden" name="o_sper"> <INPUT TYPE="hidden" name="n_locdesc"> <INPUT TYPE="hidden" name="n_loc"> <INPUT TYPE="hidden" name="n_qty"> <INPUT TYPE="hidden" name="CUSTNO" value="<%=CUSTNO%>"> <INPUT TYPE="hidden" name="CUSTNAME" value="<%=CUSTNAME%>"> <INPUT TYPE="hidden" name="DIVINO" value="<%=DIVINO%>"> <INPUT TYPE="hidden" name="DIVIDESC" value="<%=DIVIDESC%>"> <INPUT TYPE="hidden" name="STOCKNO" value="<%=STOCKNO%>"> <INPUT TYPE="hidden" name="STOCKNAME" value="<%=STOCKNAME%>"> <INPUT TYPE="hidden" name="SMOD" value="<%=SMOD%>"> <tr bordercolor="#666666" bgcolor="#cc6600"> <td width="40"> <div align="center" class="STYLE9"><font color="#FFFFFF">Select</font></div></td> <td width="92"><span class="STYLE9"><font color="#FFFFFF">Location Code</font></span></td> <td width="76"><span class="STYLE9"><font color="#FFFFFF">Description</font></span></td> <td width="6%" align="center" bgcolor="#CC6600" class="STYLE3"><font color="#FFFFFF" size="2"><strong>Date Code </strong></font></td> <td width="4%" align="center" bgcolor="#CC6600"><font color="#FFFFFF" size="2"><strong>Lot No </strong></font></td> <td width="4%" align="center" bgcolor="#CC6600"><font color="#FFFFFF" size="2"><strong>C/S No </strong></font></td> <td width="8%" align="center" bgcolor="#CC6600"><span class="STYLE7 STYLE11">Shipdate</span></td> <td width="65"><span class="STYLE9"><font color="#FFFFFF">Total Qty</font></span></td> <td width="47"><span class="STYLE9"><font color="#FFFFFF">PerCtn </font></span></td> <td width="59"><span class="STYLE9"><font color="#FFFFFF">Total Ctn</font></span></td> <td width="71"><span class="STYLE9"><font color="#FFFFFF">Onhold Ctn</font></span></td> <td width="59"><span class="STYLE9"><font color="#FFFFFF">Avail Ctn</font></span></td> <td width="91"><span class="STYLE9"><font color="#FFFFFF">New Location</font></span></td> <td width="98"><span class="STYLE9"><font color="#FFFFFF">Relocation Qty</font></span></td> </tr> <% i=0 do while not objRS.eof%> <tr> <td><div align="center"><font color="#000080" size="2"> <input name="select" type="checkbox" value="<%=objRS(0)%>" onClick="java script:ChoiceNewLOC(<%=i%>);"> </font></div></td> <td> <%=objRS(1)%></td> <td> <%=objRS(2)%></td> <td width="6%" height="1" bgcolor="#CECFCE"><span class="STYLE20"> <%=objRS("date")%></span></td> <td width="4%" height="1" bgcolor="#CECFCE"><span class="STYLE20"> <%=objRS("PONO")%></span></td> <td width="4%" height="1" bgcolor="#CECFCE"><span class="STYLE22"><%=objRS("SCSNO")%></span></td> <td width="8%" align="center" bgcolor="#CECFCE"><span class="STYLE22"><%=objRS("SHIPDATE")%></span></td> <td bgcolor="#9C9A9C"> <%=objRS(3)%></td> <td bgcolor="#999999"> <%=objRS(4)%></td> <td bgcolor="#999999"> <%=objRS(7)%></td> <td bgcolor="#999999"> <%=objRS(5)%></td> <td bgcolor="#666666"><span class="STYLE24"><%=objRS(6)%></span></td> <td><input name="n_LOC" type="text" size="10" style="color: #0000FF; background-color: #D4D0C8; font-family: Arial; font-size: 10pt" readonly></td> <td><input name="n_QTY" type="text" size="8"></td> </tr> <%i=i+1objRS.movenextloopobjRS.closeset objRS=nothing%> <tr> <td colspan="14"><div align="center"> <input type="submit" name="Submit" value="Relocate"style="font-family: Arial; font-size: 8pt; font-weight: bold"> </div></td> </tr> </FORM> </table> <%end if%> </td> </tr> </table> </td> </tr><!--#include file="../include/foot.asp"--></table></body></html>Hope some experts here could help me....Many thanks

Link to post
Share on other sites

Hi lokanThis code is too complex for a person who don't understand asp. I can give you simple explanations... If you know something about server scripting, you already know this, but if you don't, I'll tell you. First of all, ASP is executed at the server, after web server receive an http request, ASP dll try to read and execute the commands in the called page . At the top of the code is there a directive "INCLUDE". When ASP read this, the page referred there will be expanded. It will cause that the main page and the referred page is going to read as the same code.ASP is a technology wich can use some programing languages. The language used there is VBScript.In this code, some objects are created. You have to understand how to use this feature.Try to study something about ASP at http://www.w3schools.com/asp/asp_intro.asp. Try to test this code and if need more help, come back here, but focus in a specific point, because this code is too long.I hope it helps you.Antonio

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...