@@ -248,12 +248,14 @@ class DocumentController extends BackendController | |||
$json['delivery_notes'] = [] ; | |||
foreach($deliveryNotesArray as $deliveryNote) { | |||
if(!$deliveryNote->isInvoiced()) { | |||
$json['delivery_notes'][] = array_merge( | |||
$deliveryNote->getAttributes(), | |||
[ | |||
'total' => $deliveryNote->getAmountWithTax(Order::INVOICE_AMOUNT_TOTAL) | |||
] | |||
) ; | |||
} | |||
} | |||
} | |||
} |
@@ -90,4 +90,17 @@ class DeliveryNote extends Document | |||
]; | |||
} | |||
public function isInvoiced() | |||
{ | |||
if($this->orders && count($this->orders) > 0) { | |||
foreach($this->orders as $order) { | |||
if($order->id_invoice) { | |||
return true; | |||
} | |||
} | |||
} | |||
return false; | |||
} | |||
} |