/** * save the post's account (*3) */ public function saveAccount() { $this->invest_ids = []; $pcs = Terminvest::find()->where(['ID' => $this->INVES_ID])->all(); if (is_array($this->invest_ids)) { foreach ($pcs as $key => $value) { $pc = new Termdetail(); $pc->CUST_KD_PARENT = $this->cus_kd; $pc->TERM_ID = $this->term_id; $pc->INVES_ID = $value->ID; $pc->save(); } } }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Terminvest::find(); $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; } $query->andFilterWhere(['ID' => $this->ID, 'STATUS' => $this->STATUS, 'CREATE_AT' => $this->CREATE_AT, 'UPDATE_AT' => $this->UPDATE_AT]); $query->andFilterWhere(['like', 'INVES_TYPE', $this->INVES_TYPE])->andFilterWhere(['like', 'KETERANGAN', $this->KETERANGAN])->andFilterWhere(['like', 'CREATE_BY', $this->CREATE_BY])->andFilterWhere(['like', 'UPDATE_BY', $this->UPDATE_BY]); return $dataProvider; }
<?php use yii\helpers\Html; use yii\widgets\ActiveForm; use kartik\widgets\Select2; use kartik\widgets\DatePicker; use lukisongroup\master\models\Terminvest; use kartik\money\MaskMoney; use yii\helpers\Url; use kartik\label\LabelInPlace; use kartik\checkbox\CheckboxX; $data1 = Terminvest::find()->all(); $to1 = "ID"; $from1 = "INVES_TYPE"; $config = ['template' => "{input}\n{error}\n{hint}"]; ?> <?php $form = ActiveForm::begin(['id' => $budget->formName(), 'enableClientValidation' => true, 'enableAjaxValidation' => true, 'validationUrl' => Url::toRoute('/master/term-customers/valid-inves')]); ?> <?php echo $form->field($budget, 'ID_TERM')->hiddenInput(['value' => $id])->label(false); ?> <?php echo $form->field($budget, 'INVES_TYPE')->widget(Select2::classname(), ['options' => ['placeholder' => 'Select Type Investasi ...'], 'data' => $budget->data($data1, $to1, $from1)]); ?> <?php echo $form->field($budget, 'PERIODE_START')->widget(DatePicker::classname(), ['options' => ['placeholder' => 'Dari ...'], 'pluginOptions' => ['autoclose' => true, 'format' => 'dd-mm-yyyy'], 'pluginEvents' => ['show' => "function(e) {errror}"]]);
public function getInvest() { return $this->hasOne(Terminvest::className(), ['ID' => 'INVESTASI_TYPE']); }
/** * Finds the Terminvest model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Terminvest the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Terminvest::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
<?php /*extensions */ use yii\helpers\Html; use yii\bootstrap\ActiveForm; use yii\helpers\ArrayHelper; use kartik\widgets\Select2; use kartik\money\MaskMoney; use kartik\widgets\DatePicker; /* namespace model*/ use lukisongroup\master\models\Terminvest; /*array */ $investData = ArrayHelper::map(Terminvest::find()->all(), 'ID', 'INVES_TYPE'); $data = [2 => '2 persen', 4 => '4 persen ', 10 => '10 persen', 15 => '15 persen']; $config = ['template' => "{input}\n{error}\n{hint}"]; ?> <div class="row"> <?php /* $form = ActiveForm::begin([ 'id'=>'auth1Mdl_po', 'enableClientValidation' => true, 'enableAjaxValidation' => true, 'method' => 'post', 'action' => ['/purchasing/purchase-order/sign-auth1-save'], ]); */ $form = ActiveForm::begin(['id' => 'acc-actual-input', 'enableClientValidation' => true, 'enableAjaxValidation' => true, 'method' => 'post', 'action' => ['/purchasing/data-term/actual-review-save']]); ?> <?php echo $form->errorSummary($actualModel, ['class' => 'btn-danger']); ?>
public function aryData_invest() { return ArrayHelper::map(Terminvest::find()->all(), 'ID', 'INVES_TYPE'); }
public function ary_invets() { /* array*/ $data_invest = ArrayHelper::map(Terminvest::find()->all(), 'ID', 'INVES_TYPE'); return $data_invest; }