@@ -167,6 +167,7 @@ class DistributionController extends BackendController | |||
if ($dateObject && $dateObject->format($format) === $date) { | |||
$distribution = $distributionManager->createDistributionIfNotExist($date); | |||
$json['distribution'] = [ | |||
'id' => $distribution->id, | |||
'active' => $distribution->active, |
@@ -39,6 +39,7 @@ | |||
namespace common\helpers; | |||
use common\logic\Order\Order\Model\Order; | |||
use common\logic\Order\Order\Wrapper\OrderManager; | |||
use common\logic\Producer\Producer\Wrapper\ProducerManager; | |||
use linslin\yii2\curl; | |||
@@ -81,6 +82,8 @@ class Tiller | |||
public function isSynchro($date) | |||
{ | |||
$orderManager = OrderManager::getInstance(); | |||
if ($this->producer_tiller) { | |||
$ordersTiller = $this->getOrders($date); | |||
$ordersOpendistrib = Order::searchAll([ | |||
@@ -99,7 +102,7 @@ class Tiller | |||
foreach ($ordersTiller->orders as $orderTiller) { | |||
if ($orderOpendistrib->tiller_external_id == $orderTiller->id) { | |||
$amountTotalOrderOpendistrib = (int)round( | |||
$orderOpendistrib->getAmountWithTax(Order::AMOUNT_TOTAL) * 100 | |||
$orderManager->getOrderAmountWithTax($orderOpendistrib, Order::AMOUNT_TOTAL) * 100 | |||
); | |||
if ($amountTotalOrderOpendistrib >= (int)$orderTiller->currentPayedAmount | |||
|| $amountTotalOrderOpendistrib >= (int)$orderTiller->currentBill) { |
@@ -44,7 +44,7 @@ class DistributionRepository extends AbstractRepository | |||
{ | |||
$paramsDistribution = [ | |||
'date' => $date, | |||
'distribution.id_producer' => $this->getProducerContext() | |||
'distribution.id_producer' => $this->getProducerContext()->id | |||
]; | |||
if(!is_null($active)) { |
@@ -47,7 +47,11 @@ class OrderRepository extends AbstractRepository | |||
'creditHistory.userAction', | |||
'pointSale' | |||
], | |||
'join_with' => ['distribution', 'user', 'user.userProducer'], | |||
'join_with' => [ | |||
'distribution', | |||
'user', | |||
'user.userProducer' | |||
], | |||
'orderby' => 'order.date ASC', | |||
'attribute_id_producer' => 'distribution.id_producer' | |||
]; |