Subject Re: Filter on 2 fields with lookup
From Dirk C <dirk@C.com>
Date Wed, 27 Mar 2024 12:07:00 +0100
Newsgroups dbase.getting-started
Attachment(s) viewcus.wfm

Op 26/03/2024 om 16:46 schreef Mervyn Bick:
> On 2024/03/26 00:05, Dirk C wrote:
>> Hello,
>>
>> want to filter on 2 fields wirh a lookup field
>>
>> i am trying to put the first filter as a variable and using for the
>> second filter
>>
>>   function KEUZEDOOS_SOORTEN_onChange()
>>     local cSegm, cS, cMomentFilter
>>     this.style = 2
>>      cSegm =
>> form.vraagbak_stammdat.rowset.fields['soort'].lookuprowset    //soort
>>       cSegm.applyLocate("description = '" +this.value+"'")   //
>> description
>>        cS = (cSegm.fields[1].value)
>>         form.rowset.Filter :=[soort =']+cS+[']
>>         cMomentFilter= form.rowset.filter
>>            cLand =
>> form.vraagbak_stammdat.rowset.fields['country'].lookuprowset
>>           cLand.applyLocate("land = '" +this.value+"'")
>>            A = (cland.fields[1].value)
>>           form.rowset.Filter := cMomentFilter + "country ='"+A+"'"
>>    return
>
> I'm afraid you will need to give a bit more detail as it's not clear
> what you want to do.
>
> If you assign a lookupRowset to the lookupRowset property of
> form.vraagbak_stammdat.rowset.fields['soort'], its first field must
> contain the same sort of content as the field "soort" usually a code or
> abbreviation.  The name of the first field is not important.  If the
> second field in the lookupRowset is named, say "description", dBASE will
> replace the field "soort" in form.vraagbak_stammdat.rowset with the
> field "description" and its contents.
>
> As you navigate in form.vraagbak_stammdat.rowset dBASE will
> automatically navigate the lookupRowset and you can interrogate the
> fields from the 3rd field onward.  Fetching cSegm.fields[1].value gives
> you the value that would have been in the field "soort".
>
> Each field in form.vraagbak_stammdat.rowset has a lookupSQL and a
> lookupRowset property.
>
> I assume "soort" and "land" are both fields in
> form.vraagbak_stammdat.rowset and contain codes or abbreviations.
>
> Perhaps the following.
>
> form.vraagbak_stammdat.rowset.fields['soort'].lookupSQL = 'select
> desc_code,description from descriptions.dbf'
>
> form.vraagbak_stammdat.rowset.fields['land'].lookupSQL = 'select
> land_code,country from countries.dbf'
>
> function KEUZEDOOS_SOORTEN_onChange()
>     form.vraagbak_stammdat.rowset.applyLocate('description = '"
> +this.value+"'")
>     //This will move the rowpointer to the first matching description.
>     //It does not filter the rowset.
>     //You now need code to retrieve a country name into a variable,
>     //say cLand.  You can't use this combobox as it displays descriptions.
>     //Now you can set the filter to show al records with the selected
> description and country.
>     form.rowset.Filter :=[description =']+this.value+[' and country =
> ']+cLand=[']
>     return
>
> Mervyn.
>
> Mervin

  is working as long the value of the combobox is in stammdat.dbf

  when the value isn't, cannot filter any more, even i Null the filter

  even i want to get the names from stammdat from the selected country

  with the value (selecteren) so i can pointed the correct segment value

  for now main cornern is to filter

   or is it better to use sql statement ?

can you have a look to the attached file

thanks
>
>
>
>
>
>
>
>
>
>
>



/*
   * "nederlandse benaming"
   * ACTIVEX = ACTIVEXOBJEKT_ * BROWSE = BLADDOOS_  * CHECKBOX = KONTROLEDOOS_  *  COMBOBOX = KEUZEDOOS_
   * CONTAINER = DOOS_  * EDITOR = BEWERKDOOS_  * ENTRYFIELD = VELD_  * FORM = Formulier  * GRID  = ROOSTER_
   * HSCROLLBAR = HORIZONUITROL_ * IMAGE = BEELD_  * Line = LIJN_  * LISTBOX = KEUZELIJSTDOOS_
   * NOTEBOOK = NOTITIEBOEK_  * OLE = OLEOBJEKT_  * PAINTBOX  = KLEURDOOS_  * PROGRESS  = BALK_  * PUSHBUTTON = KNOP_
   * QUERY = vraagbak_  * RADIOKNOP_ = RADIOBUTTON_  * RECTANGLE = RECHTHOEK_  * ReportViewer = REPORTDOOS_
   * SHAPE = VORM_  * SLIDER = SCHUIF_  * SPINBOX  = KEUZEVELD_  * TABBOX  = LUSDOOS_  * TEXT  = Tekst_  *  TEXTLABEL = KLEVER_
   * TREEVIEW  = STRUCTUURBOOM_  * VSCROLLBAR = VERTIKAALUITROL_
  */


** END HEADER -- do not remove this line
//
// Generated on 25/03/2024
//
parameter bModal
local f
f = new viewcusForm()
if (bModal)
   f.mdi = false // ensure not MDI
   f.readModal()
else
   f.open()
endif

class viewcusForm of BASISCFORM from "basis.cfm"
   with (this)
      onGotFocus = class::FORM_ONGOTFOCUS
      onLostFocus = class::FORM_ONLOSTFOCUS
      onOpen = class::FORM_ONOPEN
      scaleFontSize = 10.0
      scaleFontBold = true
      metric = 6        // Pixels
      height = 675.0
      left = -84.0
      top = 27.0
      width = 1485.0
      text = "firma info *** Bci ****"
      windowState = 0        // Normal
      autoCenter = true
      mdi = true
      maximize = false
      icon = "filename ..\include\BCI.ico"
   endwith

   with (this.DATABANK_KLANTEN)
      left = 119.0
      top = 594.0
      width = 96.0
      height = 37.0
   endwith

   this.VRAAGBAK_SOORTEN = new QUERY(this)
   with (this.VRAAGBAK_SOORTEN)
      left = 140.0
      top = 286.0
      width = 100.0
      height = 37.0
      database = form.databank_klanten
      sql = 'Select segcode, description, info from "segm.dbf" where segcode in(select distinct soort from stammdat) order by description'
      active = true
   endwith

   with (this.VRAAGBAK_SOORTEN.rowset)
      autoEdit = false
   endwith

   this.VRAAGBAK_STAMMDAT = new QUERY(this)
   with (this.VRAAGBAK_STAMMDAT)
      left = 462.0
      top = 594.0
      width = 100.0
      height = 37.0
      database = form.databank_klanten
      sql = 'Select idnummer, name, street, plz, city, province,country, basetelefon, basefax, handy, email, web, soort, choice, creatie, outside from "stammdat.dbf" '
      active = true
   endwith

   with (this.VRAAGBAK_STAMMDAT.rowset)
      with (fields["Province"])
         lookupSQL = "select areacode,area from euroregions order by area"
      endwith
      with (fields["Country"])
         lookupSQL = "select landid,land from  country order by land"
      endwith
      with (fields["soort"])
         lookupSQL = "select * from segm order by description"
      endwith
      with (fields["outside"])
         lookupSQL = "select * from employee order by name"
      endwith
      autoEdit = false
   endwith

   this.VRAAGBAK_LAND = new QUERY(this)
   with (this.VRAAGBAK_LAND)
      left = 182.0
      top = 220.0
      width = 80.0
      height = 37.0
      database = form.databank_klanten
      sql = 'Select landid, landcode, land from "Country.dbf" where landid in(select distinct country from stammdat)order by land '
      requestLive = false
      active = true
   endwith

   with (this.VRAAGBAK_LAND.rowset)
      autoEdit = false
   endwith

   this.VRAAGBAK_BRANDPROD = new QUERY(this)
   with (this.VRAAGBAK_BRANDPROD)
      left = 672.0
      top = 176.0
      width = 100.0
      height = 37.0
      database = form.databank_klanten
      sql = 'select idnummer, type, brand, product from BRAND_PROD.DBF"'
      requestLive = false
      active = true
   endwith

   with (this.VRAAGBAK_BRANDPROD.rowset)
      autoEdit = false
      indexName = "FIRMANUMMER"
      masterRowset = form.vraagbak_stammdat.rowset
      masterFields = "IDNUMMER"
   endwith

   this.VRAAGBAK_BEDRIJFSTAK = new QUERY(this)
   with (this.VRAAGBAK_BEDRIJFSTAK)
      left = 728.0
      top = 594.0
      width = 100.0
      height = 37.0
      database = form.databank_klanten
      sql = 'select idnrbranche, aard, soort from "branche_firma.dbf"'
      requestLive = false
      active = true
   endwith

   with (this.VRAAGBAK_BEDRIJFSTAK.rowset)
      autoEdit = false
      indexName = "KATO_ID"
      masterRowset = form.vraagbak_stammdat.rowset
      masterFields = "IDNUMMER"
   endwith

   this.VRAAGBAK_TOPIC = new QUERY(this)
   with (this.VRAAGBAK_TOPIC)
      left = 308.0
      top = 253.0
      width = 83.0
      height = 37.0
      database = form.databank_klanten
      sql = 'select topicid, topicbeschrijving, datum from "TOPIC_FIRMA.DBF"'
      active = true
   endwith

   with (this.VRAAGBAK_TOPIC.rowset)
      autoEdit = false
      indexName = "THEMAVOLG"
      masterRowset = form.vraagbak_stammdat.rowset
      masterFields = "IDNUMMER"
   endwith

   this.VRAAGBAK_CONTACT = new QUERY(this)
   with (this.VRAAGBAK_CONTACT)
      left = 238.0
      top = 605.0
      width = 99.0
      height = 37.0
      database = form.databank_klanten
      sql = 'Select idnummer, name, voornaam, telefon, task, gsm,                  verlaten, email  from "communicate.dbf" '
      requestLive = false
      active = true
   endwith

   with (this.VRAAGBAK_CONTACT.rowset)
      with (fields["task"])
         lookupSQL = "select * from job"
      endwith
      autoEdit = false
      indexName = "NUMMERID"
      masterRowset = form.vraagbak_stammdat.rowset
      masterFields = "IDNUMMER"
   endwith

   this.VRAAGBAK_BEZOEKADRES = new QUERY(this)
   with (this.VRAAGBAK_BEZOEKADRES)
      left = 630.0
      top = 594.0
      width = 100.0
      height = 37.0
      database = form.databank_klanten
      sql = 'select idnummer, street, plz, city from "visitadres.dbf"'
      requestLive = false
      active = true
   endwith

   with (this.VRAAGBAK_BEZOEKADRES.rowset)
      autoEdit = false
      indexName = "IDENTIFY"
      masterRowset = form.vraagbak_stammdat.rowset
      masterFields = "IDNUMMER"
   endwith

   this.VRAAGBAK_BEZOEK = new QUERY(this)
   with (this.VRAAGBAK_BEZOEK)
      left = 42.0
      top = 220.0
      width = 92.0
      height = 37.0
      database = form.databank_klanten
      sql = 'Select idnummer, visit, time1, time2 from "VISIT.DBF" '
      active = true
   endwith

   with (this.VRAAGBAK_BEZOEK.rowset)
      autoEdit = false
      masterRowset = form.vraagbak_stammdat.rowset
      masterFields = "IDNUMMER"
   endwith

   this.LIJN_1 = new LINE(this)
   with (this.LIJN_1)
      left = 1005.0
      right = 1005.0
      top = 650.0
      bottom = 10.0
      width = 3
      colorNormal = "blue"
   endwith

   this.TEKST_KONTAKTNAAM = new TEXT(this)
   with (this.TEKST_KONTAKTNAAM)
      height = 22.0
      left = 1015.0
      top = 15.0
      width = 161.0
      wrap = false
      colorNormal = "Black/0x78787885"
      alignVertical = 1        // Middle
      transparent = true
      fontSize = 12.0
      fontBold = true
      text = "idnr  aanmaakdatum    "
   endwith

   this.TEKST_FIRMA = new TEXT(this)
   with (this.TEKST_FIRMA)
      height = 22.0
      left = 7.0
      top = 121.0
      width = 44.0
      wrap = false
      colorNormal = "Black/0x78787885"
      alignVertical = 1        // Middle
      transparent = true
      fontBold = true
      text = "firma"
   endwith

   this.VELD_FIRMA = new ENTRYFIELD(this)
   with (this.VELD_FIRMA)
      when = class::VELD_FIRMA_WHEN
      height = 30.0
      left = 70.0
      top = 121.0
      width = 819.0
      colorNormal = "black/silver"
      border = false
      fontSize = 18.0
      fontBold = true
      value = ""
      borderStyle = 3        // None
   endwith

   this.TEKST_STRAAT = new TEXT(this)
   with (this.TEKST_STRAAT)
      height = 22.0
      left = 7.0
      top = 165.0
      width = 39.0
      wrap = false
      colorNormal = "Black/0x78787885"
      alignVertical = 1        // Middle
      transparent = true
      fontBold = true
      text = "straat"
   endwith

   this.VELD_STRAAT = new ENTRYFIELD(this)
   with (this.VELD_STRAAT)
      when = class::VELD_STRAAT_WHEN
      height = 30.0
      left = 70.0
      top = 162.0
      width = 819.0
      colorNormal = "black/silver"
      border = false
      fontSize = 18.0
      fontBold = true
      value = ""
      borderStyle = 3        // None
   endwith

   this.TEKST_POSTNR = new TEXT(this)
   with (this.TEKST_POSTNR)
      height = 22.0
      left = 7.0
      top = 205.0
      width = 44.0
      wrap = false
      colorNormal = "Black/0x78787885"
      alignVertical = 1        // Middle
      transparent = true
      fontBold = true
      text = "postnr"
   endwith

   this.VELD_POSTNR = new ENTRYFIELD(this)
   with (this.VELD_POSTNR)
      when = class::VELD_POSTNR_WHEN
      height = 30.0
      left = 70.0
      top = 198.0
      width = 189.0
      colorNormal = "black/silver"
      border = false
      fontSize = 18.0
      fontBold = true
      value = ""
      borderStyle = 3        // None
   endwith

   this.TEKST_STAD = new TEXT(this)
   with (this.TEKST_STAD)
      height = 16.0
      left = 275.0
      top = 206.0
      width = 34.0
      wrap = false
      alignVertical = 1        // Middle
      transparent = true
      fontBold = true
      text = "stad"
   endwith

   this.VELD_STAD = new ENTRYFIELD(this)
   with (this.VELD_STAD)
      when = class::VELD_STAD_WHEN
      height = 30.0
      left = 323.0
      top = 198.0
      width = 567.0
      colorNormal = "black/silver"
      border = false
      fontSize = 18.0
      fontBold = true
      value = ""
      borderStyle = 3        // None
   endwith

   this.TEKST_FIRMA_TELEFOON = new TEXT(this)
   with (this.TEKST_FIRMA_TELEFOON)
      height = 22.0
      left = 4.0
      top = 360.0
      width = 66.0
      wrap = false
      colorNormal = "Black/0x78787885"
      alignVertical = 1        // Middle
      transparent = true
      fontBold = true
      text = "tel bureel"
   endwith

   this.VELD_TELEFOONFIRMA = new ENTRYFIELD(this)
   with (this.VELD_TELEFOONFIRMA)
      when = class::VELD_TELEFOONFIRMA_WHEN
      onLeftMouseDown = class::VELD_TELEFOONFIRMA_ONLEFTMOUSEDOWN
      height = 30.0
      left = 120.0
      top = 360.0
      width = 357.0
      colorNormal = "black/silver"
      border = false
      fontSize = 18.0
      fontBold = true
      value = ""
      mousePointer = 13        // Hand
      borderStyle = 3        // None
   endwith

   this.TEKST_FIRMA_GSM = new TEXT(this)
   with (this.TEKST_FIRMA_GSM)
      height = 22.0
      left = 497.0
      top = 363.0
      width = 85.0
      wrap = false
      colorNormal = "Black/0x78787885"
      alignVertical = 1        // Middle
      transparent = true
      fontBold = true
      text = "gsm bureel"
   endwith

   this.VELD_GSMFIRMA = new ENTRYFIELD(this)
   with (this.VELD_GSMFIRMA)
      when = class::VELD_GSMFIRMA_WHEN
      height = 30.0
      left = 602.0
      top = 360.0
      width = 357.0
      colorNormal = "black/silver"
      border = false
      fontSize = 18.0
      fontBold = true
      value = ""
      mousePointer = 13        // Hand
      borderStyle = 3        // None
   endwith

   this.TEKST_KONTAKT_TELEFOON = new TEXT(this)
   with (this.TEKST_KONTAKT_TELEFOON)
      height = 22.0
      left = 4.0
      top = 484.0
      width = 76.0
      wrap = false
      colorNormal = "Black/0x78787885"
      alignVertical = 1        // Middle
      transparent = true
      fontBold = true
      text = "tel contact"
   endwith

   this.VELD_CONTACT_TEL = new ENTRYFIELD(this)
   with (this.VELD_CONTACT_TEL)
      height = 30.0
      left = 120.0
      top = 480.0
      width = 357.0
      colorNormal = "blue/silver"
      border = false
      fontSize = 18.0
      fontBold = true
      value = ""
      mousePointer = 13        // Hand
      borderStyle = 3        // None
   endwith

   this.TESKT_KONTAKT_GSM = new TEXT(this)
   with (this.TESKT_KONTAKT_GSM)
      height = 22.0
      left = 497.0
      top = 484.0
      width = 91.0
      wrap = false
      colorNormal = "Black/0x78787885"
      alignVertical = 1        // Middle
      transparent = true
      fontBold = true
      text = "gsm contact"
   endwith

   this.VELD_KONTAKTGSM = new ENTRYFIELD(this)
   with (this.VELD_KONTAKTGSM)
      height = 30.0
      left = 602.0
      top = 480.0
      width = 357.0
      colorNormal = "blue/silver"
      border = false
      fontSize = 18.0
      fontBold = true
      value = ""
      mousePointer = 13        // Hand
      borderStyle = 3        // None
   endwith

   this.ROOSTER_KONTAKT = new GRID(this)
   with (this.ROOSTER_KONTAKT)
      fontSize = 14.0
      fontBold = true
      colorNormal = "black/silver"
      headingColorNormal = "black/0x78787885"
      dataLink = form.vraagbak_contact.rowset
      columns["COLUMN1"] = new GRIDCOLUMN(form.ROOSTER_KONTAKT)
      with (columns["COLUMN1"])
         dataLink = form.vraagbak_contact.rowset.fields["name"]
         editorType = 1        // EntryField
         width = 250.0
      endwith
      columns["COLUMN2"] = new GRIDCOLUMN(form.ROOSTER_KONTAKT)
      with (columns["COLUMN2"])
         dataLink = form.vraagbak_contact.rowset.fields["voornaam"]
         editorType = 1        // EntryField
         width = 250.0
      endwith
      columns["COLUMN3"] = new GRIDCOLUMN(form.ROOSTER_KONTAKT)
      with (columns["COLUMN3"])
         dataLink = form.vraagbak_contact.rowset.fields["task"]
         editorType = 1        // EntryField
         width = 250.0
      endwith
      columns["COLUMN4"] = new GRIDCOLUMN(form.ROOSTER_KONTAKT)
      with (columns["COLUMN4"])
         dataLink = form.vraagbak_contact.rowset.fields["verlaten"]
         editorType = 2        // CheckBox
         width = 80.0
      endwith
      with (columns["COLUMN1"].headingControl)
         value = "naam"
      endwith

      with (columns["COLUMN2"].headingControl)
         value = "voornaam"
      endwith

      with (columns["COLUMN3"].headingControl)
         value = "functie"
      endwith

      with (columns["COLUMN4"].headingControl)
         value = "verlaten"
      endwith

      headingHeight = 22.0
      cellHeight = 22.0
      hasIndicator = false
      rowSelect = true
      colorRowSelect = "blue/silver"
      allowEditing = false
      allowAddRows = false
      hScrollBar = 0        // Off
      height = 100.0
      left = 120.0
      top = 560.0
      width = 834.0
   endwith

   this.KNOP_EERST = new PUSHBUTTON(this)
   with (this.KNOP_EERST)
      onClick = class::KNOP_EERST_ONCLICK
      height = 35.0
      left = 15.0
      top = 35.0
      width = 65.0
      text = ""
      upBitmap = "RESOURCE PS_FIRST"
      fontSize = 12.0
      fontBold = true
      tabStop = false
      colorNormal = "black"
   endwith

   this.KNOP_VORIG = new PUSHBUTTON(this)
   with (this.KNOP_VORIG)
      onClick = class::KNOP_VORIG_ONCLICK
      height = 35.0
      left = 85.0
      top = 35.0
      width = 65.0
      text = ""
      upBitmap = "RESOURCE PS_PREV"
      fontSize = 12.0
      fontBold = true
      tabStop = false
      colorNormal = "black"
   endwith

   this.KNOP_VOLGEND = new PUSHBUTTON(this)
   with (this.KNOP_VOLGEND)
      onClick = class::KNOP_VOLGEND_ONCLICK
      height = 35.0
      left = 155.0
      top = 35.0
      width = 65.0
      text = ""
      upBitmap = "RESOURCE PS_next"
      fontSize = 12.0
      fontBold = true
      tabStop = false
      colorNormal = "black"
   endwith

   this.KNOP_LAATST = new PUSHBUTTON(this)
   with (this.KNOP_LAATST)
      onClick = class::KNOP_LAATST_ONCLICK
      height = 35.0
      left = 225.0
      top = 35.0
      width = 65.0
      text = ""
      upBitmap = "RESOURCE PS_last"
      fontSize = 12.0
      fontBold = true
      tabStop = false
      colorNormal = "black"
   endwith

   this.VELD_ZOEK = new ENTRYFIELD(this)
   with (this.VELD_ZOEK)
      onLostFocus = class::VELD_ZOEK_ONLOSTFOCUS
      onOpen = class::VELD_ZOEK_ONOPEN
      onKey = class::VELD_ZOEK_ONKEY
      height = 30.0
      left = 675.0
      top = 80.0
      width = 273.0
      colorNormal = "black/silver"
      border = false
      fontSize = 18.0
      fontBold = true
      value = ""
      borderStyle = 3        // None
   endwith

   this.TEKST_ZOEK = new TEXT(this)
   with (this.TEKST_ZOEK)
      height = 22.0
      left = 620.0
      top = 90.0
      width = 49.0
      colorNormal = "blue/BtnFace"
      transparent = true
      fontSize = 12.0
      fontBold = true
      text = "zoek"
   endwith

   this.KEUZEDOOS_KEUZE = new COMBOBOX(this)
   with (this.KEUZEDOOS_KEUZE)
      onChange = class::KEUZEDOOS_KEUZE_ONCHANGE
      height = 35.0
      left = 440.0
      top = 80.0
      width = 174.0
      fontSize = 17.0
      fontBold = true
      colorNormal = "black/Silver"
      dataSource = 'array {"(selecteren)","firma", "postnummer","stad"}'
      style = 1        // DropDown
      dropDownHeight = 132.0
   endwith

   this.KLEVER_KEUZE = new TEXTLABEL(this)
   with (this.KLEVER_KEUZE)
      height = 22.0
      left = 370.0
      top = 90.0
      width = 60.0
      text = "sorteer"
      colorNormal = "black/0x787878"
      fontSize = 12.0
      fontBold = true
   endwith

   this.KNOP_BEZOEK = new PUSHBUTTON(this)
   with (this.KNOP_BEZOEK)
      onClick = class::KNOP_BEZOEK_ONCLICK
      height = 35.0
      left = 295.0
      top = 35.0
      width = 65.0
      text = "bezoek"
      fontSize = 12.0
      fontBold = true
      mousePointer = 13        // Hand
      colorNormal = "blue/btnface"
   endwith

   this.KLEVER_LANDZOEK = new TEXTLABEL(this)
   with (this.KLEVER_LANDZOEK)
      height = 22.0
      left = 7.0
      top = 90.0
      width = 43.0
      text = "land"
      colorNormal = "black/0x787878"
      fontSize = 12.0
      fontBold = true
   endwith

   this.VELD_KONTAKT = new ENTRYFIELD(this)
   with (this.VELD_KONTAKT)
      when = class::VELD_KONTAKT_WHEN
      height = 25.0
      left = 1106.0
      top = 55.0
      width = 35.0
      colorNormal = "black/silver"
      border = false
      fontSize = 12.0
      fontBold = true
      value = ""
      borderStyle = 3        // None
   endwith

   this.KNOP_WEB = new PUSHBUTTON(this)
   with (this.KNOP_WEB)
      onClick = class::KNOP_WEB_ONCLICK
      height = 35.0
      left = 365.0
      top = 35.0
      width = 65.0
      text = ""
      upBitmap = "RESOURCE #2250"
      fontSize = 12.0
      speedTip = "www"
      mousePointer = 13        // Hand
   endwith

   this.TEKST_KONTAKT_EMAIL = new TEXT(this)
   with (this.TEKST_KONTAKT_EMAIL)
      height = 22.0
      left = 4.0
      top = 520.0
      width = 97.0
      colorNormal = "Black/0x78787885"
      transparent = true
      fontBold = true
      text = "e-mail contact"
   endwith

   this.VELD_EMAIL = new ENTRYFIELD(this)
   with (this.VELD_EMAIL)
      onLeftDblClick = class::VELD_EMAIL_ONLEFTDBLCLICK
      height = 30.0
      left = 120.0
      top = 520.0
      width = 658.0
      colorNormal = "blue/silver"
      border = false
      fontSize = 18.0
      fontBold = true
      speedTip = "zend email"
      value = ""
      mousePointer = 13        // Hand
      borderStyle = 3        // None
   endwith

   this.KLEVER_SEGM = new TEXTLABEL(this)
   with (this.KLEVER_SEGM)
      height = 20.0
      left = 1015.0
      top = 90.0
      width = 77.0
      transparent = true
      text = "segment"
      fontSize = 12.0
      fontBold = true
   endwith

   this.KEUZEDOOS_LAND = new COMBOBOX(this)
   with (this.KEUZEDOOS_LAND)
      onChange = class::KEUZEDOOS_LAND_ONCHANGE
      height = 37.0
      left = 60.0
      top = 80.0
      width = 301.0
      fontSize = 18.0
      fontBold = true
      colorNormal = "black/silver"
      autoTrim = true
      dataSource = form.vraagbak_land.rowset.fields["land"]
      style = 2        // DropDownList
      dropDownHeight = 132.0
      selectAll = false
   endwith

   this.TEKST_FIRMAEMAIL = new TEXTLABEL(this)
   with (this.TEKST_FIRMAEMAIL)
      height = 22.0
      left = 4.0
      top = 407.0
      width = 84.0
      transparent = true
      text = "e-mail firma"
      fontBold = true
   endwith

   this.VELD_EMAIL_FIRMA = new ENTRYFIELD(this)
   with (this.VELD_EMAIL_FIRMA)
      onLeftDblClick = class::VELD_EMAIL_FIRMA_ONLEFTDBLCLICK
      height = 30.0
      left = 120.0
      top = 400.0
      width = 660.0
      colorNormal = "black/silver"
      border = false
      fontSize = 18.0
      fontBold = true
      value = ""
      mousePointer = 13        // Hand
      borderStyle = 3        // None
   endwith

   this.VELD_VERTEGENWOORDIGER = new ENTRYFIELD(this)
   with (this.VELD_VERTEGENWOORDIGER)
      height = 20.0
      left = 1185.0
      top = 55.0
      width = 287.0
      colorNormal = "black/0x787878"
      border = false
      fontSize = 12.0
      fontBold = true
      value = ""
      borderStyle = 3        // None
   endwith

   this.KNOP_INFO = new PUSHBUTTON(this)
   with (this.KNOP_INFO)
      onClick = class::KNOP_INFO_ONCLICK
      height = 35.0
      left = 505.0
      top = 35.0
      width = 65.0
      text = "info"
      fontName = "Times New Roman"
      fontSize = 12.0
      fontBold = true
      mousePointer = 13        // Hand
      colorNormal = "blue/gray"
   endwith

   this.KNOP_OMZET = new PUSHBUTTON(this)
   with (this.KNOP_OMZET)
      onClick = class::KNOP_OMZET_ONCLICK
      height = 35.0
      left = 575.0
      top = 35.0
      width = 100.0
      text = "omzet"
      fontName = "Times New Roman"
      fontSize = 12.0
      fontBold = true
      mousePointer = 13        // Hand
      colorNormal = "blue/gray"
   endwith

   this.KNOP_AANBIEDING = new PUSHBUTTON(this)
   with (this.KNOP_AANBIEDING)
      onClick = class::KNOP_AANBIEDING_ONCLICK
      height = 35.0
      left = 680.0
      top = 35.0
      width = 100.0
      text = "aanbiedingen"
      fontName = "Times New Roman"
      fontSize = 12.0
      fontBold = true
      mousePointer = 13        // Hand
      colorNormal = "blue/gray"
   endwith

   this.KNOP_OPMERK = new PUSHBUTTON(this)
   with (this.KNOP_OPMERK)
      onClick = class::KNOP_OPMERK_ONCLICK
      height = 35.0
      left = 785.0
      top = 35.0
      width = 100.0
      text = "opmerkingen"
      fontName = "Times New Roman"
      fontSize = 12.0
      fontBold = true
      mousePointer = 13        // Hand
      colorNormal = "blue/gray"
   endwith

   this.VELD_BEZOEK = new ENTRYFIELD(this)
   with (this.VELD_BEZOEK)
      height = 30.0
      left = 70.0
      top = 286.0
      width = 553.0
      colorNormal = "black/silver"
      fontSize = 18.0
      fontBold = true
      value = ""
   endwith

   this.TEKST_BEZOEK = new TEXT(this)
   with (this.TEKST_BEZOEK)
      height = 22.0
      left = 7.0
      top = 291.0
      width = 49.0
      colorNormal = "black/0x787878"
      fontBold = true
      text = "bezoek"
   endwith

   this.VELD_POSTNR_BEZOEK = new ENTRYFIELD(this)
   with (this.VELD_POSTNR_BEZOEK)
      height = 30.0
      left = 70.0
      top = 325.0
      width = 189.0
      colorNormal = "black/silver"
      fontName = "arial"
      fontSize = 18.0
      fontBold = true
      value = ""
   endwith

   this.VELD_BEZOEKSTAD = new ENTRYFIELD(this)
   with (this.VELD_BEZOEKSTAD)
      height = 30.0
      left = 265.0
      top = 325.0
      width = 735.0
      colorNormal = "black/silver"
      fontName = "arial"
      fontSize = 18.0
      fontBold = true
      value = ""
   endwith

   this.KNOP_BASIS = new PUSHBUTTON(this)
   with (this.KNOP_BASIS)
      onClick = class::KNOP_BASIS_ONCLICK
      height = 35.0
      left = 890.0
      top = 35.0
      width = 110.0
      text = "basisgegevens"
      fontName = "Times New Roman"
      fontSize = 12.0
      fontBold = true
      mousePointer = 13        // Hand
      colorNormal = "blue/gray"
   endwith

   this.TEKST_LAND = new TEXT(this)
   with (this.TEKST_LAND)
      height = 22.0
      left = 7.0
      top = 248.0
      width = 46.0
      colorNormal = "Black/0x787878"
      fontName = "Ariel"
      fontBold = true
      text = "land"
   endwith

   this.VELD_LAND = new ENTRYFIELD(this)
   with (this.VELD_LAND)
      when = class::VELD_LAND_WHEN
      height = 30.0
      left = 70.0
      top = 242.0
      width = 336.0
      colorNormal = "black/silver"
      fontName = "Times New Roman"
      fontSize = 18.0
      fontBold = true
      value = ""
   endwith

   this.ROOSTER_BEDRIJFSTAKKEN = new GRID(this)
   with (this.ROOSTER_BEDRIJFSTAKKEN)
      fontBold = true
      colorNormal = "black/silver"
      dataLink = form.vraagbak_bedrijfstak.rowset
      columns["COLUMN1"] = new GRIDCOLUMN(form.ROOSTER_BEDRIJFSTAKKEN)
      with (columns["COLUMN1"])
         dataLink = form.vraagbak_bedrijfstak.rowset.fields["aard"]
         editorType = 1        // EntryField
         width = 40.0
      endwith
      columns["COLUMN2"] = new GRIDCOLUMN(form.ROOSTER_BEDRIJFSTAKKEN)
      with (columns["COLUMN2"])
         dataLink = form.vraagbak_bedrijfstak.rowset.fields["soort"]
         editorType = 1        // EntryField
         width = 300.0
      endwith
      with (columns["COLUMN1"].headingControl)
         value = "aard"
      endwith

      with (columns["COLUMN2"].headingControl)
         value = "soort"
      endwith

      headingHeight = 22.0
      cellHeight = 22.0
      hasRowLines = false
      hasIndicator = false
      hasColumnHeadings = false
      allowEditing = false
      allowAddRows = false
      hScrollBar = 0        // Off
      height = 120.0
      left = 1015.0
      top = 205.0
      width = 253.0
   endwith

   this.TEKST_WEB = new TEXT(this)
   with (this.TEKST_WEB)
      height = 22.0
      left = 7.0
      top = 444.0
      width = 84.0
      colorNormal = "black/0x787878"
      fontName = "arial"
      fontBold = true
      text = "www"
   endwith

   this.VELD_WEB = new ENTRYFIELD(this)
   with (this.VELD_WEB)
      onLeftDblClick = class::VELD_WEB_ONLEFTDBLCLICK
      height = 30.0
      left = 120.0
      top = 442.0
      width = 660.0
      colorNormal = "black/silver"
      border = false
      fontName = "arial"
      fontSize = 18.0
      fontBold = true
      value = ""
      mousePointer = 13        // Hand
      borderStyle = 3        // None
   endwith

   this.TESKT_CONTACT = new TEXT(this)
   with (this.TESKT_CONTACT)
      height = 20.0
      left = 1015.0
      top = 55.0
      width = 84.0
      colorNormal = "black/0x787878"
      fontName = "arial"
      fontSize = 12.0
      fontBold = true
      text = "contact"
   endwith

   this.VELD_CREATIE = new ENTRYFIELD(this)
   with (this.VELD_CREATIE)
      height = 25.0
      left = 1285.0
      top = 15.0
      width = 95.0
      colorNormal = "black/silver"
      fontName = "arial"
      fontSize = 12.0
      fontBold = true
      value = ""
   endwith

   this.ROOSTER_MERK_PRODUCT = new GRID(this)
   with (this.ROOSTER_MERK_PRODUCT)
      fontBold = true
      colorNormal = "black/silver"
      dataLink = form.vraagbak_brandprod.rowset
      columns["COLUMN1"] = new GRIDCOLUMN(form.ROOSTER_MERK_PRODUCT)
      with (columns["COLUMN1"])
         dataLink = form.vraagbak_brandprod.rowset.fields["type"]
         editorType = 1        // EntryField
         width = 40.0
      endwith
      columns["COLUMN2"] = new GRIDCOLUMN(form.ROOSTER_MERK_PRODUCT)
      with (columns["COLUMN2"])
         dataLink = form.vraagbak_brandprod.rowset.fields["brand"]
         editorType = 1        // EntryField
         width = 173.0
      endwith
      columns["COLUMN3"] = new GRIDCOLUMN(form.ROOSTER_MERK_PRODUCT)
      with (columns["COLUMN3"])
         dataLink = form.vraagbak_brandprod.rowset.fields["product"]
         editorType = 1        // EntryField
         width = 225.0
      endwith
      with (columns["COLUMN1"].headingControl)
         value = "type"
      endwith

      with (columns["COLUMN2"].headingControl)
         value = "brand"
      endwith

      with (columns["COLUMN3"].headingControl)
         value = "product"
      endwith

      headingHeight = 22.0
      cellHeight = 22.0
      hasRowLines = false
      hasIndicator = false
      hasColumnHeadings = false
      allowEditing = false
      allowAddRows = false
      hScrollBar = 0        // Off
      height = 140.0
      left = 1015.0
      top = 375.0
      width = 465.0
   endwith

   this.KNOP_ALG_INFO = new PUSHBUTTON(this)
   with (this.KNOP_ALG_INFO)
      onClick = class::KNOP_ALG_INFO_ONCLICK
      height = 35.0
      left = 435.0
      top = 35.0
      width = 65.0
      text = ""
      upBitmap = "RESOURCE #112"
      mousePointer = 13        // Hand
   endwith

   this.ROOSTER_BEZOEK = new GRID(this)
   with (this.ROOSTER_BEZOEK)
      colorNormal = "black/silver"
      dataLink = form.vraagbak_bezoek.rowset
      columns["COLUMN1"] = new GRIDCOLUMN(form.ROOSTER_BEZOEK)
      with (columns["COLUMN1"])
         dataLink = form.vraagbak_bezoek.rowset.fields["visit"]
         editorType = 3        // SpinBox
         width = 89.0
      endwith
      columns["COLUMN2"] = new GRIDCOLUMN(form.ROOSTER_BEZOEK)
      with (columns["COLUMN2"])
         dataLink = form.vraagbak_bezoek.rowset.fields["time1"]
         editorType = 1        // EntryField
         width = 40.0
      endwith
      columns["COLUMN3"] = new GRIDCOLUMN(form.ROOSTER_BEZOEK)
      with (columns["COLUMN3"])
         dataLink = form.vraagbak_bezoek.rowset.fields["time2"]
         editorType = 1        // EntryField
         width = 40.0
      endwith
      with (columns["COLUMN1"].editorControl)
         rangeMax = {28/05/2003}
         rangeMin = {17/02/2003}
      endwith

      with (columns["COLUMN1"].headingControl)
         value = "bezoek"
      endwith

      with (columns["COLUMN2"].headingControl)
         value = "van"
      endwith

      with (columns["COLUMN3"].headingControl)
         value = "tot"
      endwith

      headingHeight = 22.0
      cellHeight = 22.0
      hasIndicator = false
      hasColumnHeadings = false
      allowEditing = false
      allowAddRows = false
      vScrollBar = 1        // On
      height = 120.0
      left = 1275.0
      top = 205.0
      width = 193.0
   endwith

   this.KLEVER_CONTACT = new TEXTLABEL(this)
   with (this.KLEVER_CONTACT)
      height = 22.0
      left = 1325.0
      top = 170.0
      width = 70.0
      text = "contact"
      colorNormal = "BtnText/0x787878"
      fontSize = 12.0
      fontBold = true
   endwith

   this.VELD_ID = new ENTRYFIELD(this)
   with (this.VELD_ID)
      height = 25.0
      left = 1185.0
      top = 15.0
      width = 84.0
      colorNormal = "black/silver"
      fontBold = true
      value = ""
   endwith

   this.VELD_REGIO = new ENTRYFIELD(this)
   with (this.VELD_REGIO)
      height = 30.0
      left = 456.0
      top = 242.0
      width = 432.0
      colorNormal = "black/silver"
      fontSize = 18.0
      fontBold = true
      value = ""
   endwith

   this.KNOP_BEDRIJFSTAK = new PUSHBUTTON(this)
   with (this.KNOP_BEDRIJFSTAK)
      onClick = class::KNOP_BEDRIJFSTAK_ONCLICK
      themeBackground = false
      height = 40.0
      left = 1015.0
      top = 160.0
      width = 162.0
      text = "aanpassen bedrijfstak"
      fontBold = true
      mousePointer = 13        // Hand
      colorNormal = "blue/0x78787885"
   endwith

   this.KNOP_MERKEN = new PUSHBUTTON(this)
   with (this.KNOP_MERKEN)
      onClick = class::KNOP_MERKEN_ONCLICK
      themeBackground = false
      height = 40.0
      left = 1015.0
      top = 330.0
      width = 364.0
      text = "aanpassen merken en producten"
      fontBold = true
      mousePointer = 13        // Hand
      colorNormal = "Blue/0x78787885"
   endwith

   this.KNOP_TOPICS = new PUSHBUTTON(this)
   with (this.KNOP_TOPICS)
      onClick = class::KNOP_TOPICS_ONCLICK
      themeBackground = false
      height = 30.0
      left = 1015.0
      top = 525.0
      width = 161.0
      text = "aanpassen topics"
      fontBold = true
      mousePointer = 13        // Hand
      colorNormal = "Blue/0x78787885"
   endwith

   this.KEUZEDOOS_SOORTEN = new COMBOBOX(this)
   with (this.KEUZEDOOS_SOORTEN)
      onChange = class::KEUZEDOOS_SOORTEN_ONCHANGE
      systemTheme = false
      height = 24.0
      left = 1015.0
      top = 120.0
      width = 210.0
      fontBold = true
      colorNormal = "black/silver"
      autoTrim = true
      dataSource = form.vraagbak_soorten.rowset.fields["description"]
      style = 2        // DropDownList
      dropDownHeight = 132.0
      selectAll = false
   endwith

   this.ROOSTER_TOPICS = new GRID(this)
   with (this.ROOSTER_TOPICS)
      fontBold = true
      colorNormal = "black/silver"
      dataLink = form.vraagbak_topic.rowset
      columns["COLUMN1"] = new GRIDCOLUMN(form.ROOSTER_TOPICS)
      with (columns["COLUMN1"])
         dataLink = form.vraagbak_topic.rowset.fields["topicbeschrijving"]
         editorType = 1        // EntryField
         width = 172.0
      endwith
      with (columns["COLUMN1"].headingControl)
         value = "topicbeschrijving"
      endwith

      headingHeight = 22.0
      cellHeight = 22.0
      hasIndicator = false
      hasColumnHeadings = false
      allowEditing = false
      allowAddRows = false
      height = 99.0
      left = 1015.0
      top = 561.0
      width = 196.0
   endwith

   this.rowset = this.vraagbak_stammdat.rowset

Function Knop_Eerst_onClick
  Form.rowset.first()
Return
*****

Function Form_onGotFocus
     // set application reference to this Form:
     //  If type( "_app.framewin" ) # "U"
     //    _app.framewin.currentForm = this
       //  endif
    class :: Vernieuw() // Form.Verniuew()
          form.bookmark = form.rowset.bookmark()
           Form.rowset.beginFilter()
            form.rowset.Fields["Country"].value = form.keuzedoos_land.value
             form.rowset.applyFilter()
              Form.rowset.goto(form.bookmark)
Return
*****

Function Form_onLostFocus
     // null out application's reference to this Form:
  if type( "_app.framewin.currentForm" ) # "U"
   _app.framewin.currentForm := null
  endif
Return
*****


Function Form_onOpen
  Class ::Veldenaanvang()
   // Form.keuzeDoos_Land.setFocus()                    //  deze doos wordt aangesproken
   //  Form.keuzeDoos_Keuze.enabled = false   // de doos_keuze wordt buiten werking gesteld  
   //   Form.Veld_Zoek.enabled = false  
   //   Form.keuzedoos_soorten.enabled = false// het veld Zoe wordt buiten werking gesteld
Return
*****

Function Knop_Vorig_onClick
  if not(Form.rowset.next(-1))
   Form.rowset.next()
    msgbox("Begin Data","kan niet verder",64)
  endif
Return
*****

Function Knop_Bezoek_onClick
    local Rdc,rdb
         Form.bookmark = Form.rowset.bookmark()
    //   Form.rowset.beginappend() // te houden
     set procedure to ..\forms\Calend.wfm additive
      private oChild  // commando TYPE() te kunnen gebruiken
      oChild = new calendForm()
      oChild.mdi = false
      oChild.date = Date()
      oChild.readModal()
    if type("oChild.date") # "D"
      Rdc = Form.vraagbak_bezoek.rowset
                Rdb = Form.vraagbak_STAMMDAT.rowset
      Rdc.beginappend()
      rdc.fields["idnummer"].value = rdb.fields["idnummer"].value
      Rdc.fields["visit"].value = oChild.date
                Rdc.Fields["time1"].value = oChild.keuzedoos_uur1.value
      Rdc.save()
     endif
          close procedure ..\Forms\calend.wfm
       Form.rowset.goto(form.bookmark)
    //  oChild.release()
       //Form.entryfieldvisit1.setfocus() te houden  
       //         Form.container1.visitsearchentryfield.setfocus() // te houde set procedure to calend.wfm additive
Return
*****

Function Knop_Web_onClick
    form.bookmark = form.rowset.bookmark()
              dcfstr =trim(Form.vraagbak_STAMMDAT.rowset.fields["street"].value)
     dcfplz= trim(Form.vraagbak_STAMMDAT.rowset.fields["plz"].value)
     dcfcit= trim(Form.vraagbak_STAMMDAT.rowset.fields["city"].value)    
       set procedure to ..\system2\GoogleMaps.cc additive
        da = new Maps()
         da.strasse := dcfstr
          da.plz := dcfplz
           da.ort := dcfcit
            da.ShowMap()
      // release object da
      da = null
       close procedure ..\system2\GoogleMaps.cc
    form.rowset.goto(form.bookmark)          
Return
*****


Function Knop_Volgend_onClick
  if not(Form.rowset.next(1))
   Form.rowset.next(-1)
    msgbox("Einde Data"," kan niet verder",64)
  endif  
Return
*****

Function Knop_Laatst_onClick
   Form.rowset.last()
Return
*****

Function Veld_EMAIL_onLeftDblClick(flags, col, row)
   local emailbladDD        
    set procedure to zendemail.wfm additive                
     emailbladDD = new zendemailForm()        
            emailbladDD.mdi = false        
                   emailbladDD.veld_adres_naar.value = this.form.veld_email.value
      emailbladDD.veld_Naam_naar.value = lTrim(rTrim(this.parent.vraagbak_contact.rowset.fields["name"].value)) + "  " + lTrim(rTrim(this.parent.vraagbak_contact.rowset.fields["voornaam"].value))
     emailbladDD.readmodal()
         close procedure zendemail.wfm         
Return
*****

Function Veld_Zoek_onKey(nChar, nPosition,bShift,bControl)
   Form.rowset.findKeynearest(lower(Form.Veld_Zoek.value))
Return
*****

Function VELD_FIRMA_when(bOpen) ;  Return false
*****
Function VELD_GSMFIRMA_when(bOpen) ; Return false
****
Function VELD_KONTAKT_when(bOpen) ;  Return false
*****
Function VELD_LAND_when(bOpen) ; Return false
****
Function VELD_POSTNR_when(bOpen) ; Return False
****  
Function VELD_STAD_when(bOpen) ; Return False
*****
Function VELD_STRAAT_when(bOpen) ; Return false
*****

Function VELD_TELEFOONFIRMA_onLeftMouseDown(flags, col, row)
   class::kopieren()
  Return
*****

Function VELD_TELEFOONFIRMA_when(bOpen)
Return false
*****
Function VELD_WEB_onLeftDblClick(flags, col, row)
    #include winuser.h
    extern cHandle ShellExecute( cHandle, cString, cString, ;
     cString, cString, cINT ) shell32 ;
      from "ShellExecuteA"
       cUrl = ["] + this.parent.veld_web.value + ["]
     private sd         && macro needs private not local
       sd = set( "dire" ) && sometimes it *could* change dirs, so
                    && we are preventing it ...
      ShellExecute( this.parent.hwnd,"open", ;
                          cURL,null, null,SW_SHOWMINIMIZED )
      * if the directory changed:
       if sd # set("dire")
         set dire to "&sd."
       endif  
Return
*****
  
Function VELD_ZOEK_onLostFocus
  this.Value = ""
Return
*****

Function VELD_ZOEK_onOpen
  if Form.keuzeDoos_Keuze.Value = "(Selecteren)"
    this.enabled = false
   else
    this.enabled = true
   endif
Return
*****

Function KNOP_TOPICS_onClick()
  local themas,cThemas
    set procedure to ..\forms\topicklant2.wfm additive
     this.themas = new klanttopic2Form()
      this.themas.top  = Form.top +400
       this.themas.left = form.left+300
        this.themas.midi = false
         this.themas.parent = form
          cThemas = form.rowset.fields["idnummer"].value
          this.themas.rowset.filter =[idnummer=']+cthemas+[']
         this.themas.readmodal()
        close procedure ..\forms\topicklant2.wfm
Return
*****

Function KEUZEDOOS_keuze_onChange
   form.knop_basis.enabled = true
         form.rowset.first()
          do case
      case this.value == "firma"
            Form.rowset.indexname := 'Company'
                  form.rowset.first()
         Form.Veld_Zoek.enabled = true
           Form.Veld_Zoek.setfocus()
                   Form.Veld_Zoek.ColorNormal= "black/yellow"
        Form.Veld_Zoek.Value =""
      case this.value == "stad"
       Form.rowset.indexname := 'citycode'
        form.rowset.first()
                      Form.Veld_Zoek.enabled = true
         Form.Veld_Zoek.setfocus()
                  Form.Veld_Zoek.ColorNormal= "black/yellow"
       Form.Veld_Zoek.Value =""
      case this.value == "postnummer"
       Form.rowset.indexname := 'Postcode'
                  form.rowset.first()
         Form.Veld_Zoek.enabled = true
          Form.Veld_Zoek.setfocus()
                  Form.Veld_Zoek.ColorNormal= "black/yellow"
       Form.Veld_Zoek.Value =""
      case this.value == "(selecteren)"
       Form.rowset.indexname := null
                  form.rowset.first()
         Form.Veld_Zoek.enabled = true
          Form.Veld_Zoek.setfocus()
        Form.Veld_Zoek.ColorNormal= "black/yellow"
             Form.Veld_Zoek.Value =""        
           otherwise
       Form.rowset.indexname := Null
                  Form.Veld_Zoek.enabled = false
          Form.Veld_Zoek.ColorNormal= "black/silver"
         form.knop_basis.enabled = false
         endcase
Return
*****

Function keuzeDOOS_LAND_onChange
   local cLand,cLandcode
     this.style = 2
     Class :: Veldenaanpassen()
     form.rowset.Filter = ' '
     cLand = form.vraagbak_stammdat.rowset.fields['country'].lookuprowset
      cLand.applyLocate("land = '" +this.value+"'")
       cLandcode = (cland.fields[1].value)
        form.rowset.Filter = [country =']+cLandcode+[']
Return
*****

Function veld_email_firma_onLeftDblClick(flags, col, row)
   set procedure to zendemail.wfm additive                
     local emailbladEE                
           emailbladEE = new zendemailForm()        
            emailbladEE.mdi = false        
                  emailbladEE.veld_adres_naar.value = this.form.veld_email_firma.value
                   emailbladEE.veld_Naam_naar.value = lTrim(rTrim(this.parent.vraagbak_contact.rowset.fields["name"].value)) + "  " + lTrim(rTrim(this.parent.vraagbak_contact.rowset.fields["voornaam"].value))
           emailbladEE.readmodal()
         close procedure zendemail.wfm         
Return
*******

Function KEUZEDOOS_SOORTEN_onChange()
  // form.rowset.filter = NULL
   local cSegm, cS, cMomentFilter
   this.style = 2
    cSegm = form.vraagbak_stammdat.rowset.fields['soort'].lookuprowset    //soort
     cSegm.applyLocate([description = '] +this.value+['])   // description
      cS = (cSegm.fields[1].value)
     cLand = form.vraagbak_stammdat.rowset.fields['country'].lookuprowset // land
      cLandcode = (cland.fields[1].value)
       form.rowset.Filter :=[soort =']+cS+['  and country = '] +clandcode+[']
         ? form.rowset.filter // result // soort ='0014'  and country = '0001'ok
          ? form.rowset.Filter = NULL + "1" // result is false Ok
    //      form.rowset filter = NULL  //form.rowset.filter = " "
  Return
  ****

Function KNOP_AANBIEDING_onClick()
   set procedure to ..\forms\opslaggegevens.wfm additive
    local dcForm, a,b,cMap
     a= ("d:\dfcc_programms\klantenoffer\") // aanpassen volgens pad
       b= trim(form.rowset.fields["name"].value)
                  cMap= (a+b )
          if right(cmap,1) # "\"
            cmap = cmap+"\"
          endif
   this.dcForm = new opslagForm()
    this.dcFORM.top = form.top + 400
      this.dcForm.left = form.left+ 300
            this.dcForm.text = cmap
         this.dcForm.midi = false
                         this.dcForm.Parent = form
            this.dcForm.readmodal()
        close procedure ..\forms\opslaggegevens.wfm
    this.dcForm := Null  
Return
*****

Function KNOP_ALG_INFO_onClick()
   local oExcel,rf,rc,oCell,nRij,xWaarde,nCols        
     store 0 to oExcel,rf,rc,oCell,nRij,xWaarde,nCols  
      rf := form.rowset.fields
      rc := form.vraagbak_contact.rowset.fields
    oExcel := new Oleautoclient("excel.application")
    oExcel.visible =true
    oExcel.workbooks.add()

     ***Firmagegevens***
    
         oExcel.range("a1").select()
    oExcel.ActiveCell.FormulaR1C1 = "naam"
    oExcel.range("a2").select()
    oExcel.ActiveCell.FormulaR1C1 = "straat"
    oExcel.range("a3").select()
    oExcel.ActiveCell.FormulaR1C1 = "postnummer"
    oExcel.range("a4").select()
    oExcel.ActiveCell.FormulaR1C1 = "stad"
    oExcel.range("a5").select()
    oExcel.ActiveCell.FormulaR1C1 = "land"
    oExcel.range("a6").select()
    oExcel.ActiveCell.FormulaR1C1 = "telefoon"
    oExcel.range("a7").select()
    oExcel.ActiveCell.FormulaR1C1 = "fax"
    oExcel.range("a8").select()
    oExcel.ActiveCell.FormulaR1C1 = [']+ "gsm"
    oExcel.range("a9").select()
    oExcel.ActiveCell.FormulaR1C1 = "email"
    oExcel.range("a10").select()
    oExcel.ActiveCell.FormulaR1C1 = "web"
    oExcel.range("a11").select()
    oExcel.ActiveCell.FormulaR1C1 = "segment"
    
        
         ***contactgegevens ****
         oExcel.Range("a15").select()
         oExcel.ActiveCell.formulaR1C1 = "Contact"
    oExcel.range("b15").select()
    oExcel.ActiveCell.FormulaR1C1 = "naam"
         oExcel.range("c15").select()
    oExcel.ActiveCell.FormulaR1C1 = "voornaam"
         oExcel.range("d15").select()
         oExcel.ActiveCell.FormulaR1C1 = "Funktie"
         oExcel.range("e15").select()
    oExcel.ActiveCell.FormulaR1C1 = "Telefoon"
    oExcel.range("f15").select()
    oExcel.ActiveCell.FormulaR1C1 = "Fax"
    oExcel.range("g15").select()
    oExcel.ActiveCell.FormulaR1C1 = "GSM"
         oExcel.Range("h15").select()
    oExcel.ActiveCell.FormulaR1C1 = "email"         
    
    ***firmadata****  
    oExcel.range("c1").select()
    oExcel.ActiveCell.FormulaR1C1 = rf["name"].value
    oExcel.range("c2").select()
    oExcel.ActiveCell.FormulaR1C1 = rf["street"].value
    oExcel.range("c3").select()
    oExcel.ActiveCell.FormulaR1C1 = ("'")+rf["plz"].value
    oExcel.range("c4").select()
    oExcel.ActiveCell.FormulaR1C1 = rf["city"].value
    oExcel.range("c5").select()
    oExcel.ActiveCell.FormulaR1C1 = rf["country"].value
    oExcel.range("c6").select()
    oExcel.ActiveCell.FormulaR1C1 = ("'")+rf["basetelefon"].value
    oExcel.range("c7").select()
    oExcel.ActiveCell.FormulaR1C1 = ("'")+rf["basefax"].value
    oExcel.range("c8").select()
    oExcel.ActiveCell.FormulaR1C1 = ("'")+rf["handy"].value
    oExcel.range("c9").select()
    oExcel.ActiveCell.FormulaR1C1 = rf["email"].value
    oExcel.range("c10").select()
    oExcel.ActiveCell.FormulaR1C1 = rf["web"].value
    oExcel.range("c11").select()
    oExcel.ActiveCell.FormulaR1C1 = rf["soort"].value
     nRij = 15
          form.vraagbak_contact.rowset.first()
    
         do while not form.vraagbak_contact.rowset.EndofSet
          nRij++
          for nCols = 2 to(rc.size-1)
           xWaarde = rc[nCols].value
            oCell= oExcel.activeSheet.Cells(nrij,nCols)
                  ocell.formula = "'" + (xWaarde)
          next          
      form.vraagbak_contact.rowset.next()
         enddo
         *****
        **** Activiteiten***
         nrij = nrij +2
    oExcel.Range("A" + nrij).select()
         oExcel.ActiveCell.formula = "Activiteit"  //R1C1
        
    do while not form.vraagbak_bedrijfstak.rowset.endofSet
           nRij++
                 for nCols = 2 to(form.vraagbak_bedrijfstak.rowset.fields.size-1)  
                  xWaarde = form.vraagbak_bedrijfstak.rowset.fields[nCols].value
                   oCell=oExcel.activesheet.Cells(nRij,nCols)
                         oCell.formula = "'" + (xWaarde)
                 next
        form.vraagbak_bedrijfstak.rowset.next()                   
  
         enddo
         *****
          **** Merken en Producten***
          
         nrij = nrij+2
         oExcel.Range("a"+nrij).select()
         oExcel.ActiveCell.formula = "Merk/Produkt"
        
         do while not form.vraagbak_brandProd.rowset.endofSet
           nRij++
                 for nCols = 2 to(form.vraagbak_brandProd.rowset.fields.size-3)
                  xWaarde = form.vraagbak_brandProd.rowset.fields[nCols].value
                   oCell=oExcel.activesheet.Cells(nRij,nCols)
                         oCell.formula = "'" + (xWaarde)
                 next
        form.vraagbak_brandProd.rowset.next()                   
          enddo
          
           *** Topics**
           nrij = nRij+2
           oExcel.Range("a"+nRij).select()
                oExcel.ActiveCell.formula = "Topics"
     do while not Form.vraagbak_topic.rowset.endofset
      nRij++
        for nCols =2 to(form.vraagbak_topic.Rowset.Fields.size)
         xWaarde = form.vraagbak_topic.rowset.fields[nCols].value
          oCell = oExcel.activesheet.cells(nRij,nCols)
                        if form.vraagbak_topic.rowset.Fields[nCols].Type = [character]
                           oCell.formula = form.vraagbak_topic.rowset.Fields["topicbeschrijving"].value
                        endif
         if form.vraagbak_topic.rowset.fields[ncols].type =[date]                  
          oCell.Formula ="" + form.vraagbak_topic.rowset.Fields["Datum"].value
                   endif
                 next // gaat te samen met for
                
       form.vraagbak_topic.rowset.next()                
                enddo
                 
          oExcel.ActiveSheet.Columns.AutoFit()
         oExcel =null
Return
*****


Function KNOP_BASIS_onClick()
   local of_Klant, cKlant
    form.bookmark = form.rowset.Bookmark()
     set procedure to ..\forms\stammcust.wfm additive
           this.of_Klant = new stammcustform()
       this.of_Klant.top = form.top + 400
        this.of_Klant.left = form.left + 300
         this.of_Klant.mdi := false        
          this.of_Klant.parent = this.parent
                   cKlant = Form.rowset.Fields["idnummer"].value
          this.of_Klant.idnummer= cKlant
          this.of_Klant.rowset.filter=[idnummer=']+cKlant+[']
       this.of_Klant.readModal()        
         Close procedure ..\forms\stammcust.wfm
     form.rowset.goto(form.bookmark)        
      form.Veld_zoek.setfocus()
            Form.Veld_Zoek.ColorNormal= "Red/Cyan"
      
Return
*****  

Function KNOP_BEDRIJFSTAK_onClick()
   local BedrijfT,cTak
   set procedure to ..\forms\bedrijfklant2.wfm additive
    this.bedrijfT = new Bedrijfklant2form()
                 this.bedrijfT.top := form.top + 400
                  this.bedrijfT.Left := form.left +300
                      this.BedrijfT.midi = false
                         this.BedrijfT.Parent = form
           cTak = form.rowset.Fields["idnummer"].value
                  this.bedrijfT.IdNrBranche = cTak
       this.BedrijfT.Rowset.filter:=[idnummer=']+cTak+[']                    
       this.Bedrijft.readModal()
                  close procedure ..\forms\bedrijfklant2.wfm
      form.veld_zoek.setFocus()
Return
****

Function KNOP_INFO_onClick()
  local oDCForm,cInf
   set procedure to ..\forms\InputInfo2.wfm  //Briwsinfo.wfm additive
    this.oDCForm = new InputInfo2Form() //browsinfoform()
     this.oDCForm.left = 200
      this.oDCForm.top = 250
        this.oDCForm.midi = false
         this.oDCForm.parent =form
          // this.oDCForm.idnummer= Form.rowset.fields["idnummer"].value
          //  this.oDCForm.rowset.Findkey(this.oDCForm.idnummer)
             cInf = form.rowset.fields["idnummer"].value   // bijgevoegd van kunden23.wfm
               this.OdcForm.rowset.filter =[Idnummer=']+cInf+['] //bijgevoegd van Kunde23.wfm
   this.oDCForm.readmodal()
   close procedure ..\forms\InputInfo2.wfm //Briwsinfo.wfm
Return
*****

Function KNOP_MERKEN_onClick()
  local vMerk,cMerk
    set procedure to ..\forms\brandcust2.wfm additive
     this.vMerk = new brandcust2form()
       this.vMerk.top = form.top + 400
        this.vMerk.left = form.left + 300
         this.vMerk.midi = false
          this.vMerk.parent = form
         cMerk = Form.rowset.Fields["idnummer"].value
       this.vMerk.rowset.filter=[idnummer=']+cMerk+[']
      this.vMerk.readModal()
     close procedure ..\forms\Brandcust2.wfm
      form.veld_zoek.setFocus()
Return
*****

Function KNOP_OMZET_onClick()
   Local oOmzetForm,cOmz
          form.bookmark = form.rowset.bookmark()
       Set procedure to ..\forms\kwant_info.wfm additive
        this.oOmzetform = new Kwant_infoForm()
         this.oOmzetForm.Left = 300
          this.oOmzetForm.top = 200
           this.oOmzetForm.midi = false
            this.oOmzetForm.text = this.parent.text +"   " +this.parent.vraagbak_stammdat.rowset.fields["name"].value
             this.oOmzetForm.Parent = this.parent
              // this.oOMzetform.Idnummer = form.vraagbak_bypass.rowset.fields["idnummer"].value
            //   this.oOmzetForm.Rowset.Findkey(this.oOmzetForm.Idnummer)
                cOmz = form.vraagbak_bypass.rowset.fields["idnummer"].value  
               this.oOmzetForm.rowset.filter =[Idnummer=']+cOmz+[']
            this.oOmzetForm.Readmodal()
             this.oOmzetForm.release()
         close Procedure ..\forms\Kwant_info.wfm
          this.oOmzetForm := null  
       form.rowset.goto(form.bookmark)                                        
Return
*****

Function KNOP_OPMERK_onClick()
   set procedure to ..\forms\opslaggegevens.wfm additive
   local dcForm, a,b,cMap
     a= ("d:\dfcc_programms\klanteninfo\") // aanpassen volgens pad
       b= trim(form.rowset.fields["name"].value)
                  cMap= (a+b )
          if right(cmap,1) # "\"
            cmap = cmap+"\"
          endif
   this.dcForm = new opslagForm()
    this.dcFORM.top = form.top + 400
      this.dcForm.left = form.left+ 300
            this.dcForm.text = cmap
         this.dcForm.midi = false
                         this.dcForm.Parent = form
            this.dcForm.readmodal()
        close procedure ..\forms\opslaggegevens.wfm
    this.dcForm := Null  


Return
*****



Function Veldenaanvang
   Form.Veld_Bezoek.datalink= ""
      Form.Veld_BezoekStad.datalink = ""
       Form.Veld_Contact_Tel.datalink = ""
        Form.Veld_Creatie.datalink = ""
         Form.Veld_Email.datalink = ""
     Form.Veld_Email_Firma.datalink = ""  
      Form.Veld_Firma.datalink = ""
       Form.Veld_GsmFirma.datalink = ""
        Form.Veld_ID.datalink = ""
         Form.Veld_Kontakt.datalink = ""
      Form.Veld_KontaktGsm.datalink = ""
       Form.Veld_Land.Datalink =""
        Form.Veld_Postnr.datalink = ""
         Form.Veld_Postnr_Bezoek.datalink =""
          Form.Veld_Regio.Datalink= ""
    
       Form.Veld_Stad.datalink = ""
        Form.Veld_Straat.datalink = ""
         Form.Veld_TelefoonFirma.datalink = ""
          Form.Veld_Vertegenwoordiger.datalink= ""
      Form.Veld_Web.Datalink= ""
       Form.Rooster_bedrijfstakken.visible = false
        Form.Rooster_Bezoek.visible = false
         Form.Rooster_Kontakt.visible = false
          Form.Rooster_Merk_Product.visible = false
          Form.keuzeDoos_land.datalink = ""
      
         form.knop_basis.enabled = false //true
         form.rooster_topics.visible = false
      
      Form.knop_Bezoek.enabled = false
       Form.Knop_Eerst.enabled = false
        Form.Knop_Laatst.enabled = false
         Form.Knop_Volgend.enabled = false
          Form.Knop_Vorig.enabled = false
           Form.Knop_web.enabled = false
                     form.keuzedoos_land.value = "selecteer een land"

         Form.keuzeDoos_Land.setFocus()                    //  deze doos wordt aangesproken
          Form.keuzeDoos_Keuze.enabled = false   // de doos_keuze wordt buiten werking gesteld  
           Form.Veld_Zoek.enabled = false  
            Form.keuzedoos_soorten.enabled = false// het veld Zoe wordt buiten werking gesteld
    Msgbox("Selekteer een land"+chr(13)+;
               "Geen Data","View Customer *** Bci***",64)
Return
*****

Function Veldenaanpassen
   Form.Veld_Bezoek.datalink= form.vraagbak_bezoekadres.rowset.fields["street"]
    Form.Veld_BezoekStad.datalink = form.vraagbak_bezoekadres.rowset.fields["city"]
     Form.Veld_Contact_Tel.datalink =  form.vraagbak_contact.rowset.fields["telefon"]
      Form.Veld_Creatie.datalink =form.vraagbak_stammdat.rowset.fields["creatie"]
       Form.Veld_Email.dataLink = form.vraagbak_contact.rowset.fields["email"]
  
   Form.Veld_Email_Firma.dataLink = form.vraagbak_stammdat.rowset.fields["email"]
    Form.Veld_Firma.datalink = form.vraagbak_stammdat.rowset.fields["name"]
     Form.Veld_GsmFirma.dataLink = form.vraagbak_stammdat.rowset.fields["handy"]
      Form.Veld_ID.dataLink = form.vraagbak_stammdat.rowset.fields["idnummer"]
       Form.Veld_Kontakt.dataLink = form.vraagbak_stammdat.rowset.fields["choice"]

   Form.Veld_KontaktGsm.dataLink = form.vraagbak_contact.rowset.fields["gsm"]
    Form.Veld_Land.dataLink = form.vraagbak_stammdat.rowset.fields["country"]
     Form.Veld_Postnr.dataLink = form.vraagbak_stammdat.rowset.fields["plz"]
      Form.Veld_Postnr_Bezoek.dataLink = form.vraagbak_bezoekadres.rowset.fields["plz"]
       Form.Veld_Regio.dataLink = form.vraagbak_stammdat.rowset.fields["province"]

   form.veld_kontakt.datalink = form.vraagbak_stammdat.rowset.fields["choice"]      // ?
    Form.Veld_Stad.dataLink = form.vraagbak_stammdat.rowset.fields["city"]
     Form.Veld_Straat.dataLink = form.vraagbak_stammdat.rowset.fields["street"]
      Form.Veld_TelefoonFirma.dataLink = form.vraagbak_stammdat.rowset.fields["basetelefon"]
       Form.Veld_Vertegenwoordiger.dataLink = form.vraagbak_stammdat.rowset.fields["outside"]
  
   Form.Veld_Web.dataLink = form.vraagbak_stammdat.rowset.fields["web"]
    Form.keuzedoos_soorten.enabled = true
   Form.keuzeDoos_Keuze.enabled = true
    Form.knop_Bezoek.Enabled = true
     Form.Knop_Eerst.Enabled = true
      Form.Knop_Laatst.enabled= true
       Form.Knop_Volgend.enabled= true
        Form.Knop_Vorig.enabled = true
         Form.Knop_web.Enabled = true
      Form.Rooster_bedrijfstakken.visible = true
        Form.Rooster_Bezoek.visible = true
         Form.Rooster_Kontakt.visible = true
          Form.Rooster_Merk_Product.visible = true
          Form.keuzeDoos_soorten.enabked = true
          form.rooster_topics.visible = true
        form.keuzeDoos_Keuze.ColorNormal ="black/Silver"
      Form.Veld_Zoek.value = ""
            form.keuzeDoos_keuze.Value = "(selecteren)"
        form.keuzedoos_soorten.value = "(selecteren)"
          form.knop_basis.enabled = false
Return
*****

Function Vernieuw
  parameter oForm
   if type( "oForm" ) == "U" or empty( oForm )
    oForm = Form
   endif
   if type( "UpdateWindow" ) # "FP"
    extern CLOGICAL UpdateWindow( CHANDLE ) USER32
   endif
Return UpdateWindow( oForm.hWnd )
*****
                
Function Kopieren
    if type('form.activeControl.Copy()') == 'fp'
     form.activeControl.keyboard("{home}{shift+end}") // this.parent.form.activeControl.keyboard("{home}{shift+End}")
     form.activeControl.Copy()  
    endif
Return
*****

Endclass

/*Function DisplayFilesInDir
   *-------------------------*
      local i, n, cFile, ext, oItem, cText
      private cDir, oItemToSelect //oItemToSelect MUST be private for the 'type' test !!!
      *
      form.treeView1.releaseAllChildren()
      cDir = form.SelDir
      *
      aFiles = new array() //store to use in GetDisplayItem()
      *
      n = aFiles.Dir( (cDir) + "*.*", "RASH" ) //Get ALL files in the indicated folder. See array class OLH. Returns a 5 collumn array
      for i = 1 to n  // Loop trough the temp array to get only the file names.
        cFile = aFiles[i,1] //Read the filename in the first collumn of the array for row (i)
        cAttr = aFiles[i,5] //Read the file attribute in the fith collumn of array for row (i)
        if "D" $ cAttr      //if the attribute indicates a dir...
          //..do nothing
        else
          oItem = new treeItem( form.treeView1,cFile)  //add an item to the treeview.
          oItem.text = cFile //set the text for the treeview item
        endif
      next

      release object aFiles //get rid of tmp array
      aFiles = null //disassociate var with array type to make sure
      *
      form.treeView1.sortChildren()
      Return

Function knop_aanmaak_contact_onClick
   set procedure to ..\forms\custview.wfm additive
     local kConForm,cCont
      this.kConForm = new CustviewForm()
       this.kConForm.left = 400
        this.kconForm.top = 200
                  this.kConForm.parent= this.parent  
        cCont = form.rowset.fields["idnummer"].value
        this.kConForm.rowset.filter =[idnummer=']+cCont+[']    // kan ook met findkey(cCont)
           cNaam = this.parent.vraagbak_Kontakt.rowset.fields["name"].value
            this.kConform.vraagbak_contact.rowset.filter=[name=']+cNaam+[']
          this.kConForm.readmodal()
        Close procedure ..\forms\custview.wfm        
  Return                                              
  *****
  /*local FdcForm
          form.bookmark = form.rowset.bookmark()
     set procedure to ..\forms\Cust_compl.wfm additive
     this.FdcForm = new Cust_complform()
       this.FdcFORM.top = form.top + 400
         this.FdcForm.left = form.left+ 300
           this.FdcForm.midi = false
            this.FdcForm.parent = form
           this.FdcForm.Idnummer =form.rowset.fields["idnummer"].value
          This.FdcForm.rowset.Findkey(this.FdcForm.idnummer)
         this.fdcform.readmodal()
        this.FdcForm.release()
       close procedure ..\forms\Cust_compl.wfm
     This.FdcForm := Null  
           form.rowset.goto(form.bookmark)
*/

/*Function Basisaanpas
  cLand = Form.keuzedoos_Land.Value
        Form.Rowset.BeginFilter()
    Form.RowSet.filter =[Country=']+cLand+[']
     Form.Rowset.ApplyFilter()
           form.knop_basis.enabled = true
Return                  
*****
*/
/*Function Kleurveranderen
  Do Case
    Case Form.keuzeDoos_Keuze.Value ="City"
     form.Veld_Zoek.ColorNormal= "black/Cyan"
    Case Form.keuzeDoos_Keuze.Value ="Zipcode"
     Form.Veld_Zoek.ColorNormal= "black/Cyan"
    Case Form.keuzeDoos_Keuze.Value ="Company"
     Form.Veld_Zoek.ColorNormal= "black/Cyan"
    OtherWise
    Form.Veld_Zoek.ColorNormal= "black/silver"
   EndCase
Return
*****
*/
*/