예제 #1
0
 private function LoadBalances()
 {
     if (!$this->balanceSheets) {
         $this->balanceSheets = BalanceSheet::LastTwo();
     }
 }
예제 #2
0
<?php

use yii\helpers\Html;
use yii\grid\GridView;
use app\components\AccountValue;
use app\models\BalanceSheet;
/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */
$bSheets = BalanceSheet::LastTwo();
$this->title = 'Balance';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="balance-item-index">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>
	
    <p>
        <?php 
echo Html::a('New Month', ['balance-sheet/create-next'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => ['order_code', 'balanceType.name:text:Type', 'name', ['label' => 'Current Amount by ' . $bSheets[0]->period_start, 'content' => function ($model, $key, $index, $column) {
    return AccountValue::widget(['model' => $model, 'attribute' => 'currentAmount']);
}], ['label' => 'Previous Amount by ' . $bSheets[1]->period_start, 'content' => function ($model, $key, $index, $column) {
    return AccountValue::widget(['model' => $model, 'attribute' => 'previousAmount']);
}], ['class' => 'yii\\grid\\ActionColumn']]]);