示例#1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = AppContract::find();
     // add conditions that should always apply here
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     // grid filtering conditions
     $query->andFilterWhere(['ID' => $this->ID, 'Period' => $this->Period, 'DateOfSigning' => $this->DateOfSigning, 'status' => $this->status, 'ID_TypeOfContract' => $this->ID_TypeOfContract, 'ID_TypeOfCalculation' => $this->ID_TypeOfCalculation, 'ID_PaymentPeriod' => $this->ID_PaymentPeriod, 'ID_CurrencyOfThePayments' => $this->ID_CurrencyOfThePayments, 'ID_partner' => $this->ID_partner, 'ID_issuer' => $this->ID_issuer, 'ID_in_ExtSystem' => $this->ID_in_ExtSystem]);
     $query->andFilterWhere(['like', 'ContractNumber', $this->ContractNumber])->andFilterWhere(['like', 'Name', $this->Name])->andFilterWhere(['like', 'AlfrescoLink', $this->AlfrescoLink]);
     if (isset($this->DateOfSigning) && $this->DateOfSigning != '') {
         // $date_explode = explode("TO", $this->DateOfSigning);
         list($start_date, $end_date) = explode(' - ', $this->DateOfSigning);
         // $date1 = trim($date_explode[0]);
         // $date2= trim($date_explode[1]);
         $query->andFilterWhere(['between', 'DateOfSigning', $start_date, $end_date]);
     }
     return $dataProvider;
 }
示例#2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getContracts()
 {
     return $this->hasMany(AppContract::className(), ['ID_issuer' => 'ID']);
 }
示例#3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getcontract()
 {
     return $this->hasOne(AppContract::className(), ['ID' => 'ID_Contract']);
 }
示例#4
0
 /**
  * Finds the Contract model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Contract the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = AppContract::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
示例#5
0
文件: index.php 项目: netscorpion/CRM
<?php

use yii\helpers\Html;
use yii\helpers\ArrayHelper;
// use yii\grid\GridView;
use kartik\grid\GridView;
use yii\widgets\Pjax;
use app\models\AppSystemIssuer;
use app\models\AppCardsPurse;
use app\models\AppCardsPurseSearch;
use app\models\AppCardsHolder;
use app\models\AppContract;
/* @var $this yii\web\View */
/* @var $searchModel app\models\AppCardsSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Карты';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="app-cards-index">
<?php 
$gridColumns = [['class' => 'kartik\\grid\\SerialColumn', 'contentOptions' => ['class' => 'kartik-sheet-style'], 'header' => '', 'headerOptions' => ['class' => 'kartik-sheet-style']], ['class' => 'kartik\\grid\\ExpandRowColumn', 'width' => '50px', 'value' => function ($model, $key, $index, $column) {
    return GridView::ROW_COLLAPSED;
}, 'detail' => function ($model, $key, $index, $column) {
    return Yii::$app->controller->renderPartial('@app/views/app-cards-purse/indexforcard', ['model' => $model, 'dataProvider' => new \yii\data\ActiveDataProvider(['query' => $model->getpurses()]), 'searchModel' => new AppCardsPurseSearch()]);
}, 'headerOptions' => ['class' => 'kartik-sheet-style'], 'expandOneOnly' => true], ['attribute' => 'GrNumber'], ['attribute' => 'ID_Holder'], ['attribute' => 'ID_Contract', 'value' => 'contract.Name', 'filterType' => GridView::FILTER_SELECT2, 'filter' => ArrayHelper::map(AppContract::find()->all(), 'ID', 'Name'), 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true]], 'filterInputOptions' => ['placeholder' => 'Все дог...']], ['attribute' => 'status', 'class' => 'kartik\\grid\\BooleanColumn'], ['class' => 'kartik\\grid\\ActionColumn', 'template' => '{view}{info}']];
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => $gridColumns, 'responsive' => true, 'hover' => true, 'pjax' => true, 'panel' => ['heading' => '<h3 class="panel-title"><i class="glyphicon glyphicon-folder-open"></i>' . '&nbsp;&nbsp' . Html::encode($this->title) . '</h3>', 'type' => 'primary', 'footer' => false], 'toolbar' => ['{export}', '{toggleData}']]);
?>
</div>
示例#6
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getcontract()
 {
     return $this->hasMany(AppContract::className(), ['ID_partner' => 'ID']);
 }