include_once 'lib\\barcode\\code128.class.php'; $thistext = htmlspecialchars($myrow[0]); // // FIXME: (AJH) The font could be an issue, as we have no idea where the fonts reside. // If windows, the above should work, if Linux, anything might happen. // I should fix this by standardising this and the disk usage font, or including a local font. // $thisfont = 'c:\\windows\\fonts\\verdana.ttf'; $thisimagename = 'barcode.png'; $barcode = new phpCode128($thistext, 120, $thisfont, 18); $barcode->setBorderWidth(1); $barcode->setBorderSpacing(10); $barcode->setPixelWidth(1); $barcode->setEanStyle(true); $barcode->setShowText(true); $barcode->setAutoAdjustFontSize(true); $barcode->setTextSpacing(5); // $barcode->setEanStyle(false); // $barcode->setShowText(true); $barcode->saveBarcode($thisimagename); echo "<img src='" . $thisimagename . "'><tr>"; // } } } else { echo htmlspecialchars($query_array["name"]); } if (isset($_REQUEST["headline_addition"])) { echo htmlspecialchars($_REQUEST["headline_addition"]); } echo "</td></tr></table>\n";
$barcode->saveBarcode('5.png'); echo "<h3>Not using EAN style and hiding the text</h3>"; echo "<p>setEanStyle and setShowText set to false</p>"; echo '<pre> $barcode->setBorderWidth(2); $barcode->setBorderSpacing(10); $barcode->setPixelWidth(2); $barcode->setEanStyle(false); $barcode->setShowText(false); $barcode->setAutoAdjustFontSize(true); $barcode->setTextSpacing(5); </pre>'; echo "<img src='5.png'>"; echo "<hr />"; $barcode = new phpCode128('mikeleigh.com', 150, 'c:\\windows\\fonts\\verdana.ttf', 18); $barcode->setAutoAdjustFontSize(false); $barcode->saveBarcode('6.png'); echo "<h3>Not using auto adjusting font size</h3>"; echo "<p>setAutoAdjustFontSize set to false</p>"; echo '<pre> $barcode->setBorderWidth(2); $barcode->setBorderSpacing(10); $barcode->setPixelWidth(2); $barcode->setEanStyle(true); $barcode->setShowText(true); $barcode->setAutoAdjustFontSize(false); $barcode->setTextSpacing(5); </pre>'; echo "<img src='6.png'>"; echo "<hr />"; $barcode = new phpCode128('mikeleigh.com', 150, 'c:\\windows\\fonts\\verdana.ttf', 18);
/** * Ens torna el codi HTML del document per imprimir quan tenim una matrícula amb pagament en metàl·lic per caixer. * */ public static function DocMatriculaPagamentCaixer($OM, $idS) { $inici = OptionsPeer::getString('PAG_CAIXER_CODI_OP', $idS); $entitat = OptionsPeer::getString('PAG_CAIXER_CODI_ENTITAT', $idS); $referencia = str_pad(strval($OM->getIdmatricules()), 11, '0', STR_PAD_LEFT); //Càlcul de valor de check $ponderacions = array(10 => 2, 9 => 3, 8 => 4, 7 => 5, 6 => 6, 5 => 7, 4 => 8, 3 => 9, 2 => 2, 1 => 3, 0 => 4); $tot = 0; for ($i = 10; $i >= 0; $i--) { $tot += $referencia[$i] * $ponderacions[$i]; } $cc = $tot % 11; if ($cc == 10) { $cc = 0; } //Afegim el valor de check a la referència i seguim. $referencia .= $cc; $import = str_pad(strval($OM->getPagat() * 100), 10, '0', STR_PAD_LEFT); $codi = $inici . $entitat . $referencia . $import; $barcode = new phpCode128($codi, 150, false, false); $barcode->setEanStyle(true); $barcode->setAutoAdjustFontSize(true); $barcode->saveBarcode(OptionsPeer::getString('SF_WEBSYSROOT', 1) . 'tmp/' . $idS . '-barcode.png'); //Comença la càrrega d'informació. $i = 1; $HTML = OptionsPeer::getString('BODY_DOC_MATR_CAIXER', $idS); //CONSULTEM USUARI $OU = UsuarisPeer::retrieveByPK($OM->getUsuarisusuariid()); $OC = CursosPeer::retrieveByPK($OM->getCursosidcursos()); $HTML = str_replace('@@LOGO_URL@@', OptionsPeer::getString('LOGO_URL', $idS), $HTML); $HTML = str_replace('@@CODI_BARRES@@', $idS, $HTML); $HTML = str_replace('@@TIPUS_PAGAMENT@@', $OM->getTpagamentString(), $HTML); $HTML = str_replace('@@CODI@@', $codi, $HTML); $HTML = str_replace('@@ENTITAT@@', $entitat, $HTML); $HTML = str_replace('@@REFERENCIA@@', $referencia, $HTML); $HTML = str_replace('@@IMPORT@@', $OM->getPagat() . '€', $HTML); $HTML = str_replace('@@FACTURA@@', $OM->getIdmatricules(), $HTML); $HTML = str_replace('@@CODI_CLIENT@@', $OM->getUsuarisusuariid(), $HTML); $HTML = str_replace('@@DATA_FACTURA@@', $OM->getDatainscripcio('d/m/Y'), $HTML); $HTML = str_replace('@@NOM@@', $OU->getNomComplet(), $HTML); $HTML = str_replace('@@TELEFON@@', $OU->getTelefonString(), $HTML); $HTML = str_replace('@@NIF@@', $OU->getDni(), $HTML); $HTML = str_replace('@@CARRER@@', $OU->getAdreca(), $HTML); $HTML = str_replace('@@POBLE@@', $OU->getPoblacioString(), $HTML); $HTML = str_replace('@@CODI_POSTAL@@', $OU->getCodipostal(), $HTML); $HTML = str_replace('@@CONCEPTE@@', $OC->getTitolcurs(), $HTML); $HTML = str_replace('@@DIA@@', $OC->getDatainici('d/m/Y'), $HTML); $HTML = str_replace('@@HORARIS@@', $OC->getHoraris(), $HTML); $HTML = str_replace('@@P@@', $OM->getPagat(), $HTML); $HTML = str_replace('@@Q@@', 1, $HTML); $HTML = str_replace('@@I@@', $OM->getPagat(), $HTML); $HTML = str_replace('@@BASE@@', $OM->getPagat(), $HTML); $HTML = str_replace('@@IVA@@', 0, $HTML); $HTML = str_replace('@@TOTAL@@', $OM->getPagat(), $HTML); $HTML = str_replace('@@TITULAR@@', $OM->getTitularDB(), $HTML); $HTML = str_replace('@@CCC@@', $OM->getCcc(), $HTML); return $HTML; }
/** * Aquest document és una entrada * */ public static function DocReservaEntrades($OER, $idS) { $inici = OptionsPeer::getString('PAG_CAIXER_CODI_OP', $idS); $entitat = OptionsPeer::getString('PAG_CAIXER_CODI_ENTITAT', $idS); $referencia = str_pad(strval($OER->getIdentrada()), 11, '0', STR_PAD_LEFT); //Càlcul de valor de check $ponderacions = array(10 => 2, 9 => 3, 8 => 4, 7 => 5, 6 => 6, 5 => 7, 4 => 8, 3 => 9, 2 => 2, 1 => 3, 0 => 4); $tot = 0; for ($i = 10; $i >= 0; $i--) { $tot += $referencia[$i] * $ponderacions[$i]; } $cc = $tot % 11; if ($cc == 10) { $cc = 0; } //Afegim el valor de check a la referència i seguim. $referencia .= $cc; $import = str_pad(strval($OER->getPagat() * 100), 10, '0', STR_PAD_LEFT); $codi = $inici . $entitat . $referencia . $import; $barcode = new phpCode128($codi, 150, false, false); $barcode->setEanStyle(true); $barcode->setAutoAdjustFontSize(true); $barcode->saveBarcode(OptionsPeer::getString('SF_WEBSYSROOT', 1) . 'tmp/' . $idS . '-barcode.png'); //Comença la càrrega d'informació. $i = 1; $HTML = OptionsPeer::getString('BODY_DOC_ENTRADA_CAIXER', $idS); $OH = $OER->getHorari(); $OA = $OH->getActivitatss(); //CONSULTEM USUARI $HTML = str_replace('@@LOGO_URL@@', OptionsPeer::getString('LOGO_URL', $idS), $HTML); $HTML = str_replace('@@CODI_BARRES@@', $idS, $HTML); $HTML = str_replace('@@CODI@@', $codi, $HTML); $HTML = str_replace('@@CONCEPTE@@', $OA->getTmig(), $HTML); $HTML = str_replace('@@DIA@@', $OH->getDia('d/m/Y'), $HTML); $HTML = str_replace('@@HORARIS@@', $OH->getHorainici('H:i'), $HTML); $HTML = str_replace('@@P@@', $OER->getPagat() / $OER->getQuantitat(), $HTML); $HTML = str_replace('@@Q@@', $OER->getQuantitat(), $HTML); $HTML = str_replace('@@I@@', $OER->getPagat(), $HTML); $HTML = str_replace('@@BASE@@', $OER->getPagat(), $HTML); $HTML = str_replace('@@IVA@@', 0, $HTML); $HTML = str_replace('@@TOTAL@@', $OER->getPagat(), $HTML); $HTML = str_replace('@@DESCOMPTE@@', $OER->getDescompteString(), $HTML); $HTML = str_replace('@@CODI_UNIC@@', substr(sha1($OER->getIdentrada()), 0, 4), $HTML); return $HTML; }