26 private const LOCK_NAME =
'get_check_list';
52 $result->addError(
new Error(Loc::getMessage(
'SALE_CASHBOX_ERROR_EMPTY_CHECK_TYPE')));
57 if (!$check instanceof
Check)
59 $result->addError(
new Error(Loc::getMessage(
'SALE_CASHBOX_ERROR_CHECK')));
63 $check->setEntities($entities);
64 $check->setRelatedEntities($relatedEntities);
75 $result->addError(
new Error(Loc::getMessage(
'SALE_CASHBOX_NOT_FOUND')));
80 $check->setAvailableCashbox($cashboxList);
84 $validateResult = $check->validate();
85 if (!$validateResult->isSuccess())
87 if (
Main\Loader::includeModule(
'crm'))
89 \Bitrix\Crm\Timeline\OrderCheckController::getInstance()->onCheckFailure(
91 'ORDER_FIELDS' =>
$order->getFieldValues(),
96 'BINDINGS' => \
Bitrix\Crm\Order\BindingsMaker\TimelineBindingsMaker::makeByOrder(
$order),
101 $notifyClassName = $registry->getNotifyClassName();
103 $result->addErrors($validateResult->getErrors());
105 $event =
new Main\Event(
'sale', self::EVENT_ON_CHECK_VALIDATION_ERROR, $check->getDataForCheck());
111 $saveResult = $check->save();
112 if ($saveResult->isSuccess())
114 $checkId = $saveResult->getId();
115 $order->addPrintedCheck($check);
117 $enabledImmediateCashboxList =
array();
118 foreach ($cashboxList as $item)
120 if ($item[
'ENABLED'] ===
'Y')
125 $enabledImmediateCashboxList[$item[
'ID']] = $cashbox;
130 if ($enabledImmediateCashboxList)
134 $cashbox = $enabledImmediateCashboxList[$cashboxId];
136 CashboxCheckTable::update(
141 'CASHBOX_ID' => $cashbox->getField(
'ID')
145 $printResult = $cashbox->printImmediately($check);
146 if ($printResult->isSuccess())
148 $data = $printResult->getData();
151 CashboxCheckTable::update($checkId, [
'EXTERNAL_UUID' =>
$data[
'UUID']]);
154 if (
Main\Loader::includeModule(
'crm'))
156 \Bitrix\Crm\Timeline\OrderCheckController::getInstance()->onPrintingCheck(
159 'ORDER_FIELDS' =>
$order->getFieldValues(),
163 'BINDINGS' => \
Bitrix\Crm\Order\BindingsMaker\TimelineBindingsMaker::makeByOrder(
$order),
170 self::savePrintResult(
175 'TYPE' =>
Errors\Error::TYPE,
176 'MESSAGE' => implode(
"\n", $printResult->getErrorMessages())
188 foreach ($cashboxList as $cashbox)
191 $CACHE_MANAGER->SetImmediate(
'sale_checks_'.$cashbox[
'ID'],
true);
196 $result->addErrors($saveResult->getErrors());
202 public static function reprint(
int $checkId):
Result
210 new Error(Loc::getMessage(
'SALE_CASHBOX_ERROR_CHECK_NOT_FOUND', [
'#CHECK_ID#' => $checkId]))
214 if (CashboxCheckCorrectionTable::getRow([
'filter' => [
'=CHECK_ID' => $checkId]]))
217 new Error(Loc::getMessage(
'SALE_CASBHOX_ERROR_CHECK_IS_CORRECTION_CHECK', [
'#CHECK_ID#' => $checkId]))
221 if ($check->getField(
'STATUS') ===
'Y')
224 new Error(Loc::getMessage(
'SALE_CASBHOX_ERROR_CHECK_ALREADY_PRINTED', [
'#CHECK_ID#' => $checkId]))
228 if ($check->getField(
'STATUS') ===
'P')
231 new Error(Loc::getMessage(
'SALE_CASBHOX_ERROR_CHECK_IS_PRINTING', [
'#CHECK_ID#' => $checkId]))
237 $entity = $check->getEntities()[0];
244 $result->addError(
new Error(Loc::getMessage(
'SALE_CASHBOX_NOT_FOUND')));
249 $check->setAvailableCashbox($cashboxList);
251 $registry = Sale\Registry::getInstance($check->getField(
"ENTITY_REGISTRY_TYPE"));
253 $validateResult = $check->validate();
254 if (!$validateResult->isSuccess())
256 if (Main\Loader::includeModule(
'crm'))
258 \Bitrix\Crm\Timeline\OrderCheckController::getInstance()->onCheckFailure(
260 'ORDER_FIELDS' =>
$order->getFieldValues(),
265 'BINDINGS' => \Bitrix\Crm\
Order\BindingsMaker\TimelineBindingsMaker::makeByOrder(
$order),
270 $notifyClassName = $registry->getNotifyClassName();
272 $result->addErrors($validateResult->getErrors());
274 $event =
new Main\Event(
'sale', self::EVENT_ON_CHECK_VALIDATION_ERROR, $check->getDataForCheck());
280 $saveResult = $check->save();
281 if ($saveResult->isSuccess())
283 $checkId = $saveResult->getId();
284 $order->addPrintedCheck($check);
286 $enabledImmediateCashboxList =
array();
287 foreach ($cashboxList as $item)
289 if ($item[
'ENABLED'] ===
'Y')
292 if ($cashbox instanceof IPrintImmediately)
294 $enabledImmediateCashboxList[$item[
'ID']] = $cashbox;
299 if ($enabledImmediateCashboxList)
303 $cashbox = $enabledImmediateCashboxList[$cashboxId];
305 CashboxCheckTable::update(
309 'DATE_PRINT_START' =>
new Type\DateTime(),
310 'CASHBOX_ID' => $cashbox->getField(
'ID')
314 $printResult = $cashbox->printImmediately($check);
315 if ($printResult->isSuccess())
317 $data = $printResult->getData();
320 CashboxCheckTable::update($checkId, [
'EXTERNAL_UUID' =>
$data[
'UUID']]);
323 if (Main\Loader::includeModule(
'crm'))
325 \Bitrix\Crm\Timeline\OrderCheckController::getInstance()->onPrintingCheck(
328 'ORDER_FIELDS' =>
$order->getFieldValues(),
332 'BINDINGS' => \Bitrix\Crm\
Order\BindingsMaker\TimelineBindingsMaker::makeByOrder(
$order),
339 self::savePrintResult(
344 'TYPE' => Errors\Error::TYPE,
345 'MESSAGE' => implode(
"\n", $printResult->getErrorMessages())
357 foreach ($cashboxList as $cashbox)
360 $CACHE_MANAGER->SetImmediate(
'sale_checks_'.$cashbox[
'ID'],
true);
365 $result->addErrors($saveResult->getErrors());
378 if ($item[
'ACTIVE'] !==
'Y')
384 if ($cashbox && $cashbox->isCorrection())
393 public static function addCorrection(
$type, $cashboxId,
array $correction)
397 if (!self::isAvailableCorrection())
401 Loc::getMessage(
'SALE_CASHBOX_CHECK_CORRECTION_NOT_AVAILABLE')
410 $result->addError(
new Error(Loc::getMessage(
'SALE_CASHBOX_ERROR_CHECK')));
414 $check->setField(
'CASHBOX_ID', $cashboxId);
415 $check->setAvailableCashbox([
419 $check->setCorrectionFields($correction);
424 $result->setId($check->getField(
'ID'));
427 if ($cashbox->isCorrection())
429 CashboxCheckTable::update(
430 $check->getField(
'ID'),
432 'STATUS' =>
'P',
'DATE_PRINT_START' =>
new Type\DateTime()
436 $printResult = $cashbox->printCorrectionImmediately($check);
437 if ($printResult->isSuccess())
439 $data = $printResult->getData();
440 CashboxCheckTable::update($check->getField(
'ID'), [
'EXTERNAL_UUID' =>
$data[
'UUID']]);
444 self::savePrintResult(
445 $check->getField(
'ID'),
447 'ID' => $check->getField(
'ID'),
449 'TYPE' => Errors\Error::TYPE,
450 'MESSAGE' => implode(
"\n", $printResult->getErrorMessages())
463 $result->addErrors($r->getErrors());
480 public static function savePrintResult($checkId,
array $data)
486 $result->addError(
new Error(Loc::getMessage(
'SALE_CASHBOX_ERROR_CHECK_ID')));
498 $result->addError(
new Error(Loc::getMessage(
'SALE_CASHBOX_ERROR_CHECK_NOT_FOUND',
array(
'#CHECK_ID#' => $checkId))));
502 if ($check[
'STATUS'] ===
'Y')
505 $registry = Sale\Registry::getInstance($check[
'ENTITY_REGISTRY_TYPE']);
507 if ($check[
'ORDER_ID'] > 0)
510 $orderClassName = $registry->getOrderClassName();
511 $order = $orderClassName::load($check[
'ORDER_ID']);
514 $result->addError(
new Error(Loc::getMessage(
'SALE_CASHBOX_ERROR_CHECK_ORDER_LOAD')));
519 if ($check[
'PAYMENT_ID'] > 0)
524 $result->addError(
new Error(Loc::getMessage(
'SALE_CASHBOX_ERROR_CHECK_PAYMENT_LOAD')));
529 $shipmentCollection =
$order->getShipmentCollection();
530 if ($check[
'SHIPMENT_ID'] > 0)
532 $shipment = $shipmentCollection->getItemById($check[
'SHIPMENT_ID']);
533 if ($shipment ===
null)
535 $result->addError(
new Error(Loc::getMessage(
'SALE_CASHBOX_ERROR_CHECK_SHIPMENT_LOAD')));
541 if (isset(
$data[
'ERROR']))
543 $errorMessage = Loc::getMessage(
'SALE_CASHBOX_ERROR_CHECK_PRINT',
array(
'#CHECK_ID#' => $checkId));
544 if (
$data[
'ERROR'][
'MESSAGE'])
547 if (
$data[
'ERROR'][
'TYPE'] === Errors\Warning::TYPE)
549 if ($check[
'CNT_FAIL_PRINT'] >= 3)
551 $data[
'ERROR'][
'TYPE'] = Errors\Error::TYPE;
555 CashboxCheckTable::update($checkId,
array(
'CNT_FAIL_PRINT' => $check[
'CNT_FAIL_PRINT'] + 1));
561 if (
$data[
'ERROR'][
'TYPE'] === Errors\Error::TYPE)
565 'DATE_PRINT_END' =>
new Main\Type\DateTime(),
566 'ERROR_MESSAGE' =>
$data[
'ERROR'][
'MESSAGE']
568 if ((
int)$check[
'CNT_FAIL_PRINT'] === 0)
569 $updatedFields[
'CNT_FAIL_PRINT'] = 1;
571 CashboxCheckTable::update($checkId, $updatedFields);
574 self::addTimelineCheckEntryOnCreateToOrder(
579 'ERROR_MESSAGE' =>
$data[
'ERROR'][
'MESSAGE'],
586 || $shipment !==
null
591 $errorCode = isset(
$data[
'ERROR'][
'CODE']) ?
$data[
'ERROR'][
'CODE'] : 0;
595 $markerClassName = $registry->getEntityMarkerClassName();
603 $notifyClassName = $registry->getNotifyClassName();
606 elseif ($shipment !==
null)
608 $markerClassName::addMarker(
$order, $shipment, $r);
609 $shipment->setField(
'MARKED',
'Y');
612 $notifyClassName = $registry->getNotifyClassName();
628 $event =
new Main\Event(
'sale', self::EVENT_ON_CHECK_PRINT_ERROR,
array(
$data));
637 'LINK_PARAMS' =>
$data[
'LINK_PARAMS'],
638 'DATE_PRINT_END' =>
new Main\Type\DateTime(),
639 'ERROR_MESSAGE' =>
null,
642 if (isset(
$data[
'EXTERNAL_UUID']))
644 $updateParams[
'EXTERNAL_UUID'] =
$data[
'EXTERNAL_UUID'];
647 $updateResult = CashboxCheckTable::update($checkId, $updateParams);
649 if ($updateResult->isSuccess())
651 self::addStatisticOnSuccessCheckPrint($checkId);
653 self::addTimelineCheckEntryOnCreateToOrder(
$order, $checkId, [
'PRINTED' =>
'Y']);
658 self::EVENT_ON_CHECK_PRINT_SEND,
659 array(
'PAYMENT' =>
$payment,
'SHIPMENT' => $shipment,
'CHECK' => $check)
663 $eventResults =
$event->getResults();
665 foreach($eventResults as $eventResult)
667 if($eventResult->getType() == Main\EventResult::SUCCESS)
676 $notifyClassName = $registry->getNotifyClassName();
679 elseif ($shipment !==
null)
682 $notifyClassName = $registry->getNotifyClassName();
689 $result->addErrors($updateResult->getErrors());
696 private static function addStatisticOnSuccessCheckPrint($checkId)
707 private static function addTimelineCheckEntryOnCreateToOrder(
$order, $checkId,
$params)
709 if (
$order && Main\Loader::includeModule(
'crm'))
711 \Bitrix\Crm\Timeline\OrderCheckController::getInstance()->onPrintCheck(
714 'ORDER_FIELDS' =>
$order->getFieldValues(),
716 'BINDINGS' => \Bitrix\Crm\
Order\BindingsMaker\TimelineBindingsMaker::makeByOrder(
$order),
728 public static function delete($id)
730 $r = CashboxCheckTable::delete($id);
735 ->where(
'CHECK_ID', $id);
737 while ($link =
$dbRes->fetchObject())
748 public static function addChecks(
array $entities)
752 $map = self::collateDocuments($entities);
753 foreach (
$map as $check)
763 foreach (
$event->getResults() as $eventResult)
765 if ($eventResult->getType() !==
Main\EventResult::ERROR)
767 $isCorrect = (bool)$eventResult->getParameters();
774 $addResult = self::addByType($check[
"ENTITIES"], $check[
"TYPE"], $check[
"RELATED_ENTITIES"]);
775 if (!$addResult->isSuccess())
777 $result->addErrors($addResult->getErrors());
790 public static function getOrder(
$entity)
794 if (
$entity instanceof Sale\Payment)
797 $col =
$entity->getCollection();
798 $order = $col->getOrder();
803 $col =
$entity->getCollection();
804 $order = $col->getOrder();
808 throw new Main\ArgumentTypeException(
"entities");
817 private static function getBuildInCheckList()
820 '\Bitrix\Sale\Cashbox\SellCheck',
821 '\Bitrix\Sale\Cashbox\SellReturnCashCheck',
822 '\Bitrix\Sale\Cashbox\SellReturnCheck'
825 if (Manager::isSupportedFFD105())
827 $checkList = array_merge(
830 '\Bitrix\Sale\Cashbox\CorrectionSellCheck',
831 '\Bitrix\Sale\Cashbox\CorrectionBuyCheck',
832 '\Bitrix\Sale\Cashbox\AdvancePaymentCheck',
833 '\Bitrix\Sale\Cashbox\AdvanceReturnCheck',
834 '\Bitrix\Sale\Cashbox\AdvanceReturnCashCheck',
835 '\Bitrix\Sale\Cashbox\CreditPaymentCheck',
836 '\Bitrix\Sale\Cashbox\CreditPaymentReturnCheck',
837 '\Bitrix\Sale\Cashbox\CreditPaymentReturnCashCheck',
838 '\Bitrix\Sale\Cashbox\CreditCheck',
839 '\Bitrix\Sale\Cashbox\CreditReturnCheck',
840 '\Bitrix\Sale\Cashbox\PrepaymentCheck',
841 '\Bitrix\Sale\Cashbox\PrepaymentReturnCheck',
842 '\Bitrix\Sale\Cashbox\PrepaymentReturnCashCheck',
843 '\Bitrix\Sale\Cashbox\FullPrepaymentCheck',
844 '\Bitrix\Sale\Cashbox\FullPrepaymentReturnCheck',
845 '\Bitrix\Sale\Cashbox\FullPrepaymentReturnCashCheck',
856 private static function getUserCheckList()
858 $checkList =
array();
860 $event =
new Main\Event(
'sale', self::EVENT_ON_GET_CUSTOM_CHECK);
862 $resultList =
$event->getResults();
864 if (is_array($resultList) && !empty($resultList))
866 foreach ($resultList as $eventResult)
869 if ($eventResult->getType() === Main\EventResult::SUCCESS)
871 $params = $eventResult->getParameters();
873 $checkList = array_merge($checkList,
$params);
886 static $isInit =
false;
888 if ($isInit ===
false)
890 $handlers = self::getUserCheckList();
901 static $checkList =
array();
904 $checkList = array_merge(
905 self::getBuildInCheckList(),
906 array_keys(self::getUserCheckList())
916 self::getCheckList(),
919 return is_subclass_of($value, Check::class);
927 public static function getCheckTypeMap()
935 foreach ($checkMap as $className)
937 if (class_exists($className))
939 $result[$className::getType()] = $className;
954 $typeMap = self::getCheckTypeMap();
955 $handler = $typeMap[
$type];
965 public static function collateDocuments(
array $entities)
970 'ENTITIES' => $entities
973 $eventResults =
$event->getResults();
974 if ($eventResults !=
null)
976 foreach ($eventResults as $eventResult)
978 if ($eventResult->getType() ===
Main\EventResult::SUCCESS)
980 $d = $eventResult->getParameters();
986 else if ($eventResult->getType() ===
Main\EventResult::ERROR)
998 $existingChecks =
null;
1002 foreach ($entities as
$entity)
1005 if ($existingChecks ===
null)
1007 $existingChecks = [];
1011 'ORDER_ID' =>
$order->getId(),
1012 'ENTITY_REGISTRY_TYPE' => $entity::getRegistryType()
1014 if (
$entity instanceof Sale\Payment)
1025 "select" => [
"ID",
"PAYMENT_ID",
"SHIPMENT_ID",
"TYPE",
"STATUS"]
1027 while (
$ar = $db->fetch())
1029 if (intval(
$ar[
"PAYMENT_ID"]) > 0)
1031 $existingChecks[
"P"][
$ar[
"PAYMENT_ID"] ][] =
$ar;
1034 if (intval(
$ar[
"SHIPMENT_ID"]) > 0)
1036 $existingChecks[
"S"][
$ar[
"SHIPMENT_ID"] ][] =
$ar;
1043 if (
count($existingChecks) <= 0)
1045 if (self::isAutomaticEnabled(
$order))
1047 if (Manager::isSupportedFFD105())
1080 private static function isAutomaticEnabled(Sale\
Order $order)
1082 $shipmentCollection =
$order->getShipmentCollection();
1085 $shipmentCollection->count() > 2
1086 && $shipmentCollection->isExistsSystemShipment()
1090 $shipmentCollection->count() > 1
1091 && !$shipmentCollection->isExistsSystemShipment()
1124 private static function collate(
$entity)
1128 if (
$entity instanceof Sale\Payment)
1135 (
$service->getField(
"CAN_PRINT_CHECK") ==
"Y") &&
1141 $shipmentCollection =
$order->getShipmentCollection();
1143 foreach ($shipmentCollection as $shipment)
1145 if (!$shipment->isSystem())
1146 $checkEntities[] = $shipment;
1165 private static function collateWithFFD105(
$entity)
1170 if (!self::canPrintCheck(
$order))
1175 $entities =
array();
1176 $relatedEntities =
array();
1177 if (
$entity instanceof Sale\Payment)
1187 $originalFields =
$fields->getOriginalValues();
1188 if (!isset($originalFields[
'DEDUCTED']))
1189 $originalFields[
'DEDUCTED'] =
$order->getField(
'DEDUCTED');
1192 if (
$order->getField(
'DEDUCTED') ===
'Y' && $originalFields[
'DEDUCTED'] ===
'Y')
1203 $option = Main\Config\Option::get(
'sale',
'check_type_on_pay',
'sell');
1208 $shipmentCollection =
$order->getShipmentCollection()->getNotSystemItems();
1210 foreach ($shipmentCollection as $shipment)
1215 $map[] =
array(
"TYPE" => $checkType,
"ENTITIES" => $entities,
"RELATED_ENTITIES" => $relatedEntities);
1229 $shipmentCollection =
$order->getShipmentCollection()->getNotSystemItems();
1231 foreach ($shipmentCollection as $shipment)
1243 if (
$entity->getField(
'DEDUCTED') !==
'Y')
1249 if (Main\Config\Option::get(
'sale',
'check_type_on_pay',
'sell') ===
'sell')
1269 throw new Main\NotSupportedException();
1282 private static function collatePaySystemWithFFD105(
$entity):
array
1286 $relatedEntities = [];
1289 $option = Main\Config\Option::get(
'sale',
'check_type_on_pay',
'sell');
1291 if (
$entity instanceof Sale\Payment)
1294 $originalFields =
$fields->getOriginalValues();
1295 if ($originalFields[
'PAID'] ===
'Y' ||
$fields->get(
'IS_RETURN') ===
'Y')
1306 foreach (
$order->getShipmentCollection()->getNotSystemItems() as $shipment)
1308 $isShipped = $shipment->isShipped();
1311 $relatedEntities = [];
1323 $type = (Sale\PriceMaths::roundPrecision(
$entity->getSum()) === Sale\PriceMaths::roundPrecision(
$order->getPrice()))
1327 $shipmentCollection =
$order->getShipmentCollection()->getNotSystemItems();
1329 foreach ($shipmentCollection as $shipment)
1340 $shipmentCollection =
$order->getShipmentCollection()->getNotSystemItems();
1342 foreach ($shipmentCollection as $shipment)
1352 $originalFields =
$fields->getOriginalValues();
1353 if ($originalFields[
'DEDUCTED'] ===
'Y' ||
$fields->get(
'DEDUCTED') !==
'Y')
1385 'ENTITIES' => $entities,
1386 'RELATED_ENTITIES' => $relatedEntities,
1397 private static function canPrintCheck(Sale\
Order $order)
1413 ||
$service->getField(
"CAN_PRINT_CHECK") !==
'Y'
1433 public static function getPrintableChecks(
array $cashboxIds,
array $orderIds =
array())
1437 $con = Main\Application::getConnection();
1438 if (!
$con->lock(self::LOCK_NAME))
1443 $helper =
$con->getSqlHelper();
1446 'LINK_PARAMS' =>
'',
1447 'CHECK2CASHBOX.CASHBOX_ID' => $cashboxIds,
1452 'DATE_PRINT_START' =>
''
1456 '<MAX_DT_REPEAT_CHECK' =>
new Type\DateTime()
1463 $filter[
'ORDER_ID'] = $orderIds;
1466 $limit =
count($cashboxIds)*self::CHECK_LIMIT_RECORDS;
1469 'select' =>
array(
'*',
'AVAILABLE_CASHBOX_ID' =>
'CHECK2CASHBOX.CASHBOX_ID'),
1473 new Main\Entity\ExpressionField(
1474 'MAX_DT_REPEAT_CHECK',
1475 $helper->addSecondsToDateTime(self::CHECK_RESENDING_TIME * 60,
'DATE_PRINT_START'),
1478 'data_type' =>
'datetime'
1493 if (
$i > self::CHECK_LIMIT_RECORDS)
1504 foreach (
$result as $checkId => $item)
1506 if ($item[
'STATUS'] ===
'P')
1508 $now =
new Type\DateTime();
1509 $nowTs = $now->getTimestamp();
1512 $dateStartPrint = $item[
'DATE_PRINT_START'];
1513 $dateStartPrintTs = $dateStartPrint->getTimestamp();
1515 if ($nowTs - $dateStartPrintTs > self::MIN_TIME_FOR_SWITCH_CASHBOX)
1517 $availableCashboxIds = array_diff($item[
'CASHBOX_LIST'],
array($item[
'CASHBOX_ID']));
1518 if ($availableCashboxIds)
1521 CashboxCheckTable::update($checkId,
array(
'CASHBOX_ID' =>
$result[$checkId][
'CASHBOX_ID']));
1526 if ($item[
'CASHBOX_ID'] > 0 && !in_array($item[
'CASHBOX_ID'], $cashboxIds))
1534 CashboxCheckTable::update($checkId,
array(
'STATUS' =>
'P',
'DATE_PRINT_START' =>
new Type\DateTime(),
'CASHBOX_ID' =>
$result[$checkId][
'CASHBOX_ID']));
1538 $con->unlock(self::LOCK_NAME);
1569 $filter[
'=ENTITY_REGISTRY_TYPE'] = $entity::getRegistryType();
1574 $filter[
'=ENTITY_REGISTRY_TYPE'] = $entity::getRegistryType();
1578 return self::collectInfo(
$filter);
1600 '=ENTITY_REGISTRY_TYPE' => $entity::getRegistryType()
1613 'select' =>
array(
'*'),
1615 'order' =>
array(
'DATE_PRINT_END' =>
'DESC'),
1623 if (!empty(
$data[
'LINK_PARAMS']))
1627 $data[
'LINK'] = $cashbox->getCheckLink(
$data[
'LINK_PARAMS']);
1646 $typeMap = CheckManager::getCheckTypeMap();
1650 'select' =>
array(
'*'),
1658 if (!empty(
$data[
'LINK_PARAMS']))
1663 $data[
'LINK'] = $cashbox->getCheckLink(
$data[
'LINK_PARAMS']);
1669 if (class_exists(
$type))
1671 $data[
'TYPE_NAME'] = $type::getName();
1703 $dbRes = CashboxCheckTable::getById($id);
1704 if ($checkInfo =
$dbRes->fetch())
1709 $check->init($checkInfo);
1724 return CashboxCheckTable::getList($parameters);
1740 if ($check ===
null)
1747 $paymentClassName = $registry->getPaymentClassName();
1750 'select' =>
array(
'ORDER_ID'),
1751 'filter' =>
array(
'=ID' => $paymentId)
1754 $paymentData =
$dbRes->fetch();
1764 if (Manager::isSupportedFFD105())
1767 'select' =>
array(
'ID',
'ACCOUNT_NUMBER',
'SUM',
'CURRENCY',
'NAME' =>
'PAY_SYSTEM.NAME'),
1769 '!ID' => $paymentId,
1770 '=ORDER_ID' => $paymentData[
'ORDER_ID']
1779 'NAME' => Loc::getMessage(
'SALE_CASHBOX_CHECK_ADVANCE'),
1783 'NAME' => Loc::getMessage(
'SALE_CASHBOX_CHECK_CREDIT'),
1796 $shipmentClassName = $registry->getShipmentClassName();
1798 'select' =>
array(
'ID',
'ACCOUNT_NUMBER',
'PRICE_DELIVERY',
'CURRENCY',
'NAME' =>
'DELIVERY.NAME'),
1800 '=ORDER_ID' => $paymentData[
'ORDER_ID'],
1826 if (!Manager::isSupportedFFD105())
1832 if ($check ===
null)
1834 throw new Main\ArgumentTypeException($checkType);
1837 $registry = Sale\Registry::getInstance($registryType);
1839 $shipmentClassName = $registry->getShipmentClassName();
1842 'select' =>
array(
'ORDER_ID'),
1843 'filter' =>
array(
'=ID' => $shipmentId)
1846 $shipmentData =
$dbRes->fetch();
1857 'select' =>
array(
'ID',
'ACCOUNT_NUMBER',
'PRICE_DELIVERY',
'CURRENCY',
'NAME' =>
'DELIVERY.NAME'),
1859 '!ID' => $shipmentId,
1860 '=ORDER_ID' => $shipmentData[
'ORDER_ID'],
1876 $paymentClassName = $registry->getPaymentClassName();
1878 'select' =>
array(
'ID',
'ACCOUNT_NUMBER',
'SUM',
'CURRENCY',
'NAME' =>
'PAY_SYSTEM.NAME'),
1880 '=ORDER_ID' => $shipmentData[
'ORDER_ID']
1889 'NAME' => Loc::getMessage(
'SALE_CASHBOX_CHECK_ADVANCE'),
1893 'NAME' => Loc::getMessage(
'SALE_CASHBOX_CHECK_CREDIT'),
1914 $entities = $check->getEntities();
1915 foreach ($entities as
$entity)
1925 $relatedEntities = $check->getRelatedEntities();
1926 foreach ($relatedEntities as $relatedEntityCollection)
1928 foreach ($relatedEntityCollection as $relatedEntity)