home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a070 / 3.ddi / FOXPRO / SAMPLE / PAYMENTS.PRG < prev    next >
Encoding:
Text File  |  1989-11-08  |  6.6 KB  |  263 lines

  1. * ┌─────────────────────────────────────────────────────────────────────┐ *
  2. * │  PROG NAME: PAYMENTS.PRG - Payments file Maintenance.               │ *
  3. * │  Copyright (c) 1989 Tech III, Inc. All rights reserved.             │ *
  4. * │  Tech III of San Pedro, California      (213) 547-2191.             │ *
  5. * │  "The bridge connecting people and technology."(tm)                 │ *
  6. * └─────────────────────────────────────────────────────────────────────┘ *
  7. ACTIVATE WINDOW screensim
  8. DO setup
  9. SELECT invoice
  10. SET ORDER TO inv_cus
  11. SELECT customer
  12. IF BOF() .OR. EOF()
  13.   GO TOP
  14.   IF EOF()
  15.     DO standby WITH "Customer file is Empty."
  16.     RETURN
  17.   ENDIF
  18. ENDIF
  19. SET ORDER TO cus_cus
  20. IF EOF()
  21.   GO TOP
  22. ENDIF
  23. STORE cust_id TO mcust_id
  24. mtotal=0.00
  25. STORE '  CUSTOMER                           ' TO bar_label1
  26. STORE '  PAYMENTS                             ' TO bar_label2
  27. SELECT payments
  28. SET ORDER TO pmt_cus
  29. SEEK mcust_id
  30. DO disp_scrn
  31. DO disp_pmt
  32.  
  33. STORE .t. TO paymnts
  34. DO WHILE paymnts
  35.   ACTIVATE MENU paymnts PAD pbrowse
  36.   IF .NOT. in_prodemo
  37.       DEACTIVATE MENU
  38.   ENDIF
  39. ENDDO
  40.  
  41. DO shutdown
  42. RETURN
  43.  
  44. PROCEDURE add_pmt
  45.   SELECT payments
  46.   ACTIVATE WINDOW screensim BOTTOM
  47.   APPEND BLANK
  48.   REPLACE cust_id WITH mcust_id, DATE WITH DATE()
  49.   DO brow_paym
  50.   SEEK mcust_id
  51.   IF FOUND()
  52.     DELETE REST FOR amount = 0 WHILE cust_id = mcust_id
  53.   ENDIF
  54.   DO disp_pmt
  55.   RETURN
  56.   
  57. PROCEDURE brow_paym  && Browse & Change
  58.   SELECT payments
  59.   ACTIVATE WINDOW w_payments BOTTOM
  60.   SHOW WINDOW browhelp
  61.   ON KEY LABEL F10 keyboard CHR(23)
  62.   SHOW WINDOW w_payments TOP
  63.   BROWSE KEY mcust_id ;
  64.   NOAPPEND NODELETE NOMENU NOCLEAR SAVE;
  65.   WINDOW w_payments ;
  66.   FIELDS date:15, reference:15, amount:15
  67.   SHOW WINDOW w_payments SAVE
  68.   ON KEY LABEL F10
  69.   HIDE WINDOW browhelp
  70.   RETURN
  71.   
  72. PROCEDURE brow_pmt  && Browse to scroll only
  73.   SELECT payments
  74.   ACTIVATE WINDOW screensim BOTTOM
  75.   SHOW WIND w_payments TOP
  76.   SHOW WINDOW browhelp
  77.   ON KEY LABEL F10 keyboard CHR(23)
  78.   
  79.   BROWSE KEY mcust_id ;
  80.   NOMODIFY NOAPPEND NODELETE NOMENU NOCLEAR SAVE;
  81.   WINDOW w_payments ;
  82.   FIELDS date:15, reference:15, amount:15
  83.   
  84.   SHOW WINDOW w_payments SAVE
  85.   ON KEY LABEL F10
  86.   HIDE WINDOW browhelp
  87.   RETURN
  88.   
  89. PROCEDURE chg_pmt
  90.   SELECT payments
  91.   DO brow_paym
  92.   SEEK mcust_id
  93.   IF FOUND()
  94.     DELETE ALL FOR amount = 0 WHILE cust_id = mcust_id
  95.   ENDIF
  96.   SEEK mcust_id
  97.   DO disp_pmt
  98.   RETURN
  99.   
  100. PROCEDURE del_pmt
  101.   SELECT payments
  102.   DO msg2user WITH 'DELETION INSTRUCTIONS', ;
  103.   'Edit amount to equal zero.', 'System will then remove the item.'
  104.   DO brow_paym
  105.   DO msg2user WITH 'CLOSE'k
  106.   SEEK mcust_id
  107.   IF FOUND()
  108.     DELETE REST FOR amount = 0 WHILE cust_id = mcust_id
  109.   ENDIF
  110.   SEEK mcust_id
  111.   DO disp_pmt
  112.   RETURN
  113.   
  114. PROCEDURE disp_pmt
  115.   SELECT customer
  116.   ACTIVATE WINDOW w_customer
  117.   mcust_id = cust_id
  118.   @ 00,18 SAY mcust_id
  119.   @ 02,01 SAY company
  120.   @ 03,01 SAY address1
  121.   @ 04,01 SAY city
  122.   @ 04,27 SAY state
  123.   @ 04,31 SAY zip
  124.   SELECT payments
  125.   @ 02,58 SAY ' <calculating>'
  126.   @ 03,58 SAY ' <calculating>'
  127.   @ 04,58 SAY ' <calculating>'
  128.   mtotsale = CUSTSALES()
  129.   @ 02,58 SAY mtotsale PICT '999,999,999.99'
  130.   mtotpaym = CUSTPAYM()
  131.   @ 03,58 SAY mtotpaym PICT '999,999,999.99'
  132.   mdiff = mtotsale - mtotpaym
  133.   @ 04,58 SAY mdiff PICT '999,999,999.99'
  134.   SELECT payments
  135.   ACTIVATE WINDOW screensim BOTTOM
  136.   @ 20,00 GET bar_label1 COLOR SCHEME 3
  137.   @ 20,39 GET bar_label2 COLOR SCHEME 3
  138.   CLEAR GETS
  139.   BROWSE KEY mcust_id ;
  140.   NOWAIT NOMENU WINDOW w_payments ;
  141.   FIELDS date:15, reference:15, amount:15
  142.   RETURN
  143.   
  144. PROCEDURE disp_scrn
  145.   ACTIVATE WINDOW w_customer
  146.   CLEAR
  147.   @ 00,01 SAY "Customer number: "
  148.   @ 02,42 SAY "Total Invoices:"
  149.   @ 03,42 SAY "Total Payments:"
  150.   @ 04,42 SAY "   Amount Owed:"
  151.   CLEAR GETS
  152.   RETURN
  153.   
  154. PROCEDURE last_cus
  155.   SELECT customer
  156.   GO BOTTOM
  157.   DO disp_pmt
  158.   RETURN
  159.   
  160. PROCEDURE next_cus
  161.   SELECT customer
  162.   IF .NOT. EOF()
  163.     SKIP
  164.   ENDIF
  165.   IF EOF()
  166.     GO BOTTOM
  167.     DO standby WITH "End of file: there is no NEXT record."
  168.   ELSE
  169.     DO disp_pmt
  170.   ENDIF
  171.   RETURN
  172.   
  173. PROCEDURE prev_cus
  174.   SELECT customer
  175.   SKIP -1
  176.   IF BOF()
  177.     GO TOP
  178.     DO standby WITH "Beginning of file: there is no PREVIOUS record."
  179.   ELSE
  180.     DO disp_pmt
  181.   ENDIF
  182.   RETURN
  183.   
  184. PROCEDURE quit_pay
  185.   STORE .f. TO paymnts
  186.   DEACTIVATE MENU
  187.   RETURN
  188.   
  189. PROCEDURE setup
  190.   
  191.   DEFINE WINDOW w_customer FROM 02,02 TO 09,76 COLOR SCHEME 10
  192.   DEFINE WINDOW w_payments FROM 11,02 TO 20,76 CLOSE COLOR SCHEME 10
  193.   
  194.   DEFINE WINDOW browhelp FROM 09,17 TO 09,63 NONE CLOSE COLOR SCHEME 7
  195.   ACTIVATE WINDOW browhelp NOSHOW
  196.   @ 00,01 SAY 'When finished editing, press [F10].'
  197.   HIDE WINDOW browhelp
  198.   
  199.   DEFINE MENU paymnts COLOR SCHEME 3
  200.   DEFINE PAD pnext   OF paymnts PROMPT '\<Next'   AT 21,00
  201.   DEFINE PAD pprev   OF paymnts PROMPT '\<Prev'   AT 21,07
  202.   DEFINE PAD pfirst  OF paymnts PROMPT '\<First'  AT 21,14
  203.   DEFINE PAD plast   OF paymnts PROMPT '\<Last'   AT 21,22
  204.   DEFINE PAD psearch OF paymnts PROMPT '\<Search' AT 21,29
  205.   DEFINE PAD pbrowse OF paymnts PROMPT '\<Browse' AT 21,39
  206.   DEFINE PAD pnew    OF paymnts PROMPT '\<Add'    AT 21,48
  207.   DEFINE PAD pchange OF paymnts PROMPT '\<Change' AT 21,54
  208.   DEFINE PAD pdelete OF paymnts PROMPT '\<Delete' AT 21,63
  209.   DEFINE PAD pquit   OF paymnts PROMPT '\<Quit'   AT 21,72
  210.   
  211.   ON SELECTION PAD pnext      OF paymnts DO next_cus
  212.   ON SELECTION PAD pprev      OF paymnts DO prev_cus
  213.   ON SELECTION PAD pfirst     OF paymnts DO top_cus
  214.   ON SELECTION PAD plast      OF paymnts DO last_cus
  215.   ON SELECTION PAD psearch    OF paymnts DO srch_cus
  216.   ON SELECTION PAD pbrowse    OF paymnts DO brow_pmt
  217.   ON SELECTION PAD pnew       OF paymnts DO add_pmt
  218.   ON SELECTION PAD pchange    OF paymnts DO chg_pmt
  219.   ON SELECTION PAD pdelete    OF paymnts DO del_pmt
  220.   ON SELECTION PAD pquit      OF paymnts DO quit_pay
  221.   
  222.   RETURN
  223.   
  224. PROCEDURE shutdown
  225.   IF WEXIST('Payments')
  226.     HIDE WINDOW payments
  227.   ENDIF
  228.   USE
  229.   USE payments IN 5 INDEX pmt_cus, pmt_dat          ALIAS payments
  230.   RELEASE WINDOW w_payments
  231.   RELEASE WINDOW w_customer
  232.   SELECT invoice
  233.   SET ORDER TO inv_inv
  234.   CLEAR
  235.   DEACTIVATE WINDOW screensim
  236.   ACTIVATE SCREEN
  237.   RETURN
  238.   
  239. PROCEDURE srch_cus
  240.   SELECT customer
  241.   ACTIVATE WINDOW w_customer
  242.   last_rec=RECNO()
  243.   STORE SPACE(LEN(mcust_id)) TO mcust_id
  244.   @ 00,18 GET mcust_id PICTURE '!!!!!!'
  245.   READ
  246.   STORE PADL(TRIM(mcust_id),6) TO mcust_id
  247.   SEEK mcust_id
  248.   IF .NOT. FOUND()
  249.     DO standby WITH 'The customer id you have entered is not on file.'
  250.     GO last_rec
  251.     mcust_id = customer->cust_id
  252.   ENDIF
  253.   DO disp_pmt
  254.   RETURN
  255.   
  256. PROCEDURE top_cus
  257.   SELECT customer
  258.   GO TOP
  259.   DO disp_pmt
  260.   RETURN
  261.   
  262.   * EOF
  263.