public function run() { if (!is_null($this->nombrearea)) { $opcionesajax = array('type' => 'POST', 'url' => Yii::app()->createUrl('/Matchcode/relaciona1', array('campolargo' => $this->nombrecampoareemplazar, 'campo' => $this->nombrecampo, 'ordencampo' => $this->ordencampo, 'clasesita' => $this->nombreclase, 'contr' => $this->controlador . "")), 'replace' => '#' . $this->nombrearea); } else { $opcionesajax = array('type' => 'POST', 'url' => Yii::app()->createUrl('/Matchcode/relaciona'), 'replace' => '#Detgui_c_descri'); } echo "<div style='float: left; '>"; echo $this->form->textField($this->model, $this->nombrecampo, array('size' => $this->tamano, 'disabled' => $this->habilitado ? '' : 'disabled', 'ajax' => $opcionesajax)); echo " </div>"; if ($this->habilitado) { echo " <div style='float: left;'>"; echo CHtml::link(CHtml::image(Yii::app()->getTheme()->baseUrl . Yii::app()->params["rutatemaimagenes"] . "ayuda.png"), '#', array('onclick' => '$("#' . $this->nombreframe . '").attr( "src", "' . Yii::app()->createurl('/Matchcode/recibevalor1', array("campo" => $this->nombrecampo, "clasesita" => $this->nombreclase, "controlado" => $this->controlador)) . '"); $("#' . $this->nombredialogo . '").data("hilo","' . $this->controlador . '_' . $this->nombrecampo . '@' . $this->controlador . '_' . $this->nombrecampoareemplazar . '").dialog("open"); return false')); echo " </div>"; } echo " <div id ='" . $this->nombrearea . "' >"; //$formulario=$this->form; //echo $formulario->textField($this->model,$this->nombrecampoareemplazar,array('value'=> Yii::app()->explorador->buscavalor($this->nombrecampo,$this->model->{$this->nombrecampo},$this->ordencampo,$this->nombreclase))); if ($this->pintarcaja == 1) { //if ($this->model->isNewRecord) { //Yii::app()->explorador->buscavalor1($this->nombrecampoareemplazar,$this->controlador,$this->model->{$this->nombrecampo},$this->ordencampo,$this->nombreclase) ; //} // else { $formulario = $this->form; echo $formulario->textField($this->model, $this->nombrecampoareemplazar, array('value' => $this->model->{$this->nombrecampoareemplazar}, 'disabled' => $this->habilitado ? '' : 'disabled')); echo $formulario->error($this->model, $this->nombrecampoareemplazar); //if (1==1) { echo " <div >"; echo $formulario->labelEx($this->model, 'um'); $datos = CHtml::listData(Ums::model()->findAll(), 'um', 'desum'); echo $formulario->DropDownList($this->model, 'um', $datos, array('empty' => '--Unidad de medida--', 'disabled' => $this->habilitado ? '' : 'disabled')); echo $formulario->error($this->model, 'um'); echo "</div>"; // } // } } echo "</div>"; }
<?php if (!$model->isNewRecord) { echo $form->labelEx($model, 'estadodetalle'); echo CHtml::textField('hola', Estado::model()->find('codestado=:miestado and codocu=:midocumento', array(':midocumento' => '022', ':miestado' => $model->estadodetalle))->estado, array('id' => 'pepin', 'disabled' => 'disabled', 'size' => 20)); } ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'um'); ?> <?php $datos = CHtml::listData(Ums::model()->findAll(), 'um', 'desum'); echo $form->DropDownList($model, 'um', $datos, array('empty' => '--Unidad de medida--')); ?> <?php echo $form->error($model, 'um'); ?> </div> <div class="row"> <?php echo $model->isNewRecord ? $form->hiddenField($model, 'hidguia', array('value' => $idcabeza)) : ""; ?> </div>
/** * 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 $id the ID of the model to be loaded * @return Ums the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Ums::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public function actioncargaums() { $valor = $_POST['Maestroclipro']['codart']; $valores = Alconversiones::model()->findall("codart='" . $valor . "'"); $values = array(); $otro = ""; foreach ($valores as $registro) { $values[] = $registro['um2']; $otro = $registro['um1']; } array_push($values, $otro); $criteria = new CDbCriteria(); $criteria->addInCondition('um', $values); $data = CHtml::listData(Ums::model()->findAll($criteria), "um", "desum"); echo CHtml::tag('option', array('value' => null), CHtml::encode('Escoja una uM'), true); foreach ($data as $value => $name) { echo CHtml::tag('option', array('value' => $value), CHtml::encode($name), true); } }
public static function devuelveconversiones($codmaterial) { $datos = CHtml::listData(Ums::model()->findAll(), 'um', 'desum'); $modelomateriales = Maestrocompo::model()->findByPk(trim($codmaterial)); if (!is_null($modelomateriales)) { if ($unidad == $modelomateriales->um) { //se trata de la unidad de medida base return 1; } else { //hay conversiones $registro = self::model()->findAll("codart=:codigo and um2=:unitas", array(":codigo" => $codmaterial, ":unitas" => $unidad)); if (!is_null($registro)) { //efectuar la conversion return $registro->numerador / $registro->denominador; //Se tiene que multiplicar al revers } else { throw new CHttpException(404, ' No se encontraron conversiones para la unidad de medida especificada ' . $unidad . ' para este material : ' . $codmaterial); } } } else { throw new CHttpException(404, 'Error en conversiones de unidades, Este codigo de material no existe : ' . $codmaterial); } }