public function actionCeksuplier()
 {
     if (strpos($_GET['term'], "(") === false) {
         $condition = $_GET['term'];
         $criteria = new CDbCriteria();
         $criteria->condition = " suplier_name like '%{$condition}%'";
         $criteria->limit = 7;
         $info = Suplier::model()->findAll($criteria);
         $arModels = array();
         foreach ($info as $model) {
             $arModels[] = array('id' => $model->id, 'label' => $model->suplier_name, 'value' => $model->suplier_name);
         }
         echo CJSON::encode($arModels);
     }
 }
 public function actionCeksuplier()
 {
     if (strpos($_GET['term'], "(") === false) {
         $condition = $_GET['term'];
         $criteria = new CDbCriteria();
         $criteria->condition = " suplier_name like '%{$condition}%'";
         $criteria->limit = 7;
         $info = Suplier::model()->findAll($criteria);
         $arModels = array();
         foreach ($info as $model) {
             $dataprice = ComponentSuplier::model()->findByAttributes(array('suplier_id' => $model->id, 'component_id' => intval($_GET['component_id'])));
             $price = $dataprice == null ? 0 : $dataprice->price;
             $arModels[] = array('id' => $model->id, 'address' => $model->address, 'price' => $price, 'label' => $model->suplier_name, 'value' => $model->suplier_name);
         }
         echo CJSON::encode($arModels);
     }
 }
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = Suplier::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Ejemplo n.º 4
0
<?php 
echo $form->textFieldGroup($model, 'hargabeli', array('widgetOptions' => array('htmlOptions' => array('class' => 'span5', 'maxlength' => 10))));
echo $form->textFieldGroup($model, 'hargajual', array('widgetOptions' => array('htmlOptions' => array('class' => 'span5', 'maxlength' => 10))));
?>

<?php 
//echo $form->textFieldGroup($model,'hargajual',array('widgetOptions'=>array('htmlOptions'=>array('class'=>'span5','maxlength'=>10))));
echo $form->datePickerGroup($model, 'tgl_kadaluarsa', array('widgetOptions' => array('options' => array('showButtonPanel' => true, 'format' => 'yyyy-mm-dd', 'viewformat' => 'yyyy-mm-dd', 'todayHighlight' => true, 'todayBtn' => "linked"), 'htmlOptions' => array('class' => 'span5')), 'prepend' => '<i class="glyphicon glyphicon-calendar"></i>', 'append' => 'Pilih Tanggal'));
?>

<?php 
echo $form->textFieldGroup($model2, 'no_faktur', array('widgetOptions' => array('htmlOptions' => array('class' => 'span5', 'maxlength' => 20))));
?>

<?php 
$nama = CHtml::listData(Suplier::model()->findAll(), 'nama_supplier', 'nama_supplier');
?>
    Distributor<br>
    <?php 
$this->widget('ext.select2.ESelect2', array('model' => $model2, 'attribute' => 'distributor', 'data' => $nama, 'htmlOptions' => array('style' => 'width:330px', 'prompt' => '-- Pilih Distributor --')));
?>

<div class="form-actions">
    <?php 
$this->widget('booster.widgets.TbButton', array('buttonType' => 'submit', 'context' => 'primary', 'label' => $model->isNewRecord ? 'Create' : 'Save'));
?>
</div>

<?php 
$this->endWidget();