52 $maxLock = intval(Main\
Config\Option::get(
'sale',
'MAX_LOCK_TIME', 60));
54 $userID = (is_object($USER) ? (int)$USER->getID() : 0);
56 $connection = Main\Application::getConnection();
57 $helper = $connection->getSqlHelper();
62 'autocomplete' =>
true,
85 $DB->datetimeToDateFunction(
'%s'),
87 array(
'data_type' =>
'datetime')
92 static::replaceDateTime(),
94 array(
'data_type' =>
'datetime')
101 $DB->datetimeToDateFunction(
'%s'),
102 array(
'DATE_UPDATE'),
103 array(
'data_type' =>
'datetime')
108 '(SELECT SUM(b_sale_basket.QUANTITY)
110 WHERE b_sale_basket.ORDER_ID = %s)',
123 new Main\
Entity\ReferenceField(
126 array(
'=this.USER_ID' =>
'ref.ID'),
127 array(
'join_type' =>
'left')
133 'values' => array(
'N',
'Y'),
134 'default_value' =>
'N'
141 'values' => array(
'N',
'Y'),
142 'default_value' =>
'N'
153 'values' => array(
'N',
'Y'),
154 'default_value' =>
'N'
165 new Main\
Entity\ReferenceField(
167 'Bitrix\Sale\Internals\StatusLang',
169 '=this.STATUS_ID' =>
'ref.STATUS_ID',
170 '=ref.LID' => array(
'?', LANGUAGE_ID)
178 $DB->datetimeToDateFunction(
'%s'),
179 array(
'DATE_STATUS'),
180 array(
'data_type' =>
'datetime')
185 new Main\
Entity\ReferenceField(
189 '=this.EMP_STATUS_ID' =>
'ref.ID'
196 'values' => array(
'N',
'Y'),
197 'default_value' =>
'N'
205 new Main\
Entity\ReferenceField(
209 '=this.EMP_MARKED_ID' =>
'ref.ID'
222 'values' => array(
'N',
'Y'),
223 'default_value' =>
'N'
233 'values' => array(
'N',
'Y'),
234 'default_value' =>
'N'
241 'default_value' =>
'0.0000'
256 'default_value' =>
'0.0000'
262 "%s + (SELECT SUM(b_sale_basket.DISCOUNT_PRICE)
264 WHERE b_sale_basket.ORDER_ID = %s)",
265 array(
'DISCOUNT_VALUE',
'ID')
274 'CASE WHEN %s = \'Y\' THEN %s ELSE %s END',
275 array(
'PAYED',
'PRICE',
'SUM_PAID')
302 new Main\
Entity\ReferenceField(
306 '=this.CREATED_BY' =>
'ref.ID'
312 new Main\
Entity\ReferenceField(
316 '=this.RESPONSIBLE_ID' =>
'ref.ID'
329 'values' => array(
'N',
'Y'),
330 'default_value' =>
'N'
338 new Main\
Entity\ReferenceField(
342 '=this.LOCKED_BY' =>
'ref.ID'
352 $helper->getConcatFunction(
"'('",
"%s",
"') '",
"%s",
"' '",
"%s"),
353 array(
'LOCK_USER.LOGIN',
'LOCK_USER.NAME',
'LOCK_USER.LAST_NAME')
358 "case when DATE_LOCK is null or " . $helper->addSecondsToDateTime($maxLock * 60,
'DATE_LOCK') .
" < now() then 'green' when LOCKED_BY = ".$userID.
" then 'yellow' else 'red' end"
361 new Main\
Entity\ReferenceField(
363 'Bitrix\Main\UserGroup',
365 '=ref.USER_ID' =>
'this.USER_ID'
369 new Main\
Entity\ReferenceField(
373 '=this.RESPONSIBLE_ID' =>
'ref.ID'
377 new Main\
Entity\ReferenceField(
379 'Bitrix\Sale\Internals\Basket',
381 '=this.ID' =>
'ref.ORDER_ID'
383 array(
'join_type' =>
'INNER')
388 'BASKET_PRICE_TOTAL',
390 array(
'BASKET.PRICE',
'BASKET.QUANTITY')
393 new Main\
Entity\ReferenceField(
395 'Bitrix\Sale\Internals\Payment',
397 '=ref.ORDER_ID' =>
'this.ID',
401 new Main\
Entity\ReferenceField(
403 'Bitrix\Sale\Internals\Shipment',
405 '=ref.ORDER_ID' =>
'this.ID',
409 new Main\
Entity\ReferenceField(
411 'Bitrix\Sale\Internals\OrderPropsValue',
413 '=ref.ORDER_ID' =>
'this.ID',
415 array(
'join_type' =>
'INNER')
421 'values' => array(
'N',
'Y')
439 'values' => array(
'N',
'Y'),
457 'values' => array(
'N',
'Y')
466 'values' => array(
'N',
'Y'),
467 'default_value' =>
'N'
472 new Main\
Entity\ReferenceField(
476 '=this.EMP_CANCELED_ID' =>
'ref.ID'
483 'DATE_CANCELED_SHORT',
484 $DB->datetimeToDateFunction(
'%s'),
485 array(
'DATE_CANCELED'),
486 array(
'DATA_TYPE' =>
'datetime')
499 'values' => array(
'N',
'Y'),
500 'default_value' =>
'N'
504 new Main\
Entity\ReferenceField(
506 'Bitrix\Sale\Internals\OrderCoupons',
508 '=ref.ORDER_ID' =>
'this.ID',
510 array(
'join_type' =>
'LEFT')
513 new Main\
Entity\ReferenceField(
514 'ORDER_DISCOUNT_DATA',
515 'Bitrix\Sale\Internals\OrderDiscountData',
517 '=ref.ORDER_ID' =>
'this.ID',
520 array(
'join_type' =>
'LEFT')
523 new Main\
Entity\ReferenceField(
524 'ORDER_DISCOUNT_RULES',
525 'Bitrix\Sale\Internals\OrderRules',
527 '=ref.ORDER_ID' =>
'this.ID',
529 array(
'join_type' =>
'LEFT')
534 "(SELECT (CASE WHEN MAX(BR.RECOMMENDATION) IS NULL OR MAX(BR.RECOMMENDATION) = '' THEN 'N' ELSE 'Y' END) FROM b_sale_basket BR WHERE BR.ORDER_ID=%s GROUP BY BR.ORDER_ID)",
538 new Main\
Entity\ReferenceField(
540 \
Bitrix\
Sale\TradingPlatform\OrderTable::getEntity(),
542 '=ref.ORDER_ID' =>
'this.ID',
544 array(
'join_type' =>
'LEFT')