?> <h1> Despachos</h1> <?php echo CHtml::link('Advanced Search', '#', array('class' => 'search-button')); ?> <div class="search-form" style="display:none"> <?php $this->renderPartial('_search', array('model' => $model)); ?> </div><!-- search-form --> <?php $this->widget('ext.groupgridview.GroupGridView', array('id' => 'despacho-grid', 'dataProvider' => VwDespacho::model()->search_vigente(), 'cssFile' => Yii::app()->getTheme()->baseUrl . '/css/grilla_naranja.css', 'columns' => array('nombrepunto', 'codalmacen', 'codcentro', 'ap', 'am', 'cant', 'codart', 'desum', 'descripmaterial', 'numdocref', 'desdocu', 'numvale', 'movimiento', array('class' => 'CButtonColumn', 'buttons' => array('delete' => array('visible' => 'true', 'url' => '$this->grid->controller->createUrl("/despacho/cargadetalle", array("identi"=>$data->hidvale))', 'options' => array('ajax' => array('type' => 'GET', 'update' => '#zona', 'url' => 'js:$(this).attr("href")'), 'onClick' => 'Loading.show();Loading.hide(); '), 'imageUrl' => '' . Yii::app()->getTheme()->baseUrl . Yii::app()->params['rutatemaimagenes'] . 'hand_point.png', 'label' => 'Ver detalle')))))); ?> <div id="zona"></div> <?php /*$this->widget('zii.widgets.grid.CGridView', array( 'id'=>'despacho-grid', 'dataProvider'=>VwDespacho::model()->search(), 'filter'=>$model, 'columns'=>array( 'id', 'codcentro', 'codalmacen', 'fechacreac',
<?php $this->widget('zii.widgets.grid.CGridView', array('id' => 'despacho-grid', 'dataProvider' => VwDespacho::model()->search_por_vale($idvale), 'columns' => array('id', 'fechacreac', 'fechaprog', 'descripmaterial', 'codart', 'desum', 'cant', 'responsable', 'iduser', 'vigente')));
public function jaladespachototal($id, $idcabeza) { $matriz = VwDespacho::model()->findAll("hidvale=" . $id); foreach ($matriz as $fila) { $detalle = new Tempdetgui(); $detalle->valorespordefecto($this->documento); $detalle->hidespacho = $fila->id; $detalle->n_hguia = $idcabeza; $detalle->idusertemp = Yii::app()->user->id; $detalle->idstatus = 1; $detalle->iduser = Yii::app()->user->id; $detalle->codocu = $this->documentohijo; $detalle->iduser = Yii::app()->user->id; $detalle->c_codep = '100'; $detalle->c_um = $fila->um; $detalle->c_descri = $fila->descripmaterial; $detalle->c_edgui = '10'; $detalle->c_codgui = $fila->codart; $detalle->n_cangui = abs($fila->cant); $criterio = new CDbCriteria(); $criterio->condition = "n_hguia=:idguia and idusertemp= :usua"; $criterio->params = array(':idguia' => $idcabeza, ":usua" => yii::app()->user->id); $detalle->c_itguia = str_pad(Tempdetgui::model()->count($criterio) + 1, 3, "0", STR_PAD_LEFT); if (!$detalle->save()) { print_r($detalle->geterrors()); throw new CHttpException(500, 'No se pudo grabar '); } else { } unset($detalle); } }