<%
'
'    Filename: mld_typeopdrrecord.asp
'    Generated with CodeCharge 2.0.5
'    ASP 2.0 & Templates.ccp build 11/30/2001
'

'-------------------------------
' 
' mld_typeopdrrecord CustomIncludes Event begin
%>
<!-- #INCLUDE FILE="Common.asp" -->
<%
' mld_typeopdrrecord CustomIncludes Event end


'===============================
' Save Page and File Name available into variables
'-------------------------------
sFileName = "mld_typeopdrrecord.asp"
sTemplateFileName = "mld_typeopdrrecord.html"
'===============================


'===============================
' mld_typeopdrrecord PageSecurity begin
' mld_typeopdrrecord PageSecurity end
'===============================

'===============================
' mld_typeopdrrecord Open Event begin
' mld_typeopdrrecord Open Event end
'===============================

'===============================
' mld_typeopdrrecord OpenAnyPage Event begin
' mld_typeopdrrecord OpenAnyPage Event end
'===============================

'===============================
'Save the name of the form and type of action into the variables
'-------------------------------
sAction = GetParam("FormAction")
sForm = GetParam("FormName")
'===============================

' mld_typeopdrrecord Show begin
'===============================
' Perform the form's action
'-------------------------------
' Initialize error variables
'-------------------------------
sTypeOpdrRecordErr = ""

'-------------------------------
' Select the FormAction
'-------------------------------
Select Case sForm
  Case "TypeOpdrRecord"
    TypeOpdrRecordAction(sAction)
end select
'===============================

'===============================
' Display page
'-------------------------------
' Load HTML template for this page
'-------------------------------
LoadTemplate sAppPath & sTemplateFileName, "main"
'-------------------------------
' Load HTML template of Header and Footer
'-------------------------------
'-------------------------------
SetVar "FileName", sFileName


'-------------------------------
' Step through each form
'-------------------------------
TypeOpdrRecord_Show
'-------------------------------
' Process page templates
'-------------------------------
Parse "main", False
'-------------------------------
' Output the page to the browser
'-------------------------------
Response.write PrintVar("main")

' mld_typeopdrrecord Show end

'-------------------------------
' Destroy all object variables
'-------------------------------

' mld_typeopdrrecord Close Event begin
' mld_typeopdrrecord Close Event end

cn.Close
Set cn = Nothing
UnloadTemplate
'===============================
'===============================
' Action of the Record Form
'-------------------------------
Sub TypeOpdrRecordAction(sAction)
'-------------------------------
' Initialize variables  
'-------------------------------
  Dim bExecSQL: bExecSQL = true
  Dim sActionFileName : sActionFileName = ""
  Dim sWhere : sWhere = "" 
  Dim bErr : bErr = False
  Dim pPKMLD_TYPEOPDR_KEY : pPKMLD_TYPEOPDR_KEY = ""
  Dim fldMLD_TYPEOPDR_OMSCHRIJVING : fldMLD_TYPEOPDR_OMSCHRIJVING = ""
  Dim fldMLD_TYPEOPDR_MODULE : fldMLD_TYPEOPDR_MODULE = ""
  Dim fldMLD_TYPEOPDR_DECENTRAAL : fldMLD_TYPEOPDR_DECENTRAAL = ""
  Dim fldMLD_TYPEOPDR_AFMELDEN_EXTERN : fldMLD_TYPEOPDR_AFMELDEN_EXTERN = ""
  Dim fldMLD_TYPEOPDR_KOSTEN : fldMLD_TYPEOPDR_KOSTEN = ""
  Dim fldMLD_TYPEOPDR_SLUITMELDING : fldMLD_TYPEOPDR_SLUITMELDING = ""
  Dim fldMLD_TYPEOPDR_MATCHTYPE : fldMLD_TYPEOPDR_MATCHTYPE = ""
  Dim fldMLD_TYPEOPDR_AFMELDMARGE : fldMLD_TYPEOPDR_AFMELDMARGE = ""
  Dim fldMLD_TYPEOPDR_ZICHTBAARFE : fldMLD_TYPEOPDR_ZICHTBAARFE = ""
  Dim fldMLD_TYPEOPDR_ISOFFERTE : fldMLD_TYPEOPDR_ISOFFERTE = ""
  Dim fldMLD_TYPEOPDR_OFFERTELIMIET : fldMLD_TYPEOPDR_OFFERTELIMIET = ""
  Dim fldMLD_TYPEOPDR_GVS : fldMLD_TYPEOPDR_GVS = ""
  Dim fldMLD_TYPEOPDR_TYPEOPDR_KEY : fldMLD_TYPEOPDR_TYPEOPDR_KEY = ""
  Dim fldMLD_TYPEOPDR_CONTRACT : fldMLD_TYPEOPDR_CONTRACT = ""
  Dim fldMLD_TYPEOPDR_AFHANDELING : fldMLD_TYPEOPDR_AFHANDELING = ""
  Dim fldMLD_TYPEOPDR_KOSTEN_VERPLICHT : fldMLD_TYPEOPDR_KOSTEN_VERPLICHT = ""
'-------------------------------

'-------------------------------
' TypeOpdrRecord Action begin
'-------------------------------
  sActionFileName = "mld_typeopdrgrid.asp"

'-------------------------------
' CANCEL action
'-------------------------------
  if sAction = "cancel" then

'-------------------------------
' TypeOpdrRecord BeforeCancel Event begin
' TypeOpdrRecord BeforeCancel Event end
'-------------------------------
    cn.Close
    Set cn = Nothing
    response.redirect sActionFileName
  end if
'-------------------------------

'-------------------------------
' Build WHERE statement
'-------------------------------
  if sAction = "update" or sAction = "delete" then
    pPKMLD_TYPEOPDR_KEY = GetParam("PK_MLD_TYPEOPDR_KEY")
    if IsEmpty(pPKMLD_TYPEOPDR_KEY) then exit sub
    sWhere = "MLD_TYPEOPDR_KEY=" & ToSQL(pPKMLD_TYPEOPDR_KEY, "Number")
  end if
'-------------------------------


'-------------------------------
' Load all form fields into variables
'-------------------------------
  fldMLD_TYPEOPDR_OMSCHRIJVING = GetParam("MLD_TYPEOPDR_OMSCHRIJVING")
  fldMLD_TYPEOPDR_MODULE = GetParam("MLD_TYPEOPDR_MODULE")
  fldMLD_TYPEOPDR_DECENTRAAL = GetParam("MLD_TYPEOPDR_DECENTRAAL")
  fldMLD_TYPEOPDR_AFMELDEN_EXTERN = GetParam("MLD_TYPEOPDR_AFMELDEN_EXTERN")
  fldMLD_TYPEOPDR_KOSTEN = getCheckBoxValue(GetParam("MLD_TYPEOPDR_KOSTEN"), "1", "0", "Number")
  fldMLD_TYPEOPDR_SLUITMELDING = GetParam("MLD_TYPEOPDR_SLUITMELDING")
  fldMLD_TYPEOPDR_MATCHTYPE = GetParam("MLD_TYPEOPDR_MATCHTYPE")
  fldMLD_TYPEOPDR_AFMELDMARGE = GetParam("MLD_TYPEOPDR_AFMELDMARGE")
  fldMLD_TYPEOPDR_ZICHTBAARFE = getCheckBoxValue(GetParam("MLD_TYPEOPDR_ZICHTBAARFE"), "1", "0", "Number")
  fldMLD_TYPEOPDR_ISOFFERTE = getCheckBoxValue(GetParam("MLD_TYPEOPDR_ISOFFERTE"), "1", "0", "Number")
  fldMLD_TYPEOPDR_OFFERTELIMIET = GetParam("MLD_TYPEOPDR_OFFERTELIMIET")
  fldMLD_TYPEOPDR_GVS = GetParam("MLD_TYPEOPDR_GVS")
  fldMLD_TYPEOPDR_TYPEOPDR_KEY = GetParam("MLD_TYPEOPDR_TYPEOPDR_KEY")
  fldMLD_TYPEOPDR_CONTRACT = GetParam("MLD_TYPEOPDR_CONTRACT")
  fldMLD_TYPEOPDR_AFHANDELING = getCheckBoxValue(GetParam("MLD_TYPEOPDR_AFHANDELING"), "1", "0", "Number")
  fldMLD_TYPEOPDR_KOSTEN_VERPLICHT = GetParam("MLD_TYPEOPDR_KOSTEN_VERPLICHT")

'-------------------------------
' Validate fields
'-------------------------------
  if sAction = "insert" or sAction = "update" then
    if IsEmpty(fldMLD_TYPEOPDR_OMSCHRIJVING) then
      sTypeOpdrRecordErr = sTypeOpdrRecordErr & "De waarde in veld Omschrijving is verplicht.<br>"
    end if
    if not isNumeric(fldMLD_TYPEOPDR_DECENTRAAL) then
      sTypeOpdrRecordErr = sTypeOpdrRecordErr & "De waarde in veld Afmelden is niet correct.<br>"
    end if
    if not isNumeric(fldMLD_TYPEOPDR_AFMELDEN_EXTERN) then
      sTypeOpdrRecordErr = sTypeOpdrRecordErr & "De waarde in veld Afmelder (ORDBO2) mag externe opdrachten: is niet correct.<br>"
    end if
    if not isNumeric(fldMLD_TYPEOPDR_SLUITMELDING) then
      sTypeOpdrRecordErr = sTypeOpdrRecordErr & "De waarde in veld Bijbehorende melding sluiten met laatste opdracht is niet correct.<br>"
    end if
    if not isNumeric(fldMLD_TYPEOPDR_MATCHTYPE) then
      sTypeOpdrRecordErr = sTypeOpdrRecordErr & "De waarde in veld Opdrachtkosten (/Factuur matching) is niet correct.<br>"
    end if
    if not isNumeric(fldMLD_TYPEOPDR_AFMELDMARGE) then
      sTypeOpdrRecordErr = sTypeOpdrRecordErr & "De waarde in veld Marge afmeld-datering (dagen) is niet correct.<br>"
    end if
    if not isNumeric(fldMLD_TYPEOPDR_OFFERTELIMIET) then
      sTypeOpdrRecordErr = sTypeOpdrRecordErr & "De waarde in veld Bedrag waarboven offerte nodig is niet correct.<br>"
    end if
    if not isNumeric(fldMLD_TYPEOPDR_GVS) then
      sTypeOpdrRecordErr = sTypeOpdrRecordErr & "De waarde in veld Goedkeuringsvrijstelling is niet correct.<br>"
    end if
    if not isNumeric(fldMLD_TYPEOPDR_TYPEOPDR_KEY) then
      sTypeOpdrRecordErr = sTypeOpdrRecordErr & "De waarde in veld Opdrachttype na offerte is niet correct.<br>"
    end if
    if not isNumeric(fldMLD_TYPEOPDR_CONTRACT) then
      sTypeOpdrRecordErr = sTypeOpdrRecordErr & "De waarde in veld Contract kiezen bij opdracht van dit type is niet correct.<br>"
    end if
    if not isNumeric(fldMLD_TYPEOPDR_KOSTEN_VERPLICHT) then
      sTypeOpdrRecordErr = sTypeOpdrRecordErr & "De waarde in veld Verplicht opdrachtbedrag vanaf is niet correct.<br>"
    end if
'-------------------------------
' TypeOpdrRecord Check Event begin
if not IsNumeric(fldMLD_TYPEOPDR_OFFERTELIMIET) then
  sTypeOpdrRecordErr = sTypeOpdrRecordErr & "Het bedrag waarboven offerte nodig is moet een nummer zijn!<br>"
else
  if (fldMLD_TYPEOPDR_OFFERTELIMIET < 0) then
    sTypeOpdrRecordErr = sTypeOpdrRecord & "Het bedrag waarboven offerte nodig is moet groter dan nul zijn.<br>"
  end if
end if 

if not IsNumeric(fldMLD_TYPEOPDR_GVS) then
  sTypeOpdrRecordErr = sTypeOpdrRecordErr & "De goedkeuringsvrijstelling moet een nummer zijn!<br>"
else
  if (fldMLD_TYPEOPDR_GVS < 0) then
    sTypeOpdrRecordErr = sTypeOpdrRecord & "De goedkeuringsvrijstelling moet groter dan nul zijn.<br>"
  end if
end if
' TypeOpdrRecord Check Event end
'-------------------------------
    If len(sTypeOpdrRecordErr) > 0 then
      exit sub
    end if
  end if
'-------------------------------


'-------------------------------
' Create SQL statement
'-------------------------------
  select case sAction
    case "insert"
'-------------------------------
' TypeOpdrRecord Insert Event begin
' TypeOpdrRecord Insert Event end
'-------------------------------
      sSQL = "insert into MLD_TYPEOPDR (" & _
          "MLD_TYPEOPDR_OMSCHRIJVING," & _
          "MLD_TYPEOPDR_MODULE," & _
          "MLD_TYPEOPDR_DECENTRAAL," & _
          "MLD_TYPEOPDR_AFMELDEN_EXTERN," & _
          "MLD_TYPEOPDR_KOSTEN," & _
          "MLD_TYPEOPDR_SLUITMELDING," & _
          "MLD_TYPEOPDR_MATCHTYPE," & _
          "MLD_TYPEOPDR_AFMELDMARGE," & _
          "MLD_TYPEOPDR_ZICHTBAARFE," & _
          "MLD_TYPEOPDR_ISOFFERTE," & _
          "MLD_TYPEOPDR_OFFERTELIMIET," & _
          "MLD_TYPEOPDR_GVS," & _
          "MLD_TYPEOPDR_TYPEOPDR_KEY," & _
          "MLD_TYPEOPDR_CONTRACT," & _
          "MLD_TYPEOPDR_AFHANDELING," & _
          "MLD_TYPEOPDR_KOSTEN_VERPLICHT)" & _
          " values (" & _
          ToSQL(fldMLD_TYPEOPDR_OMSCHRIJVING, "Text") & "," & _
          ToSQL(fldMLD_TYPEOPDR_MODULE, "Text") & "," & _
          ToSQL(fldMLD_TYPEOPDR_DECENTRAAL, "Number") & "," & _
          ToSQL(fldMLD_TYPEOPDR_AFMELDEN_EXTERN, "Number") & "," & _
          fldMLD_TYPEOPDR_KOSTEN & "," & _
          ToSQL(fldMLD_TYPEOPDR_SLUITMELDING, "Number") & "," & _
          ToSQL(fldMLD_TYPEOPDR_MATCHTYPE, "Number") & "," & _
          ToSQL(fldMLD_TYPEOPDR_AFMELDMARGE, "Number") & "," & _
          fldMLD_TYPEOPDR_ZICHTBAARFE & "," & _
          fldMLD_TYPEOPDR_ISOFFERTE & "," & _
          ToSQL(fldMLD_TYPEOPDR_OFFERTELIMIET, "Number") & "," & _
          ToSQL(fldMLD_TYPEOPDR_GVS, "Number") & "," & _
          ToSQL(fldMLD_TYPEOPDR_TYPEOPDR_KEY, "Number") & "," & _
          ToSQL(fldMLD_TYPEOPDR_CONTRACT, "Number") & "," & _
          fldMLD_TYPEOPDR_AFHANDELING & "," & _
          ToSQL(fldMLD_TYPEOPDR_KOSTEN_VERPLICHT, "Number") & _
          ")"
    case "update"
'-------------------------------
' TypeOpdrRecord Update Event begin
' TypeOpdrRecord Update Event end
'-------------------------------
      sSQL = "update MLD_TYPEOPDR set " & _
        "MLD_TYPEOPDR_OMSCHRIJVING=" & ToSQL(fldMLD_TYPEOPDR_OMSCHRIJVING, "Text") & _
        ",MLD_TYPEOPDR_MODULE=" & ToSQL(fldMLD_TYPEOPDR_MODULE, "Text") & _
        ",MLD_TYPEOPDR_DECENTRAAL=" & ToSQL(fldMLD_TYPEOPDR_DECENTRAAL, "Number") & _
        ",MLD_TYPEOPDR_AFMELDEN_EXTERN=" & ToSQL(fldMLD_TYPEOPDR_AFMELDEN_EXTERN, "Number") & _
        ",MLD_TYPEOPDR_KOSTEN=" & fldMLD_TYPEOPDR_KOSTEN & _
        ",MLD_TYPEOPDR_SLUITMELDING=" & ToSQL(fldMLD_TYPEOPDR_SLUITMELDING, "Number") & _
        ",MLD_TYPEOPDR_MATCHTYPE=" & ToSQL(fldMLD_TYPEOPDR_MATCHTYPE, "Number") & _
        ",MLD_TYPEOPDR_AFMELDMARGE=" & ToSQL(fldMLD_TYPEOPDR_AFMELDMARGE, "Number") & _
        ",MLD_TYPEOPDR_ZICHTBAARFE=" & fldMLD_TYPEOPDR_ZICHTBAARFE & _
        ",MLD_TYPEOPDR_ISOFFERTE=" & fldMLD_TYPEOPDR_ISOFFERTE & _
        ",MLD_TYPEOPDR_OFFERTELIMIET=" & ToSQL(fldMLD_TYPEOPDR_OFFERTELIMIET, "Number") & _
        ",MLD_TYPEOPDR_GVS=" & ToSQL(fldMLD_TYPEOPDR_GVS, "Number") & _
        ",MLD_TYPEOPDR_TYPEOPDR_KEY=" & ToSQL(fldMLD_TYPEOPDR_TYPEOPDR_KEY, "Number") & _
        ",MLD_TYPEOPDR_CONTRACT=" & ToSQL(fldMLD_TYPEOPDR_CONTRACT, "Number") & _
        ",MLD_TYPEOPDR_AFHANDELING=" & fldMLD_TYPEOPDR_AFHANDELING & _
        ",MLD_TYPEOPDR_KOSTEN_VERPLICHT=" & ToSQL(fldMLD_TYPEOPDR_KOSTEN_VERPLICHT, "Number")
      sSQL = sSQL & " where " & sWhere
    case "delete"
'-------------------------------
' TypeOpdrRecord Delete Event begin
' TypeOpdrRecord Delete Event end
'-------------------------------
      sSQL = "delete from MLD_TYPEOPDR where " & sWhere
  end select
'-------------------------------
'-------------------------------
' TypeOpdrRecord BeforeExecute Event begin
' TypeOpdrRecord BeforeExecute Event end
'-------------------------------

'-------------------------------
' Execute SQL statement
'-------------------------------
if len(sTypeOpdrRecordErr) > 0 then Exit Sub
  on error resume next
  if bExecSQL then 
    cn.execute sSQL
  end if
  sTypeOpdrRecordErr = ProcessError
  on error goto 0
  if len(sTypeOpdrRecordErr) > 0 then Exit Sub
  cn.Close
  Set cn = Nothing
  response.redirect sActionFileName
'-------------------------------
' TypeOpdrRecord Action end
'-------------------------------
end sub
'===============================

'===============================
' Display Record Form
'-------------------------------
Sub TypeOpdrRecord_Show()
'-------------------------------
' TypeOpdrRecord Show begin
'-------------------------------
  Dim sWhere : sWhere = ""
  Dim sFormTitle: sFormTitle = "Details opdrachttype"
  Dim bPK : bPK = True
  Dim sMLD_TYPEOPDR_TYPEOPDR_KEYDisplayValue: sMLD_TYPEOPDR_TYPEOPDR_KEYDisplayValue = ""

'-------------------------------
' Load primary key and form parameters
'-------------------------------
  if sTypeOpdrRecordErr = "" then
    fldMLD_TYPEOPDR_KEY = GetParam("MLD_TYPEOPDR_KEY")
    pMLD_TYPEOPDR_KEY = GetParam("MLD_TYPEOPDR_KEY")
    SetVar "TypeOpdrRecordError", ""
  else
    fldMLD_TYPEOPDR_OMSCHRIJVING = GetParam("MLD_TYPEOPDR_OMSCHRIJVING")
    fldMLD_TYPEOPDR_MODULE = GetParam("MLD_TYPEOPDR_MODULE")
    fldMLD_TYPEOPDR_DECENTRAAL = GetParam("MLD_TYPEOPDR_DECENTRAAL")
    fldMLD_TYPEOPDR_AFMELDEN_EXTERN = GetParam("MLD_TYPEOPDR_AFMELDEN_EXTERN")
    fldMLD_TYPEOPDR_KOSTEN = getCheckBoxValue(GetParam("MLD_TYPEOPDR_KOSTEN"), "1", "0", "Number")
    fldMLD_TYPEOPDR_SLUITMELDING = GetParam("MLD_TYPEOPDR_SLUITMELDING")
    fldMLD_TYPEOPDR_MATCHTYPE = GetParam("MLD_TYPEOPDR_MATCHTYPE")
    fldMLD_TYPEOPDR_AFMELDMARGE = GetParam("MLD_TYPEOPDR_AFMELDMARGE")
    fldMLD_TYPEOPDR_ZICHTBAARFE = getCheckBoxValue(GetParam("MLD_TYPEOPDR_ZICHTBAARFE"), "1", "0", "Number")
    fldMLD_TYPEOPDR_ISOFFERTE = getCheckBoxValue(GetParam("MLD_TYPEOPDR_ISOFFERTE"), "1", "0", "Number")
    fldMLD_TYPEOPDR_OFFERTELIMIET = GetParam("MLD_TYPEOPDR_OFFERTELIMIET")
    fldMLD_TYPEOPDR_GVS = GetParam("MLD_TYPEOPDR_GVS")
    fldMLD_TYPEOPDR_TYPEOPDR_KEY = GetParam("MLD_TYPEOPDR_TYPEOPDR_KEY")
    fldMLD_TYPEOPDR_CONTRACT = GetParam("MLD_TYPEOPDR_CONTRACT")
    fldMLD_TYPEOPDR_AFHANDELING = getCheckBoxValue(GetParam("MLD_TYPEOPDR_AFHANDELING"), "1", "0", "Number")
    fldMLD_TYPEOPDR_KOSTEN_VERPLICHT = GetParam("MLD_TYPEOPDR_KOSTEN_VERPLICHT")
    pMLD_TYPEOPDR_KEY = GetParam("PK_MLD_TYPEOPDR_KEY")
    SetVar "sTypeOpdrRecordErr", sTypeOpdrRecordErr
    SetVar "FormTitle", sFormTitle
    Parse "TypeOpdrRecordError", False
  end if
'-------------------------------

'-------------------------------
' Load all form fields

'-------------------------------

'-------------------------------
' Build WHERE statement

  if IsEmpty(pMLD_TYPEOPDR_KEY) then bPK = False
  
  sWhere = sWhere & "MLD_TYPEOPDR_KEY=" & ToSQL(pMLD_TYPEOPDR_KEY, "Number")
  SetVar "PK_MLD_TYPEOPDR_KEY", pMLD_TYPEOPDR_KEY
'-------------------------------
'-------------------------------
' TypeOpdrRecord Open Event begin
' TypeOpdrRecord Open Event end
'-------------------------------

  SetVar "FormTitle", sFormTitle

'-------------------------------
' Build SQL statement and open recordset
'-------------------------------
  sSQL = "select * from MLD_TYPEOPDR where " & sWhere
  openrs rs, sSQL
  bIsUpdateMode = (bPK and not(sAction = "insert" and sForm = "TypeOpdrRecord") and not rs.eof)
'-------------------------------

'-------------------------------
' Load all fields into variables from recordset or input parameters
'-------------------------------
  if bIsUpdateMode then
    fldMLD_TYPEOPDR_KEY = GetValue(rs, "MLD_TYPEOPDR_KEY")
    fldMLD_TYPEOPDR_MODULE = GetValue(rs, "MLD_TYPEOPDR_MODULE")

'-------------------------------
' Load data from recordset when form displayed first time
'-------------------------------
    if sTypeOpdrRecordErr = "" then
      fldMLD_TYPEOPDR_OMSCHRIJVING = GetValue(rs, "MLD_TYPEOPDR_OMSCHRIJVING")
      fldMLD_TYPEOPDR_DECENTRAAL = GetValue(rs, "MLD_TYPEOPDR_DECENTRAAL")
      fldMLD_TYPEOPDR_AFMELDEN_EXTERN = GetValue(rs, "MLD_TYPEOPDR_AFMELDEN_EXTERN")
      fldMLD_TYPEOPDR_KOSTEN = GetValue(rs, "MLD_TYPEOPDR_KOSTEN")
      fldMLD_TYPEOPDR_SLUITMELDING = GetValue(rs, "MLD_TYPEOPDR_SLUITMELDING")
      fldMLD_TYPEOPDR_MATCHTYPE = GetValue(rs, "MLD_TYPEOPDR_MATCHTYPE")
      fldMLD_TYPEOPDR_AFMELDMARGE = GetValue(rs, "MLD_TYPEOPDR_AFMELDMARGE")
      fldMLD_TYPEOPDR_ZICHTBAARFE = GetValue(rs, "MLD_TYPEOPDR_ZICHTBAARFE")
      fldMLD_TYPEOPDR_ISOFFERTE = GetValue(rs, "MLD_TYPEOPDR_ISOFFERTE")
      fldMLD_TYPEOPDR_OFFERTELIMIET = GetValue(rs, "MLD_TYPEOPDR_OFFERTELIMIET")
      fldMLD_TYPEOPDR_GVS = GetValue(rs, "MLD_TYPEOPDR_GVS")
      fldMLD_TYPEOPDR_TYPEOPDR_KEY = GetValue(rs, "MLD_TYPEOPDR_TYPEOPDR_KEY")
      fldMLD_TYPEOPDR_CONTRACT = GetValue(rs, "MLD_TYPEOPDR_CONTRACT")
      fldMLD_TYPEOPDR_AFHANDELING = GetValue(rs, "MLD_TYPEOPDR_AFHANDELING")
      fldMLD_TYPEOPDR_KOSTEN_VERPLICHT = GetValue(rs, "MLD_TYPEOPDR_KOSTEN_VERPLICHT")
    end if
    SetVar "TypeOpdrRecordInsert", ""
    Parse "TypeOpdrRecordEdit", False
'-------------------------------
' TypeOpdrRecord ShowEdit Event begin
' TypeOpdrRecord ShowEdit Event end
'-------------------------------
  else
    if sTypeOpdrRecordErr = "" then
      fldMLD_TYPEOPDR_KEY = ToHTML(GetParam("MLD_TYPEOPDR_KEY"))
      fldMLD_TYPEOPDR_MODULE= "MLD"
      fldMLD_TYPEOPDR_SLUITMELDING= "0"
      fldMLD_TYPEOPDR_MATCHTYPE= "2"
      fldMLD_TYPEOPDR_AFMELDMARGE= "0"
      fldMLD_TYPEOPDR_CONTRACT= "2"
    end if
    SetVar "TypeOpdrRecordEdit", ""
    Parse "TypeOpdrRecordInsert", False
'-------------------------------
' TypeOpdrRecord ShowInsert Event begin
' TypeOpdrRecord ShowInsert Event end
'-------------------------------
  end if
  Parse "TypeOpdrRecordCancel", false
'-------------------------------
' TypeOpdrRecord Show Event begin
' TypeOpdrRecord Show Event end
'-------------------------------

'-------------------------------
' Show form field
'-------------------------------
      SetVar "MLD_TYPEOPDR_KEY", ToHTML(fldMLD_TYPEOPDR_KEY)
      SetVar "MLD_TYPEOPDR_OMSCHRIJVING", ToHTML(fldMLD_TYPEOPDR_OMSCHRIJVING)
      SetVar "MLD_TYPEOPDR_MODULE", ToHTML(fldMLD_TYPEOPDR_MODULE)
      SetVar "TypeOpdrRecordLBMLD_TYPEOPDR_DECENTRAAL", ""
      LOV = Split(""&FCLTLCL("0;Centraal;1;Centraal/Decentraal;2;Decentraal (exclusief)")&"", ";")
      if (ubound(LOV) mod 2) = 1 then
        for i = 0 to ubound(LOV) step 2
          SetVar "ID", LOV(i) : SetVar "Value", LOV(i+1)
          if cstr(LOV(i)) = cstr(fldMLD_TYPEOPDR_DECENTRAAL) then SetVar "Selected", "SELECTED" else SetVar "Selected", ""
          Parse "TypeOpdrRecordLBMLD_TYPEOPDR_DECENTRAAL", True
        next
      end if
    
      SetVar "TypeOpdrRecordLBMLD_TYPEOPDR_AFMELDEN_EXTERN", ""
      LOV = Split(""&FCLTLCL("0;Niet zien;1;Zien;2;Afmelden")&"", ";")
      if (ubound(LOV) mod 2) = 1 then
        for i = 0 to ubound(LOV) step 2
          SetVar "ID", LOV(i) : SetVar "Value", LOV(i+1)
          if cstr(LOV(i)) = cstr(fldMLD_TYPEOPDR_AFMELDEN_EXTERN) then SetVar "Selected", "SELECTED" else SetVar "Selected", ""
          Parse "TypeOpdrRecordLBMLD_TYPEOPDR_AFMELDEN_EXTERN", True
        next
      end if
    
  if (LCase(fldMLD_TYPEOPDR_KOSTEN) = LCase("1")) then
    SetVar "MLD_TYPEOPDR_KOSTEN_CHECKED", "CHECKED"
  else
    SetVar "MLD_TYPEOPDR_KOSTEN_CHECKED", ""
  end if

      SetVar "TypeOpdrRecordLBMLD_TYPEOPDR_SLUITMELDING", ""
      LOV = Split(""&FCLTLCL("0;Nooit;1;Vragen;2;Altijd")&"", ";")
      if (ubound(LOV) mod 2) = 1 then
        for i = 0 to ubound(LOV) step 2
          SetVar "ID", LOV(i) : SetVar "Value", LOV(i+1)
          if cstr(LOV(i)) = cstr(fldMLD_TYPEOPDR_SLUITMELDING) then SetVar "Selected", "SELECTED" else SetVar "Selected", ""
          Parse "TypeOpdrRecordLBMLD_TYPEOPDR_SLUITMELDING", True
        next
      end if
    
      SetVar "TypeOpdrRecordLBMLD_TYPEOPDR_MATCHTYPE", ""
      LOV = Split(""&FCLTLCL("0;Altijd goed;1;Opdrachttotaal;2;Termijn tot opdrachttotaal;3;Wekelijks geregistreerde uren;4;Geen kosten;5;Materiaal;6;Totaal geregistreerde uren;7;Maximum geregistreerde uren")&"", ";")
      if (ubound(LOV) mod 2) = 1 then
        for i = 0 to ubound(LOV) step 2
          SetVar "ID", LOV(i) : SetVar "Value", LOV(i+1)
          if cstr(LOV(i)) = cstr(fldMLD_TYPEOPDR_MATCHTYPE) then SetVar "Selected", "SELECTED" else SetVar "Selected", ""
          Parse "TypeOpdrRecordLBMLD_TYPEOPDR_MATCHTYPE", True
        next
      end if
    
      SetVar "MLD_TYPEOPDR_AFMELDMARGE", ToHTML(fldMLD_TYPEOPDR_AFMELDMARGE)
  if (LCase(fldMLD_TYPEOPDR_ZICHTBAARFE) = LCase("1")) then
    SetVar "MLD_TYPEOPDR_ZICHTBAARFE_CHECKED", "CHECKED"
  else
    SetVar "MLD_TYPEOPDR_ZICHTBAARFE_CHECKED", ""
  end if

  if (LCase(fldMLD_TYPEOPDR_ISOFFERTE) = LCase("1")) then
    SetVar "MLD_TYPEOPDR_ISOFFERTE_CHECKED", "CHECKED"
  else
    SetVar "MLD_TYPEOPDR_ISOFFERTE_CHECKED", ""
  end if

      SetVar "MLD_TYPEOPDR_OFFERTELIMIET", ToHTML(fldMLD_TYPEOPDR_OFFERTELIMIET)
      SetVar "MLD_TYPEOPDR_GVS", ToHTML(fldMLD_TYPEOPDR_GVS)
      SetVar "TypeOpdrRecordLBMLD_TYPEOPDR_TYPEOPDR_KEY", ""
      SetVar "Selected", ""
      SetVar "ID", ""
      SetVar "Value", sMLD_TYPEOPDR_TYPEOPDR_KEYDisplayValue
      Parse "TypeOpdrRecordLBMLD_TYPEOPDR_TYPEOPDR_KEY", True
      openrs rsMLD_TYPEOPDR_TYPEOPDR_KEY, "select MLD_TYPEOPDR_KEY, MLD_TYPEOPDR_OMSCHRIJVING from MLD_TYPEOPDR order by 2"
      while not rsMLD_TYPEOPDR_TYPEOPDR_KEY.EOF
        SetVar "ID", GetValue(rsMLD_TYPEOPDR_TYPEOPDR_KEY, 0) : SetVar "Value", GetValue(rsMLD_TYPEOPDR_TYPEOPDR_KEY, 1)
        if cstr(GetValue(rsMLD_TYPEOPDR_TYPEOPDR_KEY, 0)) = cstr(fldMLD_TYPEOPDR_TYPEOPDR_KEY) then SetVar "Selected", "SELECTED" else SetVar "Selected", ""
        Parse "TypeOpdrRecordLBMLD_TYPEOPDR_TYPEOPDR_KEY", True
        rsMLD_TYPEOPDR_TYPEOPDR_KEY.MoveNext
      wend
      set rsMLD_TYPEOPDR_TYPEOPDR_KEY = nothing
    
      SetVar "TypeOpdrRecordLBMLD_TYPEOPDR_CONTRACT", ""
      LOV = Split(""&FCLTLCL("0;Geen;2;Optioneel;3;Verplicht")&"", ";")
      if (ubound(LOV) mod 2) = 1 then
        for i = 0 to ubound(LOV) step 2
          SetVar "ID", LOV(i) : SetVar "Value", LOV(i+1)
          if cstr(LOV(i)) = cstr(fldMLD_TYPEOPDR_CONTRACT) then SetVar "Selected", "SELECTED" else SetVar "Selected", ""
          Parse "TypeOpdrRecordLBMLD_TYPEOPDR_CONTRACT", True
        next
      end if
    
  if (LCase(fldMLD_TYPEOPDR_AFHANDELING) = LCase("1")) then
    SetVar "MLD_TYPEOPDR_AFHANDELING_CHECKED", "CHECKED"
  else
    SetVar "MLD_TYPEOPDR_AFHANDELING_CHECKED", ""
  end if

      SetVar "TypeOpdrRecordLBMLD_TYPEOPDR_KOSTEN_VERPLICHT", ""
      LOV = Split("0;Niet verplicht;7;Aanmaak;6;Afmelden;4;Afronden", ";")
      if (ubound(LOV) mod 2) = 1 then
        for i = 0 to ubound(LOV) step 2
          SetVar "ID", LOV(i) : SetVar "Value", LOV(i+1)
          if cstr(LOV(i)) = cstr(fldMLD_TYPEOPDR_KOSTEN_VERPLICHT) then SetVar "Selected", "SELECTED" else SetVar "Selected", ""
          Parse "TypeOpdrRecordLBMLD_TYPEOPDR_KOSTEN_VERPLICHT", True
        next
      end if
    
  Parse "FormTypeOpdrRecord", False

'-------------------------------
' TypeOpdrRecord Close Event begin
' TypeOpdrRecord Close Event end
'-------------------------------

Set rs = Nothing

'-------------------------------
' TypeOpdrRecord Show end
'-------------------------------
End Sub
'===============================
%>