1<?php
2/* definition of the Journal class */
3
4Class Journal {
5
6	var $GLEntries; /*array of objects of JournalGLAnalysis class - id is the pointer */
7	var $JnlDate; /*Date the journal to be processed */
8	var $JournalType; /*Normal or reversing journal */
9	var $GLItemCounter; /*Counter for the number of GL entires being posted to by the journal */
10	var $GLItemID;
11	var $JournalTotal; /*Running total for the journal */
12	var $BankAccounts; /*Array of bank account GLCodes that must be posted to by a bank payment or receipt
13				to ensure integrity for matching off vs bank stmts */
14
15	function __construct(){
16	/*Constructor function initialises a new journal */
17		$this->GLEntries = array();
18		$this->GLItemCounter=0;
19		$this->JournalTotal=0;
20		$this->GLItemID=0;
21		$this->BankAccounts = array();
22	}
23	function Journal() {
24		self::__construct();
25	}
26
27	function Add_To_GLAnalysis($Amount, $Narrative, $GLCode, $GLActName, $tag, $assetid=1){
28		if (isset($GLCode) AND $Amount!=0){
29			$this->GLEntries[$this->GLItemID] = new JournalGLAnalysis($Amount, $Narrative, $this->GLItemID, $GLCode, $GLActName, $tag, $assetid);
30			$this->GLItemCounter++;
31			$this->GLItemID++;
32			$this->JournalTotal += $Amount;
33
34			Return 1;
35		}
36		Return 0;
37	}
38
39	function remove_GLEntry($GL_ID){
40		$this->JournalTotal -= $this->GLEntries[$GL_ID]->Amount;
41		unset($this->GLEntries[$GL_ID]);
42		$this->GLItemCounter--;
43	}
44
45} /* end of class defintion */
46
47Class JournalGLAnalysis {
48
49	Var $Amount;
50	Var $Narrative;
51	Var $GLCode;
52	var $GLActName;
53	Var $ID;
54	var $tag;
55	var $assetid;
56
57	function __construct ($Amt, $Narr, $id, $GLCode, $GLActName, $tag, $assetid){
58
59/* Constructor function to add a new JournalGLAnalysis object with passed params */
60		$this->Amount =$Amt;
61		$this->Narrative = $Narr;
62		$this->GLCode = $GLCode;
63		$this->GLActName = $GLActName;
64		$this->ID = $id;
65		$this->tag = $tag;
66		$this->assetid = $assetid;
67	}
68	function JournalGLAnalysis($Amt, $Narr, $id, $GLCode, $GLActName, $tag, $assetid){
69		self::__construct($Amt, $Narr, $id, $GLCode, $GLActName, $tag, $assetid);
70
71	}
72}
73
74?>
75