Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
deductdocument.php
1<?php
3
4use Bitrix\Catalog\EO_StoreDocumentElement;
5use Bitrix\Catalog\EO_StoreBatchDocumentElement_Collection;
6use Bitrix\Catalog\EO_StoreBatch;
10
16final class DeductDocument extends Base
17{
18 private EO_StoreDocumentElement $documentElement;
19 public function __construct(BatchManager $batchManager, EO_StoreDocumentElement $documentElement)
20 {
21 parent::__construct($batchManager, $documentElement->getStoreFrom());
22
23 $this->documentElement = $documentElement;
24 }
25
26 protected function addRegistryItem(EO_StoreBatch $batchItem, float $amount): Result
27 {
29 'DOCUMENT_ELEMENT_ID' => $this->documentElement->getId(),
30 'AMOUNT' => -$amount,
31 'PRODUCT_BATCH_ID' => $batchItem->getId(),
32 'BATCH_PRICE' => $batchItem->getPurchasingPrice(),
33 'BATCH_CURRENCY' => $batchItem->getPurchasingCurrency(),
34 ]);
35 }
36
37 protected function getRegistryItems(): EO_StoreBatchDocumentElement_Collection
38 {
40 'filter' => [
41 '=DOCUMENT_ELEMENT_ID' => $this->documentElement->getId(),
42 '<AMOUNT' => 0,
43 ],
44 ])
45 ->fetchCollection()
46 ;
47 }
48}
__construct(BatchManager $batchManager, EO_StoreDocumentElement $documentElement)
static getList(array $parameters=array())