Hanno Böck This code is published under a 0BSD license. Nevertheless, in case you use a significant part of this code, we ask (but not require, see the license) that you keep the authors' names in place and return your changes to the public. We would be especially happy if you tell us what you're going to do with this code. */ require_once('session/start.php'); require_once('inc/icons.php'); require_once('inc/jquery.php'); javascript('more_storage.js'); require_once('invoice.php'); require_role(ROLE_CUSTOMER); $_SESSION['more_storage_section'] = 'invoice_current'; if (isset($_GET['section'])) { $_SESSION['more_storage_section'] = $_GET['section']; } $section = $_SESSION['more_storage_section']; title('Zusätzlichen Speicherplatz buchen'); $upcoming = upcoming_items(); $hosting = null; foreach ($upcoming as $item) { if ($item['quelle'] == 'hosting') { $hosting = $item; break; } } if (!$hosting) { system_failure("Die Abrechnung für das normale Hosting konnte nicht ermittelt werden. Daher können Sie diese Funktion leider nicht benutzen. Wenden Sie sich bitte an die Administratoren um mehr Speicherplatz zu bestellen."); } if ($hosting['brutto'] == 0) { system_failure("Ihr Konto wird mit Nettopreisen abgerechnet. Bitte wenden Sie sich an den Support."); } $customerquota = get_customerquota(); $count = 1024; if (isset($_REQUEST['count']) && (int) $_REQUEST['count'] > 0) { $count = (int) $_REQUEST['count']; } output("

Ihr aktuell zugeteilter Speicherplatz (ggf. inklusive Mitbenutzer) beträgt {$customerquota} MB. Sie können weiteren Speicherplatz hinzubuchen.

"); $checked = ''; if ($count == 1024) { $checked = 'checked="checked" '; } $form = '

'; if ($count == 2048) { $checked = 'checked="checked" '; } else { $checked = ''; } $form .= ''; if ($count == 5120) { $checked = 'checked="checked" '; } else { $checked = ''; } $form .= ''; $form .= '

'; output(html_form("more_storage_selection", "more_storage", "", $form)); $new_item = $hosting; unset($new_item['quelle']); unset($new_item['id']); $gb = $count/1024; $new_item['beschreibung'] = 'Erweiterung Speicherplatz um '.$gb.' GB (Auftrag vom '.date('d.m.Y').')'; $new_item['betrag'] = $gb; $startdate = $new_item['startdatum']; $diff = date_diff(date_create("now"), date_create($startdate), true); DEBUG('date_diff(now, '.$startdate.') => '.$diff->format('%y Year %m Month %d Day')); $months = $diff->format("%m"); $stub_startdate = date_create($startdate); date_sub($stub_startdate, date_interval_create_from_date_string($months.' months')); $stub_enddate = date_create($startdate); date_sub($stub_enddate, date_interval_create_from_date_string('1 day')); $stub = $new_item; $stub['startdatum'] = date_format($stub_startdate, 'Y-m-d'); $stub['enddatum'] = date_format($stub_enddate, 'Y-m-d'); $stub['anzahl'] = $months; $stub['monate'] = $months; $items = []; $items[] = $stub; $items[] = $new_item; output('

Die Abrechnung erfolgt mit Ihrer nächsten turnusgemäßen Abrechnung und wird mit folgenden Rechnungsposten vorgemerkt.

'); output(''); $counter = 0; foreach ($items as $item) { $counter++; if ($counter == 1 && ($item['anzahl'] > 0)) { output(""); } elseif ($counter == 2) { output(""); } if ($item['anzahl'] == 0) { continue; } $desc = $item['startdatum']; if ($item['enddatum'] != null) { $desc = $item['startdatum'].' - '.$item['enddatum']; } $epreis = $item['betrag']; if ($item['brutto'] == 0) { $epreis = $epreis * (1 + ($item['mwst'] / 100)); } $gesamt = round($epreis * $item['anzahl'], 2); $epreis = round($epreis, 2); $einheit = ($item['einheit'] ? $item['einheit'] : ''); output(""); output(""); output("\n"); } output('
AnzahlBeschreibungZeitraumEinzelpreisGesamtbetrag
Einmaliger Posten:
Künftiger regelmäßiger Posten:
{$item['anzahl']} {$einheit}{$item['beschreibung']}{$desc}{$epreis} €{$gesamt} €
'); output('

Wir behalten uns vor, diese Rechnungsposten mit anderen sinngleichen Posten zusammen zu führen.

'); $handle = random_string(10); $_SESSION['more_storage_handle'] = $handle; $_SESSION['more_storage_items'] = $items; $_SESSION['more_storage_count'] = $count; $form = ''; if (have_module('systemuser')) { include('modules/systemuser/include/useraccounts.php'); $useraccounts = list_useraccounts(); if (count($useraccounts) == 1) { $form .= ''; } else { $choices = ['' => 'Nicht zuweisen']; foreach ($useraccounts as $u) { $choices[$u['uid']] = "Benutzer ${u['username']} vergrößern"; } $form .= '

Wie soll der zusätzliche Speicherplatz verwendet werden?

'.html_select('more_storage_user', $choices, $_SESSION['userinfo']['uid']).'

'; } } $form .= '

'; output(html_form("more_storage", "more_storage_save", "action=more_storage", $form));