home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Visual Database / Visual dBase Pro v7.0 / DATA1.CAB / Sample_dBASE / Mugs / InvoiceOpen.wfm < prev    next >
Encoding:
Text File  |  1997-11-20  |  3.7 KB  |  159 lines

  1. //--------------------------------------------------------------
  2. //
  3. //  InvoiceOpen.wfm - Mugs Sample Application
  4. //
  5. //  Invoice Open dialog for selecting an Invoice from the
  6. //  Customer data entry form..
  7. //
  8. //  Dependencies: <none>
  9. //
  10. //  Visual dBASE Samples Group
  11. //
  12. //  $Revision:   1.7  $
  13. //
  14. //  Copyright (c) 1997, Borland International, Inc. 
  15. //  All rights reserved.
  16. //
  17. //---------------------------------------------------------------
  18. ** END HEADER -- do not remove this line
  19. //
  20. // Generated on 10/23/97
  21. //
  22. parameter bModal
  23. local f
  24. f = new InvoiceOpenForm()
  25. if (bModal)
  26.    f.mdi = false // ensure not MDI
  27.    f.readModal()
  28. else
  29.    f.open()
  30. endif
  31.  
  32. class InvoiceOpenForm of FORM
  33.    with (this)
  34.       autoCenter = true
  35.       scaleFontSize = 8
  36.       scaleFontBold = false
  37.       height = 11
  38.       left = 30
  39.       top = 0
  40.       width = 35
  41.       text = ""
  42.    endwith
  43.  
  44.  
  45.    this.DMCONNECT = new DATAMODREF()
  46.    this.DMCONNECT.parent = this
  47.    with (this.DMCONNECT)
  48.       filename = "connect.dmd"
  49.       dataModClass = "ConnectDataModule"
  50.       share = 0
  51.       active = true
  52.       left = 0
  53.       top = 0
  54.    endwith
  55.  
  56.  
  57.    this.LISTINVOICE = new LISTBOX(this)
  58.    with (this.LISTINVOICE)
  59.       onOpen := { ; this.curSel := 1 }
  60.       height = 8
  61.       left = 2
  62.       top = 2
  63.       width = 17
  64.       metric = 0
  65.       id = 101
  66.       fontName = "MS Sans Serif"
  67.       fontSize = 8
  68.       colorHighLight = "HighLightText/HighLight"
  69.    endwith
  70.  
  71.  
  72.    this.BUTTONOPEN = new PUSHBUTTON(this)
  73.    with (this.BUTTONOPEN)
  74.       onClick = class::BUTTONOPEN_ONCLICK
  75.       height = 1.2105
  76.       left = 21
  77.       top = 2.3684
  78.       width = 12
  79.       text = "&Open"
  80.       metric = 0
  81.       default = true
  82.       fontName = "MS Sans Serif"
  83.       fontSize = 8
  84.       group = true
  85.       colorNormal = "BtnText/BtnFace"
  86.       value = false
  87.    endwith
  88.  
  89.  
  90.    this.BUTTONCANCEL = new PUSHBUTTON(this)
  91.    with (this.BUTTONCANCEL)
  92.       onClick = {; this.form.close()}
  93.       height = 1.2105
  94.       left = 21
  95.       top = 4.2632
  96.       width = 12
  97.       text = "Cancel"
  98.       metric = 0
  99.       fontName = "MS Sans Serif"
  100.       fontSize = 8
  101.       group = true
  102.       colorNormal = "BtnText/BtnFace"
  103.       value = false
  104.    endwith
  105.  
  106.  
  107.    this.TEXT1 = new TEXT(this)
  108.    with (this.TEXT1)
  109.       height = 1
  110.       left = 2
  111.       top = 1
  112.       width = 9
  113.       metric = 0
  114.       colorNormal = "BtnText"
  115.       fontName = "MS Sans Serif"
  116.       fontSize = 8
  117.       text = "Invoice:"
  118.    endwith
  119.  
  120.  
  121.    // {Linked Method} form.buttonopen.onClick
  122.    function BUTTONOPEN_OnClick
  123.       local nInvoiceID
  124.       nInvoiceID = VAL(this.form.listInvoice.value)
  125.       if ( TYPE("this.form.app") == "O" )
  126.          this.form.app.openInvoiceForm( nInvoiceID )
  127.       endif
  128.    return ( this.form.close() )
  129.  
  130.    function FillInvoiceList( nCustomerID )
  131.       local i, q
  132.       i = 1
  133.       q = new Query()
  134.       with ( q )
  135.          database := this.dmConnect.ref.dbMugs
  136.          sql      := 'SELECT invoice."Invoice ID" ' + ;
  137.                      ' FROM "invoice.dbf" invoice ' + ;
  138.                      ' WHERE invoice."Customer ID" = ' + STR(nCustomerID)
  139.          active   := true
  140.       endwith
  141.  
  142.       this.iCount = q.rowset.count()
  143.  
  144.       if ( this.iCount > 0 )
  145.          this.aInvoice = new Array( this.iCount )
  146.          for i = 1 to this.iCount
  147.             this.aInvoice[i] = q.rowset.fields["Invoice ID"].value
  148.             q.rowset.next()
  149.          next
  150.          this.aInvoice.sort()
  151.          this.listInvoice.dataSource := "ARRAY form.aInvoice"
  152.          this.listInvoice.curSel     := this.iCount
  153.       endif
  154.  
  155.       q.active  := false
  156.       this.text := "Customer - " + LTRIM(STR(nCustomerID))
  157.    return ( this.iCount > 0 )
  158. endclass
  159.