Ejemplo n.º 1
0
                 $db->query('UPDATE `' . getModeDetails($mode, 'TABLE_BILLING_INVOICES', 'table') . '` SET `state` = \'' . $db->escape($state) . '\', `state_change` = \'' . time() . '\' WHERE `id` = \'' . $id . '\' ');
             }
             if ($_POST['name'] != $contact['name'] || $_POST['firstname'] != $contact['firstname'] || $_POST['title'] != $contact['title'] || $_POST['company'] != $contact['company'] || $_POST['street'] != $contact['street'] || $_POST['zipcode'] != $contact['zipcode'] || $_POST['city'] != $contact['city'] || $_POST['country'] != $contact['country']) {
                 $invoiceXml->address->name[0] = utf8_encode(htmlspecialchars(validate($_POST['name'], 'name')));
                 $invoiceXml->address->firstname[0] = utf8_encode(htmlspecialchars(validate($_POST['firstname'], 'first name')));
                 $invoiceXml->address->title[0] = utf8_encode(htmlspecialchars(validate($_POST['title'], 'title')));
                 $invoiceXml->address->company[0] = utf8_encode(htmlspecialchars(validate($_POST['company'], 'company')));
                 $invoiceXml->address->street[0] = utf8_encode(htmlspecialchars(validate($_POST['street'], 'street')));
                 $invoiceXml->address->zipcode[0] = utf8_encode(htmlspecialchars(validate($_POST['zipcode'], 'zipcode', '/^[0-9 \\-A-Z]*$/')));
                 $invoiceXml->address->city[0] = utf8_encode(htmlspecialchars(validate($_POST['city'], 'city')));
                 $invoiceXml->address->country[0] = utf8_encode(htmlspecialchars(validate($_POST['country'], 'country')));
                 $db->query('UPDATE `' . getModeDetails($mode, 'TABLE_BILLING_INVOICES', 'table') . '` SET `xml` = \'' . $db->escape($invoiceXml->asXML()) . '\' WHERE `id` = \'' . $id . '\' ');
             }
             redirectTo($filename, array('s' => $s, 'mode' => $mode));
         } else {
             $result['invoice_date'] = makeNicePresentableDate($result['invoice_date'], $lng['panel']['dateformat_function']);
             $invoice_states_option = '';
             foreach ($lng['invoice']['states'] as $stateid => $statename) {
                 if ((int) $result['state'] <= (int) $stateid) {
                     $invoice_states_option .= makeoption($statename, $stateid, $result['state'], true);
                 }
             }
             $contact = htmlentities_array($contact);
             eval('echo "' . getTemplate('billing/invoices_edit') . '";');
         }
     }
 }
 if ($action == 'pdf') {
     $result = $db->query_first('SELECT * FROM `' . getModeDetails($mode, 'TABLE_BILLING_INVOICES', 'table') . '` WHERE `id` = \'' . $id . '\' ');
     if ($result['id'] == $id && $id != '0') {
         $invoice = new pdfInvoice();
Ejemplo n.º 2
0
 /**
  * This method processes the given contract array and creates
  * thogether with the given language array a pdf contract.
  *
  * @param array  A valid user array (a row with all fields from PANEL_ADMINS/PANEL_CUSTOMERS)
  * @param array  A valid language array
  *
  * @author Former03 GmbH :: Florian Lippert <*****@*****.**>
  */
 function processData($contract, $lng)
 {
     $this->pdf->addPage(null, null, true);
     $this->pdf->setFooterEnabled(true, $lng['invoice']['page_footer']);
     $contract_date = makeNicePresentableDate($contract['contract_date'], $lng['panel']['dateformat_function']);
     $contactdetails = '';
     if ($contract['company'] != '') {
         $contactdetails .= $contract['company'] . "\n";
     }
     if ($contract['title'] != '') {
         $contactdetails .= $contract['title'] . ' ';
     }
     if ($contract['firstname'] != '' && $contract['name'] != '') {
         $contactdetails .= $contract['firstname'] . ' ' . $contract['name'] . "\n";
     }
     $contactdetails .= $contract['street'] . "\n" . $contract['zipcode'] . ' ' . $contract['city'] . "\n" . $contract['country'];
     // Write Subject
     $this->pdf->SetFont('', 'B', 14);
     $this->pdf->SetXY(18, 32);
     $this->pdf->Cell(35, 4, utf8_decode('HOSTINGVERTRAG'), 0, 2, 'L');
     $this->pdf->Ln();
     // Write Date
     $this->pdf->SetFont('', '', 8);
     $this->pdf->SetXY(18, 25);
     $this->pdf->Cell(70, 4, sprintf(html_entity_decode($lng['invoice']['dateheader']), $contract_date), 0, 2, 'L');
     $this->pdf->Ln();
     // Write  invoice number
     $this->pdf->SetFont('', '', 10);
     $this->pdf->SetXY(18, 43);
     $this->pdf->Cell(0, 4, utf8_decode('zwischen der'), 0, 0, 'L');
     $this->pdf->Ln(8);
     $this->pdf->SetFont('', 'B', 10);
     $this->pdf->MultiCell(0, 4, utf8_decode('Provider GmbH' . "\n" . 'Strasse 1' . "\n" . '12345 Stadt' . "\n" . 'Land'), 0, 'L');
     $this->pdf->Ln(3);
     $this->pdf->SetFont('', '', 10);
     $this->pdf->Cell(0, 4, utf8_decode('im Folgenden "Provider" genannt'), 0, 0, 'L');
     $this->pdf->SetFont('', '', 10);
     $this->pdf->SetXY(18, 80);
     $this->pdf->Cell(0, 4, utf8_decode('und'), 0, 0, 'L');
     $this->pdf->Ln(8);
     $this->pdf->SetFont('', 'B', 10);
     $this->pdf->MultiCell(0, 4, $contactdetails, 0, 'L');
     $this->pdf->Ln(3);
     $this->pdf->SetFont('', '', 10);
     $this->pdf->Cell(0, 4, utf8_decode('im Folgenden "Kunde" genannt'), 0, 0, 'L');
     $this->pdf->SetFont('', 'B', 14);
     $this->pdf->SetXY(18, 130);
     $this->pdf->Cell(35, 4, utf8_decode('HOSTINGVERTRAG'), 0, 2, 'L');
     $this->pdf->Ln();
     $this->pdf->SetFont('', 'B', 10);
     $this->pdf->Cell(8, 4, utf8_decode('§ 1'), 0, 0, 'L');
     $this->pdf->Cell(0, 4, utf8_decode('KONDITIONEN'), 0, 0, 'L');
     $this->pdf->SetFont('', '', 10);
     $this->pdf->Ln(6);
     $this->pdf->Cell(8, 4, utf8_decode('(1)'), 0, 0, 'L');
     $this->pdf->MultiCell(0, 4, utf8_decode('Grundkonditionen'), 0, 'L');
     $this->pdf->Ln(3);
     $this->pdf->SetX(26);
     $this->pdf->Cell(80, 4, utf8_decode('Domains (.' . implode(', .', explode(' ', $contract['included_domains_tld'])) . ')'), 0, 0, 'L');
     $this->pdf->Cell(20, 4, utf8_decode($contract['included_domains_qty']), 0, 0, 'R');
     $this->pdf->Ln(6);
     $this->pdf->SetX(26);
     $this->pdf->Cell(80, 4, utf8_decode('Subdomains'), 0, 0, 'L');
     $this->pdf->Cell(20, 4, utf8_decode($contract['subdomains'] == '-1' ? html_entity_decode($lng['customer']['unlimited']) : $contract['subdomains']), 0, 0, 'R');
     $this->pdf->Ln(6);
     $this->pdf->SetX(26);
     $this->pdf->Cell(80, 4, utf8_decode('Webspace'), 0, 0, 'L');
     $this->pdf->Cell(20, 4, utf8_decode(($contract['diskspace'] / 1024 == '-1' ? html_entity_decode($lng['customer']['unlimited']) : $contract['diskspace'] / 1024) . ' MB'), 0, 0, 'R');
     $this->pdf->Ln(6);
     $this->pdf->SetX(26);
     $this->pdf->Cell(80, 4, utf8_decode('Frei-Traffic'), 0, 0, 'L');
     $this->pdf->Cell(20, 4, utf8_decode(($contract['traffic'] / (1024 * 1024) == '-1' ? html_entity_decode($lng['customer']['unlimited']) : $contract['traffic'] / (1024 * 1024)) . ' GB / Monat'), 0, 0, 'R');
     $this->pdf->Ln(6);
     $this->pdf->SetX(26);
     $this->pdf->Cell(80, 4, utf8_decode('FTP-Benutzer (Mehrfach Login möglich)'), 0, 0, 'L');
     $this->pdf->Cell(20, 4, utf8_decode($contract['ftps'] == '-1' ? html_entity_decode($lng['customer']['unlimited']) : $contract['ftps']), 0, 0, 'R');
     $this->pdf->Ln(6);
     $this->pdf->SetX(26);
     $this->pdf->Cell(80, 4, utf8_decode('Datenbanken (MySQL)'), 0, 0, 'L');
     $this->pdf->Cell(20, 4, utf8_decode($contract['mysqls'] == '-1' ? html_entity_decode($lng['customer']['unlimited']) : $contract['mysqls']), 0, 0, 'R');
     $this->pdf->Ln(6);
     $this->pdf->SetX(26);
     $this->pdf->Cell(80, 4, utf8_decode('E-Mail-Adressen'), 0, 0, 'L');
     $this->pdf->Cell(20, 4, utf8_decode($contract['emails'] == '-1' ? html_entity_decode($lng['customer']['unlimited']) : $contract['emails']), 0, 0, 'R');
     $this->pdf->Ln(6);
     $this->pdf->SetX(26);
     $this->pdf->Cell(80, 4, utf8_decode('POP3-Emailkonten'), 0, 0, 'L');
     $this->pdf->Cell(20, 4, utf8_decode($contract['email_accounts'] == '-1' ? html_entity_decode($lng['customer']['unlimited']) : $contract['email_accounts']), 0, 0, 'R');
     $this->pdf->Ln(6);
     $this->pdf->SetFont('', 'B', 10);
     $this->pdf->Cell(8, 4, utf8_decode('§ 2'), 0, 0, 'L');
     $this->pdf->Cell(0, 4, utf8_decode('KOSTEN'), 0, 0, 'L');
     $this->pdf->SetFont('', '', 10);
     $this->pdf->Ln(6);
     $this->pdf->Cell(8, 4, utf8_decode('(1)'), 0, 0, 'L');
     $this->pdf->MultiCell(0, 4, utf8_decode('Die monatlichen Kosten belaufen sich auf ' . $contract['interval_fee'] . ' ' . chr(128) . '.'), 0, 'L');
     $this->pdf->Ln(3);
     $this->pdf->Cell(8, 4, utf8_decode('(2)'), 0, 0, 'L');
     $this->pdf->MultiCell(0, 4, utf8_decode('Die Setup-Gebühr beträgt ' . $contract['setup_fee'] . ' ' . chr(128) . '.'), 0, 'L');
     $this->pdf->Ln(3);
     $this->pdf->Cell(8, 4, utf8_decode('(3)'), 0, 0, 'L');
     $this->pdf->MultiCell(0, 4, utf8_decode('Bei Überschreitung des Frei-Traffics koste' . ($contract['additional_traffic_unit'] / (1024 * 1024) == '1' ? 't jedes' : 'n ' . $contract['additional_traffic_unit'] / (1024 * 1024)) . ' weitere angefangene Gigabyte ' . $contract['additional_traffic_fee'] . ' ' . chr(128) . '.'), 0, 'L');
     $this->pdf->Ln(3);
     $this->pdf->Cell(8, 4, utf8_decode('(4)'), 0, 0, 'L');
     $this->pdf->MultiCell(0, 4, utf8_decode('Bei Überschreitung des Webspace koste' . ($contract['additional_diskspace_unit'] / 1024 == '1' ? 't jedes' : 'n ' . $contract['additional_diskspace_unit'] / 1024) . ' weitere angefangene Megabyte ' . $contract['additional_diskspace_fee'] . ' ' . chr(128) . '.'), 0, 'L');
     $this->pdf->Ln(3);
     $this->pdf->Cell(8, 4, utf8_decode('(5)'), 0, 0, 'L');
     $this->pdf->MultiCell(0, 4, utf8_decode('Alle Preise rein netto in Euro zuzüglich der gültigen gesetzlichen Umsatzsteuer.'), 0, 'L');
     $this->pdf->Ln(10);
     $this->pdf->Cell(70, 4, sprintf(html_entity_decode($lng['invoice']['dateheader']), $contract_date), 0, 0, 'L');
     $this->pdf->SetLineWidth(0.5);
     $this->pdf->Ln(20);
     $this->pdf->Cell(75, 4, utf8_decode('Unterschrift Kunde'), 'T', 0, 'L');
     $this->pdf->SetX(110);
     $this->pdf->Cell(75, 4, utf8_decode('Unterschrift Provider'), 'T', 0, 'L');
     $this->pdf->SetY(-0.1);
 }
Ejemplo n.º 3
0
 /**
  * This method processes the given xml string and creates
  * thogether with the given language array a pdf reminder.
  *
  * @param string The xml string which contains our invoice data
  * @param array  A valid language array
  *
  * @author Former03 GmbH :: Florian Lippert <*****@*****.**>
  */
 public function processData($xml, $lng)
 {
     $this->invoiceXml = new SimpleXMLElement($xml);
     $contactdetails = '';
     if (utf8_decode((string) $this->invoiceXml->address->company[0]) != '') {
         $contactdetails .= utf8_decode((string) $this->invoiceXml->address->company[0]) . "\n";
     }
     if (utf8_decode((string) $this->invoiceXml->address->title[0]) != '') {
         $contactdetails .= utf8_decode((string) $this->invoiceXml->address->title[0]) . ' ';
     }
     if (utf8_decode((string) $this->invoiceXml->address->firstname[0]) != '' && utf8_decode((string) $this->invoiceXml->address->name[0]) != '') {
         $contactdetails .= utf8_decode((string) $this->invoiceXml->address->firstname[0]) . ' ' . utf8_decode((string) $this->invoiceXml->address->name[0]) . "\n";
     }
     $contactdetails .= utf8_decode((string) $this->invoiceXml->address->street[0]) . "\n" . utf8_decode((string) $this->invoiceXml->address->zipcode[0]) . ' ' . utf8_decode((string) $this->invoiceXml->address->city[0]) . "\n" . utf8_decode((string) $this->invoiceXml->address->country[0]);
     $this->pdf->addPage();
     // Write Sender
     $this->pdf->SetTextColor(160, 160, 160);
     $this->pdf->SetFont('', 'B', 6);
     $this->pdf->SetXY(17.5, 50.5);
     $this->pdf->Cell(0, 0, html_entity_decode($lng['invoice']['sender']));
     $this->pdf->SetTextColor(0, 0, 0);
     $this->pdf->Ln();
     // Write Address
     $this->pdf->SetFont('', '', 10);
     $this->pdf->SetXY(18, 60);
     $this->pdf->MultiCell(70, 4, $contactdetails, 0, 'L');
     $this->pdf->Ln();
     // Write Subject
     $this->pdf->SetFont('', 'B', 13);
     $this->pdf->SetXY(18, 100);
     $this->pdf->Cell(35, 4, html_entity_decode($lng['invoice']['reminder']), 0, 2, 'L');
     $this->pdf->Ln();
     // Write Date
     $this->pdf->SetFont('', '', 8);
     $this->pdf->SetXY(18, 96);
     $this->pdf->Cell(70, 4, sprintf(html_entity_decode($lng['invoice']['dateheader']), makeNicePresentableDate(date('Y-m-d'), $lng['panel']['dateformat_function'])), 0, 2, 'L');
     $this->pdf->Ln();
     // Write  invoice number
     $this->pdf->SetFont('', '', 9);
     $this->pdf->SetXY(18, 110);
     $this->pdf->Cell(0, 4, utf8_decode('Sehr geehrte Damen und Herren,'), 0, 0, 'L');
     $this->pdf->Ln(8);
     $this->pdf->MultiCell(0, 4, utf8_decode('bisher haben wir keinen Geldeingang zu unserer Rechnung ' . (string) $this->invoiceXml->invoice_number[0] . ' vom ' . (string) $this->invoiceXml->invoice_date[0] . ' feststellen können. Die Rechnung bezog sich auf:'), 0, 'L');
     $this->pdf->SetFont('', 'B', 9);
     $this->pdf->Ln(4);
     $this->pdf->SetX(23);
     $this->pdf->MultiCell(0, 4, utf8_decode((string) $this->invoiceXml->billing->contract_details[0]), 0, 'L');
     $this->pdf->SetFont('', '', 9);
     $this->pdf->Ln(4);
     $this->pdf->SetX(18);
     $this->pdf->Cell(0, 4, utf8_decode('Bitte überweisen Sie uns den fälligen '), 0, 0, 'L');
     $this->pdf->Ln(6);
     $this->pdf->SetX(23);
     $this->pdf->Cell(35, 4, utf8_decode('Gesamtbetrag von'), 0, 0, 'L');
     $this->pdf->SetFont('', 'B', 9);
     $this->pdf->Cell(150, 4, utf8_decode((string) $this->invoiceXml->total_fee_taxed[0]) . ' ' . chr(128), 0, 0, 'L');
     $this->pdf->SetFont('', '', 9);
     $this->pdf->Ln(6);
     $this->pdf->SetX(23);
     $this->pdf->Cell(35, 4, utf8_decode('bis spätestens zum'), 0, 0, 'L');
     $this->pdf->SetFont('', 'B', 9);
     $this->pdf->Cell(150, 4, makeNicePresentableDate(manipulateDate(time(), '+', (string) $this->invoiceXml->billing->term_of_payment[0], 'd'), $lng['panel']['dateformat_function']), 0, 0, 'L');
     $this->pdf->SetFont('', '', 9);
     $this->pdf->Ln(6);
     $this->pdf->SetX(18);
     $this->pdf->MultiCell(0, 4, utf8_decode('auf unser unten genanntes Konto. Wir möchten Sie freundlich darauf hinweisen, dass Sie mit der Zahlung in Verzug sind. Sollten Sie die Forderung nicht bis zum genannten Datum begleichen, werden wir nebst der Forderung noch Verzugszinsen geltend machen.'), 0, 'L');
 }
Ejemplo n.º 4
0
 /**
  * This method processes the given xml string and creates
  * thogether with the given language array a pdf invoice.
  *
  * @param string The xml string which contains our invoice data
  * @param array  A valid language array
  *
  * @author Former03 GmbH :: Florian Lippert <*****@*****.**>
  */
 public function processData($xml, $lng)
 {
     $this->invoiceXml = new SimpleXMLElement($xml);
     $contactdetails = '';
     if (utf8_decode((string) $this->invoiceXml->address->company[0]) != '') {
         $contactdetails .= utf8_decode((string) $this->invoiceXml->address->company[0]) . "\n";
     }
     if (utf8_decode((string) $this->invoiceXml->address->title[0]) != '') {
         $contactdetails .= utf8_decode((string) $this->invoiceXml->address->title[0]) . ' ';
     }
     if (utf8_decode((string) $this->invoiceXml->address->firstname[0]) != '' && utf8_decode((string) $this->invoiceXml->address->name[0]) != '') {
         $contactdetails .= utf8_decode((string) $this->invoiceXml->address->firstname[0]) . ' ' . utf8_decode((string) $this->invoiceXml->address->name[0]) . "\n";
     }
     $contactdetails .= utf8_decode((string) $this->invoiceXml->address->street[0]) . "\n" . utf8_decode((string) $this->invoiceXml->address->zipcode[0]) . ' ' . utf8_decode((string) $this->invoiceXml->address->city[0]) . "\n" . utf8_decode((string) $this->invoiceXml->address->country[0]);
     $this->pdf->addPage(null, null, true);
     $this->pdf->setFooterEnabled(true, $lng['invoice']['page_footer']);
     // Write Sender
     $this->pdf->SetTextColor(160, 160, 160);
     $this->pdf->SetFont('', 'B', 6);
     $this->pdf->SetXY(17.5, 50.5);
     $this->pdf->Cell(0, 0, html_entity_decode($lng['invoice']['sender']));
     $this->pdf->SetTextColor(0, 0, 0);
     $this->pdf->Ln();
     // Write Address
     $this->pdf->SetFont('', '', 10);
     $this->pdf->SetXY(18, 60);
     $this->pdf->MultiCell(70, 4, $contactdetails, 0, 'L');
     $this->pdf->Ln();
     // Write Subject
     $this->pdf->SetFont('', 'B', 13);
     $this->pdf->SetXY(18, 100);
     $this->pdf->Cell(35, 4, html_entity_decode($this->cancellation === true ? $lng['invoice']['cancellation'] : $lng['invoice']['invoice']), 0, 2, 'L');
     $this->pdf->Ln();
     // Write Date
     $this->pdf->SetFont('', '', 8);
     $this->pdf->SetXY(18, 96);
     $this->pdf->Cell(70, 4, sprintf(html_entity_decode($lng['invoice']['dateheader']), $this->cancellation === true ? makeNicePresentableDate(date('Y-m-d'), $lng['panel']['dateformat_function']) : utf8_decode((string) $this->invoiceXml->invoice_date[0])), 0, 2, 'L');
     $this->pdf->Ln();
     // Write  invoice number
     $this->pdf->SetFont('', '', 9);
     $this->pdf->SetXY(18, 110);
     $this->pdf->Cell(35, 4, html_entity_decode($lng['invoice']['number']), 0, 0, 'L');
     $this->pdf->SetFont('', 'B', 9);
     $this->pdf->Cell(150, 4, utf8_decode((string) $this->invoiceXml->invoice_number[0]), 0, 0, 'L');
     $this->pdf->Ln();
     // Write contract number
     $this->pdf->SetFont('', '', 9);
     $this->pdf->Cell(35, 4, html_entity_decode($lng['invoice']['contract_number']), 0, 0, 'L');
     $this->pdf->SetFont('', 'B', 9);
     $this->pdf->Cell(150, 4, utf8_decode((string) $this->invoiceXml->billing->contract_number[0]), 0, 0, 'L');
     $this->pdf->Ln();
     // Write contract details
     $this->pdf->SetFont('', '', 9);
     $this->pdf->Cell(35, 4, html_entity_decode($lng['invoice']['contract_details']), 0, 0, 'L');
     $this->pdf->SetFont('', 'B', 9);
     $this->pdf->MultiCell(140, 4, utf8_decode((string) $this->invoiceXml->billing->contract_details[0]), 0, 'L');
     //$this->pdf->Ln();
     // Write invoice period
     $this->pdf->SetFont('', '', 9);
     $this->pdf->Cell(35, 4, html_entity_decode($lng['invoice']['period']), 0, 0, 'L');
     $this->pdf->SetFont('', 'B', 9);
     $this->pdf->Cell(150, 4, utf8_decode((string) $this->invoiceXml->invoice_period[0]), 0, 0, 'L');
     $this->pdf->Ln();
     $this->pdf->Ln();
     $invoice_items_table_header = html_entity_decode_array($lng['invoice']['header']);
     $invoice_items_table_column_width = array(8, 84, 32, 15, 12, 8, 15);
     $invoice_items_table_column_align = array('L', 'L', 'R', 'R', 'R', 'R', 'R');
     $this->pdf->SetFillColor(255, 255, 255);
     $this->pdf->SetTextColor(0);
     $this->pdf->SetDrawColor(0, 0, 0);
     $this->pdf->SetLineWidth(0.2);
     $this->pdf->SetFont('', '', 7);
     $lineheight = 4;
     foreach ($invoice_items_table_header as $i => $caption) {
         $this->pdf->Cell($invoice_items_table_column_width[$i], 7, utf8_decode($caption), 'B', 0, $invoice_items_table_column_align[$i], 1);
     }
     $this->pdf->Ln();
     $this->pdf->Ln(1);
     $i = 1;
     foreach ($this->invoiceXml->service_category as $service_details) {
         $this->pdf->SetFont('', '', 9);
         $this->pdf->Cell($invoice_items_table_column_width[0] + $invoice_items_table_column_width[1], 5, utf8_decode((string) $service_details->caption), 0, 0, 'L', 0);
         $this->pdf->SetFont('', '', 7);
         $this->pdf->Cell($invoice_items_table_column_width[2], 5, utf8_decode((string) $service_details->interval), 0, 0, $invoice_items_table_column_align[2], 0);
         $this->pdf->Ln();
         foreach ($service_details->invoice_row as $invoice_row) {
             $this->pdf->Cell($invoice_items_table_column_width[0], $lineheight, sprintf('%03d', $i), 0, 0, $invoice_items_table_column_align[0]);
             $this->pdf->Cell($invoice_items_table_column_width[1], $lineheight, utf8_decode(((string) $invoice_row->quantity[0] != '1' ? (string) $invoice_row->quantity[0] . ' x ' : '') . (string) $invoice_row->caption[0]), 0, 0, $invoice_items_table_column_align[1]);
             $this->pdf->Cell($invoice_items_table_column_width[2], $lineheight, utf8_decode((string) $invoice_row->interval[0]), 0, 0, $invoice_items_table_column_align[2]);
             $this->pdf->Cell($invoice_items_table_column_width[3], $lineheight, utf8_decode((string) $invoice_row->total_fee[0]), 0, 0, $invoice_items_table_column_align[3]);
             $this->pdf->Cell($invoice_items_table_column_width[4], $lineheight, utf8_decode((string) $invoice_row->tax[0]), 0, 0, $invoice_items_table_column_align[4]);
             $this->pdf->Cell($invoice_items_table_column_width[5], $lineheight, sprintf('%01.2f', 100 * (double) utf8_decode((string) $invoice_row->taxrate[0])), 0, 0, $invoice_items_table_column_align[5]);
             $this->pdf->Cell($invoice_items_table_column_width[6], $lineheight, utf8_decode((string) $invoice_row->total_fee_taxed[0]), 0, 0, $invoice_items_table_column_align[6]);
             $this->pdf->Ln();
             ++$i;
         }
     }
     $this->pdf->Ln(1);
     $this->pdf->Cell(array_sum($invoice_items_table_column_width), 0, '', 'T');
     $this->pdf->Ln();
     $this->pdf->Ln(1);
     $this->pdf->Cell($invoice_items_table_column_width[0] + $invoice_items_table_column_width[1] + $invoice_items_table_column_width[2], $lineheight);
     $this->pdf->Cell($invoice_items_table_column_width[3] + $invoice_items_table_column_width[4] + $invoice_items_table_column_width[5], $lineheight, html_entity_decode($lng['invoice']['subtotal']), 0, 0, 'R');
     $this->pdf->Cell($invoice_items_table_column_width[6], $lineheight, utf8_decode((string) $this->invoiceXml->total_fee[0]), 0, 0, 'R');
     $this->pdf->Ln();
     foreach ($this->invoiceXml->tax as $tax) {
         $this->pdf->Cell($invoice_items_table_column_width[0] + $invoice_items_table_column_width[1] + $invoice_items_table_column_width[2] + $invoice_items_table_column_width[3] + $invoice_items_table_column_width[4] + $invoice_items_table_column_width[5], $lineheight, sprintf(html_entity_decode($lng['invoice']['tax']), (string) ((double) utf8_decode((string) $tax['taxrate']) * 100)), 0, 0, 'R');
         $this->pdf->Cell($invoice_items_table_column_width[6], $lineheight, utf8_decode((string) $tax), 0, 0, $invoice_items_table_column_align[6]);
         $this->pdf->Ln();
     }
     if ((double) (string) $this->invoiceXml->credit_note[0] != 0) {
         $this->pdf->Cell($invoice_items_table_column_width[0] + $invoice_items_table_column_width[1] + $invoice_items_table_column_width[2], $lineheight);
         $this->pdf->Cell($invoice_items_table_column_width[3] + $invoice_items_table_column_width[4] + $invoice_items_table_column_width[5], $lineheight, html_entity_decode($lng['invoice']['credit_note']), 0, 0, 'R');
         $this->pdf->Cell($invoice_items_table_column_width[6], $lineheight, '- ' . utf8_decode((string) $this->invoiceXml->credit_note[0]), 0, 0, 'R');
         $this->pdf->Ln();
     }
     $this->pdf->SetLineWidth(0.5);
     $this->pdf->SetFont('', 'B', 9);
     $this->pdf->Cell($invoice_items_table_column_width[0] + $invoice_items_table_column_width[1] + $invoice_items_table_column_width[2], $lineheight);
     $this->pdf->Cell($invoice_items_table_column_width[3] + $invoice_items_table_column_width[4] + $invoice_items_table_column_width[5], $lineheight, html_entity_decode($lng['invoice']['total']), 'B', 0, 'R');
     $this->pdf->Cell($invoice_items_table_column_width[6], $lineheight, utf8_decode((string) $this->invoiceXml->total_fee_taxed[0]), 'B', 0, 'R');
     $this->pdf->Ln();
     $this->pdf->Ln(8);
     $this->pdf->SetFont('', '', '10');
     if ((string) $this->invoiceXml->billing->taxid[0] != '') {
         $this->pdf->MultiCell(0, 5, html_entity_decode(sprintf($lng['invoice']['tax_text']['line'], utf8_decode((string) $this->invoiceXml->address->company[0]) == '' ? $lng['invoice']['tax_text']['client'] : utf8_decode((string) $this->invoiceXml->address->company[0]), (string) $this->invoiceXml->billing->taxid[0])), 0, 'L');
         $this->pdf->Ln(8);
     }
     $this->pdf->MultiCell(0, 5, html_entity_decode(sprintf($lng['invoice']['payment_methods'][(int) (string) $this->invoiceXml->billing->payment_method[0]], utf8_decode((string) $this->invoiceXml->billing->term_of_payment[0]), utf8_decode((string) $this->invoiceXml->billing->bankaccount_bank[0]), utf8_decode((string) $this->invoiceXml->billing->bankaccount_number[0]), utf8_decode((string) $this->invoiceXml->billing->bankaccount_blz[0]))), 0, 'L');
     $this->pdf->Ln();
 }
Ejemplo n.º 5
0
         $result = $db->query("SELECT `u`.`customerid`, `u`.`loginname`, `u`.`name`, `u`.`firstname`, `u`.`company`, `u`.`street`, `u`.`zipcode`, `u`.`city`, `u`.`contract_number`, `u`.`contract_date`, `u`.`servicestart_date`, `u`.`lastinvoiced_date`, `u`.`invoice_fee`, `a`.`loginname` AS `adminname` " . "FROM `" . getModeDetails($mode, 'TABLE_PANEL_USERS', 'table') . "` `u`, `" . TABLE_PANEL_ADMINS . "` `a` " . "WHERE `u`.`adminid`=`a`.`adminid` AND `u`.`invoice_fee_hosting` > 0 " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
         $paging->setEntries($db->num_rows($result));
     }
     $sortcode = $paging->getHtmlSortCode($lng, true);
     $arrowcode = $paging->getHtmlArrowCode($filename . '?mode=' . $mode . '&s=' . $s);
     $searchcode = $paging->getHtmlSearchCode($lng);
     $pagingcode = $paging->getHtmlPagingCode($filename . '?mode=' . $mode . '&s=' . $s);
     $i = 0;
     $count = 0;
     $users = '';
     while ($row = $db->fetch_array($result)) {
         if ($paging->checkDisplay($i)) {
             $row['userid'] = $row[getModeDetails($mode, 'TABLE_PANEL_USERS', 'key')];
             $row['contract_date'] = makeNicePresentableDate($row['contract_date'], $lng['panel']['dateformat_function']);
             $row['servicestart_date'] = makeNicePresentableDate($row['servicestart_date'], $lng['panel']['dateformat_function']);
             $row['lastinvoiced_date'] = makeNicePresentableDate($row['lastinvoiced_date'], $lng['panel']['dateformat_function']);
             $row = htmlentities_array($row);
             eval("\$users.=\"" . getTemplate("billing/openinvoices_overview_row") . "\";");
             $count++;
         }
         $i++;
     }
     eval("echo \"" . getTemplate("billing/openinvoices_overview") . "\";");
 }
 if ($action == 'cacheinvoicefees') {
     $number_users = $db->query_first('SELECT COUNT(*) AS `number_users` FROM `' . getModeDetails($mode, 'TABLE_PANEL_USERS', 'table'));
     $number_users = intval($number_users['number_users']);
     if (isset($_GET['begin']) && isset($_GET['count']) && $number_users != 0) {
         $begin = intval($_GET['begin']);
         $count = intval($_GET['count']);
         if ($begin < $number_users && $count != 0) {
Ejemplo n.º 6
0
 /**
  * This method returns a nice utf8-formatted XML file
  * with the data it got from self::exportArray.
  *
  * @param array   Language array
  * @param string  Invoice number
  * @return string Contains the XML data.
  *
  * @author Former03 GmbH :: Florian Lippert <*****@*****.**>
  */
 function exportXml($lng = array(), $invoice_number = '')
 {
     if ($this->userId == 0 || !is_array($this->user) || empty($this->user) || $this->user[getModeDetails($this->mode, 'TABLE_PANEL_USERS', 'key')] != $this->userId) {
         return false;
     }
     $invoice = $this->exportArray($lng);
     $invoiceXml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><invoice></invoice>');
     $invoiceXml->addChild('invoice_number', utf8_encode(htmlspecialchars($invoice_number)));
     $invoiceXml->addChild('invoice_date', makeNicePresentableDate(date('Y-m-d'), $lng['panel']['dateformat_function']));
     $address = $invoiceXml->addChild('address');
     $address->addChild('name', utf8_encode(htmlspecialchars($this->user['name'])));
     $address->addChild('firstname', utf8_encode(htmlspecialchars($this->user['firstname'])));
     $address->addChild('title', utf8_encode(htmlspecialchars($this->user['title'])));
     $address->addChild('company', utf8_encode(htmlspecialchars($this->user['company'])));
     $address->addChild('street', utf8_encode(htmlspecialchars($this->user['street'])));
     $address->addChild('zipcode', utf8_encode(htmlspecialchars($this->user['zipcode'])));
     $address->addChild('city', utf8_encode(htmlspecialchars($this->user['city'])));
     $address->addChild('country', utf8_encode(htmlspecialchars($this->user['country'])));
     $billing = $invoiceXml->addChild('billing');
     $billing->addChild('contract_number', utf8_encode(htmlspecialchars($this->user['contract_number'])));
     $billing->addChild('contract_details', utf8_encode(htmlspecialchars(sprintf(html_entity_decode($lng['invoice']['contract_details_template']), makeNicePresentableDate($this->user['contract_date'], $lng['panel']['dateformat_function']), (int) $this->user['diskspace'] / 1024 == '-1' ? html_entity_decode($lng['customer']['unlimited']) : (string) round((int) $this->user['diskspace'] / 1024, 2), $this->user['additional_diskspace_fee'], (string) round((int) $this->user['additional_diskspace_unit'] / 1024, 4), (int) $this->user['traffic'] / (1024 * 1024) == '-1' ? html_entity_decode($lng['customer']['unlimited']) : (string) round((int) $this->user['traffic'] / (1024 * 1024), 4), $this->user['additional_traffic_fee'], (string) round((int) $this->user['additional_traffic_unit'] / (1024 * 1024), 4), $this->user['included_domains_qty'], $this->user['interval_fee'], str_replace('1 ' . $lng['panel']['intervalfee_type'][$this->user['interval_type']], $lng['panel']['intervalfee_type_one'][$this->user['interval_type']], $this->user['interval_length'] . ' ' . $lng['panel']['intervalfee_type'][$this->user['interval_type']]), str_replace('1 ' . $lng['panel']['intervalfee_type'][$this->user['interval_type']], '1 ' . $lng['panel']['intervalfee_type_one'][$this->user['interval_type']], (string) ((int) $this->user['interval_length'] * (int) $this->user['payment_every']) . ' ' . $lng['panel']['intervalfee_type'][$this->user['interval_type']])))));
     $billing->addChild('payment_method', utf8_encode(htmlspecialchars($this->user['payment_method'])));
     $billing->addChild('term_of_payment', utf8_encode(htmlspecialchars($this->user['term_of_payment'])));
     $billing->addChild('bankaccount_holder', utf8_encode(htmlspecialchars($this->user['bankaccount_holder'])));
     $billing->addChild('bankaccount_number', utf8_encode(htmlspecialchars($this->user['bankaccount_number'])));
     $billing->addChild('bankaccount_blz', utf8_encode(htmlspecialchars($this->user['bankaccount_blz'])));
     $billing->addChild('bankaccount_bank', utf8_encode(htmlspecialchars($this->user['bankaccount_bank'])));
     $billing->addChild('taxid', utf8_encode(htmlspecialchars($this->user['taxid'])));
     $billing->addChild('calc_tax', utf8_encode(htmlspecialchars($this->user['calc_tax'])));
     $total_fee = 0;
     $total_fee_taxed = 0;
     $tax = array();
     $allservices_begin = 0;
     $allservices_end = 0;
     foreach ($invoice as $service_type => $service_details) {
         $service_category = $invoiceXml->addChild('service_category');
         $service_category->addAttribute('service_type', utf8_encode(htmlspecialchars($service_type)));
         $service_category->addChild('caption', utf8_encode(htmlspecialchars(html_entity_decode($service_details['caption']))));
         $service_category->addChild('interval', utf8_encode(htmlspecialchars(html_entity_decode($service_details['interval']))));
         if (calculateDayDifference($service_details['service_date_begin'], $service_details['service_date_end']) != 0) {
             $invoiceXml->addChild('service_date_begin', utf8_encode(htmlspecialchars($service_details['service_date_begin'])));
             $invoiceXml->addChild('service_date_end', utf8_encode(htmlspecialchars($service_details['service_date_end'])));
         } else {
             $invoiceXml->addChild('service_date', utf8_encode(htmlspecialchars($service_details['service_date_begin'])));
         }
         if (calculateDayDifference($service_details['service_date_begin'], $allservices_begin) > 0 || $allservices_begin == 0) {
             $allservices_begin = $service_details['service_date_begin'];
         }
         if (calculateDayDifference($allservices_end, $service_details['service_date_end']) > 0 || $allservices_end == 0) {
             $allservices_end = $service_details['service_date_end'];
         }
         foreach ($service_details['rows'] as $rowid => $row) {
             $invoice_row = $service_category->addChild('invoice_row');
             $invoice_row->addAttribute('key', utf8_encode(htmlspecialchars($row['key'])));
             $invoice_row->addChild('service_occurence', utf8_encode(htmlspecialchars($row['service_occurence'])));
             switch ($row['service_occurence']) {
                 case 'once':
                     $invoice_row->addAttribute('date', utf8_encode(htmlspecialchars(makeNicePresentableDate($row['service_date'], 'Ymd'))));
                     $invoice_row->addChild('service_date', utf8_encode(htmlspecialchars($row['service_date'])));
                     break;
                 case 'period':
                     $invoice_row->addAttribute('date', utf8_encode(htmlspecialchars(makeNicePresentableDate($row['service_date_begin'], 'Ymd'))));
                     $invoice_row->addChild('service_date_begin', utf8_encode(htmlspecialchars($row['service_date_begin'])));
                     $invoice_row->addChild('service_date_end', utf8_encode(htmlspecialchars($row['service_date_end'])));
                     break;
             }
             $invoice_row->addChild('caption', utf8_encode(htmlspecialchars(html_entity_decode($row['description']['caption']))));
             $invoice_row->addChild('interval', utf8_encode(htmlspecialchars($row['interval'])));
             $invoice_row->addChild('quantity', utf8_encode(htmlspecialchars($row['quantity'])));
             $invoice_row->addChild('single_fee', utf8_encode(htmlspecialchars($row['single_fee'])));
             $invoice_row->addChild('total_fee', utf8_encode(htmlspecialchars($row['total_fee'])));
             $invoice_row->addChild('taxrate', utf8_encode(htmlspecialchars($row['taxrate'])));
             $invoice_row->addChild('tax', utf8_encode(htmlspecialchars($row['tax'])));
             $invoice_row->addChild('total_fee_taxed', utf8_encode(htmlspecialchars($row['total_fee_taxed'])));
             if (!isset($tax[$row['taxrate']])) {
                 $tax[$row['taxrate']] = 0;
             }
             $tax[$row['taxrate']] += $row['tax'];
             $total_fee += $row['total_fee'];
             $total_fee_taxed += $row['total_fee_taxed'];
         }
     }
     if (calculateDayDifference($allservices_begin, $allservices_end) != 0) {
         $invoiceXml->addChild('invoice_period', utf8_encode(htmlspecialchars(makeNicePresentableDate($allservices_begin, $lng['panel']['dateformat_function']) . ' - ' . makeNicePresentableDate($allservices_end, $lng['panel']['dateformat_function']))));
     } else {
         $invoiceXml->addChild('invoice_period', utf8_encode(htmlspecialchars(makeNicePresentableDate($allservices_begin, $lng['panel']['dateformat_function']))));
     }
     $credit_note = $this->getCreditNote();
     if ($credit_note != 0) {
         $invoiceXml->addChild('credit_note', utf8_encode(htmlspecialchars(sprintf("%01.2f", $credit_note))));
         $total_fee_taxed -= $credit_note;
     }
     $invoiceXml->addChild('total_fee', utf8_encode(htmlspecialchars(sprintf("%01.2f", $total_fee))));
     foreach ($tax as $taxrate => $taxamount) {
         $taxXml = $invoiceXml->AddChild('tax', utf8_encode(htmlspecialchars(sprintf("%01.2f", $taxamount))));
         $taxXml->addAttribute('taxrate', utf8_encode(htmlspecialchars($taxrate)));
     }
     $invoiceXml->addChild('total_fee_taxed', utf8_encode(htmlspecialchars(sprintf("%01.2f", $total_fee_taxed))));
     return $invoiceXml->asXML();
 }