Beispiel #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = BranchModel::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'orgn_id' => $this->orgn_id, '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]);
     return $dataProvider;
 }
Beispiel #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getBranch()
 {
     return $this->hasOne(Branch::className(), ['id' => 'branch_id']);
 }
Beispiel #3
0
$this->title = 'Purchases';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="row purchase-index">
    <section class="col-lg-12">
        <?php 
echo Toolbar::widget(['items' => [['label' => '', 'url' => ['print-html'], 'icon' => 'fa fa-print', 'linkOptions' => ['class' => 'btn btn-default btn-sm disabled', 'target' => '_blank', 'title' => 'Html Print']], ['label' => '', 'url' => ['print-pdf'], 'icon' => 'fa fa-file', 'linkOptions' => ['class' => 'btn btn-default btn-sm disabled', 'target' => '_blank', 'title' => 'Export to Pdf']], ['label' => '', 'url' => ['print-xsl'], 'icon' => 'fa fa-table', 'linkOptions' => ['class' => 'btn btn-default btn-sm disabled', 'target' => '_blank', 'title' => 'Export to Excel']]]]) . '&nbsp;&nbsp;';
echo ActionToolbar::widget(['items' => [['label' => 'Create New', 'url' => ['create', 'type' => 100], 'icon' => 'fa fa-plus-square'], ['label' => 'Update', 'url' => ['update'], 'icon' => 'fa fa-pencil', 'linkOptions' => ['class' => 'disabled']], ['label' => 'Delete', 'url' => ['delete'], 'icon' => 'fa fa-trash-o', 'linkOptions' => ['class' => 'disabled', 'data' => ['confirm' => 'Are you sure you want to delete this item?', 'method' => 'post']]], ['label' => 'PO List', 'url' => ['index'], 'icon' => 'fa fa-list', 'linkOptions' => ['class' => 'disabled']]]]);
?>
        <div class="box box-info">
            <div class="box-body no-padding">
                <?php 
\yii\widgets\Pjax::begin(['enablePushState' => false]);
?>
                <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'layout' => "{items}\n{pager}", 'tableOptions' => ['class' => 'table table-striped'], 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'number', ['attribute' => 'supplier_id', 'value' => 'supplier.name', 'filter' => Supplier::selectOptions()], ['attribute' => 'branch_id', 'value' => 'branch.name', 'filter' => Branch::selectOptions()], 'date:date', 'value:currency', ['attribute' => 'status', 'format' => 'raw', 'value' => function ($data) {
    $color = $data->status == Purchase::STATUS_DRAFT ? 'danger' : 'success';
    $color = $data->status == Purchase::STATUS_CONFIRMED ? 'warning' : $color;
    $color = $data->status == Purchase::STATUS_PROCESS ? 'info' : $color;
    $color = $data->status == Purchase::STATUS_CLOSE ? 'success' : $color;
    return Html::tag('small', $data->nmStatus, ['class' => 'label label-' . $color]);
}], ['class' => 'yii\\grid\\ActionColumn']]]);
?>
                <?php 
\yii\widgets\Pjax::end();
?>
            </div>
    </section>
</div>

Beispiel #4
0
use app\models\master\Branch;
use app\models\master\Supplier;
/* @var $this yii\web\View */
/* @var $searchModel app\models\purchase\searchs\Purchase */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Purchase List';
$this->params['breadcrumbs'][] = ['label' => 'Prices', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="purchase-index">
    <?php 
echo Toolbar::widget(['items' => [['label' => 'Create', 'url' => ['create'], 'icon' => 'fa fa-plus-square', 'linkOptions' => ['class' => 'btn btn-success btn-sm']]]]);
?>
    <div class="box box-info">
        <div class="box-body no-padding">
            <?php 
\yii\widgets\Pjax::begin(['enablePushState' => false]);
?>
            <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'layout' => "{items}\n{pager}", 'tableOptions' => ['class' => 'table table-striped'], 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'number', ['attribute' => 'supplier_id', 'value' => 'supplier.name', 'filter' => Supplier::selectOptions()], ['attribute' => 'branch_id', 'value' => 'branch.name', 'filter' => Branch::selectOptions()], 'date:date', 'value:currency', ['attribute' => 'status', 'value' => 'nmStatus', 'filter' => [Purchase::STATUS_DRAFT => 'Draft', Purchase::STATUS_PROCESS => 'Process', Purchase::STATUS_CLOSE => 'Close']], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{create-by-po}', 'buttons' => ['create-by-po' => function ($url, $model, $key) {
    return Html::a('<span class="glyphicon glyphicon-ok"></span>', $url, ['title' => Yii::t('yii', 'View'), 'data-pjax' => '0']);
}]]]]);
?>
            <?php 
\yii\widgets\Pjax::end();
?>
        </div>
    </div>
</div>

Beispiel #5
0
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use app\models\master\Branch;
/* @var $this yii\web\View */
/* @var $model app\models\master\Warehouse */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="warehouse-form">

    <?php 
$form = ActiveForm::begin();
?>

    <?php 
echo $form->field($model, 'branch_id')->dropDownList(Branch::selectOptions());
?>

    <?php 
echo $form->field($model, 'code')->textInput(['maxlength' => 4]);
?>

    <?php 
echo $form->field($model, 'name')->textInput(['maxlength' => 32]);
?>

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>
Beispiel #6
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getBranches()
 {
     return $this->hasMany(Branch::className(), ['orgn_id' => 'id']);
 }
 /**
  * Finds the Branch model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Branch the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Branch::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }