+
+//----------------------------------------------------------------------------------------
+//
+// Returns sales or purchase invoice allocations to be reallocated after invoice edition.
+//
+function get_inv_allocations($trans_no, $trans_type, $person_id)
+{
+ $allocs = array();
+ if ($trans_type == ST_SUPPINVOICE || $trans_type == ST_SUPPCREDIT)
+ $result = get_allocatable_from_supp_transactions($person_id, $trans_no, $trans_type);
+ else
+ $result = get_allocatable_from_cust_transactions($person_id, $trans_no, $trans_type);
+
+ while($dat = db_fetch($result))
+ {
+ $allocs[] = array('type'=> $dat['type'], 'trans_no'=> $dat['trans_no'], 'amount'=>$dat['alloc']);
+ }
+ return $allocs;
+}