% '
' Customer Entry and Maintenance
'
'Initialize Standard Information
Index = request("Index") ' The last selected Index number
RowId = request("RowId") ' If a record Id was passed
RunReport = (request("RunReport")<>"") ' If run report was selected
%>
<% ' redirects must occur before any html output!
If RunReport then
Response.redirect ("CustomerList.asp?RunReport=1&Index=" & Index)
end if
%>
Customer0
<% ' LoginRights: If 1 user has full rights, if 0 or -1, browse only rights %>
<% LoginRights = request.cookies("Rights") %>
" TYPE="text/css">
<% CheckFieldChange=oCustomer.call("get_peFieldMultiUser") %>
<% ' DebugMode =1 ' uncomment this for page get/post debug help %>
<% If LoginRights = "1" then %>
Customer Entry and Maintenance
<% else %>
Customer Query
<% end if %>
<%
oCustomer.call "set_pbReportErrors", 1 'normally show any errors that occur
'We either find a record, or clear the WBO
If RowId <> "" Then
Err = oCustomer.RequestFindbyRowId( "Customer", RowId)
else
Err = oCustomer.RequestClear("Customer",1)
End if
' process various buttons that might have been pressed.
' only support Post submissions
If request("Request_method")="POST" Then
if Request("clear")<>"" then
Err = oCustomer.RequestClear("Customer",1)
end if
if Request("save")<>"" then
oCustomer.call "set_pbReportErrors", 0
err = oCustomer.RequestSave("Customer")
if err = 0 then
Response.Write("
Customer record saved
")
else
Response.Write("")
Response.Write("
Could not save changes. Errors Occurred
")
oCustomer.call "msg_ReportAllErrors"
Response.Write("")
end if
end if
if Request("delete")<>"" then
oCustomer.call "set_pbReportErrors", 0
Err = oCustomer.RequestDelete("Customer")
if err = 0 then
Response.Write("
The record has been deleted.
")
else
Response.Write("")
Response.Write("
The record could not be deleted.
")
oCustomer.call "msg_ReportAllErrors"
Response.Write("")
end if
end if
if Request("validate")<>"" then
oCustomer.call "set_pbReportErrors", 0
err = oCustomer.RequestDDUpdate("Customer",0)
if Err = 0 then
Response.Write("
Current data is Valid
")
else
Response.Write("")
Response.Write("
Current data is not valid
")
oCustomer.call "msg_ReportAllErrors"
Response.Write("")
end if
end if
' note we use the Index variable we created above
if Request("findprev") <>"" then Err = oCustomer.RequestFind("Customer", Index, LT)
if Request("find") <>"" then Err = oCustomer.RequestFind("Customer", Index, GE)
if Request("findnext") <>"" then Err = oCustomer.RequestFind("Customer", Index, GT)
if Request("findfirst")<>"" then Err = oCustomer.RequestFind("Customer", Index, FIRST_RECORD)
if Request("findlast") <>"" then Err = oCustomer.RequestFind("Customer", Index, LAST_RECORD)
end if
%>
<%
' generate a row for the passed obj and field
' The advantage of this method is you can control your output
' anyway you want and propagate it to all input controls
Sub ShowDataLine (Obj, FileField )
FErr = Obj.DDValue(FileField,DDFIELDERROR)
Response.write("
")
Response.write( "
Doing it with a sub-routine
")
Response.write( "
")
If FErr<>"" then Response.Write("") else Response.Write("")
Response.write( Obj.ddValue(FileField, DDLONGLABEL) & "