public function getMenuTipoDeProductos() { return CHtml::listData(Tipoproducto::model()->findAll(), "id", "descripcion"); }
<?php /* @var $this ProductoController */ /* @var $model Producto */ $this->breadcrumbs = array('Productos' => array('index'), 'Administrar'); $this->menu = array(array('label' => 'Listar', 'url' => array('index')), array('label' => 'Crear', 'url' => array('create')), array('label' => 'MENU', 'url' => array('Menup/index'))); Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$('#producto-grid').yiiGridView('update', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n"); ?> <h1>Administrar Productos</h1> <?php $this->widget('zii.widgets.grid.CGridView', array('id' => 'producto-grid', 'itemsCssClass' => 'table table-striped', 'pager' => array('htmlOptions' => array('class' => 'pagination')), 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array(array('name' => 'id', 'htmlOptions' => array('width' => '30')), 'nombre', array('name' => 'descripcion', 'htmlOptions' => array('width' => '120')), array('name' => 'tipoproducto_id', 'value' => '$data->tipoproducto->descripcion', 'header' => 'Tipo de producto', 'htmlOptions' => array('width' => '150'), 'filter' => CHtml::listData(Tipoproducto::model()->findAll(), 'id', 'descripcion')), array('name' => 'stockminimo', 'htmlOptions' => array('width' => '40')), array('name' => 'stockmaximo', 'htmlOptions' => array('width' => '40')), array('name' => 'proveedor_id', 'value' => '$data->proveedor->razonsocial', 'header' => 'Proveedor', 'htmlOptions' => array('width' => '150'), 'filter' => CHtml::listData(Proveedor::model()->findAll(), 'id', 'razonsocial')), array('class' => 'CButtonColumn'))));
<?php /* @var $this DetallepedidocompraController */ /* @var $model Detallepedidocompra */ $this->breadcrumbs = array('Detallepedidocompras' => array('index'), 'Administrar'); $this->menu = array(array('label' => 'Listar', 'url' => array('index')), array('label' => 'Crear', 'url' => array('create')), array('label' => 'MENU', 'url' => array('Menup/index'))); Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$('#detallepedidocompra-grid').yiiGridView('update', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n"); ?> <h1>Administrar Detalle pedido compras</h1> <?php /* * <p> * También puede escribir un operador de comparación (<b><</b>, <b><=</b>, <b>></b>, <b>>=</b>, <b><></b> * o <b>=</b>) al principio de cada uno de los valores de búsqueda para especificar cómo se debe hacer la comparación. * </p> * * <?php echo CHtml::link('Busqueda Avanzada','#',array('class'=>'search-button')); ?> * <div class="search-form" style="display:none"> * <?php $this->renderPartial('_search',array( * 'model'=>$model, * )); ?> * </div><!-- search-form --> */ ?> <?php $this->widget('zii.widgets.grid.CGridView', array('id' => 'detallepedidocompra-grid', 'itemsCssClass' => 'table table-striped', 'pager' => array('htmlOptions' => array('class' => 'pagination')), 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array('id', array('name' => 'producto_id', 'value' => '$data->tipoproducto->descripcion', 'header' => 'Tipo de producto', 'filter' => CHtml::listData(Tipoproducto::model()->findAll(), 'id', 'descripcion')), 'cantidad', array('name' => 'fechacreacion', 'value' => 'date_format(new DateTime($data->fechacreacion),"d/m/Y")'), array('name' => 'fechamodificacion', 'value' => 'date_format(new DateTime($data->fechamodificacion),"d/m/Y")'), array('class' => 'CButtonColumn'))));
/** * 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 Tipoproducto the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Tipoproducto::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }