home *** CD-ROM | disk | FTP | other *** search
- ******************************************************************************
- * PROGRAM NAME: LEVERAN.PRG
- * VENDORS DATABASE SCREEN
- * SAMPLE BUSINESS APPLICATION PROGRAM
- * LAST CHANGED: 080692
- * WRITTEN BY: Borland International Inc.
- ******************************************************************************
- *
- * FILES USED:
- * Database file = Verkoper.dbf (Vendors file)
- * Index file = Verkoper.mdx
- * TAG: Verkoop_nr = verkoop_nr <= Master index
- * External procedure file = Biblio.prg
- ******************************************************************************
-
- * Main procedure
- PROCEDURE Leveran
-
- * Link to external procedure file of "tool" procedures
- SET PROCEDURE TO Biblio
-
- * Set up database environment
- DO Set_env
-
- SET COLOR TO &c_standard.
-
- * Declare variables used:
- * Database memory variables
- korting = 0
- STORE "" TO verkoop_nr, verkoper, adres1, adres2, woonplaats, provincie, postcode, telefoon, ;
- contact, intern, condities
-
- * Miscellaneous variables - used to pass parameters to Library
- STORE "VERKOPER" TO dbf, mlist && Standard report and mailing list is available
- cust_rpt = "N/B" && No custom reports available
- STORE "m->verkoop_nr" TO key, key1
- STORE "GEEN" TO key2, key3
- keyname1 = "Verkoopnr.:"
- STORE "" TO keyname2, keyname3
- list_flds = "VERKOOP_NR, VERKOPER, TELEFOON"
-
- * Open databases files and choose active indexes
- SELECT 1
- USE Verkoper ORDER Verkoop_nr
- GO TOP
- * Used for area code lookup
- USE Netnum ORDER Woonplaats IN 2
-
- record_num = RECNO()
- * Load initial record from database into memory variables
- DO Load_fld
-
- * Show data screen
- CLEAR
- DO Dstatus
- DO Backgrnd
- DO Show_data
-
- * Define popup menus
- DO Bar_def
-
- * Activate main popup menu - execute user choices
- SET COLOR TO &c_popup.
- ACTIVATE POPUP main_mnu
- DO Sub_ret
- *
- RETURN
- *================= end of main procedure ===================================
-
- * UTILITY PROCEDURES (Proprietary to Vendors.prg)
-
- PROCEDURE Filter
- * Filter (group) data into subset
- * Select subset to set up filter condition (Y=turn on,N=abort selection,T=turn off)
- * If filter is already on, set default choice to T, show window
- * If filter is not on, set default choice to Y, show window
- choice = IIF(filters_on,"U","J")
- DO Filt_ans
- IF choice = "J"
- * Start process of choosing filter condition
- STORE SPACE(15) TO woonplaats, condities
- STORE SPACE(2) TO provincie
- STORE SPACE(7) TO postcode
- ACTIVATE WINDOW alert
- * Get users filter condition selection(s)
- @ 0,0 SAY "------- FILTERVOORWAARDE OPGEVEN -------"
- @ 1,1 SAY "WOONPLAATS: " GET m->woonplaats FUNCTION "!"
- @ 2,1 SAY "PROVINCIE: " GET m->provincie PICTURE "!!"
- @ 3,1 SAY "POSTCODE: " GET m->postcode
- @ 4,1 SAY "CONDITIES: " GET m->condities FUNCTION "!"
- READ
- DEACTIVATE WINDOW alert
- * Initialize filter condition variable to null (empty)
- PUBLIC subset1,subset2,subset3,subset4,subset5
- subset1 = ""
- * Process user's entries to build filter condition
- subset2 = subset1 + IIF([] <> TRIM(m->woonplaats), ;
- [UPPER(woonplaats) = UPPER(TRIM(m->woonplaats)) .AND. ], [])
- subset3 = subset2 + IIF([] <> TRIM(m->provincie), ;
- [provincie = TRIM(provincie) .AND. ], [])
- subset4 = subset3 + IIF([] <> TRIM(m->postcode), ;
- [postcode = TRIM(postcode) .AND. ], [])
- subset5 = subset4 + IIF("" <> TRIM(m->condities), ;
- [condities = TRIM(condities) .AND. ], [])
- subset = subset5
- *
- * Check whether data entered into subset string
- IF "" = TRIM(subset)
- DO Warnbell
- filters_on = .F.
- ELSE
- * If string is not empty, truncate the .AND. from end of subset string
- subset = SUBSTR(subset,1,LEN(subset)-6)
- * Filter on entered filter string condition
- SET FILTER TO &subset.
- * Activate filter by moving record pointer
- GO TOP
- * Check whether filter condition matches any records (none matching=EOF)
- filters_on = .NOT. EOF() && Filter is turned on if .T. (matching record)
- IF .NOT. filters_on
- * Turn off filter if no matching records found
- DO Warnbell
- DO Show_msg WITH "0 records voldoen aan filtervoorwaarde"
- SET FILTER TO
- GO record_num
- ENDIF
- ENDIF
- ELSE
- * If user selects "T", turn off filter
- SET FILTER TO
- filters_on = .F.
- ENDIF
- RETURN
-
- PROCEDURE Indexer
- * Create/rebuild index
- INDEX ON verkoop_nr TAG Verkoop_nr
- GO TOP
- RETURN
-
- PROCEDURE Init_fld
- * Initialize memory variable values - for data entry
- STORE SPACE(4) TO verkoop_nr,intern
- STORE SPACE(30) TO verkoper, adres1, adres2, contact
- condities = SPACE(15)
- korting = 0
- woonplaats = SPACE(20)
- provincie = SPACE(2) && Could be any state or blank
- postcode = SPACE(7)
- telefoon = SPACE(13)
- RETURN
-
- PROCEDURE Load_fld
- * Copy field values from Vendors database record into memory variables
- verkoop_nr = verkoop_nr
- verkoper = verkoper
- adres1 = adres1
- adres2 = adres2
- woonplaats = woonplaats
- provincie = provincie
- postcode = postcode
- telefoon = telefoon
- contact = contact
- intern = intern
- condities = condities
- korting = korting
- RETURN
-
- PROCEDURE Repl_fld
- * Replace database fields with values of current memory variables
- REPLACE verkoop_nr WITH m->verkoop_nr,verkoper WITH m->verkoper, ;
- adres1 WITH m->adres1,adres2 WITH m->adres2, ;
- woonplaats WITH m->woonplaats,provincie WITH m->provincie, ;
- postcode WITH m->postcode,telefoon WITH m->telefoon, ;
- contact WITH m->contact,intern WITH m->intern, ;
- condities WITH m->condities,korting WITH m->korting
- RETURN
-
- PROCEDURE Backgrnd
- * Display screen for data entry and viewing
- * Draw and fill in boxes
- @ 14, 5 TO 14,52 COLOR &c_red.
- @ 1,22 TO 3,53 DOUBLE COLOR &c_blue.
- @ 5, 4 TO 7,27 DOUBLE COLOR &c_red.
- @ 8, 4 TO 19,53 COLOR &c_red.
- @ 2,23 FILL TO 2,52 COLOR &c_blue.
- @ 6, 5 FILL TO 6,26 COLOR &c_red.
- @ 9, 5 FILL TO 18,52 COLOR &c_red.
- * Show data
- SET COLOR TO &c_data.
- @ 2,28 SAY "DATABASE LEVERANCIERS"
- @ 6, 6 SAY "LEVERANCIERNR:"
- @ 9, 6 SAY "NAAM: "
- @ 10, 6 SAY "ADRES:"
- @ 12, 6 SAY "WOONPLAATS: "
- @ 13, 6 SAY "PROVINCIE: "
- @ 13,30 SAY "POSTCODE:"
- @ 15, 6 SAY "CONTACT:"
- @ 16, 6 SAY "TELEFOON: "
- @ 16,32 SAY "INTERN:"
- @ 17, 6 SAY "CONDITIES: "
- @ 18, 6 SAY "KORTING:"
- @ 18,20 SAY "%"
- SET COLOR TO &c_standard.
- RETURN
-
- PROCEDURE Show_data
- SET COLOR TO &c_fields.
- @ 6,21 SAY verkoop_nr
- @ 9,18 SAY verkoper
- @ 10,18 SAY adres1
- @ 11,18 SAY adres2
- @ 12,18 SAY woonplaats
- @ 13,18 SAY provincie
- @ 13,40 SAY postcode
- @ 15,18 SAY contact
- @ 16,18 SAY telefoon
- @ 16,41 SAY intern
- @ 17,18 SAY condities
- @ 18,18 SAY korting PICTURE "99"
- SET COLOR TO &c_standard.
- RETURN
-
- PROCEDURE Get_data
- SET COLOR TO &c_data.
- @ 6,21 GET m->verkoop_nr PICTURE "9999" ;
- VALID Duplicat(&key.) ;
- ERROR "Ongeldig leveranciernr.; voer ander nummer in" ;
- MESSAGE "Typ een leveranciernr. (4 cijfers) of annuleer met Esc."
- @ 9,18 GET m->verkoper FUNCTION "!" ;
- MESSAGE "Naam van leverancier"
- @ 10,18 GET m->adres1 FUNCTION "!"
- @ 11,18 GET m->adres2 FUNCTION "!"
- @ 12,18 GET m->woonplaats PICTURE "!XXXXXXXXXXXXX"
- @ 13,18 GET m->provincie PICTURE "!!"
- @ 13,40 GET m->postcode
- @ 15,18 GET m->contact FUNCTION "!" ;
- MESSAGE "Naam van contactpersoon"
- @ 16,18 GET m->telefoon PICTURE "999X9X9999999"
- @ 16,41 GET m->intern PICTURE "9999" ;
- MESSAGE "Toestelnummer"
- @ 17,18 GET m->condities FUNCTION "!" ;
- MESSAGE "Verkoopcondities van leverancier"
- @ 18,18 GET m->korting PICTURE "99" ;
- MESSAGE "Gewenste kortingspercentage"
- SET COLOR TO &c_standard.
- ON KEY LABEL F9 DO Findcode WITH m->woonplaats
- RETURN
-
-