コード例 #1
0
 public function actionACCombustibles()
 {
     if (isset($_GET['term'])) {
         $searchTerm = $_GET['term'];
         $result = array();
         $combustibles = Combustibles::model()->findAll('nombre LIKE :nombre', array(':nombre' => '%' . $searchTerm . '%'));
         foreach ($combustibles as $combustible) {
             $result[] = array('label' => $combustible->nombre, 'value' => $combustible->nombre, 'id' => $combustible->id);
         }
         echo CJSON::encode($result);
     }
 }
コード例 #2
0
ファイル: admin.php プロジェクト: dev-lav/htdocs
<?php

$this->breadcrumbs = array($model->label(2) => array('index'), Yii::t('app', 'Administrar'));
$this->menu = array(array('label' => Yii::t('app', 'Listar') . ' ' . $model->label(2), 'url' => array('index')), array('label' => Yii::t('app', 'Agregar') . ' ' . $model->label(), 'url' => array('create')));
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\$.fn.yiiGridView.update('factura-combustible-grid', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
?>

<h1><?php 
echo Yii::t('app', 'Administrar') . ' ' . GxHtml::encode($model->label(2));
?>
</h1>

<?php 
echo GxHtml::link(Yii::t('app', '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' => 'factura-combustible-grid', 'dataProvider' => $model->search(), 'emptyText' => 'No hay resultados', 'summaryText' => 'Mostrando del {start} al {end} de {count} resultado(s).', 'pager' => array('header' => '', 'prevPageLabel' => 'Anterior', 'nextPageLabel' => 'Siguiente'), 'filter' => $model, 'columns' => array('nro_factura', 'fecha', array('name' => 'id_combustible', 'value' => 'GxHtml::valueEx($data->idCombustible)', 'filter' => GxHtml::listDataEx(Combustibles::model()->findAllAttributes(null, true))), 'neto', 'iva', 'litros', 'total', array('class' => 'CButtonColumn', 'header' => 'Opciones', 'htmlOptions' => array('width' => 120), 'template' => '{view}{update}{delete}', 'buttons' => array('view' => array('label' => 'Ver', 'url' => 'Yii::app()->createUrl("facturacombustible/view", array("id"=>$data->id))', 'imageUrl' => Yii::app()->baseUrl . '/images/ver.png'), 'update' => array('label' => 'Editar', 'url' => 'Yii::app()->createUrl("facturacombustible/update", array("id"=>$data->id))', 'imageUrl' => Yii::app()->baseUrl . '/images/editar.png'), 'delete' => array('label' => 'Borrar', 'url' => 'Yii::app()->createUrl("facturacombustible/delete", array("id"=>$data->id))', 'imageUrl' => Yii::app()->baseUrl . '/images/delete.png'))))));
コード例 #3
0
ファイル: _search.php プロジェクト: dev-lav/htdocs
<div class="wide form">

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

	<div class="row">
		<?php 
echo $form->label($model, 'idCombustible');
?>
		<?php 
echo $form->dropDownList($model, 'idCombustible', GxHtml::listDataEx(Combustibles::model()->findAllAttributes(null, true)), array('prompt' => Yii::t('app', 'All')));
?>
	</div>

	<div class="row">
		<?php 
echo $form->label($model, 'idTipoVehiculo');
?>
		<?php 
echo $form->dropDownList($model, 'idTipoVehiculo', GxHtml::listDataEx(TiposVehiculos::model()->findAllAttributes(null, true)), array('prompt' => Yii::t('app', 'All')));
?>
	</div>

	<div class="row">
		<?php 
echo $form->label($model, 'idProveedor');
?>
		<?php 
echo $form->dropDownList($model, 'idProveedor', GxHtml::listDataEx(Proveedores::model()->findAllAttributes(null, true)), array('prompt' => Yii::t('app', 'All')));
?>
コード例 #4
0
ファイル: _form.php プロジェクト: dev-lav/htdocs
		<?php 
echo $form->labelEx($model, 'fecha');
?>
		<?php 
$form->widget('zii.widgets.jui.CJuiDatePicker', array('model' => $model, 'attribute' => 'fecha', 'language' => 'es', 'value' => $model->fecha, 'options' => array('showButtonPanel' => true, 'changeYear' => true, 'dateFormat' => 'yy-mm-dd')));
?>
		<?php 
echo $form->error($model, 'fecha');
?>
		</div><!-- row -->
		<div class="row">
		<?php 
echo $form->labelEx($model, 'id_combustible');
?>
		<?php 
echo $form->dropDownList($model, 'id_combustible', GxHtml::listDataEx(Combustibles::model()->findAllAttributes(null, true)));
?>
		<?php 
echo $form->error($model, 'id_combustible');
?>
		</div><!-- row -->
		<div class="row">
		<?php 
echo $form->labelEx($model, 'neto');
?>
		<?php 
echo $form->textField($model, 'neto', array('onblur' => 'calcularIva(),calcularTotal();'));
?>
		<?php 
echo $form->error($model, 'neto');
?>