(******************************************************************************
*                                SHARE11 .DEF                                 *
*                              ABO Software Dep.                              *
* Purpose : TO provide a simple database OF share details                     *
*                                                                             *
*   Notes :                                                                   *
*                                                                             *
*         Version Date : 21 Feb 1992                                          *
******************************************************************************)
DEFINITION MODULE SHARE11;

FROM DATA11 IMPORT DBase,Tuple,TuplePtr;
FROM FIO IMPORT File;
CONST

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

CLASS Date(Tuple);
	year,month,day:INTEGER;
PROCEDURE create(d,m,y:INTEGER);
VIRTUAL PROCEDURE less(VAR t:Tuple ):BOOLEAN ;
VIRTUAL PROCEDURE more(VAR t:Tuple ):BOOLEAN ;
VIRTUAL PROCEDURE equal(VAR t:Tuple):BOOLEAN ;
PROCEDURE days(VAR d:Date):INTEGER;
PROCEDURE months(VAR d:Date):INTEGER;
PROCEDURE years(VAR d:Date):INTEGER;
VIRTUAL PROCEDURE read(f:File);
VIRTUAL PROCEDURE write(f:File);
END Date;


CLASS CPI(Date);
	value:REAL;
VIRTUAL PROCEDURE read(f:File);
VIRTUAL PROCEDURE write(f:File);
END CPI;


CLASS Company(Tuple);
	comp:CompType;
	name:String;
	note:String;
VIRTUAL PROCEDURE less(VAR t:Tuple ):BOOLEAN ;
VIRTUAL PROCEDURE more(VAR t:Tuple ):BOOLEAN ;
VIRTUAL PROCEDURE equal(VAR t:Tuple):BOOLEAN ;
VIRTUAL PROCEDURE read(f:File);
VIRTUAL PROCEDURE write(f:File);
END Company;


CLASS Share(Date);
	comp:CompType;
	note:String;
VIRTUAL PROCEDURE compequal(VAR t:Share):BOOLEAN ;
VIRTUAL PROCEDURE read(f:File);
VIRTUAL PROCEDURE write(f:File);
END Share;


CLASS Transact(Share);
	number:INTEGER;
	cost,broker,stamp:REAL;
VIRTUAL PROCEDURE read(f:File);
VIRTUAL PROCEDURE write(f:File);
END Transact;


CLASS Dividend(Share);
	unfrnk,franked,imputed:REAL;
VIRTUAL PROCEDURE read(f:File);
VIRTUAL PROCEDURE write(f:File);
END Dividend;


CLASS Gain(Share);
	number:INTEGER;
	received,cost,aquired,disposed,index,base,indexed,taxed:REAL;
	purchase,sale:TransactPtr;
PROCEDURE create(n:INTEGER;tr1,tr2:TransactPtr);
VIRTUAL PROCEDURE write(f:File);
END Gain;


CLASS CPIDB(DBase);
PROCEDURE value(VAR d:Date):REAL;
PROCEDURE insert(VAR t:Tuple);
PROCEDURE merge(VAR d:DBase);
END CPIDB;


CLASS ShareDB(DBase);
PROCEDURE compselect(c:CompType);
PROCEDURE compreject(c:CompType);
END ShareDB;


CLASS GainDB;
	transactions,gains,summarys:ShareDB;
PROCEDURE clear;
PROCEDURE fifosale(tr:TransactPtr);
PROCEDURE distsale(tr:TransactPtr);
PROCEDURE bonus(tr:TransactPtr);
PROCEDURE purchase(tr:TransactPtr);
END GainDB;


CLASS Folio;
	transactions,dividends:ShareDB;
	gains:GainDB;
PROCEDURE clear;
PROCEDURE update;
PROCEDURE before(VAR date:Date);
PROCEDURE after(VAR date:Date);
PROCEDURE select(c:CompType);
PROCEDURE reject(c:CompType);
PROCEDURE datesort;
PROCEDURE load(f:File);
PROCEDURE save(f:File);
PROCEDURE read(f:File);
PROCEDURE write(f:File);
END Folio;

VAR
	comp:DBase;
	cpis:CPIDB;


END SHARE11.