/** * Returns the static model of the specified AR class. * Please note that you should have this exact method in all your CActiveRecord descendants! * @param string $className active record class name. * @return Entidad the static model class */ public static function model($className = __CLASS__) { return parent::model($className); }
'method' => 'get', )); ?> <div class="row"> <?php echo $form->label($model, 'idparticipacion'); ?> <?php echo $form->textFieldControlGroup($model,'idparticipacion'); ?> </div> <div class="row"> <?php echo $form->label($model, 'idsociedad'); ?> <?php echo $form->dropDownListControlGroup($model, 'idsociedad0', CHtml::listData(Entidad::model()->findAll(array('order'=>'matricula')),'identidad', 'matricula')); ?> </div> <div class="row"> <?php echo $form->label($model, 'idsocio'); ?> <?php echo $form->dropDownListControlGroup($model, 'idsocio0', CHtml::listData(Entidad::model()->findAll(array('order'=>'matricula')),'identidad', 'matricula')); ?> </div> <div class="row"> <?php echo $form->label($model, 'participacion'); ?> <?php echo $form->textFieldControlGroup($model,'participacion',array('size'=>6,'maxlength'=>6)); ?> </div> <div class="row"> <?php echo $form->label($model, 'porcjubil'); ?> <?php echo $form->textFieldControlGroup($model,'porcjubil',array('size'=>6,'maxlength'=>6)); ?> </div> <div class="row buttons"> <?php echo CHtml::submitButton(Yii::t('app', 'Search')); ?> </div>
public function loadModel($id) { $model = Entidad::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, Yii::t('app', 'The requested page does not exist.')); } return $model; }
<?php if ($model->mostrarCampo('iddomicilio')) { echo "<div class='control-group'>"; echo $form->labelEx($model, 'matricula', array('class' => 'control-label')); echo "<div class='controls'>"; $this->widget('yiiwheels.widgets.select2.WhSelect2', array( 'model' => $model, 'attribute' => 'matricula', 'language' => 'es', 'data' => CHtml::listData(Entidad::model()->findAll(array('order' => 'nombre')), 'matricula', 'nombrecomp'), 'htmlOptions' => array( 'style' => 'width:280px', 'class'=>'carga_matricula', 'id'=>rand(0,1000), // es importante, porque al recargarla por 'ajax' => array( // ajax mas de una vez, se genera codigo repetido 'type' => 'POST', // por eso hay que identificar 'dataType' => 'html', 'data' => array('matricula' => 'js:this.value'), 'url' => CController::createUrl('entidad/domicilios'), //url to call. 'success'=> 'js:function(data){$("#domicilio-div").html(data).focus();return false;}', ), 'prompt' => '' ), )); echo "</div></div>"; if (isset($model->iddomicilio)) { $domicilios = Domicilio::model()->findAllByAttributes(array('identidad' => $model->iddomicilio0->identidad), array('order' => 'calle')); } else { $domicilios = array(); }
<?php echo $form->dropDownListControlGroup($model, 'idsexo0', CHtml::listData(Sexo::model()->findAll(array('order'=>'nombre')),'idsexo', 'nombre'), array('prompt' => 'No corresponde')); ?> </div> <div class="row"> <?php echo $form->label($model, 'iddocumentotipo'); ?> <?php echo $form->dropDownListControlGroup($model, 'iddocumentotipo0', CHtml::listData(Documentotipo::model()->findAll(array('order'=>'nombre')),'iddocumentotipo', 'nombre'), array('prompt' => 'No corresponde')); ?> </div> <div class="row"> <?php echo $form->label($model, 'idestadocivil'); ?> <?php echo $form->dropDownListControlGroup($model, 'idestadocivil0', CHtml::listData(Estadocivil::model()->findAll(array('order'=>'nombre')),'idestadocivil', 'nombre'), array('prompt' => 'No corresponde')); ?> </div> <div class="row"> <?php echo $form->label($model, 'idconyuge'); ?> <?php echo $form->dropDownListControlGroup($model, 'idconyuge0', CHtml::listData(Entidad::model()->findAll(array('order'=>'matricula')),'identidad', 'matricula'), array('prompt' => 'No corresponde')); ?> </div> <div class="row"> <?php echo $form->label($model, 'adhesioncategoria'); ?> <?php echo "<div class='control-group'>"; echo $form->labelEx($model,'adhesioncategoria',array('class'=>'control-label')); echo "<div class='controls'>"; $this->widget('CJuiDateTimePicker', array( 'model'=>$model, 'name'=>'Entidad[adhesioncategoria]', 'language'=> 'es', 'value'=>$model->isNewRecord? date('d/m/Y'):$model->adhesioncategoria,
'summaryText'=>false, 'columns' => array( array( 'name' => 'idparticipacion', 'value' => 'isset($data->idparticipacion)?$data->idparticipacion:""', 'filter' => false, ), array( 'name' => 'idsociedad', 'value' => 'isset($data->idsociedad0->matricula)?$data->idsociedad0->matricula:""', 'filter' => CHtml::listData(Entidad::model()->findAll(array('order'=>'matricula')),'identidad','matricula'), ), array( 'name' => 'idsocio', 'value' => 'isset($data->idsocio0->matricula)?$data->idsocio0->matricula:""', 'filter' => CHtml::listData(Entidad::model()->findAll(array('order'=>'matricula')),'identidad','matricula'), ), array( 'name' => 'participacion', 'value' => 'isset($data->participacion)?$data->participacion:""', 'filter' => false, ), array( 'name' => 'porcjubil', 'value' => 'isset($data->porcjubil)?$data->porcjubil:""', 'filter' => false, ), array( 'class' => 'CButtonColumn', 'viewButtonImageUrl' => Yii::app()->baseUrl . '/css/gridviewstyle/images/' . 'gr-view.png', 'updateButtonImageUrl' => Yii::app()->baseUrl . '/css/gridviewstyle/images/' . 'gr-update.png',
public function actionCapturar2() { if (Yii::app()->request->isAjaxRequest) { if (isset($_POST['nrotransac'])) { Yii::app()->clientScript->scriptMap = array('jquery.js' => false, 'jquery-ui.min.js' => false, 'jquery-ui-i18n.min.js' => false, 'select2.js' => false, 'bootstrap.js' => false, 'select2_locale_es.js' => false); $model = new Carga(); $model->setAttributes($_POST['Carga']); // nro de transaccion recibida $nrotransac = $_POST['nrotransac']; $transacheader = new Transacheader(); $codigocarga = array(); // buscar header de esa transaccion try { $header = $transacheader->findByAttributes(array('transac' => $nrotransac)); // no existe la transaccion if (!$header) { throw new Exception("No existe la transacción"); } // si existe transaccion: $idltransac = $header->idl; $profesional = false; $errordeprof = false; if (isset($idltransac)) { // buscar con la idl en tabla domicilio la identidad del profesional if ($dom = Domicilio::model()->findByAttributes(array('idl' => $idltransac))) { $identidad = $dom->identidad; $domicilio = $dom->iddomicilio; $profesional = Entidad::model()->findByPk($identidad)->getNombrecomp(); if ($domicilio != $model->iddomicilio) { $errordeprof = true; } } } // buscar practicas para esa transaccion // se usa la relacion, y $ practicas es un arreglo con // todos los registros de practicas para ese haeader $practicas = $header->transacpracticas; // obtener codigo practicas, recorriendo arreglo $practicas foreach ($practicas as $key => $value) { $codigocarga[] = $value['codigo']; } // completar arreglo para la grilla $codigocarga = array_pad($codigocarga, Carga::MAX_PRACTICAS_BOLETA, false); } catch (Exception $e) { // mostrar error $this->renderPartial('_error', array('message' => $e->getMessage()), false, true); Yii::app()->end(); } // si se encuentra la transaccion, sigue ejecutando el codigo. // se muestran el header y practicas o // se captura la transaccion y se graban las tablas // de carga // // switch (isset($_POST['save'])) { // si save es falso,solo mostrar datos de la transaccion , no grabarla case false: if ($errordeprof) { $this->renderPartial('_error', array('message' => "Matrícula: " . $profesional), false, true); } else { $this->renderPartial('_success', array('message' => "Matrícula: " . $profesional), false, true); } // mostrar header $this->renderPartial('//transacheader/view', array('model' => $header), false, true); // mostrar grilla practicas $this->renderPartial('//carga/_grillapracticas', array('codigocarga' => $codigocarga, 'accion' => 'captura'), false, true); // botones del formulario $this->renderPartial('_formbotones', array(), false, true); break; // save es true, entonces grabar // save es true, entonces grabar case true: try { //grabar transaccion: si la funcion retorna falso, no grabó $this->grabartransaccion($nrotransac, $header, $codigocarga, $model); // si grabo, vuelve a pedir nrotransac y muestra mensaje de grabado ok // mostrar campo entrada nrotransac despues de grabar transaccion $this->renderPartial('_nrotransac', array('nrotransac' => $nrotransac), false, true); // mostrar mensaje grabado ok $this->renderPartial('_success', array('message' => 'Grabado Ok'), false, true); } catch (Exception $e) { $this->renderPartial('_nrotransac', array('nrotransac' => $nrotransac), false, true); // mostrar error $this->renderPartial('_error', array('message' => $e->getMessage()), false, true); } break; } //endswitch; } } }
public function controlEmbargos($archivo) { // Traigo las entidades para comparar / actualizar $gb = new Globalmodel(); $filtro = $gb->filtroActivoProfesional($this->filtroActivos); $models = Entidad::model()->findAll(array('condition' => $filtro)); // Pregunto si hay cuits para actualizar if (count($models) == 0) { // Duermo el proceso para que muestre la ventana modal de procesando sleep(1); throw new Exception("No existen entidades para comparar/actualizar"); } // $cuits = array(); // Proceso el archivo por posición $filas = file($archivo); // Validacion del archivo de embargos if (!is_numeric(trim(substr($filas[0], 0, 32)))) { throw new Exception("No es el padron de embargos"); } $arrepadron = array(); for ($i = 0; $i < count($filas); $i++) { $cuit = trim(substr($filas[$i], 8, 11)); $embargo = round(trim(substr($filas[$i], 19, 13)) / 100, 2); if ($embargo <= 0) { throw new Exception("Monto embargo incorrecto en linea {$i}"); } $cuits[$i] = $cuit; // para buscar por cuit en el padron array_push($arrepadron, array($cuit, $embargo)); // Arreglo con todos los datos } $resultado = $this->procesarEmbargos($models, $arrepadron, $cuits); $areproceso = $this->areprocesar($resultado); $intento = 1; while (count($areproceso) > 0 && $intento < $this->reproceso) { $resultado_reproceso = $this->procesarEmbargos($areproceso, $arrepadron, $cuits); $areproceso = $this->areprocesar($resultado_reproceso); $intento++; // Si pudo reprocesar y tiene diferencias se debe mostrar // por eso lo agrego al arreglo de resultados if (count($resultado_reproceso) > 0) { $resultado = array_merge($resultado, $resultado_reproceso); } } $proceso = "Proceso " . $this->nombre; if (count($resultado) > 0) { $this->resultado = "Proceso finalizado con diferencias"; } else { $this->resultado = "{$proceso} finalizado correctamente"; } return $resultado; }