public function generateReport() { $i = 1; $detail = array(); $total = 0; foreach ($this->detaildata as $value) { $detail[] = array("no" => $i++, "date" => "", "tovar_name" => $value['itemname'], "tovar_code" => "", "measure_name" => $value['measure_name'], "measure_code" => $value['measure_code'], "quantity" => $value['quantity'] / 1000, "price" => H::fm($value['price']), "pricends" => H::fm($value['pricends']), "amount" => H::fm($value['quantity'] / 1000 * $value['price'])); $total += $value['quantity'] / 1000 * $value['price']; } $firm = System::getOptions("firmdetail"); $customer = \ZippyERP\ERP\Entity\Customer::load($this->headerdata["customer"]); $contract = Document::load($this->headerdata["contract"]); if ($contract instanceof Document) { $contractnumber = $contract->document_number; $contractname = $contract->meta_desc; $contractdate = date('dmY', $contract->document_date); } $header = array('date' => date('dmY', $this->document_date), "firmname" => $firm['name'], "firmcode" => H::addSpaces($firm['inn']), "customername" => $customer->customer_name, "customercode" => H::addSpaces($customer->inn), "saddress" => $firm['street'] . ',' . $firm['city'], "baddress" => $customer->street . ',' . $customer->city, "sphone" => H::addSpaces($firm['phone']), "bphone" => H::addSpaces($customer->phone), "contractname" => $contractname, "contractdate" => H::addSpaces($contractdate), "contractnumber" => $contractnumber, "paytype" => $this->headerdata["paytype"], "document_number" => $this->document_number, "totalnds" => H::fm($this->headerdata["totalnds"]), "total" => H::fm($total), "totalall" => H::fm($total + $this->headerdata["totalnds"])); $report = new \ZippyERP\ERP\Report('taxinvoice.tpl'); $html = $report->generate($header, $detail); return $html; }