|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function actionOrder($id = 0, $date = '') |
|
|
public function actionOrder($id = 0, $date = '') |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
$params = []; |
|
|
$params = []; |
|
|
|
|
|
$producer = $this->getProducer() ; |
|
|
|
|
|
|
|
|
if ($id) { |
|
|
if ($id) { |
|
|
$order = Order::searchOne([ |
|
|
$order = Order::searchOne([ |
|
|
|
|
|
|
|
|
if (strlen($date)) { |
|
|
if (strlen($date)) { |
|
|
$distribution = Distribution::searchOne([ |
|
|
$distribution = Distribution::searchOne([ |
|
|
'date' => $date, |
|
|
'date' => $date, |
|
|
'id_producer' => GlobalParam::getCurrentProducerId() |
|
|
|
|
|
|
|
|
'id_producer' => $producer->id |
|
|
]); |
|
|
]); |
|
|
|
|
|
|
|
|
if($distribution) { |
|
|
if($distribution) { |
|
|
|
|
|
|
|
|
*/ |
|
|
*/ |
|
|
public function actionHistory($type = 'incoming') |
|
|
public function actionHistory($type = 'incoming') |
|
|
{ |
|
|
{ |
|
|
|
|
|
$producer = $this->getProducer() ; |
|
|
|
|
|
|
|
|
$query = Order::find() |
|
|
$query = Order::find() |
|
|
->with('productOrder', 'pointSale', 'creditHistory') |
|
|
->with('productOrder', 'pointSale', 'creditHistory') |
|
|
->joinWith('distribution', 'distribution.producer') |
|
|
->joinWith('distribution', 'distribution.producer') |
|
|
->where([ |
|
|
->where([ |
|
|
'id_user' => Yii::$app->user->id, |
|
|
'id_user' => Yii::$app->user->id, |
|
|
'distribution.id_producer' => GlobalParam::getCurrentProducerId() |
|
|
|
|
|
|
|
|
'distribution.id_producer' => $producer->id |
|
|
]) |
|
|
]) |
|
|
->params([':date_today' => date('Y-m-d')]); |
|
|
->params([':date_today' => date('Y-m-d')]); |
|
|
|
|
|
|