public function loadModel($id)
 {
     $model = Osplan::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, Yii::t('app', 'The requested page does not exist.'));
     }
     return $model;
 }
Example #2
0
<div class="wide form">

<?php $form = $this->beginWidget('CActiveForm', array(
    'action' => Yii::app()->createUrl($this->route),
    'method' => 'get',
)); ?>

    <div class="row">
        <?php echo $form->label($model, 'idcarga'); ?>
        <?php echo $form->textFieldControlGroup($model,'idcarga',array('size'=>10,'maxlength'=>10)); ?>
    </div>

    <div class="row">
        <?php echo $form->label($model, 'idosplan'); ?>
        <?php echo $form->dropDownListControlGroup($model, 'idosplan0', CHtml::listData(Osplan::model()->findAll(array('order'=>'codplan')),'idosplan', 'codplan')); ?>
    </div>

    <div class="row">
        <?php echo $form->label($model, 'periodofacturacion'); ?>
        <?php echo $form->textFieldControlGroup($model,'periodofacturacion',array('size'=>7,'maxlength'=>7)); ?>
    </div>

    <div class="row">
        <?php echo $form->label($model, 'idprestaciontipo'); ?>
        <?php echo $form->dropDownListControlGroup($model, 'idprestaciontipo0', CHtml::listData(Prestaciontipo::model()->findAll(array('order'=>'nombre')),'idprestaciontipo', 'nombre')); ?>
    </div>

    <div class="row">
        <?php echo $form->label($model, 'idcargatipo'); ?>
        <?php echo $form->dropDownListControlGroup($model, 'idcargatipo0', CHtml::listData(Cargatipo::model()->findAll(array('order'=>'nombre')),'idcargatipo', 'nombre')); ?>
    </div>
Example #3
0
<?php

// solo si es un update
    if (!$model->isNewRecord){
         echo TbHtml::labelTb('Domicilio de entrega', array('color' => TbHtml::LABEL_COLOR_WARNING,'style'=>'margin-top:20px;font-size:13px;padding:5px;')); 
   
        echo "<div id='domient'>";
        
        //armar select con los domicilios de la os de facturacion y de los planes
         // ya existentes.
       $lista=Osplan::model()->GetDomiciliosEntrega($model);
       
       $lista[0]="Sin Domicilio";  // agregado para el select
       
       if($model->iddomicilio==null) $model->iddomicilio=0;
       
         echo  "<div class='control-group' style='margin:-27px 0 0 21px;'>";  
        echo $form->labelEx($model,'',array('class'=>'control-label'));
      
        echo $form->dropDownList($model, 'iddomicilio',$lista,array("selected"=>$model->iddomicilio));
//        echo $form->dropDownListControlGroup($model, 'iddomicilio',$lista,array("selected"=>$model->iddomicilio));       // arma el select
       echo "</div>";
        echo "</div>";
     //print_r($lista);
//       
//       
    // Muestra boton y se abre hacia abajo el formulario de ingreso 
    //de nuevo domicilio de entrega
    echo TbHtml::button("Agregar Nuevo Domicilio",array(
        "color"=> TbHtml::LABEL_COLOR_INFO,
        "style"=> "text-transform:capitalize; margin-top:-30px;margin-left:412px;font-size:13px;padding:3px;",
Example #4
0
<?php
echo $form->labelEx($model, 'idosplan', array('style' => 'display:inline;margin:0 5px 0 4px;'));
$this->widget('yiiwheels.widgets.select2.WhSelect2', array(
    'model' => $model,
    'attribute' => 'idosplan',
    'language' => 'es',
    
    'data' => CHtml::listData(Osplan::model()->findAll(array('order' => 'codplan')), 'idosplan', 'cuenta'),
    'htmlOptions' => array(
        'style' => 'width:220px;',
        'onclick'=>'js:{$("#Carga_idprestaciontipo").val("");return false;}', // Esto lo hago para que obligue a seleccionar el tipo de prestacion
        'onchange'=>'js:{$("#Carga_idprestaciontipo").removeAttr("disabled").focus();return false;}',
        'prompt' => '',  
       
    ),
));

    
//
if ($model->mostrarCampo('idprestaciontipo')){
        echo $form->labelEx($model, 'idprestaciontipo', array('style' => 'display:inline;margin:0 0 0 47px;'));

    echo $form->dropDownList($model, 'idprestaciontipo', CHtml::listData(Prestaciontipo::model()->findAll(array('order' => 'idprestaciontipo')), 'idprestaciontipo', 'nombrecompuesto'), array(
        'style'=>'width:135px;margin-left:3px; margin-right:5px;',
        'disabled'=>'disabled',
            'ajax' => array(
            'type' => 'POST', //request type
            'dataType' => 'html',
            'url' => CController::createUrl('carga/'.$accion), //url to call.
            'success'=> 'js:function(data){$("#form2").html(data);'
                    . '$("html, body").scrollTop(300); $(".carga_matricula").select2("open");return false;}',
Example #5
0
 public function actionDelete($id)
 {
     if (Yii::app()->request->isPostRequest) {
         try {
             $model = $this->loadModel($id);
             $idosplan = $model->idosplan;
             // analizar acreditacionplan
             // cargar modelo osplan
             $modelplan = Osplan::model()->findByPk($idosplan);
             // borrar
             if ($modelplan->idacreditacionosplan == Acreditacionosplan::NO_DISCRIMINA) {
                 Arancel::model()->deleteAll("mesanio ='{$model->mesanio}' AND idunidad={$model->idunidad} \n                                         AND idosplan={$model->idosplan}  ");
             } else {
                 $model->delete();
             }
             //                $this->loadModel($id)->delete();
         } catch (Exception $e) {
             throw new CHttpException(500, $e->getMessage());
         }
         if (!Yii::app()->getRequest()->getIsAjaxRequest()) {
             $this->redirect(array('index'));
         }
     } else {
         throw new CHttpException(400, Yii::t('app', 'Invalid request.'));
     }
 }