Example #1
0
<div class="wide form">

<?php 
$form = $this->beginWidget('CActiveForm', array('id' => 'detgui-form', 'enableClientValidation' => false, 'clientOptions' => array('validateOnSubmit' => true, 'validateOnChange' => true), 'enableAjaxValidation' => true));
?>

<?php 
echo $form->errorSummary($model);
?>
	<div class="row">
		<?php 
echo $form->labelEx($model, 'idpadre');
?>
		<?php 
//$criteria=""
$datos = CHtml::listData(Dcotmateriales::model()->findAll("hidguia=:idcabeza  and estadodetalle <>'07' ", array(":idcabeza" => $model->isNewRecord ? $idcabeza : $model->hidguia)), 'id', 'descri');
echo $form->DropDownList($model, 'idpadre', $datos, array('empty' => '--Escoja el item superior--'));
?>
		<?php 
echo $form->error($model, 'idpadre');
?>
	</div>


	<div class="row">
		<?php 
echo $form->labelEx($model, 'tipo');
?>
		<?php 
//$criteria=""
$datos = CHtml::listData(Dcottipo::model()->findAll(), 'codtipo', 'destipo');
 /**
  * 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 Dcotmateriales the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Dcotmateriales::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Example #3
0
 public function actionCreadetalle($idcabeza, $cest)
 {
     //VERIFICADO PRIMERO SI ES POSIBLE AGREGAR MAS ITEMS
     if ($cest == '01' or $cest == '99') {
         $model = new Dcotmateriales();
         $model->valorespordefecto();
         // Uncomment the following line if AJAX validation is needed
         $this->performAjaxValidation1($model);
         if (isset($_POST['Dcotmateriales'])) {
             $model->attributes = $_POST['Dcotmateriales'];
             //$model->codocu='024'; ///detalle COTIZACION
             //crietria para filtrar la cantidad de items del detalle
             $criterio = new CDbCriteria();
             $criterio->condition = "hidguia=:nguia  ";
             $criterio->params = array(':nguia' => $idcabeza);
             $model->item = str_pad(Dcotmateriales::model()->count($criterio) + 1, 3, "0", STR_PAD_LEFT);
             //str_pad($somevariable,$anchocampo,"0",STR_PAD_LEFT);
             ////con esto calculamos el numero de items
             if ($model->save()) {
                 if (!empty($_GET['asDialog'])) {
                     //Close the dialog, reset the iframe and update the grid
                     echo CHtml::script("window.parent.\$('#cru-dialogdetalle').dialog('close');\n\t\t\t\t\t\t\t\t\t\t\t\t\t                    window.parent.\$('#cru-detalle').attr('src','');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\twindow.parent.\$.fn.yiiGridView.update('detalle-grid');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\twindow.parent.\$.fn.yiiGridView.update('resumen-grid');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t");
                     Yii::app()->end();
                 }
             }
             //$this->redirect(array('view','id'=>$model->n_guia));
         }
         if (!empty($_GET['asDialog'])) {
             $this->layout = '//layouts/iframe';
         }
         $this->render('_form_detalle', array('model' => $model, 'idcabeza' => $idcabeza));
     } else {
         //si ya cambio el estado impisble agregar mas items
         if (!empty($_GET['asDialog'])) {
             $this->layout = '//layouts/iframe';
         }
         $this->render('vw_imposible', array());
     }
 }
Example #4
0

<?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'dcotmateriales-grid', 'dataProvider' => Dcotmateriales::model()->search_($idcoti), 'filter' => $model, 'columns' => array('id', 'numcot', 'codart', 'disp', 'cant', 'punit', array('class' => 'CButtonColumn'))));
Example #5
0

<?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'detalle-grid', 'dataProvider' => Dcotmateriales::model()->search_($filtro), 'columns' => array(array('class' => 'CCheckBoxColumn', 'selectableRows' => 20, 'value' => '$data->id', 'checkBoxHtmlOptions' => array('name' => 'cajita[]')), array('name' => 'st.', 'header' => 'st', 'type' => 'raw', 'value' => 'CHtml::image(Yii::app()->getTheme()->baseUrl.Yii::app()->params["rutatemaimagenes"].trim($data->coddocu).trim($data->estadodetalle).".png")'), 'item', 'cant', 'um', 'codart', 'descri', array('name' => 'texto', 'type' => 'raw', 'header' => 't', 'value' => '(!empty($data->detalle))?CHtml::image(Yii::app()->getTheme()->baseUrl.Yii::app()->params["rutatemaimagenes"]."texto.png","hola"):""'), 'disp', 'punit', array('name' => 'potal', 'header' => 'P. to', 'value' => '$data->punit*$data->cant'), array('class' => 'CButtonColumn', 'buttons' => array('view' => array('visible' => 'false'), 'update' => array('visible' => $eseditable ? 'false' : 'true', 'url' => '$this->grid->controller->createUrl("/coti/Modificadetalle/",
										    array("id"=>$data->id,
                                                                                         "asDialog"=>1,
											"gridId"=>$this->grid->id
											)
									    )', 'click' => 'function(){ 
							    $("#cru-detalle").attr("src",$(this).attr("href")); 
							    $("#cru-dialogdetalle").dialog("open");  
							     return false;
							 }', 'imageUrl' => '' . Yii::app()->getTheme()->baseUrl . Yii::app()->params['rutatemagrid'] . 'update.png', 'label' => 'Actualizar Item'), 'delete' => array('visible' => 'false'))))));