Beispiel #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = CoaModel::find();
     $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['code' => SORT_ASC]], 'pagination' => ['pageSize' => 100]]);
     $this->load($params);
     if (!$this->validate()) {
         $query->where('1=0');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'parent_id' => $this->parent_id, 'type' => $this->type, 'created_at' => $this->created_at, 'created_by' => $this->created_by, 'updated_at' => $this->updated_at, 'updated_by' => $this->updated_by]);
     $query->andFilterWhere(['like', 'code', $this->code])->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'normal_balance', $this->normal_balance]);
     return $dataProvider;
 }
Beispiel #2
0
<?php

use yii\helpers\Html;
use yii\grid\GridView;
use app\components\Toolbar;
use app\models\accounting\Coa;
/* @var $this yii\web\View */
/* @var $searchModel app\models\accounting\searchs\Coa */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Coas';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="coa-index">
    <?php 
echo Toolbar::widget(['items' => [['label' => 'Create', 'url' => ['create'], 'icon' => 'fa fa-plus-square', 'linkOptions' => ['class' => 'btn btn-success btn-sm']]]]);
?>
    <?php 
echo Toolbar::widget(['items' => [['label' => '', 'url' => ['print-html'], 'icon' => 'fa fa-print', 'linkOptions' => ['class' => 'btn btn-default btn-sm', 'target' => '_blank', 'title' => 'Html Print']], ['label' => '', 'url' => ['print-pdf'], 'icon' => 'fa fa-file', 'linkOptions' => ['class' => 'btn btn-default btn-sm', 'target' => '_blank', 'title' => 'Export to Pdf']], ['label' => '', 'url' => ['print-xsl'], 'icon' => 'fa fa-table', 'linkOptions' => ['class' => 'btn btn-default btn-sm', 'target' => '_blank', 'title' => 'Export to Excel']]]]);
?>
    <div class="box box-info">
        <div class="box-body no-padding">
            <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'layout' => "{items}\n{pager}", 'tableOptions' => ['class' => 'table table-striped'], 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'code', 'name', ['attribute' => 'type', 'value' => 'group.name', 'label' => 'Coa Group', 'filter' => Coa::selectGroup()], ['attribute' => 'normal_balance', 'value' => 'normal_balance', 'filter' => ['D' => 'Debit', 'K' => 'Kredit']], ['class' => 'yii\\grid\\ActionColumn']]]);
?>

        </div>
    </div>
</div>
Beispiel #3
0
use yii\web\JsExpression;
use yii\jui\AutoComplete;
use yii\web\View;
/* @var $this yii\web\View */
/* @var $model app\models\accounting\Coa */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="box box-warning">
    <?php 
$form = ActiveForm::begin();
?>
    <div class="box-body">

        <?php 
echo $form->field($model, 'type')->dropDownList(Coa::selectGroup());
?>

        <?php 
echo $form->field($model, 'nmParent')->widget('yii\\jui\\AutoComplete', ['clientOptions' => ['source' => new JsExpression('biz.master.sourceCoa'), 'select' => new JsExpression('biz.coa.onParentSelect'), 'search' => new JsExpression('biz.coa.onParentSearch')], 'options' => ['class' => 'form-control']]);
?>

        <?php 
echo $form->field($model, 'parent_id')->hiddenInput()->label(false);
?>
        <br>
        <?php 
echo $form->field($model, 'code')->textInput(['maxlength' => 16], ['style' => 'width:200px;']);
?>

        <?php 
Beispiel #4
0
 /**
  * Finds the Coa model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Coa the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Coa::findOne($id)) !== null) {
         $model->nmParent = $model->parent->name;
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }