Example #1
0
 public function TypeName()
 {
     $account = Acctype::findOne(['id' => $this->type_id]);
     if ($account == null) {
         return \Yii::t('app', 'NA');
     }
     return $account->name;
 }
Example #2
0
 public function calcPay()
 {
     $this->step = 1;
     $this->dates();
     $this->income_sum = Acctype::findOne(3)->getTotal($this->from_date, $this->to_date);
     $this->tax_rate = \app\helpers\Linet3Helper::getSetting('company.tax.rate');
     //$tax
     $this->tax_sum = $this->income_sum * ($this->tax_rate / 100);
     $this->custtax_acc = \app\helpers\Linet3Helper::getSetting('company.acc.custtax');
     $this->custtax_sum = Accounts::findOne($this->custtax_acc)->getTotal($this->from_date, $this->to_date);
     //*-1
     $this->custtax_total = Accounts::findOne($this->custtax_acc)->getTotal(0, $this->to_date);
     if ($this->custtax_total > $this->tax_sum) {
         $this->custtax_total = $this->tax_sum;
     }
     $this->tax_total = $this->tax_sum + $this->custtax_total;
     return $this->tax_total;
 }
Example #3
0
 public function actionOpenfrmtimport()
 {
     $model = new FormOpenfrmt();
     if (isset($_POST['SwitchType'])) {
         //save current
         //$corComp=Yii::$app->user->Database->id;
         $newComp = (int) $_POST['companyId'];
         //company load
         Company::select($newComp);
         foreach ($_POST['SwitchType'] as $old => $new) {
             \app\models\Acctype::switchType($old, $new);
         }
         //end
         //$this->redirect(\yii\helpers\BaseUrl::base() . '/company/index');
     }
     if (isset($_POST['FormOpenfrmt'])) {
         //$yiiUser=Yii::$app->user->id;
         //$configPath=\app\helpers\Linet3Helper::getSetting("company.path");
         $file = Company::getFilePath() . "ini.txt";
         $model->iniFile = $_POST['FormOpenfrmt']['iniFile'];
         $model->iniFile = \yii\web\UploadedFile::getInstance($model, 'iniFile');
         if ($model->iniFile->saveAs($file)) {
             $model->iniFile = $file;
             //$model->read();
         }
         $file = Company::getFilePath() . "/bkmv.txt";
         $model->bkmvFile = $_POST['FormOpenfrmt']['bkmvFile'];
         $model->bkmvFile = \yii\web\UploadedFile::getInstance($model, 'bkmvFile');
         if ($model->bkmvFile->saveAs($file)) {
             //$corComp = ;
             $model->bkmvFile = $file;
             $model->readIni();
             $this->company = $model->companyId;
             Company::select($this->company);
             $model->readBkmv();
             Company::select($this->company);
         }
         return $this->render('openfrmtimportajax', array('model' => $model));
         Yii::$app->end();
     }
     return $this->render('openfrmtimport', array('model' => $model));
     //echo $model->read();
 }
Example #4
0
 public function getType($name)
 {
     $model = Acctype::find()->where(['name' => $name])->one();
     //print_r($this);
     return $model->id;
 }
Example #5
0
 public function getAccType()
 {
     return $this->hasOne(Acctype::className(), array('id' => 'type'));
 }
Example #6
0
 /**
  * Manages all models.
  */
 public function actionAdmin($id = 0)
 {
     $types = Acctype::find()->All();
     $list = array();
     $searchModel = new \app\models\AccountsSearch();
     $searchModel->type = $id;
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     if (Yii::$app->request->get('AccountsSearch')) {
         $searchModel->search(Yii::$app->request->get());
         return $this->renderPartial('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
     }
     foreach ($types as $type1) {
         $searchModel = new \app\models\AccountsSearch();
         $searchModel->type = $type1->id;
         $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
         $array = ['linkOptions' => ['data-id' => $type1->id], 'content' => $this->renderPartial('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]), 'label' => Yii::t('app', $type1->desc)];
         if ($id == $type1->id) {
             $array['active'] = true;
         }
         $list[] = $array;
     }
     return $this->render('admin', ['list' => $list, 'type' => $id]);
     /*
               return $this->render('admin', array(
               'model' => $model,
               'type' => $type
               )); */
 }
Example #7
0
<?php

/***********************************************************************************
 * The contents of this file are subject to the GNU AFFERO GENERAL PUBLIC LICENSE Version 3
 * ("License"); You may not use this file except in compliance with the GNU AFFERO GENERAL PUBLIC LICENSE Version 3
 * The Original Code is:  Linet 3.0 Open Source
 * The Initial Developer of the Original Code is Adam Ben Hur.
 * All portions are Copyright (C) Adam Ben Hur.
 * All Rights Reserved.
 ************************************************************************************/
$this->params["breadcrumbs"] = array(Yii::t('app', 'Account Categories') => array('index'), Yii::t('app', 'Manage'));
$this->params["menu"] = array(array('label' => Yii::t('app', 'Create Account Category'), 'url' => array('create')));
app\widgets\MiniForm::begin(array('header' => Yii::t('app', "Manage Account Categories")));
?>

<?php 
echo app\widgets\GridView::widget(array('id' => 'bank-name-grid', 'dataProvider' => $model->search([]), 'filterModel' => $model, 'columns' => array('name', ['attribute' => 'type_id', 'filter' => \yii\helpers\ArrayHelper::map(\app\models\Acctype::find()->All(), 'id', 'name'), 'value' => function ($data) {
    return $data->TypeName();
}], array('class' => 'yii\\grid\\ActionColumn'))));
app\widgets\MiniForm::end();
Example #8
0
echo \yii\helpers\Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => 'btn btn-success']);
?>
	</div>

<?php 
kartik\form\ActiveForm::end();
$this->registerJs("\$('#mailtemplate-entity_type').change(function(){\r\n        change();\r\n    });", \yii\web\View::POS_READY);
?>
<script type="text/javascript">
    
    
    
    
function change(){
    var accList=<?php 
echo \yii\helpers\JSON::encode(\yii\helpers\ArrayHelper::map(Acctype::find()->All(), 'id', 'name'));
?>
;
    var docList=<?php 
echo \yii\helpers\JSON::encode(\yii\helpers\ArrayHelper::map(Doctype::find()->All(), 'id', 'name'));
?>
;
    //console.log(docList.length);
    if($("#mailtemplate-entity_type").val()=='app\\models\\Accounts'){
        loadList(accList);
    }else{
        loadList(docList);   
    }
        
}    
Example #9
0
echo $form->field($model, 'to_date')->widget(kartik\datecontrol\DateControl::classname(), ['type' => 'date']);
?>
        
        <?php 
echo $form->field($model, 'acc');
?>
        <?php 
echo Yii::t('app', 'Examples');
?>
: <br/>
        1-200<br/>
        1,3,5<br/>
        1-10,15-20,25-30<br/>
        
        <?php 
$temp = \yii\helpers\ArrayHelper::map(Acctype::find()->All(), 'id', 'name');
$temp[""] = Yii::t('app', 'Choose Type');
echo $form->field($model, 'type')->widget(kartik\select2\Select2::className(), ['data' => $temp]);
?>
        <div class="form-actions">
            <?php 
echo \yii\helpers\Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-success']);
?>
            
        </div>



    </div>
</div>