public function getItems($start, $count, $sortfield = null, $asc = null) { return Entry::find($this->getWhere(), "document_date", "desc"); }
public function setDoc(\ZippyERP\ERP\Entity\Doc\Document $doc) { $this->_doc = $doc; // получение екзамеляра конкретного документа с данными $type = Helper::getMetaType($doc->type_id); $class = "\\ZippyERP\\ERP\\Entity\\Doc\\" . $type['meta_name']; $doc = $class::load($doc->document_id); // проверяем поддержку экспорта $exportlist = $doc->supportedExport(); $this->word->setVisible(in_array(Document::EX_WORD, $exportlist)); $this->excel->setVisible(in_array(Document::EX_EXCEL, $exportlist)); $this->xml->setVisible(in_array(Document::EX_XML_GNAU, $exportlist)); // генерация печатной формы $html = $doc->generateReport(); if (strlen($html) == 0) { // $this->owner->setError("Не найден шаблон печатной формы"); // return; $html = "<h4>Печатная форма не задана</h4>"; $this->print->setVisible(false); $this->html->setVisible(false); $this->word->setVisible(false); $this->excel->setVisible(false); } $this->preview->setText($html, true); Session::getSession()->printform = "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"></head><body>" . $html . "</body></html>"; $filename = $type['meta_name']; //экспорт в xml формат $xml = $doc->export(Document::EX_XML_GNAU); if (is_array($xml) > 0) { Session::getSession()->xmlform = $xml['content']; $filename = $xml['filename']; } $reportpage = "ZippyERP/ERP/Pages/ShowDoc"; $this->print->pagename = $reportpage; $this->print->params = array('print', $filename); $this->html->pagename = $reportpage; $this->html->params = array('html', $filename); $this->word->pagename = $reportpage; $this->word->params = array('doc', $filename); $this->excel->pagename = $reportpage; $this->excel->params = array('xls', $filename); $this->xml->pagename = $reportpage; $this->xml->params = array('xml', $filename); $this->updateDocs(); $this->_entries = \ZippyERP\ERP\Entity\Entry::find('document_id=' . $this->_doc->document_id); $this->dw_entrylist->Reload(); $this->_statelist = $this->_doc->getLogList(); $this->dw_statelist->Reload(); $this->updateFiles(); $this->updateMessages(); $this->detuser->setText($this->_doc->userlogin); $this->detcreated->setText(date('Y-m-d H:i', $this->_doc->created)); $this->detupdated->setText(date('Y-m-d H:i', $this->_doc->updated)); $this->detnotes->setText($this->_doc->notes); }