


    DR_FILES.DOC for Version 4.02 printed January 23, 2002

    DR_FILES.DOC is monolithic programmer's documentation for DRAINS system.
    Version 4.00 is first version.  Document started 11/23/99.

    \DR4DEV is development directory. I believe Roto-Rooter is no longer
    interested in revisions of the program, so I have stripped much of
    CMP_ROTO code. For last thoughts including RR, see version 3.08 in Borg's
    C:\RRDEV. Version 3.07 was the last released RR version, still running at
    RR18 through May 2000.  RR18 has now been converted to PCSMS.

    DR_FILES.DOC is programmer's documentation.
    DRNSUnnn.DOC is user's documentation.

              ===================================================










































     DRAINS 4.02 programmer's .DOC 01/02 KGH Nicholes * Page 1


    Multi-Session Conflict Control DRAINS 2.13..
    read; only a problem if exclusive use needed for ZAP, PACK, indexing or
    BACKUP
    edit record; conflicts w/edit same record, append is OK; warn read
    edit file; conflicts w/edit record or edit file; warn read
    append; conflicts w/editing BROWSE (file edit); warn read
    Note: indexing to TEMPIX must declare the indexed file Writefile.
    DRWHYDEL doesn't need resource token in 2.17..4.00; only appends or reads.
    DRSTR131 and DRSTRG79 don't need resource token in 4.00; only read.

    000/032/132/159 (159-132=27)
    DATABASE files (read/write/writefile/append)
    065/097/197/224 Aa \DRAINS\DRACCRCV INDEX &PA2IDX.DXACCRCV (TAGS..
    066/098/198/225 Bb \DRAINS\DRINCOME and DRAGINGR (4.00)
    067/099/199/226 Cc \DRAINS\DRCLIENT, \DRAINS\DRINTRVL
    068/100/200/227 Dd \DRAINS\DRJDESCR (Addl Job Descriptions 4.00)
    069/101/201/228 Ee \DRAINS\DREMPCOM INDEX &PA2IDX.EIX
    070/102/202/229 Ff \DRAINS\DRREFERR (2.14)
    071/103/203/230 Gg \DRAINS\DRWORKEM (added 4.00)
    072/104/204/231 Hh \DRAINS\DRWOHIST
    073/105/205/232 Ii \DRAINS\DRSCHSVC (DRINTRVL included in Client marker)
    074/106/206/233 Jj \DRAINS\DRJOURNL
    075/107/207/234 Kk \DRAINS\DRCUSTTY (2.14)
    *    l           Ll RotoRooter report files (added 2.14, removed 4.00)
    077/109/209/236 Mm \DRAINS\DRCLM131.DBF; DRCLMAIL.DBF; DRMAIL.DBF
    078/110/210/237 Nn \DRAINS\DRFINDER
    *079/111/211/238 Oo \DRAINS\DRCLSRTO (Close Ratio Report 2.14, removed
          4.00)
    080/112/212/239 Pp \DRAINS\DRPAYABL INDEX &PA2IDX.PIX, &PA2IDX.PNIX
    *    q           Qq
    082/114/214/241 Rr \DRAINS\DRWORKOR
    083/115/215/242 Ss \DRAINS\DRSVCPER INDEX &PA2IDX.SIX, &PA2IDX.SNIX
    084/116/216/243 Tt \DRAINS\DRTEMP.DBF; TEMP1.DBF; TEMP2.DBF; TEMPIX
    085/117/217/244 Uu \DRAINS\DRCUSTOM
    086/118/218/245 Vv \DRAINS\DRREVCAT INDEX &PA2IDX.VIX
    087/119/219/246 Ww \DRAINS\DRWORKTY (Work Type Codes 2.14)
    088/120/220/247 Xx \DRAINS\DRTAXGRP INDEX &PA2IDX.XIX
    089/121/221/248 Yy \DRAINS\DRPHONEG INDEX YIX (YNIX obsolete in 2.13)
    090/122/222/249 Zz \DRAINS\DRTOWNSH INDEX &PA2IDX.TIX; \RRDRNS\DRZIPCOD
          INDEX ZIX RotoRooter ZIP code check (2.14)

    For an analysis of multiuser considerations done for version 3, see Borg's
          C:\RRDEV\Ver3Cnfl.DOC.
    For an analysis of multiuser considerations done for version 4, see Borg's
          C:\DR4DEV\Menu.DOC. Since there are a number of programs in
          \DR4DEV\PREVPRGS and UTIL that use MulPermit and these codes, for
          simplicity's sake I am not rearranging them now or renaming
          MulPermit.









     DRAINS 4.02 programmer's .DOC 01/02 KGH Nicholes * Page 2


    A_ Account (DRACCRCV)
    B_ Income Log (DRINCOME)
    C_ Client (DRCLIENT)
    D_ device control
    E_ Employee commissions (DREMPCOM)
    F_ REFERRAL
    G_ Aging (DRAGINGR)
    H_ DRJDESCR (JOBDSCIX)
    I_ DRINTEVL
    J_ Journal (DRJOURNL)
    K_ DRCUSTTY
    L_, LL_ low level subroutines (LL_ in ParseAdr)
    M_ temporary variables used in Main menu Options & Submenu functions
    N_
    O_ used by submenus
    P_ Payables (DRPAYABL)
    PR_ printing subroutine
    Q_
    R_ Request, History, Deletion Audit (DRWORKOR, DRWOHIST, DRWHYDEL)
    S_ Servicepeople, Prescheduled service (DRSVCPER, DRSCHSVC)
    S13_ STRING 131 long utility file
    S8_ STRING 79 long utility file
    T_ DRTOWNSH
    U_ Customization/Utility (DRCUSTOM)
    V_ DRREVCAT
    W_ DRWORKTY
    X_ DRTAXGRP
    Y_ County (DRPHONEG)
    Z_ DRZIPCOD

    Diagnostics wanted: Check R_JOBRECID unique, check A/H_JOBRECID found.
    Check H_LINESEQNs grouped 01..13, no dups.
    * remove unusable lines
      IF FOUND()
       DELETE REST FOR ;
       .NOT. AT(H_LINESEQN,"01020304050607080910111213") ;
       WHILE H_JOBRECID=JOBRECID
      ENDIF   && FOUND()

    Finder/Commission info is found in 2 files (DrWorkEm & DrEmpCom) which
    match up with DrWorkOr and DrWOHist.
    * ------------------------------------------------------------------------
    * DrWorkEm (w/WorkOr): simple single job editing only
    * Can't know $s/# ways split until job is closed.
    * DrEmpCom (w/History): complex editing, reporting
    * ------------------------------------------------------------------------
    *{A} 1 finder can note amount, 0/1 assign
    *{BE/BC} 1 finder, chg/add/del assign(s) & add note.
    *{PT} move records DrWorkEm->DrEmpCom
    *{OB} 1 finder, chg/add/del assign(s).
    *{KDB} create records automatically & verify
    *{KDC} enter details





     DRAINS 4.02 programmer's .DOC 01/02 KGH Nicholes * Page 3


    * ------------------------------------------------------------------------
    SPnFILTR is raw filter, may be blank or have (R_) variable prefixes
    SPnFILTN is .F. if SPnFILTR is blank, else has R_ stripped.
             The .F. avoids a problem with .AND. &SPnFILTN
    * ------------------------------------------------------------------------

* ----------------------------------------------------------------------------
* ----------------------------------------------------------------------------

 SET COLOR OF SCHEME 01 TO SCHEME &MCOLOR
 SET COLOR OF SCHEME 01 TO ;
  "W+/N,N/W,W+/W,W+/N,N+/W,W+/W,W+/N,N+/N,N/W,N+/W,-" && initial palatte
 SET COLOR OF SCHEME 01 TO SCHEME 02
 SET COLOR OF SCHEME 01 TO SCHEME 10    && prepare for browse
 LL_COLOR = SCHEME(01)
 SET COLOR OF SCHEME 01 TO &LL_COLOR
  @ 07,11 SAY "Enter password:"
  SET COLOR OF SCHEME 01 TO X/X,X/X

TRANSFORM(RIGHT(DTOC(DATE,1),4)+LEFT(DTOC(DATE,1),4),"@R !!/!!/!!!!")
TRANSFORM(RIGHT(DTOC(DATE,1),4)+SUBSTR(DTOC(DATE,1),3,2),"@R !!/!!/!!")

* ----------------------------------------------------------------------------
* ----------------------------------------------------------------------------
MENU.DOC multiuser analysis implemented 06/07/00:
DRAINS.PRG version 4.00 Main menu loop
 - on the way in, read WorkOr(R)/History(H)/Custom(U)
 - backup reminder does own FLOCK() checking
* ----------------------------------------------------------------------------
 A. Create Service Request    DrainsA   && Create Service Request
    @ 10,41 SAY "Enter 'E' to re-edit, or   "
    @ 11,42 SAY  "'P' to seek phone/unit,    "
    @ 12,42 SAY  "'N' to seek name,          "
    @ 13,42 SAY  "'A' to seek address,       "
    @ 13,42 SAY  "'B' to seek billing name,  "
    @ 14,42 SAY  "'C' to continue when done, "
    @ 15,42 SAY  "'R' recovers entered info, "
    @ 16,42 SAY  "'H' shows address history, "
    @ 17,42 SAY  "'M' recalls Main menu: _   "
  - reads/appends Client(C), reads History(H), reads SvcPer(S), reads
      Finder(N), appends WorkEm()/WorkOr(), reads/writes Custom(Uu) (J#),
      reads Townsh(Z)/ZipCod(Z), reads WorkTy(W), reads TaxGrp(X)

 B. Edit / Close Work Order   DrainsB   && Edit / Close Work Order
   @ 03,53 SAY "Press -Enter- for next  "
   @ 04,53 SAY "  record, or enter      "
   @ 05,53 SAY "'P' for previous record,"
   @ 06,53 SAY "'H' to hunt, E' to edit,"
   @ 07,53 SAY "'C' to set closing      "
   @ 08,53 SAY "  defaults and edit,    "
   @ 09,53 SAY "'T' to manually enter   "
   @ 10,53 SAY "  sales tax,            "





     DRAINS 4.02 programmer's .DOC 01/02 KGH Nicholes * Page 4


   @ 11,53 SAY "'X' to cancel or restore"
   @ 12,53 SAY "  work order, or        "
   @ 13,53 SAY "'M' for Main menu:      "
  - reads (C)Client /(D)JDescr /(G)WorkEm /(N)Finder /(R)WorkOr /(S)SvcPer
      /(W)WorkTy /(X)TaxGrp /(Z)Townsh&ZipCod, writes (d)JDescr /(g)WorkEm
      /(r)WorkOr, appends ()JDescr /()WorkEm, writes (u)Custom (if J#)

 C. Dispatch Tools   DrainsC            && Dispatch Tools
  A. Set job order and group limits
   - read SvcPer(S)
  B. Browse Active Jobs / Done job & job assignment info entry
     (^Done job(RrS) ^Assign/priority(RrS) ^View(R) ^Order(R))
   - read/write Request(Rr), read SvcPer(S)
  C. Active Work Order List
   - read Request(R) to own-station temporary file
  D. Done Jobs Report
   - read Request(R) to own-station temporary file
  M. recall Main menu
   - (none)

 D. Invoice Batch Print       DrainsD   && Invoice Batch Print
  - Read WorkOr(R), read History(H), read TaxGrp(X)

 E. Client Mailings           DrainsE   && Client mailings
   - writefile Mailings()/TempIX() need to be reserved all through due to
      temp work kept during other function use until menu is left
  A. Toggle screen/printer:
   - (none)
  B. Edit selection limits
   - (none)
  C. Edit label format
   - (none)
  D. Print billing address labels
   - read Client(C)/History(H), writefile Mailings/TempIX()
  E. Print job site labels
   - read Client(C)/History(H), writefile Mailings/TempIX()
  F. Select & check text
   - (none)
  G. Print text, replacing tokens
   - read Client(C)/History(H), writefile Mailings/TempIX()
  H. Test print labels or text
   - (none)
  I. Sort by city/name/zip
   - (none)
  J. Ignore Unit ID when eliminating duplicate phone numbers:
   - (none)
  M. Main menu

 F. Bank Deposit Journal      DrainsF   && Bank Deposit Journal
  A. Copy information from Work Orders to Journal & Accounts Receivable
   - read WorkOr(R), write Client(c)/WorkOr(r), append AccRcv()/Journal()
  B. Scan / Edit / Delete Journal records





     DRAINS 4.02 programmer's .DOC 01/02 KGH Nicholes * Page 5


   -Enter- for next record,
   'P' for previous record,
   'E' to edit,
   'D' to delete,
   'H' to hunt another record,
   'M' for Journal menu
   - read/write Journal(Jj), read Client(C)
  C. Add Journal record
   - append Journal(), read Client(C)
  D. Cash & Check Journal Reports
   A. Toggle Screen Display / Printer Printout
   B. Select name, job#, or phone sort
   C. " + M_JTYPE + " Journal 80-column"
   D. " + M_JTYPE + " Journal 132-column"
   E. " + M_JTYPE + " Journal Tax Group Revenue Report"
   F. Reports C/D and E listed above"
   G. " + M_JTYPE + " Journal 132-column with Tax Group Subtotals"
   Enter 'M' for Journal menu, or enter selection (A..G):"
   - read/write Journal(Jj)/TaxGrp(X)
  F. Credit Card Journal Reports
   - read/write Journal(Jj)/TaxGrp(X)
  E. Clear Cash & Check Journal Records
   - writefile Journal()
  G. Clear Credit Card Journal Records
   - writefile Journal()

 G. Accounts Receivable / ROA DrainsG   && Accounts Receivable / ROA
  A. Record a Received on Account payment, scan/change/delete acct records
      @ 18,46 SAY "Enter ' ' for next record, or   "
      @ 19,46 SAY " 'P' for previous record,       "
      @ 20,46 SAY " 'R' to enter received on acct.,"
      @ 21,46 SAY " 'E' to edit, 'D' to delete,    "
      @ 22,46 SAY " 'H' to hunt another record, or "
      @ 23,46 SAY " 'M' for Acc. Receivable menu:  "
   - read/write/append AccRcv(Aa), read/write Client(Cc), append Journal(),
      read Townsh(Z)/ZipCod(Z), write History(h)
  B. Record an account debit or an account credit
   - read/write Client(Cc), read Townsh(Z)/ZipCod(Z), append
      AccRcv()/Journal()
  C. Accounts Receivable reports
   A. Toggle Screen Display / Printer Printout
   B. Group limits
   C. Report setup
   D. Acc.Rcv. Detail
   E. Acc.Rcv. Summary
   F. Aging (wide)
   G. Aging (narrow)
   Enter 'M' for Accounts Receivable menu
   - read AccRcv(A), filewrite AgingR()
  D. Discard $0.00 balances older than specified date
   - writefile AccRcv()
  E. Add interest to accounts





     DRAINS 4.02 programmer's .DOC 01/02 KGH Nicholes * Page 6


   - write AccRcv(a) plus GF runs automatically
  F. Recalculate account balances
   - writefile Client(), read AccRcv(A)
  Enter 'M' for Main menu

 H. Statements                DrainsH   && Statements
  A. Set statement group limits
   - (none)
  B. Specify itemization start date
   - (none)
  C. Enter message to include with statements
   - (none)
  D. Forms justification test print
   - (none)
  E. Print statements
   - read/writefile AccRcv(A), read Client(C), writefile Temp()
  Enter 'M' for Main menu

 I. Site-Specific Auxiliary   DrainsI   && Site-Specific Auxiliary
  1A..9L.
   - (selected program w/own checking)
  ^ Attach auxiliary modules
   - write DrAuxPrg unlikely to conflict, ignore

 J. Client File Maintenance   DrainsJ   && Client File Maintenance
  A. Add/Edit/Delete Client Information
   ' ' for next record,
   'P' for previous,
   'E' to edit,
   'D' to delete,
   'H' to hunt again,
   'M' for menu
   - read/write/append Client(Cc)/Interval(Cc), read Townsh(Z)/ZipCod(Z),
      read SvcPer(S)
  B. Print Client Information  (132 columns wide)
   - read Client(C)
  C. Scheduled Service Reports and Work Order Generation
    {JCA} Refresh Scheduled Service Dates
    {JCB} Scheduled Service Report Selections
    {JCC} Scheduled Service List
    {JCD} View History for Scheduled Service List Members
    {JCE} Create Work Orders for Marked Scheduled Service
    {JCF} Print Service Requests for Marked Scheduled Service
    {JCG} Create Work Order for Specified Scheduled Service
    {JCH} Print Service Request for Specified Scheduled Service
    {JCI} Print Scheduled Service Interval List
    {JCJ} Inactive Scheduled Service List
    {JCM} for Client menu
    - writefile schsvc(), temp() need to be reserved all through due to temp
      work kept during other function use until menu is left
   A. Refresh Scheduled Service Dates
    - read/write Interval(Cc)





     DRAINS 4.02 programmer's .DOC 01/02 KGH Nicholes * Page 7


   B. Scheduled Service Report Selections
    - (none)
   C. Scheduled Service List
    - (CDEFG) writefile schsvc(), read Client(C)/Interval(C), temp()
    - read SchSvc(I)
   D. View History for Scheduled Service List Members
    - writefile schsvc(), read Client(C)/Interval(C), temp(), read
      History(H)
   E. Create Work Orders for Marked Scheduled Service
    - (CDEFG) writefile schsvc(), read Client(C)/Interval(C), temp()
    - append WorkOr()
   F. Print Service Requests for Marked Scheduled Service
    - (CDEFG) writefile schsvc(), read Client(C)/Interval(C), temp()
   G. Create Work Order for Specified Scheduled Service
    - (CDEFG) writefile schsvc(), read Client(C)/Interval(C), temp()
    - append WorkOr()
   H. Print Service Request for Specified Scheduled Service
    - (CDEFG) writefile schsvc(), read Client(C)/Interval(C), writefile
      temp()
   I. Print Scheduled Service Interval List
    - read Client(C)/Interval(C)
   J. Inactive Scheduled Service List
    - read Interval(C)
   Enter 'M' for Client menu
  D. Change Client's Phone Number
   - read/write
      Client(Cc)/Interval(Cc)/WorkOr(Rr)/History(Hh)/Journal(Jj)/AccRcv(Aa)
  E. Change Client's Billing Address
   - read AccRcv(A)/Client(C)/Request(R), write Client(c)/Request(r),
      writefile AccRcv()
  F. Print Inactive Client List
   - Read Client(C)
  G. Print List of Clients Authorized to Charge
   - Read Client(C)
  H. Print List of Charge Allowed and Scheduled Service Clients
   - Read Client(C)
  I. Print List of Unduplicated Clients Authorized to Charge
   - read/temp index on Client(C), writefile Temp()
  J. Print List of Best Clients
   - read/temp index on History(H), writefile Temp()
  Enter 'M' for Main menu

 K. Servicepeople & Finders DrainsK     && Servicepeople & Finders
  A. Serviceperson Add/Edit/Delete Information
   -Enter- for next record,
   'P' for previous,
   'E' to edit,
   'D' to delete,
   'M' for Serviceperson menu:
   - read/write/append SvcPer(Ss)
  B. Finder Add/Edit/Delete Information
   - read/write/writefile Finder(Nn)





     DRAINS 4.02 programmer's .DOC 01/02 KGH Nicholes * Page 8


  1. Serviceperson Print List
   - read SvcPer(S)
  2. Finder Print List
   - read Finder(N)
  C. Close Ratio Report
   - writefile SvcP() need to be reserved all through due to temp work kept
      during other function use until menu is left
   A. Toggle Screen Display / Printer Printout
    - (none)
   B. Edit report date span
    - (none)
   C. Limit report to one serviceperson
    - read SvcPer(S)
   D. Produce Close Ratio Report
    - read History(H)/EmpCom(E), writefile unique temp, writefile SvcPer()
   Enter 'M' for Serviceperson menu
  D. Serviceperson/Finder Commission Reports
   A. Change verify & edit date span
    - (none)
   B. Verify commission file for History jobs
    - read History(H), writefile EmpCom(), read SvcPer(S)/Finder(N)
   C. Edit commissions
    - writefile EmpCom(), read History(H)/SvcPer(S)
   D. Edit finder fees
    - read History(H)/Finder(N), writefile EmpCom()
   E. Change report date span
    - (none)
   F. Commission report
    - read History(H)/EmpCom(E)/SvcPer(S), writefile unique temp
   G. Finder report
    - read History(H)/EmpCom(E)/Finder(N), writefile unique temp
   Enter 'M' for Serviceperson menu
  Enter 'M' for Main menu

 L. Maintain Customization    DrainsL   && Customization Maintenance
  - writefile Custom(), BootID

 M. Lookup Table Maintenance  DrainsM   && Lookup Table Maintenance
 A. Add/Edit/Delete Revenue Category Information
  - read/write/append RevCat(Vv), read History(H)
 B. Add/Edit/Delete Customer Type Information
  - read/write/append CustTy(Kk), read History(H)
 C. Add/Edit/Delete Referral Code Information
  - read/write/append Referr(Ff), read History(H)
 D. Add/Edit/Delete Work Type Information
  - read/write/append WorkTy(Ww)
 E. Add/Edit/Delete Municipality Code Information
  - read/write/append Townsh(Zz)
 F. Add/Edit/Delete ZIPcode Check Information
  - filewrite ZipCode()
 G. Add/Edit/Delete Tax Group Information
  - read/write/append TaxGrp(Xx)





     DRAINS 4.02 programmer's .DOC 01/02 KGH Nicholes * Page 9


 1. Print Revenue Category List
  - read RevCat(V)
 2. Print Customer Type List
  - read CustTy(K)
 3. Print Referral Code List
  - read Referr(F)
 4. Print Work Type List
  - read WorkTy(W)
 5. Print Municipality Code List
  - read Townsh(Z)
 6. Print ZIPcode Check List
  - read ZipCode(Z)
 7. Print Tax Group List
  - read TaxGrp(X)
 Enter 'M' for Main menu

 N. Backup                    DrainsN   && Backup
  A. Select DRAINS backup destination floppy drive
   - (none)
  B. Format floppy diskette(s)
   - (none)
  C. Backup database files (*.DBF) via PKZIP
   - exclusive use of system, write Custom(u)
  D. Write backup batch file \DRAINBAK.BAT
   - (none)
  E. Test DRAINDBF.ZIP backup disk set
   - (none)
  Enter 'M' for Main menu

 O. History Reports & Maint.  DrainsO   && History Reports & Maint.
  A. Set History group limits
   - read SvcPer(S)
  B. Scan/Edit/Delete History records
   -Enter- for next record,
   'P' for previous record,
   'B' for brief mini-menu,
   'F' for full mini-menu,
   'E' to edit this record,
   'T' to manually enter sales tax,
   'D' to delete,
   'H' to hunt again,
   'M' for History menu
       @ 03,53 SAY "Press -Enter- for next  "
       @ 04,53 SAY "  record, or enter      "
       @ 05,53 SAY "'P' for previous record,"
       @ 06,53 SAY "'B' for brief mini-menu,"
       @ 07,53 SAY "'E' to edit this record,"
       @ 08,53 SAY "'T' to manually enter   "
       @ 09,53 SAY "  sales tax,            "
       @ 10,53 SAY "'D' to delete,          "
       @ 11,53 SAY "'H' to hunt again, or   "
       @ 12,53 SAY "'M' for History menu:   "





     DRAINS 4.02 programmer's .DOC 01/02 KGH Nicholes * Page 10


 "  )next, P)revious, F)ull mini, E)dit, T)ax entry, D)elete, H)unt, M)enu:_ "
   - read/write History(Hh), read/write/append EmpCom(Ee), read
      Client(C)/SvcPer(S)/Townsh(Z)/ZipCod(Z)/TaxGrp(X), append DelAudit,
      write AccRcv(a)/Journal(j)
  C. Display History record synopsis list
   - read History(H)
  D. History reports
   - reads many files checks in module based on report, writefile unique temp
  E. Change a Work Order's payment type in History and books
   - read/write History(Hh), read/write/append Journal(Jj)/AccRcv(aA)
  Enter 'M' for Main menu

 P. Archive Closed Jobs       DrainsP   && Archive Closed Jobs
  'T' to transfer jobs only,
  'P' to pack and reindex also,
  'M' for Main menu
  - exclusive system access: filewrite
      AccRcv()/Client()/CustTy()/EmpCom()/Finder()/Interval()/JDescr()/
      Journl/Payable()/Referr()/RevCat()/SvcPer()/TaxGrp()/Townsh()/Hist
      ory()/WorkEm()/WorkOr()/WorkTy()/ZipCod(), append
      History()/EmpCom()
  - crossfile reference should be stable while moving items from active to
      History

 Q. Exit DRAINS               LogMeOut
   - (none)

 ^. Programmer's tools        PrgTools
  A. SUSPEND program
   - (none)
  B. CLEAR PROGRAM
   - (none)
  C. Set ESCAPE ON
   - (none)
  D. Turn on F5 display of free memory
   - (none)
  E. List programmer's Function Keys
   - (none)
  F. Edit password
   - writefile Custom()
  G. Edit U_WRNTYLST
   - writefile Custom()
  H. Edit A/R cascade
   - writefile AccRcv()
  I. Edit DRBOOTID
   - exclusive use(!)
  J. Issue DOS command
   - (none)
  K. Run Program
   - (none)
  Enter 'M' for Main menu
* ----------------------------------------------------------------------------





     DRAINS 4.02 programmer's .DOC 01/02 KGH Nicholes * Page 11


DRACCPAY.PRG was old Main menu I. ACCOUNTS PAYABLE
 {IA} Add/Edit/Delete Payable bills
    -Enter- to see next Payable,
    'E' to edit this Payable
    'D' to delete this Payable
    'C' to create a new record for this vendor,
    'M' for Accounts Payable menu
 {IB} Enter payments
 {IC} Display Payable record synopsis list
 {ID} Vendor bill balance report
    'I' for itemized report by vendor name
    'S' for summary report by phone number
 {IE} Clear paid bills
 {IM} for Main menu
* ----------------------------------------------------------------------------
* ----------------------------------------------------------------------------
As-of DRAINS 4.01 note: I am hoping to revise this stuff, contact me if you
      need it.  I have a ".FLT" documentation file on each of the database
      files which you are welcome to a copy of.  Kate Nicholes, Concise Logic,
      406-572-3323 or in case of difficulty 800-262-2617.

DRAINS 3.04 programmers' documentation (c) 1997 Concise Logic
-------------------------------------------------------------

\DRAINS\DRACCRCV.DBF is Accounts Receivable;
 all charge jobs and all payments made on them
----------------------------------------------
A_STATESEQ  N06.0   Statement client sequence number
A_PHNUMBER  C10     Client phone number
A_UNITIDEN  C04     Complex unit number
A_NAME      C25     Client name
A_TAXGROUP  C02     Sales tax group
A_BILLADR1  C25     Client billing address line 1
A_BILLADR2  C25     Client billing address line 2
A_BILLADR3  C25     Client billing address line 3
A_BILLADR4  C25     Client billing address line 4
A_JOBNUMBR  C07     Job ID number
A_DATEDONE  D08     usually DONEDATE
A_DESCR1    C50     Description of charge - usually JOBDESC1
A_DESCR2    C50     Description of charge - usually JOBDESC2
A_DESCR3    C50     Description of charge - usually JOBDESC3
A_PURORDER  C10     Purchase order #
A_CHRGDATE  D08     Date account entry made
A_GRACDATE  D08     Date to figure interest from
A_CASCADE   C01     0/1/2/3 indicating sequence type:
                           0 ... Only record of this charge.
                           1 ... 1st Partial payment record.
                           2 ... Partial payment record.
                           3 ... Current state of this charge.
A_PAIDDATE  D08     Date payment made
A_CHARGE    N08.2   Original amount charged of (total - sales tax)
A_SALESTAX  N08.2   Sales tax charged.





     DRAINS 4.02 programmer's .DOC 01/02 KGH Nicholes * Page 12


A_INTEREST  N08.2   Late payment penalty interest
A_PAYTYPE   C01     Payment type: $=cash P=plastic (credit card)
                     C=check K=kredit D=discount/coupon W=writeoff
A_AMNTPAID  N08.2   Amount paid
A_CHECKNUM  C07     Payment check#/brief description of kredit etc.
A_DEPOSIT   N08.2   Amount copied to bank deposit journal
A_BALANCE   N08.2   Current balance including tax & interest this
                     job (negative if credit, transfers to client
                     record.)
A_FISCDATE  D08     Roto-Rooter fiscal date

Terminal dependent variables are items that might be station-dependent;
 each station has its own.
\DRAINS\DRBOOTID.DBF
------------------------------------------------
DR_DATADRV  C 1.   Drive to find Drains .DBFs on
D_COLORMON  C 1.   Color scheme B=blue/blue G=blue/grey Y=blue/white N=mono.
D_FLOPPYDS  C 1.   Default floppy for backups
D_PRINDEV1  C 5.   Printer device #1, most output LPT1:..COM4:
D_PRINTYP1  C 8.   Printer driver name for printer #1
D_PRINDEV2  C 5.   Printer device #2, dispatch cards LPT1:..COM4:
D_PRINTYP2  C 8.   Printer driver name for printer #2
D_PRINDEV3  C 5.   Printer device #3, can be disk file such as C:\DR
D_PRINTYP3  C 8.   Printer driver name for printer #3
D_PATH2DOS  C30.   Path to find FORMAT on
D_PATH2IDX  C10.   Path to find Drains .IDXs on
D_THISUSER  N 2.   This station's ID number

\DRAINS\DRCLIENT.DBF is the master job site file, the 'Rolodex'.
C_PHNUMBER  C10     Client phone number
C_UNITIDEN  C04     Complex unit number
C_NAME      C25     Client name (Last, First recommended)
C_ADDRESS   C25     Client street address
C_TAXGROUP  C02     Sales tax group
C_REFERRAL  C01     'Referred to us by' code
C_PARSADDR  C25     Parsed street address
C_CITYSTZP  C25     Client city, state, zip code
C_BILLADR1  C25     Client billing address line 1
C_BILLADR2  C25     Client billing address line 2
C_BILLADR3  C25     Client billing address line 3
C_BILLADR4  C25     Client billing address line 4
C_DRAINS    C01     "S"=septic, "W"=sewer
C_GRPCODE   C01     Client billing group code
C_CONTACT   C25     Contact person
C_ALTPHONE  C10     Alternative phone # / mgt. co. phone #
C_FAXPHONE  C10     Fax phone
C_PMGRADR1  C25     Property management company address line 1
C_PMGRADR2  C25     Property management company address line 1
C_PMGRADR3  C25     Property management company address line 1
C_ALLOWCHG  C01     A=account charge OK, C=check OK, $=cash only,
                    N=no service!, P=plastic (credit card)
C_TAXID     C20     Client tax exemption ID #





     DRAINS 4.02 programmer's .DOC 01/02 KGH Nicholes * Page 13


C_DISCOUNT  N05.2   Percent discount to give client on labor chgs.
C_NOTES     C50     Miscellaneous information about client;
                     if management co., properties managed.
C_USUALSVC  C04+04  Regular serviceperson ID code and name code
C_ACCOUNT   N09.2   Total amount on account, this client - updates
                     when statement is displayed/printed. NO EDIT.
C_LASTDATE  D08     Date of last job for client, updated when W/O
                     is archived to HISTORY file.
C_ESTMDATE  D08     Date estimate was given
C_HASMAINT  N03     Number of Scheduled Service schedules associated
                     with job site.

\DRAINS\DRCUSTOM.DBF is the sitewide customization file
U_PASSWORD     C07     Password
U_SHOWTIME     C01     Time format 1=12 hour 2=24 hour
U_NEXTJOBN     C07     Next job number
U_SELECTFD     C01     Client seek field P=phone#, N=name, A=address
U_ADRPARSE     C01     Y/N address parsed
U_SRQFORMT     C01     Service Request format file (xSERVREQ.FOX)
U_STMDESCR     C01     Y/N description appears on statements
U_PLAININV     C01     Y/N plain paper invoice
U_JOBRATE1     N06.2   1st standard rate
U_JOBRATE2     N06.2   2nd standard rate
U_JOBRATE3     N06.2   3rd standard rate
U_JOBRATEC     N07.2   commercial service standard rate
U_STATETAX     N05.2   Percent tax to charge
U_TEMPLATE     C50     Default value of job description line 2 (v2.9)
U_ACCTINTR     N05.2   Percent annual interest on late accounts
U_DEFTAREA     C03     default area code
U_BUSADDR1     C30     Statement return address line 1
U_BUSADDR2     C30     Statement return address line 2
U_BUSADDR3     C30     Statement return address line 3
U_BUSPHONE     C10     Statement/invoice phone number
U_STMFORMT     C01     Statement format file (xSTATEMT.FOX)
U_ACTSVCOM     C01     Activate serviceperson commissions Y/N
U_DISPCARD     C01     Offer dispatch card for each service request Y/N
U_ACTMULTX     C01     Activate multiple tax (group tax)
U_WRNTYLST     C04     Warranty code list selected from:
                       3=30day 6=60day 9=90day N=None 1=1yr. 4=4mo.
                       5=1/2yr O=Other C=Cond. (blank=*****).
U_PREVCLNT     C 1     Referral code for prev. client
U_LASTWEEK     D 8     Date of last completed reports
U_FIRSTDAY     D 8     First day of current business ownership
U_FINALDAY     D 8     (reserved)
U_REPORTFX     C10     Number to fax weekly report to
U_DOFAXTRY     C 5     Time to fax weekly report
U_PRCNTDUE     N 6.2   Percent of net due Roto-Rooter
U_POSTGDUE     N 6.2   Weekly postage fee
U_BACKSTEP     N 4.0   # hours before backup reminder
U_BACKDATE     C10     Date&time backup due YYYYMMDDHH
U_WHEREJOB     C 1     Auto job numbering: A=in {A}, B=in {B}, blank=none
U_ZIPCHECK     C 1     ZipCode checking active Y/N





     DRAINS 4.02 programmer's .DOC 01/02 KGH Nicholes * Page 14


U_NATIONAL     C 1     Nationality U=US C=Canada)
U_DEFTPAYT     C 1     Default payment type
U_PATH2FAX     C30     Path to FAX utilities
U_FAXBTYPE     C 1     FAX board type S=SatisFAXtion 1=class 1
U_FAXCOVER     C40     FAX cover sheet "route to"
U_CENTDISP     C 1     Site type N=US contractor Y=Canadian Central Dispatch
                        A=Canadian Agency C=US Central Dispatch
U_GENSALTX     N 5.2   National sales tax (Canada)
U_HOUSEPST     C 2     Agency Report PST Tax Group
U_DELREASN     C 1     Y/N deletion audit file turned on
U_NUMSESSN     N 2.    Maximum number of simultaneous sessions on network

\DRAINS\DRCUSTTY.DBF
K_CUSTCODE     C 1.    Customer type code
K_CUSTDESC     C55.    Customer type description

\DRAINS\DRINTRVL.DBF is the Scheduled Service interval file,
 links to Client file by phone#+unitID
I_PHNUMBER  C10.
I_UNITIDEN  C 4.
I_FIRSTSVC  D 8.
I_FINDYEAR  N 2.
I_FINDMNTH  N 2.
I_COUNTWKS  N 2.
I_COUNTDYS  N 3.
I_FINDDAYN  N 2.
I_ALLOWDOW  C 7.
I_CALLFRST  C 1.
I_PRSVCREQ  C 1.
I_ACTIVINT  C 1.
I_MNTNOTES  C25.
I_MNTPRICE  N 7.2
I_NEXTSVC1  D 8.
I_NEXTSVC2  D 8.
I_NEXTSVC3  D 8.
I_NEXTSVC4  D 8.
I_NEXTSVC5  D 8.

\DRAINS\DRJOURNL.DBF is the Bank Deposit Journal
J_PHNUMBER  C10     Client phone number
J_UNITIDEN  C04     Complex unit number
J_NAME      C25     Client name
J_TAXGROUP  C02     Sales tax group
J_JOBNUMBR  C07     Job number
J_DEPOSIT   N08.2   Amount deposited
J_PAYTYPE   C01     Payment type $=cash P=plastic (cr.cd.) C=check
J_CHECKNUM  C07     Payment check number
J_SUBTOTAL  N08.2   Amount collected of (deposit - sales tax)
J_SALESTAX  N08.2   Sales tax charged and/or collected, due state
J_PAIDDATE  D08     Date payment made
J_JOURDATE  D08     Date journal entry made
J_COUNTY    C20     Area ID per phone areacode & exchange





     DRAINS 4.02 programmer's .DOC 01/02 KGH Nicholes * Page 15



\DRAINS\DRREFERR.DBF
F_REFERRAL  C01.    'Customer referred to us by' code
F_REFERDSC  C20.    Description of referral

\DRAINS\DRREVCAT.DBF
V_REVCATGY  C 1.    Revenue category code
V_RVCTDESC  C20.    Revenue category description

\DRAINS\DRSVCPER.DBF
S_IDCODE    C04     Serviceperson numeric ID code
S_NAMECODE  C04     Serviceperson 4 character name mnemonic
S_PHNUMBER  C10     Serviceperson phone number, last 4 digits
S_NAME      C25     Serviceperson name (Last, First recommended)
S_ADDRESS   C25     Serviceperson street address
S_CITYSTZP  C25     Serviceperson city, state, zip code
S_SOCSECNO  C11     Soc.Sec.# or Canadian tax ID#
S_SVCNOTE1  C50     Notes line 1
S_SVCNOTE2  C50     Notes line 2
S_SVCNOTE3  C50     Notes line 3
S_ONHOURSC  N6.2    Commission during normal hours on labor
S_OFFHOURC  N6.2    Commission during on-call hours on labor
S_PARTSCOM  N6.2    Commission on parts

\DRAINS\DRTAXGRP.DBF The tax group file describes sales tax for the site.
X_TAXGROUP  C02     Sales tax group code
X_TAXGNAME  C20     Name of tax group
X_LABORTAX  N05.02  Percent tax on labor
X_PARTSTAX  N05.02  Percent tax on parts/consumer products
X_TOTAL     N10.02  Report scratch variable

\DRAINS\DRTOWNSH.DBF is the Municipality file which provides a convenient &
 quick way to standardize entry of City State Zip lines.
T_TOWNCODE  C02.   Town ID code
T_TOWNSHIP  C25.   Town City State Zip as desired

\DRAINS\DRWORKOR.DBF
R_PHNUMBER     C10     Client phone number
R_UNITIDEN     C04     Complex unit number
R_NAME         C25     Client name (Last, First recommended)
R_ADDRESS      C25     Client street address
R_TAXGROUP     C02     Sales tax group
R_REFERRAL     C 1.    'Customer referred by' code
R_CUSTTYPE     C 1.    Customer type code
R_ALTPHONE     C10     Alternate phone, DRWORKOR only
R_PARSADDR     C25     Parsed street address
R_CITYSTZP     C25     Client city, state, zip code
R_BILLADR1     C25     Client billing address line 1
R_BILLADR2     C25     Client billing address line 2
R_BILLADR3     C25     Client billing address line 3
R_BILLADR4     C25     Client billing address line 4
R_REQUDATE     D08     Date request received from client





     DRAINS 4.02 programmer's .DOC 01/02 KGH Nicholes * Page 16


R_REQUTIME     C07     Time request received from client (HH:MMxm)
R_OFFHOURS     C01     'X' if off hours commission percent applies
R_DRAINS       C01     'S' if septic problem, 'W' if sewer problem
R_ESTIMATE     C25     $ + QUOTE + "QUOTED" OR "NOT QUOTED"
R_PAYTYPE      C01     '$' if cash paid/expected, 'P' plastic (cr.cd.)
                       'C' if check, 'A' if charge, 'R' if recall visit
R_PURORDER     C10     Purchase order #
R_WARRANTY     C01     Warranty code, for example '3' if 30 day warranty
                       given, '6' if 60, '9' if 90, 'N'=no warranty etc
R_DOITDATE     D08     Date quoted for service
R_DOITTIME     C07     Time given to serviceperson
R_ASSIGN       C04+04  Serviceperson ID code and name code
R_HELPER       C04     Helper ID code
R_COMMERCL     C01     Revenue category code of job
R_JOBNUMBR     C07     Job ID number
R_JOBDESC1     C50     Job description
R_JOBDESC2     C50     Job description (continued)
R_JOBDESC3     C50     Job description (continued)
R_JOBDESC4     C50     Job description (continued, confidential line)
R_DONEDATE     D08     Date completed by serviceperson
R_DONETIME     C07     Time completed by serviceperson
R_TURNEDIN     C01     Y/N whether turned in by serviceperson
R_MTERIAL1     C15     Description for 1st material
R_MTERCHG1     N08.2   Charge for 1st material
R_MTERIAL2     C15     Description for 2nd material
R_MTERCHG2     N08.2   Charge for 2nd material
R_MTERIAL3     C15     Description for 3rd material
R_MTERCHG3     N08.2   Charge for 3rd material
R_MTERIAL4     C15     Description for 4th material
R_MTERCHG4     N08.2   Charge for 4th material
R_MTERIALU     C15     Description of untaxed charges
R_UNTAXED      N08.2   Charges not subject to sales tax
R_MTERLTOT     N08.2   Charge for all materials
R_LABORTOT     N08.2   Charge for labor
R_SUBCONTR     N08.2   Charge for subcontracted work/rentals charged to client
R_DISCOUNT     N08.2   Discount on labor charge (see below)
R_TAX          N08.2   Charge for tax, any negative number indicates tax
                       exemption and is treated as zero
R_WKOTOTAL     N08.2   Grand total charge for job
R_CHECKNUM     C07     Payment check number
R_DEPOSIT      N08.2   Amount sent to bank deposit journal or accts. rcv.
R_PAIDDATE     D08     Date full payment made
R_CANCELLD     C01     Y/N if job was cancelled
R_ARCHIVE      C01     Y/N whether OK to archive to HISTORY from Active WkO
R_SENDBOOK     C01     Y/N/*: send R_DEPOSIT & R_TAX to journal and
                         R_WKOTOTAL & R_TAX to account *=SENT
R_TXDSALES     N08.02  Amount tax is charged on
R_SLTXDATE     D08     Date of 1st payment

R_DISCOUNT: DRAINS has a desirable flexibilty of percent or dollar amount
      entry of discounts.  Negative entries (-0.01 through -100.00 are
      allowed) are treated as percentages, positive entries (0.00 through the
      labor total) as dollar amounts.




     DRAINS 4.02 programmer's .DOC 01/02 KGH Nicholes * Page 17


              A client's percentage discount is picked up (as negative) when
      the long term client information including a discount is called to the
      Service Request, and the new active work order is saved.  The percentage
      calculation of discount remains until the active work order is saved
      with Turned In marked "Y", or a dollar value is entered.  All History
      WkOs are converted to dollar amount discount when saved.
              If a different client's information is called onto an existing
      active or archived Work Order, its percentage is picked up with the rest
      of the client information, and remains present for editing at least
      until the WkO is saved.

\DRAINS\DRWOHIST.DBF is the History file.  It has the same structure as the
 Active Work Order file except for the omission of field R_ALTPHONE and the
 addition of field:
R_FISCDATE  D08.   Fiscal week of inclusion in Roto-Rooter report

\DRAINS\DRWHYDEL.DBF is the Deletion Audit file.  It has the same structure as
      the History file, except for added fields:
R_DELREASN  C24.   Reason record was deleted
R_DELTDATE  D08.   Date record was deleted

\DRAINS\DRWORKTY.DBF  The work type code file provides
 1) convenient entry of work descriptions and
 2) standardized codes for statistical analysis
W_WORKTYPE  C 2.   Work type code
W_WORKDESC  C50.   Work type code + description of work
New in DRAINS 3.05:
W_REDUCEBY  N06.3  % xx.xxx reduction of tithe for each work type
W_WKREDUCE  N10.2  Total amount reduction applies to (report temporary)

\DRAINS\DRZIPCOD.DBF  The ZipCode Check file lets users list which zip codes
 the computer should not complain about.
Z_ZIPCODE   C 5.   Zip code to consider legitimate.  Canadian version of this
      file is C06.

End of section revised 05/12/97 by K.G.H.Nicholes
* ----------------------------------------------------------------------------
02/21/01 A site has corruption in 3 main files.  The corruption is in 1-5
      record bunches scattered through the file.  It offsets the data by 2 or
      4 characters.  Field-by-field repair is tedious and difficult,
      especially where date fields obscure alpha data that has intruded.
The perfect tool: Would retain the FoxPro header as-is.  Would permit the
      marking of the last header character / first data character division.
      Would permit the setting of a largish field length (History DR3.08 is
      737L).  Would permit the scanning of the file as a table, and the
      pushing and pulling of record data by insertion and deletion of single
      characters.  Would have optional insertable vertical line(s) to justify
      field data to visually.  Would have a scan of the data area for unusual,
      unprintable, and control characters.  Would permit vertical scrolling of
      the file in bands.
A useable tool.  Use Foxbase+ to USE xxx, then COPY TO xxx.SDF TYPE SDF.
      XyWrite CA xxx.SDF.  SE (search) for chr 250 and ^.  Change all spaces
      to chr 250, all dashes to ^ (or whatever isn't found).  This disables
      XyWrite's line breaking.  Set RM to anything less than 256 that makes



     DRAINS 4.02 programmer's .DOC 01/02 KGH Nicholes * Page 18


      sense, 1/2 or 1/3 of the record length is good.  This lines the data up
      in columns.  Edit the file.  Change the chr 250's back to spaces etc and
      remove the <<RM>> token.  In Foxbase+ ZAP xxx, then APPEND FROM xxx.SDF
      TYPE SDF.  Check for all OK.
* ----------------------------------------------------------------------------




















































     DRAINS 4.02 programmer's .DOC 01/02 KGH Nicholes * Page 19

