• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/cashbox/checkmanager.php
  • Класс: BitrixSaleCashboxCheckManager
  • Вызов: CheckManager::getLastPrintableCheckInfo
static function getLastPrintableCheckInfo(SaleInternalsCollectableEntity $entity)
{
	if (!($entity instanceof SalePayment)
		&& !($entity instanceof SaleShipment)
	)
	{
		return array();
	}

	$filter = array(
		'STATUS' => 'Y',
		'ENTITY_REGISTRY_TYPE' => $entity::getRegistryType()
	);
	if ($entity instanceof SalePayment)
	{
		$filter['PAYMENT_ID'] = $entity->getId();
	}
	elseif ($entity instanceof SaleShipment)
	{
		$filter['SHIPMENT_ID'] = $entity->getId();
	}

	$dbRes = self::getList(
		array(
			'select' => array('*'),
			'filter' => $filter,
			'order' => array('DATE_PRINT_END' => 'DESC'),
			'limit' => 1
		)
	);

	if ($data = $dbRes->fetch())
	{
		$data['LINK'] = '';
		if (!empty($data['LINK_PARAMS']))
		{
			$cashbox = Manager::getObjectById($data['CASHBOX_ID']);
			if ($cashbox)
				$data['LINK'] = $cashbox->getCheckLink($data['LINK_PARAMS']);
		}

		return $data;
	}

	return array();
}