- read_sales_trans($type, $trans_no, $this);
- $this->prepayments = get_payments_for($trans_no[0], $type);
- if ($this->order_no) { // free hand credit notes have no order_no
- $sodata = get_sales_order_header($this->order_no, ST_SALESORDER);
- $this->cust_ref = $sodata["customer_ref"];
- // currently currency is hard linked to debtor account
- // $this->customer_currency = $sodata["curr_code"];
- $this->delivery_to = $sodata["deliver_to"];
- $this->delivery_address = $sodata["delivery_address"];
- // child transaction reedition - update with parent info unless it is freehand
- if (!$this->is_prepaid() && !$prepare_child) // this is read for view/reedition
- $this->set_parent_constraints($sodata, $trans_no[0]);
- }
+ read_sales_trans($type, $trans_no, $this);
+ $this->prepayments = get_payments_for($trans_no[0], $type, $this->customer_id);
+ $this->update_payments();
+ if ($this->order_no) { // free hand credit notes have no order_no
+ $sodata = get_sales_order_header($this->order_no, ST_SALESORDER);
+ $this->cust_ref = $sodata["customer_ref"];
+ // currently currency is hard linked to debtor account
+ $this->delivery_to = $sodata["deliver_to"];
+ $this->delivery_address = $sodata["delivery_address"];
+ // child transaction reedition - update with parent info unless it is freehand
+ if (!$this->is_prepaid() && !$prepare_child) // this is read for view/reedition
+ $this->set_parent_constraints($sodata, $trans_no[0]);
+ }