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?? }