public function actionReportgeneral()
 {
     $modelgeneral = Up::model();
     if (isset($_POST['Up'])) {
         $modelgeneral->attributes = $_POST['Up'];
         $this->render('reportGeneral', array('model' => $modelgeneral, 'idCod' => $modelgeneral->COD, 'fecha' => 2013, 'excel' => 0, 'pdf' => 0));
     } else {
         $this->render('reportGeneral', array('model' => $modelgeneral, 'idCod' => 0, 'fecha' => 2013, 'excel' => 0, 'pdf' => 0));
     }
 }
Exemple #2
0
	'enableAjaxValidation'=>false,
)); ?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php echo $form->errorSummary($model); ?>

	<div class="row">
		<?php echo $form->labelEx($model,'CED'); ?>
		<?php echo $form->dropDownList($model,'CED', CHtml::listData(Pers::model()->findAll(), 'CED', 'NOM'),array('empty' => ' Seleccione la persona')); ?>
		<?php echo $form->error($model,'CED'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'COD'); ?>
		<?php echo $form->dropDownList($model,'COD', CHtml::listData(Up::model()->findAll(array('condition'=>'REGION="CHOROTEGA"')), 'COD', 'DES'),array('empty' => ' Seleccione la U.P.')); ?>
		<?php echo $form->error($model,'COD'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'CODT'); ?>
		<?php echo $form->dropDownList($model,"CODT", CHtml::listData(Tipos::model()->findAll(array('condition'=>'tipo="Perfil Plaza"')), 'CODT', 'DES'), array('empty'=>' Seleccione programa de atención')); ?>
		<?php echo $form->error($model,'CODT'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'POB'); ?>
		<?php echo $form->textField($model,'POB'); ?>
		<?php echo $form->error($model,'POB'); ?>
	</div>
 /**
  * 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 Upje the loaded model
  * @throws CHttpException
  */
 public function loadModelUp($idup)
 {
     $modelUp = Up::model()->findByPk($idup);
     if ($modelUp === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $modelUp;
 }
 /**
  * Deletes a particular model.
  * If deletion is successful, the browser will be redirected to the 'admin' page.
  * @param integer $id the ID of the model to be deleted
  */
 public function actionDelete($id)
 {
     if (Yii::app()->request->isPostRequest) {
         // we only allow deletion via POST request
         $model = $this->loadModel($id);
         $lastUp = Up::model()->find(array('order' => 'id DESC'));
         if ($model->up_number_of_letter != $lastUp->number_of_letter) {
             Yii::app()->user->setFlash('error', 'Sudah ada UP baru. Detail gagal dihapus.');
         } else {
             $up = Up::model()->findByAttributes(array('number_of_letter' => $model->up_number_of_letter));
             $realization = $model->getTotalDetail($model->package_code, $model->up_number_of_letter)["realization"];
             if ($realization != 0) {
                 Yii::app()->user->setFlash('error', 'Tidak dapat menghapus detail yang sudah direalisasi');
                 $this->redirect(array('../up/view', 'id' => $up->id));
             }
             $model->delete();
         }
         // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
         if (!isset($_GET['ajax'])) {
             $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));
         }
     } else {
         throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.');
     }
 }
Exemple #5
0
 public function getUpOptions()
 {
     $models = Up::model()->findAll();
     $options = array();
     foreach ($models as $model) {
         $subcomponent = Subcomponent::model()->findByAttributes(array('code' => $model->number_of_letter));
         $options[$model->number_of_letter] = "{$model->number_of_letter}";
     }
     return $options;
 }
<?php

$this->breadcrumbs = array('Up Details' => array('index'), 'Manage');
$this->menu = array(array('label' => 'List UpDetail', 'url' => array('index')), array('label' => 'Create UpDetail', '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('up-detail-grid', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
?>

<?php 
$this->widget('bootstrap.widgets.TbGridView', array('id' => 'up-detail-grid', 'dataProvider' => $model->search(), 'columns' => array(array('header' => 'No', 'value' => '$this->grid->dataProvider->pagination->currentPage * $this->grid->dataProvider->pagination->pageSize + ($row+1)'), array('name' => 'up_number_of_letter', 'value' => '$data->up_number_of_letter', 'filter' => Up::model()->getUpOptions()), 'package_code', array('name' => 'limit', 'value' => 'Yii::app()->format->number($data->limit)'), array("name" => "realization", "value" => 'Yii::app()->format->number($data->getTotalDetail($data->package_code,$data->up_number_of_letter)["realization"])', 'htmlOptions' => array('style' => 'text-align: right;'), 'filter' => FALSE), array("name" => "restUp", "value" => 'Yii::app()->format->number($data->getTotalDetail($data->package_code,$data->up_number_of_letter)["restUp"])', 'htmlOptions' => array('style' => 'text-align: right;'), 'filter' => FALSE), array('name' => 'rateUpUsing', 'type' => 'raw', 'filter' => FALSE, 'value' => function ($data) {
    $rate = $data->getTotalDetail($data->package_code, $data->up_number_of_letter)['rateUpUsing'];
    return "<div class='slider' data-progress='{$rate}'><span></span><label></label></div>";
}), array('class' => 'bootstrap.widgets.TbButtonColumn'))));