public function actionFunctionalities($id = 3)
 {
     $project = Project::findOne($id);
     $monthly = Functionality::find()->where("price > 1 AND project_id = " . $id . " AND monthly_costs = 1")->all();
     //All(['project_id' => $id, 'monthly_costs' => 1],['price','>',1]);
     $once = Functionality::find()->where("price > 1 AND project_id = " . $id . " AND monthly_costs = 0")->all();
     //(['project_id' => $id, 'monthly_costs' => 0],['price','>',1]);
     $solidCostsMonthly = new Functionality();
     $solidCostsMonthly->name = "Vaste Maandelijkse Kosten";
     $solidCostsMonthly->price = 39.95;
     array_push($monthly, $solidCostsMonthly);
     $solidCostOnce = new Functionality();
     $solidCostOnce->name = "Vaste maandelijkse kosten";
     $solidCostOnce->price = 250;
     array_push($once, $solidCostOnce);
     //            var_dump($monthly); exit;
     $oneOffDataProvider = new ArrayDataProvider(['allModels' => $once]);
     $monthlyDataProvider = new ArrayDataProvider(['allModels' => $monthly]);
     $this->layout = '@common/mail/layouts/html';
     $totalMonthly = 0;
     foreach ($monthlyDataProvider->allModels as $model) {
         $totalMonthly += $model->price;
     }
     $totalOnce = 0;
     foreach ($oneOffDataProvider->allModels as $model) {
         $totalOnce += $model->price;
     }
     return $this->render('@common/mail/overviewMail-html', ['oneOffDataProvider' => $oneOffDataProvider, 'monthlyDataProvider' => $monthlyDataProvider, 'totalMonthly' => $totalMonthly, 'totalOnce' => $totalOnce]);
 }
Ejemplo n.º 2
0
<div class="project-view">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <p>
        <?php 
echo Html::a(Yii::t('common', 'Update'), ['update', 'id' => $model->project_id], ['class' => 'btn btn-primary']);
?>
        <?php 
echo Html::a(Yii::t('common', 'Delete'), ['delete', 'id' => $model->project_id], ['class' => 'btn btn-danger', 'data' => ['confirm' => Yii::t('common', 'Are you sure you want to delete this item?'), 'method' => 'post']]);
?>
    </p>

    <?php 
echo DetailView::widget(['model' => $model, 'attributes' => ['description', 'datetime_added:datetime', 'deleted:boolean', ['label' => Yii::t('user', 'Creator'), 'value' => $model->creator->username], ['label' => Yii::t('customer', 'Client'), 'value' => $model->client->name], ['label' => Yii::t('user', 'Project manager'), 'value' => $model->projectmanager_id ? $model->projectmanager->username : $model->projectmanager_id], 'datetime_updated:datetime', ['label' => Yii::t('user', 'Updater'), 'value' => $model->updater->username]]]);
?>
    
    <h2><?php 
Yii::t('project', 'Functionalities for this project');
?>
</h2>
    
    <?php 
echo GridView::widget(['dataProvider' => new ActiveDataProvider(['query' => Functionality::find()->where(['project_id' => $model->project_id])->with('creator', 'updater')]), 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'project_id', 'name', 'description', 'datetime_added:datetime', ['label' => \Yii::t('project', 'Creator'), 'value' => 'creator.username'], 'datetime_updated:datetime', ['label' => \Yii::t('project', 'Updater'), 'value' => 'updater.username'], 'deleted:boolean', ['class' => 'yii\\grid\\ActionColumn', 'controller' => 'functionality']]]);
?>

</div>
 /**
  * Finds the Functionality model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Functionality the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Functionality::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Ejemplo n.º 4
0
 public function saveAsFunctionality($project_id)
 {
     $functionality = new Functionality();
     $functionality->project_id = $project_id;
     $functionality->name = $this->name;
     $functionality->price = round($this->price, 2);
     $functionality->amount = 1;
     $functionality->description = $this->description;
     $functionality->deleted = false;
     if (!$functionality->validate()) {
         return false;
     } else {
         return $functionality->save();
     }
 }
Ejemplo n.º 5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getFunctionalities()
 {
     return $this->hasMany(Functionality::className(), ['project_id' => 'project_id']);
 }
 /**
  * 
  * @param Model $step
  * @param integer $project_id
  * @param integer $uid
  * @return string $comments
  */
 private function saveFunctionalities($step, $project_id, $uid)
 {
     $comment = '';
     foreach ($step->attributes as $key => $attribute) {
         if (!empty($attribute)) {
             if ($key == 'comment') {
                 $comment = $attribute;
             } else {
                 $bidpart = BidPart::find()->where(['attribute_name' => $key])->one();
                 if ($bidpart->file_upload) {
                     $file = new File();
                     $file->name = $attribute->baseName . '.' . $attribute->extension;
                     $file->description = $bidpart->description;
                     $file->project_id = $project_id;
                     $file->todo_id = null;
                     $file->deleted = 0;
                     $file->creator_id = $uid;
                     $file->updater_id = $uid;
                     $file->save();
                     rename($this->tempFileLocation . $file->name, $this->permFileLocation . $project_id . '/' . $file->name);
                 } else {
                     $functionality = new Functionality();
                     $functionality->name = $bidpart->name;
                     $functionality->description = $attribute;
                     $functionality->project_id = $project_id;
                     $functionality->deleted = 0;
                     $functionality->amount = 1;
                     $functionality->price = $bidpart->price;
                     $functionality->creator_id = $uid;
                     $functionality->updater_id = $uid;
                     $functionality->monthly_costs = $bidpart->monthly_costs;
                     $functionality->save(false);
                 }
             }
         }
     }
     return $comment;
 }
Ejemplo n.º 7
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getFunctionality()
 {
     return $this->hasOne(Functionality::className(), ['functionality_id' => 'functionality_id']);
 }
 protected function findModels($pid)
 {
     if (($models = Functionality::findAll(['project_id' => $pid])) != null) {
         return $models;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Ejemplo n.º 9
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getFunctionalities0()
 {
     return $this->hasMany(Functionality::className(), ['updater_id' => 'id']);
 }
Ejemplo n.º 10
0
?>

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

    <?php 
echo $form->field($model, 'description')->textInput();
?>

    <?php 
echo $form->field($model, 'status_id')->textInput();
?>

    <?php 
echo $form->field($model, 'functionality_id')->dropdownList(ArrayHelper::map(Functionality::find()->all(), 'functionality_id', 'name'));
?>

    <?php 
echo $form->field($model, 'deleted')->checkBox(['label' => 'Deleted']);
?>

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? Yii::t('common', 'Create') : Yii::t('common', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

    <?php 
ActiveForm::end();
?>
Ejemplo n.º 11
0
echo DetailView::widget(['model' => $model, 'attributes' => [['attribute' => 'client_id', 'format' => 'raw', 'value' => Html::a($model->client->name, ['/customer/view', 'id' => $model->client_id])], ['label' => Yii::t('project', 'Projectmanager'), 'value' => $model->projectmanager_id ? $model->projectmanager->username : $model->projectmanager_id], ['label' => Yii::t('project', 'Creator'), 'value' => $model->creator->username], 'datetime_added:datetime', ['label' => Yii::t('project', 'Updater'), 'value' => $model->updater->username], 'datetime_updated:datetime']]);
?>
    
    <h2><?php 
echo Yii::t('project', 'Functionalities for this project');
?>
</h2>
    
    <p>
        <?php 
echo Yii::$app->user->can('editProject') ? Html::a(Yii::t('project', 'Add functionality'), ['functionality/create', 'pid' => $model->project_id], ['class' => 'btn btn-success']) : Html::a('');
?>
</p>
    
	<?php 
echo GridView::widget(['dataProvider' => new ActiveDataProvider(['query' => Functionality::findNonDeleted(['project_id' => $model->project_id])->with('creator', 'updater')]), 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'name', 'description', 'price:currency', 'todoAmount', ['class' => 'yii\\grid\\ActionColumn', 'controller' => 'functionality']]]);
?>
    
    <h2><?php 
echo Yii::t('project', 'Files for this project');
?>
</h2>
    
    <p><?php 
echo Html::a(Yii::t('file', 'Create file'), ['/file/create', 'pid' => $model->project_id], ['class' => 'btn btn-success']);
?>
</p>
    
    <?php 
echo GridView::widget(['dataProvider' => new ActiveDataProvider(['query' => File::findNonDeleted(['project_id' => $model->project_id])->with('creator', 'updater')]), 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'name', 'description', ['class' => 'yii\\grid\\ActionColumn', 'controller' => 'file']]]);
?>