コード例 #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Pembeli::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]);
     $query->andFilterWhere(['like', 'nama_lengkap', $this->nama_lengkap])->andFilterWhere(['like', 'no_ktp', $this->no_ktp])->andFilterWhere(['like', 'alamat', $this->alamat])->andFilterWhere(['like', 'kota', $this->kota])->andFilterWhere(['like', 'no_tlp', $this->no_tlp]);
     return $dataProvider;
 }
コード例 #2
0
use dosamigos\datepicker\DatePicker;
/* @var $this yii\web\View */
/* @var $model app\models\Penjualan */
/* @var $form yii\widgets\ActiveForm */
?>

<?php 
if ($model->isNewRecord) {
    $sql = 'SELECT a.id, concat(a.id, " - ", " TIPE : ", b.nama, " - ",  a.warna, " - ", a.no_rangka, " - ", a.no_mesin) as warna from motor a INNER JOIN jenis_motor b ON a.id_jenis=b.id INNER JOIN kondisi_motor c ON a.id = c.id_motor where a.status = "belum terjual" AND c.kondisi = "siap jual" ORDER by a.id';
} else {
    $sql = 'SELECT a.id, concat(a.id, " - ", " TIPE : ", b.nama, " - ",  a.warna, " - ", a.no_rangka, " - ", a.no_mesin) as warna from motor a INNER JOIN jenis_motor b ON a.id_jenis=b.id INNER JOIN kondisi_motor c ON a.id = c.id_motor ORDER by a.id';
}
$motor = \app\models\Motor::findBySql($sql)->all();
$listData = \yii\helpers\ArrayHelper::map($motor, 'id', 'warna');
$sql2 = 'SELECT id, concat(id, " - ", nama_lengkap, " - ", alamat, " - ", kota) as nama_lengkap from pembeli';
$pembeli = \app\models\Pembeli::findBySql($sql2)->all();
$listData3 = \yii\helpers\ArrayHelper::map($pembeli, 'id', 'nama_lengkap');
?>
<!--<div class="jumbotron" style="background-color : lightgreen;"><b>Info :</b> Data Motor yang tersedia adalah Data Motor dengan kondisi <b>'siap jual'</b> saja.</div>-->

<div class="alert alert-block" style="background-color : lightgreen;">
    <button type="button" class="close" data-dismiss="alert">&times;</button>
    <h4>Info:</h4>
    <b>Data Motor</b> yang tersedia adalah <b>Data Motor</b> dengan kondisi <b>'siap jual'</b> saja.
</div>

<div class="penjualan-form">

    <?php 
$form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]);
?>
コード例 #3
0
 /**
  * Finds the Pembeli model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Pembeli the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Pembeli::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
コード例 #4
0
 public function getPembeli0()
 {
     return $this->hasOne(Pembeli::className(), ['id' => 'id_pembeli'])->via('penjualan0');
 }
コード例 #5
0
 public function getPembeli0()
 {
     return $this->hasOne(Pembeli::className(), ['id' => 'id_pembeli']);
 }