public function actionPpkComponentChart($id, $ppkId)
 {
     $suboutput = Suboutput::model()->findByPk($id);
     $ppk = Ppk::model()->findByPk($ppkId);
     $packageAccounts = PackageAccount::model()->findAllByAttributes(array('suboutput_code' => "{$suboutput->code}", 'ppk_code' => "{$ppk->code}"));
     $componentLists = array();
     if ($packageAccounts) {
         foreach ($packageAccounts as $packageAccount) {
             $component = $packageAccount->component->name;
             if (!in_array($component, $componentLists, true)) {
                 array_push($componentLists, $component);
             }
         }
     }
     $componentIdLists = array();
     if ($packageAccounts) {
         foreach ($packageAccounts as $packageAccount) {
             $componentId = $packageAccount->component->id;
             if (!in_array($componentId, $componentIdLists, true)) {
                 array_push($componentIdLists, $componentId);
             }
         }
     }
     $componentCodes = array();
     if ($packageAccounts) {
         foreach ($packageAccounts as $packageAccount) {
             $code = $packageAccount->component_code;
             if (!in_array($code, $componentCodes, true)) {
                 array_push($componentCodes, $code);
             }
         }
     }
     $limits = array();
     for ($i = 0; $i < count($componentLists); $i++) {
         $accounts = PackageAccount::model()->findAllByAttributes(array('component_code' => $componentCodes[$i], 'ppk_code' => $ppk->code));
         $limit = 0;
         if ($accounts) {
             foreach ($accounts as $account) {
                 $limit += $account->limit;
             }
             array_push($limits, $limit);
         }
     }
     $realizations = array();
     for ($i = 0; $i < count($componentLists); $i++) {
         $accounts = PackageAccount::model()->findAllByAttributes(array('component_code' => $componentCodes[$i], 'ppk_code' => $ppk->code));
         $realization = 0;
         if ($accounts) {
             foreach ($accounts as $account) {
                 $realization += $account->getTotal($account->code)['realization'];
             }
             array_push($realizations, $realization);
         }
     }
     $rests = array();
     for ($i = 0; $i < count($componentLists); $i++) {
         $accounts = PackageAccount::model()->findAllByAttributes(array('component_code' => $componentCodes[$i], 'ppk_code' => $ppk->code));
         $rest = 0;
         if ($accounts) {
             foreach ($accounts as $account) {
                 $rest += $account->getTotal($account->code)['restMoney'];
             }
             array_push($rests, $rest);
         }
     }
     $rates = array();
     for ($i = 0; $i < count($componentLists); $i++) {
         $accounts = PackageAccount::model()->findAllByAttributes(array('component_code' => $componentCodes[$i], 'ppk_code' => $ppk->code));
         $realization = 0;
         $limit = 0;
         if ($accounts) {
             foreach ($accounts as $account) {
                 $realization += $account->getTotal($account->code)['realization'];
                 $limit += $account->limit;
             }
             $rate = $realization / $limit;
             array_push($rates, $rate);
         } else {
             array_push($rates, 0);
         }
     }
     $this->render('ppkComponentChart', array('ppk' => $ppk, 'componentLists' => $componentLists, 'id' => $componentIdLists, 'limits' => $limits, 'realizations' => $realizations, 'rests' => $rests, 'rates' => $rates));
 }
예제 #2
0
 public function getSuboutputOptions()
 {
     $models = Suboutput::model()->findAll();
     $options = array();
     foreach ($models as $model) {
         $options[$model->code] = "[{$model->code}] | {$model->name}";
     }
     return $options;
 }
 /**
  * Export Data to Excel
  */
 public function actionExport()
 {
     /** Get model */
     $models = Suboutput::model()->findAll();
     /** Error reporting */
     $this->excelErrorReport();
     /** PHPExcel_IOFactory */
     $objReader = new PHPExcel();
     $objReader = PHPExcel_IOFactory::createReader('Excel2007');
     $path = Yii::app()->basePath . '/../export/suboutput.xlsx';
     $pathExport = Yii::app()->basePath . '/../files/Master Suboutput.xlsx';
     $objPHPExcel = $objReader->load($path);
     $objPHPExcel->setActiveSheetIndex(0);
     /* " Add new data to template" */
     $this->exportExcel($objPHPExcel, $models);
     /** Export to excel* */
     $this->excel($objPHPExcel, $pathExport);
     readfile($pathExport);
     unlink($pathExport);
     exit;
 }
예제 #4
0
        <?php 
echo $form->fileFieldRow($model, 'file', array('class' => 'span5', 'maxlength' => 256, 'labelOptions' => array('label' => false)));
?>
        <p>File excel yang digunakan adalah file d_kmpnen yang sudah difilter jumlah barisnya</p>

        <div class="form-actions">
            <?php 
$this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'type' => 'primary', 'label' => 'Import'));
?>
        </div>
        <?php 
$this->endWidget();
?>
    </div>

    <div class="panel-header">
        <a href="<?php 
echo yii::app()->baseUrl;
?>
/component/exportError" class="btn btn-primary"><i class="fa fa fa-download"></i> Export Error</a>
    </div>
    <div class="panel-body">
        <h2>Daftar Error Import Karena Sudah Terealisasi</h2>

        <?php 
$this->widget('bootstrap.widgets.TbGridView', array('id' => 'component-error-grid', 'dataProvider' => $componentError->search(), 'filter' => $componentError, 'columns' => array(array('header' => 'No', 'value' => '$this->grid->dataProvider->pagination->currentPage * $this->grid->dataProvider->pagination->pageSize + ($row+1)'), array('name' => 'satker_code', 'value' => 'isset($data->satker->name)?$data->satker->name:"Not set"', 'filter' => Satker::model()->getSatkerOptions()), array('name' => 'activity_code', 'value' => 'isset($data->activity->name)?$data->activity->name:"Not set"', 'filter' => Activity::model()->getActivityOptions()), array('name' => 'output_code', 'value' => 'isset($data->outputCode->name)?$data->outputCode->name:$data->output_code', 'filter' => Output::model()->getOutputOptions()), array('name' => 'suboutput_code', 'value' => 'isset($data->suboutputCode->name)?$data->suboutputCode->name:$data->suboutput_code', 'filter' => Suboutput::model()->getSuboutputOptions()), 'code', 'name', array('class' => 'bootstrap.widgets.TbButtonColumn', 'template' => '{view}'))));
?>
    </div>
</div>

 /**
  * Check completeness data of master
  * @return boolean
  */
 public function checkMaster()
 {
     $complete = false;
     $ppk = Ppk::model()->exists();
     $satker = Satker::model()->exists();
     $activity = Activity::model()->exists();
     $output = Output::model()->exists();
     $suboutput = Suboutput::model()->exists();
     $component = Component::model()->exists();
     $subcomponent = Subcomponent::model()->exists();
     $account = Account::model()->exists();
     $province = Province::model()->exists();
     $city = City::model()->exists();
     if ($ppk && $satker && $activity && $output && $suboutput & $component && $subcomponent && $account && $province && $city) {
         $complete = TRUE;
     }
     return $complete;
 }
예제 #6
0
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'subcomponent-form', 'enableAjaxValidation' => true, 'htmlOptions' => array('enctype' => 'multipart/form-data')));
?>


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

<?php 
echo $form->dropDownListRow($model, "output_code", Output::model()->getOutputOptions(), array("prompt" => "Please Select"));
?>


<?php 
echo $form->dropDownListRow($model, "suboutput_code", Suboutput::model()->getSuboutputOptions(), array("prompt" => "Please Select"));
?>


<?php 
echo $form->dropDownListRow($model, "component_code", Component::model()->getComponentOptions(), array("prompt" => "Please Select"));
?>


<?php 
echo $form->textFieldRow($model, 'code', array('class' => 'span5', 'maxlength' => 256));
?>


<?php 
echo $form->textFieldRow($model, 'name', array('class' => 'span5', 'maxlength' => 256));
예제 #7
0
<?php

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




<?php 
$this->widget('bootstrap.widgets.TbGridView', array('id' => 'budget-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array(array('header' => 'No', 'value' => '$this->grid->dataProvider->pagination->currentPage * $this->grid->dataProvider->pagination->pageSize + ($row+1)'), array('name' => 'dipa_id', 'value' => '$data->dipa->dipa_number', 'filter' => Dipa::model()->getDipaOptions()), array('name' => 'output_code', 'value' => 'isset($data->outputCode->name)?$data->outputCode->name:$data->output_code', 'filter' => Output::model()->getOutputOptions()), array('name' => 'suboutput_code', 'value' => 'isset($data->suboutputCode->name)?$data->suboutputCode->name:$data->suboutput_code', 'filter' => Suboutput::model()->getSuboutputOptions()), array('name' => 'component_code', 'value' => 'isset($data->componentCode->name)?$data->componentCode->name:$data->component_code', 'filter' => Component::model()->getComponentOptions()), array('name' => 'subcomponent_code', 'value' => 'isset($data->subcomponentCode->name)?$data->subcomponentCode->name:$data->subcomponent_code', 'filter' => Subcomponent::model()->getSubcomponentOptions()), 'subcomponent_code', array('name' => 'account_code', 'value' => 'isset($data->accountCode->name)?$data->accountCode->name:$data->account_code', 'filter' => Account::model()->getAccountOptions()), array("name" => "total_budget_limit", "value" => 'Yii::app()->format->number($data->total_budget_limit)', 'htmlOptions' => array('style' => 'text-align: right;')), array('class' => 'bootstrap.widgets.TbButtonColumn'))));