Here you will find a step-by-step explanation of how to do the most common accounting tasks at xyz.

Find An Account's Balance

Use grep to find which data file the account is in, then balance the data file. The trickiest part is finding the right data file. Remember, you can search for anything that is contained in the data files, such as a contact's name, their phone number, a username, or the name on a check. Here is a sample session.

$ grep Marion ~accounts@xyz.net/data/*
1140:Marion Abeldgaard:2350345:mabel@xyz.net
2151:Dina Marion:2359051:gunz@xyz.net
$ ~accounts@xyz.net/balance ~accounts@xyz.net/data/2151
  8/19/99   gunz, normal, homer tax                    -7.70
  9/1/99    gunz, normal, homer tax                   -21.10

      TOTAL:  -28.80      Dina Marion  235-9051

$ 

Here we were looking for the account balance of someone with the last name Marion. So, we use grep to find Marion's data file. Two data files contain the word Marion, 1140 and 2151. Dina Marion is who we want, so we feed balance with the data file we want.

Enter Payments

You can record credits to an account by hand or with the script enter. Either way, you search for the data file you would like to credit, and make an appropriate entry in the data, tape, and iai files. Here's an sample session using the enter script.

$ cd ~accounts@xyz.net/data/
$ ~accounts@xyz.net/enter
Grep: jrljknf
570:John Fitzpatrick:2356158:jrljknf@xyz.net
570:jrljknf:normal:homer:tax
570:10470:jrljknf, normal, homer:-21.1
570:10500:jrljknf, normal, homer:-21.1
570:10531:jrljknf, normal, homer:-21.1
570:10561:jrljknf, normal, homer tax:-21.1
570:10592:jrljknf, normal, homer tax:-21.1
570:10623:jrljknf, normal, homer tax:-21.1
570:10651:jrljknf, normal, homer tax:-21.1
570:10682:jrljknf, normal, homer tax:-21.1
570:10712:jrljknf, normal, homer tax:-21.1
570:10743:jrljknf, normal, homer tax:-21.1
570:10773:jrljknf, normal, homer tax:-21.1
570:10804:jrljknf, normal, homer tax:-21.1
570:10835:jrljknf, normal, homer tax:-21.1
Continue (y): 
File: 570
uDate: 10857
Description (JOHN R.FITZPATRICK / LINDA J. FITZPATRICK):
Amount (21.1): 
  homer:tax
Tax (b): h
9/23/99         JOHN R.FITZPATRICK / LINDA J. FITZPATRICK       21.1    h
Accept (y): 
Grep: 

First, we entered into the data file directory and started the enter script. Our check provided a username, so we searched for it, jrljknf. We find that data file 570 contains entries for the username, and there were no other matches. There is no need to search again, so we continue, and tell it to work on file 570. We enter the date. The description is correct, so there's no need to type it in. The amount is as it was last month, so we can just continue here as well. We enter the appropriate tax code as described in the explanations for enter and tapesum. It presents us with the entry we've just generated, and since it is correct, we continue. Done with the entry, we are left with a prompt to grep for another entry, or we could Ctrl-C to quit.

Create A New Account

You simply need to add the account to an existing data file, or create a new data file. Usually the latter is the case, and the name of the new file should simply be the next available file number. Refer to the data file format for the details of its form. Here is a sample session.

$ cd ~accounts@xyz.net/data/
$ ls 229?
2290  2291  2292  2293  2294  2295  2296  2297  2298  2299
$ ls 230?
230?: No such file or directory
$ vi 2230

...

Susan Lind:2357714:slind@xyz.net
slind:normal:homer:tax

10898:slind, normal, homer tax:-19

...

$ chown one@xyz.net:xyz 2300
$ chmod 660 2300

For convenience, we cd into the data directory. In this case, the account is brand new, so will not be added to an existing data file. Therefor, we ls around where we think we last added files, in the 2290's. We find that 2290 through 2299 already exist, so we ls to see what 2300's there are. Finding there are none, we take the first available, 2300, and start up vi (or the text editor of your choice) with that filename. As specified we add contact and account information. Since this account was added 11/3/99 (10898), they are charged for 27 days of service. After saving the file, we set the proper group and access permissions.

Remove An Account

After the account has been terminated, we need to take care of the account's accounting file. If the terminated account is not the only account represented in and accounting file, we can simply remove it's entry and make appropriate changed to the charges in the accounting file. More commonly, the terminated account is the only account in the accounting file, and thus the file may be deleted after any balances due have been paid. Here is a sample session.

$ cd ~accounts@xyz.net/data/
$ grep buddy *
977:Joan Brown:2357297:buddy@xyz.net
977:buddy:normal:homer:tax
977:10531:buddy, normal, homer:-21.1
977:10561:buddy, normal, homer tax:-21.1
977:10592:buddy, normal, homer tax:-21.1
977:10623:buddy, normal, homer tax:-21.1
977:10651:buddy, normal, homer tax:-21.1
977:10682:buddy, normal, homer tax:-21.1
977:10712:buddy, normal, homer tax:-21.1
977:10743:buddy, normal, homer tax:-21.1
977:10773:buddy, normal, homer tax:-21.1
977:10804:buddy, normal, homer tax:-21.1
977:10835:buddy, normal, homer tax:-21.1
977:10865:buddy, normal, homer tax:-21.1
977:10896:buddy, normal, homer tax:-21.1
$ vi 977

...

Joan Brown:2357297:buddy@xyz.net
buddy:normal:homer:closed

10513:Previous Balance:21.1
10531:buddy, normal, homer:-21.1
10561:buddy, normal, homer tax:-21.1
10592:buddy, normal, homer tax:-21.1
10616:CHARLES M. BROWN / JOAN BROWN / BEN J. BROWN:63.3
10623:buddy, normal, homer tax:-21.1
10651:buddy, normal, homer tax:-21.1
10682:buddy, normal, homer tax:-21.1
10694:CHARLES M. BROWN / JOAN BROWN / BEN J. BROWN:63.3
10712:buddy, normal, homer tax:-21.1
10743:buddy, normal, homer tax:-21.1
10765:CHARLES M. BROWN / JOAN BROWN / BEN J. BROWN:42.2
10773:buddy, normal, homer tax:-21.1
10804:buddy, normal, homer tax:-21.1
10816:CHARLES M. BROWN / JOAN BROWN / BEN J. BROWN:42.2
10835:buddy, normal, homer tax:-21.1
10865:buddy, normal, homer tax:-21.1
10877:CHARLES M. BROWN / JOAN BROWN / BEN J. BROWN:21.1
10896:buddy, normal, homer tax:-2.1

...

$ ~accounts@xyz.net/balance 977
  10/14/98  Previous Balance                           21.10
  11/1/98   buddy, normal, homer                      -21.10
  12/1/98   buddy, normal, homer tax                  -21.10
  1/1/99    buddy, normal, homer tax                  -21.10
  1/25/99   CHARLES M. BROWN / JOAN BROWN / BEN J.     63.30
  2/1/99    buddy, normal, homer tax                  -21.10
  3/1/99    buddy, normal, homer tax                  -21.10
  4/1/99    buddy, normal, homer tax                  -21.10
  4/13/99   CHARLES M. BROWN / JOAN BROWN / BEN J.     63.30
  5/1/99    buddy, normal, homer tax                  -21.10
  6/1/99    buddy, normal, homer tax                  -21.10
  6/23/99   CHARLES M. BROWN / JOAN BROWN / BEN J.     42.20
  7/1/99    buddy, normal, homer tax                  -21.10
  8/1/99    buddy, normal, homer tax                  -21.10
  8/13/99   CHARLES M. BROWN / JOAN BROWN / BEN J.     42.20
  9/1/99    buddy, normal, homer tax                  -21.10
  10/1/99   buddy, normal, homer tax                  -21.10
  10/13/99  CHARLES M. BROWN / JOAN BROWN / BEN J.     21.10
  11/1/99   buddy, normal, homer tax                   -2.10

      TOTAL:  -2.10      Joan Brown  235-7297

$ 

Change into the data directory, and grep for buddy, the account we need to close. We find the buddy account in file 977, so we open it in our text editor. There we mark the account as closed (on the second line), and adjust their November (10896) charge. Since they closed their account out November 3rd, we charge them only for three day's services ($2.10). Finding the balance of the account, we see they still owe us money, so we'll leave their account file as it is. Were their balance zero, or if their balance is zero in the future, we could delete the file with the rm 977 command.

Make A Deposit

Since the last time we made a deposit, every payment we've entered has been recorded in the tape file. We now want to move this file to include a date so we can keep it as a record for the payments made with this particular deposit. While we're here, we'll create the tape and iai files for the next round, and set their permissions so others who need to can access them. We can then use the tapesum script to find the total sum for that deposit. Here is a sample session.

$ cd ~accounts@xyz.net/
$ mv tape tape1008.txt
$ mv iai iai1008.txt
$ touch tape iai
$ chown one@xyz.net:xyz tape iai
$ chmod 660 tape iai
$ ./tapesum tape1008.txt
h = 1029.62
sn = 40
b = 1647.1
s = 126
hn = 25

Total = 2867.72
$ 

First, we change into the directory where the files are. Then rename the files with the day of the deposit, in this case October 8, and add the text file extension. Create new empty files, and change their group ownership and permissions (you'll want to substitute one@xyz.net with your own username). Finally, run the tapesum script.

You can also print out the tape file (in this case tape1008.txt) to accompany the deposit made to the bank.

Bill Customers

Billing is done on the first of each month. Although simply running the next script will charge and bill all customers, there are some things that need to be checked before hand.

  1. Make sure the permissions on the data files are correct. Since the setting of these permissions is done by hand, there is a possibility it was forgotten. The data files should belong to the xyz group, and the user and group should have read and write privileges. Here is a sample session.

    $ cd ~accounts@xyz.net/data/
    $ ls -l 218?
    -rw-rw----   1 accounts@xyz.netxyz          100 Sep  3 16:07 2180
    -rw-rw----   1 accounts@xyz.netxyz           98 Sep  3 16:52 2181
    -rw-rw----   1 accounts@xyz.netxyz          102 Sep  4 20:05 2182
    -rw-rw----   1 accounts@xyz.netxyz          104 Sep  5 16:01 2183
    -rw-rw----   1 accounts@xyz.netxyz          102 Sep  7 09:33 2184
    -rw-rw----   1 accounts@xyz.netxyz          104 Sep  7 10:12 2185
    -rw-rw----   1 accounts@xyz.netxyz           99 Sep  7 10:28 2186
    -rw-rw----   1 accounts@xyz.netxyz           93 Sep  7 10:38 2187
    -rw-rw----   1 accounts@xyz.netxyz          109 Sep  7 11:25 2188
    -rw-rw----   1 accounts@xyz.netxyz          109 Sep  7 12:58 2189
    $ ls -l 217?
    -rw-rw----   1 accounts@xyz.netxyz          133 Sep  1 12:00 2170
    -rw-rw----   1 accounts@xyz.netxyz          159 Sep  1 12:00 2171
    -rw-rw----   1 accounts@xyz.netxyz          201 Sep 15 14:09 2172
    -rw-rw----   1 accounts@xyz.netxyz          151 Sep  1 12:00 2173
    -rw-rw----   1 accounts@xyz.netxyz          106 Sep  1 14:17 2174
    -rw-rw----   1 accounts@xyz.netxyz          108 Sep  2 15:11 2175
    -rw-rw----   1 accounts@xyz.netxyz          139 Sep  8 13:18 2176
    -rw-rw----   1 accounts@xyz.netxyz          109 Sep  2 16:50 2177
    -rw-rw----   1 accounts@xyz.netxyz          102 Sep  3 11:38 2178
    -rw-rw----   1 accounts@xyz.netxyz          100 Sep  3 15:10 2179
    $ 
    

    Change into the data directory. We start out by trying to find which data files have been added since the last time we billed. We guessed it was in the 2180s, so we used ls -l 218? and found that the dates on those files only went back to the 3rd. So, we look at the files before those, the 2170s, and see and see that those go back to the 1st of the month, so we know we're looking at the beginning of the files we need to check, in this case, 2174 and on. From here we would continue to ls -l filenumber, looking for a file that might be set wrong. Remember, they should belong to the xyz group (the part after accounts@xyz.net), and the user and group, should have read and write privileges (-rw-rw----).

    $ ls -l 223?
    -rw-rw----   1 accounts@xyz.netxyz          106 Sep 23 17:55 2230
    -rw-rw----   1 accounts@xyz.netxyz          107 Sep 24 11:20 2231
    -rw-r--r--   1 one@xyz.netstaff        109 Sep 27 14:26 2232
    -rw-r--r--   1 one@xyz.netstaff         94 Sep 27 15:26 2233
    -rw-r--r--   1 one@xyz.netstaff         92 Sep 28 17:14 2234
    -rw-r--r--   1 one@xyz.netstaff        103 Sep 28 17:54 2235
    -rw-r--r--   1 one@xyz.netstaff        100 Sep 28 20:05 2236
    -rw-r--r--   1 one@xyz.netstaff         98 Sep 28 20:17 2237
    -rw-r--r--   1 one@xyz.netstaff        147 Sep 28 21:35 2238
    -rw-r--r--   1 one@xyz.netstaff        106 Sep 30 12:02 2239
    $ chown one@xyz.net:xyz 223?
    chown: 2230: Not owner
    chown: 2231: Not owner
    $ chmod 660 223?
    chmod: WARNING: can't change 2230
    chmod: WARNING: can't change 2231
    $ ls -l 223?
    -rw-rw----   1 accounts@xyz.netxyz          106 Sep 23 17:55 2230
    -rw-rw----   1 accounts@xyz.netxyz          107 Sep 24 11:20 2231
    -rw-rw----   1 one@xyz.netxyz          109 Sep 27 14:26 2232
    -rw-rw----   1 one@xyz.netxyz           94 Sep 27 15:26 2233
    -rw-rw----   1 one@xyz.netxyz           92 Sep 28 17:14 2234
    -rw-rw----   1 one@xyz.netxyz          103 Sep 28 17:54 2235
    -rw-rw----   1 one@xyz.netxyz          100 Sep 28 20:05 2236
    -rw-rw----   1 one@xyz.netxyz           98 Sep 28 20:17 2237
    -rw-rw----   1 one@xyz.netxyz          147 Sep 28 21:35 2238
    -rw-rw----   1 one@xyz.netxyz          106 Sep 30 12:02 2239
    $ 
    

    Here we found in the 2230s, that some of the files are set wrong. First we need to change their group from staff to xyz. After issuing the command, we get a couple errors on the first two files, that's all right, we just don't own the files, but they're set right anyway. Then we set their permissions, again, the error is all right. Then we check our work and find the files are now set as they should be. You would continue this process for the remaining files.

  2. Many accounts are closed out on the turn of the month. Check the kill file for those, and delete the accounts. Handle their account file as specified in Remove An Account.

  3. Find accounts that were previously closed, who's account file was left because they still had a balance due. Check to see if they've paid, and if they have, delete their account file. Here's a sample session.

    
    
  4. Run the next script. Think before you do, it's a real mess if something was overlooked.

    $ cd ~accounts@xyz.net/
    $ nice ./next > errors &
    [1] 25431
    $ 
    

    We changed into the accounts directory, nice the process so it doesn't hog all the server resources, specify that any output should be save in a file named errors, and run the process in the background so we can continue to work.