public function getHtmlIndex($id = false, $name = false) { $module = Yii::$app->getModule('cap'); $search = $id; $sql = 'id = :search'; if ($name) { $search = $name; $sql = 'name = :search'; } $account = AccountCodeSearch::find()->where($sql, ['search' => $search])->one(); $value = 0; $value = $account->sisa * ($account->increaseon == 0 ? 1 : -1); $div = pow(10, max(0, floor((strlen($account->max . "") - 1) / 3)) * 3); $html = '<li> ' . ($account->parent_id != null ? $account->code . ' - ' : '<h4>') . Html::a($account->name, ['view', 'id' => $account->id]) . '<span class="pull-right">' . number_format($value / ($div == 0 ? 1 : $div), 2, $module->currency["decimal_separator"], $module->currency["thousand_separator"]) . '</span>' . ($account->parent_id != null ? '' : '</h4>') . ' <ul id="account-codes-' . $account->id . '" class="navs" style="clear:right">'; $children = $account->accountCodes; foreach ($children as $child) { $html .= Account::getHtmlIndex($child->id); } $html .= ' </ul> </li>'; return $html; }
$html = Account::getHtmlIndex($model->id); } return $html; }]); ?> </ul> </div> <div class="col-md-6"> <ul class="nav"> <?php echo ListView::widget(['dataProvider' => $dataProvider, 'itemOptions' => ['class' => 'item'], 'summary' => Yii::t('app', 'List of account codes where increase on revenues, but has no affect on balance'), 'itemView' => function ($model, $key, $index, $widget) { $html = ''; if ($model->isbalance == 0 && $model->increaseon == 1) { $ch = []; $children = $model->accountCodes; foreach ($children as $child) { $c = $child->attributes; array_push($ch, $c); } $html = Account::getHtmlIndex($model->id); } return $html; }]); ?> </ul> </div> </div> </div>