USing
Multiple
Files
All
we
need
to
do
to
record a
sale
IS
to
subtract the number
at
items sold
from
the Recording Sales
relevant stock record.
It
IS
advisable
to
Include some
form
of
confirmation
that
we
are
dealing with the right stock
Item
and
that
the stock
IS
sufficient
to
meet the
order.
proe
quantity
rem
*****
pri
nt
items
in
stock
*****
inquire
print
;
nput
"How
many?
1/;
num
print
e l s
print
num;1l *
";sto.stockno$;"
(";sto.description$;")l1
endproc
proc
sa
Le
rem
*****
process
sa
Le
*****
quantity
if
num<=sto.qty
print
"Order
value:-
E";
num*sto.seL
Lpr
confirm
if
yes
let
sto.qty=sto.qty-num
update
sprint:
rem
***
show
the
modified
record
***
endif
else
print
"Not
enough
stock"
endif
clear
endproc
The following procedure allows
you
to
record the delivery
of
stock. Again
it
requests
confirmation of the details
you
type
in
before accepting them and updating the relevant
stock record.
proc
deLivery
rem
*****
incase
stock
on
de
Livery
*****
quantity
confirm
pri
nt
if
yes
pri
nt
"Accepted"
Let
sto.qty=sto.qty+num
update
sprint
eLse
print
"DeLivery
not
recorded"
endif
cLear
endproc
Recording Incoming
Stock
So
far our procedures
have
only referred
to
the stock
file.
When
we
want
to
order more Ordering New Stock
stock
we
shall have
to
refer
to
the supplier and orders files
for
the name and address
of
the company, the price, and
so
on.
Assuming that
we
have identified the
Item
in
the stock
file
(with inquire)
we
select. from
the orders
file,
those records
that
have
the
correct stock code. These records contain
the codes for
all
the companies that can supply the
item.
Since the records also contain
the price and delivery time far each supplier,
we
can decide whether
we
want the
cheapest
Item
or the shortest delivery
time.
We
use locate as a
fast
way
of
finding the requrred supplier record. This means that
the supplier
file
must be ordered (with respect
to
the supplier code, code$) before
we
use doorder.
12184
35