|
|
|
|
|
|
|
|
*/ |
|
|
*/ |
|
|
public function initPaidAmount() |
|
|
public function initPaidAmount() |
|
|
{ |
|
|
{ |
|
|
$history = CreditHistory::find() |
|
|
|
|
|
->where(['id_order' => $this->id]) |
|
|
|
|
|
->all(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(isset($this->creditHistory)) { |
|
|
|
|
|
$history = $this->creditHistory ; |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
$history = CreditHistory::find() |
|
|
|
|
|
->where(['id_order' => $this->id]) |
|
|
|
|
|
->all(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
$this->paid_amount = 0 ; |
|
|
$this->paid_amount = 0 ; |
|
|
|
|
|
|
|
|
if(count($history)) { |
|
|
if(count($history)) { |
|
|
|
|
|
|
|
|
if(is_array($orders)) { |
|
|
if(is_array($orders)) { |
|
|
if(count($orders)) { |
|
|
if(count($orders)) { |
|
|
foreach($orders as $order) { |
|
|
foreach($orders as $order) { |
|
|
$order->init() ; |
|
|
|
|
|
|
|
|
if(is_a($order, 'common\models\Order')) { |
|
|
|
|
|
$order->init() ; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
return $orders ; |
|
|
return $orders ; |
|
|
} |
|
|
} |