function get_printable_timeSheet_file($timeSheetID, $timeSheetPrintMode, $printDesc, $format) { global $TPL; $TPL["timeSheetID"] = $timeSheetID; $TPL["timeSheetPrintMode"] = $timeSheetPrintMode; $TPL["printDesc"] = $printDesc; $TPL["format"] = $format; $db = new db_alloc(); if ($timeSheetID) { $timeSheet = new timeSheet(); $timeSheet->set_id($timeSheetID); $timeSheet->select(); $timeSheet->set_tpl_values(); $person = $timeSheet->get_foreign_object("person"); $TPL["timeSheet_personName"] = $person->get_name(); $timeSheet->set_tpl_values("timeSheet_"); // Display the project name. $project = new project(); $project->set_id($timeSheet->get_value("projectID")); $project->select(); $TPL["timeSheet_projectName"] = $project->get_value("projectName", DST_HTML_DISPLAY); // Get client name $client = $project->get_foreign_object("client"); $client->set_tpl_values(); $TPL["clientName"] = $client->get_value("clientName", DST_HTML_DISPLAY); $TPL["companyName"] = config::get_config_item("companyName"); $TPL["companyNos1"] = config::get_config_item("companyACN"); $TPL["companyNos2"] = config::get_config_item("companyABN"); unset($br); $phone = config::get_config_item("companyContactPhone"); $fax = config::get_config_item("companyContactFax"); $phone and $TPL["phone"] = "Ph: " . $phone; $fax and $TPL["fax"] = "Fax: " . $fax; $timeSheet->load_pay_info(); $db->query(prepare("SELECT max(dateTimeSheetItem) AS maxDate\n ,min(dateTimeSheetItem) AS minDate\n ,count(timeSheetItemID) as count\n FROM timeSheetItem \n WHERE timeSheetID=%d ", $timeSheetID)); $db->next_record(); $timeSheet->set_id($timeSheetID); $timeSheet->select() || alloc_error("Unable to select time sheet, trying to use id: " . $timeSheetID); $TPL["period"] = format_date(DATE_FORMAT, $db->f("minDate")) . " to " . format_date(DATE_FORMAT, $db->f("maxDate")); $TPL["img"] = config::get_config_item("companyImage"); $TPL["companyContactAddress"] = config::get_config_item("companyContactAddress"); $TPL["companyContactAddress2"] = config::get_config_item("companyContactAddress2"); $TPL["companyContactAddress3"] = config::get_config_item("companyContactAddress3"); $email = config::get_config_item("companyContactEmail"); $email and $TPL["companyContactEmail"] = "Email: " . $email; $web = config::get_config_item("companyContactHomePage"); $web and $TPL["companyContactHomePage"] = "Web: " . $web; $TPL["footer"] = config::get_config_item("timeSheetPrintFooter"); $TPL["taxName"] = config::get_config_item("taxName"); $default_header = "Time Sheet"; $default_id_label = "Time Sheet ID"; $default_contractor_label = "Contractor"; $default_total_label = "TOTAL AMOUNT PAYABLE"; if ($timeSheetPrintMode == "money") { $default_header = "Tax Invoice"; $default_id_label = "Invoice Number"; } if ($timeSheetPrintMode == "estimate") { $default_header = "Estimate"; $default_id_label = "Estimate Number"; $default_contractor_label = "Issued By"; $default_total_label = "TOTAL AMOUNT ESTIMATED"; } if ($format != "html") { // Build PDF document $font1 = ALLOC_MOD_DIR . "util/fonts/Helvetica.afm"; $font2 = ALLOC_MOD_DIR . "util/fonts/Helvetica-Oblique.afm"; $pdf_table_options = array("showLines" => 0, "shaded" => 0, "showHeadings" => 0, "xPos" => "left", "xOrientation" => "right", "fontSize" => 10, "rowGap" => 0, "fontSize" => 10); $cols = array("one" => "", "two" => "", "three" => "", "four" => ""); $cols3 = array("one" => "", "two" => ""); $cols_settings["one"] = array("justification" => "right"); $cols_settings["three"] = array("justification" => "right"); $pdf_table_options2 = array("showLines" => 0, "shaded" => 0, "showHeadings" => 0, "width" => 400, "fontSize" => 10, "xPos" => "center", "xOrientation" => "center", "cols" => $cols_settings); $cols_settings2["gst"] = array("justification" => "right"); $cols_settings2["money"] = array("justification" => "right"); $pdf_table_options3 = array("showLines" => 2, "shaded" => 0, "width" => 400, "xPos" => "center", "fontSize" => 10, "cols" => $cols_settings2, "lineCol" => array(0.8, 0.8, 0.8), "splitRows" => 1, "protectRows" => 0); $cols_settings["two"] = array("justification" => "right", "width" => 80); $pdf_table_options4 = array("showLines" => 2, "shaded" => 0, "width" => 400, "showHeadings" => 0, "fontSize" => 10, "xPos" => "center", "cols" => $cols_settings, "lineCol" => array(0.8, 0.8, 0.8)); $pdf = new Cezpdf(); $pdf->ezSetMargins(90, 90, 90, 90); $pdf->selectFont($font1); $pdf->ezStartPageNumbers(436, 80, 10, 'right', 'Page {PAGENUM} of {TOTALPAGENUM}'); $pdf->ezStartPageNumbers(200, 80, 10, 'left', '<b>' . $default_id_label . ': </b>' . $TPL["timeSheetID"]); $pdf->ezSetY(775); $TPL["companyName"] and $contact_info[] = array($TPL["companyName"]); $TPL["companyContactAddress"] and $contact_info[] = array($TPL["companyContactAddress"]); $TPL["companyContactAddress2"] and $contact_info[] = array($TPL["companyContactAddress2"]); $TPL["companyContactAddress3"] and $contact_info[] = array($TPL["companyContactAddress3"]); $TPL["companyContactEmail"] and $contact_info[] = array($TPL["companyContactEmail"]); $TPL["companyContactHomePage"] and $contact_info[] = array($TPL["companyContactHomePage"]); $TPL["phone"] and $contact_info[] = array($TPL["phone"]); $TPL["fax"] and $contact_info[] = array($TPL["fax"]); $pdf->selectFont($font2); $y = $pdf->ezTable($contact_info, false, "", $pdf_table_options); $pdf->selectFont($font1); $line_y = $y - 10; $pdf->setLineStyle(1, "round"); $pdf->line(90, $line_y, 510, $line_y); $pdf->ezSetY(782); $image_jpg = ALLOC_LOGO; if (file_exists($image_jpg)) { $pdf->ezImage($image_jpg, 0, sprintf("%d", config::get_config_item("logoScaleX")), 'none'); $y = 700; } else { $y = $pdf->ezText($TPL["companyName"], 27, array("justification" => "right")); } $nos_y = $line_y + 22; $TPL["companyNos2"] and $nos_y = $line_y + 34; $pdf->ezSetY($nos_y); $TPL["companyNos1"] and $y = $pdf->ezText($TPL["companyNos1"], 10, array("justification" => "right")); $TPL["companyNos2"] and $y = $pdf->ezText($TPL["companyNos2"], 10, array("justification" => "right")); $pdf->ezSetY($line_y - 20); $y = $pdf->ezText($default_header, 20, array("justification" => "center")); $pdf->ezSetY($y - 20); $ts_info[] = array("one" => "<b>" . $default_id_label . ":</b>", "two" => $TPL["timeSheetID"], "three" => "<b>Date Issued:</b>", "four" => date("d/m/Y")); $ts_info[] = array("one" => "<b>Client:</b>", "two" => $TPL["clientName"], "three" => "<b>Project:</b>", "four" => $TPL["timeSheet_projectName"]); $ts_info[] = array("one" => "<b>" . $default_contractor_label . ":</b>", "two" => $TPL["timeSheet_personName"], "three" => "<b>Billing Period:</b>", "four" => $TPL["period"]); if ($timeSheetPrintMode == "estimate") { // This line needs to be glued to the above line $temp = array_pop($ts_info); $temp["three"] = ""; // Nuke Billing Period for the Estimate version of the pdf. $temp["four"] = ""; // Nuke Billing Period for the Estimate version of the pdf. $ts_info[] = $temp; } $y = $pdf->ezTable($ts_info, $cols, "", $pdf_table_options2); $pdf->ezSetY($y - 20); if ($timeSheetPrintMode == "money" || $timeSheetPrintMode == "estimate") { list($rows, $info) = $this->get_timeSheetItem_list_money($TPL["timeSheetID"]); $cols2 = array("desc" => "Description", "units" => "Units", "money" => "Charges", "gst" => $TPL["taxName"]); $taxPercent = config::get_config_item("taxPercent"); if ($taxPercent === '') { unset($cols2["gst"]); } $rows[] = array("desc" => "<b>TOTAL</b>", "units" => $info["total_units"], "money" => $info["total"], "gst" => $info["total_gst"]); $y = $pdf->ezTable($rows, $cols2, "", $pdf_table_options3); $pdf->ezSetY($y - 20); if ($taxPercent !== '') { $totals[] = array("one" => "TOTAL " . $TPL["taxName"], "two" => $info["total_gst"]); } $totals[] = array("one" => "TOTAL CHARGES", "two" => $info["total"]); $totals[] = array("one" => "<b>" . $default_total_label . "</b>", "two" => "<b>" . $info["total_inc_gst"] . "</b>"); $y = $pdf->ezTable($totals, $cols3, "", $pdf_table_options4); } else { if ($timeSheetPrintMode == "units") { list($rows, $info) = $this->get_timeSheetItem_list_units($TPL["timeSheetID"]); $cols2 = array("desc" => "Description", "units" => "Units"); $rows[] = array("desc" => "<b>TOTAL</b>", "units" => "<b>" . $info["total"] . "</b>"); $y = $pdf->ezTable($rows, $cols2, "", $pdf_table_options3); } else { if ($timeSheetPrintMode == "items") { list($rows, $info) = $this->get_timeSheetItem_list_items($TPL["timeSheetID"]); $cols2 = array("date" => "Date", "units" => "Units", "multiplier_string" => "Multiplier", "desc" => "Description"); $rows[] = array("date" => "<b>TOTAL</b>", "units" => "<b>" . $info["total"] . "</b>"); $y = $pdf->ezTable($rows, $cols2, "", $pdf_table_options3); } } } $pdf->ezSetY($y - 20); $pdf->ezText(str_replace(array("<br>", "<br/>", "<br />"), "\n", $TPL["footer"]), 10); $pdf->ezStream(array("Content-Disposition" => "timeSheet_" . $timeSheetID . ".pdf")); // Else HTML format } else { if (file_exists(ALLOC_LOGO)) { $TPL["companyName"] = '<img alt="Company logo" src="' . $TPL["url_alloc_logo"] . '" />'; } $TPL["this_tsp"] = $this; $TPL["main_alloc_title"] = "Time Sheet - " . APPLICATION_NAME; include_template(dirname(__FILE__) . "/../templates/timeSheetPrintM.tpl"); } } }
function b_header(Cezpdf &$pdf, $partner_typ, $partner_id, $orientation = 'portrait', $font_file, $f_size, $logo_file = '') { $diff = array(196 => 'Adieresis', 228 => 'adieresis', 214 => 'Odieresis', 246 => 'odieresis', 220 => 'Udieresis', 252 => 'udieresis', 223 => 'germandbls'); $pdf->selectFont('Helvetica', array('encoding' => 'WinAnsiEncoding', 'differences' => $diff)); $all = $pdf->openObject(); $pdf->saveState(); $pdf->setStrokeColor(0, 0, 0, 1); if ($orientation == 'portrait') { $pdf->ezSetMargins(135, 70, 50, 50); if (!isset($_REQUEST['no_logo'])) { if ($logo_file == '') { $logo_file = BERLUS_PATH . "/print_css/{$partner_typ}/{$partner_id}" . "_logo.png"; } if (file_exists("{$logo_file}")) { $pdf->addPngFromFile("{$logo_file}", 200, 730, 200, 80); $pdf->line(43, 725, 545, 725); $pdf->line(42, 50, 550, 50); } } else { $logo_file = BERLUS_PATH . "/print_css/{$partner_typ}/{$partner_id}" . "_logo.png"; } $pdf->setLineStyle(0.5); $this->footer_info($partner_typ, $partner_id); $pdf->addText(43, 718, $f_size, "{$this->header_zeile}"); $pdf->ezStartPageNumbers(545, 715, $f_size, '', 'Seite {PAGENUM} von {TOTALPAGENUM}', 1); $pdf->setLineStyle(0.5); if (!isset($_REQUEST['no_logo'])) { $pdf->addText($pdf->ez['pageWidth'] / 2, 42, $f_size, "{$this->zeile1}", 0, 'center'); $pdf->addText($pdf->ez['pageWidth'] / 2, 35, $f_size, "{$this->zeile2}", 0, 'center'); } } else { $pdf->ezSetMargins(120, 40, 30, 30); $logo_file = BERLUS_PATH . "/print_css/{$partner_typ}/{$partner_id}" . "_logo.png"; if (file_exists("{$logo_file}")) { $pdf->addPngFromFile("{$logo_file}", 320, 505, 200, 80); } else { $pdf->addText(370, 505, $f_size, "Vorschau / Druckansicht "); } $pdf->setLineStyle(0.5); $this->footer_info($partner_typ, $partner_id); $pdf->line(43, 500, 785, 500); $pdf->addText(43, 493, $f_size, "{$this->header_zeile}"); $pdf->ezStartPageNumbers(783, 493, $f_size, '', 'Seite {PAGENUM} von {TOTALPAGENUM}', 1); $pdf->setLineStyle(0.5); $pdf->line(42, 30, 785, 30); $pdf->addText($pdf->ez['pageWidth'] / 2, 23, $f_size, "{$this->zeile1}", 0, 'center'); $pdf->addText($pdf->ez['pageWidth'] / 2, 16, $f_size, "{$this->zeile2}", 0, 'center'); } $pdf->restoreState(); $pdf->closeObject(); $pdf->addObject($all, 'all'); }
/** * Creates a PDF document and sends this pricelist to the client * * Unfortunately, ezpdf does not return anything after printing the * document, so there's no way to tell whether it has succeeded. * Thus, you should not rely on the return value, except when it is * false -- in that case, loading of some data failed. * @return boolean False on failure, true on supposed success */ function send_as_pdf() { global $objInit, $_ARRAYLANG; if (!$this->load()) { return \Message::error($_ARRAYLANG['TXT_SHOP_PRICELIST_ERROR_LOADING']); } $objPdf = new \Cezpdf('A4'); $objPdf->setEncryption('', '', array('print')); $objPdf->selectFont(\Cx\Core\Core\Controller\Cx::instanciate()->getCodeBaseLibraryPath() . '/ezpdf/fonts/' . $this->font); $objPdf->ezSetMargins(0, 0, 0, 0); // Reset margins $objPdf->setLineStyle(0.5); $marginTop = 30; $biggerCountTop = $biggerCountBottom = 0; $arrHeaderLeft = $arrHeaderRight = $arrFooterLeft = $arrFooterRight = array(); if ($this->header) { // header should be shown $arrHeaderLeft = explode("\n", $this->header_left); $arrHeaderRight = explode("\n", $this->header_right); $countLeft = count($arrHeaderLeft); $countRight = count($arrHeaderRight); $biggerCountTop = $countLeft > $countRight ? $countLeft : $countRight; $marginTop = $biggerCountTop * 14 + 36; } // Bottom margin $marginBottom = 20; $arrFooterRight = array(); if ($this->footer) { // footer should be shown // Old, obsolete: $this->footer_left = str_replace('<--DATE-->', date(ASCMS_DATE_FORMAT_DATE, time()), $this->footer_left); $this->footer_right = str_replace('<--DATE-->', date(ASCMS_DATE_FORMAT_DATE, time()), $this->footer_right); // New: $this->footer_left = str_replace('[DATE]', date(ASCMS_DATE_FORMAT_DATE, time()), $this->footer_left); $this->footer_right = str_replace('[DATE]', date(ASCMS_DATE_FORMAT_DATE, time()), $this->footer_right); $arrFooterLeft = explode("\n", $this->footer_left); $arrFooterRight = explode("\n", $this->footer_right); $countLeft = count($arrFooterLeft); $countRight = count($arrFooterRight); $biggerCountBottom = $countLeft > $countRight ? $countLeft : $countRight; $marginBottom = $biggerCountBottom * 20 + 20; } // Borders if ($this->border) { $linesForAllPages = $objPdf->openObject(); $objPdf->saveState(); $objPdf->setStrokeColor(0, 0, 0, 1); $objPdf->rectangle(10, 10, 575.28, 821.89); $objPdf->restoreState(); $objPdf->closeObject(); $objPdf->addObject($linesForAllPages, 'all'); } // Header $headerArray = array(); $startpointY = 0; if ($this->header) { $objPdf->ezSetY(830); $headerForAllPages = $objPdf->openObject(); $objPdf->saveState(); for ($i = 0; $i < $biggerCountTop; ++$i) { $headerArray[$i] = array('left' => isset($arrHeaderLeft[$i]) ? $arrHeaderLeft[$i] : '', 'right' => isset($arrHeaderRight[$i]) ? $arrHeaderRight[$i] : ''); } $tempY = $objPdf->ezTable($headerArray, '', '', array('showHeadings' => 0, 'fontSize' => $this->font_size_header, 'shaded' => 0, 'width' => 540, 'showLines' => 0, 'xPos' => 'center', 'xOrientation' => 'center', 'cols' => array('right' => array('justification' => 'right')))); $tempY -= 5; if ($this->border) { $objPdf->setStrokeColor(0, 0, 0); $objPdf->line(10, $tempY, 585.28, $tempY); } $startpointY = $tempY - 5; $objPdf->restoreState(); $objPdf->closeObject(); $objPdf->addObject($headerForAllPages, 'all'); } // Footer $pageNumbersX = $pageNumbersY = $pageNumbersFont = 0; if ($this->footer) { $footerForAllPages = $objPdf->openObject(); $objPdf->saveState(); $tempY = $marginBottom - 5; if ($this->border) { $objPdf->setStrokeColor(0, 0, 0); $objPdf->line(10, $tempY, 585.28, $tempY); } // length of the longest word $longestWord = 0; foreach ($arrFooterRight as $line) { if ($longestWord < strlen($line)) { $longestWord = strlen($line); } } for ($i = $biggerCountBottom - 1; $i >= 0; --$i) { if (empty($arrFooterLeft[$i])) { $arrFooterLeft[$i] = ''; } if (empty($arrFooterRight[$i])) { $arrFooterRight[$i] = ''; } if ($arrFooterLeft[$i] == '<--PAGENUMBER-->' || $arrFooterLeft[$i] == '[PAGENUMBER]') { $pageNumbersX = 65; $pageNumbersY = $tempY - 18 - $i * $this->font_size_footer; $pageNumbersFont = $this->font_size_list; } else { $objPdf->addText(25, $tempY - 18 - $i * $this->font_size_footer, $this->font_size_footer, $arrFooterLeft[$i]); } if ($arrFooterRight[$i] == '<--PAGENUMBER-->' || $arrFooterRight[$i] == '[PAGENUMBER]') { $pageNumbersX = 595.28 - 25; $pageNumbersY = $tempY - 18 - $i * $this->font_size_footer; $pageNumbersFont = $this->font_size_list; } else { // Properly align right $width = $objPdf->getTextWidth($this->font_size_footer, $arrFooterRight[$i]); $objPdf->addText(595.28 - $width - 25, $tempY - 18 - $i * $this->font_size_footer, $this->font_size_footer, $arrFooterRight[$i]); } } $objPdf->restoreState(); $objPdf->closeObject(); $objPdf->addObject($footerForAllPages, 'all'); } // Page numbers if (isset($pageNumbersX)) { $objPdf->ezStartPageNumbers($pageNumbersX, $pageNumbersY, $pageNumbersFont, '', $_ARRAYLANG['TXT_SHOP_PRICELIST_FORMAT_PAGENUMBER'], 1); } // Margins $objPdf->ezSetMargins($marginTop, $marginBottom, 30, 30); // Product table if (isset($startpointY)) { $objPdf->ezSetY($startpointY); } $objInit->backendLangId = $this->lang_id; $_ARRAYLANG = $objInit->loadLanguageData('Shop'); Currency::setActiveCurrencyId($this->currency_id); $currency_symbol = Currency::getActiveCurrencySymbol(); $category_ids = $this->category_ids(); if ($category_ids == '*') { $category_ids = null; } $count = 1000; // Be sensible! // Pattern is "%" because all-empty parameters will result in an // empty array! $arrProduct = Products::getByShopParams($count, 0, null, $category_ids, null, '%', null, null, '`category_id` ASC, `name` ASC'); $arrCategoryName = ShopCategories::getNameArray(); $arrOutput = array(); foreach ($arrProduct as $product_id => $objProduct) { $categoryIds = explode(',', $objProduct->category_id()); $arrCategoryNames = array(); foreach ($categoryIds as $categoryId) { $arrCategoryNames[] = $arrCategoryName[$categoryId]; } //$objProduct = new Product(); $arrOutput[$product_id] = array('product_name' => self::decode($objProduct->name()), 'category_name' => self::decode(implode(', ', $arrCategoryNames)), 'product_code' => self::decode($objProduct->code()), 'product_id' => self::decode($objProduct->id()), 'price' => ($objProduct->discount_active() ? "S " . Currency::formatPrice($objProduct->discountprice()) : Currency::formatPrice($objProduct->price())) . ' ' . $currency_symbol); } $objPdf->ezTable($arrOutput, array('product_name' => '<b>' . self::decode($_ARRAYLANG['TXT_SHOP_PRODUCT_NAME']) . '</b>', 'category_name' => '<b>' . self::decode($_ARRAYLANG['TXT_SHOP_CATEGORY_NAME']) . '</b>', 'product_code' => '<b>' . self::decode($_ARRAYLANG['TXT_SHOP_PRODUCT_CODE']) . '</b>', 'product_id' => '<b>' . self::decode($_ARRAYLANG['TXT_ID']) . '</b>', 'price' => '<b>' . self::decode($_ARRAYLANG['TXT_SHOP_PRICE']) . '</b>'), '', array('showHeadings' => 1, 'fontSize' => $this->font_size_list, 'width' => 530, 'innerLineThickness' => 0.5, 'outerLineThickness' => 0.5, 'shaded' => 2, 'shadeCol' => array(hexdec(substr($this->row_color_1, 0, 2)) / 255, hexdec(substr($this->row_color_1, 2, 2)) / 255, hexdec(substr($this->row_color_1, 4, 2)) / 255), 'shadeCol2' => array(hexdec(substr($this->row_color_2, 0, 2)) / 255, hexdec(substr($this->row_color_2, 2, 2)) / 255, hexdec(substr($this->row_color_2, 4, 2)) / 255), 'cols' => array('product_name' => array('width' => 255), 'category_name' => array('width' => 130), 'product_code' => array('width' => 50), 'product_id' => array('width' => 40, 'justification' => 'right'), 'price' => array('width' => 55, 'justification' => 'right')))); $objPdf->ezStream(); // Never reached return true; }
$cattotal = Category::load(0); $scoretotal = $cattotal[0]->calc_score($user_id); $scoretotal_display = isset($scoretotal) ? $scoredisplay->display_score($scoretotal, SCORE_PERCENT) : get_lang('NoResultsAvailable'); //prepare all necessary variables: $organization_name = api_get_setting('Institution'); $portal_name = api_get_setting('siteName'); $stud_fn = $user['firstname']; $stud_ln = $user['lastname']; $certif_text = sprintf(get_lang('CertificateWCertifiesStudentXFinishedCourseYWithGradeZ'), $organization_name, $stud_fn . ' ' . $stud_ln, $category[0]->get_name(), $scorecourse_display); $certif_text = str_replace("\\n", "\n", $certif_text); $date = api_convert_and_format_date(null, DATE_FORMAT_SHORT); $pdf = new Cezpdf('a4', 'landscape'); $pdf->selectFont(api_get_path(LIBRARY_PATH) . 'ezpdf/fonts/Courier.afm'); $pdf->ezSetMargins(30, 30, 50, 50); //line Y coordinates in landscape mode are upside down (500 is on top, 10 is on the bottom) $pdf->line(50, 50, 790, 50); $pdf->line(50, 550, 790, 550); $pdf->ezSetY(450); //@todo replace image //$pdf->ezImage(api_get_path(SYS_CODE_PATH).'img/dokeos_logo_certif.png',1,400,'','center',''); $pdf->ezSetY(480); $pdf->ezText($certif_text, 28, array('justification' => 'center')); //$pdf->ezSetY(750); $pdf->ezSetY(50); $pdf->ezText($date, 18, array('justification' => 'center')); $pdf->ezSetY(580); $pdf->ezText($organization_name, 22, array('justification' => 'left')); $pdf->ezSetY(580); $pdf->ezText($portal_name, 22, array('justification' => 'right')); $pdf->ezStream(); }
function dofreePDF() { global $mosConfig_live_site, $mosConfig_sitename, $mosConfig_offset; global $mainframe, $database, $my; $id = intval(mosGetParam($_REQUEST, 'id', 1)); $gid = $my->gid; $now = _CURRENT_SERVER_TIME; $nullDate = $database->getNullDate(); // query to check for state and access levels $query = "SELECT a.*, cc.name AS category, s.name AS section, s.published AS sec_pub, cc.published AS cat_pub," . "\n s.access AS sec_access, cc.access AS cat_access, s.id AS sec_id, cc.id as cat_id" . "\n FROM #__content AS a" . "\n LEFT JOIN #__categories AS cc ON cc.id = a.catid" . "\n LEFT JOIN #__sections AS s ON s.id = cc.section AND s.scope = 'content'" . "\n WHERE a.id = " . (int) $id . "\n AND a.state = 1" . "\n AND a.access <= " . (int) $gid . "\n AND ( a.publish_up = " . $database->Quote($nullDate) . " OR a.publish_up <= " . $database->Quote($now) . " )" . "\n AND ( a.publish_down = " . $database->Quote($nullDate) . " OR a.publish_down >= " . $database->Quote($now) . " )"; $database->setQuery($query); $row = NULL; if ($database->loadObject($row)) { /* * check whether category is published */ if (!$row->cat_pub && $row->catid) { mosNotAuth(); return; } /* * check whether section is published */ if (!$row->sec_pub && $row->sectionid) { mosNotAuth(); return; } /* * check whether category access level allows access */ if ($row->cat_access > $gid && $row->catid) { mosNotAuth(); return; } /* * check whether section access level allows access */ if ($row->sec_access > $gid && $row->sectionid) { mosNotAuth(); return; } include 'includes/class.ezpdf.php'; $params = new mosParameters($row->attribs); $params->def('author', !$mainframe->getCfg('hideAuthor')); $params->def('createdate', !$mainframe->getCfg('hideCreateDate')); $params->def('modifydate', !$mainframe->getCfg('hideModifyDate')); $row->fulltext = pdfCleaner($row->fulltext); $row->introtext = pdfCleaner($row->introtext); $pdf = new Cezpdf('a4', 'P'); //A4 Portrait $pdf->ezSetCmMargins(2, 1.5, 1, 1); $pdf->selectFont('./fonts/Helvetica.afm'); //choose font $all = $pdf->openObject(); $pdf->saveState(); $pdf->setStrokeColor(0, 0, 0, 1); // footer $pdf->addText(250, 822, 6, $mosConfig_sitename); $pdf->line(10, 40, 578, 40); $pdf->line(10, 818, 578, 818); $pdf->addText(30, 34, 6, $mosConfig_live_site); $pdf->addText(250, 34, 6, _PDF_POWERED); $pdf->addText(450, 34, 6, _PDF_GENERATED . ' ' . date('j F, Y, H:i', time() + $mosConfig_offset * 60 * 60)); $pdf->restoreState(); $pdf->closeObject(); $pdf->addObject($all, 'all'); $pdf->ezSetDy(30); $txt1 = $row->title; $pdf->ezText($txt1, 14); $txt2 = AuthorDateLine($row, $params); $pdf->ezText($txt2, 8); $txt3 = $row->introtext . "\n" . $row->fulltext; $pdf->ezText($txt3, 10); $pdf->ezStream(); } else { mosNotAuth(); return; } }
Released under the GNU General Public License */ // set paper type and size if ($pageloop == "0") { $pdf = new Cezpdf(A4, portrait); } else { $pdf->selectFont(BATCH_PDF_DIR . 'Helvetica.afm'); $pdf->setFontFamily(BATCH_PDF_DIR . 'Helvetica.afm'); $y = 10; $i = 0; do { $i++; $y = $y + 20; $pdf->setLineStyle(1); $pdf->line(0, $y, 600, $y); $pdf->addText(0, $y, 8, "{$y}"); $pdf->ezSetY($y); $dup_y = $y; } while ($i < 40); $x = 10; $i = 0; do { $i++; $x = $x + 20; $pdf->setLineStyle(1); $pdf->line($x, 0, $x, 900); $pdf->addText($x, 0, 8, "{$x}"); $pdf->ezSetY($x); $dup_x = $x; } while ($i < 30);
$pdf->ezText($swimmername, 40, array('justification' => 'center')); // $pdf->ezText($clubname, 16, array('justification' => 'center')); $pdf->ezText('', 20, array('justification' => 'center')); $pdf->ezText(_('har deltaget i'), 20, array('justification' => 'center')); $pdf->ezText('', 20, array('justification' => 'center')); $pdf->ezText($aryCompo['name'] . ' - ' . $date, 30, array('justification' => 'center')); $pdf->ezText('', 20, array('justification' => 'center')); $pdf->ezText(_('med følgende resultat:'), 20, array('justification' => 'center')); $pdf->ezText('', 20, array('justification' => 'center')); foreach ($results as $r) { $pdf->ezText($r['Resultat'], 20, array('justification' => 'center')); } $pdf->ezSetMargins(0, 0, 28.3, 75); $pdf->ezSetY(80); $pdf->setLineStyle(1); $pdf->line(300, 80, 530, 80); $pdf->ezText(_('Stævneleder') . ' ' . $aryCompo['leader'], 15, array('justification' => 'right')); $pdf->closeObject(); $pdf->addObject($text); } $swimmername = $swimmer['sname']; $clubname = $swimmer['cname']; $results = array(); $count = 0; $currentswimmer = $swimmer['sid']; } if ($swimmer['distance'] == 25) { if ($result = $db->getSwimmerBestTime($id, $currentswimmer, 25)) { if ($result['result'] > 0) { $min = floor($result['result'] / 60); $sek = floor($result['result']) % 60;
$pdf->setFontFamily(BATCH_PDF_DIR . 'Helvetica.afm'); // company name and details pulled from the my store address and phone number // in admin configuration mystore $y = $pdf->ezText(STORE_NAME_ADDRESS, COMPANY_HEADER_FONT_SIZE); $y -= 10; // logo image set to right of the above .. change first number to move sideways //$pdf->addJpegFromFile(BATCH_PRINT_INC . 'templates/' . 'invoicelogo.jpg',365,730,85,85); // extra info boxs to be used by staff $pdf->setStrokeColor(0, 0, 0); $pdf->setLineStyle(0.5); $pdf->Rectangle(300, 745, 250, 70); $pdf->addText(310, 785, GENERAL_FONT_SIZE, TEXT_PACKED_BY); $pdf->addText(310, 760, GENERAL_FONT_SIZE, TEXT_VERIFIED_BY); // line between header order number and order date $pdf->setLineStyle(0.5); $pdf->line(LEFT_MARGIN, $y, LINE_LENGTH, $y); $pdf->ezSetY($y); $dup_y = $y; // order number $y = $pdf->ezText("<b>" . TEXT_ORDER_NUMBER . " </b>" . $orders['orders_prefix'] . $orders['orders_id'] . "\n\n", SUB_HEADING_FONT_SIZE); // order date if ($_POST['show_order_date']) { $pdf->ezSetY($dup_y); $pdf->ezText("<b>" . TEXT_ORDER_DATE . " </b>" . date(TEXT_ORDER_FORMAT, strtotime($order->info['date_purchased'])) . "\n\n", SUB_HEADING_FONT_SIZE, array('justification' => 'right')); } // sold to info in left rectangle $pdf->addText(LEFT_MARGIN, $y, SUB_HEADING_FONT_SIZE, "<b>" . ENTRY_SOLD_TO . "</b>"); $pos = $y; $indent = LEFT_MARGIN + TEXT_BLOCK_INDENT; $pdf->addText($indent, $pos -= GENERAL_LEADING, GENERAL_FONT_SIZE, $order->billing['name']); if ($order->billing['company'] && $order->billing['company'] != 'NULL') {
$pdf->setFontFamily('Helvetica', $tmp); $pdf->selectFont('fonts/Helvetica.afm'); $pdf->ezSetCmMargins(1.5, 1, 2, 3); $pdf->addJpegFromFile("../img/libro.jpg", 50, 750, 60); $result = mysql_query("select matricula,\n\tconcat(nombre,' ',apellido_paterno,' ',apellido_materno) as nombre,\n\tconcat(calle,' ',numero,' ',colonia,'') as direccion,ciudad,estado,telefono,celular,sueldo,tipo\n\t\t\t\t\t\tfrom empleados \n\t\t\t\t\t\twhere status = 'ACTIVO' "); while ($datatmp = mysql_fetch_array($result)) { $data[] = array_merge($datatmp, array('matricula')); } $options = array('shadeHeadingCol' => array(0.6, 0.6, 0.5), 'shadeCol' => array(0.9, 0.9, 0.9), 'xOrientation' => 'center', 'width' => 550, 'fontSize' => 8, 'xPos' => 'center'); $titles = array('matricula' => '<b>ID</b>', 'nombre' => '<b>NOMBRE</b>', 'direccion' => '<b>DIRECCIÓN</b>', 'ciudad' => '<b>CIUDAD</b>', 'estado' => '<b>ESTADO</b>', 'telefono' => '<b>TELÉFONO</b>', 'celular' => '<b>CELULAR</b>', 'sueldo' => '<b>SUELDO</b>', 'tipo' => '<b>TIPO</b>'); $pdf->ezText("\n\n\n\n\n", 10); $pdf->ezTable($data, $titles, '', $options); //cabecera del pdf (objeto para todas las páginas) $all = $pdf->openObject(); $pdf->saveState(); $pdf->line($pdf->ez['leftMargin'], $pdf->ez['bottomMargin'] + 10, $pdf->ez['pageWidth'] - $pdf->ez['rightMargin'], $pdf->ez['bottomMargin'] + 10); //the bottom line $pdf->addText(200, 790, 12, "<b>Distribuciones y Representaciones Arvizu </b>\n"); $pdf->addText(230, 770, 12, "<i>!Leer Aumenta el Saber! </i>\n"); $pdf->addText(240, 740, 12, "<b>Listado Empleados </b>\n"); $pdf->ezText("\n\n\n", 10); $pdf->addText(50, 30, 8, "<b>Fecha: </b>\n" . date("d/m/Y")); $pdf->ezStartPageNumbers($pdf->ez['pageWidth'] - ($pdf->ez['rightMargin'] - 10), $pdf->ez['bottomMargin'], 8, 'PAGINA', '{PAGENUM} de {TOTALPAGENUM}', 1); $pdf->addText(50, 30, 10); //bottom text $pdf->restoreState(); $pdf->closeObject(); $pdf->addObject($all, 'all'); $pdf->ezSetCmMargins(4, 3, 3, 3); ob_end_clean(); $pdf->ezStream();
$alleval = $cats[0]->get_evaluations($stud_id, true); $alllink = $cats[0]->get_links($stud_id, true); if (isset($_GET['exportpdf'])) { $datagen = new GradebookDataGenerator($allcat, $alleval, $alllink); $header_names = array(get_lang('Name'), get_lang('Description'), get_lang('Weight'), get_lang('Date'), get_lang('Results')); $data_array = $datagen->get_data(GradebookDataGenerator::GDG_SORT_NAME, 0, null, true); $newarray = array(); foreach ($data_array as $data) { $newarray[] = array_slice($data, 1); } $pdf = new Cezpdf(); $pdf->selectFont(api_get_path(LIBRARY_PATH) . 'ezpdf/fonts/Courier.afm'); $pdf->ezSetMargins(30, 30, 50, 30); $pdf->ezSetY(810); $pdf->ezText(get_lang('FlatView') . ' (' . api_convert_and_format_date(null, DATE_FORMAT_SHORT) . ' ' . api_convert_and_format_date(null, TIME_NO_SEC_FORMAT) . ')', 12, array('justification' => 'center')); $pdf->line(50, 790, 550, 790); $pdf->line(50, 40, 550, 40); $pdf->ezSetY(750); $pdf->ezTable($newarray, $header_names, '', array('showHeadings' => 1, 'shaded' => 1, 'showLines' => 1, 'rowGap' => 3, 'width' => 500)); $pdf->ezStream(); exit; } } else { //Student view //in any other case (no search, no pdf), print the available gradebooks // Important note: loading a category will actually load the *contents* of // this category. This means that, to show the categories of a course, // we have to show the root category and show its subcategories that // are inside this course. This is done at the time of calling // $cats[0]->get_subcategories(), not at the time of doing Category::load() // $category comes from GET['selectcat']
ini_set('memory_limit', '500M'); ini_set('max_execution_time', 600); ini_set('limit', -1); include 'class.ezpdf.php'; $pdf = new Cezpdf('LETTER', 'portrait'); # t, b, l, r $pdf->ezSetMargins(50, 70, 50, 50); #w = 612 h = 792 $pdf->setColor(0.16, 0.38, 0.61); $pdf->selectFont('fonts/Helvetica.afm'); $img = ImageCreatefromjpeg('../img/logo.jpg'); $pdf->addImage($img, 50, 697, 47, 50); $pdf->addText(110, 722, 24, '<b>ENTREGAS PUNTUALES</b>'); $pdf->setColor(0.79, 0.67, 0.11); $pdf->addText(110, 702, 16, '<b>Soporte de Factura ' . $_GET[folio] . '</b>'); $pdf->line(50, 690, 560, 690); $pdf->setColor(0.25, 0.25, 0.25); $pdf->ezText("\n\n\n\n{$f->fechaactual}", 12, array('justification' => 'right')); #detallado superior $s = "SELECT fd.*,SUBSTRING(CONCAT(cc.nombre,' ',cc.paterno,' ',cc.materno),1,25) cliente,gv.totalpaquetes,\n\t\tDATE_FORMAT(fd.fecha,'%d/%m/%Y') AS fecha\n\t\tFROM facturadetalle fd\n\t\tINNER JOIN guiasventanilla gv ON fd.folio=gv.id\n\t\tINNER JOIN catalogocliente cc ON gv.iddestinatario=cc.id\n\t\tWHERE fd.factura = '{$_GET['folio']}'\n\t\tUNION\n\t\tSELECT fd.*,SUBSTRING(CONCAT(cc.nombre,' ',cc.paterno,' ',cc.materno),1,25) cliente,ge.totalpaquetes,\n\t\tDATE_FORMAT(fd.fecha,'%d/%m/%Y') AS fecha\n\t\tFROM facturadetalle fd\n\t\tINNER JOIN guiasempresariales ge ON fd.folio=ge.id\n\t\tINNER JOIN catalogocliente cc ON ge.iddestinatario=cc.id\n\t\tWHERE fd.factura = '{$_GET['folio']}'"; $rx = mysql_query($s, $l) or die($s); $registros = mysql_num_rows($rx); if ($registros > 0) { $pdf->setColor(0.79, 0.67, 0.11); $pdf->ezText("<b>DETALLADO DE FACTURA, GUIAS</b>\n", 12, array('justification' => 'left')); $pdf->setColor(0.25, 0.25, 0.25); $s = "SELECT fd.*,SUBSTRING(CONCAT(cc.nombre,' ',cc.paterno,' ',cc.materno),1,25) cliente,gv.totalpaquetes,\n\t\tDATE_FORMAT(fd.fecha,'%d/%m/%Y') AS fecha\n\t\tFROM facturadetalle fd\n\t\tINNER JOIN guiasventanilla gv ON fd.folio=gv.id\n\t\tINNER JOIN catalogocliente cc ON gv.iddestinatario=cc.id\n\t\tWHERE fd.factura = '{$_GET['folio']}'\n\t\tUNION\n\t\tSELECT fd.*,SUBSTRING(CONCAT(cc.nombre,' ',cc.paterno,' ',cc.materno),1,25) cliente,ge.totalpaquetes,\n\t\tDATE_FORMAT(fd.fecha,'%d/%m/%Y') AS fecha\n\t\tFROM facturadetalle fd\n\t\tINNER JOIN guiasempresariales ge ON fd.folio=ge.id\n\t\tINNER JOIN catalogocliente cc ON ge.iddestinatario=cc.id\n\t\tWHERE fd.factura = '{$_GET['folio']}'"; $r = mysql_query($s, $l) or die($s); $col = array('0' => "Folio", '1' => 'Remitente', '2' => '#Paqs', '3' => 'Fecha', '4' => 'Flete', '5' => 'Desc', '6' => 'Exced', '7' => 'EAD', '8' => 'Recol', '9' => 'Seguro', '10' => 'Combus', '11' => 'Otros', '12' => 'Subtotal', '13' => 'Iva', '14' => 'Iva Ret', '15' => 'Total'); $opt = array('0' => array('justification' => 'left'), '1' => array('justification' => 'center'), '2' => array('justification' => 'center'), '3' => array('justification' => 'right'), '4' => array('justification' => 'right'), '5' => array('justification' => 'right'), '6' => array('justification' => 'right'), '7' => array('justification' => 'right'), '8' => array('justification' => 'right'), '9' => array('justification' => 'right'), '10' => array('justification' => 'right'), '11' => array('justification' => 'right'), '12' => array('justification' => 'right'), '13' => array('justification' => 'right'), '14' => array('justification' => 'right'), '15' => array('justification' => 'right')); $est = array('fontSize' => 5, 'showHeadings' => 1, 'lineCol' => array(0, 0, 0), 'cols' => $opt, 'width' => 520);
$listMembers = new request(); $listMembers->openMembers($tmpquery); $comptListMembers = count($listMembers->mem_id); for ($i = 0; $i < $comptListMembers; $i++) { $name = $listMembers->mem_name[$i]; $title = $listMembers->mem_title[$i]; $email = $listMembers->mem_email_work[$i]; $phone = $listMembers->mem_phone_work[$i]; $mobile = $listMembers->mem_mobile[$i]; $fax = $listMembers->mem_fax[$i]; //$ = $listMembers->[$i]; // stuff the array with data $data[] = array('name' => $name, 'title' => $title, 'email' => $email, 'phone' => $phone, 'mobile' => $mobile, 'fax' => $fax); } // print the page number $pdf->ezStartPageNumbers(526, 34, 6, 'right', '', 1); // put a line top and bottom on all the pages and company info on the bottom $all = $pdf->openObject(); $pdf->saveState(); $pdf->setStrokeColor(0, 0, 0, 1); $pdf->line(20, 40, 578, 40); $pdf->line(20, 822, 578, 822); $pdf->addText(50, 34, 6, $cn . " - " . $url); $pdf->AddText(510, 34, 6, "Page "); $pdf->restoreState(); $pdf->closeObject(); $pdf->addObject($all, 'all'); // make the table $pdf->ezTable($data, array('name' => 'Name', 'title' => 'Title', 'email' => 'Email', 'phone' => 'Phone', 'mobile' => 'Mobile', 'fax' => 'Fax'), '', array('fontSize' => 10, 'maxWidth' => 550)); // output the PDF $pdf->ezStream();
for ($i = 0; $i < count($mieter_ids); $i++) { $mieter_daten_arr[] = $buchung->get_person_infos($mieter_ids[$i]['PERSON_MIETVERTRAG_PERSON_ID']); } // ##überschrift############################## $heute = date("Y-m-d"); $heute_deutsch = $buchung->date_mysql2german($heute); // ##erste seite $pdf = new Cezpdf('a4', 'portrait'); $pdf->ezSetCmMargins(4.3, 0, 1.5, 2.5); $berlus_schrift = 'Times-Roman.afm'; $text_schrift = 'Helvetica.afm'; // links, $pdf->addJpegFromFile('includes/logos/Slogo_78_31.jpg', 190, 730, 200, 80); $pdf->setLineStyle(0.5); // line(x1,y1,x2,y2) /links anfang hoehe weite hoehe $pdf->line(42, 722, 550, 722); $pdf->selectFont($berlus_schrift); $pdf->ezText("BERLUS HAUSVERWALTUNG * Fontanestr. 1 * 14193 Berlin", 7); $pdf->ezSetDy(-20); $pdf->selectFont($berlus_schrift); $pdf->addText(400, 680, 10, 'Telefon (030) 89784477'); $pdf->addText(400, 665, 10, 'Telefax (030) 89784479'); $pdf->addText(400, 650, 10, 'Email: info@berlus.de'); $pdf->addText(400, 635, 10, '<c:uline><b>Sprechzeiten</b></c:uline>'); $pdf->addText(400, 620, 10, 'Dienstag:'); $pdf->addText(455, 620, 10, '9:00-12:00'); $pdf->addText(400, 605, 10, 'Donnerstag:'); $pdf->addText(450, 605, 10, '14:00-17:00'); $pdf->addText(400, 590, 10, '<c:uline><b>Internet</b></c:uline>'); $pdf->addText(400, 575, 10, 'Berlus.de'); $pdf->addText(400, 560, 10, 'Hausverwaltung-Forum.de');
function pdf_einzel_tab(Cezpdf &$pdf, $bk_arr, $label, $kontroll_tab_druck) { $empf = $bk_arr['EMPF']; $empf_kos_typ = $bk_arr['KOS_TYP']; $empf_kos_id = $bk_arr['KOS_ID']; $mieternummer = $bk_arr['EINHEIT_NAME']; $zeitraum = $bk_arr['ZEITRAUM']; $zeitraum_arr = explode('.', $zeitraum); $anzahl_monate = $zeitraum_arr[3] - $zeitraum_arr[1] + 1; $pdf->ergebnis_tab["{$mieternummer} - {$empf}"]['KOS_TYP'] = $empf_kos_typ; $pdf->ergebnis_tab["{$mieternummer} - {$empf}"]['KOS_ID'] = $empf_kos_id; $pdf->ergebnis_tab["{$mieternummer} - {$empf}"]['ZEITRAUM'] = $zeitraum; $pdf->ergebnis_tab["{$mieternummer} - {$empf}"]['ANZ_MONATE'] = $anzahl_monate; $einheit_typ = $bk_arr['EINHEIT_TYP']; $einheit_qm = $bk_arr['EINHEIT_QM']; $QM_G_OBJEKT = nummer_punkt2komma($bk_arr['QM_G_OBJEKT']); $QM_G = nummer_punkt2komma($bk_arr['QM_G']); $QM_G_GEWERBE = nummer_punkt2komma($bk_arr['QM_G_GEWERBE']); $this->bk_profil_infos($_SESSION['profil_id']); $anzahl_zeilen = count($bk_arr) - 10; // WICHTIG 10 felder abschneiden $cols = array('KOSTENART' => "Betriebskostenart", 'G_BETRAG' => "Gesamtkosten umlagefähige Betriebskosten", 'G_HNDL' => "Gesamtkosten haushaltsnahe Dienst- und Handwerkerleistungen", 'G_KEY' => "Wohnfläche / Verteiler- Schlüssel in Mieteinheiten (ME)", 'QM_ME' => "Ihre ME", 'BET_HNDL' => "Anteil für Ihre Wohnung haushaltsnahe Dienst- und Handwerkerleistungen", 'BET_G' => "Beteiligung"); $g_beteiligung = 0.0; $g_beteiligung_hnd = 0.0; for ($b = 0; $b < $anzahl_zeilen; $b++) { $tab[$b]['KOSTENART'] = $bk_arr[$b]['KOSTENART']; $tab[$b]['G_KOS_BEZ'] = $bk_arr[$b]['G_KOS_BEZ']; $tab[$b]['G_BETRAG'] = $bk_arr[$b]['G_BETRAG']; $tab[$b]['ANTEIL'] = $bk_arr[$b]['ANTEIL'] . '%'; $tab[$b]['UMLAGE'] = $bk_arr[$b]['UMLAGE']; $tab[$b]['ME'] = $bk_arr[$b]['ME']; $tab[$b]['G_KEY'] = nummer_punkt2komma($bk_arr[$b]['G_KEY']) . ' ' . $bk_arr[$b]['ME']; $tab[$b]['QM'] = $bk_arr[$b]['QM']; $tab[$b]['QM_ME'] = nummer_punkt2komma($bk_arr[$b]['QM']) . ' ' . $bk_arr[$b]['ME']; $tab[$b]['BET_G'] = $bk_arr[$b]['BET_G']; $tab[$b]['G_HNDL'] = $bk_arr[$b]['G_HNDL']; $tab[$b]['BET_HNDL'] = $bk_arr[$b]['BET_HNDL']; $tab[$b]['GENKEY_ID'] = $bk_arr[$b]['GENKEY_ID']; $g_beteiligung += nummer_komma2punkt($bk_arr[$b]['BET_G']); $g_beteiligung_hndl += nummer_komma2punkt($bk_arr[$b]['BET_HNDL']); } /* Pr�fen ob Kaltwasserkosten worden sind */ $check_kw = $this->check_kw_abrechnung($empf_kos_typ, $empf_kos_id, $this->bk_jahr); if ($check_kw == true) { $kw_summe = $this->summe_kw_abrechnung($empf_kos_typ, $empf_kos_id, $this->bk_jahr); $kw_summe_a = nummer_punkt2komma($kw_summe); // $pdf->ezText("<b>Heiz- und Betriebskostenabrechnung Einheit: $mv->einheit_kurzname</b>",10); $tab[$b + 1]['KOSTENART'] = 'Be- und Entwässerung lt. Kaltwasserabr.'; if ($kw_summe < 0) { $kw_erg_a = 'Nachzahlung'; } else { $kw_erg_a = 'Guthaben'; } $tab[$b + 1]['G_KEY'] = 'n. Verbrauch'; $tab[$b + 1]['BET_G'] = $kw_summe_a; $g_beteiligung += $kw_summe; // die($g_beteiligung); } else { // $pdf->ezText("<b>Betriebskostenabrechnung $this->bk_jahr Einheit: $mv->einheit_kurzname</b>",10); } $b++; $tab[$b + 1]['KOSTENART'] = '<b>Gesamtkosten</b>'; $tab[$b + 1]['BET_G'] = '<b>' . nummer_punkt2komma($g_beteiligung) . '</b>'; $tab[$b + 1]['BET_HNDL'] = '<b>' . nummer_punkt2komma($g_beteiligung_hndl) . '</b>'; $summe_nebenkosten_jahr = 0.0; if ($empf_kos_typ == 'MIETVERTRAG') { $mz = new miete(); $summe_nebenkosten_jahr = $mz->summe_nebenkosten_im_jahr($empf_kos_typ, $empf_kos_id, $this->bk_jahr); $summe_hk_jahr = $mz->summe_nebenkosten_im_jahr($empf_kos_typ, $empf_kos_id, $this->bk_jahr); } else { $summe_nebenkosten_jahr = 0.0; $summe_hk_jahr = '0.00'; } $tab[$b + 2]['KOSTENART'] = '<b>Ihr Vorschuss/Jahr</b>'; $tab[$b + 2]['BET_G'] = '<b>' . nummer_punkt2komma($summe_nebenkosten_jahr) . '</b>'; $ergebnis = $g_beteiligung + $summe_nebenkosten_jahr; // $ergebnis = $summe_nebenkosten_jahr- substr($g_beteiligung,1); if ($ergebnis < 0) { $txt = 'Nachzahlung'; $ergebnis_a = substr($ergebnis, 1); } if ($ergebnis > 0) { $txt = 'Guthaben'; $ergebnis_a = $ergebnis; } if ($ergebnis == null) { $txt = 'Ergebnis'; $ergebnis_a = $ergebnis; } $tab[$b + 3]['KOSTENART'] = "<b>{$txt}</b>"; $tab[$b + 3]['BET_G'] = '<b>' . nummer_punkt2komma($ergebnis_a) . '</b>'; $pdf->ezNewPage(); $pdf->ezStopPageNumbers(); // seitennummerirung beenden /* * $this->wirt_ges_qm = $wirt->g_qm; * $this->wirt_g_qm_gewerbe = $wirt->g_qm_gewerbe; * $this->wirt_g_qm_wohnen = $this->wirt_ges_qm - $this->wirt_g_qm_gewerbe; */ // $cols1 = array('KOSTENART'=>"Betriebskostenart","KOSTEN_GESAMT"=>"Kosten gesamt $QM_G_OBJEKT m²",'KOSTEN_GEWERBE'=>"Gewerbeanteil $QM_G_GEWERBE m²",'KOSTEN_WOHNRAUM'=>"Wohnanteil $QM_G m²"); // $cols1 = array('KOSTENART'=>"Betriebskostenart","KOSTEN_GESAMT"=>"Kosten gesamt $this->wirt_ges_qm_a m²",'KOSTEN_GEWERBE'=>"Gewerbeanteil $this->wirt_g_qm_gewerbe_a m²",'KOSTEN_WOHNRAUM'=>"Wohnanteil $this->wirt_g_qm_wohnen_a m²"); $cols1 = array('KOSTENART' => "Betriebskostenart", "KOSTEN_GESAMT" => "Kosten gesamt", 'KOSTEN_GEWERBE' => "Gewerbeanteil {$this->wirt_g_qm_gewerbe_a} m²", 'KOSTEN_WOHNRAUM' => "Wohnanteil {$this->wirt_g_qm_wohnen_a} m²"); // $i=$pdf->ezStartPageNumbers(545,728,6,'','Seite {PAGENUM} von {TOTALPAGENUM}',1); $p = new partners(); $p->get_partner_info($_SESSION[partner_id]); $pdf->addText(480, 697, 8, "{$p->partner_ort}, {$this->bk_berechnungs_datum_d}"); // $zeitraum = "01.09.2011 - 31.12.2011"; $pdf->ezText('<b>Betriebskostenabrechnung für den Zeitraum: ' . $zeitraum . '</b>', 8); $pdf->ezSetDy(-15); $pdf->ezText("<b>{$this->bk_bezeichnung}</b>", 8); $pdf->ezText("Wirtschaftseinheit: {$this->bk_kos_bez} ", 8); $pdf->ezText('Mieternummer: ' . $mieternummer . " - {$einheit_typ}", 8); $pdf->ezText('Mieter: ' . $empf, 8); $pdf->ezSetDy(-20); /* Ergebnis in die �bersichtstabelle */ $pdf->ergebnis_tab["{$mieternummer} - {$empf}"]['ERGEBNIS'] = $ergebnis; $pdf->ergebnis_tab["{$mieternummer} - {$empf}"]['SUMME_NK'] = $summe_nebenkosten_jahr; $pdf->ezTable($kontroll_tab_druck, $cols1, "Aufteilung Gewerbe- / Wohnfläche", array('showHeadings' => 1, 'shaded' => 1, 'titleFontSize' => 7, 'fontSize' => 7, 'xPos' => 55, 'xOrientation' => 'right', 'width' => 500, 'cols' => array('KOSTENART' => array('justification' => 'left'), 'KOSTEN_GESAMT' => array('justification' => 'right'), 'KOSTEN_GEWERBE' => array('justification' => 'right'), 'KOSTEN_WOHNRAUM' => array('justification' => 'right')))); $pdf->ezSetDy(-20); $pdf->ezTable($tab, $cols, "{$label}", array('showHeadings' => 1, 'shaded' => 1, 'titleFontSize' => 8, 'fontSize' => 7, 'xPos' => 55, 'xOrientation' => 'right', 'width' => 500, 'cols' => array('KOSTENART' => array('justification' => 'left'), 'G_BETRAG' => array('justification' => 'right', 'width' => 60), 'G_HNDL' => array('justification' => 'right', 'width' => 60), 'ANTEIL' => array('justification' => 'right', 'width' => 40), 'UMLAGE' => array('justification' => 'right', 'width' => 45), 'G_KOS_BEZ' => array('justification' => 'right', 'width' => 45), 'G_KEY' => array('justification' => 'right', 'width' => 55), 'QM_ME' => array('justification' => 'right', 'width' => 50), 'BET_G' => array('justification' => 'right', 'width' => 45), 'BET_HNDL' => array('justification' => 'right', 'width' => 65)))); // $pdf->ezStopPageNumbers(1,1,$i); // ENDE BERECHNUNGSSEITEN if ($empf_kos_typ == 'MIETVERTRAG') { $mz = new miete(); $mk = new mietkonto(); $monat = date("m"); $jahr = date("Y"); $ber_datum_arr = explode('-', $this->bk_berechnungs_datum); $ver_datum_arr = explode('-', $this->bk_verrechnungs_datum); $monat_b = $ber_datum_arr[1]; $jahr_b = $ber_datum_arr[0]; $monat_v = $ver_datum_arr[1]; $jahr_v = $ver_datum_arr[0]; $mk->kaltmiete_monatlich_ink_vz($empf_kos_id, $monat_b, $jahr_b); $mk->ausgangs_kaltmiete_a = nummer_punkt2komma($mk->ausgangs_kaltmiete); // $mk->heizkosten_monatlich($empf_kos_id,$monat,$jahr); // $mk->betriebskosten_monatlich($empf_kos_id,$monat,$jahr); // $mk->nebenkosten_monatlich($empf_kos_id,$monat,$jahr); $anp_tab[0]['KOSTENKAT'] = 'Miete kalt'; $anp_tab[0]['AKTUELL'] = "{$mk->ausgangs_kaltmiete_a} €"; $anp_tab[0]['ANPASSUNG'] = '--'; $mk1 = new mietkonto(); $mk1->kaltmiete_monatlich_ink_vz($empf_kos_id, $monat_v, $jahr_v); $mk1->ausgangs_kaltmiete_a = nummer_punkt2komma($mk1->ausgangs_kaltmiete); $anp_tab[0]['NEU'] = "{$mk1->ausgangs_kaltmiete_a} €"; $this->get_anpassung_details($_SESSION['profil_id'], 'Nebenkosten Vorauszahlung'); $anp_datum = date_mysql2german($this->bk_an_anpassung_ab); $mv = new mietvertraege(); $mv->get_mietvertrag_infos_aktuell($empf_kos_id); /* * if($empf_kos_id == '580'){ * echo '<pre>'; * print_r($mv); * die(); * } */ $pdf->addText(480, 697, 8, "{$p->partner_ort}, {$this->bk_berechnungs_datum_d}"); /* Wenn MV aktuell anpassen, wenn ausgezogen nicht */ // if($mv->mietvertrag_aktuell && $summe_nebenkosten_jahr){ if ($empf_kos_typ != 'Leerstand') { // ##########NEU ENERGIEVERBRAUCH GEGEN VORSCHÜSSE################### /* prüfen ob HK Vorschüsse vorhanden */ $mz2 = new miete(); $met = new mietentwicklung(); // $summe_nebenkosten_jahr = $mz->summe_nebenkosten_im_jahr($empf_kos_typ,$empf_kos_id,$this->bk_jahr); $summe_hk_vorschuss = $mz2->summe_heizkosten_im_jahr($empf_kos_typ, $empf_kos_id, $this->bk_jahr); $energiekosten_jahr = $met->get_energieverbrauch(strtoupper($empf_kos_typ), $empf_kos_id, $this->bk_jahr); if ($energiekosten_jahr > 0) { $pdf->ezNewPage(); $pdf->addText(480, 697, 8, "{$p->partner_ort}, {$this->bk_berechnungs_datum_d}"); $pdf->ezText('<b>Energiekostenabrechnung für den Zeitraum: ' . $zeitraum . '</b>', 8); $pdf->ezSetDy(-15); $pdf->ezText("<b>{$this->bk_bezeichnung}</b>", 8); $pdf->ezText("Wirtschaftseinheit: {$this->bk_kos_bez} ", 8); $pdf->ezText('Mieternummer: ' . $mieternummer . " - {$einheit_typ}", 8); $pdf->ezText('Mieter: ' . $empf, 8); $pdf->ezSetDy(-20); $pdf->ezText("{$mv->mv_anrede}", 9); $pdf->ezText("die Abrechnung der Energiekosten für den o.g. Zeitraum stellt sich wie folgt da:", 9); $hk_verbrauch_tab[0]['KOSTENKAT'] = "Ihre Vorauszahlung im Jahr {$this->bk_jahr}"; $hk_verbrauch_tab[0]['BETRAG'] = nummer_punkt2komma_t($summe_hk_vorschuss); /* Heizkostenverbrauch abfragen */ // $energiekosten_jahr = $met->get_energieverbrauch(strtoupper($empf_kos_typ), $empf_kos_id, $this->bk_jahr); $hk_verbrauch_tab[1]['KOSTENKAT'] = "Angefallene Kosten lt. Abrechnung in {$this->bk_jahr}"; $hk_verbrauch_tab[1]['BETRAG'] = nummer_punkt2komma_t($energiekosten_jahr); /* Ergebnis ermittlen */ $ergebnis_energie = $summe_hk_vorschuss - $energiekosten_jahr; if ($ergebnis_energie < 0) { $energie_text = "Ihre Nachzahlung"; } if ($ergebnis_energie > 0) { $energie_text = "Ihr Guthaben"; } if ($ergebnis_energie == 0) { $energie_text = "Saldo"; } $hk_verbrauch_tab[2]['KOSTENKAT'] = "<b>{$energie_text} {$this->bk_jahr}</b>"; $hk_verbrauch_tab[2]['BETRAG'] = "<b>" . nummer_punkt2komma_t($ergebnis_energie) . "</b>"; $pdf->ezSetDy(-20); $cols = array('KOSTENKAT' => "Bezeichnung", "BETRAG" => "Betrag"); $pdf->ezTable($hk_verbrauch_tab, $cols, "", array('showHeadings' => 0, 'shaded' => 1, 'titleFontSize' => 7, 'fontSize' => 8, 'xPos' => 55, 'xOrientation' => 'right', 'width' => 500, 'cols' => array('BETRAG' => array('justification' => 'right', 'width' => 80), 'KOSTENKAT' => array('justification' => 'left')))); $pdf->ezSetDy(-20); $pdf->ezText("Die Energieabrechnung des Abrechnungsunternehmens legen wir dieser Abrechnung bei.", 9); $pdf->ezSetDy(-10); $pdf->ezText("Mit freundlichen Grüßen", 9); $pdf->ezSetDy(-30); $pdf->ezText("Ihre Hausverwaltung", 9); $hk_verbrauch_tab[3]['KOSTENKAT'] = "{$mieternummer} - {$empf} - {$zeitraum}"; $pdf->energie_abr[]["{$mieternummer} - {$empf} - {$zeitraum}"] = $hk_verbrauch_tab; } // #ende wenn energieabrecnung drin } // #ende wenn nicht leerstand // ######################################################################## if ($mv->mietvertrag_aktuell) { /* ANPASSUNGSBLATT */ $pdf->ezNewPage(); $pdf->addText(480, 697, 8, "{$p->partner_ort}, {$this->bk_berechnungs_datum_d}"); $pap = $mv->postanschrift[0]['anschrift']; if (!empty($pap)) { $pdf->ezText("{$pap}", 10); $pap = ''; } else { $pdf->ezText("{$mv->personen_name_string_u}\n{$mv->haus_strasse} {$mv->haus_nr}\n\n{$mv->haus_plz} {$mv->haus_stadt}", 10); } $pdf->ezSetDy(-60); $check_hk = $this->check_hk_abrechnung($empf_kos_typ, $empf_kos_id, $this->bk_jahr); // $check_bk = $this->check_bk_abrechnung($empf_kos_typ,$empf_kos_id,$this->bk_jahr); $bk_summe = $ergebnis; /* Summe aus der Abrechnung */ $hk_summe = $this->summe_hk_abrechnung($empf_kos_typ, $empf_kos_id, $this->bk_jahr); // $bk_summe = $this->summe_bk_abrechnung($empf_kos_typ,$empf_kos_id,$this->bk_jahr); /* NEU */ /* Anpassung Nachzahlung Heizkosten */ /* Wenn Nachzahlung, dann mindestens 50/12+1EUR=5.00 EUR */ if ($hk_summe < 0) { // echo $hk_summe; $hk_monatlich_letzte_vj = $mz->letzte_hk_vorauszahlung($empf_kos_typ, $empf_kos_id, $this->bk_jahr, 'Heizkosten Vorauszahlung'); $hk_monatlich_letzte = $mz->letzte_hk_vorauszahlung($empf_kos_typ, $empf_kos_id, $jahr, 'Heizkosten Vorauszahlung'); $hk_jahr_aktuell = $hk_monatlich_letzte * 12; $hk_diff = $hk_jahr_aktuell - ($hk_summe * -1 + $anzahl_monate * $hk_monatlich_letzte_vj); $hk_anp_betrag_neu = ($hk_summe - 25) / 12; $hk_anp_betrag_neu = intval($hk_anp_betrag_neu - 1); $hk_anp_betrag_neu = substr($hk_anp_betrag_neu, 1); // echo "$hk_summe $hk_vorschuss_neu $hk_anp_betrag_neu"; if ($hk_diff >= 0) { $hk_anp_betrag_neu = '0.00'; } else { $hk_anp_betrag_neu = $hk_diff / 12 * -1; } /* * if($mv->mietvertrag_id=='1573'){ * echo "<br><b>HKSUMME: $hk_summe HKV: $hk_vorschuss_neu ANP:$hk_anp_betrag_neu HKJAHR: $hk_jahr_aktuell|$hk_monatlich_letzte $hk_monatlich_letzte_vj $hk_diff</b>"; * echo "$hk_diff = $hk_jahr_aktuell - (($hk_summe*-1) + ($anzahl_monate*$hk_monatlich_letzte_vj));"; * die(); * } */ } else { /* Guthaben bei HK */ $hk_anp_betrag_neu = ($hk_summe - 50) / 12; $hk_anp_betrag_neu = intval($hk_anp_betrag_neu); if ($hk_anp_betrag_neu < 0) { $hk_anp_betrag_neu = 0.0; } /* Unter 5 Euro nicht anpassen */ if ($hk_anp_betrag_neu > 0.0 && $hk_anp_betrag_neu < 5.0) { $hk_anp_betrag_neu = 0.0; } if ($hk_anp_betrag_neu > 5) { $hk_anp_betrag_neu = -$hk_anp_betrag_neu - 1; } if ($hk_summe == 0 or $summe_hk_jahr == 0) { $hk_anp_betrag_neu = '0.00'; } } // END HK ANPASSUNG /* NEU BK */ /* Anpassung Nachzahlung BK */ /* Summe aus der Abrechnung */ // $bk_summe = $this->summe_bk_abrechnung($empf_kos_typ,$empf_kos_id,$this->bk_jahr); // echo $bk_summe if ($bk_summe < 0) { // echo $hk_summe; $bk_anp_betrag_neu = ($bk_summe - 24) / 12; $bk_anp_betrag_neu = intval($bk_anp_betrag_neu - 1); $bk_anp_betrag_neu = substr($bk_anp_betrag_neu, 1); // echo "$bk_anp_betrag_neu"; // die(); } else { /* Guthaben bei BK */ if ($bk_summe > 24) { $bk_anp_betrag_neu = ($bk_summe - 24) / 12; } else { $bk_anp_betrag_neu = $bk_summe / 12; } $bk_anp_betrag_neu = intval($bk_anp_betrag_neu); if ($bk_anp_betrag_neu < 0) { $bk_anp_betrag_neu = 0.0; } /* Unter 5 Euro nicht anpassen */ if ($bk_anp_betrag_neu > 0.0 && $bk_anp_betrag_neu < 5.0) { $bk_anp_betrag_neu = 0.0; } if ($bk_anp_betrag_neu > 5) { // echo "SANEL $bk_anp_betrag_neu"; $bk_anp_betrag_neu = $bk_anp_betrag_neu - 1; // die("SANEL $bk_anp_betrag_neu"); } } // ENDE BK ANPASSUNGSERMITTLUNG if ($bk_summe == 0 or $summe_nebenkosten_jahr == 0) { $bk_anp_betrag_neu = '0.00'; } if ($mv->mietvertrag_id == '1813') { // ob_clean(); // echo "$bk_summe $ergebnis ANP: $bk_anp_betrag_neu "; // die('SANEL'); } $pdf->ergebnis_tab["{$mieternummer} - {$empf}"]['HK_SUMME'] = nummer_punkt2komma($hk_summe); /* Summe aller Vorauszahlungen im Jahr der Abrechnung */ $summe_hk_jahr = $mz->summe_heizkosten_im_jahr($empf_kos_typ, $empf_kos_id, $this->bk_jahr); $this->get_anpassung_details($_SESSION['profil_id'], 'Heizkosten Vorauszahlung'); $hk_monatlich_bisher_schnitt = $summe_hk_jahr / $anzahl_monate; $hk_monatlich_letzte = $mz->letzte_hk_vorauszahlung($empf_kos_typ, $empf_kos_id, $jahr, 'Heizkosten Vorauszahlung'); // $hk_monatlich_letzte = $mz->letzte_hk_vorauszahlung($empf_kos_typ, $empf_kos_id, $this->bk_jahr, 'Heizkosten Vorauszahlung'); // $x = $hk_monatlich_letzte + $hk_anp_betrag_neu; // die("$x = $hk_monatlich_letzte + $hk_anp_betrag_neu"); // if($empf_kos_id==1){ // die("Schnitt: $hk_monatlich_bisher_schnitt Letzte:$hk_monatlich_letzte HK-Abrechnung: $hk_summe Voraus:$summe_hk_jahr"); // } /* bis hier alles ok */ $hk_monatlich_genau = (-$summe_hk_jahr + $hk_summe) / $anzahl_monate; if ($hk_monatlich_genau < 0) { $hk_monatlich_genau = substr($hk_monatlich_genau, 1); } echo "{$hk_monatlich_genau} = (-{$summe_hk_jahr} + {$hk_summe})/{$anzahl_monate};"; $vorauszahlung_n_jahr = $hk_monatlich_letzte * $anzahl_monate; $festgesetzt_n_jahr = $vorauszahlung_n_jahr - $hk_summe; $hk_vorschuss_neu = $festgesetzt_n_jahr / $anzahl_monate; // $hk_monatlich_letzte = 84.99; $x = $hk_monatlich_letzte + $hk_anp_betrag_neu; // intval($hk_anp_betrag_neu-1) // $hk_anp_betrag_neu = $x- $hk_monatlich_letzte; echo "HK {$hk_summe} {$hk_monatlich_letzte} {$hk_anp_betrag_neu} {$x} {$hk_vorschuss_neu}<br>"; echo "HK ANP: {$hk_anp_betrag_neu}<br><hr>"; // die(); // if($hk_anp_betrag_neu<0){ // $hk_anp_betrag_neu_pos = substr($hk_anp_betrag_neu,1);//positiv // } // echo "$hk_vorschuss_neu $hk_vorschuss_neu_pos"; // die(); // $hk_vorschuss_neu = $hk_monatlich_letzte + $hk_anp_betrag_neu; $hk_vorschuss_neu = $x; // echo "$hk_vorschuss_neu = $hk_monatlich_letzte + $hk_anp_betrag_neu_pos"; // die(); // $hk_anp_betrag = $hk_monatlich_genau - $hk_monatlich_bisher; // $hk_anp_betrag = $hk_monatlich_bisher_schnitt - $hk_monatlich_genau; // $hk_vorschuss_neu = $hk_monatlich_bisher + $hk_anp_betrag; // $hk_vorschuss_neu = $hk_monatlich_letzte + $hk_anp_betrag; $hk_monatlich_bisher_schnitt_a = nummer_punkt2komma($hk_monatlich_bisher_schnitt); $hk_monatlich_bisher_a = nummer_punkt2komma($hk_monatlich_letzte); // if($mv->mietvertrag_id=='1365'){ // die('SANEL'); // } $this->get_genkey_infos($this->bk_an_keyid); if ($this->bk_an_keyid == '1') { $hk_vorschuss_neu = $hk_vorschuss_neu + $this->bk_an_fest_betrag * $einheit_qm; } if ($this->bk_an_keyid == '2') { $hk_vorschuss_neu = $hk_vorschuss_neu + $this->bk_an_fest_betrag; } // $hk_anp_betrag = $hk_vorschuss_neu - $hk_monatlich_bisher; /* Anpassung auf Vollzahlen */ // $hk_vorschuss_neu = intval(substr($hk_vorschuss_neu,0,-2)); // $hk_anp_betrag = $hk_vorschuss_neu - $hk_monatlich_letzte; // die("$hk_anp_betrag = $hk_anp_betrag_neu **** $hk_vorschuss_neu - $hk_monatlich_letzte"); // if($hk_anp_betrag_neu!=0){ // if(($hk_anp_betrag < 5.00) && ($hk_anp_betrag < -5.00)){ // die("if(($hk_anp_betrag_neu > 0 && $hk_anp_betrag < 5.00) && ($hk_anp_betrag_neu < 0 && $hk_anp_betrag < -5.00)){"); // $hk_anp_betrag = 0.00; // $hk_vorschuss_neu =$hk_monatlich_letzte; // die('OK'); // die("$hk_anp_betrag < 5.00) && ($hk_anp_betrag < -5.00)"); // } // } $hk_anp_betrag_a = nummer_punkt2komma($hk_anp_betrag_neu); $hk_vorschuss_neu_a = nummer_punkt2komma($hk_vorschuss_neu); if ($check_hk == true) { $anp_tab[2]['KOSTENKAT'] = 'Heizkosten Vorauszahlung'; $anp_tab[2]['AKTUELL'] = "{$hk_monatlich_bisher_a} €"; $anp_tab[2]['ANPASSUNG'] = "{$hk_anp_betrag_a} €"; $anp_tab[2]['NEU'] = "{$hk_vorschuss_neu_a} €"; $pdf->ergebnis_tab["{$mieternummer} - {$empf}"]['HK_VORSCHUSS_ALT'] = $hk_monatlich_bisher_a; $pdf->ergebnis_tab["{$mieternummer} - {$empf}"]['HK_VORSCHUSS_NEU'] = $hk_vorschuss_neu_a; if ($hk_summe > $hk_monatlich_bisher_schnitt * $anzahl_monate) { die("{$mieternummer} {$empf} - Summe Hk Abrechnung > eingezahlte Summe für HK im Jahr"); } } if ($check_hk == true) { $pdf->ezText("<b>Anpassung der monatlichen Heiz- und Betriebskostenvorauszahlungen ab {$this->bk_verrechnungs_datum_d}</b>", 10); } else { $pdf->ezText("<b>Anpassung der monatlichen Betriebskostenvorauszahlungen ab {$this->bk_verrechnungs_datum_d}</b>", 10); } // $pdf->ezText("Objekt: $mv->haus_strasse $mv->haus_nr, $mv->haus_plz $mv->haus_stadt",12); $pdf->ezText("<b>{$this->bk_bezeichnung}</b>", 10); $pdf->ezText("Wirtschaftseinheit: {$this->bk_kos_bez} Einheit: {$mv->einheit_kurzname}", 10); // $pdf->ezText("Einheit: $mv->einheit_kurzname",12); $pdf->ezSetDy(-10); /* Faltlinie */ $pdf->setLineStyle(0.2); $pdf->line(5, 542, 20, 542); $pdf->ezText("{$anrede}", 10); $pdf->ezText("{$mv->mv_anrede}", 10); // $text_nachzahlung = "aufgrund der Nachzahlungsbetr�ge aus der letzten Betriebskostenabrechnung und der uns bisher bekannten Erhöhungen der Kosten für die Müllentsorgung durch die BSR, die Be- und Entwässerungskosten durch die Berliner Wasserbetriebe und die Erhöhung der Kosten für die Hausreinigung ändern wir die monatlichen Betriebskostenvorauszahlungen auf der Grundlage des § 560 BGB wie nachfolgend aufgeführt ab dem $this->bk_verrechnungs_datum_d."; $text_nachzahlung = "aufgrund der vorliegenden Nebenkostenabrechnung und zu erwartender Kostensteigerungen, erfolgt hiermit eine Änderung der monatlichen Betriebskostenvorauszahlungen auf der Grundlage des § 560 BGB, wie nachfolgend aufgeführt ab dem {$this->bk_verrechnungs_datum_d}."; $text_guthaben_berlin = "aufgrund der uns bisher bekannten Erhöhungen der Kosten für die Müllentsorgung durch die BSR, die Be- und Entwässerungskosten durch die Berliner Wasserbetriebe und die Erhöhung der Kosten für die Hausreinigung, erfolgt hiermit eine Änderung der monatlichen Betriebskostenvorauszahlungen auf der Grundlage des § 560 BGB wie nachfolgend aufgeführt ab dem {$this->bk_verrechnungs_datum_d}."; $text_guthaben = "aufgrund der vorliegenden Nebenkostenabrechnung und zu erwartender Kostensteigerungen, erfolgt hiermit eine Änderung der monatlichen Betriebskostenvorauszahlungen auf der Grundlage des § 560 BGB, wie nachfolgend aufgeführt ab dem {$this->bk_verrechnungs_datum_d}."; if ($txt == 'Nachzahlung') { $pdf->ezText("{$text_nachzahlung}", 10, array('justification' => 'full')); } $alttext = 'aufgrund der Nachzahlungsbeträge aus der letzten Betriebskostenabrechnung ändern wir die monatlichen Betriebskostenvorauszahlungen auf der Grundlage des § 560 Abs. 4 und 5 BGB wie nachfolgend aufgeführt ab dem $this->bk_verrechnungs_datum_d.'; if ($txt == 'Guthaben') { $pdf->ezText("{$text_guthaben}", 10, array('justification' => 'full')); } $pdf->ezSetDy(-15); /* BK NK ANPASSUNG */ $this->get_anpassung_details($_SESSION['profil_id'], 'Nebenkosten Vorauszahlung'); // $vorschuesse_aktuell =$summe_nebenkosten_jahr; $men = new mietentwicklung(); // $vorschuesse_aktuell = $men->nebenkosten_monatlich($empf_kos_id,date("m"),date("Y")); // $vorschuesse_aktuell = $mz->letzte_hk_vorauszahlung($empf_kos_typ, $empf_kos_id, $this->bk_jahr, 'Nebenkosten Vorauszahlung'); $jahr_vorschuss = date("Y"); // OKOKOK2015$vorschuesse_aktuell = $mz->letzte_hk_vorauszahlung($empf_kos_typ, $empf_kos_id, $jahr_vorschuss, 'Nebenkosten Vorauszahlung'); // $vorschuesse_aktuell = $mz->letzte_vorauszahlung_summe($empf_kos_typ, $empf_kos_id, $jahr_vorschuss, 'Nebenkosten Vorauszahlung'); $vorschuesse_aktuell = $mz->letzte_hk_vorauszahlung($empf_kos_typ, $empf_kos_id, $jahr_vorschuss, 'Nebenkosten Vorauszahlung'); /* * if($empf_kos_id=='1585'){ * ob_clean(); * die($vorschuesse_aktuell); * } */ $vorschuesse_neu = $g_beteiligung / $anzahl_monate; $vorschuesse_aktuell_a = nummer_punkt2komma($vorschuesse_aktuell); if ($vorschuesse_neu < 0) { $vorschuesse_neu = substr($vorschuesse_neu, 1); } $this->get_genkey_infos($this->bk_an_keyid); if ($this->bk_an_keyid == '1') { $vorschuesse_neu = $vorschuesse_neu + $this->bk_an_fest_betrag * $einheit_qm; } if ($this->bk_an_keyid == '2') { $vorschuesse_neu = $vorschuesse_neu + $this->bk_an_fest_betrag; } $vorschuesse_neu_a = nummer_punkt2komma($vorschuesse_neu); $anp_betrag = $vorschuesse_neu - $vorschuesse_aktuell; $anp_betrag_a = nummer_punkt2komma($anp_betrag); if ($ergebnis > 0) { $xbk = intval($vorschuesse_aktuell - $bk_anp_betrag_neu); // intval($hk_anp_betrag_neu-1) } else { $xbk = intval($vorschuesse_aktuell + $bk_anp_betrag_neu); // intval($hk_anp_betrag_neu-1) } $bk_anp_betrag_neu = $xbk - $vorschuesse_aktuell; echo "BK: {$vorschuesse_aktuell} {$bk_anp_betrag_neu} {$xbk}<br>"; echo "BK_ANP {$bk_anp_betrag_neu}<br>"; // $anp_betrag_a = nummer_punkt2komma($bk_anp_betrag_neu); // $vorschuesse_neu = $xbk; // $vorschuesse_neu_a =nummer_punkt2komma($vorschuesse_neu); // die(); /* Wenn keine VZ Anteilig gezahlt, BK Anpassen - Nettomieter!!!!!!!!! */ $mkk = new mietkonto(); if ($mkk->check_vz_anteilig($empf_kos_id, $monat, $jahr) == true) { // $vorschuesse_aktuell_a =nummer_punkt2komma(0); // $anp_betrag_a = nummer_punkt2komma(0); $anp_betrag_a = nummer_punkt2komma(intval($anp_betrag)); $vorschuesse_neu = $vorschuesse_aktuell + intval($anp_betrag); $vorschuesse_neu_a = nummer_punkt2komma($vorschuesse_neu); } else { /* Wenn VZ Anteilig gezahlt, keine BK Anpassen - Bruttomieter!!!!!!!!! */ $anp_betrag = 0; $vorschuesse_aktuell = 0; $vorschuesse_neu = 0; $anp_betrag_a = nummer_punkt2komma(0); $vorschuesse_neu_a = nummer_punkt2komma($vorschuesse_aktuell); } $anp_tab[1]['KOSTENKAT'] = 'Betriebskosten Vorauszahlung'; $anp_tab[1]['AKTUELL'] = "{$vorschuesse_aktuell_a} €"; $anp_tab[1]['ANPASSUNG'] = "{$anp_betrag_a} €"; $anp_tab[1]['NEU'] = "{$vorschuesse_neu_a} €"; $pdf->ergebnis_tab["{$mieternummer} - {$empf}"]['VORSCHUSS_ALT'] = "{$vorschuesse_aktuell_a}"; if ($vorschuesse_neu > $vorschuesse_aktuell) { $pdf->ergebnis_tab["{$mieternummer} - {$empf}"]['VORSCHUSS_NEU'] = "<b>{$vorschuesse_neu_a}</b>"; } else { $pdf->ergebnis_tab["{$mieternummer} - {$empf}"]['VORSCHUSS_NEU'] = "{$vorschuesse_neu_a}"; } $anp_tab[3]['KOSTENKAT'] = ''; $anp_tab[3]['AKTUELL'] = ""; $anp_tab[3]['ANPASSUNG'] = ""; $anp_tab[3]['NEU'] = ""; $anp_tab[4]['KOSTENKAT'] = ''; $a_km = nummer_punkt2komma($mk->ausgangs_kaltmiete + $vorschuesse_aktuell + $hk_monatlich_letzte); // $n_km= nummer_punkt2komma($mk->ausgangs_kaltmiete + $vorschuesse_neu + $hk_vorschuss_neu); // if($bk_summe && $check_hk==true){ $n_km = nummer_punkt2komma($mk->ausgangs_kaltmiete + $vorschuesse_neu + $hk_vorschuss_neu); // } // if($check_hk==true && !$bk_summe){ // $n_km= nummer_punkt2komma($mk->ausgangs_kaltmiete + $hk_vorschuss_neu); // } // if($check_hk==false && $bk_summe){ // $n_km= nummer_punkt2komma($mk->ausgangs_kaltmiete + $vorschuesse_neu); // } $anp_tab[4]['AKTUELL'] = "{$a_km} €"; $anp_tab[4]['ANPASSUNG'] = "<b>Neue Miete</b>"; $anp_tab[4]['NEU'] = "<b>{$n_km} €</b>"; $pdf->ergebnis_tab["{$mieternummer} - {$empf}"]['A_MIETE'] = $a_km; $pdf->ergebnis_tab["{$mieternummer} - {$empf}"]['N_MIETE'] = $n_km; $cols = array('KOSTENKAT' => "", "AKTUELL" => "Derzeitige Miete", 'ANPASSUNG' => "Anpassungsbetrag", 'NEU' => "Neue Miete ab {$this->bk_verrechnungs_datum_d}"); $pdf->ezTable($anp_tab, $cols, "", array('showHeadings' => 1, 'shaded' => 1, 'titleFontSize' => 7, 'fontSize' => 7, 'xPos' => 55, 'xOrientation' => 'right', 'width' => 500, 'cols' => array('AKTUELL' => array('justification' => 'right', 'width' => 100), 'ANPASSUNG' => array('justification' => 'right', 'width' => 100), 'NEU' => array('justification' => 'right', 'width' => 100)))); $pdf->ezSetDy(-15); $pdf->ezText("Die Anpassung des Heiz- und Betriebskostenvorschusses hat eine vertragsverändernde Wirkung, bedarf aber nicht Ihrer Zustimmung. Sollte Sie bei Ihrer Bank einen Dauerauftrag eingerichtet haben, bitten wir diesen ändern zu lassen. Bei uns vorliegenden Einzugsermächtigung erfolgt automatisch ab {$this->bk_verrechnungs_datum_d} der Lastschrifteinzug der geänderten Miete. \n\n", 10, array('justification' => 'full')); $pdf->ezSetDy(-15); // $pdf->ezText("$this->footer_zahlungshinweis",10); // $pdf->ezText("$this->footer_zahlungshinweis", 10, array('justification'=>'full')); } /* ENDE ANPASSUNGSBLATT */ /* Anschreiben nur für Mietverträge */ if ($empf_kos_typ == 'MIETVERTRAG') { $mv = new mietvertraege(); $mv->get_mietvertrag_infos_aktuell($empf_kos_id); /* Wenn Mietvertrag aktuell anpassen, sonst nicht (d.h. Mieter wohnt noch in der Einheit) */ // $this->get_anpassung_infos($_SESSION['profil_id']); $this->get_anpassung_details($this->profil_id, 'Nebenkosten Vorauszahlung'); $anp_datum = date_mysql2german($this->bk_an_anpassung_ab); $p = new partners(); $p->get_partner_info($_SESSION[partner_id]); $pdf->ezNewPage(); $pdf->addText(480, 697, 8, "{$p->partner_ort}, {$this->bk_berechnungs_datum_d}"); /* * echo '<pre>'; * print_r($mv); * die(); * * /*Wennn ausgezogen */ $pap = $mv->postanschrift[0]['anschrift']; if (!empty($pap)) { $pdf->ezText("{$pap}", 10); $pap = ''; } else { $pdf->ezText("{$mv->personen_name_string_u}\n{$mv->haus_strasse} {$mv->haus_nr}\n\n{$mv->haus_plz} {$mv->haus_stadt}", 10); } /* * if($mv->mietvertrag_aktuell=='0'){ * $anschrift_xx = $mv->postanschrift[0]['anschrift']; * $pdf->ezText("$anschrift_xx",10); * }else{ * $pdf->ezText("$mv->personen_name_string_u\n$mv->haus_strasse $mv->haus_nr\n\n$mv->haus_plz $mv->haus_stadt",10); * } */ $pdf->ezSetDy(-60); /* Pr�fen ob heizkostenabgerechnet worden sind */ $check_hk = $this->check_hk_abrechnung($empf_kos_typ, $empf_kos_id, $this->bk_jahr); if ($check_hk == true) { $hk_summe = $this->summe_hk_abrechnung($empf_kos_typ, $empf_kos_id, $this->bk_jahr); $hk_summe_a = nummer_punkt2komma($hk_summe); $pdf->ezText("<b>Heiz- und Betriebskostenabrechnung Einheit: {$mv->einheit_kurzname}</b>", 10); $tab_ans[1]['KOSTENART'] = 'Heizkosten/Warmwasser'; if ($hk_summe < 0) { $hk_erg_a = 'Nachzahlung'; } else { $hk_erg_a = 'Guthaben'; } $tab_ans[1]['ERGEBNIS'] = $hk_erg_a; $tab_ans[1]['SUMME'] = $hk_summe_a . ' €'; } else { $pdf->ezText("<b>Betriebskostenabrechnung {$this->bk_jahr} Einheit: {$mv->einheit_kurzname}</b>", 10); } $pdf->ezText("<b>{$this->bk_bezeichnung}</b>", 10); $pdf->ezText("Wirtschaftseinheit: {$this->bk_kos_bez}", 10); // $pdf->ezText("Einheit: $mv->einheit_kurzname",12); $pdf->ezSetDy(-12); /* Faltlinie */ $pdf->setLineStyle(0.2); $pdf->line(5, 542, 20, 542); $pdf->ezText("{$anrede}", 12); $pdf->ezText("{$mv->mv_anrede}", 10); $pdf->ezText("namens und im Auftrag der Eigentümer erhalten Sie nachfolgend die Betriebs- und Heizkostenabrechnung für das Kalenderjahr {$this->bk_jahr} mit entsprechenden Erläuterungen zu den einzelnen Abrechnungspositionen und eventuellen Veränderungen zu vorangegangenen Abrechnungen.\n\n\t\tDaraus ergibt sich für Sie folgendes Ergebnis:", 10, array('justification' => 'full')); $tab_ans[0]['KOSTENART'] = 'Betriebskosten'; if ($ergebnis < 0) { $bk_ergebnis = 'Nachzahlung'; } if ($ergebnis > 0) { $bk_ergebnis = 'Guthaben'; } if ($ergebnis == 0) { $bk_ergebnis = 'Ergebnis'; } /* Wenn kein Bruttomieter */ $mkk = new mietkonto(); if ($mkk->check_vz_anteilig($empf_kos_id, $monat, $jahr) == true) { // die('Sanel'); $tab_ans[0]['ERGEBNIS'] = $bk_ergebnis; $ergebnis_a_a = nummer_punkt2komma($ergebnis); $tab_ans[0]['SUMME'] = $ergebnis_a_a . ' €'; } else { // die($empf_kos_id); $bk_ergebnis = 0.0; $ergebnis_a_a = nummer_punkt2komma(0.0); $tab_ans[0]['SUMME'] = $ergebnis_a_a . ' €'; $ergebnis = 0.0; } // if($summe_nebenkosten_jahr>0){ // $tab_ans[0]['ERGEBNIS'] = $bk_ergebnis; // $ergebnis_a_a = nummer_punkt2komma($ergebnis); // $tab_ans[0]['SUMME'] = $ergebnis_a_a.' €'; // }else{ // $bk_ergebnis = 0.00; // $ergebnis_a_a = nummer_punkt2komma(0.00); // $tab_ans[0][SUMME] = $ergebnis_a_a.' €'; // $ergebnis = 0.00; // } $tab_ans[2][KOSTENART] = ''; $tab_ans[2][ERGEBNIS] = ''; $tab_ans[2][SUMME] = ''; $end_erg = $hk_summe + $ergebnis; if ($end_erg < 0) { $end_erg_ergebnis = 'Nachzahlung'; } if ($end_erg > 0) { $end_erg_ergebnis = 'Guthaben'; } if ($end_erg == 0) { $end_erg_ergebnis = 'Ergebnis'; } $tab_ans[3][KOSTENART] = '<b>Gesamtergebnis</b>'; $tab_ans[3][ERGEBNIS] = "<b>{$end_erg_ergebnis}</b>"; $tab_ans[3][SUMME] = '<b>' . nummer_punkt2komma($end_erg) . ' €' . '</b>'; $pdf->ezSetDy(-8); $cols = array('KOSTENART' => "Betriebskostenart", 'ERGEBNIS' => "Ergebnis", 'SUMME' => "Summe"); $pdf->ezTable($tab_ans, $cols, "", array('showHeadings' => 1, 'shaded' => 1, 'titleFontSize' => 7, 'fontSize' => 7, 'xPos' => 55, 'xOrientation' => 'right', 'width' => 500, 'cols' => array('KOSTENART' => array('justification' => 'left', 'width' => 345), 'ERGEBNIS' => array('justification' => 'left', 'width' => 55), 'SUMME' => array('justification' => 'right', 'width' => 100)))); } $pdf->ezSetDy(-10); $pdf->ezText("Die Abrechnungsunterlagen können nach vorheriger Terminabsprache bei uns im Büro eingesehen werden. Eventuelle Einwände gegen die Abrechnung sind bitte innerhalb eines Jahres nach Zugang der Abrechnung schriftlich bei uns anzuzeigen.", 10, array('justification' => 'full')); $pdf->ezSetDy(-10); $v_monat_arr = explode('-', $this->bk_verrechnungs_datum); $v_monat_name = monat2name($v_monat_arr['1']); $v_jahr = $v_monat_arr['0']; $pdf->ezText("Bei Vorlage einer Einzugsermächtigung wird das Guthaben aus der Abrechnung mit der Miete für den Monat {$v_monat_name} {$v_jahr} verrechnet. Nachzahlungsbeträge werden mit der Zahlung der Miete für den Monat {$v_monat_name} {$v_jahr} mit eingezogen, bitte sorgen Sie für eine ausreichende Kontodeckung bzw. informieren uns unbedingt, falls der Nachzahlungsbetrag nicht per Lastschrift eingezogen werden soll.", 10, array('justification' => 'full')); $pdf->ezSetDy(-10); if (isset($_SESSION[geldkonto_id])) { $g = new geldkonto_info(); $g->geld_konto_details($_SESSION[geldkonto_id]); } else { die("GELDKONTO AUSWÄHLEN"); } // $pdf->ezText("auf das Konto $g->kontonummer bei der $g->kredit_institut, BLZ $g->blz.\n\n",12); $pdf->ezText("Sollte uns keine Einzugsermächtigung vorliegen, bitten wir das Guthaben mit der nächsten Mietzahlung zu\nverrechnen bzw. den Nachzahlungsbetrag unter Angabe Ihrer Mieternummer <b>{$mieternummer}</b> auf das Konto mit der\n<b>IBAN</b> <b>{$g->IBAN1}</b> bei der <b>{$g->kredit_institut}</b> zu überweisen.", 10, array('justification' => 'left')); $pdf->ezSetDy(-10); $pdf->ezText("Bei verzogenen Mietern ist es uns nicht möglich die Nachzahlungsbeträge per Lastschrift einzuziehen, wir bitten hier um Überweisung auf das o.g. Geldkonto.", 10, array('justification' => 'full')); $pdf->ezText("Für die Erstattung eines Guthabens bitten wir Sie uns Ihre aktuelle Kontonummer schriftlich mitzuteilen.", 10); // print_r($g); // die(); $pdf->ezSetDy(-15); // $pdf->ezText("$this->footer_zahlungshinweis",10); /* Anschreiben ENDE */ } else { // $pdf->ezText("KEINE ANPASSUNG",10); } // }
switch ($pdfkopf) { case "VA": // va kopf $vahead = $pdf->openObject(); $va = $data["adststelle"]; $links = 40; $center = 797; $rechts = 455; $pdf->addPngFromFile($pathvars["fileroot"] . "/images/net/wappen-klein-sw.png", $links, 780, 35); $pdf->addPngFromFile($pathvars["fileroot"] . "/images/net/auge-klein.png", $links + 150, $center + 9, 34); $pdf->addText($links + 40, $center + 13, '14', 'Vermessungsamt'); $pdf->addText($links + 186, $center + 13, '14', $va); $pdf->addText($links + 40, $center - 10, '14', 'BFD Bereich: ' . $data["adstbfd"]); $pdf->addText($rechts - 9, $center + 10, '10', '<b>Intranet-Adressverwaltung</b>'); $pdf->addText($rechts + 49, $center - 13, '10', '<b>Einzel-Auszug</b>'); $pdf->line($links, $center - 26, $rechts + 117, $center - 26); $pdf->closeObject(); $pdf->addObject($vahead, 'all'); break; case "BFD": // bfd kopf $bfdhead = $pdf->openObject(); $bfd = $data["adststelle"]; $links = 40; $center = 797; $rechts = 455; $pdf->addPngFromFile($pathvars["fileroot"] . "/images/net/wappen-gross-sw.png", $links, 780, 80); $pdf->addText($links + 80, $center + 13, '14', 'Bezirksfinanzdirektion'); $pdf->addText($links + 80, $center - 10, '14', 'Vermessungsabteilung '); $pdf->addText($links + 220, $center + 13, '14', $bfd); $pdf->addText($rechts - 9, $center + 10, '10', '<b>Intranet-Adressverwaltung</b>');
function BuildPDFReport($userid) { $GLOBALS["SartON"] = time(); $q = new mysql(); $sql = "SELECT * FROM quarantine_report_users WHERE userid='{$userid}' and `type`=1 and `enabled`=1"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup")); if ($ligne["enabled"] == 0) { return; } $params = unserialize(base64_decode($ligne["parameters"])); $days = $params["days"]; $subject = $params["subject"]; $subject = str_replace("{", "", $subject); $subject = str_replace("}", "", $subject); $session = md5($user->password); if ($days < 1) { $days = 2; } $user = new user($userid); while (list($num, $ligne) = each($user->HASH_ALL_MAILS)) { $recipient_sql[] = "mailto='{$ligne}'"; } $date = date('Y-m-d'); $recipients = implode(" OR ", $recipient_sql); $sql = "SELECT mailfrom,zDate,MessageID,DATE_FORMAT(zdate,'%W %D %H:%i') as tdate,subject FROM quarantine\n\tWHERE (zDate>DATE_ADD('{$date}', INTERVAL -{$days} DAY)) AND ({$recipients}) ORDER BY zDate DESC;"; if ($GLOBALS["VERBOSE"]) { echo "{$sql}\n"; } $datepdf = date('Y-m-d'); $results = $q->QUERY_SQL($sql, "artica_backup"); $num_rows = mysql_num_rows($results); if (!$q->ok) { send_email_events("Build SMTP quarantine report failed for {$uid}", "{$sql}\n{$q->mysql_error}", "postfix"); return null; } if ($num_rows == 0) { return; } $pdf = new Cezpdf('a4', 'portrait'); $pdf->ezSetMargins(50, 70, 50, 50); $all = $pdf->openObject(); $pdf->saveState(); //$pdf->setStrokeColor(0,0,0,1); $pdf->line(20, 40, 578, 40); $pdf->line(20, 822, 578, 822); $pdf->addText(50, 34, 6, $date); $pdf->restoreState(); $pdf->closeObject(); $pdf->addObject($all, 'all'); $mainFont = dirname(__FILE__) . "/ressources/fonts/Helvetica.afm"; $codeFont = dirname(__FILE__) . "/ressources/fonts/Courier.afm"; $pdf->selectFont($mainFont); $pdf->ezText("{$user->DisplayName}\n", 30, array('justification' => 'centre')); $pdf->ezText("{$subject}\n", 20, array('justification' => 'centre')); $pdf->ezText("{$date} ({$num_rows} message(s))", 18, array('justification' => 'centre')); $pdf->ezStartPageNumbers(100, 30, 12, "left", "Page {PAGENUM}/{TOTALPAGENUM}"); $pdf->ezNewPage(); $options = array('showLines' => 2, 'showHeadings' => 0, 'shaded' => 2, 'shadeCol' => array(1, 1, 1), 'shadeCol2' => array(0.8, 0.8, 0.8), 'fontSize' => 11, 'textCol' => array(0, 0, 0), 'textCol2' => array(1, 1, 1), 'titleFontSize' => 16, 'titleGap' => 8, 'rowGap' => 5, 'colGap' => 10, 'lineCol' => array(1, 1, 1), 'xPos' => 'left', 'xOrientation' => 'right', 'width' => 500, 'maxWidth' => 500); while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $mail_subject = $ligne["subject"]; $from = trim($ligne["mailfrom"]); $zDate = $ligne["tdate"]; $MessageID = $ligne["MessageID"]; if ($from == null) { $from = "unknown"; } $domain = "unknown"; if (preg_match("#(.+?)@(.+)#", $from, $re)) { $domain = $re[2]; } $mail_subject = str_replace("{", "", $mail_subject); $mail_subject = str_replace("}", "", $mail_subject); $uri = "<c:alink:{{$params["URI"]}/user.quarantine.query.php?uid={$user->uid}&session={$session}&mail={$MessageID}>{$mail_subject}</c:alink>"; $data[] = array($zDate, $from, $uri); } $pdf->ezTable($data, $cols, $subject, $options); $pdfcode = $pdf->output(); $fname = "/tmp/" . date('Ymdhi') . "-{$user->mail}-quarantines.pdf"; if ($GLOBALS["VERBOSE"]) { echo "{$pdf->messages}\nbuilding {$fname}\n"; } @unlink($fname); if ($GLOBALS["VERBOSE"]) { echo "Building {$fname}\n"; } $fp = fopen($fname, 'w'); fwrite($fp, $pdfcode); fclose($fp); if (preg_match("#(.+?)@(.+)#", $user->mail, $re)) { $domain = $re[2]; } $PostmasterAdress = "no-reply-quarantine@{$domain}"; $ini = new Bs_IniHandler("/etc/artica-postfix/smtpnotif.conf"); if ($ini->_params["SMTP"]["smtp_sender"] != null) { $PostmasterAdress = $ini->_params["SMTP"]["smtp_sender"]; } if (file_exists('/etc/artica-postfix/settings/Daemons/PostfixPostmaster')) { $PostmasterAdress = trim(@file_get_contents('/etc/artica-postfix/settings/Daemons/PostfixPostmaster')); } $unix = new unix(); $sendmail = $unix->find_program("sendmail"); $mail = new PHPMailer(true); $mail->IsSendmail(); $mail->AddAddress($user->mail, $user->DisplayName); $mail->AddReplyTo($PostmasterAdress, $PostmasterAdress); $mail->From = $PostmasterAdress; $mail->Subject = $subject; $mail->Body = "{$subject}\nSee attached file...\n"; $mail->AddAttachment($fname, basename($fname)); $content = $mail->Send(true); $tmpfile = "/tmp/" . md5(date('Y-m-d H:is') . "-{$user->uid}-msmtp"); file_put_contents($tmpfile, $content); $cmd = "{$sendmail} -bm -t -f {$PostmasterAdress} <{$tmpfile}"; system($cmd); @unlink($tmpfile); @unlink($fname); $SartOff = time(); $time_duration = distanceOfTimeInWords($GLOBALS["SartON"], $SartOff); send_email_events("SMTP quarantine report for {$user->mail} (success) {$num_rows} message(s)", "duration:{$time_duration}\nnothing to say more...", "postfix"); }
include "function/class.ezpdf.php"; include "function/fungsi_rupiah.php"; include "function/fungsi_indotgl.php"; $smarty = new Smarty(); $module = $_GET['module']; $user_id = $_COOKIE['user_id']; $pdf = new Cezpdf(); $pdf->ezSetCmMargins(3, 3, 3, 3); $pdf->selectFont('fonts/Times-Roman.afm'); $all = $pdf->openObject(); $pdf->setStrokeColor(0, 0, 0, 1); $pdf->addJpegFromFile('img/logo.jpg', 20, 800, 69); $pdf->addText(220, 820, 16, '<b>Laporan Penjualan</b>'); $pdf->addText(245, 800, 14, '<b>ASFA JAYA</b>'); $pdf->addText(75, 780, 8, 'Jl. Ki Hajar Dewantara No. 132 Arjawinangun, Cirebon, Telp. (0231) 358630, Hp. 08562121141, Email: takehikoboyz@gmail.com'); $pdf->line(10, 775, 578, 775); $pdf->line(10, 50, 578, 50); $pdf->addText(535, 764, 8); $pdf->addText(30, 34, 8, 'Dicetak tgl:' . date('d-m-Y') . ", " . date('G:i:s', time())); $pdf->closeObject(); $pdf->addObject($all, 'all'); $start_date = $_GET['start_date']; $end_date = $_GET['end_date']; $date_indo = tgl_indo($start_date); $date_in = tgl_indo($end_date); $sql_report = mysql_query("SELECT * FROM aj_sales_transaction a, aj_products b, aj_categories c WHERE a.sales_date BETWEEN '{$start_date}' AND '{$end_date}' AND a.product_id=b.product_id AND b.category_id=c.category_id ORDER BY a.sales_date,a.sales_time ASC"); $i = 1; while ($data_report = mysql_fetch_array($sql_report)) { $sales_date = tgl_indo($data_report[sales_date]); $sales_price = format_rupiah($data_report[sales_price]); $po_price = format_rupiah($data_report[po_price]);
function hv_pdf_kopf() { //include_once ('pdfclass/class.ezpdf.php'); $pdf = new Cezpdf('a4', 'portrait'); $pdf->ezSetCmMargins(4.5, 1, 1, 1); $berlus_schrift = 'pdfclass/fonts/Times-Roman.afm'; $text_schrift = 'pdfclass/fonts/Arial.afm'; $pdf->addJpegFromFile('includes/logos/logo_hv_sw.jpg', 220, 750, 175, 100); // $pdf->addJpgFromFile('pdfclass/logo_262_150_sw1.jpg', 300, 500, 250, 150); $pdf->setLineStyle(0.5); $pdf->selectFont($berlus_schrift); $pdf->addText(86, 743, 6, "BERLUS HAUSVERWALTUNG * Fontanestr. 1 * 14193 Berlin * Inhaber Wolfgang Wehrheim * Telefon: 89784477 * Fax: 89784479 * Email: info@berlus.de"); $pdf->line(42, 750, 550, 750); }
/** * Crea un pdf con el estado de cuenta de el cliente especificado * @param Array $args, $args['id_cliente'=>12[,'tipo_venta'=> 'credito | contado | saldo'] ], por default obtiene todas las compras del cliente */ public static function imprimirEstadoCuentaCliente($args) { //verificamos que se haya especificado el id del cliente if (!isset($args['id_cliente'])) { Logger::log("Error al obtener el estado de cuenta, no se ha especificado un cliente."); die('{"success": false, "reason": "Error al obtener el estado de cuenta, no se ha especificado un cliente."}'); } //verificamos que el cliente exista if (!($cliente = ClienteDAO::getByPK($args['id_cliente']))) { Logger::log("Error al obtener el estado de cuenta, no se tiene registro del cliente {$args['id_cliente']}."); die('{"success": false, "reason": "Error al obtener el estado de cuenta, no se tiene registro del cliente ' . $args['id_cliente'] . '"}'); } //obtenemos los datos del emisor $estado_cuenta = estadoCuentaCliente($args); //buscar los datos del emisor if (!($emisor = PosConfigDAO::getByPK('emisor'))) { Logger::log("no encuentro los datos del emisor"); die("no encuentro los datos del emisor"); } $emisor = json_decode($emisor->getValue())->emisor; $sucursal = SucursalDAO::getByPK($_SESSION['sucursal']); if (!$sucursal) { die("Sucursal invalida"); } include_once 'librerias/ezpdf/class.pdf.php'; include_once 'librerias/ezpdf/class.ezpdf.php'; $pdf = new Cezpdf(); $pdf->selectFont('../server/librerias/ezpdf/fonts/Helvetica.afm'); //margenes de un centimetro para toda la pagina $pdf->ezSetMargins(1, 1, 1, 1); /* * LOGO */ if (!($logo = PosConfigDAO::getByPK('url_logo'))) { Logger::log("Verifique la configuracion del pos_config, no se encontro el camṕo 'url_logo'"); die("Verifique la configuracion del POS, no se encontro el url del logo"); } //addJpegFromFile(imgFileName,x,y,w,[h]) //detectamos el tipo de imagen del logo if (substr($logo->getValue(), -3) == "jpg" || substr($logo->getValue(), -3) == "JPG" || substr($logo->getValue(), -4) == "jpeg" || substr($logo->getValue(), -4) == "JPEG") { $pdf->addJpegFromFile($logo->getValue(), puntos_cm(2), puntos_cm(25.5), puntos_cm(3.5)); } elseif (substr($logo->getValue(), -3) == "png" || substr($logo->getValue(), -3) == "PNG") { $pdf->addPngFromFile($logo->getValue(), puntos_cm(2), puntos_cm(25.5), puntos_cm(3.5)); } else { Logger::log("Verifique la configuracion del pos_config, la extension de la imagen del logo no es compatible"); die("La extension de la imagen usada para el logo del negocio no es valida."); } /* * ************************ * ENCABEZADO * ************************* */ $e = "<b>" . self::readableText($emisor->nombre) . "</b>\n"; $e .= formatAddress($emisor); $e .= "RFC: " . $emisor->rfc . "\n\n"; //datos de la sucursal $e .= "<b>Lugar de expedicion</b>\n"; $e .= self::readableText($sucursal->getDescripcion()) . "\n"; $e .= formatAddress($sucursal); $datos = array(array("emisor" => $e)); $pdf->ezSetY(puntos_cm(28.6)); $opciones_tabla = array(); $opciones_tabla['showLines'] = 0; $opciones_tabla['showHeadings'] = 0; $opciones_tabla['shaded'] = 0; $opciones_tabla['fontSize'] = 8; $opciones_tabla['xOrientation'] = 'right'; $opciones_tabla['xPos'] = puntos_cm(7.3); $opciones_tabla['width'] = puntos_cm(11); $opciones_tabla['textCol'] = array(0, 0, 0); $opciones_tabla['titleFontSize'] = 12; $opciones_tabla['rowGap'] = 3; $opciones_tabla['colGap'] = 3; $pdf->ezTable($datos, "", "", $opciones_tabla); $cajero = UsuarioDAO::getByPK($_SESSION['userid'])->getNombre(); $datos = array(array("col" => "<b>Cajero</b>"), array("col" => self::readableText($cajero)), array("col" => "<b>Cliente</b>"), array("col" => self::readableText($cliente->getRazonSocial())), array("col" => "<b>Limite de Credito</b>"), array("col" => FormatMoney($estado_cuenta->limite_credito, DONT_USE_HTML)), array("col" => "<b>Saldo</b>"), array("col" => FormatMoney($estado_cuenta->saldo, DONT_USE_HTML))); $pdf->ezSetY(puntos_cm(28.8)); $opciones_tabla['xPos'] = puntos_cm(12.2); $opciones_tabla['width'] = puntos_cm(6); $opciones_tabla['showLines'] = 0; $opciones_tabla['shaded'] = 2; $opciones_tabla['shadeCol'] = array(1, 1, 1); //$opciones_tabla['shadeCol2'] = array(0.054901961, 0.756862745, 0.196078431); $opciones_tabla['shadeCol2'] = array(0.8984375, 0.95703125, 0.99609375); $pdf->ezTable($datos, "", "", $opciones_tabla); //roundRect($pdf, puntos_cm(12.2), puntos_cm(28.8), puntos_cm(6), puntos_cm(4.25)); /** * ESTADO DE CUENTA */ $elementos = array(array('id_venta' => 'Venta', 'fecha' => 'Fecha', 'sucursal' => 'Sucursal', 'cajero' => 'Cajero', 'tipo_venta' => 'Tipo', 'tipo_pago' => 'Pago', 'total' => 'Total', 'pagado' => 'Pagado', 'saldo' => 'Saldo')); foreach ($estado_cuenta->array_ventas as $venta) { $array_venta = array(); $array_venta['id_venta'] = $venta['id_venta']; $array_venta['fecha'] = $venta['fecha']; $array_venta['sucursal'] = self::readableText($venta['sucursal']); $array_venta['cajero'] = self::readableText($venta['cajero']); $array_venta['cancelada'] = self::readableText($venta['cancelada']); $array_venta['tipo_venta'] = self::readableText($venta['tipo_venta']); $array_venta['tipo_pago'] = self::readableText($venta['tipo_pago']); $array_venta['total'] = FormatMoney($venta['total'], DONT_USE_HTML); $array_venta['pagado'] = FormatMoney($venta['pagado'], DONT_USE_HTML); $array_venta['saldo'] = FormatMoney($venta['saldo'], DONT_USE_HTML); array_push($elementos, $array_venta); } $pdf->ezText("", 8, array('justification' => 'center')); $pdf->ezSetY(puntos_cm(24)); $opciones_tabla['xPos'] = puntos_cm(2); $opciones_tabla['width'] = puntos_cm(16.2); $pdf->ezTable($elementos, "", "Estado de Cuenta", $opciones_tabla); //roundRect($pdf, puntos_cm(2), puntos_cm(24.3), puntos_cm(16.2), puntos_cm(3.2)); /* * ************************ * notas de abajo * ************************* */ $pdf->setLineStyle(1); $pdf->setStrokeColor(0.3359375, 0.578125, 0.89453125); $pdf->line(puntos_cm(2), puntos_cm(1.3), puntos_cm(18.2), puntos_cm(1.3)); $pdf->addText(puntos_cm(2), puntos_cm(1.0), 7, "Fecha de impresion: " . date("d/m/y") . " " . date("H:i:s")); //addJpegFromFile(imgFileName,x,y,w,[h]) //$pdf->addJpegFromFile("../www/media/logo_simbolo.jpg", puntos_cm(15.9), puntos_cm(.25), 25); $pdf->addText(puntos_cm(16.7), puntos_cm(0.6), 8, "caffeina.mx"); $pdf->ezStream(); }
function citeRecords($result, $rowsFound, $query, $queryURL, $showQuery, $showLinks, $rowOffset, $showRows, $previousOffset, $nextOffset, $wrapResults, $citeStyle, $citeOrder, $citeType, $orderBy, $headerMsg, $userID, $viewType) { global $officialDatabaseName; // these variables are defined in 'ini.inc.php' global $databaseBaseURL; global $contentTypeCharset; global $pdfPageSize; global $client; // The array '$transtab_refbase_pdf' contains search & replace patterns for conversion from refbase markup to PDf markup & entities global $transtab_refbase_pdf; // defined in 'transtab_refbase_pdf.inc.php' // Initialize array variables: $yearsArray = array(); $typeTitlesArray = array(); // Define inline text markup to be used by the 'citeRecord()' function: $markupPatternsArray = array("bold-prefix" => "<b>", "bold-suffix" => "</b>", "italic-prefix" => "<i>", "italic-suffix" => "</i>", "underline-prefix" => "<u>", "underline-suffix" => "</u>", "endash" => "¦", "emdash" => "©", "ampersand" => "&", "double-quote" => '"', "double-quote-left" => "ª", "double-quote-right" => "¬", "single-quote" => "'", "single-quote-left" => "®", "single-quote-right" => "¶", "less-than" => "<", "greater-than" => ">", "newline" => "\n"); // Defines search & replace 'actions' that will be applied upon PDF output to all those refbase fields that are listed // in the corresponding 'fields' element: $pdfSearchReplaceActionsArray = array(array('fields' => array("title", "publication", "abbrev_journal", "address", "keywords", "abstract", "orig_title", "series_title", "abbrev_series_title", "notes"), 'actions' => $transtab_refbase_pdf)); // For CLI queries, we'll allow paging thru the result set, i.e. we honour the values of the CLI options '-S|--start' ('$rowOffset') // and '-R|--rows' ('$showRows') ('$rowOffset' and '$showRows' are re-assigned in function 'seekInMySQLResultsToOffset()' in 'include.inc.php') if (preg_match("/^cli/i", $client)) { // if the query originated from a command line client such as the "refbase" CLI client ("cli-refbase-1.0") $showMaxRows = $showRows; } else { $showMaxRows = $rowsFound; } // otherwise show all rows // Setup the basic PDF document structure (PDF functions defined in 'class.ezpdf.php'): $pdf = new Cezpdf($pdfPageSize, 'portrait'); // initialize PDF object if (!empty($headerMsg)) { // adjust upper page margin if a custom header message was given $pageMarginTop = "70"; } else { $pageMarginTop = "50"; } $pdf->ezSetMargins($pageMarginTop, 70, 50, 50); // set document margins (top, bottom, left, right) // Set fonts: $headingFont = 'includes/classes/org/pdf-php/fonts/Helvetica.afm'; $textBodyFont = 'includes/classes/org/pdf-php/fonts/Times-Roman.afm'; // Re-map character numbers from the 0->255 range to a named character, i.e. replace an (unused) character for any other PostScript char; // see the PDF reference for a list of supported PostScript/PDF character names: <http://www.adobe.com/devnet/pdf/pdf_reference.html>; // for the decimal code numbers of the ISO-8859-1 character set, see e.g.: <http://www.ramsch.org/martin/uni/fmi-hp/iso8859-1.html> $diff = array(166 => 'endash', 169 => 'emdash', 170 => 'quotedblleft', 172 => 'quotedblright', 174 => 'quoteleft', 182 => 'quoteright'); // Select a font: $pdf->selectFont($textBodyFont, array('encoding' => 'WinAnsiEncoding', 'differences' => $diff)); $pdf->openHere('Fit'); // Put a footer (and optionally a header) on all the pages: $all = $pdf->openObject(); // start an independent object; all further writes to a page will actually go into this object, until a 'closeObject()' call is made $pdf->saveState(); $pdf->setStrokeColor(0, 0, 0, 1); // set line color $pdf->setLineStyle(0.5); // set line width // - print header line and header message at the specified x/y position: if (!empty($headerMsg)) { // Remove any colon (":") from end of header message: $headerMsg = trimTextPattern($headerMsg, ":", false, true); // function 'trimTextPattern()' is defined in 'include.inc.php' // Decode any HTML entities: // (these may occur in the header message e.g. if the user's preferred display language is not English but German or French, etc) $headerMsg = decodeHTML($contentTypeCharset, $headerMsg); // function 'decodeHTML()' is defined in 'include.inc.php', and '$contentTypeCharset' is defined in 'ini.inc.php' // Convert refbase markup in the header message into appropriate PDF markup & entities: $headerMsg = searchReplaceText($transtab_refbase_pdf, $headerMsg, true); // function 'searchReplaceText()' is defined in 'include.inc.php' if ($pdfPageSize == 'a4') { $pdf->line(20, 800, 575, 800); $pdf->addText(50, 805, 10, $headerMsg); } elseif ($pdfPageSize == 'letter') { $pdf->line(20, 750, 592, 750); $pdf->addText(50, 755, 10, $headerMsg); } } // - print footer line and footer text at the specified x/y position: if ($pdfPageSize == 'a4') { $pdf->line(20, 40, 575, 40); $pdf->addText(50, 28, 10, $officialDatabaseName . ' ¦ ' . $databaseBaseURL); // w.r.t. the endash, see notes at '$markupPatternsArray' and '$diff' above } elseif ($pdfPageSize == 'letter') { $pdf->line(20, 40, 592, 40); $pdf->addText(50, 28, 10, $officialDatabaseName . ' ¦ ' . $databaseBaseURL); } $pdf->restoreState(); $pdf->closeObject(); // close the currently open object; further writes will now go to the current page $pdf->addObject($all, 'all'); // note that object can be told to appear on just odd or even pages by changing 'all' to 'odd' or 'even' // Start printing page numbers: if ($pdfPageSize == 'a4') { $pdf->ezStartPageNumbers(550, 28, 10, '', '', 1); } elseif ($pdfPageSize == 'letter') { $pdf->ezStartPageNumbers(567, 28, 10, '', '', 1); } // LOOP OVER EACH RECORD: // Fetch one page of results (or less if on the last page) // (i.e., upto the limit specified in $showMaxRows) fetch a row into the $row array and ... for ($rowCounter = 0; $rowCounter < $showMaxRows && ($row = @mysql_fetch_array($result)); $rowCounter++) { foreach ($row as $rowFieldName => $rowFieldValue) { // Apply search & replace 'actions' to all fields that are listed in the 'fields' element of the arrays contained in '$pdfSearchReplaceActionsArray': foreach ($pdfSearchReplaceActionsArray as $fieldActionsArray) { if (in_array($rowFieldName, $fieldActionsArray['fields'])) { $row[$rowFieldName] = searchReplaceText($fieldActionsArray['actions'], $row[$rowFieldName], true); } } } // function 'searchReplaceText()' is defined in 'include.inc.php' // Order attributes according to the chosen output style & record type: $record = citeRecord($row, $citeStyle, $citeType, $markupPatternsArray, false); // function 'citeRecord()' is defined in the citation style file given in '$citeStyleFile' (which, in turn, must reside in the 'cite' directory of the refbase root directory), see function 'generateCitations()' // Print out the current record: if (!empty($record)) { // Print any section heading(s): if (preg_match("/year|type/i", $citeOrder)) { $headingPrefix = ""; $headingSuffix = ""; $sectionMarkupPrefix = "<b>"; $sectionMarkupSuffix = "</b>\n"; $subSectionMarkupPrefix = ""; $subSectionMarkupSuffix = "\n"; if ($citeOrder == "type-year") { $sectionMarkupSuffix .= "\n"; } list($yearsArray, $typeTitlesArray, $sectionHeading) = generateSectionHeading($yearsArray, $typeTitlesArray, $row, $citeOrder, $headingPrefix, $headingSuffix, $sectionMarkupPrefix, $sectionMarkupSuffix, $subSectionMarkupPrefix, $subSectionMarkupSuffix); // function 'generateSectionHeading()' is defined in 'cite.inc.php' if (!empty($sectionHeading)) { $pdf->selectFont($headingFont, array('encoding' => 'WinAnsiEncoding', 'differences' => $diff)); // use Helvetica $pdf->ezText($sectionHeading, '14', array('justification' => 'left')); // create heading using a font size of 14pt } } // If character encoding is not UTF-8 already, convert record text to UTF-8: // if ($contentTypeCharset != "UTF-8") // $record = convertToCharacterEncoding("UTF-8", "IGNORE", $record); // function 'convertToCharacterEncoding()' is defined in 'include.inc.php' // NOTE: Export of cited references to PDF does currently only work with a latin1 database but not with UTF-8 (since I don't know how to write Unicode characters to PDF). // As a workaround, we could convert UTF-8 characters to latin1 if possible (and omit any other higher ASCII chars) // TODO: While this workaround indeed fixes display issues with higher ASCII chars that have equivalents in the latin1 charset, this will currently swallow higher ASCII // hyphens/dashes such as endashes (which display correctly without this workaround). // if ($contentTypeCharset == "UTF-8") // $record = convertToCharacterEncoding("ISO-8859-1", "TRANSLIT", $record, "UTF-8"); // function 'convertToCharacterEncoding()' is defined in 'include.inc.php' // Set paragraph text options: $textOptions = array('justification' => 'full'); // possible array options: // 'left'=> number, gap to leave from the left margin // 'right'=> number, gap to leave from the right margin // 'aleft'=> number, absolute left position (overrides 'left') // 'aright'=> number, absolute right position (overrides 'right') // 'justification' => 'left','right','center','centre','full' // // only set one of the next two items (leading overrides spacing) // 'leading' => number, defines the total height taken by the line, independent of the font height. // 'spacing' => a real number, though usually set to one of 1, 1.5, 2 (line spacing as used in word processing) // Write PDF paragraph: $pdf->selectFont($textBodyFont, array('encoding' => 'WinAnsiEncoding')); // use Times-Roman $pdf->ezText($record . "\n", '12', $textOptions); // create text block with record text using "Times Roman" and a font size of 12pt } } return $pdf->ezStream(); }
$b->monatsbericht_mit_ausgezogenen(); $form->fieldset_ende(); break; case "test": ob_clean(); // ausgabepuffer leeren //include_once ('pdfclass/class.ezpdf.php'); $pdf = new Cezpdf('a4', 'portrait'); $pdf->ezSetCmMargins(4.5, 2.5, 2.5, 2.5); $berlus_schrift = 'pdfclass/fonts/Times-Roman.afm'; $text_schrift = 'pdfclass/fonts/Arial.afm'; $pdf->addJpegFromFile('includes/logos/hv_logo198_80.jpg', 450, 780, 100, 42); $pdf->setLineStyle(0.5); $pdf->selectFont($berlus_schrift); $pdf->addText(42, 743, 6, "BERLUS HAUSVERWALTUNG - Fontanestr. 1 - 14193 Berlin"); $pdf->line(42, 750, 550, 750); $seite = $pdf->ezGetCurrentPageNumber(); $alle_seiten = $pdf->ezPageCount; $data55 = array(array('num' => 1, 'name' => 'gandalf', 'type' => 'wizard'), array('num' => 2, 'name' => 'bilbo', 'type' => 'hobbit', 'url' => 'http://www.ros.co. nz/pdf/'), array('num' => 3, 'name' => 'frodo', 'type' => 'hobbit'), array('num' => 4, 'name' => 'saruman', 'type' => 'bad dude', 'url' => 'http://sourceforge.net/projects/pdf-php'), array('num' => 5, 'name' => 'sauron', 'type' => 'really bad dude')); $pdf->ezTable($data55); // header('Content-type: application/pdf'); // header('Content-Disposition: attachment; filename="downloaded.pdf"'); // $output = $pdf->Output(); // $len = strlen($output); // header("Content-type: application/pdf"); // wird von MSIE ignoriert // header("content-length: $len"); // header("Content-Disposition: inline; filename=test.pdf"); //im fenster // header("Content-Disposition: attachment; filename=test.pdf"); // echo $output; // jetzt ausgeben
function kosten_einnahmen_pdf($geldkontos_arr, $monat, $jahr) { $anzahl_konten = count($geldkontos_arr); $datum_jahresanfang = "01.01.{$jahr}"; if ($anzahl_konten) { ob_clean(); // ausgabepuffer leeren /* PDF AUSGABE */ //include_once ('pdfclass/class.ezpdf.php'); $pdf = new Cezpdf('a4', 'portrait'); $pdf->selectFont('Helvetica.afm'); $pdf->ezSetCmMargins(4.5, 0, 0, 0); /* Kopfzeile */ $pdf->addJpegFromFile('includes/logos/logo_hv_sw.jpg', 220, 750, 175, 100); $pdf->setLineStyle(0.5); $pdf->addText(86, 743, 6, "BERLUS HAUSVERWALTUNG * Fontanestr. 1 * 14193 Berlin * Inhaber Wolfgang Wehrheim * Telefon: 89784477 * Fax: 89784479 * Email: info@berlus.de"); $pdf->line(42, 750, 550, 750); /* Footer */ $pdf->line(42, 50, 550, 50); $pdf->addText(170, 42, 6, "BERLUS HAUSVERWALTUNG * Fontanestr. 1 * 14193 Berlin * Inhaber Wolfgang Wehrheim"); $pdf->addText(150, 35, 6, "Bankverbindung: Dresdner Bank Berlin * BLZ: 100 800 00 * Konto-Nr.: 05 804 000 00 * Steuernummer: 24/582/61188"); $pdf->addInfo('Title', "Monatsbericht {$objekt_name} {$monatname} {$jahr}"); $pdf->addInfo('Author', $_SESSION['username']); $pdf->ezStartPageNumbers(100, 760, 8, '', 'Seite {PAGENUM} von {TOTALPAGENUM}', 1); $g_kosten_jahr = 0.0; /* Schleife für jedes Geldkonto bzw. Zeilenausgabe */ for ($a = 0; $a < $anzahl_konten; $a++) { $geldkonto_id = $geldkontos_arr[$a]['GELDKONTO_ID']; $objekt_name = $geldkontos_arr[$a]['OBJEKT_NAME']; $this->kontostand_tagesgenau_bis($geldkonto_id, $datum_jahresanfang); $kontostand_jahresanfang = $this->summe_konto_buchungen; $this->summe_kontobuchungen_jahr_monat($geldkonto_id, '80001', $jahr, $monat); $summe_mieteinnahmen_monat = $this->summe_konto_buchungen; $this->summe_miete_jahr($geldkonto_id, '80001', $jahr, $monat); $summe_mieteinnahmen_jahr = $this->summe_konto_buchungen; $this->summe_kosten_jahr_monat($geldkonto_id, '80001', $jahr, $monat); $summe_kosten_monat = $this->summe_konto_buchungen; $this->summe_kosten_jahr($geldkonto_id, '80001', $jahr, $monat); $summe_kosten_jahr = $this->summe_konto_buchungen; /* * if($monat < 12){ * $monat_neu = $monat + 1; * $jahr_neu = $jahr; * } * if($monat == 12){ * $monat_neu = 1; * $jahr_neu = $jahr +1; * } */ $monat = sprintf('%02d', $monat); $letzter_tag_m = letzter_tag_im_monat($monat, $jahr); $datum_bis = "{$letzter_tag_m}.{$monat}.{$jahr}"; $this->kontostand_tagesgenau_bis($geldkonto_id, $datum_bis); $kontostand_heute = $this->summe_konto_buchungen; $monatname = monat2name($monat); /* Gesamtsummen bilden */ $g_kontostand_ja = $g_kontostand_ja + $kontostand_jahresanfang; $g_me_monat = $g_me_monat + $summe_mieteinnahmen_monat; $g_me_jahr = $g_me_jahr + $summe_mieteinnahmen_jahr; $g_kosten_monat = $g_kosten_monat + $summe_kosten_monat; $g_kosten_jahr += $summe_kosten_jahr; $g_kontostand_akt = $g_kontostand_akt + $kontostand_heute; $kontostand_jahresanfang = nummer_punkt2komma($kontostand_jahresanfang); $summe_mieteinnahmen_monat = nummer_punkt2komma($summe_mieteinnahmen_monat); $summe_mieteinnahmen_jahr = nummer_punkt2komma($summe_mieteinnahmen_jahr); $summe_kosten_monat = nummer_punkt2komma($summe_kosten_monat); $summe_kosten_jahr = nummer_punkt2komma($summe_kosten_jahr); $kontostand_heute = nummer_punkt2komma($kontostand_heute); // echo "<b>$kontostand_jahresanfang| $summe_mieteinnahmen_monat|$summe_mieteinnahmen_jahr|$summe_kosten_monat|$summe_kosten_jahr|$kontostand_heute</b><br>"; $table_arr[$a]['OBJEKT_NAME'] = $objekt_name; $table_arr[$a]['KONTOSTAND1_1'] = $kontostand_jahresanfang; $table_arr[$a]['ME_MONAT'] = $summe_mieteinnahmen_monat; $table_arr[$a]['ME_JAHR'] = $summe_mieteinnahmen_jahr; $table_arr[$a]['KOSTEN_MONAT'] = $summe_kosten_monat; $table_arr[$a]['KOSTEN_JAHR'] = $summe_kosten_jahr; $table_arr[$a]['KONTOSTAND_AKTUELL'] = "<b>{$kontostand_heute}</b>"; } // end for /* Summenzeile hinzufügen */ $table_arr[$a]['OBJEKT_NAME'] = "<b>Summe incl. FON</b>"; $table_arr[$a]['KONTOSTAND1_1'] = '<b>' . nummer_punkt2komma($g_kontostand_ja) . '</b>'; $table_arr[$a]['ME_MONAT'] = '<b>' . nummer_punkt2komma($g_me_monat) . '</b>'; $table_arr[$a]['ME_JAHR'] = '<b>' . nummer_punkt2komma($g_me_jahr) . '</b>'; $table_arr[$a]['KOSTEN_MONAT'] = '<b>' . nummer_punkt2komma($g_kosten_monat) . '</b>'; $table_arr[$a]['KOSTEN_JAHR'] = '<b>' . nummer_punkt2komma($g_kosten_jahr) . '</b>'; $table_arr[$a]['KONTOSTAND_AKTUELL'] = '<b>' . nummer_punkt2komma($g_kontostand_akt) . '</b>'; $pdf->ezTable($table_arr, array('OBJEKT_NAME' => 'Objekt', 'KONTOSTAND1_1' => "Kontostand {$datum_jahresanfang}", 'ME_MONAT' => "Mieten Einnahmen {$monatname}", 'ME_JAHR' => "Mieten Einnahmen {$jahr}", 'KOSTEN_MONAT' => "Kosten {$monatname}", 'KOSTEN_JAHR' => "Kosten {$jahr}", 'KONTOSTAND_AKTUELL' => "Kontostand"), '<b>Kosten & Einnahmen / Objekt (Tabellarische übersicht)</b>', array('shaded' => 0, 'width' => '500', 'justification' => 'right', 'cols' => array('KONTOSTAND1_1' => array('justification' => 'right'), 'ME_MONAT' => array('justification' => 'right'), 'ME_MONAT' => array('justification' => 'right'), 'ME_JAHR' => array('justification' => 'right'), 'KOSTEN_MONAT' => array('justification' => 'right'), 'KOSTEN_JAHR' => array('justification' => 'right'), 'KONTOSTAND_AKTUELL' => array('justification' => 'right')))); ob_clean(); // ausgabepuffer leeren header("Content-type: application/pdf"); // wird von MSIE ignoriert $pdf->ezStream(); } else { echo "Keine Daten Error 65922"; } }
function saldenliste_mv_pdf($monat, $jahr) { ob_clean(); // ausgabepuffer leeren /* PDF AUSGABE */ //include_once ('pdfclass/class.ezpdf.php'); $pdf = new Cezpdf('a4', 'portrait'); $pdf->selectFont('Helvetica.afm'); $pdf->ezSetCmMargins(4.5, 0, 0, 0); /* Kopfzeile */ $pdf->addJpegFromFile('includes/logos/logo_hv_sw.jpg', 220, 750, 175, 100); $pdf->setLineStyle(0.5); $pdf->addText(86, 743, 6, "BERLUS HAUSVERWALTUNG * Fontanestr. 1 * 14193 Berlin * Inhaber Wolfgang Wehrheim * Telefon: 89784477 * Fax: 89784479 * Email: info@berlus.de"); $pdf->line(42, 750, 550, 750); /* Footer */ $pdf->line(42, 50, 550, 50); $pdf->addText(170, 42, 6, "BERLUS HAUSVERWALTUNG * Fontanestr. 1 * 14193 Berlin * Inhaber Wolfgang Wehrheim"); $pdf->addText(150, 35, 6, "Bankverbindung: Dresdner Bank Berlin * BLZ: 100 800 00 * Konto-Nr.: 05 804 000 00 * Steuernummer: 24/582/61188"); $pdf->addInfo('Title', "Saldenliste {$objekt_name} {$monatname} {$jahr}"); $pdf->addInfo('Author', $_SESSION[username]); $pdf->ezStartPageNumbers(550, 755, 7, '', "Seite {PAGENUM} von {TOTALPAGENUM}"); // echo "Monatsbericht Mieter - Monatsbericht Kostenkonten<br>"; // echo "<h3>Aktuelle Mieterstatistik mit ausgezogene Mieter<br></h3>"; $s = new statistik(); $jahr = $_REQUEST[jahr]; if (empty($jahr)) { $jahr = date("Y"); } else { if (strlen($jahr) < 4) { $jahr = date("Y"); } } // $jahr_monat = date("Y-m"); // $jahr = date("Y"); $monat = $_REQUEST[monat]; if (empty($monat)) { $monat = date("m"); } else { if (strlen($monat) < 2) { $monat = '0' . $monat; } } // $monat = '04'; $jahr_monat = $jahr . '-' . $monat; // $jahr_vormonat = mktime(0, 0, 0, date("m")-1, date("d"), date("Y")); // $jahr_vormonat = date("Y-m",$jahr_vormonat); $bg = new berlussimo_global(); $link = "?daten=mietvertrag_raus&mietvertrag_raus=saldenliste"; $bg->objekt_auswahl_liste($link); $bg->monate_jahres_links($jahr, $link); if (isset($_SESSION['objekt_id'])) { $objekt_id = $_SESSION['objekt_id']; $einheit_info = new einheit(); $o = new objekt(); $objekt_name = $o->get_objekt_name($objekt_id); $monatname = monat2name($monat); $pdf->addText(70, 755, 10, "Saldenliste {$objekt_name} {$monatname} {$jahr}"); $pdf->ezSetDy(25); $pdf->ezSetCmMargins(3, 3, 3, 3); $text_options = array(left => 0, justification => 'left'); $pdf->ezText("<b>Einheit</b>", 8, $text_options); $pdf->ezSetDy(9); $text_options = array(left => 100, justification => 'left'); $pdf->ezText("<b>Mieter</b>", 8, $text_options); $pdf->ezSetDy(9); $text_options = array(left => 270, justification => 'left'); $pdf->ezText("<b>Einzug</b>", 8, $text_options); $pdf->ezSetDy(9); $text_options = array(left => 320, justification => 'left'); $pdf->ezText("<b>Auszug</b>", 8, $text_options); $pdf->ezSetDy(9); $text_options = array(right => 0, justification => 'right'); $pdf->ezText("<b>SALDO EUR</b>", 8, $text_options); /* Aktuell bzw. gewünschten Monat berechnen */ $ob = new objekt(); $einheiten_array = $ob->einheiten_objekt_arr($objekt_id); // $einheiten_array = $s->vermietete_monat_jahr($jahr_monat,$objekt_id, ''); /* * echo "<pre>"; * print_r($einheiten_array); * echo "<h1> EINHEITEN: $anzahl_aktuell</h1>"; * $mv_array = $einheit_info->get_mietvertrag_ids('7'); * print_r($mv_array); */ $summe_sv = 0; $summe_mieten = 0; $summe_umlagen = 0; $summe_akt_gsoll = 0; $summe_g_zahlungen = 0; $summe_saldo_neu = 0; $anzahl_aktuell = count($einheiten_array); $miete = new miete(); $zeilen_pro_seite = 60; $aktuelle_zeile = 0; for ($i = 0; $i < $anzahl_aktuell; $i++) { $mv_array = $einheit_info->get_mietvertraege_bis("" . $einheiten_array[$i]['EINHEIT_ID'] . "", $jahr, $monat); $mv_anzahl = count($mv_array); if (is_array($mv_array)) { for ($b = 0; $b < $mv_anzahl; $b++) { $mv_id = $mv_array[$b]['MIETVERTRAG_ID']; $mk = new mietkonto(); $mieter_ids = $mk->get_personen_ids_mietvertrag($mv_id); for ($a = 0; $a < count($mieter_ids); $a++) { $mieter_daten_arr[] = $mk->get_person_infos($mieter_ids[$a][PERSON_MIETVERTRAG_PERSON_ID]); } // $miete->mietkonto_berechnung_monatsgenau($mv_id, $jahr, $monat); $end_saldoo = $miete->saldo_berechnen_monatsgenau($mv_id, $monat, $jahr); $zeile = $zeile + 1; $einheit_kurzname = $einheiten_array[$i]['EINHEIT_KURZNAME']; $vn = RTRIM(LTRIM($mieter_daten_arr['0']['0']['PERSON_VORNAME'])); $nn = RTRIM(LTRIM($mieter_daten_arr['0']['0']['PERSON_NACHNAME'])); $akt_gesamt_soll = $miete->saldo_vormonat_stand + $miete->sollmiete_warm; $this->get_mietvertrag_infos_aktuell($mv_id); $l_tag_akt_monat = letzter_tag_im_monat($monat, $jahr); $l_datum = "{$jahr}-{$monat}-{$l_tag_akt_monat}"; if ($this->mietvertrag_bis == '0000-00-00' or $this->mietvertrag_bis > $l_datum) { $mv_bis = 'aktuell'; } else { $mv_bis = date_mysql2german($this->mietvertrag_bis); } $mv_von = date_mysql2german($this->mietvertrag_von); $end_saldoo = nummer_punkt2komma($end_saldoo); if ($mv_bis == 'aktuell') { // echo "$zeile. $einheit_kurzname $nn $vn SALDO NEU: $end_saldoo <br>"; $pdf->ezSetCmMargins(3, 3, 3, 3); $text_options = array(left => 0, justification => 'left'); $pdf->ezText("{$einheit_kurzname}", 8, $text_options); $pdf->ezSetDy(9); $text_options = array(left => 100, justification => 'left'); $pdf->ezText("{$nn} {$vn}", 8, $text_options); $pdf->ezSetDy(9); $text_options = array(left => 270, justification => 'left'); $pdf->ezText("{$mv_von}", 8, $text_options); $pdf->ezSetDy(9); $text_options = array(left => 320, justification => 'left'); $pdf->ezText("", 8, $text_options); $pdf->ezSetDy(9); $text_options = array(right => 0, justification => 'right'); $pdf->ezText("{$end_saldoo}", 8, $text_options); $aktuelle_zeile++; } else { // echo "<b>$zeile. $einheit_kurzname $nn $vn SALDO NEU: $end_saldoo € BEENDET AM :$mv_bis €</b><br>"; $pdf->ezSetCmMargins(3, 3, 3, 3); $text_options = array(left => 0, justification => 'left'); $pdf->ezText("{$einheit_kurzname}", 8, $text_options); $pdf->ezSetDy(9); $text_options = array(left => 100, justification => 'left'); $pdf->ezText("{$nn} {$vn}", 8, $text_options); $pdf->ezSetDy(9); $text_options = array(left => 270, justification => 'left'); $pdf->ezText("{$mv_von}", 8, $text_options); $pdf->ezSetDy(9); $text_options = array(left => 320, justification => 'left'); $pdf->ezText("{$mv_bis}", 8, $text_options); $pdf->ezSetDy(9); $text_options = array(right => 0, justification => 'right'); $pdf->ezText("{$end_saldoo}", 8, $text_options); $aktuelle_zeile++; } if ($zeilen_pro_seite == $aktuelle_zeile) { $pdf->ezNewPage(); /* Kopfzeile */ $pdf->addJpegFromFile('includes/logos/logo_hv_sw.jpg', 220, 750, 175, 100); $pdf->setLineStyle(0.5); $pdf->addText(86, 743, 6, "BERLUS HAUSVERWALTUNG * Fontanestr. 1 * 14193 Berlin * Inhaber Wolfgang Wehrheim * Telefon: 89784477 * Fax: 89784479 * Email: info@berlus.de"); $pdf->line(42, 750, 550, 750); /* Footer */ $pdf->line(42, 50, 550, 50); $pdf->addText(170, 42, 6, "BERLUS HAUSVERWALTUNG * Fontanestr. 1 * 14193 Berlin * Inhaber Wolfgang Wehrheim"); $pdf->addText(150, 35, 6, "Bankverbindung: Dresdner Bank Berlin * BLZ: 100 800 00 * Konto-Nr.: 05 804 000 00 * Steuernummer: 24/582/61188"); $pdf->addInfo('Title', "Saldenliste {$objekt_name} {$monatname} {$jahr}"); $pdf->addText(70, 755, 10, "Saldenliste {$objekt_name} {$monatname} {$jahr}"); $pdf->ezStartPageNumbers(550, 755, 7, '', "Seite {PAGENUM} von {TOTALPAGENUM}"); /* Überschriftzeile */ $pdf->ezSetDy(-18); $pdf->ezSetCmMargins(3, 3, 3, 3); $text_options = array(left => 0, justification => 'left'); $pdf->ezText("<b>Einheit</b>", 8, $text_options); $pdf->ezSetDy(9); $text_options = array(left => 100, justification => 'left'); $pdf->ezText("<b>Mieter</b>", 8, $text_options); $pdf->ezSetDy(9); $text_options = array(left => 270, justification => 'left'); $pdf->ezText("<b>Einzug</b>", 8, $text_options); $pdf->ezSetDy(9); $text_options = array(left => 320, justification => 'left'); $pdf->ezText("<b>Auszug</b>", 8, $text_options); $pdf->ezSetDy(9); $text_options = array(right => 0, justification => 'right'); $pdf->ezText("<b>SALDO EUR</b>", 8, $text_options); $aktuelle_zeile = 0; } unset($mieter_daten_arr); unset($nn); unset($vn); } // end if is_array mv_ids } } // hinweis_ausgeben("Saldenliste mit Vormieter für $objekt_name wurde erstellt<br>"); ob_clean(); // ausgabepuffer leeren $pdf->ezStopPageNumbers(); $pdf->ezStream(); /* Falls kein Objekt ausgewählt */ } else { echo "Objekt auswählen"; } }
function pdf_header($partner_id) { $pdf = new Cezpdf('a4', 'portrait'); $pdf->ezSetCmMargins(4.5, 1, 1, 1); $berlus_schrift = 'pdfclass/fonts/Times-Roman.afm'; $text_schrift = 'pdfclass/fonts/Arial.afm'; $pdf->addJpegFromFile('includes/logos/logo_hv_sw.jpg', 220, 750, 175, 100); // $pdf->addJpgFromFile('pdfclass/logo_262_150_sw1.jpg', 300, 500, 250, 150); $pdf->setLineStyle(0.5); $pdf->selectFont($berlus_schrift); $pdf->addText(42, 743, 6, "BERLUS HAUSVERWALTUNG - Fontanestr. 1 - 14193 Berlin"); $pdf->line(42, 750, 550, 750); $pdf->selectFont($berlus_schrift); $pdf->ezSetCmMargins(1, 1, 1, 1); $pdf->setLineStyle(0.5); $pdf->line(42, 50, 550, 50); $pdf->addText(170, 42, 6, "BERLUS HAUSVERWALTUNG | Fontanestr. 1 | 14193 Berlin | Inhaber Wolfgang Wehrheim"); $pdf->addText(150, 35, 6, "Bankverbindung: Dresdner Bank Berlin | BLZ: 100 800 00 | Konto-Nr.: 05 804 000 00 | Steuernummer: 24/582/61188"); return $pdf; }
$pdf->addText($labelx, $labely -= GENERAL_LEADING, GENERAL_FONT_SIZE, $order->delivery['postcode']); } if ($order->delivery['country'] && $order->delivery['country'] != 'NULL') { $pdf->addText($labelx, $labely -= GENERAL_LEADING, GENERAL_FONT_SIZE, $order->delivery['country']); } //Add order number to shipping label for s3 $pdf->ezSetY(90); $pdf->ezText($orders['orders_id'], 6, array('left' => '220')); //Add footer text $pdf->ezSetY(50); $pdf->ezText(str_replace($vilains, $cools, FOOTER_TEXT), 9, array('justification' => 'center')); //Add some lines to make things look a bit neater! //Add Footer Line $pdf->setStrokeColor(0, 0, 0); $pdf->setLineStyle(0.5); $pdf->line(30, 50, 565, 50); //Add line to split for totals $pdf->setStrokeColor(0, 0, 0); $pdf->setLineStyle(0.5); $pdf->line(30, 240, 565, 240); //Add line to top of products table $pdf->setStrokeColor(0, 0, 0); $pdf->setLineStyle(0.5); $pdf->line(30, 581, 565, 581); //Set cursor to make sure products display in same place each time $pos = 580; // products table layout change_color(TABLE_HEADER_BKGD_COLOR); $pdf->filledRectangle(LEFT_MARGIN, $pos - PRODUCT_TABLE_ROW_HEIGHT, PRODUCT_TABLE_HEADER_WIDTH, PRODUCT_TABLE_ROW_HEIGHT); $x = LEFT_MARGIN + PRODUCT_TABLE_LEFT_MARGIN; $pos = $pos - PRODUCT_TABLE_ROW_HEIGHT + PRODUCT_TABLE_BOTTOM_MARGIN;
*/ $pdf->stream(); } else { include_once $pathvars["libraries"] . "xtra.pdf.php"; include_once $pathvars["libraries"] . "xtra.ezpdf.php"; $pdf = new Cezpdf(); $pdf->selectFont('./fonts/Helvetica.afm'); $pdf->openHere("Fit"); // Image #ezImage(image,[padding],[width],[resize],[justification],[array border]); #$pdf->addPngFromFile($pathvars["fileroot"]."/images/net/wappen.png",20,780,70); #$pdf->addPngFromFile($pathvars["fileroot"]."/images/net/auge.png",500,780,70); $pdf->addPngFromFile($pathvars["fileroot"] . "/images/net/kleines-wappen.png", 30, 780, 46); $pdf->addPngFromFile($pathvars["fileroot"] . "/images/net/auge.png", 300, 780, 70); // eine linie $pdf->line(20, 770, 560, 770); $pdf->addText(120, 790, '20', '<b>Vermessungsamt</b>'); $pdf->addText(380, 790, '20', '<i>Friedberg</i>'); // seiten nummern $pdf->ezStartPageNumbers(300, 20, 12, '', '', 1); // hier geht es los $pdf->ezSetDy(-60); // spaltenweise ausgabe an $pdf->ezColumnsStart(array("num" => 2, "gap" => 20)); // wichtig: damit der die ausgabe am spaltenbeginn steht #$pdf->ezSetDy(10); // Textblock #$pdf->ezText($text,10,array( "justification" => "full" )); // "leading"=>20, "spacing"=>1 // Tabellen $data = array(array('num' => 1, 'name' => 'gandalf', 'type' => 'wizard'), array('num' => 2, 'name' => 'bilbo', 'type' => 'hobbit', 'url' => 'http://www.ros.co. nz/pdf/'), array('num' => 3, 'name' => 'frodo', 'type' => 'hobbit'), array('num' => 4, 'name' => 'saruman', 'type' => 'bad dude', 'url' => 'http://sourceforge.net/projects/pdf-php'), array('num' => 5, 'name' => 'sauron', 'type' => 'really bad dude')); for ($i = 0; $i <= 20; $i++) {
<?php include 'class.ezpdf.php'; $pdf = new Cezpdf(); // Set margin dan font $pdf->ezSetCmMargins(3, 3, 3, 3); $pdf->selectFont('fonts/Courier.afm'); $all = $pdf->openObject(); // Tampilkan logo //$pdf->setStrokeColor(0, 0, 0, 1); //$pdf->addJpegFromFile('logo.jpg',20,800,69); // Teks di tengah atas untuk judul header $pdf->addText(30, 820, 16, '<b>KARTU HASIL STUDI</b>'); $pdf->addText(30, 800, 16, '<b>UNIVERSITAS ISLAM NEGERI SUNAN GUNUNG DJATI BANDUNG</b>'); // Garis atas untuk header $pdf->line(10, 795, 578, 795); // Garis bawah untuk footer $pdf->line(10, 50, 578, 50); // Teks kiri bawah $pdf->addText(30, 34, 8, 'Dicetak tgl:' . date('d-m-Y, H:i:s')); $pdf->closeObject(); // Tampilkan object di semua halaman $pdf->addObject($all, 'all'); // Koneksi ke database dan tampilkan datanya include "../../../config/koneksi.php"; // Query untuk merelasikan kedua tabel $nima = $_POST['nim']; $semestera = $_POST['semester']; $tahuna = $_POST['tahun']; $hts = substr($_POST['tahun'], 0, 4); $ktr = $_POST['semester'];
include "../../Inc/fungsi_indotgl.php"; include "../../Inc/library.php"; $pdf = new Cezpdf(); // Set margin dan font $pdf->ezSetCmMargins(3, 3, 3, 3); $pdf->selectFont('fonts/Courier.afm'); $all = $pdf->openObject(); $pemilik = mysql_fetch_array(mysql_query("select nm_perusahaan,alamat from bigbook_perusahaan")) or die("gagal"); // Tampilkan logo $pdf->setStrokeColor(0, 0, 0, 1); $pdf->addJpegFromFile('logo.jpg', 20, 785, 69); // Teks di tengah atas untuk judul header $pdf->addText(150, 820, 16, '<b>Laporan Pembelian Bulan' . tgl_indo(date("Ymd")) . '</b>'); $pdf->addText(200, 800, 14, '<b>' . $pemilik[nm_perusahaan] . '</b>'); // Garis atas untuk header $pdf->line(10, 780, 578, 780); // Garis bawah untuk footer $pdf->line(10, 50, 578, 50); // Teks kiri bawah $pdf->addText(30, 34, 8, 'Dicetak tgl:' . date('d-m-Y, H:i:s')); $pdf->closeObject(); // Tampilkan object di semua halaman $pdf->addObject($all, 'all'); // Baca input tanggal yang dikirimkan user $mulai = $_GET[tgl1]; $selesai = $_GET[tgl2]; // Query untuk merelasikan kedua tabel di filter berdasarkan tanggal $sum = mysql_fetch_array(mysql_query("SELECT sum(total) as total from \n\t\tkd_pemb where tanggal between '{$mulai}' and '{$selesai}' AND status='Tunai'")); $sql = mysql_query("select kd_pemb.tanggal, kd_pemb.kd_pmb, kd_pemb.nofaktur,kd_pemb.tgl_faktur,supplier.nm_supplier,kd_pemb.total \n\t\tfrom kd_pemb,supplier where supplier.id_supplier=kd_pemb.id_supplier and \n\t\tkd_pemb.tanggal between '{$mulai}' and '{$selesai}' AND kd_pemb.status='Tunai' order by kd_pemb.tanggal asc"); $jml = mysql_num_rows($sql); if ($jml > 0) {
function get_printable_file($_FORM = array()) { global $TPL; $db = new db_alloc(); $TPL["companyName"] = config::get_config_item("companyName"); $TPL["companyNos1"] = config::get_config_item("companyACN"); $TPL["companyNos2"] = config::get_config_item("companyABN"); $TPL["img"] = config::get_config_item("companyImage"); $TPL["companyContactAddress"] = config::get_config_item("companyContactAddress"); $TPL["companyContactAddress2"] = config::get_config_item("companyContactAddress2"); $TPL["companyContactAddress3"] = config::get_config_item("companyContactAddress3"); $email = config::get_config_item("companyContactEmail"); $email and $TPL["companyContactEmail"] = "Email: " . $email; $web = config::get_config_item("companyContactHomePage"); $web and $TPL["companyContactHomePage"] = "Web: " . $web; $phone = config::get_config_item("companyContactPhone"); $fax = config::get_config_item("companyContactFax"); $phone and $TPL["phone"] = "Ph: " . $phone; $fax and $TPL["fax"] = "Fax: " . $fax; $taskPriorities = config::get_config_item("taskPriorities"); $projectPriorities = config::get_config_item("projectPriorities"); // Add requested fields to pdf $_FORM["showEdit"] = false; $fields["taskID"] = "ID"; $fields["taskName"] = "Task"; $_FORM["showProject"] and $fields["projectName"] = "Project"; $_FORM["showPriority"] || $_FORM["showPriorityFactor"] and $fields["priorityFactor"] = "Pri"; $_FORM["showPriority"] and $fields["taskPriority"] = "Task Pri"; $_FORM["showPriority"] and $fields["projectPriority"] = "Proj Pri"; $_FORM["showCreator"] and $fields["creator_name"] = "Creator"; $_FORM["showManager"] and $fields["manager_name"] = "Manager"; $_FORM["showAssigned"] and $fields["assignee_name"] = "Assigned To"; $_FORM["showDate1"] and $fields["dateTargetStart"] = "Targ Start"; $_FORM["showDate2"] and $fields["dateTargetCompletion"] = "Targ Compl"; $_FORM["showDate3"] and $fields["dateActualStart"] = "Start"; $_FORM["showDate4"] and $fields["dateActualCompletion"] = "Compl"; $_FORM["showDate5"] and $fields["dateCreated"] = "Created"; $_FORM["showTimes"] and $fields["timeBestLabel"] = "Best"; $_FORM["showTimes"] and $fields["timeExpectedLabel"] = "Likely"; $_FORM["showTimes"] and $fields["timeWorstLabel"] = "Worst"; $_FORM["showTimes"] and $fields["timeActualLabel"] = "Actual"; $_FORM["showTimes"] and $fields["timeLimitLabel"] = "Limit"; $_FORM["showPercent"] and $fields["percentComplete"] = "%"; $_FORM["showStatus"] and $fields["taskStatusLabel"] = "Status"; $rows = task::get_list($_FORM); $taskListRows = array(); foreach ((array) $rows as $row) { $row["taskPriority"] = $taskPriorities[$row["priority"]]["label"]; $row["projectPriority"] = $projectPriorities[$row["projectPriority"]]["label"]; $row["taskDateStatus"] = strip_tags($row["taskDateStatus"]); $row["percentComplete"] = strip_tags($row["percentComplete"]); $taskListRows[] = $row; } if ($_FORM["format"] != "html" && $_FORM["format"] != "html_plus") { // Build PDF document $font1 = ALLOC_MOD_DIR . "util/fonts/Helvetica.afm"; $font2 = ALLOC_MOD_DIR . "util/fonts/Helvetica-Oblique.afm"; $pdf_table_options = array("showLines" => 0, "shaded" => 0, "showHeadings" => 0, "xPos" => "left", "xOrientation" => "right", "fontSize" => 10, "rowGap" => 0, "fontSize" => 10); $pdf_table_options3 = array("showLines" => 2, "shaded" => 0, "width" => 750, "xPos" => "center", "fontSize" => 10, "lineCol" => array(0.8, 0.8, 0.8), "splitRows" => 1, "protectRows" => 0); $pdf = new Cezpdf(null, 'landscape'); $pdf->ezSetMargins(40, 40, 40, 40); $pdf->selectFont($font1); $pdf->ezStartPageNumbers(436, 30, 10, 'center', 'Page {PAGENUM} of {TOTALPAGENUM}'); $pdf->ezSetY(560); $TPL["companyContactAddress"] and $contact_info[] = array($TPL["companyContactAddress"]); $TPL["companyContactAddress2"] and $contact_info[] = array($TPL["companyContactAddress2"]); $TPL["companyContactAddress3"] and $contact_info[] = array($TPL["companyContactAddress3"]); $TPL["companyContactEmail"] and $contact_info[] = array($TPL["companyContactEmail"]); $TPL["companyContactHomePage"] and $contact_info[] = array($TPL["companyContactHomePage"]); $TPL["phone"] and $contact_info[] = array($TPL["phone"]); $TPL["fax"] and $contact_info[] = array($TPL["fax"]); $pdf->selectFont($font2); $y = $pdf->ezTable($contact_info, false, "", $pdf_table_options); $pdf->selectFont($font1); $line_y = $y - 10; $pdf->setLineStyle(1, "round"); $pdf->line(40, $line_y, 801, $line_y); $pdf->ezSetY(570); $image_jpg = ALLOC_LOGO; if (file_exists($image_jpg)) { $pdf->ezImage($image_jpg, 0, sprintf("%d", config::get_config_item("logoScaleX")), 'none'); $y = 700; } else { $y = $pdf->ezText($TPL["companyName"], 27, array("justification" => "right")); } $nos_y = $line_y + 22; $TPL["companyNos2"] and $nos_y = $line_y + 34; $pdf->ezSetY($nos_y); $TPL["companyNos1"] and $y = $pdf->ezText($TPL["companyNos1"], 10, array("justification" => "right")); $TPL["companyNos2"] and $y = $pdf->ezText($TPL["companyNos2"], 10, array("justification" => "right")); $pdf->ezSetY($line_y - 10); $y = $pdf->ezText("Task List", 20, array("justification" => "center")); $pdf->ezSetY($y - 20); $y = $pdf->ezTable($taskListRows, $fields, "", $pdf_table_options3); $pdf->ezSetY($y - 20); $pdf->ezStream(); // Else HTML format } else { echo task::get_list_html($taskListRows, $_FORM); } }
function berechnung_anzeigen($leerstand_arr, $vermietete_arr, $monat, $jahr) { echo '<pre>'; // print_r($vermietete_arr); $anzahl_vermietete = count($vermietete_arr); $mv = new mietvertrag(); $m = new mietkonto(); $haeuser = array(); $gsollmiete_vermietet = 0; for ($a = 0; $a < $anzahl_vermietete; $a++) { $einheit_id = $vermietete_arr[$a]['EINHEIT_ID']; $haus_str = $vermietete_arr[$a]['HAUS_STRASSE']; $haus_nr = $vermietete_arr[$a]['HAUS_NUMMER']; $haus_str_nr = $haus_str . ' ' . $haus_nr; if (!in_array($haus_str_nr, $haeuser)) { $haeuser[] = $haus_str_nr; } $mv->get_mietvertrag_infos_aktuell($einheit_id); $summe_f_monatlich = $m->summe_forderung_monatlich($mv->mietvertrag_id, $monat, $jahr); $gsollmiete_vermietet = $gsollmiete_vermietet + $summe_f_monatlich; } $anzahl_leer = count($leerstand_arr); $gsollmiete_leer = 0; for ($b = 0; $b < $anzahl_leer; $b++) { $einheit_id = $leerstand_arr[$b]['EINHEIT_ID']; $haus_str = $leerstand_arr[$b]['HAUS_STRASSE']; $haus_nr = $leerstand_arr[$b]['HAUS_NUMMER']; $haus_str_nr = $haus_str . ' ' . $haus_nr; if (!in_array($haus_str_nr, $haeuser)) { $haeuser[] = $haus_str_nr; } $sollmiete_leer = $this->get_sollmiete_leerstand($einheit_id); $gsollmiete_leer = $gsollmiete_leer + $sollmiete_leer; } // print_r($haeuser); $g_summe = $gsollmiete_vermietet + $gsollmiete_leer; $g_summe_a = nummer_punkt2komma($g_summe); $gsollmiete_vermietet_a = nummer_punkt2komma($gsollmiete_vermietet); $gsollmiete_leer_a = nummer_punkt2komma($gsollmiete_leer); $v_geb = $g_summe / 100 * 5; $brutto_vgeb = $v_geb * 1.19; $mwst_eur = $v_geb / 100 * 19; $mwst_eur = nummer_punkt2komma($mwst_eur); $brutto_vgeb_a = nummer_punkt2komma($brutto_vgeb); $v_geb_a = nummer_punkt2komma($v_geb); if (!isset($_REQUEST['pdf'])) { echo "{$gsollmiete_vermietet_a} € GESAMT SOLL VERMIETET<br>"; echo "{$gsollmiete_leer_a} € GESAMT SOLL LEER<br>"; echo " {$g_summe_a} € GESAMT SOLL<br>"; echo " {$v_geb_a} € NETTO VERWALTERGEBÜHR 5%<br>"; echo " <b>{$brutto_vgeb_a} € INKL. 19% MWST VERWALTERGEBÜHR 5%</b><hr>"; } else { /* PDF AUSGABE */ ob_clean(); // ausgabepuffer leeren header("Content-type: application/pdf"); // wird von MSIE ignoriert //include_once ('pdfclass/class.ezpdf.php'); $pdf = new Cezpdf('a4', 'portrait'); $pdf->ezSetCmMargins(4.5, 1, 1, 1); $berlus_schrift = 'pdfclass/fonts/Times-Roman.afm'; $text_schrift = 'pdfclass/fonts/Arial.afm'; $pdf->addJpegFromFile('includes/logos/logo_hv_sw.jpg', 220, 750, 175, 100); // $pdf->addJpgFromFile('pdfclass/logo_262_150_sw1.jpg', 300, 500, 250, 150); $pdf->setLineStyle(0.5); $pdf->selectFont($berlus_schrift); $pdf->addText(42, 743, 6, "BERLUS HAUSVERWALTUNG - Fontanestr. 1 - 14193 Berlin"); $pdf->line(42, 750, 550, 750); $monatsname = monat2name($monat); $pdf->addText(42, 720, 12, "Berechnungsbogen für die Verwaltergebühr {$monatsname} {$jahr}"); $pdf->addText(42, 650, 10, "Gesamtsoll aus vermieteten Einheiten"); $pdf->addText(300, 650, 10, "{$gsollmiete_vermietet_a} €"); $pdf->addText(42, 635, 10, "Gesamtsoll aus leerstehenden Einheiten"); $pdf->addText(300, 635, 10, "{$gsollmiete_leer_a} €"); $pdf->setLineStyle(0.5); $pdf->line(42, 630, 350, 630); $pdf->addText(42, 620, 10, "<b>Gesamtsoll"); $pdf->addText(300, 620, 10, "{$g_summe_a} €</b>"); $pdf->addText(42, 595, 10, "5% Verwaltergebühr"); $pdf->addText(300, 595, 10, "{$v_geb_a} €"); $pdf->addText(42, 585, 10, "+ 19% MWSt"); $pdf->addText(300, 585, 10, "{$mwst_eur} €"); $pdf->setLineStyle(0.5); $pdf->line(42, 580, 350, 580); $pdf->addText(42, 570, 10, "<b>Verwaltergebühr brutto"); $pdf->addText(300, 570, 10, "{$brutto_vgeb_a} €</b>"); /* Häuser */ $pdf->addText(42, 480, 10, "In diese Berechnung wurden folgende Häuser einbezogen:"); $text_xpos = 460; for ($c = 0; $c < count($haeuser); $c++) { $haus = $haeuser[$c]; $pdf->addText(42, $text_xpos, 10, "<b>{$haus}</b>"); $text_xpos = $text_xpos - 10; if ($text_xpos == 100) { $pdf->ezNewPage(); $text_xpos = 650; $pdf->ezSetCmMargins(4.5, 1, 1, 1); $berlus_schrift = 'pdfclass/fonts/Times-Roman.afm'; $text_schrift = 'pdfclass/fonts/Arial.afm'; $pdf->addJpegFromFile('includes/logos/logo_hv_sw.jpg', 220, 750, 175, 100); // $pdf->addJpgFromFile('pdfclass/logo_262_150_sw.jpg', 450, 780, 100, 42); $pdf->setLineStyle(0.5); $pdf->selectFont($berlus_schrift); $pdf->addText(42, 743, 6, "BERLUS HAUSVERWALTUNG - Fontanestr. 1 - 14193 Berlin"); $pdf->line(42, 750, 550, 750); $pdf->addText(42, 720, 12, "Berechnungsbogen für die Verwaltergebühr {$monat}/{$jahr}"); } } $pdf->ezStream(); } }