(******************************************************************************
*                                SHARE21 .DEF                                 *
*                              ABO Software Dep.                              *
* Purpose : TO provide a simple database OF share details                     *
*                                                                             *
*   Notes :                                                                   *
*                                                                             *
*         Version Date : 21/5/92                                              *
******************************************************************************)
DEFINITION MODULE SHARE21;

FROM DATA21 IMPORT DBase,Tuple,TuplePtr;
FROM OBJ11 IMPORT Object;
FROM FIO IMPORT File;
CONST

TYPE
	CompType = ARRAY[0..4]OF CHAR;
	String  = ARRAY[0..32]OF CHAR;
	SharePtr = POINTER TO Share;
	TransactPtr = POINTER TO Transact;
	GainPtr	= POINTER TO Gain;

CLASS Date(Tuple);
	y,m,d:INTEGER;
PROCEDURE create(d,m,y:INTEGER);
PROCEDURE untill(VAR d:Date):Date;
VIRTUAL PROCEDURE clear;
VIRTUAL PROCEDURE copy(VAR o:Object);
VIRTUAL PROCEDURE eq(VAR t:Tuple ):BOOLEAN ;
VIRTUAL PROCEDURE lt(VAR t:Tuple ):BOOLEAN ;
VIRTUAL PROCEDURE gt(VAR t:Tuple ):BOOLEAN ;
VIRTUAL PROCEDURE rd(f:File);
VIRTUAL PROCEDURE wr(f:File);
END Date;


CLASS CPI(Date);
	value:REAL;
VIRTUAL PROCEDURE clear;
VIRTUAL PROCEDURE copy(VAR o:Object);
VIRTUAL PROCEDURE rd(f:File);
VIRTUAL PROCEDURE wr(f:File);
END CPI;


CLASS Share(Date);
	comp:CompType;
	note:String;
VIRTUAL PROCEDURE compeq(VAR t:Share):BOOLEAN ;
VIRTUAL PROCEDURE complt(VAR t:Share):BOOLEAN ;
VIRTUAL PROCEDURE compgt(VAR t:Share):BOOLEAN ;
VIRTUAL PROCEDURE clear;
VIRTUAL PROCEDURE copy(VAR o:Object);
VIRTUAL PROCEDURE add(VAR t1,t2:Share);
VIRTUAL PROCEDURE rd(f:File);
VIRTUAL PROCEDURE wr(f:File);
END Share;


CLASS Transact(Share);
	number:INTEGER;
	cost,broker,stamp:REAL;
PROCEDURE create(no:INTEGER;VAR tr:Transact);
VIRTUAL PROCEDURE clear;
VIRTUAL PROCEDURE copy(VAR o:Object);
VIRTUAL PROCEDURE add(VAR t1,t2:Share);
VIRTUAL PROCEDURE rd(f:File);
VIRTUAL PROCEDURE wr(f:File);
END Transact;


CLASS Dividend(Share);
	unfrank,franked,imputed:REAL;
VIRTUAL PROCEDURE clear;
VIRTUAL PROCEDURE copy(VAR o:Object);
VIRTUAL PROCEDURE add(VAR t1,t2:Share);
VIRTUAL PROCEDURE rd(f:File);
VIRTUAL PROCEDURE wr(f:File);
END Dividend;


CLASS Gain(Share);
	purchase:Date;
	number:INTEGER;
	received,cost,aquired,disposed,index,base,indexed,taxed:REAL;
PROCEDURE create(no:INTEGER;VAR tr1,tr2:Transact);
VIRTUAL PROCEDURE clear;
VIRTUAL PROCEDURE copy(VAR o:Object);
VIRTUAL PROCEDURE add(VAR t1,t2:Share);
VIRTUAL PROCEDURE wr(f:File);
END Gain;


CLASS CPIDB(DBase);
PROCEDURE value(VAR dt:Date):REAL;
END CPIDB;


CLASS ShareDB(DBase);
PROCEDURE compfind(VAR cp:Share):SharePtr;
PROCEDURE compselecteq(VAR cp:Share;VAR db:ShareDB);
PROCEDURE compselectne(VAR cp:Share;VAR db:ShareDB);
PROCEDURE sum(VAR tp:Share);
END ShareDB;


CLASS GainDB(Object);
	trans,gains,transumms,gainsumms:ShareDB;
	trantotal:Transact;
	gaintotal:Gain;
PROCEDURE fifoprocess(trdb:ShareDB;VAR dt:Date);
PROCEDURE distprocess(trdb:ShareDB;VAR dt:Date);
PROCEDURE open;
PROCEDURE close(VAR dt:Date);
PROCEDURE fifosale(tr:Transact);
PROCEDURE distsale(tr:Transact);
PROCEDURE bonus   (tr:Transact);
PROCEDURE purchase(tr:Transact);
VIRTUAL PROCEDURE clear;
END GainDB;

VAR
	cpis:CPIDB;
	taxdate:Date;

END SHARE21.