Example #1
0
 public function actionAdmin()
 {
     $model = new Ivas('search');
     $model->unsetAttributes();
     if (isset($_GET['Ivas'])) {
         $model->setAttributes($_GET['Ivas']);
     }
     $this->render('admin', array('model' => $model));
 }
 public function actionDelete($id)
 {
     if (Yii::app()->getRequest()->getIsPostRequest()) {
         $orden = $this->loadModel($id, 'OrdenTrabajo');
         $totalorden = $orden->sumita;
         $factura = $this->loadModel($orden->id_rf, 'RegistroFactura');
         if ($orden->delete()) {
             $iva = Ivas::model()->findBySql('SELECT valor_iva FROM ivas ORDER BY fecha DESC');
             $suma_bruto = $factura->sumarNeto() * ($iva['valor_iva'] / 100 + 1);
             $factura->setAttributes(array('total_neto' => $factura->sumarNeto(), 'total_bruto' => round($suma_bruto)));
             $factura->save();
             $presid = Presupuesto::model()->find('ano = :an ORDER BY modificado DESC', array(':an' => date("Y", strtotime($orden->fecha))));
             $presupuesto = $this->loadModel($presid->id, 'Presupuesto');
             $presupuesto->setAttributes(array('ppto_disponible' => $presupuesto->ppto_disponible + $totalorden));
             $presupuesto->save();
         }
         if (!Yii::app()->getRequest()->getIsAjaxRequest()) {
             $this->redirect(array('admin'));
         }
     } else {
         throw new CHttpException(400, Yii::t('app', 'Your request is invalid.'));
     }
 }
Example #3
0
<?php

$this->breadcrumbs = array(Ivas::label(2), Yii::t('app', 'Index'));
$this->menu = array(array('label' => Yii::t('app', 'Agregar') . ' ' . Ivas::label(), 'url' => array('create')), array('label' => Yii::t('app', 'Administrar') . ' ' . Ivas::label(2), 'url' => array('admin')));
?>

<h1><?php 
echo GxHtml::encode(Ivas::label(2));
?>
</h1>

<?php 
$this->widget('zii.widgets.CListView', array('dataProvider' => $dataProvider, 'emptyText' => 'No hay resultados', 'summaryText' => 'Mostrando del {start} al {end} de {count} resultado(s).', 'pager' => array('header' => '', 'prevPageLabel' => 'Anterior', 'nextPageLabel' => 'Siguiente'), 'itemView' => '_view'));
Example #4
0
		<?php 
echo $form->labelEx($model, 'neto');
?>
		<?php 
echo $form->textField($model, 'neto', array('onblur' => 'calcularIva(),calcularTotal();'));
?>
		<?php 
echo $form->error($model, 'neto');
?>
		</div><!-- row -->
		<div class="row">
		<?php 
echo $form->labelEx($model, 'iva');
?>
                <?php 
echo CHtml::hiddenField('hiva', Ivas::model()->findBySql('SELECT valor_iva FROM ivas ORDER BY fecha DESC'));
?>
		<?php 
echo $form->textField($model, 'iva');
?>
		<?php 
echo $form->error($model, 'iva');
?>
		</div><!-- row -->
		<div class="row">
		<?php 
echo $form->labelEx($model, 'especifico');
?>
		<?php 
echo $form->textField($model, 'especifico', array('onblur' => 'calcularTotal()'));
?>