- if ($this->trans_no == 0) return; // this is new payment
-
- /* Now get trans that might have previously been allocated to by this trans
- NB existing entries where still some of the trans outstanding entered from
- above logic will be overwritten with the prev alloc detail below */
-
- if ($this->person_type==PT_SUPPLIER)
- $trans_items = get_allocatable_to_supp_transactions($this->person_id,
- $this->trans_no, $this->type);
- else
- $trans_items = get_allocatable_to_cust_transactions($this->person_id,
- $this->trans_no, $this->type);
-
- while ($myrow = db_fetch($trans_items))
- {
- $this->add_or_update_item ($myrow["type"], $myrow["trans_no"],
- sql2date($myrow["tran_date"]),
- sql2date($myrow["due_date"]),
- $myrow["Total"],
- $myrow["alloc"] - $myrow["amt"], $myrow["amt"], $myrow["reference"], $myrow["early_discount"], $myrow["early_days"]);
- }