3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php // ------------------------------------------------------------------------------------------------- // posbirame vsechna prijata data z formulare (../kalkulace.php) - doplnit if isset // info o zakazce $oid = $_GET['offerIdNo']; $of = $_GET['offerName']; $ev = $_GET['eventName']; $arsum = $_GET['summaryArea']; // ucastnik - dodavatel $supName = $_GET['supplierName']; $supAddr = $_GET['supplierAddress']; $supTel = $_GET['supplierTelContact']; $supEmail = $_GET['supplierEmail']; $supIco = $_GET['supplierIco']; $supDic = $_GET['supplierDic']; $supNote = $_GET['supplierNotes']; // ucastnik - klient $clName = $_GET['clientName']; $clAddr = $_GET['clientAddress']; $clTel = $_GET['clientTelContact']; $clEmail = $_GET['clientEmail']; $clIco = $_GET['clientIco']; $clDic = $_GET['clientDic']; $clNote = $_GET['clientNotes']; // polozky jednotlivych sekci // material polozka $matn = $_GET['materialItemName']; $matup = $_GET['materialUnitPrice']; $matq = $_GET['materialItemQuantity']; $matut = $_GET['materialUnitType']; $matic = $_GET['materialItemCoeff']; $matipnv = $_GET['materialItemPriceNoVat']; $mativ = $_GET['materialItemVat']; $matisv = $_GET['materialItemSumVat']; $matipiv = $_GET['materialPriceInVat']; // montazni prace polozka $servn = $_GET['serviceItemName']; $servup = $_GET['serviceUnitPrice']; $servq = $_GET['serviceItemQuantity']; $servut = $_GET['serviceUnitType']; $servic = $_GET['serviceItemCoeff']; $servipnv = $_GET['serviceItemPriceNoVat']; $serviv = $_GET['serviceItemVat']; $servisv = $_GET['serviceItemSumVat']; $servipiv = $_GET['servicePriceInVat']; // vedlejsi rozpoctove naklady polozka $ocn = $_GET['otherCostsItemName']; $ocup = $_GET['otherCostsUnitPrice']; $ocq = $_GET['otherCostsItemQuantity']; $ocut = $_GET['otherCostsUnitType']; $ocic = $_GET['otherCostsItemCoeff']; $ocipnv = $_GET['otherCostsItemPriceNoVat']; $ociv = $_GET['otherCostsItemVat']; $ocisv = $_GET['otherCostsItemSumVat']; $ocipiv = $_GET['otherCostsPriceInVat']; // celkove sumy sekci bez a vcetne DPH $matAllNoVat = $_GET['materialAllPriceNoVat']; $matAllVat = $_GET['materialAllPriceVat']; $matAllInVat = $_GET['materialAllPriceInVat']; $servAllNoVat = $_GET['serviceAllPriceNoVat']; $servAllVat = $_GET['serviceAllPriceVat']; $servAllInVat = $_GET['serviceAllPriceInVat']; $ocAllNoVat = $_GET['otherCostsPriceNoVat']; $ocAllVat = $_GET['otherCostsPriceVat']; $ocAllInVat = $_GET['otherCostsPriceInVat']; // celkovy rozpocet bez a vcetne DPH $totBudNoVat = $_GET['totalBudgetValueNoVat']; $totBudSVat = $_GET['totalBudgetSumVat']; $totBudInVat = $_GET['totalBudgetValueInVat']; // ------------------------------------------------------------------------------------------------- // pripojime knihovnu tcpdf, s jejiz pomoci budeme vykreslovani ovladat, je doporuceno require_once require_once('tcpdf.php'); // ------------------------------------------------------------------------------------------------- // tridy class pdf extends TCPDF { // hlavicka + funkce pozadi stranky public function Header() { // ziskame aktualni sirku, $bMargin = $this->getBreakMargin(); // automaticky radkujeme, $auto_page_break = $this->AutoPageBreak; // automaticke odsazeni nechceme. $this->SetAutoPageBreak(false, 0); // vlozime soubor s pozadim stranky, $pozadi_uvod = 'body.jpg'; // roztahneme tento obrazek na celou obrazovku $this->Image($pozadi_uvod, 0, 0, 210, 297, '', '', '', false, 300, '', false, false, 0); } } // ------------------------------------------------------------------------------------------------- // vytvorime novy pdf dokument a prednastavime vlastnosti jako orientace, format A4, kodovani atd. $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf->SetCreator('Patrik Sokol'); $pdf->SetAuthor('SUKUP parkety'); $pdf->SetTitle('Cenova nabidka c. '.$oid); $pdf->SetSubject($of.' - '.$ev); // nastavime okraje $pdf->SetMargins(10, 10, 10); $pdf->SetHeaderMargin(0); $pdf->SetFooterMargin(0); // vratime se k nastaveni automatickeho odsazeni $pdf->SetAutoPageBreak(false, PDF_MARGIN_BOTTOM); // nastavime meritko (velikost) obrazku $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); // ------------------------------------------------------------------------------------------------- // nastaveni hlavniho fontu $pdf->SetFont('dejavusans', '', 12); $pdf->SetMargins(20,40); // ************************************************************************************************* // A ZACINAME UVODNI STRANKOU... // pridame novou stranku $pdf->AddPage(); // uvodni informace $uvod = '<span stroke="0.7" fill="true" strokecolor="rgb(89,67,32)" color="white" style="font-weight:bold;font-size:42pt;text-align:center;margin-bottom:100px;">'.$of.'</span><br /><br /><br /><br /><br /> <span stroke="0.5" fill="true" strokecolor="white" color="rgb(0,67,0)" style="font-weight:bold;font-size:32pt;text-align:center;">'.$ev.'</span><br /><br /><br /><br /><br /> <span style="text-align:center">celkova vymera podlahovych ploch:</span> <span style="font-size:32pt;color:maroon;">'.$arsum.'</span> <span style="text-align:center">m<sup>2</sup></span><br /><br /><br /><br /><br />'; $pdf->writeHTML($uvod, true, false, true, false, ''); // zucastneni - dodavatel a klient $ucastnici = '<table style="width:100%;text-align:center;" cellpadding="5"> <tr> <th></th> <th style="font-weight:bold;text-decoration:underline;">Dodavatel:</th> <th style="font-weight:bold;text-decoration:underline;">Objednatel:</th> </tr> <tr> <td style="font-style:italic;font-size:10pt;">jmeno:</td> <td>'.$supName.'</td> <td>'.$clName.'</td> </tr> <tr> <td style="font-style:italic;font-size:10pt;">adresa/sidlo:</td> <td>'.$supAddr.'</td> <td>'.$clAddr.'</td> </tr> <tr> <td style="font-style:italic;font-size:10pt;">tel. kontakt:</td> <td>'.$supTel.'</td> <td>'.$clTel.'</td> </tr> <tr> <td style="font-style:italic;font-size:10pt;">email:</td> <td>'.$supEmail.'</td> <td>'.$clEmail.'</td> </tr> <tr> <td style="font-style:italic;font-size:10pt;">ICO:</td> <td>'.$supIco.'</td> <td>'.$clIco.'</td> </tr> <tr> <td style="font-style:italic;font-size:10pt;">DIC:</td> <td>'.$supDic.'</td> <td>'.$clDic.'</td> </tr> <tr> <td style="font-style:italic;font-size:10pt;">poznamka:</td> <td>'.$supNote.'</td> <td>'.$clNote.'</td> </tr> </table>'; $pdf->writeHTML($ucastnici, true, false, true, false, ''); // ************************************************************************************************* // POKRACUJE VYPIS MATERIALOVYCH POLOZEK $pdf->AddPage(); $pdf->SetAutoPageBreak(true, PDF_MARGIN_BOTTOM); // nadpis material $material_uvod = '<span style="font-weight:bold;font-size:28pt;">Rozpis materialu na zakazku:</span>'; $pdf->writeHTML($material_uvod, true, false, true, false, ''); $material_table_ths = '<table><tr><th>nazev</th><th>jedn.cena</th><th>mnozstvi</th><th>jednotka</th><th>koeficient</th></tr><tr><th>celkem bez dph</th><th>dph sazba</th><th>celkem dph</th><th>celkem s dph</th>'; $pdf->writeHTML($material_table_ths, true, false, true, false, ''); $material_vypis_dat = ''; foreach( $matn as $key => $matn ) { $material_vypis_dat = "<table><tr><td>". $matn."</td><td>". $matup[$key]."</td><td>". $matq[$key]."</td><td>". $matut[$key]."</td><td>". $matic[$key]."</td></tr><tr><td>". $matipnv[$key]."</td><td>". $mativ[$key]."</td><td>". $matisv[$key]."</td><td>". $matipiv[$key]."</td></tr></table> <br />"; } $pdf->writeHTML($material_vypis_dat, true, false, true, false, ''); $material_konec = '<span style="font-weight:bold;">konec</span>'; $pdf->writeHTML($material_konec, true, false, true, false, ''); // ************************************************************************************************* // POKRACUJE VYPIS MONTAZNICH PRACI // nadpis montazni prace $montaze_uvod = '<span style="font-weight:bold;font-size:28pt;">Montazni prace spojene se zakazkou:</span>'; $pdf->writeHTML($montaze_uvod, true, false, true, false, ''); $montaze_vypis_dat = ''; foreach( $servn as $key => $servn ) { $montaze_vypis_dat .= "Nazev ".$servn. "Jednotkova cena ".$servup[$key]. "Mnozstvi ".$servq[$key]. "Jednotka ".$servut[$key]. "Koeficient ".$servic[$key]. "Celkem bez DPH ".$servipnv[$key]. "DPH sazba ".$serviv[$key]. "DPH celkem ".$servisv[$key]. "Celkem s DPH ".$servipiv[$key]. "<br /><br />"; } $pdf->writeHTML($montaze_vypis_dat, true, false, true, false, ''); // ************************************************************************************************* // POKRACUJE VYPIS VRN // nadpis vedlejsi rozpoctove naklady $vrn_uvod = '<span style="font-weight:bold;font-size:28pt;">Vedlejsi rozpoctove naklady:</span>'; $pdf->writeHTML($vrn_uvod, true, false, true, false, ''); $vedlejsi_naklady_vypis_dat = ''; foreach( $ocn as $key => $ocn ) { $vedlejsi_naklady_vypis_dat .= "Nazev ".$ocn. "Jednotkova cena ".$ocup[$key]. "Mnozstvi ".$ocq[$key]. "Jednotka ".$ocut[$key]. "Koeficient ".$ocic[$key]. "Celkem bez DPH ".$ocipnv[$key]. "DPH sazba ".$ociv[$key]. "DPH celkem ".$ocisv[$key]. "Celkem s DPH ".$ocipiv[$key]. "<br /><br />"; } $pdf->writeHTML($vedlejsi_naklady_vypis_dat, true, false, true, false, ''); // ************************************************************************************************* // BLIZIME SE KE KONCI, BUDEME VYPLNOVAT SUMY CELKOVEHO ROZPOCTU // pridame stranku $pdf->AddPage(); $finishing = '<table style="width:100%;text-align:center;" cellpadding="5"> <tr> <th></th> <th style="font-weight:bold;text-decoration:underline;">bez DPH:</th> <th></th> <th style="font-weight:bold;text-decoration:underline;">DPH:</th> <th></th> <th style="font-weight:bold;text-decoration:underline;">vc. DPH:</th> <th></th> </tr> <tr> <td style="font-style:italic;font-size:10pt;">material:</td> <td>'.$matAllNoVat.'</td> <td style="font-style:italic;font-size:10pt;">,- kc</td> <td>'.$matAlVat.'</td> <td style="font-style:italic;font-size:10pt;">,- kc</td> <td>'.$matAllInVat.'</td> <td style="font-style:italic;font-size:10pt;">,- kc</td> </tr> <tr> <td style="font-style:italic;font-size:10pt;">montazni prace:</td> <td>'.$servAllNoVat.'</td> <td style="font-style:italic;font-size:10pt;">,- kc</td> <td>'.$servAllVat.'</td> <td style="font-style:italic;font-size:10pt;">,- kc</td> <td>'.$servAllInVat.'</td> <td style="font-style:italic;font-size:10pt;">,- kc</td> </tr> <tr> <td style="font-style:italic;font-size:10pt;">vedlejsi rozpoctove naklady:</td> <td>'.$obcAllNoVat.'</td> <td style="font-style:italic;font-size:10pt;">,- kc</td> <td>'.$obcAllVat.'</td> <td style="font-style:italic;font-size:10pt;">,- kc</td> <td>'.$obcAllInVat.'</td> <td style="font-style:italic;font-size:10pt;">,- kc</td> </tr> </table> <table style="width:100%;text-align:center;font-size:24pt;border-top:1px solid;" cellpadding="5"> <tr> <td style="font-style:italic;font-size:10pt;">celkovy rozpocet:</td> <td>'.$totBudNoVat.'</td> <td style="font-style:italic;font-size:10pt;">,- kc</td> <td>'.$totBudSVat.'</td> <td style="font-style:italic;font-size:10pt;">,- kc</td> <td>'.$totBudInVat.'</td> <td style="font-style:italic;font-size:10pt;">,- kc</td> </tr> </table>'; $pdf->writeHTML($finishing, true, false, true, false, ''); // ------------------------------------------------------------------------------------------------- // ------------------------------------------------------------------------------------------------- // na samotny zaver si zvolime nazev souboru .pdf, jeho umisteni a zpusob jeho generace (manualne, automaticky, atd). Urcite lze take vytvorit emailovou sablonu, ktera se zasle automaticky $pdf->Output('cenova-nabidka-'.$_POST['offerIdNo'].'.pdf', 'I'); /* NEJAKE NAPOVEDY A POMOCNICI, TEST, SCRIPT, atd... */ /* ?OUTPUT I: send the file inline to the browser (default). The plug-in is used if available. The name given by name is used when one selects the "Save as" option on the link generating the PDF. D: send to the browser and force a file download with the name given by name. F: save to a local server file with the name given by name. S: return the document as a string (name is ignored). FI: equivalent to F + I option FD: equivalent to F + D option E: return the document as base64 mime multi-part email attachment (RFC 2045)*/ /* ?IMAGE image - source, x, y, w, h, type, link, align, resize, dpi, palign, ismask, imgmask, border*/
Output for 5.3.0 - 5.6.28, 7.0.0 - 7.1.0
Notice: Undefined index: offerIdNo in /in/3Fd7E on line 7 Notice: Undefined index: offerName in /in/3Fd7E on line 8 Notice: Undefined index: eventName in /in/3Fd7E on line 9 Notice: Undefined index: summaryArea in /in/3Fd7E on line 10 Notice: Undefined index: supplierName in /in/3Fd7E on line 12 Notice: Undefined index: supplierAddress in /in/3Fd7E on line 13 Notice: Undefined index: supplierTelContact in /in/3Fd7E on line 14 Notice: Undefined index: supplierEmail in /in/3Fd7E on line 15 Notice: Undefined index: supplierIco in /in/3Fd7E on line 16 Notice: Undefined index: supplierDic in /in/3Fd7E on line 17 Notice: Undefined index: supplierNotes in /in/3Fd7E on line 18 Notice: Undefined index: clientName in /in/3Fd7E on line 20 Notice: Undefined index: clientAddress in /in/3Fd7E on line 21 Notice: Undefined index: clientTelContact in /in/3Fd7E on line 22 Notice: Undefined index: clientEmail in /in/3Fd7E on line 23 Notice: Undefined index: clientIco in /in/3Fd7E on line 24 Notice: Undefined index: clientDic in /in/3Fd7E on line 25 Notice: Undefined index: clientNotes in /in/3Fd7E on line 26 Notice: Undefined index: materialItemName in /in/3Fd7E on line 29 Notice: Undefined index: materialUnitPrice in /in/3Fd7E on line 30 Notice: Undefined index: materialItemQuantity in /in/3Fd7E on line 31 Notice: Undefined index: materialUnitType in /in/3Fd7E on line 32 Notice: Undefined index: materialItemCoeff in /in/3Fd7E on line 33 Notice: Undefined index: materialItemPriceNoVat in /in/3Fd7E on line 34 Notice: Undefined index: materialItemVat in /in/3Fd7E on line 35 Notice: Undefined index: materialItemSumVat in /in/3Fd7E on line 36 Notice: Undefined index: materialPriceInVat in /in/3Fd7E on line 37 Notice: Undefined index: serviceItemName in /in/3Fd7E on line 39 Notice: Undefined index: serviceUnitPrice in /in/3Fd7E on line 40 Notice: Undefined index: serviceItemQuantity in /in/3Fd7E on line 41 Notice: Undefined index: serviceUnitType in /in/3Fd7E on line 42 Notice: Undefined index: serviceItemCoeff in /in/3Fd7E on line 43 Notice: Undefined index: serviceItemPriceNoVat in /in/3Fd7E on line 44 Notice: Undefined index: serviceItemVat in /in/3Fd7E on line 45 Notice: Undefined index: serviceItemSumVat in /in/3Fd7E on line 46 Notice: Undefined index: servicePriceInVat in /in/3Fd7E on line 47 Notice: Undefined index: otherCostsItemName in /in/3Fd7E on line 49 Notice: Undefined index: otherCostsUnitPrice in /in/3Fd7E on line 50 Notice: Undefined index: otherCostsItemQuantity in /in/3Fd7E on line 51 Notice: Undefined index: otherCostsUnitType in /in/3Fd7E on line 52 Notice: Undefined index: otherCostsItemCoeff in /in/3Fd7E on line 53 Notice: Undefined index: otherCostsItemPriceNoVat in /in/3Fd7E on line 54 Notice: Undefined index: otherCostsItemVat in /in/3Fd7E on line 55 Notice: Undefined index: otherCostsItemSumVat in /in/3Fd7E on line 56 Notice: Undefined index: otherCostsPriceInVat in /in/3Fd7E on line 57 Notice: Undefined index: materialAllPriceNoVat in /in/3Fd7E on line 59 Notice: Undefined index: materialAllPriceVat in /in/3Fd7E on line 60 Notice: Undefined index: materialAllPriceInVat in /in/3Fd7E on line 61 Notice: Undefined index: serviceAllPriceNoVat in /in/3Fd7E on line 62 Notice: Undefined index: serviceAllPriceVat in /in/3Fd7E on line 63 Notice: Undefined index: serviceAllPriceInVat in /in/3Fd7E on line 64 Notice: Undefined index: otherCostsPriceNoVat in /in/3Fd7E on line 65 Notice: Undefined index: otherCostsPriceVat in /in/3Fd7E on line 66 Notice: Undefined index: otherCostsPriceInVat in /in/3Fd7E on line 67 Notice: Undefined index: totalBudgetValueNoVat in /in/3Fd7E on line 69 Notice: Undefined index: totalBudgetSumVat in /in/3Fd7E on line 70 Notice: Undefined index: totalBudgetValueInVat in /in/3Fd7E on line 71 Warning: require_once(tcpdf.php): failed to open stream: No such file or directory in /in/3Fd7E on line 76 Fatal error: require_once(): Failed opening required 'tcpdf.php' (include_path='.:') in /in/3Fd7E on line 76
Process exited with code 255.
Output for hhvm-3.10.0 - 3.12.0
Notice: Undefined index: offerIdNo in /in/3Fd7E on line 7 Notice: Undefined index: offerName in /in/3Fd7E on line 8 Notice: Undefined index: eventName in /in/3Fd7E on line 9 Notice: Undefined index: summaryArea in /in/3Fd7E on line 10 Notice: Undefined index: supplierName in /in/3Fd7E on line 12 Notice: Undefined index: supplierAddress in /in/3Fd7E on line 13 Notice: Undefined index: supplierTelContact in /in/3Fd7E on line 14 Notice: Undefined index: supplierEmail in /in/3Fd7E on line 15 Notice: Undefined index: supplierIco in /in/3Fd7E on line 16 Notice: Undefined index: supplierDic in /in/3Fd7E on line 17 Notice: Undefined index: supplierNotes in /in/3Fd7E on line 18 Notice: Undefined index: clientName in /in/3Fd7E on line 20 Notice: Undefined index: clientAddress in /in/3Fd7E on line 21 Notice: Undefined index: clientTelContact in /in/3Fd7E on line 22 Notice: Undefined index: clientEmail in /in/3Fd7E on line 23 Notice: Undefined index: clientIco in /in/3Fd7E on line 24
Process exited with code 255.