Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
deductdocument.php
1
<?php
2
namespace
Bitrix\Catalog\Product\Store\DistributionStrategy
;
3
4
use Bitrix\Catalog\EO_StoreDocumentElement;
5
use Bitrix\Catalog\EO_StoreBatchDocumentElement_Collection;
6
use Bitrix\Catalog\EO_StoreBatch;
7
use
Bitrix\Catalog\Product\Store\BatchManager
;
8
use
Bitrix\Catalog\StoreBatchDocumentElementTable
;
9
use
Bitrix\Main\Result
;
10
16
final
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
{
28
return
StoreBatchDocumentElementTable::add
([
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
{
39
return
StoreBatchDocumentElementTable::getList
([
40
'filter'
=> [
41
'=DOCUMENT_ELEMENT_ID'
=> $this->documentElement->getId(),
42
'<AMOUNT'
=> 0,
43
],
44
])
45
->fetchCollection()
46
;
47
}
48
}
Bitrix\Catalog\Product\Store\BatchManager
Definition
batchmanager.php:19
Bitrix\Catalog\Product\Store\DistributionStrategy\Base
Definition
base.php:21
Bitrix\Catalog\Product\Store\DistributionStrategy\Base\$batchManager
BatchManager $batchManager
Definition
base.php:23
Bitrix\Catalog\Product\Store\DistributionStrategy\DeductDocument
Definition
deductdocument.php:17
Bitrix\Catalog\Product\Store\DistributionStrategy\DeductDocument\addRegistryItem
addRegistryItem(EO_StoreBatch $batchItem, float $amount)
Definition
deductdocument.php:26
Bitrix\Catalog\Product\Store\DistributionStrategy\DeductDocument\getRegistryItems
getRegistryItems()
Definition
deductdocument.php:37
Bitrix\Catalog\Product\Store\DistributionStrategy\DeductDocument\__construct
__construct(BatchManager $batchManager, EO_StoreDocumentElement $documentElement)
Definition
deductdocument.php:19
Bitrix\Catalog\StoreBatchDocumentElementTable
Definition
storebatchdocumentelementtable.php:28
Bitrix\Main\ORM\Data\DataManager\getList
static getList(array $parameters=array())
Definition
datamanager.php:441
Bitrix\Main\ORM\Data\DataManager\add
static add(array $data)
Definition
datamanager.php:874
Bitrix\Main\ORM\Data\Result
Definition
result.php:16
Bitrix\Main\Result
Definition
result.php:14
Bitrix\Catalog\Product\Store\DistributionStrategy
Definition
base.php:2
modules
catalog
lib
product
store
distributionstrategy
deductdocument.php
Создано системой
1.10.0