|
|
|
|
|
|
|
|
|
|
|
|
|
|
$ordersArray = Order::searchAll([ |
|
|
$ordersArray = Order::searchAll([ |
|
|
'distribution.date' => $date, |
|
|
'distribution.date' => $date, |
|
|
|
|
|
'distribution.id_producer' => $idProducer |
|
|
], |
|
|
], |
|
|
[ |
|
|
[ |
|
|
'orderby' => 'user.lastname ASC, user.name ASC, comment_point_sale ASC', |
|
|
'orderby' => 'user.lastname ASC, user.name ASC, comment_point_sale ASC', |
|
|
'conditions' => 'date_delete IS NULL' |
|
|
'conditions' => 'date_delete IS NULL' |
|
|
]); |
|
|
]); |
|
|
|
|
|
|
|
|
$distribution = Distribution::searchOne([], [ |
|
|
|
|
|
|
|
|
$distribution = Distribution::searchOne([ |
|
|
|
|
|
'id_producer' => $idProducer |
|
|
|
|
|
], [ |
|
|
'conditions' => 'date LIKE :date', |
|
|
'conditions' => 'date LIKE :date', |
|
|
'params' => [':date' => $date] |
|
|
'params' => [':date' => $date] |
|
|
]); |
|
|
]); |
|
|
|
|
|
|
|
|
if ($distribution) { |
|
|
if ($distribution) { |
|
|
$selectedProductsArray = ProductDistribution::searchByDistribution($distribution->id); |
|
|
$selectedProductsArray = ProductDistribution::searchByDistribution($distribution->id); |
|
|
$pointsSaleArray = PointSale::searchAll(); |
|
|
|
|
|
|
|
|
$pointsSaleArray = PointSale::searchAll([ |
|
|
|
|
|
'point_sale.id_producer' => $idProducer |
|
|
|
|
|
]); |
|
|
|
|
|
|
|
|
foreach ($pointsSaleArray as $pointSale) { |
|
|
foreach ($pointsSaleArray as $pointSale) { |
|
|
$pointSale->initOrders($ordersArray); |
|
|
$pointSale->initOrders($ordersArray); |
|
|
|
|
|
|
|
|
$q->where(['id_distribution' => $distribution->id]); |
|
|
$q->where(['id_distribution' => $distribution->id]); |
|
|
}]) |
|
|
}]) |
|
|
->where([ |
|
|
->where([ |
|
|
'id_producer' => GlobalParam::getCurrentProducerId(), |
|
|
|
|
|
|
|
|
'id_producer' => $idProducer, |
|
|
]) |
|
|
]) |
|
|
->orderBy('order ASC') |
|
|
->orderBy('order ASC') |
|
|
->all(); |
|
|
->all(); |