compile('pdf/tcpdf/tcpdf.php',array('includes'=>true,'namespace'=>true,'modules'=>true,'skipIfNamespace'=>true))); require(\ProcessWire\wire('files')->compile(\ProcessWire\wire("config")->paths->root . 'site/templates/_m.php',array('includes'=>true,'namespace'=>true,'modules'=>true,'skipIfNamespace'=>true))); $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor('Netmaster.lt'); $pdf->SetTitle('Oakywood krepšelis'); $pdf->SetSubject('Sąskaita'); $pdf->SetKeywords('oakywood, krepselis, netmaster'); $pdf->setPrintHeader(false); $pdf->setPrintFooter(false); $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); if (@file_exists(dirname(\ProcessWire\wire("config")->paths->root . 'site/templates/payment.php').'/lang/eng.php')) { require_once(\ProcessWire\wire('files')->compile(dirname(\ProcessWire\wire("config")->paths->root . 'site/templates/payment.php').'/lang/eng.php',array('includes'=>true,'namespace'=>true,'modules'=>true,'skipIfNamespace'=>true))); $pdf->setLanguageArray($l); } $pdf->setFontSubsetting(true); $pdf->SetFont('dejavusans', '', 14, '', true); $pdf->AddPage(); $pdf->writeHTMLCell(90, '', '', '', '', 0, 1, 0, true, '', true); $pdf->writeHTMLCell(90, '', '', '', '
Įmonė:
', 0, 0, 0, true, '', true); $pdf->writeHTMLCell(90, '', '', '', '
Užsakovas:
', 0, 1, 0, true, '', true); $pdf->writeHTMLCell(90, '', '', '', '
UAB Oakywood
', 0, 0, 0, true, '', true); $pdf->writeHTMLCell(90, '', '', '', '
' . $_POST['name'] .' '. $_POST['surname'] . '
', 0, 1, 0, true, '', true); $pdf->writeHTMLCell(90, '', '', '', '
'.$pages->get(1)->address.'
', 0, 0, 0, true, '', true); $pdf->writeHTMLCell(90, '', '', '', '
' . $_POST['number'] . '
', 0, 1, 0, true, '', true); $pdf->writeHTMLCell(90, '', '', '', '
'.$pages->get(1)->phone.'
', 0, 0, 0, true, '', true); $pdf->writeHTMLCell(90, '', '', '', '
' . $_POST['email'] . '
', 0, 1, 0, true, '', true); $pdf->writeHTMLCell(90, '', '', '', '
'.$pages->get(1)->email.'
', 0, 0, 0, true, '', true); if($_POST['firm'] != '') $pdf->writeHTMLCell(90, '', '', '', '
' . $_POST['firm'] . '
', 0, 1, 0, true, '', true); $pdf->writeHTMLCell(0, '', '', '', '
' . $_POST['city'] . ', ' . $_POST['country'] . '
', 0, 1, 0, true, '', true); $pdf->writeHTMLCell(0, '', '', '', '
' . $_POST['address1'] . '
', 0, 1, 0, true, '', true); if($_POST['address2'] != '') $pdf->writeHTMLCell(0, '', '', '', '
' . $_POST['address2'] . '
', 0, 1, 0, true, '', true); $pdf->writeHTMLCell(180, '', '', '', '
Užsakymo data: ' . date("Y-m-d H:i:s") . '
', 0, 1, 0, true, '', true); $pdf->writeHTMLCell(180, '', '', '', '
Užsakymo Nr.: ' . rand(10,100000) . '
', 0, 1, 0, true, '', true); $bigstring.="


" . '' . "\n'; $array = json_decode($_COOKIE['cart']); $total = 0; for ($i = 0; $i < count($array); $i++) { $bigstring.="\n"; $bigstring.=''; $bigstring.=''; $total += $array[$i]->price*$array[$i]->quantity; } $bigstring.="\n
Eil. Nr.Prekės kodasPavadinimasKiekis, vnt.Vnt. KainaKaina
' . ($i+1) . '' . $array[$i]->code . '' . $array[$i]->title . '' . $array[$i]->quantity . '' . sprintf("%01.2f", (float)$array[$i]->price) . ' €' . sprintf("%01.2f", (float)$array[$i]->price*$array[$i]->quantity) . ' €
"; $pdf->writeHTMLCell(0, 0, '', '', $bigstring, 0, 1, 0, true, '', true); $pdf->writeHTMLCell(150, '', '', '', '
Suma:
', 0, 0, 0, true, '', true); $pdf->writeHTMLCell(30, '', '', '', '
' . sprintf("%01.2f", (float)$total) . ' €
', 0, 1, 0, true, '', true); $pdf->writeHTMLCell(150, '', '', '', '
Pristatymas:
', 0, 0, 0, true, '', true); $pdf->writeHTMLCell(30, '', '', '', '
' . $_COOKIE['shipping'] . '
', 0, 1, 0, true, '', true); $pdf->writeHTMLCell(150, '', '', '', '
Galutinė kaina:
', 0, 0, 0, true, '', true); $pdf->writeHTMLCell(30, '', '', '', '
' . sprintf("%01.2f", (float)$total+$_COOKIE['shipping']) . ' €
', 0, 1, 0, true, '', true); $doc=$pdf->Output('doc.pdf', 'S'); $email=new PHPMailer; $email2=new PHPMailer; $email->CharSet = 'UTF-8'; // $email->From = $pages->get(1)->email; $email->From = 'hdd741@gmail.lt'; $email->FromName = 'Oakywood'; $email->Subject = 'Užsakymas įvykdytas'; $email->Body = 'Prie laiško yra prisegtas užsakymo PDF failas'; $email->AddAddress($_POST['email']); $email2->CharSet = 'UTF-8'; // $email->From = $pages->get(1)->email; $email2->From = 'hdd741@gmail.lt'; $email2->FromName = 'Oakywood'; $email2->Subject = 'Užsakymas įvykdytas'; $email2->Body = 'Prie laiško yra prisegtas užsakymo PDF failas'; // $email2->AddAddress($pages->get(1)->email); $email2->AddAddress('povilas.vinikas1337@gmail.com'); $email2->AddStringAttachment($doc, 'doc.pdf'); $email->AddStringAttachment($doc, 'doc.pdf'); if ($email->send()) { $email2->send(); echo "

Užsakymas išsiųstas

"; setcookie('cart', '', time() - 3600, '/'); header( "refresh:3;url=/" ); } else { echo "

Įvyko klaida siunčiant užsakymą. Bandykite iš naujo.

"; } } include(\ProcessWire\wire('files')->compile(\ProcessWire\wire("config")->paths->root . "site/templates/header.php",array('includes'=>true,'namespace'=>true,'modules'=>true,'skipIfNamespace'=>true))); ?>

Atsiskaitymo informacija

Jūsų užsakymas

Prekė

Kaina


price * $item->quantity; $total += $itemTotal; ?>

x


get(1039)->shipping_cost; ?>

Siuntimo kaina

2.50 €


Iš viso

compile(\ProcessWire\wire("config")->paths->root . "site/templates/footer.php",array('includes'=>true,'namespace'=>true,'modules'=>true,'skipIfNamespace'=>true))); ?>