[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[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.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

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!

6.6

setting cookies in asp -urgent

Asked by Suma in Active Server Pages (ASP)

Tags: parselng, showmodaldialog

i want to enforce security in my my prg comprising of asps. the first ASP will read the username and the password which will be remembered by the other ASPs. i want to use cookies to do the above. the following is the ASP that will read the login information:-

<%
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'  default.asp
'
'  This page is where users request authorization for using the
'  application.  If a user has lost his connection to the application
'  he is directed back to this page to login again.
'
'  If a user attempts to login through this page and he does not have
'  an account setup in the database, he will not be able to use any
'  part of the application.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'  This function is called when the page is loaded to check the
'  username and password submitted by the user.
'
'      If the username and password are valid for logging into the
'  database, then access to the application should be granted
'
Option Explicit
Response.Expires = -1   ' Do not cache this page


Login Request("username"), Request("password")

Private Sub Login( username, password )

      ' Currently any username and password is accepted
      ' This procedure needs to be enhanced to enforce the security model
      If Request("Username") <> "" and Request("Password") <> "" Then
            Response.Redirect("mainframe.asp")
      End If

End Sub

%>

<html>
<head>
<title>AIIMS2000(tm) Login...</title>
</head>
<body style="FONT-FAMILY: Verdana; FONT-SIZE: 10pt" topmargin="1" leftmargin="1" background="images/fv_back.gif">

<table border="0" width="100%" cellspacing="0" cellpadding="4" height="412">
  <tr>
    <td width="100%" style="COLOR: #ffffff" bgcolor="#000000" height="79" background="images/bannerbg.bmp" style="background-repeat:no-repeat;">
            <p><img border="0" src="images/bannertitle.gif"></p>
    </td>
  </tr>
  <tr>
    <td width="100%" height="317" >
    <form method="post" action="Default.asp">
    <table border="0" cellpadding=2 cellspacing=0 style="background-color: #c0c0c0; font-family: Verdana; font-size: 10pt; border: 1px solid #000000" align=center>
      <TR><TH color="#ffffff" bgcolor=navy colspan=2><P align=left style="COLOR: white">Login...</P></TH></TR>
      <tr>
        <td height=40>&nbsp;User Name</td>
        <td height=40><input name="Username">&nbsp;</td>
      </tr>
      <tr>
        <td height=40>&nbsp;Password</td>
        <td height=40><input name="Password" type="password"> </td>
      </tr>
      <tr><td colspan=2 align=right><input type="submit" value="Login..." name="login"></td>
      </tr>
     </table>
     </form>
   </td></tr>
</table>

</body>
</html>


the following is the ASP that will remember the password read by the login ASP.:-

<%
OPTION EXPLICIT
Response.Expires = -1

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' This page performs all of the ASSET CRUD functions.
'
'
' Functions implemented in Phase I
'
'      1) Create New Asset Records
'      2) Edit existing asset records
'      3) View an asset's history
'      4) Delete an asset record
'
' Functions to be added:
'
'      5) Reclass
'      6) Improve
'      7) Transfer
'      8) Dispose
'      9) View Image
'
' Besides all of these functions, this page also defines the user-
' interface for viewing asset records.  
'
' This ASP is particularly large and should be broken into several
' smaller pages.  There should be one page to display the asset
' record and Each additional page should perform an action on a record
' and then call Redirect() to load the asset back into the frame.
'
' If the functions that have to be added to this page are not separated
' into new pages, this page will grow to nearly 2000 lines which is too
' large to maintain efficiently.
'            
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
%>

<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Asset Record</title>
<base target="_self">
</head>

<script language=vbscript><!--

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'' Record Locator Tags are dynamically generated by this Visual Basic
'' Code.  The RLT is a random ten digit number.
''
Sub setRLT()
      
      Dim mbRet, strNum  'value returned by msgbox / new rlt
      mbRet = 6 '

      If Len(assetForm("rlt").value) > 0 Then
            mbRet = MsgBox("This record already has an RLT set. " & _
            " (RLTs should only be changed if the physical label has been replaced on the asset!)" & _
                        Chr(13) & Chr(10) & Chr(13) & Chr(10) & "Are you certain you want to change it?", _
                        vbYesNoCancel, "Change RLT?")
      End If

      If mbRet = 6 Then
            Randomize
            strNum = CStr(Round(CDbl(Rnd * 9999999999 + 1)))
            While Len(strNum) < 10
                  strNum = "0" & strNum
            Wend
            assetForm("rlt").value = strNum
            assetForm("chrlt").value = 1
      End If
      
End Sub

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'' After quantity has been entered, uniticost and totalcost must be updated.
''
Sub blurQuantity()

      Dim qt, tc, uc
      qt = CLng( "0" & assetForm("quantity").value )            ' Quantity
      uc = CDbl( "0" & assetForm("showunitcost").value )      ' Unit Cost
      tc = CDbl( "0" & assetForm("showtotalcost").value )      ' Total Cost
      
      If qt <= 0 Then            ' Don't allow a quantity less than 1
            qt = 1
            assetForm("quantity").value = 1
      End If
      
      If uc > 0 Then
            tc = qt * uc
            assetForm("totalcost").value = FormatNumber(tc,2,true,false,true)
            assetForm("showtotalcost").value = tc
      ElseIf tc > 0 Then
            uc = tc / qt
            assetForm("unitcost").value = FormatNumber(uc,2,true,false,true)
            assetForm("showunitcost").value = uc
      Else
            assetForm("unitcost").value = 0
            assetForm("totalcost").value = 0
            assetForm("showunitcost").value = "0.00"
            assetForm("showtotalcost").value = "0.00"
      End If
             
End Sub

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Cost should be selected(hilited) when it receives focus.
'
Private Sub focusCost()
      window.event.srcElement.select
End Sub

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' After unit cost has been changed, total cost must be re-computed.
'
Sub blurUnitCost()

      Dim qt, tc, uc
      qt = CLng( "0" & assetForm("quantity").value )
      uc = CDbl( "0" & assetForm("showunitcost").value )
      tc = CDbl( "0" & assetForm("showtotalcost").value )

      If qt <= 0 Then
            qt = 1
            assetForm("quantity").value = "1"
      End If
      
      If uc < 0 Then
            assetForm("totalcost").value = "0"
            assetForm("showtotalcost").value = "0.00"
      ElseIf uc >= 0 Then
            tc = qt * uc
            assetForm("totalcost").value = tc
            assetForm("showtotalcost").value = FormatNumber(tc,2,true,false,true)
      End If
      
      assetForm("showunitcost").value = FormatNumber(uc,2,true,false,true)
      
End Sub

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' After total cost has been changed, unit cost must be recomputed.
'
Sub blurTotalCost()

      Dim qt, tc, uc
      
      qt = CLng( "0" & assetForm("quantity").value )
      uc = CDbl( "0" & assetForm("showunitcost").value )
      tc = CDbl( "0" & assetForm("showtotalcost").value )

      If qt <= 0 Then
            assetForm("quantity").value = "1"
            qt = 1
      End If
      
      If tc < 0 Then
            assetForm("showtotalcost").value = "0.00"
      ElseIf tc >= 0 Then
            uc = tc / qt
            assetForm("showunitcost").value = FormatNumber(uc,2,true,false,true)
      End If
      
      assetForm("showtotalcost").value = FormatNumber(tc,2,true,false,true)
      
End Sub

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Format replacement cost with two decimal places.
'
Sub blurReplacementCost()
      Dim rc
      rc = CDbl("0" & assetForm("rplcmntcost").value)
      assetForm("rplcmntcost").value = FormatNumber(rc,2,true,false,true)
End Sub

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Format Salvage Value with two decimal places.
'
Sub blurSalvageValue()
      Dim sv
      sv = CDbl( "0" & assetForm("salvagevalue").value )
      assetForm("salvagevalue").value = FormatNumber(sv,2,true,false,true)
End Sub

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Called when the user assigns an account to an asset record.
'
' Note that this Sub is dependent on parseLng(), parseStr() and parseStr2
' These functions extract values from a string returned by the dialog box.
'
Sub showAccountSearch()

      Dim retVal
      retVal = showModalDialog("../../setup/account/accountsearch/account_search.asp","","dialogHeight:400px; dialogWidth:550px; center:yes; help:no; status:no; resizable:yes;")
      If Not IsNull(retVal) Then
            If "::CLEAR::" = retVal Then ' The user has cleared the field
                  assetForm("accountid").value = 0
                  assetForm("account").value = ""
                  assetForm("acctdescription").innerText = ""
            Else ' The user has assigned an account from the dialog
                  assetForm("accountid").value = parseLng(retVal)
                  assetForm("account").value = parseStr(retVal)
                  assetForm("acctdescription").innerText = parseStr2(retVal)
            End If
            assetForm.chaccount.value = 1 ' This field must be set to 1 to be saved
      End If

End Sub

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Called when the user assigns a fund to an asset record.
'
Sub showFundDlg()

      Dim sFeatures, retVal
      sFeatures = "dialogHeight:300px; dialogWidth:250px; center:yes; help:no; status:no; resizable:yes; scrollbars:no"
      retVal = showModalDialog("lookupfields/lookup_fund.asp","","dialogHeight:300px; dialogWidth:250px; center:yes; help:no; status:no; resizable:yes; scrollbars:no")
      
      If Not IsNull(retVal) Then
            If retVal = "::CLEAR::" Then
                  assetForm("fundid").value = 0
                  assetForm("fund").value = ""
            Else
                  assetForm("fundid").value = parseLng(retVal)
                  assetForm("fund").value = parseStr(retVal)
            End If
            assetForm("chfund").value = 1 ' This field must be set to 1 to be saved
      End If

End Sub

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Called when the user attempts to assign a new Department
'
Sub showDepartmentDlg()

      Dim retVal
      retVal = showModalDialog("lookupfields/lookup_department.asp","","dialogHeight:300px; dialogWidth:400px; center:yes; help:no; status:no; resizable:yes; scrollbars:no;")
      
      If Not IsNull(retVal) Then
            If retVal = "::CLEAR::" Then ' The user has requested that this field should be cleared
                  assetForm("departmentid").value = 0
                  assetForm("department").value = ""
            Else ' The user has assigned a department
                  assetForm("departmentid").value = parseLng(retVal)
                  assetForm("department").value = parseStr(retVal)
            End If
            assetForm("chdepartment").value = 1 ' This field must be set to 1 to be saved
      End If
End Sub

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Called when a user attempts to assign a new Division
'
Sub showDivisionDlg()

      Dim retVal, strURL

      ' If a department is already assigned, only select from divisions under
      ' the assigned department.
      strURL = "lookupfields/lookup_division.asp"
      If Not IsNull(assetForm("departmentid").value) Then
            strURL = strURL & "?department=" & assetForm("departmentid").value
      End If
      
      retVal = showModalDialog(strURL,"","dialogHeight:300px; dialogWidth:400px; center:yes; help:no; status:no; resizable:yes; scrollbars:no;")
      If Not IsNull(retVal) Then
            If retVal = "::CLEAR::" Then ' The user has requested that this field is cleared
                  assetForm("divisionid").value = 0
                  assetForm("division").value = ""
            Else ' The user has assigned a new Division.
                  assetForm("divisionid").value = parseLng(retVal)
                  assetForm("division").value = parseStr(retVal)
            End If
            assetForm("chdivision").value = 1 ' This field must be set to 1 to be saved
      End If
      
End Sub

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Called when the user attempts to assign a new Organization to an asset record
'
Sub showOrganizationDlg()

      Dim retVal, strURL

      ' If this record is already assigned to a a division, show only orgs that belong
      ' to the assigned division.
      strURL = "lookupfields/lookup_organization.asp"
      If Not IsNull(assetForm("divisionid").value) Then
            strURL = strURL & "?division=" & assetForm("divisionid").value
      End If

      retVal = showModalDialog(strURL,"","dialogHeight:300px; dialogWidth:400px; center:yes; help:no; status:no; resizable:yes; scrollbars:no;")
      if Not IsNull(retVal) Then
            If retVal = "::CLEAR::" Then ' User has requested that this field should be cleared.
                  assetForm("organizationid").value = 0
                  assetForm("organization").value = ""
            Else ' User has assigned a new organization
                  assetForm("organizationid").value = parseLng(retVal)
                  assetForm("organization").value = parseStr2(retVal)
            End If
            assetForm("chorganization").value = 1 ' This field must be set to 1 to be saved
      End If
End Sub

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Called when a user attempts to assign a new value to Location
'
Sub showLocationDlg()

      Dim retVal
      retVal = showModalDialog("lookupfields/lookup_location.asp","","dialogHeight:300px; dialogWidth:400px; center:yes; help:no; status:no; resizable:yes; scrollbars:no;")

      if Not IsNull(retVal) Then
            If retVal = "::CLEAR::" Then ' User has requested this field should be cleared
                  assetForm("locationid").value = 0
                  assetForm("txtlocation").value = ""
            Else ' User has assigned a new location
                  assetForm("locationid").value = parseLng(retVal)
                  assetForm("txtlocation").value = parseStr(retVal)
            End If
            assetForm("chlocation").value = 1
      End If

End Sub

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Called when user attempts to assign a facility
'
Sub showFacilityDlg()

      Dim retVal      
      retVal = showModalDialog("lookupfields/lookupfacility/facility_frame.asp","","dialogHeight:300px; dialogWidth:400px; center:yes; help:no; status:no; resizable:yes; scrollbars:no;")
      
      if Not IsNull(retVal) Then
            If retVal = "::CLEAR::" Then ' User requests clear this field
                  assetForm("facilityid").value = 0
                  assetForm("facility").value = ""
            Else ' User has assigned new Facility
                  assetForm("facilityid").value = parseLng(retVal)
                  assetForm("facility").value = parseStr2(retVal)
            End If
            assetForm("chfacility").value = 1 ' This field must be set to 1 to be saved
      End If
      
End Sub

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Called when user attempts to change the condition field
'
Sub showConditionDlg()

      Dim retVal
      retVal = showModalDialog("lookupfields/lookup_condition.asp","","dialogHeight:250px; dialogWidth:350px; center:yes; help:no; status:no; resizable:yes; scrollbars:no;")
      
      if Not IsNull(retVal) Then
            If retVal = "::CLEAR::" Then ' User requests clear this field
                  assetForm("conditionid").value = 0
                  assetForm("condition").value = ""
            Else ' User has assigned a new Condition
                  assetForm("conditionid").value = parseLng(retVal)
                  assetForm("condition").value = parseStr(retVal)
            End If
            assetForm("chcondition").value = 1 ' This field must be set to 1 to be saved
      End If
End Sub

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Called when user attempts to assign a new Status
'
Sub showStatusDlg()
      
      Dim retVal
      retVal = showModalDialog("lookupfields/lookup_status.asp","","dialogHeight:250px; dialogWidth:350px; center:yes; help:no; status:no; resizable:yes; scrollbars:no;")
      
      if Not IsNull(retVal) Then
            If retVal = "::CLEAR::" Then ' User requests clear this field
                  assetForm("statusid").value = 0
                  assetForm("status").value = ""
            Else ' User has assigned a new Status
                  assetForm("statusid").value = parseLng(retVal)
                  assetForm("status").value = parseStr(retVal)
            End If
            assetForm("chstatus").value = 1 ' This field must be set to 1 to be saved
      End If
End Sub

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Called when user attempts to save changes to a record
'
Sub onSaveRecord()

      dim vali_date, valid_service
      if (CStr(assetForm("mfgyear").value) = "") then
            vali_date = 0
      else
            if not validate then
                  msgbox "You must enter a valid 4 digit Mfg. Year and resave"
                  vali_date = 1
            end if
      end if
      
      if (CStr(assetForm("servicedate").value) = "") then
            valid_service = 0
      else
            if not validservice then
                  msgbox "You must enter the service date in the MM/DD/YYYY format and resave"
                  valid_service = 1
            end if
      end if
      
      if not isvalid  then
            MsgBox "You must enter a valid ACCOUNT, FUND, RLT, PONUMBER, QUANTITY, UNITCOST, TOTALCOST and SERIAL NUMBER in order to save a record."
      elseif vali_date = 1 then
            vali_date = vali_date + 1
      elseif valid_service = 1 then
            valid_service = valid_service + 1
      else
            assetForm("action").value = "Save"
            assetForm.submit()
      End If

End Sub

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Called when the user attempts to delete an asset record
'
Sub onDeleteAsset()

      ' If we're in the middle of creating a new asset, don't delete anything!
      If assetForm("action").value = "New" Then
            MsgBox "No record to delete."
            Exit Sub
      End If

      ' Prompt the user to be certain about the deletion
      If assetForm("assetid") <> "" Then
            If vbYes = MsgBox("Are you sure you want to delete this record?  You cannot get back what you delete!",vbYesNoCancel,"Delete?") Then
                  assetForm("action").value = "Delete"
                  assetForm.submit
            End If
      End If

End Sub

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Called when the user attempts to open an asset's history data dialog
'
Sub showHistory()

      ' If there's no asset selected, or we're in the middle of creating a new record
      ' don't show history.
      If assetForm.action.value = "New" Then
            MsgBox "Cannot show history while creating a record."
      Else
            Dim strURL
            strURL = "history/history.asp?assetid=" & assetForm("assetid").value
            showModalDialog strURL,"","dialogHeight:400px; dialogWidth:610px; center:yes; help:no; status:no; resizable:yes;"
      End If
      
End Sub

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Not implemented in phase 1
'
Sub showImage()
      Dim sFeatures
      sFeatures = "dialogHeight:400px; dialogWidth:375px; center:yes; help:no; status:no;"
      showModalDialog "asset_image.asp","",sFeatures
End Sub

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Called to determine if the manufactured date has been properly entered.
'
' Returns False if the date entered is a character.
'
function validate()

      dim i
      i = Asc(assetForm("mfgyear").value)
      If ((i < 48) Or (i > 57)) Then
            validate = false
      else
            validate = true
      end if
      if validate = true then
            i = len(assetForm("mfgyear").value)
            if i < 4 then
                  validate = false
            else
                  validate = true
            end if
      end if
      
end function

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Called to determine if the serviced date has been properly entered.
'
' Returns False if the date entered is a character.
'
function validservice()

      dim i
      i = Asc(assetForm("servicedate").value)
      If ((i < 48) Or (i > 57)) Then
            validservice = false
      else
            validservice = true
      end if
      if validservice = true then
            i = len(assetForm("servicedate").value)
            if i < 10 then
                  validservice = false
            else
                  validservice = true
            end if
      end if
      
end function

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Called to determine if all required field of an asset record have been
' entered.
' It also checks if the manufactured date has been correctly entered
' Returns True if all required fields are entered, or False if not.
'
Function isValid()
      
      If (CStr(assetForm("accountid").value) <> "") and _
         (CStr(assetForm("fundid").value) <> "") and _
         (CStr(assetForm("rlt").value) <> "") and _
         (CStr(assetForm("ponumber").value) <> "") and _
         (CStr(assetForm("quantity").value) <> "") and _
         (CStr(assetForm("totalcost").value) <> "") and _
         (CStr(assetForm("serial").value) <> "") _
      Then  
            isValid = true
      Else
          isValid = False
      End If

End Function

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' For each field that is changed, the corresponding CHfieldname field
' must be updated so the field is saved when the form is submitted.
'
Sub onChangeRLT()
      assetForm.chrlt.value = 1
End Sub

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' For each field that is changed, the corresponding CHfieldname field
' must be updated so the field is saved when the form is submitted.
'
Sub onChangeSublocation()
      assetForm.chsublocation.value = 1
End Sub

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' For each field that is changed, the corresponding CHfieldname field
' must be updated so the field is saved when the form is submitted.
'
Sub onChangeShopNo()
      assetForm.chshopno.value = 1
End Sub

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' For each field that is changed, the corresponding CHfieldname field
' must be updated so the field is saved when the form is submitted.
'
Sub onChangeVendor()
      assetForm.chvendor.value = 1
End Sub

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' For each field that is changed, the corresponding CHfieldname field
' must be updated so the field is saved when the form is submitted.
'
Sub onChangeManufacturer()
      assetForm.chmanufacturer.value = 1
End Sub

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' For each field that is changed, the corresponding CHfieldname field
' must be updated so the field is saved when the form is submitted.
'
Sub onChangeMfgYear()
      assetForm.chmfgyear.value = 1
End Sub

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' For each field that is changed, the corresponding CHfieldname field
' must be updated so the field is saved when the form is submitted.
'
Sub onChangeModel()
      assetForm.chmodel.value = 1
End Sub

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' For each field that is changed, the corresponding CHfieldname field
' must be updated so the field is saved when the form is submitted.
'
Sub onChangeSerial()
      assetForm.chserial.value = 1
End Sub

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' For each field that is changed, the corresponding CHfieldname field
' must be updated so the field is saved when the form is submitted.
'
Sub onChangeRplCost()
      assetForm.chrplcost.value = 1
End Sub

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' For each field that is changed, the corresponding CHfieldname field
' must be updated so the field is saved when the form is submitted.
'
Sub onChangeSublocation()
      assetForm.chsublocation.value = 1
End Sub

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' For each field that is changed, the corresponding CHfieldname field
' must be updated so the field is saved when the form is submitted.
'
Sub onChangeSlvgValue()
      assetForm.chslvgvalue.value = 1
End Sub

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' For each field that is changed, the corresponding CHfieldname field
' must be updated so the field is saved when the form is submitted.
'
Sub onChangeParentRLT()
      assetForm.chparentrlt.value = 1
End Sub

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' For each field that is changed, the corresponding CHfieldname field
' must be updated so the field is saved when the form is submitted.
'
Sub onChangeNotes()
      assetForm.chnotes.value = 1
End Sub

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' For each field that is changed, the corresponding CHfieldname field
' must be updated so the field is saved when the form is submitted.
'
Sub onChangePONumber()
      assetForm.chponumber.value = 1
End Sub

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' For each field that is changed, the corresponding CHfieldname field
' must be updated so the field is saved when the form is submitted.
'
Sub onChangeInvoiceNo()
      assetForm.chinvoiceno.value = 1
End Sub

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' For each field that is changed, the corresponding CHfieldname field
' must be updated so the field is saved when the form is submitted.
'
Sub onChangeServiceDate()
      assetForm.chservicedate.value = 1
End Sub

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' For each field that is changed, the corresponding CHfieldname field
' must be updated so the field is saved when the form is submitted.
'
Sub onChangeQuantity()
      assetForm.chquantity.value = 1
      assetForm.chcost.value = 1
End Sub

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' For each field that is changed, the corresponding CHfieldname field
' must be updated so the field is saved when the form is submitted.
'
Sub onChangeCost()
      assetForm.chcost.value = 1
End Sub

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' All of the popup dialogs on this page return a value that must be parsed.
' The value that is returned is a string in the form of "NUMBER1:STRING1:STRING2".
' This function reads the number and returns it as a Long.
'
Function parseLng( v )

      Dim dPos, nLen
      nLen = Len(v)
      dPos = InStr(1,v,":")
      parseLng = CLng(Left(v,dPos-1))

End Function

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' All of the popup dialogs on this page return a value that must be parsed.
' The value that is returned is a string in the form of "NUMBER1:STRING1:STRING2".
' This function reads the first String and returns it as a String.
'
Function parseStr( v )

      Dim dPos1, dPos2, nLen
      dPos1 = InStr(1,v,":")
      dPos2 = InStr(dPos1+1,v,":")
      nLen = dPos2 - dPos1
      parseStr = Mid(v,dPos1+1,nLen-1)

End Function

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' All of the popup dialogs on this page return a value that must be parsed.
' The value that is returned is a string in the form of "NUMBER1:STRING1:STRING2".
' This function reads the second String and returns it as a String.
'
Function parseStr2( v )
      
      Dim dPos1, dPos2, nLen
      dPos1 = InStr(1,v,":")
      dPos2 = InStr(dPos1+1,v,":")
      nLen = Len(v) - dPos2
      parseStr2 = Right(v,nLen)

End Function

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' When the asset_record.asp page is loaded, it may take a few moments
' to display because it is so large.  There is a message on the page
' that says, "PLEASE WAIT" until the page is loaded.  When the page is
' loaded, this message should be hidden.  This Sub hides the message.
'
Sub initPage()
      waitmsg.style.display = "none"
End Sub

'-->
</script>

<body bgcolor="#808080" topmargin="10" style="FONT-FAMILY: Verdana; FONT-SIZE: 10pt" text ="#ffffff" onload="initPage">

<P id="waitmsg" align="center">-- PLEASE WAIT --</p>

<%

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' This function returns a new, unique 9 digit number used as the primary
' key for history records or transaction history records.
'
Function getNewID()

      Randomize
      
      Dim strNum
      strNum = CStr(Round(CDbl(Rnd * 999999999)))
      While Len(strNum) < 9
            strNum = "0" & strNum
      Wend
      getNewID = strNum

End Function

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Add a new record to the primary asset table
'
' This procedure constructs a SQL query which calls a stored procedure:
' sp_AddAsset().  This stored procedure creates a new asset record in
' the Asset table.
'
Private Sub SaveAsset()

      Dim strQuery
      strQuery = ""
      
      strQuery = "begin sp_AddAsset(" & Request("assetid") & ","
      If Request("assetid") = ""      Then strQuery = strQuery & getNewID & "," Else strQuery = strQuery & Request("assetid") & "," End If
      If Request("accountid") = ""    Then strQuery = strQuery & "null," Else strQuery = strQuery & Request("accountid") & "," End If
      If Request("fundid") = ""            Then strQuery = strQuery & "null," Else strQuery = strQuery & Request("fundid") & "," End If
      strQuery = strQuery & "1," 'If Request("quantity") = ""            Then strQuery = strQuery & "1," Else strQuery = strQuery & Request("quantity") & "," End If
      If CDbl(Request("totalcost")) = CDbl(0.0) Then strQuery = strQuery & "null," Else strQuery = strQuery & Request("totalcost") & "," End If
      If Request("parent") = ""       Then strQuery = strQuery & "null," Else strQuery = strQuery & "'" & Request("parent") & "'," End If
      strQuery = strQuery & "'AIIMS2000 User Interface',"
      If Request("acqmethodid") = ""  Then strQuery = strQuery & "null," Else strQuery = strQuery & Request("acqmethodid") & "," End If
      If Request("dispmethodid") = "" Then strQuery = strQuery & "null," Else strQuery = strQuery & Request("dispmethodid") & "," End if
      If Request("departmentid") = "" Then strQuery = strQuery & "null," Else strQuery = strQuery & Request("departmentid") & "," End If
      If Request("divisionid") = ""   Then strQuery = strQuery & "null," Else strQuery = strQuery & Request("divisionid") & "," End If
      If Request("organizationid")="" Then strQuery = strQuery & "null," Else strQuery = strQuery & Request("organizationid") & "," End If
      If Request("facilityid") = ""   Then strQuery = strQuery & "null," Else strQuery = strQuery & Request("facilityid") & "," End If
      If Request("locationid") = ""   Then strQuery = strQuery & "null," Else strQuery = strQuery & Request("locationid") & "," End If
      If Request("sublocation") = ""  Then strQuery = strQuery & "null," Else strQuery = strQuery & "'" & Request("sublocation") & "'," End If
      If Request("conditionid") = ""  Then strQuery = strQuery & "null," Else strQuery = strQuery & Request("conditionid") & "," End If
      If Request("statusid") = ""     Then strQuery = strQuery & "null," Else strQuery = strQuery & Request("statusid") & "," End If
      If Request("capital") = ""      Then strQuery = strQuery & "0,"    Else strQuery = strQuery & Request("capital") & "," End If
            Dim ReplCost
            ReplCost = CInt(Request("rplcmntcost"))      
      If Request("rplcmntcost") = ""      Then strQuery = strQuery & "null," Else strQuery = strQuery & ReplCost & "," End If
      If Request("salvagevalue") = "" Then strQuery = strQuery & "null," Else strQuery = strQuery & Request("salvagevalue") & "," End If
      If Request("rlt") = ""          Then strQuery = strQuery & "null," Else strQuery = strQuery & "'" & Request("rlt") & "'," End If
      If Request("vendor") = ""       Then strQuery = strQuery & "null," Else strQuery = strQuery & "'" & Request("vendor") & "'," End If
      If Request("manufacturer") = "" Then strQuery = strQuery & "null," Else strQuery = strQuery & "'" & Request("manufacturer") & "'," End If
      If Request("mfgyear") = ""      Then
            strQuery = strQuery & "null,"
      Else
            dim yearmfg
            yearmfg = DatePart("yyyy", Request("mfgyear"))
            if yearmfg <= "1905" then
                  yearmfg = Request("mfgyear")
            else
                  yearmfg = yearmfg
            end if
            strQuery = strQuery & "'" & yearmfg & "',"
      End If
      If Request("warrantyexp") = ""  Then strQuery = strQuery & "null," Else strQuery = strQuery & Request("warrantyexp") & "," End If
      If Request("model") = ""        Then strQuery = strQuery & "null," Else strQuery = strQuery & "'" & Request("model") & "'," End If
      If Request("shopno") = ""       Then strQuery = strQuery & "null," Else strQuery = strQuery & "'" & Request("shopno") & "'," End If
      If Request("serial") = ""       Then strQuery = strQuery & "null," Else strQuery = strQuery & "'" & Request("serial") & "'," End If      
      If Request("invoiceno") = ""      Then strQuery = strQuery & "null," Else strQuery = strQuery & "'" & Request("invoiceno") & "'," End If
      If Request("ponumber") = ""            Then strQuery = strQuery & "null," Else strQuery = strQuery & "'" & Request("ponumber") & "'," End If
      strQuery = strQuery & "null,"
      If Request("servicedate") = ""  Then
            strQuery = strQuery & "null,"
      Else
            dim dateserviced, monthserviced, dayserviced
            dateserviced = DatePart("yyyy", Request("servicedate"))
            monthserviced = DatePart("m", Request("servicedate"))
            dayserviced = DatePart("d", Request("servicedate"))
            if (dateserviced = "2000") then
                  dateserviced = monthserviced & "/" & dayserviced & "/" & "2000"
            else
                  dateserviced = Request("servicedate")
            End If
            strQuery = strQuery & "'" & dateserviced & "',"
      End If
      strQuery = strQuery & "null,"
      If Request("usage") = ""        Then strQuery = strQuery & "null," Else strQuery = strQuery & "'" & Request("usage") & "'," End If
      If Request("notes") = ""        Then strQuery = strQuery & "null); end;" Else strQuery = strQuery & "'" & Request("notes") & "'); end;" End If

Dim x
x = Time
Response.Write("Before Database")      
Response.Write(x)
      
Dim  RecordSet, Divid, OraSession, OraDatabase, strQuery1
 
      Dim retcode
      retcode = OraDatabase.ExecuteSQL(strQuery)
      
      If (1 = retcode) Then
            strQuery = "begin sp_AddHistoryItem(" & getNewID & "," & Request("assetid") & ",'','','','Record created by user interface.'" &  "); end;"
            OraDatabase.ExecuteSQL strQuery
      End If
      
x = Time      
Response.Write("After SP")
Response.Write(x)
      
End Sub

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Delete the previously selected asset and blank out all the fields
'
Private Sub DeleteAsset()
Dim  RecordSet, Divid, OraSession, OraDatabase, strQuery
Set OraSession = CreateObject("OracleInProcServer.XOraSession")
session("user") = Request.From("user")
session("pass") = Request.Form("pass")  
Set OraDatabase = OraSession.OpenDatabase("AIIMS2K.Orlando", session("user") & "/" & session("pass"), 0)
      
      strQuery = "begin sp_DeleteAsset(" & Request("assetid") & "); end;"
      OraDatabase.ExecuteSQL strQuery
End Sub


''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Save changes made to the current record and report any errors
'
Private Sub UpdateAsset()

      Dim strQuery, nAssetID, strReason
Dim  RecordSet, Divid, OraSession, OraDatabase
Set OraSession = CreateObject("OracleInProcServer.XOraSession")
session("user") = Request.Form("user")
session("pass") = Request.Form("pass")
Set OraDatabase = OraSession.OpenDatabase("AIIMS2K.Orlando", session("user") & "/" & session("pass"), 0)

      nAssetID = Request("assetid")
      strReason = "Updated by user interface."
      
      If Request("chaccount") = 1 Then
            strQuery = "begin sp_ChangeAccount(" & getNewID & "," & nAssetID & "," & Request("accountid") & ",'" & strReason & "'); end;"
            OraDatabase.ExecuteSQL strQuery
      End If

      If Request("chfund") = 1 Then      
            strQuery = "begin sp_ChangeFund(" & getNewID & "," & nAssetID & "," & Request("fundid") & ",'" & strReason & "'); end;"
            OraDatabase.ExecuteSQL strQuery
      End If

      If Request("chrlt") = 1 Then      
            strQuery = "begin sp_ChangeRLT(" & nAssetID & "," & Request("rlt") & "," & getNewID & ",'" & strReason & "'); end;"
            OraDatabase.ExecuteSQL strQuery
      End If

      If Request("chrplcost") = 1 Then      
            Dim ReplCost
            ReplCost = CInt(Request("rplcmntcost"))      
            strQuery = "begin sp_ChangeReplacementCost(" & getNewID & "," & nAssetID & ",'" & ReplCost & "','" & strReason & "'); end;"
            OraDatabase.ExecuteSQL strQuery
      End If
      
      If Request("chslvgvalue") = 1 Then
            strQuery = "begin sp_ChangeSalvageValue(" & nAssetID & ",'" & Request("salvagevalue") & "'," & getNewID & ",'" & strReason & "'); end;"
            OraDatabase.ExecuteSQL strQuery
      End If

      If Request("chnotes") = 1 Then
            strQuery = "begin sp_ChangeNotes(" & nAssetID & ",'" & Request("notes") & "'," & getNewID & ",'" & strReason & "'); end;"
            OraDatabase.ExecuteSQL strQuery
      End If
      
      If Request("chdepartment") = 1 Then
            strQuery = "begin sp_ChangeDepartMent(" & nAssetID & "," & getNewID & "," & Request("departmentid") & ",'" & strReason & "'); end;"
            OraDatabase.ExecuteSQL strQuery
      End If

      If Request("chdivision") = 1 Then      
            strQuery = "begin sp_ChangeDivision(" & nAssetID & "," & getNewID & "," & Request("divisionid") & ",'" & strReason & "'); end;"
            OraDatabase.ExecuteSQL strQuery
      End If

      If Request("chorganization") = 1 Then      
            strQuery = "begin sp_ChangeOrganization(" & getNewID & "," & nAssetID & "," & Request("organizationid") & ",'" & strReason & "'); end;"
            OraDatabase.ExecuteSQL strQuery
      End If
      
      If Request("chfacility") = 1 Then
            strQuery = "begin sp_ChangeFacility(" & getNewID & "," & nAssetID & "," & Request("facilityid") & ",'" & strReason & "'); end;"
            OraDatabase.ExecuteSQL strQuery
      End If
      
      If Request("chlocation") = 1 Then
            strQuery = "begin sp_ChangeLocation(" & getNewID & "," & nAssetID & ","
            If Request("locationid") <> "" Then strQuery = strQuery & Request("locationid") Else strQuery = strQuery & "null" End If
            strQuery = strQuery & ",'" & strReason & "'); end;"
            OraDatabase.ExecuteSQL strQuery
      End If
      
      If Request("chsublocation") = 1 Then
            strQuery = "begin sp_ChangeSublocation(" & getNewID & "," & nAssetID & ",'" & Request("sublocation") & "','" & strReason & "'); end;"
            OraDatabase.ExecuteSQL strQuery
      End If

      If Request("chparentrlt") = 1 Then
            strQuery = "begin sp_ChangeParentRLT(" & getNewID & "," & nAssetID & ",'" & Request("parentrlt") & "','" & strReason & "'); end;"
            OraDatabase.ExecuteSQL strQuery
      End If
      
      If Request("chshopno") = 1 Then
            strQuery = "begin sp_ChangeShopNumber(" & getNewID & "," & nAssetID & ",'" & Request("shopno") & "','" & strReason & "'); end;"
            OraDatabase.ExecuteSQL strQuery
      End If

      If Request("chvendor") = 1 Then
            strQuery = "begin sp_ChangeVendor(" & getNewID & "," & nAssetID & ",'" & Request("vendor") & "','" & strReason & "'); end;"
            OraDatabase.ExecuteSQL strQuery
      End If

      If Request("chmanufacturer") = 1 Then
            strQuery = "begin sp_ChangeManufacturer(" & getNewID & "," & nAssetID & ",'" & Request("manufacturer") & "','" & strReason & "'); end;"
            OraDatabase.ExecuteSQL strQuery
      End If

      If Request("chmfgyear") = 1 Then
            strQuery = "begin sp_ChangeMfgYear(" & getNewID & "," & nAssetID & ",'" & Request("mfgyear") & "','" & strReason & "'); end;"
            OraDatabase.ExecuteSQL strQuery
      End If

      If Request("chmodel") = 1 Then
            strQuery = "begin sp_ChangeModel(" & getNewID & "," & nAssetID & ",'" & Request("model") & "','" & strReason & "'); end;"
            OraDatabase.ExecuteSQL strQuery
      End If

      If Request("chserial") = 1 Then      
            strQuery = "begin sp_ChangeSerialNumber(" & getNewID & "," & nAssetID & ",'" & Request("serial") & "','" & strReason & "'); end;"
            OraDatabase.ExecuteSQL strQuery
      End If
      
      If Request("chcondition") = 1 Then
            strQuery = "begin sp_ChangeCondition(" & getNewID & "," & nAssetID & "," & Request("conditionid") & ",'" & strReason & "'); end;"
            OraDatabase.ExecuteSQL strQuery
      End If
      
      If Request("chstatus") = 1 Then
            strQuery = "begin sp_ChangeStatus(" & getNewID & "," & nAssetID & "," & Request("statusid") & ",'" & strReason & "'); end;"
            OraDatabase.ExecuteSQL strQuery
      End If
      
      If Request("chponumber") = 1 Then
            strQuery = "begin sp_ChangePONumber(" & getNewID & "," & nAssetID & ",'" & Request("ponumber") & "','" & strReason & "'); end;"
            OraDatabase.ExecuteSQL strQuery
      End If
      
      If Request("chinvoiceno") = 1 Then
            strQuery = "begin sp_ChangeInvoiceNo(" & getNewID & "," & nAssetID & ",'" & Request("invoiceno") & "','" & strReason & "'); end;"
            OraDatabase.ExecuteSQL strQuery
      End If
      
      If Request("chcost") = 1 Then
            strQuery = "begin sp_ChangeCost(" & getNewID & "," & nAssetID & ",'" & Request("totalcost") & "','" & strReason & "'); end;"
            OraDatabase.ExecuteSQL strQuery
      End If
      
      If Request("chquantity") = 1 Then
            strQuery = "begin sp_ChangeQuantity(" & getNewID & "," & nAssetID & "," & Request("quantity") & ",'" & strReason & "'); end;"
            OraDatabase.ExecuteSQL strQuery
      End If
            
End Sub

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' This function was written to prevent a lot of duplicate code within
' the form in the body of this web page.
'
Function getFieldValue( name )

      If Recordset(name) = "" Then ' There may not be an open recordset
            getFieldValue = ""
      Else ' There is an open recordset, if the specified field has a value, return it
            getFieldValue = Recordset(name)
      End If

End Function

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' When the user saves a record, he may be saving a new record or updating
' an existing record.  If the record exists, it should be updated, if the
' record does not exist, it should be created.
'
' This function determines if the record submitted by the assetForm exists
' by querying the database for the record.
'
Function AssetExists( id )

Dim  RecordSet, Divid, OraSession, OraDatabase, strQuery
Set OraSession = CreateObject("OracleInProcServer.XOraSession")
session("user") = Request.Form("user")
Session("pass") = Request.From("pass")
Set OraDatabase = OraSession.OpenDatabase("AIIMS2K.Orlando", session("user") & "/" & session("pass"), 0)

      strQuery = "select count(*) assetCount from asset where assetid = " & id
      Set Recordset = OraDatabase.DbCreateDynaset(strQuery,0)
      
      If Recordset("assetCount") > 0 Then
            AssetExists = True
      Else
            AssetExists = False
      End If

End Function

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' This block of code is always executed when this page is loaded.  Therefore,
' it is not enclosed in a Sub block.
'
' The Action field in the assetform determines what function will be performed
' when the form is submitted.  If the action is "save" the record will either
' be created or updated depending on whether the record exists in the database.
' If action is "Delete" then the record is deleted from the database.
'
Select Case Request("action")

      Case "Save" ' Called to save a new asset in the database      
            If AssetExists(Request("assetid")) Then
                  UpdateAsset
            Else
                  SaveAsset
            End If

      Case "Delete" ' Called to delete an asset
            DeleteAsset
            
      Case Else
            ' If this is the beginning of a new asset, do nothing but
            ' leave the fields in the form blank.

End Select

Dim x
x = Time
Response.Write("Before Qry Db")
Response.Write(x)

Dim  RecordSet, Divid, OraSession, OraDatabase, strQuery
Set OraSession = CreateObject("OracleInProcServer.XOraSession")
'Session("user") = "system"
'Session("pass") = "manager"
Response.Write(session("user"))

Session("user") = Request.Form("user")
Session("pass") = Request.Form("pass")
Set OraDatabase = OraSession.OpenDatabase("AIIMS2K.Orlando", session("user") & "/" & session("pass"), 0)

If Len(Request("assetid")) > 0 Then
      strQuery = "select * from qry_assetview where assetid = " & Request("assetid")
Else
      strQuery = "select * from qry_assetview where assetid = 0"
End If

Set Recordset = OraDatabase.DbCreateDynaset( strQuery, 0)

x = Time
Response.Write("After Qry Db")
Response.Write(x)

%>

<form id=assetForm action="asset_record.asp" target="_self">
<%
      x = Time
      Response.Write("Before HTML")
      Response.Write(x)
%>
 <input type=hidden name=action                value="<%=Request("Action")%>">
 <input type=hidden name=assetid        value="<%If Request("Action") = "New" Then Response.Write(getNewID) Else Response.Write(getFieldValue("assetid"))%>">
 <input type=hidden name=acqmethodid    value="<%=getFieldValue("acquisitionmethodid")%>">
 <input type=hidden name=dispmethodid   value="<%=getFieldValue("disposalmethodid")%>">
 <input type=hidden name=departmentid   value="<%=getFieldValue("departmentid")%>">
 <input type=hidden name=divisionid     value="<%=getFieldValue("divisionid")%>">
 <input type=hidden name=organizationid value="<%=getFieldValue("organizationid")%>">
 <input type=hidden name=facilityid     value="<%=getFieldValue("facilityid")%>">
 <input type=hidden name=locationid     value="<%=getFieldValue("locationid")%>">
 <input type=hidden name=statusid       value="<%=getFieldValue("statusid")%>">
 <input type=hidden name=conditionid    value="<%=getFieldValue("conditionid")%>">
 <input type=hidden name=accountid      value="<%=getFieldValue("accountid")%>">
 <input type=hidden name=fundid         value="<%=getFieldValue("fundid")%>">
 <input type=hidden name=unitcost            value="<%=getFieldValue("unitcost")%>">
 <input type=hidden name=totalcost            value="<%=getFieldValue("totalcost")%>">

 <input type=hidden name=chcost                  value="0">  
 <input type=hidden name=chrplcost            value="0">
 <input type=hidden name=chslvgvalue      value="0">
 <input type=hidden name=chacqmethod      value="0">
 <input type=hidden name=chdispmethod      value="0">
 <input type=hidden name=chdepartment      value="0">
 <input type=hidden name=chdivision            value="0">
 <input type=hidden name=chorganization      value="0">
 <input type=hidden name=chfacility            value="0">
 <input type=hidden name=chlocation            value="0">
 <input type=hidden name=chstatus            value="0">
 <input type=hidden name=chcondition      value="0">
 <input type=hidden name=chaccount            value="0">
 <input type=hidden name=chfund                  value="0">
 <input type=hidden name=chtotalcost      value="0">
 <input type=hidden name=chunitcost            value="0">
 <input type=hidden name=chquantity            value="0">
 <input type=hidden name=chrlt                  value="0">
 <input type=hidden name=chsublocation      value="0">
 <input type=hidden name=chparentrlt      value="0">
 <input type=hidden name=chshopno            value="0">
 <input type=hidden name=chvendor            value="0">
 <input type=hidden name=chmanufacturer      value="0">
 <input type=hidden name=chmfgyear            value="0">
 <input type=hidden name=chmodel            value="0">
 <input type=hidden name=chserial            value="0">
 <input type=hidden name=chponumber            value="0">
 <input type=hidden name=chinvoiceno      value="0">
 <input type=hidden name=chservicedate  value="0">
 <input type=hidden name=chnotes            value="0">
 
<table border="0" width="100%" style="font-family: Verdana; font-size: 8pt" cellspacing="0" cellpadding="0">
 <tr>
  <td align="left" nowrap valign="top" width="10%">
   <p align="right"><b>Account<font color="#ff0000">*&nbsp;&nbsp;</font></b></p>
  </td>
  <td nowrap valign="top">
   <table border="0" width="100%" cellspacing="0" cellpadding="0">
    <tr>
     <td width="90%"><input id="account" value="<%=getFieldValue("AccountNumber")%>" title="<%=getFieldValue("AccountNumber")%>"
      style="font-family: Arial; font-size: 8pt; position: relative; width: 100%; border-style: solid; border-width: 1" tabindex="1" readOnly name="account" size="12"></td>
     <td width="10%"><input onclick="showAccountSearch" type=button value="..."  tabindex="2" height="18" name="btnAccount"
      style="font-family: ar; font-size: 8pt; height: 18px; position: relative; width: 18px; border-style: solid; border-width: 1; margin-left: 1"></td>
    </tr>
   </table>
  </td>
  <td nowrap rowspan="2" valign="top" width="10%" align="right">
   <p align="right">&nbsp;Acct. Desc.&nbsp;&nbsp;&nbsp;</p>
  </td>
  <td nowrap colspan="3" rowspan="2">
   <TEXTAREA name=acctdescription readOnly rows=2 tabIndex=3 cols="20"
    style="font-family: Arial; font-size: 8pt; position: relative; width: 100%; border: 1px solid #000000"><%=getFieldValue("AccountDescription")%></TEXTAREA>
  </td>
  </tr>
  <tr>
   <td nowrap width="10%">
    <p align="right"><b>Fund<font color="#ff0000">*&nbsp;&nbsp;</font></b></p>
   </td>
   <td nowrap>
    <table border="0" width="100%" cellspacing="0" cellpadding="0">
     <tr>
      <td width="90%"><input style="font-family: Arial; font-size: 8pt; position: relative; width: 100%; border: 1px solid #000000" tabindex="4" name="fund" value="<%=getFieldValue("FundNumber")%>" size="12"></td>
      <td width="10%"><input type=button name="btnFund" value="..." onclick="showFundDlg()" style="font-size: 8pt; height: 18px; position: relative; width: 18px; border: 1px solid #000000; margin-left: 1px" tabindex="5" height="18"></td>
     </tr>
    </table>
   </td>
  </tr>
  <tr>
   <td align="left" nowrap width="10%">
    <p align="right"><b>RLT#<font color="#ff0000">*&nbsp;&nbsp;</font></b></p>
   </td>
   <td nowrap>
    <table border="0" width="100%" cellspacing="0" cellpadding="0">
     <tr>
      <td width="90%">
      <input name="rlt" maxlength="10" value="<%=getFieldValue("rlt")%>" onkeypress="onChangeRLT" style="font-family: Arial; font-size: 8pt; position: relative; width: 100%; border-style: solid; border-width: 1px" title="<%=getFieldValue("rlt")%>" tabindex="6" size="12" ></td>
      <td width="10%"><input name="btnRLT" language="vbscript" onclick="setRLT" type=button value="..." style="font-family: ar; font-size: 8pt; height: 18px; position: relative; width: 18px; border: 1px solid #000000; margin-left: 1px" tabindex="7" height="18"></td>
     </tr>
    </table>
   </td>
   <td nowrap width="10%" align="right">&nbsp;Service Date&nbsp;&nbsp;</td>
   <td nowrap width="15%">
    <input name="servicedate" tabindex="16" size="25" maxlength="20" value="<%=getFieldValue("servicedate")%>" title="<%=getFieldValue("servicedate")%>" onkeypress="onChangeServiceDate"
     style="font-family: Arial; font-size: 8pt; position: relative; border: 1px solid #000000">
   </td>
   <td nowrap width="10%" align="right">&nbsp;Shop No.&nbsp;&nbsp;</td>
   <td nowrap width="15%">
   <input name="shopno" tabindex="30" maxlength="32" value="<%=getFieldValue("shopnumber")%>" title="<%=getFieldValue("shopnumber")%>" onkeypress="onChangeShopNo"
    style="BORDER-BOTTOM: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; FONT-FAMILY: Arial; FONT-SIZE: 8pt; POSITION: relative; WIDTH: 100%"></td>
  </tr>
  <tr>
   <td align="left" nowrap width="10%">
    <p align="right"><b>PO Number<font color="#ff0000">*&nbsp;&nbsp;</font></b></p>
   </td>
   <td nowrap width="15%">
    <input maxlength="32" name="ponumber" tabindex="8" size="16" value="<%=getFieldValue("ponumber")%>" title="<%=getFieldValue("ponumber")%>" onkeypress="onChangePONumber"
     style="font-family: Arial; font-size: 8pt; position: relative; text-align: right; width: 100%; border-style: solid; border-width: 1px">
   </td>
   <td nowrap width="10%" align="right">&nbsp;Department&nbsp;&nbsp;</td>
   <td nowrap>
    <table border="0" width="100%" cellspacing="0" cellpadding="0">
     <tr>
      <td width="90%"><input value="<%=getFieldValue("department")%>" title="<%=getFieldValue("department")%>" style="font-family: Arial; font-size: 8pt; position: relative; border: 1px solid #000000" tabindex="17" name="department" readOnly size="21"></td>
      <td width="10%"><input type=button value="..." onclick="showDepartmentDlg()" style="font-family: ar; font-size: 8pt; height: 18px; position: relative; width: 18px; border: 1px solid #000000; margin-left: 1px" tabindex="18" height="18"></td>
     </tr>
    </table>
   </td>
   <td nowrap width="10%" align="right">&nbsp;Vendor&nbsp;&nbsp;</td>
   <td nowrap width="15%"><input maxlength="32" value="<%=getFieldValue("vendor")%>" title="<%=getFieldValue("vendor")%>" onkeypress="onChangeVendor" style="BORDER-BOTTOM: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; FONT-FAMILY: Arial; FONT-SIZE: 8pt; POSITION: relative; WIDTH: 100%" name="vendor" tabindex="31" ></td>
  </tr>
  <tr>
   <td align="left" nowrap width="10%">
    <p align="right">&nbsp;Invoice No.&nbsp;&nbsp;</p>
   </td>
   <td nowrap width="15%">
    <input maxlength="32" value="<%=getFieldValue("invoicenumber")%>" title="<%=getFieldValue("invoicenumber")%>" onkeypress="onChangeInvoiceNo" style="font-family: Arial; font-size: 8pt; position: relative; text-align: right; width: 100%; border-style: solid; border-width: 1px" name="invoiceno" tabindex="9" size="16">
   </td>
   <td nowrap width="10%" align="right">&nbsp;Division&nbsp;&nbsp;</td>
   <td nowrap>
    <table border="0" width="100%" cellspacing="0" cellpadding="0">
     <tr>
      <td width="90%"><input value="<%=getFieldValue("division")%>" title="<%=getFieldValue("division")%>" style="font-family: Arial; font-size: 8pt; position: relative; border: 1px solid #000000" tabindex="19" name="division" readonly size="21"></td>
      <td width="10%"><input onclick="showDivisionDlg()" type=button value="..." style="font-family: ar; font-size: 8pt; height: 18px; position: relative; width: 18px; border: 1px solid #000000; margin-left: 1px" tabindex="20" height="18"></td>
     </tr>
    </table>
   </td>
   <td nowrap width="10%" align="right">&nbsp;Manufacturer&nbsp;&nbsp;</td>
   <td nowrap width="15%"><input maxlength="32" value="<%=getFieldValue("manufacturer")%>" title="<%=getFieldValue("manufacturer")%>" onkeypress="onChangeManufacturer" style="BORDER-BOTTOM: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; FONT-FAMILY: Arial; FONT-SIZE: 8pt; POSITION: relative; WIDTH: 100%" name="manufacturer" tabindex="32" ></td>
  </tr>
  <tr>
   <td align="left" nowrap width="10%">
    <p align="right">
    <b>
    Quantity<font color="#ff0000">*&nbsp;&nbsp;</font></b></p>
   </td>
   <td nowrap width="15%">
    <p align="right"><input maxlength="9" value="<%=getFieldValue("quantity")%>" title="<%=getFieldValue("quantity")%>" onkeypress="onChangeQuantity" style="font-family: Arial; font-size: 8pt; position: relative; text-align: right; width: 100%; border-style: solid; border-width: 1px" name="quantity" tabindex="10" onblur="blurQuantity" size="16" disabled></p>
   </td>
   <td nowrap width="10%" align="right">&nbsp;Organization&nbsp;&nbsp;</td>
   <td nowrap>
    <table border="0" width="100%" cellspacing="0" cellpadding="0">
     <tr>
      <td width="90%"><input value="<%=getFieldValue("organization")%>" title="<%=getFieldValue("organization")%>" style="font-family: Arial; font-size: 8pt; position: relative; border: 1px solid #000000" tabindex="21" name="organization" readOnly size="21"></td>
      <td width="10%"><input onclick="showOrganizationDlg()" type=button value="..." style="font-family: ar; font-size: 8pt; height: 18px; position: relative; width: 18px; border: 1px solid #000000; margin-left: 1px" tabindex="22" height="18"></td>
     </tr>
    </table>
   </td>
   <td nowrap width="10%" align="right">&nbsp;Mfg. Year&nbsp;&nbsp;</td>
   <td nowrap width="15%"><input value="<%=getFieldValue("mfgyear")%>" title="<%=getFieldValue("mfgyear")%>" onkeypress="onChangeMfgYear" style="BORDER-BOTTOM: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; FONT-FAMILY: Arial; FONT-SIZE: 8pt; POSITION: relative; WIDTH: 100%" name="mfgyear" tabindex="33" ></td>
  </tr>
  <tr>
   <td align="left" nowrap width="10%">
    <p align="right">
    <b>
    Unit Cost<font color="#ff0000">*&nbsp;&nbsp;</font></b></p>
   </td>
   <td nowrap width="15%">
     <p align="right">
     <input maxlength="15" value="<%=getFieldValue("unitcost")%>" title="<%=getFieldValue("unitcost")%>" onkeypress="onChangeCost" name="showunitcost" tabindex="11" maxlength="11" onblur="blurUnitCost" onfocus="focusCost"
      style="font-family: Arial; font-size: 8pt; position: relative; text-align: right; width: 100%; border-style: solid; border-width: 1px" size="16"></p>
   </td>
   <td nowrap width="10%" align="right">&nbsp;Facility&nbsp;&nbsp;</td>
   <td nowrap>
    <table border="0" width="100%" cellspacing="0" cellpadding="0">
     <tr>
      <td width="90%"><input value="<%=getFieldValue("facility")%>" title="<%=getFieldValue("facility")%>" style="font-family: Arial; font-size: 8pt; position: relative; border: 1px solid #000000" tabindex="23" name="facility" readOnly size="21"></td>
      <td width="10%"><input onclick="showFacilityDlg()" type=button value="..." style="font-family: ar; font-size: 8pt; height: 18px; position: relative; width: 18px; border: 1px solid #000000; margin-left: 1px" tabindex="24" height="18"></td>
     </tr>
    </table>
   </td>
   <td nowrap width="10%" align="right">&nbsp;Model No.&nbsp;&nbsp;</td>
   <td nowrap width="15%"><input maxlength="32" value="<%=getFieldValue("model")%>" title="<%=getFieldValue("model")%>" onkeypress="onChangeModel" style="BORDER-BOTTOM: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; FONT-FAMILY: Arial; FONT-SIZE: 8pt; POSITION: relative; WIDTH: 100%" name="model" tabindex="34" ></td>
  </tr>
  <tr>
    <td align="left" nowrap width="10%">
    <p align="right"><b>Total Cost<font color="#ff0000">*&nbsp;&nbsp;</font></b></p>
    </td>
    <td nowrap width="15%"><p align="right">
     <input maxlength="15" name="showtotalcost" value="<%=getFieldValue("totalcost")%>" title="<%=getFieldValue("totalcost")%>" onkeypress="onChangeCost" onfocus="focusCost" onblur="blurTotalCost"
      style="font-family: Arial; font-size: 8pt; position: relative; text-align: right; width: 100%; border-style: solid; border-width: 1px" tabindex="12" size="16"></p></td>
    <td nowrap width="10%" align="right">&nbsp;Location&nbsp;&nbsp;</td>
    <td nowrap>
     <table border="0" width="100%" cellspacing="0" cellpadding="0">
      <tr>
       <td width="90%"><input value="<%=getFieldValue("location")%>" title="<%=getFieldValue("location")%>" name="txtlocation" style="font-family: Arial; font-size: 8pt; position: relative; border: 1px solid #000000" readOnly tabindex="25" size="21" ></td>
       <td width="10%"><input type=button value="..." onclick="showLocationDlg()" style="font-family: ar; font-size: 8pt; height: 18px; position: relative; width: 18px; border: 1px solid #000000; margin-left: 1px" tabindex="26" height="18" name=btnLocation></td>
      </tr>
     </table>
    </td>
    <td nowrap width="10%" align="right"><b><font color="#ff0000">&nbsp;</font>Ser./VIN No.</b><font color="#ff0000"><b>*</b>&nbsp;&nbsp;</font></td>
    <td nowrap width="15%"><input maxlength="32" value="<%=getFieldValue("serialnumber")%>" title="<%=getFieldValue("serialnumber")%>" onkeypress="onChangeSerial" style="BORDER-BOTTOM: 1px solid; BORDER-LEFT: 1px solid; BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; FONT-FAMILY: Arial; FONT-SIZE: 8pt; POSITION: relative; WIDTH: 100%" name="serial" tabindex="35"></td>
  </tr>
  <tr>
    <td nowrap width="10%">
      <p align="right">&nbsp;Rplcmnt Cost&nbsp;&nbsp;</p>
    </td>
    <td nowrap width="15%"><input name="rplcmntcost" id="rplcmntcost" onblur="blurReplacementCost" value="<%=getFieldValue("replacementcost")%>" onkeypress="onChangeRplCost" style="font-family: Arial; font-size: 8pt; position: relative; text-align: right; width: 100%; border: 1px solid #000000" size="16" tabindex="13"></td>
    <td nowrap width="10%" align="right">&nbsp;Sub-Location&nbsp;&nbsp;</td>
    <td nowrap width="15%"><input maxlength="32" value="<%=getFieldValue("sublocation")%>" title="<%=getFieldValue("sublocation")%>" onkeypress="onChangeSublocation" style="font-family: Arial; font-size: 8pt; position: relative; border: 1px solid #000000" name="sublocation" tabindex="27" size="25" ></td>
    <td nowrap width="10%" align="right">&nbsp;Condition&nbsp;&nbsp;</td>
    <td nowrap>
    <table border="0" width="100%" cellspacing="0" cellpadding="0">
      <tr>
       <td width="90%"><input value="<%=getFieldValue("condition")%>" title="<%=getFieldValue("condition")%>" name="condition" style="BORDER-BOTTOM: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; FONT-FAMILY: Arial; FONT-SIZE: 8pt; POSITION: relative; WIDTH: 100%" readOnly tabindex="36" size="20" ></td>
       <td width="10%"><input type=button value="..." onclick="showConditionDlg()" style="BORDER-BOTTOM: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; FONT-FAMILY: ar; FONT-SIZE: 8pt; HEIGHT: 18px; MARGIN-LEFT: 1px; POSITION: relative; WIDTH: 20px" tabindex="37" height="18" name=btnCondition></td>
      </tr>
     </table>
    </td>
  </tr>
  <tr>
    <td align="left" nowrap width="10%">
      <p align="right">&nbsp;Salvage Value&nbsp;&nbsp;</p>
    </td>
    <td nowrap width="15%">
    <input disabled name="salvagevalue" tabindex="14" maxlength="15" size="16" onblur="blurSalvageValue" value="<%=getFieldValue("salvagevalue")%>" title="<%=getFieldValue("salvagevalue")%>" onkeypress="onChangeSlvgValue"
     style="font-family: Arial; font-size: 8pt; position: relative; text-align: right; width: 100%; background-color: #C0C0C0; border: 1px solid #000000"></td>
    <td nowrap width="10%" align="right">&nbsp;Parent RLT&nbsp;&nbsp;</td>
    <td nowrap width="15%"><input disabled value="<%=getFieldValue("parentrlt")%>" title="<%=getFieldValue("parentrlt")%>" onkeypress="onChangeParentRLT" style="font-family: Arial; font-size: 8pt; position: relative; background-color: #C0C0C0; border: 1px solid #000000" tabindex="28" maxlength="10" name="parentrlt" size="25"></td>
    <td nowrap width="10%" align="right">&nbsp;Status&nbsp;&nbsp;</td>
    <td nowrap>
     <table border="0" width="100%" cellspacing="0" cellpadding="0">
      <tr>
       <td width="90%"><input value="<%=getFieldValue("status")%>" title="<%=getFieldValue("status")%>" name="status" style="BORDER-BOTTOM: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; FONT-FAMILY: Arial; FONT-SIZE: 8pt; POSITION: relative; WIDTH: 100%" readOnly tabindex="38" size="20" ></td>
       <td width="10%"><input type=button value="..." onclick="showStatusDlg()" style="BORDER-BOTTOM: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; FONT-FAMILY: ar; FONT-SIZE: 8pt; HEIGHT: 18px; MARGIN-LEFT: 1px; POSITION: relative; WIDTH: 20px" tabindex="39" height="18" name=btnStatus></td>
      </tr>
     </table>
    </td>
  </tr>
  <tr>
    <td align="left" valign="top" nowrap width="10%">
      <p align="right">&nbsp;Notes&nbsp;&nbsp;</p>
    </td>
    <td colspan="5" nowrap><TEXTAREA name=notes maxlength="2000" onkeypress="onChangeNotes" style="BORDER-BOTTOM: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; FONT-FAMILY: Arial; FONT-SIZE: 8pt; POSITION: relative; WIDTH: 100%" tabIndex=15 rows="2" cols="20"><%=getFieldValue("Notes")%></TEXTAREA></td>
  </tr>
</table>

</form>

</body>
</html>
[+][-]08/07/00 12:20 PM, ID: 3820062Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: Active Server Pages (ASP)
Tags: parselng, showmodaldialog
Sign Up Now!
Solution Provided By: Bushweiler
Participating Experts: 2
Solution Grade: C
 
[+][-]08/07/00 12:17 PM, ID: 3820033Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091118-EE-VQP-93