dolibarr.steuer/steuerindex.php
2026-02-03 14:47:27 +01:00

279 lines
10 KiB
PHP
Executable file

<?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2026 Eduard Wisch <data@data-it-solution.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file steuer/steuerindex.php
* \ingroup steuer
* \brief EÜR Übersicht - Einnahmen-Überschuss-Rechnung für Deutschland
*/
// Load Dolibarr environment
$res = 0;
if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
$res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
}
$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME'];
$tmp2 = realpath(__FILE__);
$i = strlen($tmp) - 1;
$j = strlen($tmp2) - 1;
while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
$i--;
$j--;
}
if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
$res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
}
if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
$res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
}
if (!$res && file_exists("../main.inc.php")) {
$res = @include "../main.inc.php";
}
if (!$res && file_exists("../../main.inc.php")) {
$res = @include "../../main.inc.php";
}
if (!$res && file_exists("../../../main.inc.php")) {
$res = @include "../../../main.inc.php";
}
if (!$res) {
die("Include of main fails");
}
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
dol_include_once('/steuer/class/euer.class.php');
/**
* @var Conf $conf
* @var DoliDB $db
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*/
// Load translation files required by the page
$langs->loadLangs(array("steuer@steuer", "bills", "compta"));
$action = GETPOST('action', 'aZ09');
$jahr = GETPOSTINT('jahr');
if (empty($jahr)) {
$jahr = date('Y');
}
$monat = GETPOSTINT('monat');
$now = dol_now();
// Security check
$socid = GETPOSTINT('socid');
if (!empty($user->socid) && $user->socid > 0) {
$action = '';
$socid = $user->socid;
}
/*
* Actions
*/
// None
/*
* View
*/
$form = new Form($db);
$formfile = new FormFile($db);
$euer = new EUeR($db);
// Berechne EÜR
if ($monat > 0) {
$euer->berechneAusDolibarr($jahr, $monat, $monat);
$periode_text = $langs->trans("Month")." ".dol_print_date(mktime(0, 0, 0, $monat, 1, $jahr), '%B %Y');
} else {
$euer->berechneAusDolibarr($jahr);
$periode_text = $langs->trans("Year")." ".$jahr;
}
llxHeader("", $langs->trans("EUeRUebersicht"), '', '', 0, 0, '', '', '', 'mod-steuer page-index');
print load_fiche_titre($langs->trans("EUeRUebersicht")." - ".$periode_text, '', 'steuer.png@steuer');
// Filter-Formular
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Period").'</td>';
print '<td>'.$langs->trans("Year").'</td>';
print '<td>'.$langs->trans("Month").'</td>';
print '<td></td>';
print '</tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("SelectPeriod").'</td>';
print '<td>';
print '<select name="jahr" class="flat minwidth100">';
for ($y = date('Y'); $y >= date('Y') - 5; $y--) {
print '<option value="'.$y.'"'.($y == $jahr ? ' selected' : '').'>'.$y.'</option>';
}
print '</select>';
print '</td>';
print '<td>';
print '<select name="monat" class="flat minwidth100">';
print '<option value="0"'.($monat == 0 ? ' selected' : '').'>'.$langs->trans("WholeYear").'</option>';
for ($m = 1; $m <= 12; $m++) {
print '<option value="'.$m.'"'.($m == $monat ? ' selected' : '').'>'.dol_print_date(mktime(0, 0, 0, $m, 1, 2000), '%B').'</option>';
}
print '</select>';
print '</td>';
print '<td>';
print '<input type="submit" class="button" value="'.$langs->trans("Refresh").'">';
print '</td>';
print '</tr>';
print '</table>';
print '</div>';
print '</form>';
print '<br>';
// Schnellzugriff-Links
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<th colspan="4">'.$langs->trans("QuickAccess").'</th>';
print '</tr>';
print '<tr class="oddeven">';
print '<td><a href="'.dol_buildpath('/steuer/buchung_list.php', 1).'?jahr='.$jahr.'" class="butAction">'.$langs->trans("Buchungen").'</a></td>';
print '<td><a href="'.dol_buildpath('/steuer/buchung_card.php', 1).'?action=create" class="butAction">'.$langs->trans("NeueBuchung").'</a></td>';
print '<td><a href="'.dol_buildpath('/steuer/euer_bericht.php', 1).'?jahr='.$jahr.'" class="butAction">'.$langs->trans("AnlageEUeR").'</a></td>';
print '<td><a href="'.dol_buildpath('/steuer/ustva.php', 1).'?jahr='.$jahr.'" class="butAction">'.$langs->trans("UStVA").'</a></td>';
print '</tr>';
print '<tr class="oddeven">';
print '<td><a href="'.dol_buildpath('/steuer/gewerbesteuer.php', 1).'?jahr='.$jahr.'" class="butAction">'.$langs->trans("Gewerbesteuer").'</a></td>';
print '<td><a href="'.dol_buildpath('/steuer/export_wiso.php', 1).'?jahr='.$jahr.'" class="butAction">'.$langs->trans("WISOExport").'</a></td>';
print '<td><a href="'.dol_buildpath('/steuer/konten.php', 1).'" class="butAction">'.$langs->trans("Kontenplan").'</a></td>';
print '<td></td>';
print '</tr>';
print '</table>';
print '</div>';
print '<br>';
print '<div class="fichecenter"><div class="fichethirdleft">';
// EÜR Übersicht - Einnahmen
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<th colspan="2">'.$langs->trans("Einnahmen").'</th>';
print '<th class="right">'.$langs->trans("Amount").'</th>';
print '</tr>';
if (!empty($euer->einnahmen)) {
foreach ($euer->einnahmen as $key => $einnahme) {
print '<tr class="oddeven">';
print '<td colspan="2">'.$einnahme['bezeichnung'].'</td>';
print '<td class="right nowraponall amount">'.price($einnahme['netto'], 0, $langs, 1, 2, 2, 'EUR').'</td>';
print '</tr>';
}
}
print '<tr class="liste_total">';
print '<td colspan="2"><strong>'.$langs->trans("TotalEinnahmen").'</strong></td>';
print '<td class="right nowraponall amount"><strong>'.price($euer->summe_einnahmen, 0, $langs, 1, 2, 2, 'EUR').'</strong></td>';
print '</tr>';
print '</table>';
print '<br>';
// USt/VSt Übersicht
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<th colspan="2">'.$langs->trans("UmsatzsteuerVorsteuer").'</th>';
print '</tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("UmsatzsteuerGesamt").'</td>';
print '<td class="right nowraponall amount">'.price($euer->ust_summe, 0, $langs, 1, 2, 2, 'EUR').'</td>';
print '</tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("VorsteuerGesamt").'</td>';
print '<td class="right nowraponall amount">'.price($euer->vst_summe, 0, $langs, 1, 2, 2, 'EUR').'</td>';
print '</tr>';
print '<tr class="liste_total">';
print '<td><strong>'.$langs->trans("Zahllast").'</strong></td>';
$zahllast = $euer->ust_summe - $euer->vst_summe;
$color = $zahllast >= 0 ? '' : 'amountremaintopay';
print '<td class="right nowraponall amount '.$color.'"><strong>'.price($zahllast, 0, $langs, 1, 2, 2, 'EUR').'</strong></td>';
print '</tr>';
print '</table>';
print '</div><div class="fichetwothirdright">';
// EÜR Übersicht - Ausgaben
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<th colspan="2">'.$langs->trans("Ausgaben").'</th>';
print '<th class="right">'.$langs->trans("Amount").'</th>';
print '</tr>';
if (!empty($euer->ausgaben)) {
foreach ($euer->ausgaben as $key => $ausgabe) {
print '<tr class="oddeven">';
print '<td colspan="2">'.$ausgabe['bezeichnung'].'</td>';
print '<td class="right nowraponall amount">'.price($ausgabe['netto'], 0, $langs, 1, 2, 2, 'EUR').'</td>';
print '</tr>';
}
}
print '<tr class="liste_total">';
print '<td colspan="2"><strong>'.$langs->trans("TotalAusgaben").'</strong></td>';
print '<td class="right nowraponall amount"><strong>'.price($euer->summe_ausgaben, 0, $langs, 1, 2, 2, 'EUR').'</strong></td>';
print '</tr>';
print '</table>';
print '<br>';
// Gewinn/Verlust Box
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<th colspan="2">'.$langs->trans("ErgebnisEUeR").'</th>';
print '</tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("Einnahmen").'</td>';
print '<td class="right nowraponall amount">'.price($euer->summe_einnahmen, 0, $langs, 1, 2, 2, 'EUR').'</td>';
print '</tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("Ausgaben").'</td>';
print '<td class="right nowraponall amount">- '.price($euer->summe_ausgaben, 0, $langs, 1, 2, 2, 'EUR').'</td>';
print '</tr>';
print '<tr class="liste_total">';
$color = $euer->gewinn >= 0 ? 'amountpaymentcomplete' : 'amountremaintopay';
print '<td><strong>'.($euer->gewinn >= 0 ? $langs->trans("Gewinn") : $langs->trans("Verlust")).'</strong></td>';
print '<td class="right nowraponall amount '.$color.'"><strong>'.price($euer->gewinn, 0, $langs, 1, 2, 2, 'EUR').'</strong></td>';
print '</tr>';
print '</table>';
print '</div></div>';
print '<div class="clearboth"></div>';
// End of page
llxFooter();
$db->close();