示例#1
0
 public function docsTest()
 {
     $types = Doctype::find()->All();
     foreach ($types as $type) {
         $docs = Docs::find()->where(["doctype" => $type->id])->orderBy('docnum')->All();
         $num = 0;
         foreach ($docs as $doc) {
             if ($num != 0) {
                 if ($num == $doc->docnum) {
                     $this->errors[] = 'Duplicate documenet number:' . $doc->docnum . ' id: ' . $doc->id . " type: " . $type->name;
                 }
                 if ($num + 1 != $doc->docnum) {
                     $this->errors[] = 'Invalid documenet number:' . $doc->docnum . ' id: ' . $doc->id . " type: " . $type->name;
                 }
             }
             $num = $doc->docnum;
         }
     }
 }
示例#2
0
 public function import()
 {
     //add warehouse
     $array = $this->read();
     //companies
     $company = $this->parseLine($array['companies'][0]);
     $prefix = $company[1];
     //echo $prefix;
     $this->saveSetting('company.name', $company[0]);
     $this->saveSetting('company.vat.id', $company[3]);
     $this->saveSetting('company.address', $company[4]);
     $this->saveSetting('company.city', $company[5]);
     $this->saveSetting('company.zip', $company[6]);
     $this->saveSetting('company.phone', $company[7]);
     $this->saveSetting('company.fax', $company[8]);
     $this->saveSetting('company.website', $company[9]);
     $this->saveSetting('company.tax.rate', $company[10]);
     $this->saveSetting('company.tax.irs', $company[11]);
     //$this->saveSetting('account.100.srctax', $company[12]);
     $this->saveSetting('company.tax.vat', $company[13]);
     //exit;
     ///*
     if (isset($array['accounts'])) {
         $this->imprtAccounts($array['accounts'], $prefix);
     }
     if (isset($array['items'])) {
         $this->imprtItems($array['items'], $prefix);
     }
     if (isset($array['docs'])) {
         $this->imprtDocs($array['docs'], $prefix);
     }
     if (isset($array['cheques'])) {
         $this->imprtCheques($array['cheques'], $prefix);
     }
     if (isset($array['docdetails'])) {
         $this->imprtDocdetails($array['docdetails'], $prefix);
     }
     if (isset($array['transactions'])) {
         $this->imprtTransactions($array['transactions'], $prefix);
     }
     if (isset($array['bankbook'])) {
         $this->imprtBankbooks($array['bankbook'], $prefix);
     }
     if (isset($array['correlation'])) {
         $this->imprtCorrelations($array['correlation'], $prefix);
     }
     //*/
     //vat rate
     $acc = Accounts::findOne(100);
     $acc->src_tax = $company[12];
     $acc->save();
     $acc = Accounts::findOne(101);
     $acc->src_tax = $company[12];
     $acc->save();
     //add warehouse
     //add genral item
     //get transaction num
     $this->saveSetting('company.transaction', Transactions::getMax() + 1);
     //get docnums
     $types = Doctype::find()->All();
     foreach ($types as $type) {
         $type->last_docnum = Docs::getMax($type->id);
         $type->save();
     }
     //contacthist
     //contacts??
     //tranrep??
 }
示例#3
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.
 * ********************************************************************************** */
yii\widgets\Pjax::begin(['id' => 'docs-grid-pjax']);
$model = new \app\models\Docs();
$model->scenario = 'search';
//$model->unsetAttributes();
//$var=\yii\helpers\Html::link(\yii\helpers\Html::encode($data->docnum),"#", array("onclick"=>'refNum('.\yii\helpers\Json::encode($data).')'));
echo \app\widgets\GridView::widget(['id' => 'docs-grid', 'dataProvider' => $model->search(Yii::$app->request->get()), 'layout' => '{items}{pager}', 'panel' => false, 'filterModel' => $model, 'columns' => array(['attribute' => 'doctype', 'filter' => \yii\helpers\ArrayHelper::map(\app\models\Doctype::find()->All(), 'id', 'name'), 'value' => function ($data) {
    return $data->TypeName();
}, 'options' => ['style' => 'width:35%;']], ['attribute' => 'docnum', 'value' => function ($data) {
    return \yii\helpers\Html::a(\yii\helpers\Html::encode($data->docnum), "#", array("onclick" => 'refNum(' . \yii\helpers\Json::encode($data) . ')'));
}, 'format' => 'raw', 'options' => ['style' => 'width:5%;']], 'company', ['attribute' => 'status', 'value' => function ($data) {
    return $data->docStatus->name;
}, 'options' => ['style' => 'width:8%;']], array('attribute' => 'total', 'options' => ['style' => 'width:8%;']))]);
?>
<script type="text/javascript">
    
    jQuery("#docs-grid-pjax").on('pjax:timeout', function(e){
        e.preventDefault();
    }).on('pjax:send', function(){
        jQuery("#docs-grid-container").addClass('kv-grid-loading');
    }).on('pjax:complete', function(){
            //setTimeout(kvGridInit_34655f25(), 2500);
示例#4
0
 public function getOType($type)
 {
     $model = Doctype::find()->where(['openformat' => $type])->one();
     if ($model === null) {
         return 0;
     }
     return $model->id;
 }
示例#5
0
 public static function tlist()
 {
     $array = \yii\helpers\ArrayHelper::map(\app\models\Doctype::find()->All(), 'id', 'name');
     foreach ($array as $id => $name) {
         $array[$id] = Yii::t('app', $name);
     }
     return $array;
 }
示例#6
0

<?php 
\yii\widgets\Pjax::begin();
echo $searchModel->issue_from;
$dateisOn = kartik\date\DatePicker::widget(['model' => $searchModel, 'attribute' => 'issue_from', 'attribute2' => 'issue_to', 'removeButton' => false, 'type' => 5, 'separator' => '']);
//.
//kartik\date\DatePicker::widget([    'model' => $searchModel,     'attribute' => 'issue_to',             'removeButton' => false,    ]);
//kartik\datecontrol\DateControl::widget(['model' => $searchModel, 'attribute' => 'issue_to', 'type' => 'date']);
$filter = '';
if ($searchModel->doctype != null) {
    $filter = \yii\helpers\ArrayHelper::map(\app\models\Docstatus::find()->where(['doc_type' => $searchModel->doctype])->All(), 'num', 'name');
} else {
    //$searchModel->status = null;
}
echo app\widgets\GridView::widget(array('dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => array(array('attribute' => 'doctype', 'filter' => \app\models\Doctype::tlist(), 'value' => function ($data) {
    return $data->TypeName();
}, 'width' => '150px'), array('attribute' => 'status', 'filter' => $filter, 'value' => function ($data) {
    return $data->docStatus->name;
}, 'width' => '70px'), array('attribute' => 'refstatus', 'width' => '110px', 'filter' => \yii\helpers\ArrayHelper::map(\app\models\Docs::getRefStatuses(), 'id', 'name'), 'value' => function ($data) {
    return app\widgets\Switcher::widget(['model' => $data, 'name' => 'refstatus', 'url' => yii\helpers\BaseUrl::base() . '/docs/refstatus/' . $data->id, 'onLabel' => Yii::t('app', 'Open'), 'offLabel' => Yii::t('app', 'Closed')]);
}, 'format' => 'raw'), array('attribute' => 'docnum', 'width' => '70px'), array('attribute' => 'account_id', 'width' => '70px'), 'company', 'refnum_ext', array('attribute' => 'issue_date', 'filterType' => \kartik\grid\GridView::FILTER_DATE_RANGE, 'filterWidgetOptions' => ['convertFormat' => true, 'useWithAddon' => true, 'pluginOptions' => ['format' => 'Y-m-d', 'separator' => ' to '], 'hideInput' => true, 'presetDropdown' => false], 'width' => '150px', 'value' => function ($data) {
    return $data->readDateFormat($data->issue_date);
}), 'total', array('options' => array('style' => 'width:95px;'), 'class' => 'yii\\grid\\ActionColumn', 'template' => '{duplicate}{print}{view}{update}{delete}', 'buttons' => array('update' => function ($url, $model, $key) {
    if ($model->docStatus->looked == 1) {
        return '';
    }
    //    'label' => '<i class="glyphicon glyphicon-edit"></i>',
    return Html::a('<i class="glyphicon glyphicon-edit"></i>', $url);
}, 'duplicate' => function ($url, $model, $key) {
    return Html::a('<i class="glyphicon glyphicon-plus-sign"></i>', $url);
示例#7
0
文件: Docs.php 项目: chaimvaid/linet3
 public function getDocType()
 {
     return $this->hasOne(Doctype::className(), array('id' => 'doctype'));
 }
示例#8
0
 /**
  * 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 the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = Doctype::findOne($id);
     if ($model === null) {
         throw new \yii\web\HttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
示例#9
0
 public function docsTable()
 {
     $array = array();
     if (isset($this->docArr)) {
         foreach ($this->docArr as $key => $value) {
             $tmp = OpenFormatType::findOne(array('id' => $key, 'type' => 'INI'));
             //echo OpenFormatType::findOne($key)->description;
             if ($tmp) {
                 print_r($tmp);
             }
             $array[] = array('id' => $key, 'name' => Doctype::getOpenType($key), 'count' => $value, 'sum' => $this->docSumArr[$key]);
         }
     }
     return new \yii\data\ArrayDataProvider(array('allModels' => $array, 'pagination' => array('pageSize' => 100)));
 }
示例#10
-13
<?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);   
    }
        
}    

function loadList(list){
    
    $("#mailtemplate-entity_id")
            .find('option')