3 /* definition of the Debtor Receipt/Credit note allocation class */
5 //-----------------------------------------------------------------------------------
15 var $amount; /*Total amount of the transaction in FX */
17 var $allocs; /*array of transactions allocated to */
19 function allocation($trans_no, $type, $person_id, $person_name, $amount, $date_)
21 $this->allocs = array();
23 $this->trans_no = $trans_no;
25 $this->person_id = $person_id;
26 $this->person_name = $person_name;
27 $this->amount = $amount;
28 $this->date_ = $date_;
31 function add_item($type, $type_no, $date_, $due_date, $amount, $amount_allocated,
36 $this->allocs[count($this->allocs)] = new allocation_item($type, $type_no,
37 $date_, $due_date, $amount, $amount_allocated, $current_allocated);
46 function update_item($index, $type, $type_no, $date_, $due_date,
47 $amount, $amount_allocated, $current_allocated)
51 $this->allocs[$index] = new allocation_item($type, $type_no,
52 $date_, $due_date, $amount, $amount_allocated, $current_allocated);
61 function add_or_update_item($type, $type_no, $date_, $due_date,
62 $amount, $amount_allocated, $current_allocated)
64 for ($i = 0; $i < count($this->allocs); $i++)
66 $item = $this->allocs[$i];
67 if (($item->type == $type) && ($item->type_no == $type_no))
69 return $this->update_item($i, $type, $type_no, $date_, $due_date,
70 $amount, $amount_allocated, $current_allocated);
73 return $this->add_item($type, $type_no, $date_, $due_date,
74 $amount, $amount_allocated, $current_allocated);
79 //-----------------------------------------------------------------------------------
90 var $amount_allocated;
93 var $current_allocated;
95 function allocation_item ($type, $type_no, $date_, $due_date, $amount,
96 $amount_allocated, $current_allocated)
100 $this->type_no = $type_no;
102 $this->date_ = $date_;
103 $this->due_date = $due_date;
105 $this->amount = $amount;
106 $this->amount_allocated = $amount_allocated;
107 $this->current_allocated = $current_allocated;
111 //-----------------------------------------------------------------------------------