DataMuseum.dk

Presents historical artifacts from the history of:

CP/M

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about CP/M

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦5f2613491⟧ TextFile

    Length: 15104 (0x3b00)
    Types: TextFile
    Names: »CHECKS.BAK«

Derivation

└─⟦65142c8de⟧ Bits:30004652 KnowledgeMan vers. 1.07h
    └─ ⟦this⟧ »CHECKS.BAK« 

TextFile

/********************************************************************************
 
      This program is meant to provide you with an example of how 
      KnowledgeMan can be used in a procedural fashion.  It is for
      demonstration purposes ONLY and no guarantee is made for its
      fitness for use in any way.
     
      Along the right margin you will see numbers enclosed in 
      comment marks.  These page numbers are intended to provide
      you with pages in the manual to refer to for additional 
      details on the subject (command, etc.) that is being covered
      at that point in the program.
	 
 ********************************************************************************/

     
/*****
     Define as a form and put up the MDBS, Inc. logo. 
 *****/ 
form logo                                                           /* 153, 154 */
 at 1,1 to 24,79 put "fobu"                                         /* 156, 157 */
 at 12,10 to 16,70 put "fubo"
 at 2,2 put "     M"
 at 3,2 put "    ! ! "
 at 4,2 put "   !   ! "
 at 5,2 put "  D     B   Micro Data Base Systems, Inc."
 at 6,2 put "   !   !"
 at 7,2 put "    ! !"
 at 8,2 put "     S"
 at 14,23 put "C h e c k   B o o k   S y s t e m" with "lb"              /* 157 */ 
endform

clear                                                                    /* 164 */
putform logo                                                             /* 160 */
at 20,40                                                                 /* 159 */


/*****
     Check to see if the CHECKS table has been defined.  If it has not, then
     define it by executing the perform file "SETCHK.IPF".  The define will 
     automatically leave the table in USE.  If it has already been defined 
     (the file CHECKS.ITB exists), then simply invoke USE to make the table
     available for use.
 *****/
if not filex("checks.itb") then perform setchk               /* 238, 33, 225, 19 */
			   else use checks                                /* 64 */
endif

/*****
     Set some environment variables.
 *****/
e.paus=true                                                           /* 23, 24 */
e.lmod=false                                                          /* 24, 71 */
e.supd=true                                                           /* 24, 93 */
e.lstr=50                                                             /* 24, 85 */ 


/*****
     Initialize working variables.
 *****/
amt1=0                                                                    /* 22 */
amt2=0
amt3=0
amt4=0
dat=""
note=""


/*****
     Define a macro to use inside each form definition that uses the company
     name and address. 
 *****/
macro putmdbs Ø
 at 11,7 put "Micro Data Base Systems, Inc." with "l";Ø
 at 12,7 put "1616 Potter Drive" with "l";Ø
 at 13,7 put "West Lafayette, IN. 47906" with "l";Ø
 at 14,7 put "(317) 463-7653" with "l"
                                                                          /* 34 */

/*****
     Define the menu as a form.
 *****/
form menu                                                           /* 153, 154 */
 at 1,1 to 24,80 put "BAFO"
 at 5,20 put "KnowledgeMan Check Book System" with "rl"
 at 8,10 put "1  Enter Checks"
 at 9,10 put "2  Enter Deposit"
 at 11,10 put "3  Sort on Check Number"
 at 12,10 put "4  Sort on Date"
 at 14,10 put "5  Mark Returned Checks"
 at 16,10 put "6  Balance Check Book"
 at 8,40 put "7  Browse Checks"
 at 9,40 put "8  Browse Deposits"
 at 11,40 put "9  List All Checks and Deposits"
 at 16,40 put "0"; at 16,46 put "End Session" with "l"
 at 19,30 put "Choice?" with "b"
endform


/*****
     Define a form to put on the screen during lengthy processing so that the
     user knows what's happening.
 *****/
form delay
 at 10,10 to 14,70 put "brfg"
 at 12,20 put "Calculations in Process  ... please wait" with "b"
endform


/*****
     Define form to put on screen during WAIT command.
 *****/
form pause
 at 23,25 put "Press ANY KEY to return to menu" with "b"
endform


/*****
     Define forms for input/output
 *****/ 
form ckform
 at 10,5 to 19,70 put "bufc"
 at 11,6 to 14,40 put "bafc"
 putmdbs                            ! REMEMBER: This is a macro           /* 34 */
 at 11,50 put "Number: " with "l"
 at 11,58 put number
 at 11,58 get number
 at 12,50 put "Date  : " with "l"
 at 12,58 put date 
 at 12,58 get date 
 at 16,7 put "Pay To: " with "l"
 at 16,15 put payto 
 at 16,15 get payto 
 at 16,50 put "Amount: " with "l"
 at 16,58 put amount 
 at 16,58 get amount 
 at 18,7 put "Memo  : " with "l"
 at 18,15 put memo 
 at 18,15 get memo 
 at 18,47 put "Cancelled: " with "l"
 at 18,58 put cancel 
 at 18,58 get cancel 
endform

form depform
 at 10,5 to 19,70 put "brfo"
 at 11,6 to 14,40 put "bafo"
 putmdbs                                                                  /* 34 */
 at 12,50 put "Date  : " with "l"
 at 12,58 put date 
 at 12,58 get date 
 at 16,50 put "Amount: " with "l"
 at 16,58 put amount 
 at 16,58 get amount 
 at 18,7 put "Memo  : " with "l"
 at 18,15 put memo 
 at 18,15 get memo 
 at 18,47 put "Credited: " with "l"
 at 18,58 put cancel 
 at 18,58 get cancel 
endform

form bal
 at 10,10 to 21,70 put "bufo"
 at 10,25 put "Check Book Balance Form" with "l"
 at 12,15 put "Enter Final Balance" with "l"
 at 13,15 put "as Shown by Bank" with "l"
 at 13,40 put amt4 using "$dddddd.dd"
 at 13,40 get amt4 using "$dddddd.dd"
 at 15,15 put "Deposits not Credited" with "l"
 at 15,40 put -amt2 using "$dddddd.dd"
 at 17,15 put "Checks Outstanding" with "l"
 at 17,40 put amt1 using "$dddddd.dd"
 at 18,15 put "Computed Balance" with "l"
 at 18,40 put amt4-amt2-amt1 using "$dddddd.dd"
 at 19,15 put "Check Book Balance" with "l"
 at 19,40 put amt3 using "$dddddd.dd"
 at 20,15 put "Discrepancy"
 at 20,40 put amt4-amt2-amt1-amt3 using "$dddddd.dd"
endform	
	
form deposit
 at 10,5 to 19,70 put "brfo"
 at 11,6 to 14,40 put "bafo" 
 putmdbs                                                                  /* 34 */   
 at 16,7 put "Deposit: " with "l"
 at 16,16 put amt1 using "$dddddd.dd"
 at 16,16 get amt1 using "$dddddd.dd"
 at 11,47 put "Date: " with "l"
 at 11,56 put dat using "dd/dd/dddd"
 at 11,56 get dat using "dd/dd/dddd"
 at 18,7 put "Memo: " with "l"
 at 18,16 get note 
endform



/*****
     Define a form to display when the user enters a check number that does not 
     exist.  Note that this is a helpful way to display 'status' messages.  
 *****/ 
form NotHere
 at 24,32 put "Check not Present" with "srb"                             /* 157 */
endform

/*******************************************************************************

       Note:  An alternative to defining numerous forms each time the
              program is executed would be to define them once, in a 
              separate program, and SAVE them to a context file.  The
              form definitions, then, get LOADed (by adding a LOAD line
              to this program) each time this program is executed.
              You'll discover that executing a LOAD is often much faster
              than the first alternative.  This is because the definitions
              are SAVEd in a tokenized form. 
              This is true not only for forms, but also for macros, cell
              definitions, global variables, etc.  
                                                                 /* 50, 243, 19 */

/********************************************************************************/



/********************************************************************************

       This is the main body of the program.  An infinite WHILE loop 
       executes until the user enters 0 (or just presses <ENTER>) as 
       his choice from the menu, which exits from KnowledgeMan to the 
       Operating System.  All other valid entries cause the statements 
       for the appropriate CASE to get executed and the loop repeats.
 
 ********************************************************************************/

while true do                                                            /* 234 */   

     clear;  putform menu; c=0  !Put menu on screen and set default response
     e.auto=true                !Turn on auto advance during menu selection
                                                                          /* 24 */
     at 19,38 input c using "d" !Get user's selection                     /* 165 */
     e.auto=false               !Turn off auto advance

     test c                                                         /* 236, 237 */
        case 1:                                          !Menu Option 1
                create with ckform   !Create records in the default table
                                     !using the format of the form ckform.
                                                                      /* 74, 51 */
                break                !Exit TEST statement           /* 236, 240 */

        case  2:clear                                    !Menu Option 2
                amt1=0
                dat=""
                note=""
                putform deposit   !Display deposit form.                 /* 160 */
                getform deposit   !Allow user input to deposit form.
                                                                         /* 161 */
                tally deposit     !Display new values of computed variables.
                                                                         /* 162 */
                attach 1          !Create blank record at end of default table
                                                                    /* 76, 78.1 */
                payto=" *** DEPOSIT ***"; number=0       !Set values of
                date=dat; amount=-amt1                   !fields in the 
                memo=note; cancel=false                  !new record. 
                putform pause; at 24,40
                wait                                                     /* 230 */
                clear
                break

        case 3: clear; putform delay; at 17,40           !Menu Option 3 
                sort checks by az number                                  /* 80 */
                break

        case 4: clear; putform delay; at 17,40           !Menu Option 4
                sort checks by az substr(date,7,4)+substr(date,1,5)       /* 80 */ 
                break

        case 5: clear                                    !Menu Option 5
                at 17,19 ?"(Enter Return to Go Back to Menu)"
                while c>0 do 
                 at 12,20 input c using "dddd" with "Number of Returned Check: "
                                                                         /* 166 */
                 if not #found then clear NotHere        !If the previous OBTAIN
                                                         !caused form NotHere to
                                                         !be displayed, then 
                                                         !CLEAR it.
                                                                 /* 25, 28, 164 */
                 endif
                 if c>0 then obtain first for number=c   !If non-zero check number
                                                         !was entered, then look
                                                         !for the check. 
                                                                      /* 88, 90 */ 
                             if #found then cancel=true  !If it is there, then
                                                         !mark it as cancelled
                                       else putform NotHere
                             endif
                 endif
                endwhile
                break

        case 6: clear; putform delay ; at 17,40         !Menu Option 6

                e.ocon=false  !Turn off console display during statistics computation
                                                                          /* 24 */
                stat amount for number>0 and not cancel !Fill statistical arrays
                                                        !based on amounts of all
                                                        !outstanding checks.  
                                                                         /* 100 */
                amt1=#sum(1)     !Store the sum of these amounts to amt1 
                                                                     /* 25, 101 */

                stat amount for number=0 and not cancel !Compute statistics for
                                                        !for all outstanding deposits.
                amt2=#sum(1)     !Store the sum to amt2  

                stat amount      !Compute statistics for all transactions
                amt3=-#sum(1)    !Store the negative of the sum to amt3
                amt4=0
                e.ocon=true      !Turn console display back on       /* 24, 100 */
                clear; putform bal; tally bal; getform bal; tally bal
                                                                         /* 153 */
                putform pause; at 24,40
                wait                                                     /* 230 */
                clear
                break

        case 7: browse for number>0 with ckform          !Menu Option 7
                                                                    /* 124, 128 */
                break

        case 8: browse for number=0 with depform         !Menu Option 8
                                                                    /* 124, 128 */
                break

        case 9: e.stat=false                             !Menu Option 9
                                                                          /* 24 */
                #title="       ---------------     Check Book Listing     ---------------"
                                                                      /* 25, 94 */
                list number using "dddddd", payto, amount, date, memo
                                                                      /* 85, 94 */
                e.stat=true                                               /* 24 */
                output;output     !Put two blank lines on the screen (scroll twice)
                                                                         /* 167 */
                putform pause; at 24,40; wait; clear 
                break

        case 0: clear                                    !Menu Option 0
                bye                                                      /* 244 */ 

        otherwise: ?"ERROR"                                              /* 236 */

      endtest

endwhile


«eof»