瀏覽代碼

[backend] Facturation : afficher uniquement les bons de livraison pas encore facturés

refactoring
Guillaume 3 年之前
父節點
當前提交
6976b03959
共有 2 個文件被更改,包括 15 次插入0 次删除
  1. +2
    -0
      backend/controllers/DocumentController.php
  2. +13
    -0
      common/models/DeliveryNote.php

+ 2
- 0
backend/controllers/DocumentController.php 查看文件

@@ -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)
]
) ;
}
}
}
}

+ 13
- 0
common/models/DeliveryNote.php 查看文件

@@ -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;
}

}

Loading…
取消
儲存