Ejemplo n.º 1
0
 public function __construct($type, $p1 = "report")
 {
     $html = \ZippyERP\System\Session::getSession()->printform;
     $xml = \ZippyERP\System\Session::getSession()->xmlform;
     if (strlen($html) > 0) {
         $filename = $p1;
         if ($type == "print") {
             Header("Content-Type: text/html;charset=UTF-8");
             echo $html;
         }
         if ($type == "doc") {
             header("Content-type: application/vnd.ms-word");
             header("Content-Disposition: attachment;Filename={$filename}.doc");
             header("Content-Transfer-Encoding: binary");
             echo $html;
         }
         if ($type == "xls") {
             header("Content-type: application/vnd.ms-excel");
             header("Content-Disposition: attachment;Filename={$filename}.xls");
             header("Content-Transfer-Encoding: binary");
             //echo '<meta http-equiv=Content-Type content="text/html; charset=windows-1251">';
             echo $html;
         }
         if ($type == "html") {
             header("Content-type: text/plain");
             header("Content-Disposition: attachment;Filename={$filename}.html");
             header("Content-Transfer-Encoding: binary");
             echo $html;
         }
         if ($type == "xml") {
             header("Content-type: text/xml");
             header("Content-Disposition: attachment;Filename={$filename}");
             header("Content-Transfer-Encoding: binary");
             echo $xml;
         }
         /*  if ($type == "pdf") {
         
                       $pdf = new \TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
                       $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
                       $pdf->SetFont('freesans', '', 12);
                       $pdf->setPrintHeader(false);
                       $pdf->AddPage();
                       $pdf->writeHTML($html, true, false, true, false, 'J');
                       $pdf->Output("{$filename}.pdf", 'D');
                       } */
     }
     if ($type == "metaie") {
         // экспорт  файлов  метаобьекта
         if ($p1 > 0) {
             $item = \ZippyERP\ERP\Entity\MetaData::load($p1);
             $filename = $item->meta_name . ".zip";
             header("Content-type: application/zip");
             header("Content-Disposition: attachment;Filename={$filename}");
             header("Content-Transfer-Encoding: binary");
             echo $zip;
         }
     }
     die;
 }
Ejemplo n.º 2
0
 public function OnSubmit($sender)
 {
     $html = $this->generateReport();
     $this->detail->preview->setText($html, true);
     \ZippyERP\System\Session::getSession()->printform = "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"></head><body>" . $html . "</body></html>";
     $reportpage = "ZippyERP/ERP/Pages/ShowDoc";
     $this->detail->print->pagename = $reportpage;
     $this->detail->print->params = array('print', "obsaldoreport");
     $this->detail->html->pagename = $reportpage;
     $this->detail->html->params = array('html', "obsaldoreport");
     $this->detail->word->pagename = $reportpage;
     $this->detail->word->params = array('doc', "obsaldoreport");
     $this->detail->excel->pagename = $reportpage;
     $this->detail->excel->params = array('xls', "obsaldoreport");
     $this->detail->setVisible(true);
 }
Ejemplo n.º 3
0
 public function OnSubmit($sender)
 {
     $item = $this->filter->item->getKey();
     if (Item::load($item) == null) {
         $this->setError('Не выбран ТМЦ');
         return;
     }
     $html = $this->generateReport();
     $this->detail->preview->setText($html, true);
     \ZippyERP\System\Session::getSession()->printform = "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"></head><body>" . $html . "</body></html>";
     // \ZippyERP\System\Session::getSession()->storereport = "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"></head><body>" . $html . "</body></html>";
     $reportpage = "ZippyERP/ERP/Pages/ShowDoc";
     $this->detail->print->pagename = $reportpage;
     $this->detail->print->params = array('print', "movereport");
     $this->detail->html->pagename = $reportpage;
     $this->detail->html->params = array('html', "movereport");
     $this->detail->word->pagename = $reportpage;
     $this->detail->word->params = array('doc', "movereport");
     $this->detail->excel->pagename = $reportpage;
     $this->detail->excel->params = array('xls', "movereport");
     $this->detail->setVisible(true);
 }
Ejemplo n.º 4
0
 public function onReport($sender)
 {
     $html = $this->generateReport();
     //  $html ="<h1>ddd</h1>";
     $this->detail->preview->setText($html, true);
     \ZippyERP\System\Session::getSession()->printform = "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"></head><body>" . $html . "</body></html>";
     $this->updateAjax(array("preview"));
 }
Ejemplo n.º 5
0
 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);
 }