Esempio n. 1
0
 /**
  * get or create record for table
  * @param int $fret_id - ref type (first dimension level)
  * @param int $ref_id - refernce table record id
  * @param string $code 
  * @param string $name
  * @return type
  */
 public static function getDim2Id($fret_id, $ref_id, $code, $name = false)
 {
     if (!$name) {
         $name = $code;
     }
     //search existing record
     $criteria = new CDbCriteria();
     $criteria->compare('fdm2_sys_ccmp_id', Yii::app()->sysCompany->getActiveCompany());
     $criteria->compare('fdm2_fret_id', $fret_id);
     $criteria->compare('fdm2_ref_id', $ref_id);
     if ($fdm2 = Fdm2Dimension2::model()->find($criteria)) {
         return $fdm2->fdm2_id;
     }
     $fret = FretRefType::model()->findByPk($fret_id);
     //add record
     $fdm2 = new Fdm2Dimension2();
     $fdm2->fdm2_fret_id = $fret_id;
     $fdm2->fdm2_ref_id = $ref_id;
     $fdm2->fdm2_fdm1_id = $fret->fret_fdm1_id;
     $fdm2->fdm2_code = substr($code, 0, 10);
     $fdm2->fdm2_name = $name;
     $fdm2->save();
     return $fdm2->primaryKey;
 }
Esempio n. 2
0
 public function beforeSave()
 {
     //get all data from dimension 2
     $fdm2 = Fdm2Dimension2::model()->findByPk($this->fdm3_fdm2_id);
     if (empty($this->fdm3_sys_ccmp_id)) {
         $this->fdm3_sys_ccmp_id = Yii::app()->sysCompany->getActiveCompany();
     }
     if (empty($this->fdm3_fret_id)) {
         $this->fdm3_fret_id = $fdm2->fdm2_fret_id;
     }
     if (empty($this->fdm3_fdm1_id)) {
         $this->fdm3_fdm1_id = $fdm2->fdm2_fdm1_id;
     }
     if (empty($this->fdm3_fdm2_id)) {
         $this->fdm3_fdm2_id = $fdm2->fdm2_id;
     }
     if (!parent::beforeSave()) {
         return false;
     }
     return true;
 }
 public function loadModel($id)
 {
     $m = Fdm2Dimension2::model();
     // apply scope, if available
     $scopes = $m->scopes();
     if (isset($scopes[$this->scope])) {
         $m->{$this->scope}();
     }
     $model = $m->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, Yii::t('D2fixrModule.crud', 'The requested page does not exist.'));
     }
     return $model;
 }
Esempio n. 4
0
        <div class='control-label'>
            <?php 
echo $form->labelEx($model, 'fdda_fdm2_id');
?>
        </div>
        <div class='controls'>
            <span class="tooltip-wrapper" data-toggle='tooltip' data-placement="right"
                  title='<?php 
echo ($t = Yii::t('D2fixrModule.model', 'tooltip.fdda_fdm3_id')) != 'tooltip.fdda_fdm3_id' ? $t : '';
?>
'>
                      <?php 
//get select fret list
$criteria = new CDbCriteria();
$criteria->compare('fdm2_fret_id', $fret_id);
$fdm2_list = Fdm2Dimension2::model()->findAll($criteria);
//create array for grouped listbox
$list_data = array();
foreach ($fdm2_list as $fdm2) {
    $sublist = array();
    foreach ($fdm2->fdm3Dimension3s as $fdm3) {
        $sublist[$fdm3->fdm3_id] = $fdm3->fdm3_name;
    }
    $list_data[$fdm2->fdm2_name] = $sublist;
}
echo $form->dropDownList($model, 'fdda_fdm3_id', $list_data, array('prompt' => Yii::t('D2fixrModule.model', 'Select position')));
echo $form->error($model, 'fdda_fdm3_id');
?>
                            </span>
        </div>
    </div>
Esempio n. 5
0
<?php

$this->renderPartial('levels_js');
$fdm1 = Fdm1Dimension1::model()->findByPk($fdm1_id);
$fdm2 = Fdm2Dimension2::model()->findByPk($fdm2_id);
$breadcrumbs[Yii::t('D2fixrModule.model', 'Home')] = array('level1', 'year' => $year);
$breadcrumbs[$fdm1->itemLabel] = array('level2', 'year' => $year, 'fdm1_id' => $fdm1_id);
$breadcrumbs[] = $fdm2->itemLabel;
$this->widget("TbD2Breadcrumbs", array('links' => $breadcrumbs));
?>

<div class="table-header">
    <?php 
echo Yii::t('D2fixrModule.model', 'Dimensions:') . ' ';
echo $fdm1->itemLabel . ' > ' . $fdm2->itemLabel . ' / ';
echo Yii::t('D2fixrModule.model', 'Year:');
$prev_year = $year - 1;
$next_year = $year + 1;
$this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'link', 'type' => 'primary', 'size' => 'mini', 'icon' => 'icon-chevron-left', 'url' => array('level3', 'year' => $prev_year, 'fdm1_id' => $fdm1_id, 'fdm2_id' => $fdm2_id), 'htmlOptions' => array('title' => $prev_year, 'data-toggle' => 'tooltip', 'icon_class' => '')));
echo $year;
$this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'link', 'type' => 'primary', 'size' => 'mini', 'icon' => 'icon-chevron-right', 'url' => array('level3', 'year' => $next_year, 'fdm1_id' => $fdm1_id, 'fdm2_id' => $fdm2_id), 'htmlOptions' => array('title' => $next_year, 'data-toggle' => 'tooltip', 'icon_class' => '')));
?>
</div>


<table class="items table table-striped table-bordered table-hover" id="dim_transactions">
    <thead>
        <tr>
            <td></td>
            <?php 
foreach ($months as $m) {
 public function actionAdmin($fdm2_id)
 {
     $model = new Fdm3Dimension3('search');
     $scopes = $model->scopes();
     if (isset($scopes[$this->scope])) {
         $model->{$this->scope}();
     }
     $model->unsetAttributes();
     if (isset($_GET['Fdm3Dimension3'])) {
         $model->attributes = $_GET['Fdm3Dimension3'];
     }
     $model->fdm3_fdm2_id = $fdm2_id;
     $fdm2 = Fdm2Dimension2::model()->findByPk($fdm2_id);
     $this->render('admin', array('model' => $model, 'fdm2' => $fdm2));
 }
Esempio n. 7
0
 /**
  * get fdm2_id value and set it
  * @param int $ref_id fdm2_ref_id value
  * @param string $code
  * @param string $name
  */
 public function setFdm2Id($ref_id, $code, $name = false)
 {
     if (empty($this->fdda_fret_id)) {
         exit('Before FddaDimData->setFdm2Id require set fdda_fret_id');
     }
     $this->fdda_fdm2_id = Fdm2Dimension2::getDim2Id($this->fdda_fret_id, $ref_id, $code, $name);
 }
Esempio n. 8
0
 /**
  * level 1 month transactions
  * @param type $fdm1_id
  * @param type $year
  * @param type $month
  */
 public function actionLevel2transactions($fdm2_id, $year, $month)
 {
     $fdpe_id = FdpeDimPeriod::getIdByYearMonth($year, $month);
     $data = FdpeDimPeriod::getDimMonthPositions($fdpe_id, false, $fdm2_id);
     $fdm2 = Fdm2Dimension2::model()->findByPk($fdm2_id);
     $this->renderPartial('transactions', array('year' => $year, 'month' => $month, 'label' => $fdm2->fdm2_name, 'data' => $data));
 }