示例#1
0
 public function getBudgetForDipaOptions()
 {
     $models = Budget::model()->findAll();
     $options = array();
     foreach ($models as $model) {
         $subcomponent = Subcomponent::model()->findByAttributes(array('code' => $model->subcomponent_code));
         if ($subcomponent) {
             $options[$model->code] = "[ {$model->code} ] | {$subcomponent->name}";
         } else {
             $options[$model->code] = "[ {$model->code} ]";
         }
     }
     return $options;
 }
 public function actionAccountChart($id)
 {
     $subcomponent = Subcomponent::model()->findByPk($id);
     $package = Package::model()->findByAttributes(array('code' => $subcomponent->code));
     $limit = array();
     $realization = array();
     $rest = array();
     $rate = array();
     $legend = FALSE;
     $packageAccounts = PackageAccount::model()->findAllByAttributes(array('package_code' => $package->code));
     if ($packageAccounts) {
         foreach ($packageAccounts as $packageAccount) {
             $limit[$packageAccount->id] = $packageAccount->limit;
             $realization[$packageAccount->id] = $packageAccount->getTotal($packageAccount->code)['realization'];
             $rest[$packageAccount->id] = $packageAccount->getTotal($packageAccount->code)['restMoney'];
             $rate[$packageAccount->id] = $packageAccount->getTotal($packageAccount->code)['rate'];
         }
         $legend = TRUE;
     }
     $this->render('accountChart', array('legend' => $legend, 'packageAccounts' => $packageAccounts, 'package' => $package, 'rate' => $rate, 'limit' => $limit, 'realization' => $realization, 'rest' => $rest));
 }
 public function getSubcomponentOptions2()
 {
     $packages = Package::model()->findAll();
     $code = '';
     foreach ($packages as $package) {
         $code .= $package->code . ';';
     }
     $code = explode(";", $code);
     $models = Subcomponent::model()->findAll();
     $options = array();
     foreach ($models as $model) {
         $options[$model->id] = "[{$model->code}] | {$model->name}";
     }
     return $options;
 }
示例#4
0
 </td>
                    <td><?php 
        // echo CHtml::dropDownList('province_code[]', "string", Province::model()->getOptionsCodeName(), array('prompt' => 'Pilih'));
        ?>
 </td>
                    <td><?php 
        echo CHtml::dropDownList('city_code[]', "string", City::model()->getProvinceGroupOptions(), array('prompt' => 'Pilih'));
        ?>
 </td>
                </tr>
            <?php 
    }
    ?>
            <tr>
                <td><?php 
    echo CHtml::dropDownList('code[]', "string", Subcomponent::model()->getSubcomponentOptions(), array('prompt' => 'Pilih', 'type' => 'selc', 'onfocus' => 'removeDuplicate()'));
    ?>
 </td>
                <td><?php 
    echo CHtml::dropDownList('ppk_code[]', "string", Ppk::model()->getPpkOptions(), array('prompt' => 'Pilih'));
    ?>
 </td>
                <td><?php 
    // echo CHtml::dropDownList('province_code[]', "string", Province::model()->getOptionsCodeName(), array('prompt' => 'Pilih'));
    ?>
 </td>
                <td><?php 
    echo CHtml::dropDownList('city_code[]', "string", City::model()->getProvinceGroupOptions(), array('prompt' => 'Pilih'));
    ?>
 </td>
            </tr>
 /**
  * Check completeness of inputed data
  * @return boolean
  */
 public function checkDataCompleteness()
 {
     $status = array();
     $status['dipa'] = TRUE;
     // True if dipa data complete
     $status['master'] = TRUE;
     //True if master data complete
     //Find  missing master data
     $master = Subcomponent::model()->findAllBySql("SELECT subcomponent.* FROM subcomponent LEFT JOIN budget_temp ON subcomponent.code=budget_temp.subcomponent_code WHERE budget_temp.subcomponent_code IS NULL");
     //FInd missing dipa data input
     $dipa = BudgetTemp::model()->findAllBySql("SELECT budget_temp.* FROM budget_temp LEFT JOIN subcomponent ON budget_temp.subcomponent_code=subcomponent.code WHERE subcomponent.code IS NULL");
     if ($master) {
         $status['dipa'] = FALSE;
     }
     if ($dipa) {
         $status['master'] = FALSE;
     }
     return $status;
 }
 /**
  * Export Data to Excel
  */
 public function actionExport()
 {
     /** Get model */
     $models = Subcomponent::model()->findAll();
     /** Error reporting */
     $this->excelErrorReport();
     /** PHPExcel_IOFactory */
     $objReader = new PHPExcel();
     $objReader = PHPExcel_IOFactory::createReader('Excel2007');
     $path = Yii::app()->basePath . '/../export/subcomponent.xlsx';
     $pathExport = Yii::app()->basePath . '/../files/Master Subkomponen.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;
 }
<?php

$this->widget('ext.jqrelcopy.JQRelcopy', array('id' => 'copylink', 'removeText' => '<i></i>', 'removeHtmlOptions' => array('class' => 'fa fa-fw fa-trash'), 'options' => array('copyClass' => 'newcopy', 'limit' => 5, 'clearInputs' => true, 'excludeSelector' => '.skipcopy')));
?>
<a id="copylink" href="#" rel=".copy">Copy</a>
<div class="copy">
    <?php 
echo CHtml::dropDownList('code[]', "string", Subcomponent::model()->getSubcomponentOptions(), array('prompt' => 'Pilih Paket Pekerjaan'));
?>
 
    <?php 
echo CHtml::dropDownList('ppk_code[]', "string", Ppk::model()->getPpkOptions(), array('prompt' => 'Pilih PPK'));
?>
 </br>
    <?php 
echo CHtml::dropDownList('province_code[]', "string", Province::model()->getOptionsCodeName(), array('prompt' => 'Pilih Provinsi'));
?>
    <?php 
echo CHtml::dropDownList('city_code[]', "string", City::model()->getOptionsCodeName(), array('prompt' => 'Pilih Kab/Kota'));
?>
</div>
</br>
</br>
<div class="clearfix"></div>

示例#8
0
<?php

$this->widget('ext.dropDownChain.VDropDownChain', array('parentId' => 'province', 'childId' => 'city', 'url' => 'package/getCity', 'valueField' => 'code', 'textField' => 'name'));
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'package-form', 'enableAjaxValidation' => true, 'htmlOptions' => array('enctype' => 'multipart/form-data')));
?>


<?php 
echo $form->errorSummary($model);
if ($model->isNewRecord) {
    ?>
    <?php 
    echo $form->dropDownList($model, 'code', Subcomponent::model()->getSubcomponentOptions(), array("prompt" => "Pilih Paket"));
}
echo $form->dropDownList($model, 'province_code', Province::model()->getOptionsCodeName(), array("prompt" => "Pilih Provinsi", 'id' => 'province'));
?>

<?php 
echo $form->dropDownList($model, 'city_code', City::model()->getOptionsCodeName(), array("prompt" => "Pilih Kota", 'id' => 'city'));
?>

<?php 
echo $form->dropDownList($model, 'ppk_code', Ppk::model()->getPpkOptions(), array("prompt" => "Pilih PPK"));
?>


<div class="form-actions">
    <?php 
$this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'type' => 'primary', 'label' => $model->isNewRecord ? 'Tambah' : 'Simpan'));
?>
</div>
 public function exportExcel($objPHPExcel, $models)
 {
     $sheet = $objPHPExcel->getActiveSheet();
     $row = 1;
     $number = 0;
     $models = PackageAccount::model()->findAll();
     if ($models) {
         $sheet->getProtection()->setSheet(true);
         foreach ($models as $model) {
             $package = Subcomponent::model()->findByAttributes(array('code' => "{$model->package_code}"));
             $account = Account::model()->findByAttributes(array('code' => "{$model->account_code}"));
             $packageName = isset($package->name) ? $package->name : NULL;
             $accountName = isset($account->name) ? $account->name : NULL;
             $sheet->setCellValue('A' . ++$row, ++$number);
             $this->cellColor($sheet, 'A' . $row, 'A3A3A3');
             $sheet->setCellValueExplicit('B' . $row, $model->code, PHPExcel_Cell_DataType::TYPE_STRING);
             $this->cellColor($sheet, 'B' . $row, 'A3A3A3');
             $sheet->setCellValue('C' . $row, $packageName);
             $this->cellColor($sheet, 'C' . $row, 'A3A3A3');
             $sheet->setCellValue('D' . $row, $accountName);
             $this->cellColor($sheet, 'D' . $row, 'A3A3A3');
             $sheet->setCellValue('E' . $row, $model->limit);
             $this->cellColor($sheet, 'E' . $row, 'A3A3A3');
             $sheet->setCellValue('F' . $row, PackageAccount::model()->getTotal("{$model->code}")['realization']);
             $this->cellColor($sheet, 'F' . $row, 'A3A3A3');
             $sheet->setCellValue('G' . $row, 0);
             $sheet->getStyle('G' . $row)->getProtection()->setLocked(PHPExcel_Style_Protection::PROTECTION_UNPROTECTED);
             $sheet->getStyle('H' . $row)->getProtection()->setLocked(PHPExcel_Style_Protection::PROTECTION_UNPROTECTED);
             $sheet->getStyle('I' . $row)->getProtection()->setLocked(PHPExcel_Style_Protection::PROTECTION_UNPROTECTED);
             $sheet->getStyle('J' . $row)->getProtection()->setLocked(PHPExcel_Style_Protection::PROTECTION_UNPROTECTED);
             $sheet->getStyle('K' . $row)->getProtection()->setLocked(PHPExcel_Style_Protection::PROTECTION_UNPROTECTED);
             $sheet->getStyle('L' . $row)->getProtection()->setLocked(PHPExcel_Style_Protection::PROTECTION_UNPROTECTED);
             $sheet->getStyle('M' . $row)->getProtection()->setLocked(PHPExcel_Style_Protection::PROTECTION_UNPROTECTED);
             $sheet->getStyle('N' . $row)->getProtection()->setLocked(PHPExcel_Style_Protection::PROTECTION_UNPROTECTED);
             $sheet->getStyle('O' . $row)->getProtection()->setLocked(PHPExcel_Style_Protection::PROTECTION_UNPROTECTED);
             $sheet->getStyle('P' . $row)->getProtection()->setLocked(PHPExcel_Style_Protection::PROTECTION_UNPROTECTED);
         }
     }
     $objPHPExcel->getActiveSheet()->setTitle('Realisasi');
 }
示例#10
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'))));
示例#11
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;
 }