if (count($this->src_docs) == 0 && ($this->trans_type == ST_SALESINVOICE || $this->trans_type == ST_CUSTDELIVERY)) {
// this is direct document - first add parent
$ref = $this->reference;
$date = $this->document_date;
$due_date = $this->due_date;
if (count($this->src_docs) == 0 && ($this->trans_type == ST_SALESINVOICE || $this->trans_type == ST_CUSTDELIVERY)) {
// this is direct document - first add parent
$ref = $this->reference;
$date = $this->document_date;
$due_date = $this->due_date;