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; } } }
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?? }
<?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);
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; }
public function getOType($type) { $model = Doctype::find()->where(['openformat' => $type])->one(); if ($model === null) { return 0; } return $model->id; }
<?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')