<?php

namespace Tables;

class Fop_fints_buchung {
  
  

  
  

    // --- Statische Methoden ---
  
  public static function getDefaults() { 
    
    
    // --- BLOCK: main ---
    
	// erstellt ein leeres Objekt zum Befüllen mit Daten oder als Default fürs Create-Formular
	$data = ['forderungDone' => FALSE,
		'konto' => null,
		'bdate' => null,
		'date' => null,
		'betrag' => 0,
		'saldo' => 0,
		'iban' => '',
		'name_firma' => '',
		'vzweck' => '',
		'endtoend' => '',
		'umsatzart' => '',
		'hash' => ''];
	return $data;
	
    
  }

  public static function deleteConfirmAction($id = null ) { 
    
    // Methodenimplementierung überschrieben.
    throw new \FOP\AccessDeniedException();return false;
  }

  public static function viewAction($id = null ) { 
    
    
    // --- BLOCK: 0_CSRFValidate ---
    
	if ($_SERVER['REQUEST_METHOD'] === 'POST') \FOP\Session::validateCSRFToken(); else \FOP\Session::getCSRFToken();

    // --- BLOCK: 0_CSRF_ensure ---
    
	\FOP\Session::getCSRFToken();
    // --- BLOCK: access ---
    if(!(!\FOP\User::getIsGuest())) throw new \FOP\AccessDeniedException();
    // --- BLOCK: access+validators ---
    
	if ($_SERVER['REQUEST_METHOD'] === 'POST') {
		
		/* Validatoren */
		
		

		
		/* Sanitizer */

		

		
	}
	
    // --- BLOCK: fetch ---
    
	\FOP\I18n::ensureIsLoaded();
	$row = self::view($id);

    // --- BLOCK: main ---
    
		// Main block
	
    // --- BLOCK: main-1 ---
    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
		if (!isset($_POST['ok'])) {
			\FOP\Database::beginTransaction();
    // --- BLOCK: main-2:save-clone-prepare ---
    
		$data = self::view($id);
	
    // --- BLOCK: main-2:save-main ---
    /* view */
    // --- BLOCK: main-3 ---
    
			\FOP\Database::commitTransaction();
			
		}
		
		if (isset($_POST['ok'])) {
			
			
			if (isset($_POST['fop-from']) && $_POST['fop-from']) {
				// Redirect zu fop-from
				header('Location: ' . (isset($id) && is_string($id) ? preg_replace('/&insert_param=(.*)$/', '&$1=' . ($id instanceof \FOP\IDList ? $id->toString() : $id), $_POST['fop-from']) : $_POST['fop-from']));
			} else {
				if ($to = (isset($_GET['popup']) ? \FOP\Util::getCurrentBaseurl().'jscloser.php?action=popup' : \FOP\Session::getPayload('dv-fop_fints_buchung')['from'] ?? null)) {
					header('Location: ' . $to);
					die();
				}
				if (!\TablesRouter\Fop_fints_buchung::indexAccess()) {
					if (!\FOPRouter\Index::indexAccess()) {
						header('Location: ' . \FOPRouter\Index::indexURL2(['popup' => $_GET['popup'] ?? null]));
						die();
					}
					header('Location: ' . \FOPRouter\Index::indexURL2(['popup' => $_GET['popup'] ?? null]));
					die();
				}
				header('Location: ' . \TablesRouter\Fop_fints_buchung::indexURL2(['popup' => $_GET['popup'] ?? null]));
			}
			die();
	
		}
		die(json_encode($_POST));
	} else {
    // --- BLOCK: main-4:load-main ---
    
		$data = self::view($id); // TODO: klären, wer die Funktion bereitstellt (momentan crud/view.fop)
	
    // --- BLOCK: main-5 ---
    ?><?php
			header('Content-Type: text/html; charset=UTF-8');
			header('X-XSS-Protection: 1; mode=block');
			header('Strict-Transport-Security: max-age=63072000');
			header('X-Content-Type-Options: nosniff');
			header("Content-Security-Policy: default-src *  data: blob: 'unsafe-inline' 'unsafe-eval'; script-src * 'unsafe-inline' 'unsafe-eval'; connect-src * 'unsafe-inline'; img-src * data: blob: 'unsafe-inline'; frame-src *; style-src * data: blob: 'unsafe-inline'; font-src * data: blob: 'unsafe-inline';");


		?><!DOCTYPE html><html><head><title><?php echo htmlentities(str_replace('%s', \FOP\Database::query('SELECT CONCAT('.qi('fop_fints_buchung').'.'.qi('betrag').', \' am \', '.(\FOP\Database::getDriver() == 'mysql' ? 'DATE_FORMAT(FROM_UNIXTIME' : 'to_char(to_timestamp') . '('.qi('fop_fints_buchung').'.'.qi('bdate').')'.(\FOP\Database::getDriver() == 'mysql' ? '' : '::date') . ', '.\FOP\Database::sessionVarSQL('dateformat').'), \' (\', '.qi('fop_fints_buchung').'.'.qi('vzweck').', \')\') AS description FROM '.qi('fop_fints_buchung').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($id))->fetchColumn() ?: '', _('%s'))); ?></title><base href='<?php echo \FOP\Util::getCurrentBaseurl(); ?>'><meta name="google" content="notranslate"><meta http-equiv="Content-Language" content="<?php echo htmlentities(\FOP\I18n::getLocale()); ?>"><meta charset="utf-8"><link rel="stylesheet" type="text/css" href="style_dependencies.css?v=<?php echo(\FOP\Util::getVersionAppendix()); ?>"><link rel="stylesheet" type="text/css" href="style.css?v=<?php echo(\FOP\Util::getVersionAppendix()); ?>"><script type="text/javascript" src="js/script_dependencies.js?v=<?php echo(\FOP\Util::getVersionAppendix()); ?>"></script><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="mobile-web-app-capable" content="yes"><link rel="manifest" href="manifest.webmanifest"><script type="text/javascript">moment.locale('<?php echo(\FOP\I18n::getShortLocale()); ?>');</script><script type="text/javascript" src="js/form.js"></script><script type="text/javascript">window.globals = <?php
	echo json_encode(['user:superadmin' => /* TODO: resanitizer später mal */(integer) \FOP\User::getSuperadmin(), 'user:mitglied' => /* TODO: resanitizer später mal */(integer) \FOP\User::getMitglied(), 'user:gruppe' => /* TODO: resanitizer später mal */(integer) \FOP\User::getGruppe(), 'user:campaign' => /* TODO: resanitizer später mal */(integer) \FOP\User::getCampaign(), 'user:sammlung' => /* TODO: resanitizer später mal */(integer) \FOP\User::getSammlung(), 'user:protokoll' => /* TODO: resanitizer später mal */(integer) \FOP\User::getProtokoll(), 'user:ID' => /* TODO: resanitizer später mal */(integer) \FOP\User::getID(), 'user:buchhaltung' => /* TODO: resanitizer später mal */(integer) \FOP\User::getBuchhaltung()]);
?>;</script><script type="text/javascript" src="angular/<?php echo(\FOP\I18n::getShortLocale()); ?>/js/alltypes.js?v=<?php echo(\FOP\Util::getVersionAppendix()); ?>"></script><script type="text/javascript" src="angular/angular-i18n/angular-locale_<?php echo \FOP\I18n::getAngularLocale(); ?>.js"></script><script type="text/javascript" src="js/date-filter.js"></script><script type="text/javascript" src="js/dropdown.js"></script><script type="text/javascript" src="js/numeric.js"></script><script type="text/javascript" src="js/getparam.js"></script><script type="text/javascript" src="js/tables.js"></script>
		<script type="text/javascript" src="js/parsehash.js"></script><script type="text/javascript">
		window.query = <?php echo json_encode($_GET, JSON_FORCE_OBJECT); ?>;
		window.baseurl = <?php echo json_encode(\FOP\Util::getCurrentBaseurl()); ?>;

		window.i18n_weiter = <?php echo json_encode(_('Weiter'));?>;
		//Filter I18n:
		window.i18n_quartal = <?php echo json_encode(_('Quarter'));?>;
		window.i18n_alle = <?php echo json_encode(_('All'));?>;
		window.i18n_leere = <?php echo json_encode(_('Empty'));?>;
		window.i18n_tag = <?php echo json_encode(_('Tag'));?>;
		window.i18n_woche = <?php echo json_encode(_('Woche'));?>;
		window.i18n_zeitraum = <?php echo json_encode(_('Period'));?>;
		window.i18n_monat = <?php echo json_encode(_('Monat'));?>;
		window.i18n_jahr = <?php echo json_encode(_('Jahr'));?>;
		window.i18n_von = <?php echo json_encode(_('filters_from'));?>;
		window.i18n_bis = <?php echo json_encode(_('filters_to'));?>;
		window.i18n_tabButton = <?php echo json_encode(_('open_in_new_tab'));?>;
		window.i18n_closeButton = <?php echo json_encode(_('close'));?>;
		</script></head><script type="text/javascript">const fopPushPublicKey = '<?php echo(addslashes(\FOP\Configuration::getFOPPushPublicKey())); ?>';
        const fopUserID = <?php echo(intval(\FOP\User::getID())); ?>;
        var fopPushDisabled = false;
    </script><script type="text/javascript" src="js/serviceworkersetup.js"></script><body ng-app='app'>
		<div class='mdl-js-snackbar mdl-snackbar' id='snackbar'>
			<div class='mdl-snackbar__text'></div>
			<button class='mdl-snackbar__action' type='button'></button>
		</div>
		<script>
			var snackbar = document.querySelector('#snackbar');
			componentHandler.upgradeElement(snackbar, 'MaterialSnackbar');
			$(function () {
				setTimeout(function () {
					$('.fop-layout').scrollTop(0);
				}, 0);
			});
		</script>

		<?php if (isset($_GET['popup'])) { ?>
		<header class="fop-header mdl-layout__header mdl-layout__header mdl-layout__header--scroll">
				<div class="mdl-layout__header-row">
					<?php
	if ($dv = \FOP\Session::getPayload('dv-fop_fints_buchung')) { ?>
	<?php if (isset($dv['prev'])) {?><a href="<?php echo htmlentities(str_replace('XXX', urlencode($id), $dv['prev'])); ?>" class="mdl-button mdl-js-button mdl-button--icon">
		<i class="material-icons">keyboard_arrow_left</i>
	</a><?php } ?>
	<a href="<?php echo htmlentities($dv['from']); ?>" class="mdl-button mdl-js-button mdl-button--icon">
		<i class="material-icons">view_list</i>
	</a>
	<?php if (isset($dv['next'])) {?><a href="<?php echo htmlentities(str_replace('XXX', urlencode($id), $dv['next'])); ?>" class="mdl-button mdl-js-button mdl-button--icon">
		<i class="material-icons">keyboard_arrow_right</i>
	</a><?php } ?><?php } ?><span class="mdl-layout-title"><?php echo htmlentities(str_replace('%s', \FOP\Database::query('SELECT CONCAT('.qi('fop_fints_buchung').'.'.qi('betrag').', \' am \', '.(\FOP\Database::getDriver() == 'mysql' ? 'DATE_FORMAT(FROM_UNIXTIME' : 'to_char(to_timestamp') . '('.qi('fop_fints_buchung').'.'.qi('bdate').')'.(\FOP\Database::getDriver() == 'mysql' ? '' : '::date') . ', '.\FOP\Database::sessionVarSQL('dateformat').'), \' (\', '.qi('fop_fints_buchung').'.'.qi('vzweck').', \')\') AS description FROM '.qi('fop_fints_buchung').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($id))->fetchColumn() ?: '', _('%s'))); ?></span><div class="mdl-layout-spacer"></div><span class="noprint mdl-layout-title mdl-layout--large-screen-only"><div class="mdl-textfield mdl-js-textfield"><input id="supersearch" accesskey="f" class="mdl-textfield__input" type="text" onkeydown="if (event.keyCode == 13 && this.value) window.location.href = 'FOP/Index/searchURL?q=' + encodeURIComponent(this.value) + '&from=<?php echo htmlentities(urlencode(\FOP\Util::getBackUrl())); ?>';" value="<?php echo htmlentities($_GET['q'] ?? ''); ?>" style="border-bottom: 1px solid white;"/><label class="mdl-textfield__label" style="color: inherit"><?php echo(_('search')); ?> - <?php
		if (strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) {
			// MAC: Control+ davor
			echo 'Control + ';
		}
		if (strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox') !== false) {
			// Firefox
			if (strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) {
				// MAC: Control + Alt + key
				echo 'Alt + F';
			} else {
				echo 'Alt + Shift + F';
			}
		} else {
			// Internet Explorer, Chrome, Safari, Opera
			echo 'Alt + F';
		}
	?></label></div></span><i onclick='addFav(null)' class='material-icons fop-favorites' id='favorites_button'>star_border</i>
				</div>
      	</header>
			<style>
				.content {
					margin-top: 0px !important;
				}
			</style>
			<div id='content' class='popup' >
		<?php } else { ?>
			<div class="fop-layout mdl-layout mdl-js-layout mdl-layout--fixed-drawer mdl-layout--fixed-header">
			<header class="fop-header mdl-layout__header mdl-layout__header mdl-layout__header--scroll">
				<div class="mdl-layout__header-row">
					<?php
	if ($dv = \FOP\Session::getPayload('dv-fop_fints_buchung')) { ?>
	<?php if (isset($dv['prev'])) {?><a href="<?php echo htmlentities(str_replace('XXX', urlencode($id), $dv['prev'])); ?>" class="mdl-button mdl-js-button mdl-button--icon">
		<i class="material-icons">keyboard_arrow_left</i>
	</a><?php } ?>
	<a href="<?php echo htmlentities($dv['from']); ?>" class="mdl-button mdl-js-button mdl-button--icon">
		<i class="material-icons">view_list</i>
	</a>
	<?php if (isset($dv['next'])) {?><a href="<?php echo htmlentities(str_replace('XXX', urlencode($id), $dv['next'])); ?>" class="mdl-button mdl-js-button mdl-button--icon">
		<i class="material-icons">keyboard_arrow_right</i>
	</a><?php } ?><?php } ?><span class="mdl-layout-title"><?php echo htmlentities(str_replace('%s', \FOP\Database::query('SELECT CONCAT('.qi('fop_fints_buchung').'.'.qi('betrag').', \' am \', '.(\FOP\Database::getDriver() == 'mysql' ? 'DATE_FORMAT(FROM_UNIXTIME' : 'to_char(to_timestamp') . '('.qi('fop_fints_buchung').'.'.qi('bdate').')'.(\FOP\Database::getDriver() == 'mysql' ? '' : '::date') . ', '.\FOP\Database::sessionVarSQL('dateformat').'), \' (\', '.qi('fop_fints_buchung').'.'.qi('vzweck').', \')\') AS description FROM '.qi('fop_fints_buchung').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($id))->fetchColumn() ?: '', _('%s'))); ?></span><div class="mdl-layout-spacer"></div><span class="noprint mdl-layout-title mdl-layout--large-screen-only"><div class="mdl-textfield mdl-js-textfield"><input id="supersearch" accesskey="f" class="mdl-textfield__input" type="text" onkeydown="if (event.keyCode == 13 && this.value) window.location.href = 'FOP/Index/searchURL?q=' + encodeURIComponent(this.value) + '&from=<?php echo htmlentities(urlencode(\FOP\Util::getBackUrl())); ?>';" value="<?php echo htmlentities($_GET['q'] ?? ''); ?>" style="border-bottom: 1px solid white;"/><label class="mdl-textfield__label" style="color: inherit"><?php echo(_('search')); ?> - <?php
		if (strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) {
			// MAC: Control+ davor
			echo 'Control + ';
		}
		if (strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox') !== false) {
			// Firefox
			if (strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) {
				// MAC: Control + Alt + key
				echo 'Alt + F';
			} else {
				echo 'Alt + Shift + F';
			}
		} else {
			// Internet Explorer, Chrome, Safari, Opera
			echo 'Alt + F';
		}
	?></label></div></span><i onclick='addFav(null)' class='material-icons fop-favorites' id='favorites_button'>star_border</i>
				</div>
      		</header>


				<?php  \EasyEditor\Navigation::render(); ?>
      
				<main class="mdl-layout__content" id="content">
					<div class="fop-content">
						<?php } ?>
						
							<div class="content" id="1">
								

								<form
									
									action="<?php echo \TablesRouter\Fop_fints_buchung::viewURL2(['popup' => $_GET['popup'] ?? null, 'id' => $id]); ?>"
									method="post"
									enctype="multipart/form-data" ng-submit='submit($event)'
									onsubmit="
										if (window.running_uploads) {
											event.preventDefault();
											alert('<?php echo htmlentities(json_encode(_('fileUploadStillActive')));?>');
										}
									"
								 
								id="cardform-wf_fop_fints_buchung_view"
								style="width: 100%; height: 100%;"
								class='mdl-grid'
									ng-controller="FormWf_fop_fints_buchung_view" ng-init="form = <?php echo htmlentities(json_encode([]));
									?>;"
								>
								<?php
								 echo '<input type="hidden" name="csrftoken" value="' . htmlentities(\FOP\Session::getCSRFToken()) . '">';
								 if (isset($_GET['from'])) echo '<input type="hidden" name="fop-from" value="' . htmlentities($_GET['from']) . '">';
								 ?>
								<div id='fop-upbar'></div>
								
									<?php
									$features = [];
									if (true && (true)) {
									$feature = [
										'id' => 'buttons',
										'title' => _('Aktionen'),
										'order' => '300', // 300 (50)
										'mode' => 'area', // 
										'position' => 'full', // 
										'collapsed' => 0, // 
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => null
									];
									$features[$feature['id']] = $feature;
									}
									
									if (true && (false || true || true || true || true || true || true || true || true || true || true || ((false)) || true)) {
									$feature = [
										'id' => 'main',
										'title' => _('Daten'),
										'order' => '100', // 100 (20)
										'mode' => 'area', // 
										'position' => 'full', // 
										'collapsed' => 0, // 
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => '0' .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (((false)) ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											
									];
									$features[$feature['id']] = $feature;
									}
									

									
									/* load order from database
										schema: fop_form_feature(user, form, subid, key, value)
										key = (order, mode, position, collapsed)
									*/
									$upbar_collapsed = false;
									// default values
									foreach (\FOP\Database::query('SELECT subid, '.qi('key').', (SELECT '.qi('value').' FROM fop_form_feature b WHERE a.subid = b.subid AND a.'.qi('key').' = b.'.qi('key').' AND '.qi('user').' = '.intval(\FOP\User::getID()).' GROUP BY '.qi('value').' ORDER BY COUNT(*) DESC LIMIT 1) AS '.qi('value').' FROM fop_form_feature a WHERE '.qi('user').' = '.intval(\FOP\User::getID()).' GROUP BY subid, '.qi('key'))->fetchAll(\PDO::FETCH_ASSOC) AS $setting) {
										if (isset($features[$setting['subid']])) {
											$features[$setting['subid']][$setting['key']] = $setting['value'];
										}
									}
									// form specific special values
									foreach (\FOP\Database::query('SELECT subid, '.qi('key').', '.qi('value').' FROM fop_form_feature a WHERE form = \'wf:fop_fints_buchung:view\' AND '.qi('user').' = '.intval(\FOP\User::getID()).'')->fetchAll(\PDO::FETCH_ASSOC) AS $setting) {
										if (isset($features[$setting['subid']])) {
											$features[$setting['subid']][$setting['key']] = $setting['value'];
										} else if ($setting['subid'] == 'upbar' && $setting['key'] == 'collapsed') {
											$upbar_collapsed = (bool) $setting['value'];
										}
									}

									/* fill in the content of the features */
									if (true && (true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['buttons']);
										?><div id='wf_fop_fints_buchung_view_buttons' class='mdl-cell mdl-cell--12-col' style='flex-wrap: wrap;'>
		<?php if (true && $data['operation::view'] == 1 && $data['operation::edit'] == 1 && ((\FOP\User::getBuchhaltung()) && (\FOP\User::getBuchhaltung())) && ((\FOP\User::getBuchhaltung()) && (\FOP\User::getBuchhaltung()))) { ?><a title="<?php echo(_('editbtn')); ?>" class="detailbtn mdl-button mdl-js-button mdl-button--raised mdl-button--colored" href="<?php echo htmlentities(\TablesRouter\Fop_fints_buchung::editURL2(['id' => $data['ID'], 'popup' => $_GET['popup'] ?? null])); ?>"><i class='material-icons'>mode_edit</i> <?php echo(_('editbtn')); ?></a><?php } ?>&nbsp;<?php if (true) { ?><button onclick="$(this).closest('form').find('.mdl-textfield__error:visible').hide();
		$('[required]').removeAttr('required');
	" type="submit" name="ok" class="mdl-button mdl-js-button mdl-button--colored mdl-button--raised" ><i class="material-icons">check</i><?php echo(_('ok')); ?></button><?php } ?>
									&nbsp;
		<?php if ($data['operation::view'] == 1 && $data['operation::view'] == 1 && ((\FOP\User::getBuchhaltung()) && (\FOP\User::getBuchhaltung()))) { ?><a title="<?php echo(_('Ignorieren')); ?>" class="detailbtn mdl-button mdl-js-button mdl-button--raised mdl-button--colored" href="<?php echo htmlentities(\TablesRouter\Fop_fints_buchung::ignoreForderungURL2(['ids' => $data['ID'], 'popup' => $_GET['popup'] ?? null])); ?>"><i class='material-icons'>visibility_off</i> <?php echo(_('Ignorieren')); ?></a><?php } ?>&nbsp;
		<?php if (true && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest()) && ((\FOP\User::getBuchhaltung()) && (\FOP\User::getGruppe()))) { ?><a title="<?php echo(_('Einzelbuchung')); ?>" class="detailbtn mdl-button mdl-js-button mdl-button--raised mdl-button--colored" href="<?php echo htmlentities(\TablesRouter\MitgliedBuchung::createURL2(['buchung' => $data['ID'], 'popup' => $_GET['popup'] ?? null])); ?>"><i class='material-icons'>arrow_forward</i> <?php echo(_('Einzelbuchung')); ?></a><?php } ?>&nbsp;
		<?php if (true && $data['operation::view'] == 1 && ((\FOP\User::getBuchhaltung()) && (\FOP\User::getBuchhaltung()))) { ?><a title="<?php echo(_('Mitglied zuordnen')); ?>" class="detailbtn mdl-button mdl-js-button mdl-button--raised mdl-button--colored" href="<?php echo htmlentities(\TablesRouter\Mitglied::assignIbanURL2(['buchung' => $data['ID'], 'popup' => $_GET['popup'] ?? null])); ?>"><i class='material-icons'>shuffle</i> <?php echo(_('Mitglied zuordnen')); ?></a><?php } ?>&nbsp;
		<?php if ($data['operation::delete'] == 1 && $data['operation::delete'] == 1 && ((false) && (\FOP\User::getBuchhaltung()) && (\FOP\User::getBuchhaltung()))) { ?><a title="<?php echo(_('deletebtn')); ?>" class="detailbtn mdl-button mdl-js-button mdl-button--raised mdl-button--colored" href="<?php echo htmlentities(\TablesRouter\Fop_fints_buchung::deleteConfirmURL2(['id' => $data['ID'], 'popup' => $_GET['popup'] ?? null, 'from' => $_GET['from'] ?? \FOP\Session::getPayload('dv-fop_fints_buchung')['from'] ?? null])); ?>"><i class='material-icons'>delete</i> <?php echo(_('deletebtn')); ?></a><?php } ?></div><script type='text/javascript'>
		// copy all buttons to #fop-upbar
		$(function () {
    var btn = document.getElementById("fop-bar-mainbutton");
    var upbar = $('#fop-upbar');
    var upbar_buttons = document.getElementById("fop-bar-container");

    // Check if the elements already exist
    if (!btn || !upbar_buttons) {
        if (!btn) {
            btn = $('<div id="fop-bar-mainbutton" class="mdl-button fop-button-half fop-button-margin mdl-button--raised"><i class="material-icons">keyboard_arrow_right</i></div>')
                .click(function () {
                    if (btn.find('i').text() == 'keyboard_arrow_right') {
                        upbar_buttons.fadeOut(400);
                        btn.find('i').text('keyboard_arrow_left');
                    } else {
                        upbar_buttons.fadeIn(400);
                        btn.find('i').text('keyboard_arrow_right');
                    }
                });
            upbar.append(btn);
        }

        if (!upbar_buttons) {
            upbar_buttons = $('<div id="fop-bar-container" style="max-width: 290px"></div>'); //dependant on the mdl-buttons width, caps of upbar buttons at exactly 4 buttons
            upbar.append(upbar_buttons);
        }

        var buttons = $('#wf_fop_fints_buchung_view_buttons').find('.mdl-button');
        buttons.each(function (i, v) {
            var button = $(v);
            var newbutton = $('<div></div>');
            newbutton.attr('class', button.attr('class'));
            newbutton.attr('title', button.attr('title'));
            newbutton.append(button.find('.material-icons').clone(false));
            newbutton.click(function () {
                button[0].click();
            });
            upbar_buttons.append(newbutton);
        });
    }
});

	</script><?php
										\EasyEditor\FormFeature::pop();
										$features['buttons']['html'] = ob_get_contents();
										ob_end_clean();
									}
									
									if (true && (false || true || true || true || true || true || true || true || true || true || true || ((false)) || true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['main']);
										?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_forderungDone" id="column_forderungDone">
		<!-- Feld "Forderung behandelt": forderungDone -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="forderungDone"><?php echo(_('Forderung behandelt')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<?php if($data['forderungDone'] == 1){ ?>✓<?php }else{ ?>✗<?php }?>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_konto" id="column_konto">
		<!-- Feld "Konto": konto -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="konto"><?php echo(_('Konto')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<?php
	
	$sql = 'SELECT '.qi('ID').' AS '.qi('ID').', '.qi('fop_fints_konto').'.'.qi('kontoname').' AS description, (('.\FOP\Database::quote(\FOP\User::getBuchhaltung()).')) AS '.qi('canView').' FROM '.qi('fop_fints_konto').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($data['konto']);
	$fop_fints_konto_result = \FOP\Database::query($sql);
	if ($fop_fints_konto_row = $fop_fints_konto_result->fetch(\PDO::FETCH_ASSOC)) {
		if ($fop_fints_konto_row['canView']) echo "<a onclick=\"event.preventDefault(); open_url(this.href, false);\" href=\"" . \TablesRouter\Fop_fints_konto::viewURL($data['konto'], ['from' => \FOP\Util::getBackURL()]) . "\" class=\"tbl-link\" data-tbl=\"fop_fints_konto\" data-id=\"".htmlentities($fop_fints_konto_row['ID'])."\">";echo htmlentities($fop_fints_konto_row['description']);if ($fop_fints_konto_row['canView']) echo "</a>";
	} else {
		echo htmlentities(_('') ?: '-');
	}
	
?>

	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_bdate" id="column_bdate">
		<!-- Feld "Buchungsdatum": bdate -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="bdate"><?php echo(_('Buchungsdatum')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		
	<?php echo htmlentities(($data['bdate']) ? strftime(_('dateformat_php2'), intval($data['bdate'])) : ''); ?>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_date" id="column_date">
		<!-- Feld "Wertstellungsdatum": date -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="date"><?php echo(_('Wertstellungsdatum')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		
	<?php echo htmlentities(($data['date']) ? strftime(_('dateformat_php2'), intval($data['date'])) : ''); ?>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_betrag" id="column_betrag">
		<!-- Feld "Betrag": betrag -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="betrag"><?php echo(_('Betrag')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<span style="white-space: nowrap; width: 100%; display: inline-block; "><?php echo htmlentities(\Types\Euro::print($data['betrag'])); ?><?php echo '&nbsp;' .  htmlentities('€'); ?>
	</span>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_saldo" id="column_saldo">
		<!-- Feld "Saldo": saldo -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="saldo"><?php echo(_('Saldo')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<span style="white-space: nowrap; width: 100%; display: inline-block; "><?php echo htmlentities(\Types\Euro::print($data['saldo'])); ?><?php echo '&nbsp;' .  htmlentities('€'); ?>
	</span>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_iban" id="column_iban">
		<!-- Feld "IBAN": iban -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="iban"><?php echo(_('IBAN')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		
	<?php echo htmlentities($data['iban']); ?>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_name_firma" id="column_name_firma">
		<!-- Feld "Name, Vorname/Firma": name_firma -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="name_firma"><?php echo(_('Name, Vorname/Firma')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		
	<?php echo htmlentities($data['name_firma']); ?>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_vzweck" id="column_vzweck">
		<!-- Feld "Verwendungszweck": vzweck -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="vzweck"><?php echo(_('Verwendungszweck')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		
	<?php echo htmlentities($data['vzweck']); ?>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_endtoend" id="column_endtoend">
		<!-- Feld "End to End-Referenz": endtoend -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="endtoend"><?php echo(_('End to End-Referenz')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		
	<?php echo htmlentities($data['endtoend']); ?>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_umsatzart" id="column_umsatzart">
		<!-- Feld "Umsatzart": umsatzart -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="umsatzart"><?php echo(_('Umsatzart')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		
	<?php echo htmlentities($data['umsatzart']); ?>
	</div>
	</div><?php if (((false))) { ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_hash" id="column_hash">
		<!-- Feld "Hashcode": hash -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="hash"><?php echo(_('Hashcode')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		
	<?php echo htmlentities($data['hash']); ?>
	</div>
	</div><?php } ?><?php
										\EasyEditor\FormFeature::pop();
										$features['main']['html'] = ob_get_contents();
										ob_end_clean();
									}
									

									uasort($features, function ($a, $b) {
										return strnatcmp($a['order'], $b['order']);
									});
									foreach ($features AS $feature) {
										\EasyEditor\FormFeature::render($feature);
									}
									?><script type='text/javascript'>
										function setCFF(id, key, value) {
											<?php if(!\FOP\User::getIsGuest()) { ?>
											$.get('FOP/Index/setCFF?form=wf%3Afop_fints_buchung%3Aview&subid=' + encodeURIComponent(id) + '&key=' + encodeURIComponent(key) + '&value=' + encodeURIComponent(value)).then(function () {
												if (key == 'reset') {
													location.reload();
												}
											});
											<?php } /* EditAccess */ ?>
										}
										function setCFFOrder(fids) {
											<?php if(!\FOP\User::getIsGuest()) { ?>
											$.get('FOP/Index/setCFFOrder?form=wf%3Afop_fints_buchung%3Aview&fids=' + encodeURIComponent(JSON.stringify(fids)));
											<?php } /* EditAccess */ ?>
										}
										$(function () {
											refreshTabHeaders($('#cardform-wf_fop_fints_buchung_view')); /* provided in js/form.js */
											// preselection
											if (location.hash.startsWith('#select:')) {
												$('[name="' + window.location.hash.slice(8) + '"]').focus().select();
											} else {
												$('#cardform-wf_fop_fints_buchung_view input[type!="hidden"],textarea,select[tabindex!="-1"]').not('.fop-disabled *').filter(':visible:first').focus().select();
											}
										});

										$(window).keydown(function(event) {
											 if (event.ctrlKey && String.fromCharCode(event.which).toLowerCase() == 's') {
												 event.preventDefault();
												 $('button[type=submit]').click();
												 return false;
											 }
										});

										
										$(document).on('keyup',function(evt) {
										   if (evt.keyCode == 27) {
												if (window.parent) {
													window.close(); // iframe:close
												} else {
													window.history.back();
												}
											}
												});
										
									</script>

							</form>
							

							</div>
							<div class="content" id="focus-supersearch">
							</div>
							<div class="content" id="focus-supersearch">
		<script type='text/javascript'>
			$(function () {
				var focusfield = $('#supersearch');
				if (focusfield.length) {
					focusfield[0].focus();
					focusfield[0].select();
				}
			});
		</script>
	
							</div>
							<div class="content" id="~spacer"><?php if (!isset($_GET['popup'])) { ?><div style="padding-bottom: 10cm;"></div><?php } ?>
							</div>
						<?php if (!isset($_GET['popup'])) { ?>
					</div>
				</main>
				
			</div>
		<?php } else { ?></div><?php } ?>
<?php if (!isset($_GET['popup'])) { ?><div class='fop-seal'></div><?php } ?></body></html><?php
    // --- BLOCK: main-6 ---
    }
    
  }

  public static function createAction($column_konto = null ) { 
    
    // Methodenimplementierung überschrieben.
    throw new \FOP\AccessDeniedException();return false;
  }

  public static function editAction($id = null ) { 
    
    
    // --- BLOCK: 0_CSRFValidate ---
    
	if ($_SERVER['REQUEST_METHOD'] === 'POST') \FOP\Session::validateCSRFToken(); else \FOP\Session::getCSRFToken();

    // --- BLOCK: 0_CSRF_ensure ---
    
	\FOP\Session::getCSRFToken();
    // --- BLOCK: access ---
    if(!(((\FOP\User::getBuchhaltung()) && (\FOP\User::getBuchhaltung())))) throw new \FOP\AccessDeniedException();
    // --- BLOCK: access+validators ---
    
	if ($_SERVER['REQUEST_METHOD'] === 'POST') {
		$data = self::view($id);
		/* Validatoren */
		
		if (((false)) && ($data['konto::canEdit'] == 1) && (!isset($_POST['cancel']))) \Types\Fop_fints_konto::validate($_POST['konto']);
		if (((false)) && ($data['iban::canEdit'] == 1) && (!isset($_POST['cancel']))) \FOP\Validators::iban_checker($_POST['iban']);

		
		/* Sanitizer */

		if (((false)) && ($data['konto::canEdit'] == 1) && (!isset($_POST['cancel']))) $_POST['konto'] = \FOP\Sanitizers::null_filter($_POST['konto']);
		if (((false)) && ($data['bdate::canEdit'] == 1)) $_POST['bdate'] = \FOP\Sanitizers::convert_date_to_unix_timestamp($_POST['bdate']);
		if (((false)) && ($data['date::canEdit'] == 1)) $_POST['date'] = \FOP\Sanitizers::convert_date_to_unix_timestamp($_POST['date']);
		if (((false)) && ($data['betrag::canEdit'] == 1)) $_POST['betrag'] = \Types\Euro::parse($_POST['betrag']);
		if (((false)) && ($data['saldo::canEdit'] == 1)) $_POST['saldo'] = \Types\Euro::parse($_POST['saldo']);
		if (((false)) && ($data['iban::canEdit'] == 1) && (!isset($_POST['cancel']))) $_POST['iban'] = \FOP\Sanitizers::iban_filter($_POST['iban']);
		if (((false)) && ($data['iban::canEdit'] == 1) && (!isset($_POST['cancel']))) $_POST['iban'] = \FOP\Sanitizers::no_text($_POST['iban']);
		if (((false)) && ($data['iban::canEdit'] == 1) && (!isset($_POST['cancel']))) $_POST['iban'] = mb_strtoupper($_POST['iban']);

		
	}
	
    // --- BLOCK: access+~konto:be4e517bcab327042669d75d9e676b9f5f5a9a843d9e57e3f4b4cd3fbb948c22:if ---
    
		if ($_SERVER['REQUEST_METHOD'] === 'POST') {
			if (((false)) && !isset($_POST['cancel']) && !(((\FOP\Util::FalseToNull(\FOP\Database::query('SELECT ('.\FOP\Database::quote(\FOP\User::getBuchhaltung()).') FROM '.qi('fop_fints_konto').' '.qi('2ZJnnPGF').' WHERE '.qi('2ZJnnPGF').'.'.qi('ID').' = ' . \FOP\Database::quote($_POST['konto']) . '')->fetchColumn()))) !== null && ((\FOP\Util::FalseToNull(\FOP\Database::query('SELECT ('.\FOP\Database::quote(\FOP\User::getBuchhaltung()).') FROM '.qi('fop_fints_konto').' '.qi('2ZJnnPGF').' WHERE '.qi('2ZJnnPGF').'.'.qi('ID').' = ' . \FOP\Database::quote($_POST['konto']) . '')->fetchColumn()))) !== '0' ? ((\FOP\Util::FalseToNull(\FOP\Database::query('SELECT ('.\FOP\Database::quote(\FOP\User::getBuchhaltung()).') FROM '.qi('fop_fints_konto').' '.qi('2ZJnnPGF').' WHERE '.qi('2ZJnnPGF').'.'.qi('ID').' = ' . \FOP\Database::quote($_POST['konto']) . '')->fetchColumn()))) : (false))) throw new \FOP\AccessDeniedException();
		}
	
    // --- BLOCK: access+~konto:fop_fints_buchung:hash:konto:unique ---
    
		if ($_SERVER['REQUEST_METHOD'] === 'POST') {
			if (($data ?? null) && isset($data['ID'])) $_POST['ID'] = $data['ID'];
			if (((false)) && ((false)) && ((false)) && !isset($_POST['cancel']) && !(true)) throw new \FOP\AccessDeniedException();
		}
	
    // --- BLOCK: access-item-fop_fints_buchung-edit ---
    
		if ($id !== null && \FOP\Database::query('SELECT ('.\FOP\Database::quote(\FOP\User::getBuchhaltung()).') AND (COALESCE((SELECT ('.\FOP\Database::quote(\FOP\User::getBuchhaltung()).') FROM '.qi('fop_fints_konto').' '.qi('56VmsVdP').' WHERE '.qi('56VmsVdP').'.'.qi('ID').' = '.qi('fop_fints_buchung').'.'.qi('konto').' LIMIT 1), FALSE)) AND ('.\FOP\Database::quote(\FOP\User::getBuchhaltung()).') FROM '.qi('fop_fints_buchung').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($id))->fetchColumn() != 1) {
			throw new \FOP\AccessDeniedException();
		}
	
    // --- BLOCK: main ---
    
		// Main block
	
    // --- BLOCK: main-1 ---
    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
		if (!isset($_POST['cancel'])) {
			\FOP\Database::beginTransaction();
    // --- BLOCK: main-2:save-clone-prepare ---
    
		$data = self::view($id);
	
    // --- BLOCK: main-2:save-main ---
    
		$data_edit = [];
		$data_edit['forderungDone'] = $_POST['forderungDone'];
		if (((false)) && ($data['konto::canEdit'] == 1) && (!isset($_POST['cancel']))) $data_edit['konto'] = $_POST['konto'];
		if (((false)) && ($data['bdate::canEdit'] == 1)) $data_edit['bdate'] = $_POST['bdate'];
		if (((false)) && ($data['date::canEdit'] == 1)) $data_edit['date'] = $_POST['date'];
		if (((false)) && ($data['betrag::canEdit'] == 1)) $data_edit['betrag'] = $_POST['betrag'];
		if (((false)) && ($data['saldo::canEdit'] == 1)) $data_edit['saldo'] = $_POST['saldo'];
		if (((false)) && ($data['iban::canEdit'] == 1) && (!isset($_POST['cancel']))) $data_edit['iban'] = $_POST['iban'];
		if (((false)) && ($data['name_firma::canEdit'] == 1)) $data_edit['name_firma'] = $_POST['name_firma'];
		if (((false)) && ($data['vzweck::canEdit'] == 1)) $data_edit['vzweck'] = $_POST['vzweck'];
		if (((false)) && ($data['endtoend::canEdit'] == 1)) $data_edit['endtoend'] = $_POST['endtoend'];
		if (((false)) && ($data['umsatzart::canEdit'] == 1)) $data_edit['umsatzart'] = $_POST['umsatzart'];
		if (((false)) && ($data['hash::canEdit'] == 1)) $data_edit['hash'] = $_POST['hash'];
		self::edit($id, $data_edit);
		if (isset($data_edit['ID'])) {
			$id = $data_edit['ID'];
		}
	
    // --- BLOCK: main-3 ---
    
			\FOP\Database::commitTransaction();
			
		}
		
		if (isset($_POST['cancel'])) {
			
			if (isset($_POST['fop-from']) && $_POST['fop-from']) {
				// Redirect zu fop-from
				header('Location: ' . preg_replace('/&insert_param=(.*)$/', '&$1=' . ($id instanceof \FOP\IDList ? $id->toString() : $id), $_POST['fop-from']));
			} else {
				header('Location: ' . \TablesRouter\Fop_fints_buchung::viewURL2(['id' => $id, 'popup' => $_GET['popup'] ?? null]));
			}
			die();
	
		}
		if (isset($_POST['save'])) {
			
			if (isset($_POST['fop-from']) && $_POST['fop-from']) {
				// Redirect zu fop-from
				header('Location: ' . preg_replace('/&insert_param=(.*)$/', '&$1=' . ($id instanceof \FOP\IDList ? $id->toString() : $id), $_POST['fop-from']));
			} else {
				header('Location: ' . \TablesRouter\Fop_fints_buchung::viewURL2(['id' => $id, 'popup' => $_GET['popup'] ?? null]));
			}
			die();
	
		}
		die(json_encode($_POST));
	} else {
    // --- BLOCK: main-4:load-main ---
    
		$data = self::view($id); // TODO: klären, wer die Funktion bereitstellt (momentan crud/view.fop)
	
    // --- BLOCK: main-5 ---
    ?><?php
			header('Content-Type: text/html; charset=UTF-8');
			header('X-XSS-Protection: 1; mode=block');
			header('Strict-Transport-Security: max-age=63072000');
			header('X-Content-Type-Options: nosniff');
			header("Content-Security-Policy: default-src *  data: blob: 'unsafe-inline' 'unsafe-eval'; script-src * 'unsafe-inline' 'unsafe-eval'; connect-src * 'unsafe-inline'; img-src * data: blob: 'unsafe-inline'; frame-src *; style-src * data: blob: 'unsafe-inline'; font-src * data: blob: 'unsafe-inline';");


		?><!DOCTYPE html><html><head><title><?php echo htmlentities(str_replace('%s', \FOP\Database::query('SELECT CONCAT('.qi('fop_fints_buchung').'.'.qi('betrag').', \' am \', '.(\FOP\Database::getDriver() == 'mysql' ? 'DATE_FORMAT(FROM_UNIXTIME' : 'to_char(to_timestamp') . '('.qi('fop_fints_buchung').'.'.qi('bdate').')'.(\FOP\Database::getDriver() == 'mysql' ? '' : '::date') . ', '.\FOP\Database::sessionVarSQL('dateformat').'), \' (\', '.qi('fop_fints_buchung').'.'.qi('vzweck').', \')\') AS description FROM '.qi('fop_fints_buchung').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($id))->fetchColumn() ?: '', _('edit %s'))); ?></title><base href='<?php echo \FOP\Util::getCurrentBaseurl(); ?>'><meta name="google" content="notranslate"><meta http-equiv="Content-Language" content="<?php echo htmlentities(\FOP\I18n::getLocale()); ?>"><meta charset="utf-8"><link rel="stylesheet" type="text/css" href="style_dependencies.css?v=<?php echo(\FOP\Util::getVersionAppendix()); ?>"><link rel="stylesheet" type="text/css" href="style.css?v=<?php echo(\FOP\Util::getVersionAppendix()); ?>"><script type="text/javascript" src="js/script_dependencies.js?v=<?php echo(\FOP\Util::getVersionAppendix()); ?>"></script><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="mobile-web-app-capable" content="yes"><link rel="manifest" href="manifest.webmanifest"><script type="text/javascript">moment.locale('<?php echo(\FOP\I18n::getShortLocale()); ?>');</script><script type="text/javascript" src="js/form.js"></script><script type="text/javascript">window.globals = <?php
	echo json_encode(['user:superadmin' => /* TODO: resanitizer später mal */(integer) \FOP\User::getSuperadmin(), 'user:mitglied' => /* TODO: resanitizer später mal */(integer) \FOP\User::getMitglied(), 'user:gruppe' => /* TODO: resanitizer später mal */(integer) \FOP\User::getGruppe(), 'user:campaign' => /* TODO: resanitizer später mal */(integer) \FOP\User::getCampaign(), 'user:sammlung' => /* TODO: resanitizer später mal */(integer) \FOP\User::getSammlung(), 'user:protokoll' => /* TODO: resanitizer später mal */(integer) \FOP\User::getProtokoll(), 'user:ID' => /* TODO: resanitizer später mal */(integer) \FOP\User::getID(), 'user:buchhaltung' => /* TODO: resanitizer später mal */(integer) \FOP\User::getBuchhaltung()]);
?>;</script><script type="text/javascript" src="angular/<?php echo(\FOP\I18n::getShortLocale()); ?>/js/alltypes.js?v=<?php echo(\FOP\Util::getVersionAppendix()); ?>"></script><script type="text/javascript" src="angular/angular-i18n/angular-locale_<?php echo \FOP\I18n::getAngularLocale(); ?>.js"></script><script type="text/javascript" src="js/date-filter.js"></script><script type="text/javascript" src="js/dropdown.js"></script><script type="text/javascript" src="js/numeric.js"></script><script type="text/javascript" src="js/getparam.js"></script><script type="text/javascript" src="js/tables.js"></script>
		<script type="text/javascript" src="js/parsehash.js"></script><script type="text/javascript">
		window.query = <?php echo json_encode($_GET, JSON_FORCE_OBJECT); ?>;
		window.baseurl = <?php echo json_encode(\FOP\Util::getCurrentBaseurl()); ?>;

		window.i18n_weiter = <?php echo json_encode(_('Weiter'));?>;
		//Filter I18n:
		window.i18n_quartal = <?php echo json_encode(_('Quarter'));?>;
		window.i18n_alle = <?php echo json_encode(_('All'));?>;
		window.i18n_leere = <?php echo json_encode(_('Empty'));?>;
		window.i18n_tag = <?php echo json_encode(_('Tag'));?>;
		window.i18n_woche = <?php echo json_encode(_('Woche'));?>;
		window.i18n_zeitraum = <?php echo json_encode(_('Period'));?>;
		window.i18n_monat = <?php echo json_encode(_('Monat'));?>;
		window.i18n_jahr = <?php echo json_encode(_('Jahr'));?>;
		window.i18n_von = <?php echo json_encode(_('filters_from'));?>;
		window.i18n_bis = <?php echo json_encode(_('filters_to'));?>;
		window.i18n_tabButton = <?php echo json_encode(_('open_in_new_tab'));?>;
		window.i18n_closeButton = <?php echo json_encode(_('close'));?>;
		</script></head><script type="text/javascript">const fopPushPublicKey = '<?php echo(addslashes(\FOP\Configuration::getFOPPushPublicKey())); ?>';
        const fopUserID = <?php echo(intval(\FOP\User::getID())); ?>;
        var fopPushDisabled = false;
    </script><script type="text/javascript" src="js/serviceworkersetup.js"></script><body ng-app='app'>
		<div class='mdl-js-snackbar mdl-snackbar' id='snackbar'>
			<div class='mdl-snackbar__text'></div>
			<button class='mdl-snackbar__action' type='button'></button>
		</div>
		<script>
			var snackbar = document.querySelector('#snackbar');
			componentHandler.upgradeElement(snackbar, 'MaterialSnackbar');
			$(function () {
				setTimeout(function () {
					$('.fop-layout').scrollTop(0);
				}, 0);
			});
		</script>

		<?php if (isset($_GET['popup'])) { ?>
		<header class="fop-header mdl-layout__header mdl-layout__header mdl-layout__header--scroll">
				<div class="mdl-layout__header-row">
					<span class="mdl-layout-title"><?php echo htmlentities(str_replace('%s', \FOP\Database::query('SELECT CONCAT('.qi('fop_fints_buchung').'.'.qi('betrag').', \' am \', '.(\FOP\Database::getDriver() == 'mysql' ? 'DATE_FORMAT(FROM_UNIXTIME' : 'to_char(to_timestamp') . '('.qi('fop_fints_buchung').'.'.qi('bdate').')'.(\FOP\Database::getDriver() == 'mysql' ? '' : '::date') . ', '.\FOP\Database::sessionVarSQL('dateformat').'), \' (\', '.qi('fop_fints_buchung').'.'.qi('vzweck').', \')\') AS description FROM '.qi('fop_fints_buchung').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($id))->fetchColumn() ?: '', _('edit %s'))); ?></span><div class="mdl-layout-spacer"></div><span class="noprint mdl-layout-title mdl-layout--large-screen-only"><div class="mdl-textfield mdl-js-textfield"><input id="supersearch" accesskey="f" class="mdl-textfield__input" type="text" onkeydown="if (event.keyCode == 13 && this.value) window.location.href = 'FOP/Index/searchURL?q=' + encodeURIComponent(this.value) + '&from=<?php echo htmlentities(urlencode(\FOP\Util::getBackUrl())); ?>';" value="<?php echo htmlentities($_GET['q'] ?? ''); ?>" style="border-bottom: 1px solid white;"/><label class="mdl-textfield__label" style="color: inherit"><?php echo(_('search')); ?> - <?php
		if (strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) {
			// MAC: Control+ davor
			echo 'Control + ';
		}
		if (strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox') !== false) {
			// Firefox
			if (strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) {
				// MAC: Control + Alt + key
				echo 'Alt + F';
			} else {
				echo 'Alt + Shift + F';
			}
		} else {
			// Internet Explorer, Chrome, Safari, Opera
			echo 'Alt + F';
		}
	?></label></div></span><i onclick='addFav(null)' class='material-icons fop-favorites' id='favorites_button'>star_border</i>
				</div>
      	</header>
			<style>
				.content {
					margin-top: 0px !important;
				}
			</style>
			<div id='content' class='popup' >
		<?php } else { ?>
			<div class="fop-layout mdl-layout mdl-js-layout mdl-layout--fixed-drawer mdl-layout--fixed-header">
			<header class="fop-header mdl-layout__header mdl-layout__header mdl-layout__header--scroll">
				<div class="mdl-layout__header-row">
					<span class="mdl-layout-title"><?php echo htmlentities(str_replace('%s', \FOP\Database::query('SELECT CONCAT('.qi('fop_fints_buchung').'.'.qi('betrag').', \' am \', '.(\FOP\Database::getDriver() == 'mysql' ? 'DATE_FORMAT(FROM_UNIXTIME' : 'to_char(to_timestamp') . '('.qi('fop_fints_buchung').'.'.qi('bdate').')'.(\FOP\Database::getDriver() == 'mysql' ? '' : '::date') . ', '.\FOP\Database::sessionVarSQL('dateformat').'), \' (\', '.qi('fop_fints_buchung').'.'.qi('vzweck').', \')\') AS description FROM '.qi('fop_fints_buchung').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($id))->fetchColumn() ?: '', _('edit %s'))); ?></span><div class="mdl-layout-spacer"></div><span class="noprint mdl-layout-title mdl-layout--large-screen-only"><div class="mdl-textfield mdl-js-textfield"><input id="supersearch" accesskey="f" class="mdl-textfield__input" type="text" onkeydown="if (event.keyCode == 13 && this.value) window.location.href = 'FOP/Index/searchURL?q=' + encodeURIComponent(this.value) + '&from=<?php echo htmlentities(urlencode(\FOP\Util::getBackUrl())); ?>';" value="<?php echo htmlentities($_GET['q'] ?? ''); ?>" style="border-bottom: 1px solid white;"/><label class="mdl-textfield__label" style="color: inherit"><?php echo(_('search')); ?> - <?php
		if (strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) {
			// MAC: Control+ davor
			echo 'Control + ';
		}
		if (strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox') !== false) {
			// Firefox
			if (strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) {
				// MAC: Control + Alt + key
				echo 'Alt + F';
			} else {
				echo 'Alt + Shift + F';
			}
		} else {
			// Internet Explorer, Chrome, Safari, Opera
			echo 'Alt + F';
		}
	?></label></div></span><i onclick='addFav(null)' class='material-icons fop-favorites' id='favorites_button'>star_border</i>
				</div>
      		</header>


				<?php  \EasyEditor\Navigation::render(); ?>
      
				<main class="mdl-layout__content" id="content">
					<div class="fop-content">
						<?php } ?>
						
							<div class="content" id="1">
								

								<form
									
									action="<?php echo \TablesRouter\Fop_fints_buchung::editURL2(['popup' => $_GET['popup'] ?? null, 'id' => $id]); ?>"
									method="post"
									enctype="multipart/form-data" ng-submit='submit($event)'
									onsubmit="
										if (window.running_uploads) {
											event.preventDefault();
											alert('<?php echo htmlentities(json_encode(_('fileUploadStillActive')));?>');
										}
									"
								 
								id="cardform-wf_fop_fints_buchung_edit"
								style="width: 100%; height: 100%;"
								class='mdl-grid'
									ng-controller="FormWf_fop_fints_buchung_edit" ng-init="form = <?php echo htmlentities(json_encode(['hash' => $data['hash'], 'konto' => $data['konto'], 'ID' => $data['ID']]));
									?>;"
								>
								<?php
								 echo '<input type="hidden" name="csrftoken" value="' . htmlentities(\FOP\Session::getCSRFToken()) . '">';
								 if (isset($_GET['from'])) echo '<input type="hidden" name="fop-from" value="' . htmlentities($_GET['from']) . '">';
								 ?>
								<div id='fop-upbar'></div>
								
									<?php
									$features = [];
									if (true && (true)) {
									$feature = [
										'id' => 'buttons',
										'title' => _('Aktionen'),
										'order' => '300', // 300 (50)
										'mode' => 'area', // 
										'position' => 'full', // 
										'collapsed' => 0, // 
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => null
									];
									$features[$feature['id']] = $feature;
									}
									
									if (true && (false || true || ((false)) && ($data['bdate::canEdit'] == 1) || ((false)) && ($data['date::canEdit'] == 1) || ((false)) && ($data['betrag::canEdit'] == 1) || ((false)) && ($data['saldo::canEdit'] == 1) || ((false)) && ($data['iban::canEdit'] == 1) && (!isset($_POST['cancel'])) || ((false)) && ($data['name_firma::canEdit'] == 1) || ((false)) && ($data['vzweck::canEdit'] == 1) || ((false)) && ($data['endtoend::canEdit'] == 1) || ((false)) && ($data['umsatzart::canEdit'] == 1) || ((false)) && ($data['hash::canEdit'] == 1) || ((false)) && ($data['konto::canEdit'] == 1) && (!isset($_POST['cancel'])))) {
									$feature = [
										'id' => 'main',
										'title' => _('Daten'),
										'order' => '100', // 100 (20)
										'mode' => 'area', // 
										'position' => 'full', // 
										'collapsed' => 0, // 
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => '0' .'||'. (true ? 'true' : '0')
											 .'||'. (((false)) && ($data['bdate::canEdit'] == 1) ? 'true' : '0')
											 .'||'. (((false)) && ($data['date::canEdit'] == 1) ? 'true' : '0')
											 .'||'. (((false)) && ($data['betrag::canEdit'] == 1) ? 'true' : '0')
											 .'||'. (((false)) && ($data['saldo::canEdit'] == 1) ? 'true' : '0')
											 .'||'. (((false)) && ($data['iban::canEdit'] == 1) && (!isset($_POST['cancel'])) ? 'true' : '0')
											 .'||'. (((false)) && ($data['name_firma::canEdit'] == 1) ? 'true' : '0')
											 .'||'. (((false)) && ($data['vzweck::canEdit'] == 1) ? 'true' : '0')
											 .'||'. (((false)) && ($data['endtoend::canEdit'] == 1) ? 'true' : '0')
											 .'||'. (((false)) && ($data['umsatzart::canEdit'] == 1) ? 'true' : '0')
											 .'||'. (((false)) && ($data['hash::canEdit'] == 1) ? 'true' : '0')
											 .'||'. (((false)) && ($data['konto::canEdit'] == 1) && (!isset($_POST['cancel'])) ? 'true' : '0')
											
									];
									$features[$feature['id']] = $feature;
									}
									

									
									/* load order from database
										schema: fop_form_feature(user, form, subid, key, value)
										key = (order, mode, position, collapsed)
									*/
									$upbar_collapsed = false;
									// default values
									foreach (\FOP\Database::query('SELECT subid, '.qi('key').', (SELECT '.qi('value').' FROM fop_form_feature b WHERE a.subid = b.subid AND a.'.qi('key').' = b.'.qi('key').' AND '.qi('user').' = '.intval(\FOP\User::getID()).' GROUP BY '.qi('value').' ORDER BY COUNT(*) DESC LIMIT 1) AS '.qi('value').' FROM fop_form_feature a WHERE '.qi('user').' = '.intval(\FOP\User::getID()).' GROUP BY subid, '.qi('key'))->fetchAll(\PDO::FETCH_ASSOC) AS $setting) {
										if (isset($features[$setting['subid']])) {
											$features[$setting['subid']][$setting['key']] = $setting['value'];
										}
									}
									// form specific special values
									foreach (\FOP\Database::query('SELECT subid, '.qi('key').', '.qi('value').' FROM fop_form_feature a WHERE form = \'wf:fop_fints_buchung:edit\' AND '.qi('user').' = '.intval(\FOP\User::getID()).'')->fetchAll(\PDO::FETCH_ASSOC) AS $setting) {
										if (isset($features[$setting['subid']])) {
											$features[$setting['subid']][$setting['key']] = $setting['value'];
										} else if ($setting['subid'] == 'upbar' && $setting['key'] == 'collapsed') {
											$upbar_collapsed = (bool) $setting['value'];
										}
									}

									/* fill in the content of the features */
									if (true && (true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['buttons']);
										?><div id='wf_fop_fints_buchung_edit_buttons' class='mdl-cell mdl-cell--12-col' style='flex-wrap: wrap;'><?php if (true) { ?><button onclick="
		var errors = $(this).closest('form').find('.fop-form-error:visible, .is-invalid').filter((i, x) => $(x).parents('.novalidate').length ? false : true);
		if (errors.length) {
			event.preventDefault();
			alert(errors.closest('.fop-form-content').prev('.fop-form-label').text() + ' Es sind noch Fehler im Formular bei Feld');
			return;
		} /* TODO: i18n */
		
	" type="submit" name="save" class="mdl-button mdl-js-button mdl-button--colored mdl-button--raised" ><i class="material-icons">save</i><?php echo(_('save')); ?></button><?php } ?>
									&nbsp;<?php if (true) { ?><button onclick="$(this).closest('form').find('.mdl-textfield__error:visible').hide();
		$('[required]').removeAttr('required');
	" type="submit" name="cancel" class="mdl-button mdl-js-button mdl-button--colored mdl-button--raised" ><i class="material-icons">cancel</i><?php echo(_('cancel')); ?></button><?php } ?>
									</div><script type='text/javascript'>
		// copy all buttons to #fop-upbar
		$(function () {
    var btn = document.getElementById("fop-bar-mainbutton");
    var upbar = $('#fop-upbar');
    var upbar_buttons = document.getElementById("fop-bar-container");

    // Check if the elements already exist
    if (!btn || !upbar_buttons) {
        if (!btn) {
            btn = $('<div id="fop-bar-mainbutton" class="mdl-button fop-button-half fop-button-margin mdl-button--raised"><i class="material-icons">keyboard_arrow_right</i></div>')
                .click(function () {
                    if (btn.find('i').text() == 'keyboard_arrow_right') {
                        upbar_buttons.fadeOut(400);
                        btn.find('i').text('keyboard_arrow_left');
                    } else {
                        upbar_buttons.fadeIn(400);
                        btn.find('i').text('keyboard_arrow_right');
                    }
                });
            upbar.append(btn);
        }

        if (!upbar_buttons) {
            upbar_buttons = $('<div id="fop-bar-container" style="max-width: 290px"></div>'); //dependant on the mdl-buttons width, caps of upbar buttons at exactly 4 buttons
            upbar.append(upbar_buttons);
        }

        var buttons = $('#wf_fop_fints_buchung_edit_buttons').find('.mdl-button');
        buttons.each(function (i, v) {
            var button = $(v);
            var newbutton = $('<div></div>');
            newbutton.attr('class', button.attr('class'));
            newbutton.attr('title', button.attr('title'));
            newbutton.append(button.find('.material-icons').clone(false));
            newbutton.click(function () {
                button[0].click();
            });
            upbar_buttons.append(newbutton);
        });
    }
});

	</script><?php
										\EasyEditor\FormFeature::pop();
										$features['buttons']['html'] = ob_get_contents();
										ob_end_clean();
									}
									
									if (true && (false || true || ((false)) && ($data['bdate::canEdit'] == 1) || ((false)) && ($data['date::canEdit'] == 1) || ((false)) && ($data['betrag::canEdit'] == 1) || ((false)) && ($data['saldo::canEdit'] == 1) || ((false)) && ($data['iban::canEdit'] == 1) && (!isset($_POST['cancel'])) || ((false)) && ($data['name_firma::canEdit'] == 1) || ((false)) && ($data['vzweck::canEdit'] == 1) || ((false)) && ($data['endtoend::canEdit'] == 1) || ((false)) && ($data['umsatzart::canEdit'] == 1) || ((false)) && ($data['hash::canEdit'] == 1) || ((false)) && ($data['konto::canEdit'] == 1) && (!isset($_POST['cancel'])))) {
										ob_start();
										\EasyEditor\FormFeature::push($features['main']);
										?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_forderungDone" id="column_forderungDone">
		<!-- Feld "Forderung behandelt": forderungDone -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="forderungDone"><?php echo(_('Forderung behandelt')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<input type="hidden" name="forderungDone" id="forderungDone" value="<?php echo ($data['forderungDone']) ? '1' : '0'; ?>"/><label class="mdl-checkbox mdl-js-checkbox" style="width: unset;"><input onkeydown="
      if (event.keyCode == 13) {
         event.preventDefault();
         event.stopPropagation();
         tabNext(this);
         return false;
      }
   "  class="mdl-checkbox__input" id="forderungDone__checkbox" type="checkbox" onchange="this.parentElement.previousElementSibling.value = this.checked ? 1 : 0;"<?php if ($data['forderungDone']) echo ' checked'; ?>><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></label>
	</div>
	</div><?php if (((false)) && ($data['konto::canEdit'] == 1) && (!isset($_POST['cancel']))) { ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_konto" id="column_konto">
		<!-- Feld "Konto": konto -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="konto"><?php echo(_('Konto')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div style='display: flex; flex-direction: row; align-items: center; width: 100%;'><?php
	\Tables\Fop_fints_konto::renderEditform_wf_fop_fints_buchung_edit_kontoAction($data['konto'], [], '');
?> &nbsp;	<?php if (\TablesRouter\Fop_fints_konto::createAccess()) { ?>  <a tabindex='-1' class='unimportant button' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\Fop_fints_konto::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26ng=<?php echo urlencode('form[\'konto\']'); ?>%26type=fop_fints_konto%26colinsert=konto%26el=" + encodeURIComponent(id) + "%26close%26insert_param=colvalue", "_blank", "width=739, height=395"); return false;'><i class="material-icons">add</i></a> <?php } ?> &nbsp;	<a tabindex='-1' class='unimportant button fop-ddt-search' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\Fop_fints_konto::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26ng=<?php echo urlencode('form[\'konto\']'); ?>%26type=fop_fints_konto%26colinsert=konto%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=fop_fints_konto", "_blank", "width=739, height=395"); return false;'><i class="material-icons">search</i></a>
	</div>
	</div>
	</div><?php } ?><?php if (((false)) && ($data['bdate::canEdit'] == 1)) { ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_bdate" id="column_bdate">
		<!-- Feld "Buchungsdatum": bdate -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="bdate"><?php echo(_('Buchungsdatum')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield"><input onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			tabNext(this);
			return false;
		}
	" ts-locale='<?php echo (\FOP\I18n::getShortLocale()); ?>' ts-format='<?php echo (_('dateformat_moment')); ?>' class="mdl-textfield__input picker_date" id="bdate" type="text" name="bdate" value="<?php echo ($data['bdate']) ? strftime(_('dateformat_php2'), intval($data['bdate'])) : ''; ?>"/><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	</div>
	</div><?php } ?><?php if (((false)) && ($data['date::canEdit'] == 1)) { ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_date" id="column_date">
		<!-- Feld "Wertstellungsdatum": date -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="date"><?php echo(_('Wertstellungsdatum')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield"><input onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			tabNext(this);
			return false;
		}
	" ts-locale='<?php echo (\FOP\I18n::getShortLocale()); ?>' ts-format='<?php echo (_('dateformat_moment')); ?>' class="mdl-textfield__input picker_date" id="date" type="text" name="date" value="<?php echo ($data['date']) ? strftime(_('dateformat_php2'), intval($data['date'])) : ''; ?>"/><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	</div>
	</div><?php } ?><?php if (((false)) && ($data['betrag::canEdit'] == 1)) { ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_betrag" id="column_betrag">
		<!-- Feld "Betrag": betrag -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="betrag"><?php echo(_('Betrag')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield fop-numeric">
		<input onfocus='this.select()' style='text-align: right;' type='text' pattern='<?php echo htmlentities(\Types\Euro::pattern()); ?>' class="mdl-textfield__input" name="betrag"  value="<?php echo \Types\Euro::print($data['betrag']); ?>" fop-numeric='2' fop-numeric-decimal='<?php echo htmlentities(\Types\Euro::decimalSeparator()); ?>' fop-numeric-thousands='<?php echo htmlentities(\Types\Euro::thousandsSeparator()); ?>' /><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div><span class="betrag_unit" style="visibility: visible; margin-left: 0.2em;">€</span>
	<script type='text/javascript'>$(function () {bindNumericFields(); });</script>
	</div>
	</div><?php } ?><?php if (((false)) && ($data['saldo::canEdit'] == 1)) { ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_saldo" id="column_saldo">
		<!-- Feld "Saldo": saldo -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="saldo"><?php echo(_('Saldo')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield fop-numeric">
		<input onfocus='this.select()' style='text-align: right;' type='text' pattern='<?php echo htmlentities(\Types\Euro::pattern()); ?>' class="mdl-textfield__input" name="saldo"  value="<?php echo \Types\Euro::print($data['saldo']); ?>" fop-numeric='2' fop-numeric-decimal='<?php echo htmlentities(\Types\Euro::decimalSeparator()); ?>' fop-numeric-thousands='<?php echo htmlentities(\Types\Euro::thousandsSeparator()); ?>' /><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div><span class="saldo_unit" style="visibility: visible; margin-left: 0.2em;">€</span>
	<script type='text/javascript'>$(function () {bindNumericFields(); });</script>
	</div>
	</div><?php } ?><?php if (((false)) && ($data['iban::canEdit'] == 1) && (!isset($_POST['cancel']))) { ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_iban" id="column_iban">
		<!-- Feld "IBAN": iban -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="iban"><?php echo(_('IBAN')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield"><input onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			tabNext(this);
			return false;
		}
	" style="text-transform: uppercase;" class="mdl-textfield__input"  type="text" name="iban" pattern="[A-Z]{2}[0-9 \-]{12,26}" value="<?php echo htmlentities($data['iban']); ?>"/><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	</div>
	</div><?php } ?><?php if (((false)) && ($data['name_firma::canEdit'] == 1)) { ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_name_firma" id="column_name_firma">
		<!-- Feld "Name, Vorname/Firma": name_firma -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="name_firma"><?php echo(_('Name, Vorname/Firma')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield"><input onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			tabNext(this);
			return false;
		}
	"  class="mdl-textfield__input"  type="text" name="name_firma"  value="<?php echo htmlentities($data['name_firma']); ?>"/><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	</div>
	</div><?php } ?><?php if (((false)) && ($data['vzweck::canEdit'] == 1)) { ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_vzweck" id="column_vzweck">
		<!-- Feld "Verwendungszweck": vzweck -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="vzweck"><?php echo(_('Verwendungszweck')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield"><input onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			tabNext(this);
			return false;
		}
	"  class="mdl-textfield__input"  type="text" name="vzweck"  value="<?php echo htmlentities($data['vzweck']); ?>"/><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	</div>
	</div><?php } ?><?php if (((false)) && ($data['endtoend::canEdit'] == 1)) { ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_endtoend" id="column_endtoend">
		<!-- Feld "End to End-Referenz": endtoend -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="endtoend"><?php echo(_('End to End-Referenz')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield"><input onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			tabNext(this);
			return false;
		}
	"  class="mdl-textfield__input"  type="text" name="endtoend"  value="<?php echo htmlentities($data['endtoend']); ?>"/><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	</div>
	</div><?php } ?><?php if (((false)) && ($data['umsatzart::canEdit'] == 1)) { ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_umsatzart" id="column_umsatzart">
		<!-- Feld "Umsatzart": umsatzart -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="umsatzart"><?php echo(_('Umsatzart')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield"><input onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			tabNext(this);
			return false;
		}
	"  class="mdl-textfield__input"  type="text" name="umsatzart"  value="<?php echo htmlentities($data['umsatzart']); ?>"/><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	</div>
	</div><?php } ?><?php if (((false)) && ($data['hash::canEdit'] == 1)) { ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_hash" id="column_hash">
		<!-- Feld "Hashcode": hash -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="hash"><?php echo(_('Hashcode')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield"><input onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			tabNext(this);
			return false;
		}
	"  ng-model='form[&apos;hash&apos;]' ng-trim='false' ng-revalidate class="mdl-textfield__input"  type="text" name="hash"  value="<?php echo htmlentities($data['hash']); ?>"/><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	</div>
	</div><?php } ?><?php
										\EasyEditor\FormFeature::pop();
										$features['main']['html'] = ob_get_contents();
										ob_end_clean();
									}
									

									uasort($features, function ($a, $b) {
										return strnatcmp($a['order'], $b['order']);
									});
									foreach ($features AS $feature) {
										\EasyEditor\FormFeature::render($feature);
									}
									?><script type='text/javascript'>
										$(function(){
											// bei Änderungen: prüfen, ob Form geändert wurde
											var formData = $('#cardform-wf_fop_fints_buchung_edit').serialize();
											document.body.onbeforeunload = function () {
												if (formData != $('#cardform-wf_fop_fints_buchung_edit').serialize()) {
													return 'Form data has changed - are you sure??';
												}
											};
											$('#cardform-wf_fop_fints_buchung_edit').on('submit', function () {
												document.body.onbeforeunload = undefined;
											});
											<?php if ($upbar_collapsed) {
												?>$('#fop-bar-mainbutton').click();<?php
											} ?>
											$('#fop-bar-mainbutton').click(function () {
												setTimeout(function () {
													setCFF('upbar', 'collapsed', $('#fop-bar-container').is(':visible') ? 0 : 1);
												}, 440); /* perfect timing for fadeOut */
											});
										});
										
										function setCFF(id, key, value) {
											<?php if(!\FOP\User::getIsGuest()) { ?>
											$.get('FOP/Index/setCFF?form=wf%3Afop_fints_buchung%3Aedit&subid=' + encodeURIComponent(id) + '&key=' + encodeURIComponent(key) + '&value=' + encodeURIComponent(value)).then(function () {
												if (key == 'reset') {
													location.reload();
												}
											});
											<?php } /* EditAccess */ ?>
										}
										function setCFFOrder(fids) {
											<?php if(!\FOP\User::getIsGuest()) { ?>
											$.get('FOP/Index/setCFFOrder?form=wf%3Afop_fints_buchung%3Aedit&fids=' + encodeURIComponent(JSON.stringify(fids)));
											<?php } /* EditAccess */ ?>
										}
										$(function () {
											refreshTabHeaders($('#cardform-wf_fop_fints_buchung_edit')); /* provided in js/form.js */
											// preselection
											if (location.hash.startsWith('#select:')) {
												$('[name="' + window.location.hash.slice(8) + '"]').focus().select();
											} else {
												$('#cardform-wf_fop_fints_buchung_edit input[type!="hidden"],textarea,select[tabindex!="-1"]').not('.fop-disabled *').filter(':visible:first').focus().select();
											}
										});

										$(window).keydown(function(event) {
											 if (event.ctrlKey && String.fromCharCode(event.which).toLowerCase() == 's') {
												 event.preventDefault();
												 $('button[type=submit]').click();
												 return false;
											 }
										});

										
										$(document).on('keyup',function(evt) {
										   if (evt.keyCode == 27) {
												if (window.parent) {
													window.close(); // iframe:close
												} else {
													window.history.back();
												}
											}
												});
										
									</script>

							</form>
							

							</div>
							<div class="content" id="focus-supersearch">
							</div>
							<div class="content" id="~spacer"><?php if (!isset($_GET['popup'])) { ?><div style="padding-bottom: 10cm;"></div><?php } ?>
							</div>
						<?php if (!isset($_GET['popup'])) { ?>
					</div>
				</main>
				
			</div>
		<?php } else { ?></div><?php } ?>
<?php if (!isset($_GET['popup'])) { ?><div class='fop-seal'></div><?php } ?></body></html><?php
    // --- BLOCK: main-6 ---
    }
    
  }

  public static function ignoreForderungAction($ids) { 
    
    
    // --- BLOCK: access ---
    if(!(((\FOP\User::getBuchhaltung()) && (\FOP\User::getBuchhaltung())))) throw new \FOP\AccessDeniedException();
    // --- BLOCK: access-itemlist-fop_fints_buchung-view ---
    
		// ID-Liste neu aufbauen und nur die übrig lassen, die auch erlaubt sind
		$ids_ = new \FOP\IDList($ids);
		$ids = new \FOP\IDList();
		foreach (\FOP\Database::query('SELECT '.qi('ID').' FROM '.qi('fop_fints_buchung').' WHERE (('.\FOP\Database::quote(\FOP\User::getBuchhaltung()).') AND (COALESCE((SELECT ('.\FOP\Database::quote(\FOP\User::getBuchhaltung()).') FROM '.qi('fop_fints_konto').' '.qi('ztZvmiXX').' WHERE '.qi('ztZvmiXX').'.'.qi('ID').' = '.qi('fop_fints_buchung').'.'.qi('konto').' LIMIT 1), FALSE)) AND ('.\FOP\Database::quote(\FOP\User::getBuchhaltung()).')) AND ' . $ids_->toSQL(qi('ID')))->fetchAll(\PDO::FETCH_COLUMN) AS $ids_sub) {
			$ids->push($ids_sub);
		}
	
    // --- BLOCK: main ---
    
	\FOP\Database::query('UPDATE fop_fints_buchung SET forderungDone = 1 WHERE ' . (new \FOP\IDList($ids))->toSQL('ID'));
	header('Location: ' . $_GET['from'] ?? \DataViewRouter\ReminderFop_fints_buchungForderungen::viewURL());

    
  }

  public static function delete($id, $disregardPermissions = false ) { 
    
    
    // --- BLOCK: main ---
    
			$sql = 'SELECT ' . ($disregardPermissions ? 1 : '(FALSE) AND ('.\FOP\Database::quote(\FOP\User::getBuchhaltung()).') AND (COALESCE((SELECT ('.\FOP\Database::quote(\FOP\User::getBuchhaltung()).') FROM '.qi('fop_fints_konto').' '.qi('vBKfwiB4').' WHERE '.qi('vBKfwiB4').'.'.qi('ID').' = '.qi('fop_fints_buchung').'.'.qi('konto').' LIMIT 1), FALSE)) AND ('.\FOP\Database::quote(\FOP\User::getBuchhaltung()).')') . ' FROM '.qi('fop_fints_buchung').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($id);
			if (\FOP\Database::query($sql)->fetchColumn() != 1) {
				return false;
			}
			
			$sql = 'DELETE FROM  '.qi('fop_fints_buchung').'  WHERE '.qi('ID').' = ' . \FOP\Database::quote($id);
			$result = \FOP\Database::query($sql);
			
			return true;
	
    
  }

  public static function create($data, $disregardPermissions = false , $updateOnDuplicate = false ) { 
    
    
    // --- BLOCK: main ---
    
				$sql = 'INSERT INTO '.qi('fop_fints_buchung').'(';
				
				$set = [];
				
					
					$set[qi('forderungDone')] = \FOP\Database::quote($data['forderungDone']);
					
				
					if ($disregardPermissions || ((!\FOP\User::getIsGuest()))) {
					
					$set[qi('konto')] = \FOP\Database::quote($data['konto']);
					} else {
						$set[qi('konto')] = \FOP\Database::quote(\FOP\Sanitizers::null_filter(null));
					}
				
					
					$set[qi('bdate')] = \FOP\Database::quote($data['bdate']);
					
				
					
					$set[qi('date')] = \FOP\Database::quote($data['date']);
					
				
					
					$set[qi('betrag')] = \FOP\Database::quote($data['betrag']);
					
				
					
					$set[qi('saldo')] = \FOP\Database::quote($data['saldo']);
					
				
					
					$set[qi('iban')] = \FOP\Database::quote($data['iban']);
					
				
					
					$set[qi('name_firma')] = \FOP\Database::quote($data['name_firma']);
					
				
					
					$set[qi('vzweck')] = \FOP\Database::quote($data['vzweck']);
					
				
					
					$set[qi('endtoend')] = \FOP\Database::quote($data['endtoend']);
					
				
					
					$set[qi('umsatzart')] = \FOP\Database::quote($data['umsatzart']);
					
				
					if ($disregardPermissions || (((false)))) {
					
					$set[qi('hash')] = \FOP\Database::quote($data['hash']);
					} else {
						$set[qi('hash')] = \FOP\Database::quote((''));
					}
				
				$id = 0;

				$sql = $sql . implode(', ', array_keys($set)) . ') VALUES (' . implode(', ', array_values($set)) . ')';
				if ($updateOnDuplicate){
					// TODO: Postgres ON CONFLICT(...) DO UPDATE SET ...
					$set2 = [];
					foreach ($set AS $k => $v) {
						array_push($set2, "$k = $v");
					}
					if (\FOP\Database::getDriver() == 'mysql') {
						$sql .= ' ON DUPLICATE KEY UPDATE ' . implode(', ', $set2);
					} else {
						$sql .= ' ON CONFLICT ('.qi('hash').', '.qi('konto').') UPDATE SET ' . implode(', ', $set2);
					}
				}

				try {
					\FOP\Database::query($sql);
					$id = \FOP\Database::getLastInsertId();
				} catch (\PDOException $e) {
					if ($e->errorInfo[1] == 1062) {
						throw new \FOP\AccessDeniedException('duplicateinsert');
					}
                    throw $e; // weiterwerfen
				}
				$data['fop-id'] = $id; // für Hooks
				
				return $id;

    
  }

  public static function view($id, $snippet = false , $ignoreAccess = false ) { 
    
    
    // --- BLOCK: main ---
    
		$sql = 'SELECT /* ID */ '.qi('ID').' AS '.qi('ID').',
									/* ID */ '.qi('fop_fints_buchung').'.'.qi('ID').' AS '.qi('ID').',
									/* bdate */ '.qi('fop_fints_buchung').'.'.qi('bdate').' AS '.qi('bdate').',
									/* bdate::canEdit */ (FALSE) AS '.qi('bdate::canEdit').',
									/* betrag */ '.qi('fop_fints_buchung').'.'.qi('betrag').' AS '.qi('betrag').',
									/* betrag::canEdit */ (FALSE) AS '.qi('betrag::canEdit').',
									/* date */ '.qi('fop_fints_buchung').'.'.qi('date').' AS '.qi('date').',
									/* date::canEdit */ (FALSE) AS '.qi('date::canEdit').',
									/* endtoend */ '.qi('fop_fints_buchung').'.'.qi('endtoend').' AS '.qi('endtoend').',
									/* endtoend::canEdit */ (FALSE) AS '.qi('endtoend::canEdit').',
									/* forderungDone */ '.qi('fop_fints_buchung').'.'.qi('forderungDone').' AS '.qi('forderungDone').',
									/* hash */ '.qi('fop_fints_buchung').'.'.qi('hash').' AS '.qi('hash').',
									/* hash::canEdit */ (FALSE) AS '.qi('hash::canEdit').',
									/* iban */ '.qi('fop_fints_buchung').'.'.qi('iban').' AS '.qi('iban').',
									/* iban::canEdit */ (FALSE) AS '.qi('iban::canEdit').',
									/* konto */ '.qi('fop_fints_buchung').'.'.qi('konto').' AS '.qi('konto').',
									/* konto::canEdit */ (FALSE) AS '.qi('konto::canEdit').',
									/* konto::canView */ '.qi('ref:konto').'.'.qi('konto:canView').' AS '.qi('konto::canView').',
									/* konto::description */ '.qi('ref:konto').'.'.qi('konto:description').' AS '.qi('konto::description').',
									/* name_firma */ '.qi('fop_fints_buchung').'.'.qi('name_firma').' AS '.qi('name_firma').',
									/* name_firma::canEdit */ (FALSE) AS '.qi('name_firma::canEdit').',
									/* operation::create */ (FALSE) AND ('.\FOP\Database::quote(\FOP\User::getBuchhaltung()).') AND (COALESCE((SELECT ('.\FOP\Database::quote(\FOP\User::getBuchhaltung()).') FROM '.qi('fop_fints_konto').' '.qi('2ZJnnPGF').' WHERE '.qi('2ZJnnPGF').'.'.qi('ID').' = '.qi('fop_fints_buchung').'.'.qi('konto').' LIMIT 1), FALSE)) AND ('.\FOP\Database::quote(\FOP\User::getBuchhaltung()).') AS '.qi('operation::create').',
									/* operation::delete */ (FALSE) AND ('.\FOP\Database::quote(\FOP\User::getBuchhaltung()).') AND (COALESCE((SELECT ('.\FOP\Database::quote(\FOP\User::getBuchhaltung()).') FROM '.qi('fop_fints_konto').' '.qi('vBKfwiB4').' WHERE '.qi('vBKfwiB4').'.'.qi('ID').' = '.qi('fop_fints_buchung').'.'.qi('konto').' LIMIT 1), FALSE)) AND ('.\FOP\Database::quote(\FOP\User::getBuchhaltung()).') AS '.qi('operation::delete').',
									/* operation::edit */ ('.\FOP\Database::quote(\FOP\User::getBuchhaltung()).') AND (COALESCE((SELECT ('.\FOP\Database::quote(\FOP\User::getBuchhaltung()).') FROM '.qi('fop_fints_konto').' '.qi('56VmsVdP').' WHERE '.qi('56VmsVdP').'.'.qi('ID').' = '.qi('fop_fints_buchung').'.'.qi('konto').' LIMIT 1), FALSE)) AND ('.\FOP\Database::quote(\FOP\User::getBuchhaltung()).') AS '.qi('operation::edit').',
									/* operation::index */ ' . (!\FOP\User::getIsGuest() ? 1 : 0) . ' AS '.qi('operation::index').',
									/* operation::view */ ('.\FOP\Database::quote(\FOP\User::getBuchhaltung()).') AND (COALESCE((SELECT ('.\FOP\Database::quote(\FOP\User::getBuchhaltung()).') FROM '.qi('fop_fints_konto').' '.qi('ztZvmiXX').' WHERE '.qi('ztZvmiXX').'.'.qi('ID').' = '.qi('fop_fints_buchung').'.'.qi('konto').' LIMIT 1), FALSE)) AND ('.\FOP\Database::quote(\FOP\User::getBuchhaltung()).') AS '.qi('operation::view').',
									/* saldo */ '.qi('fop_fints_buchung').'.'.qi('saldo').' AS '.qi('saldo').',
									/* saldo::canEdit */ (FALSE) AS '.qi('saldo::canEdit').',
									/* umsatzart */ '.qi('fop_fints_buchung').'.'.qi('umsatzart').' AS '.qi('umsatzart').',
									/* umsatzart::canEdit */ (FALSE) AS '.qi('umsatzart::canEdit').',
									/* vzweck */ '.qi('fop_fints_buchung').'.'.qi('vzweck').' AS '.qi('vzweck').',
									/* vzweck::canEdit */ (FALSE) AS '.qi('vzweck::canEdit').',
									1
								FROM '.qi('fop_fints_buchung').' '.qi('fop_fints_buchung').'
								LEFT JOIN (SELECT '.qi('ID').' AS '.qi('konto:ID').', '.qi('fop_fints_konto').'.'.qi('kontoname').' AS '.qi('konto:description').', (('.\FOP\Database::quote(\FOP\User::getBuchhaltung()).')) AS '.qi('konto:canView').' FROM '.qi('fop_fints_konto').') '.qi('ref:konto').' ON '.qi('ref:konto').'.'.qi('konto:ID').' = '.qi('fop_fints_buchung').'.'.qi('konto').'
								WHERE ('.qi('ID').' = ' . \FOP\Database::quote($id) . ')';
		$result = \FOP\Database::query($sql);
		if (!$row = $result->fetch(\PDO::FETCH_ASSOC)) {
			throw new \FOP\AccessDeniedException('notfoundread');
		} else if (!$ignoreAccess && !$row['operation::view']) {
			throw new \FOP\AccessDeniedException('accessdeniedread');
		}
		
		$row['forderungDone'] = \FOP\Util::BoolSanitizer($row['forderungDone']);
		$row['konto'] = \FOP\Sanitizers::null_converter($row['konto']);
		$row['bdate'] = intval($row['bdate']);
		$row['date'] = intval($row['date']);
		$row['betrag'] = \Types\Euro::unpack($row['betrag']);
		$row['saldo'] = \Types\Euro::unpack($row['saldo']);
		$row['iban'] = \FOP\Sanitizers::a_text($row['iban']);
		

		if($snippet){
			$row['forderungDone'] = ($row['forderungDone']);
			$row['konto'] = (
  \FOP\Database::query('SELECT '.qi('fop_fints_konto').'.'.qi('kontoname').' AS description FROM '.qi('fop_fints_konto').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($row['konto']))->fetchColumn() ?: _('')
);
			$row['bdate'] = (($row['bdate']) ? strftime(_('dateformat_php2'), intval($row['bdate'])) : '');
			$row['date'] = (($row['date']) ? strftime(_('dateformat_php2'), intval($row['date'])) : '');
			$row['betrag'] = (\Types\Euro::print($row['betrag']) .  ' €'
	);
			$row['saldo'] = (\Types\Euro::print($row['saldo']) .  ' €'
	);
			$row['iban'] = ($row['iban']);
			$row['name_firma'] = ($row['name_firma']);
			$row['vzweck'] = ($row['vzweck']);
			$row['endtoend'] = ($row['endtoend']);
			$row['umsatzart'] = ($row['umsatzart']);
			$row['hash'] = ($row['hash']);
			
		}


		return $row;

    
  }

  public static function hashkontoUniqueAction($context, $value, $id) { 
    
    // Methodenimplementierung überschrieben.
    throw new \FOP\AccessDeniedException();return false;
  }

  public static function sanitizeDefaults(&$data, $sanitizeForForms, $refcol = null , $parentdata = null ) { 
    
    
    // --- BLOCK: main ---
    
		$virginData = self::getDefaults();
		// column: bdate
		
		// column: betrag
		
		// column: date
		
		// column: endtoend
		
		// column: forderungDone
		
		// column: hash
		
		// column: iban
		
		// column: konto
			if (!$data['konto']) {
				// replace forbidden NULL values
				$items = \Types\Fop_fints_konto::getItems([], null);
				$best = -INF;
				foreach ($items as $item) /* TODO: InputFieldLoadCondition: if (!$condition || $item[$condition]) */ {
					if ($item['priority'] > $best) {
						$data['konto'] = $item['ID'];
						$best = $item['priority'];
					}
				}
			}
		
		// column: name_firma
		
		// column: saldo
		
		// column: umsatzart
		
		// column: vzweck
		
		if ($sanitizeForForms) {
			
			$data['forderungDone'] = \FOP\Util::BoolSanitizer($data['forderungDone']);
			$data['konto'] = \FOP\Sanitizers::null_converter($data['konto']);
			$data['bdate'] = intval($data['bdate']);
			$data['date'] = intval($data['date']);
			$data['betrag'] = \Types\Euro::unpack($data['betrag']);
			$data['saldo'] = \Types\Euro::unpack($data['saldo']);
			$data['iban'] = \FOP\Sanitizers::a_text($data['iban']);
		}
	
    
  }

  public static function edit($id, $data, $ignoreUniqueConstraints = false , $disregardPermissions = false ) { 
    
    
    // --- BLOCK: main ---
    
				
				$set = [];
				
					
					if (array_key_exists('forderungDone', $data)) {
						array_push($set, qi('forderungDone').' = ' . \FOP\Database::quote($data['forderungDone']));
					}
				
					if ($disregardPermissions || ((false)))
					
					if (array_key_exists('konto', $data)) {
						array_push($set, qi('konto').' = ' . \FOP\Database::quote($data['konto']));
					}
				
					if ($disregardPermissions || ((false)))
					
					if (array_key_exists('bdate', $data)) {
						array_push($set, qi('bdate').' = ' . \FOP\Database::quote($data['bdate']));
					}
				
					if ($disregardPermissions || ((false)))
					
					if (array_key_exists('date', $data)) {
						array_push($set, qi('date').' = ' . \FOP\Database::quote($data['date']));
					}
				
					if ($disregardPermissions || ((false)))
					
					if (array_key_exists('betrag', $data)) {
						array_push($set, qi('betrag').' = ' . \FOP\Database::quote($data['betrag']));
					}
				
					if ($disregardPermissions || ((false)))
					
					if (array_key_exists('saldo', $data)) {
						array_push($set, qi('saldo').' = ' . \FOP\Database::quote($data['saldo']));
					}
				
					if ($disregardPermissions || ((false)))
					
					if (array_key_exists('iban', $data)) {
						array_push($set, qi('iban').' = ' . \FOP\Database::quote($data['iban']));
					}
				
					if ($disregardPermissions || ((false)))
					
					if (array_key_exists('name_firma', $data)) {
						array_push($set, qi('name_firma').' = ' . \FOP\Database::quote($data['name_firma']));
					}
				
					if ($disregardPermissions || ((false)))
					
					if (array_key_exists('vzweck', $data)) {
						array_push($set, qi('vzweck').' = ' . \FOP\Database::quote($data['vzweck']));
					}
				
					if ($disregardPermissions || ((false)))
					
					if (array_key_exists('endtoend', $data)) {
						array_push($set, qi('endtoend').' = ' . \FOP\Database::quote($data['endtoend']));
					}
				
					if ($disregardPermissions || ((false)))
					
					if (array_key_exists('umsatzart', $data)) {
						array_push($set, qi('umsatzart').' = ' . \FOP\Database::quote($data['umsatzart']));
					}
				
					if ($disregardPermissions || ((false)))
					
					if (array_key_exists('hash', $data)) {
						array_push($set, qi('hash').' = ' . \FOP\Database::quote($data['hash']));
					}
				;
				
				if (count($set)) {
					try {
						\FOP\Database::query('UPDATE '.qi('fop_fints_buchung').' SET ' . implode(', ', $set) . ' WHERE '.qi('ID').' = ' . \FOP\Database::quote($id));
						if (isset($data['ID'])) {
							$id = $data['ID'];
						}
					} catch (\PDOException $e) {
						if ($e->errorInfo[1] == 1062) {
							if ($ignoreUniqueConstraints) {
								return false;
							}
							throw new \FOP\AccessDeniedException('duplicateupdate');
						}
						throw $e; // weiterwerfen
					}
				}
				$data['fop-id'] = $id; // für Hooks
				
				return true;

    
  }

  public static function deleteAction($id) { 
    
    // Methodenimplementierung überschrieben.
    throw new \FOP\AccessDeniedException();return false;
  }

  public static function indexAction() { 
    
    
    // --- BLOCK: access ---
    if(!(((\FOP\User::getBuchhaltung()) && (\FOP\User::getBuchhaltung())) && (!\FOP\User::getIsGuest()))) throw new \FOP\AccessDeniedException();
    // --- BLOCK: main ---
    ?><?php
			header('Content-Type: text/html; charset=UTF-8');
			header('X-XSS-Protection: 1; mode=block');
			header('Strict-Transport-Security: max-age=63072000');
			header('X-Content-Type-Options: nosniff');
			header("Content-Security-Policy: default-src *  data: blob: 'unsafe-inline' 'unsafe-eval'; script-src * 'unsafe-inline' 'unsafe-eval'; connect-src * 'unsafe-inline'; img-src * data: blob: 'unsafe-inline'; frame-src *; style-src * data: blob: 'unsafe-inline'; font-src * data: blob: 'unsafe-inline';");


		?><!DOCTYPE html><html><head><title><?php echo(_('Buchungen')); ?></title><base href='<?php echo \FOP\Util::getCurrentBaseurl(); ?>'><meta name="google" content="notranslate"><meta http-equiv="Content-Language" content="<?php echo htmlentities(\FOP\I18n::getLocale()); ?>"><meta charset="utf-8"><link rel="stylesheet" type="text/css" href="style_dependencies.css?v=<?php echo(\FOP\Util::getVersionAppendix()); ?>"><link rel="stylesheet" type="text/css" href="style.css?v=<?php echo(\FOP\Util::getVersionAppendix()); ?>"><script type="text/javascript" src="js/script_dependencies.js?v=<?php echo(\FOP\Util::getVersionAppendix()); ?>"></script><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="mobile-web-app-capable" content="yes"><link rel="manifest" href="manifest.webmanifest"><script type="text/javascript">moment.locale('<?php echo(\FOP\I18n::getShortLocale()); ?>');</script><script type="text/javascript" src="js/form.js"></script><script type="text/javascript">window.globals = <?php
	echo json_encode(['user:superadmin' => /* TODO: resanitizer später mal */(integer) \FOP\User::getSuperadmin(), 'user:mitglied' => /* TODO: resanitizer später mal */(integer) \FOP\User::getMitglied(), 'user:gruppe' => /* TODO: resanitizer später mal */(integer) \FOP\User::getGruppe(), 'user:campaign' => /* TODO: resanitizer später mal */(integer) \FOP\User::getCampaign(), 'user:sammlung' => /* TODO: resanitizer später mal */(integer) \FOP\User::getSammlung(), 'user:protokoll' => /* TODO: resanitizer später mal */(integer) \FOP\User::getProtokoll(), 'user:ID' => /* TODO: resanitizer später mal */(integer) \FOP\User::getID(), 'user:buchhaltung' => /* TODO: resanitizer später mal */(integer) \FOP\User::getBuchhaltung()]);
?>;</script><script type="text/javascript" src="angular/<?php echo(\FOP\I18n::getShortLocale()); ?>/js/alltypes.js?v=<?php echo(\FOP\Util::getVersionAppendix()); ?>"></script><script type="text/javascript" src="angular/angular-i18n/angular-locale_<?php echo \FOP\I18n::getAngularLocale(); ?>.js"></script><script type="text/javascript" src="js/date-filter.js"></script><script type="text/javascript" src="js/dropdown.js"></script><script type="text/javascript" src="js/numeric.js"></script><script type="text/javascript" src="js/getparam.js"></script><script type="text/javascript" src="js/tables.js"></script>
		<script type="text/javascript" src="js/parsehash.js"></script><script type="text/javascript">
		window.query = <?php echo json_encode($_GET, JSON_FORCE_OBJECT); ?>;
		window.baseurl = <?php echo json_encode(\FOP\Util::getCurrentBaseurl()); ?>;

		window.i18n_weiter = <?php echo json_encode(_('Weiter'));?>;
		//Filter I18n:
		window.i18n_quartal = <?php echo json_encode(_('Quarter'));?>;
		window.i18n_alle = <?php echo json_encode(_('All'));?>;
		window.i18n_leere = <?php echo json_encode(_('Empty'));?>;
		window.i18n_tag = <?php echo json_encode(_('Tag'));?>;
		window.i18n_woche = <?php echo json_encode(_('Woche'));?>;
		window.i18n_zeitraum = <?php echo json_encode(_('Period'));?>;
		window.i18n_monat = <?php echo json_encode(_('Monat'));?>;
		window.i18n_jahr = <?php echo json_encode(_('Jahr'));?>;
		window.i18n_von = <?php echo json_encode(_('filters_from'));?>;
		window.i18n_bis = <?php echo json_encode(_('filters_to'));?>;
		window.i18n_tabButton = <?php echo json_encode(_('open_in_new_tab'));?>;
		window.i18n_closeButton = <?php echo json_encode(_('close'));?>;
		</script></head><script type="text/javascript">const fopPushPublicKey = '<?php echo(addslashes(\FOP\Configuration::getFOPPushPublicKey())); ?>';
        const fopUserID = <?php echo(intval(\FOP\User::getID())); ?>;
        var fopPushDisabled = false;
    </script><script type="text/javascript" src="js/serviceworkersetup.js"></script><body ng-app='app'>
		<div class='mdl-js-snackbar mdl-snackbar' id='snackbar'>
			<div class='mdl-snackbar__text'></div>
			<button class='mdl-snackbar__action' type='button'></button>
		</div>
		<script>
			var snackbar = document.querySelector('#snackbar');
			componentHandler.upgradeElement(snackbar, 'MaterialSnackbar');
			$(function () {
				setTimeout(function () {
					$('.fop-layout').scrollTop(0);
				}, 0);
			});
		</script>

		<?php if (isset($_GET['popup'])) { ?>
		<header class="fop-header mdl-layout__header mdl-layout__header mdl-layout__header--scroll">
				<div class="mdl-layout__header-row">
					<span class="mdl-layout-title"><?php echo(_('Buchungen')); ?></span><div class="mdl-layout-spacer"></div><span class="noprint mdl-layout-title mdl-layout--large-screen-only"><div class="mdl-textfield mdl-js-textfield"><input id="supersearch" accesskey="f" class="mdl-textfield__input" type="text" onkeydown="if (event.keyCode == 13 && this.value) window.location.href = 'FOP/Index/searchURL?q=' + encodeURIComponent(this.value) + '&from=<?php echo htmlentities(urlencode(\FOP\Util::getBackUrl())); ?>';" value="<?php echo htmlentities($_GET['q'] ?? ''); ?>" style="border-bottom: 1px solid white;"/><label class="mdl-textfield__label" style="color: inherit"><?php echo(_('search')); ?> - <?php
		if (strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) {
			// MAC: Control+ davor
			echo 'Control + ';
		}
		if (strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox') !== false) {
			// Firefox
			if (strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) {
				// MAC: Control + Alt + key
				echo 'Alt + F';
			} else {
				echo 'Alt + Shift + F';
			}
		} else {
			// Internet Explorer, Chrome, Safari, Opera
			echo 'Alt + F';
		}
	?></label></div></span><i onclick='addFav(null)' class='material-icons fop-favorites' id='favorites_button'>star_border</i>
				</div>
      	</header>
			<style>
				.content {
					margin-top: 0px !important;
				}
			</style>
			<div id='content' class='popup' >
		<?php } else { ?>
			<div class="fop-layout mdl-layout mdl-js-layout mdl-layout--fixed-drawer mdl-layout--fixed-header">
			<header class="fop-header mdl-layout__header mdl-layout__header mdl-layout__header--scroll">
				<div class="mdl-layout__header-row">
					<span class="mdl-layout-title"><?php echo(_('Buchungen')); ?></span><div class="mdl-layout-spacer"></div><span class="noprint mdl-layout-title mdl-layout--large-screen-only"><div class="mdl-textfield mdl-js-textfield"><input id="supersearch" accesskey="f" class="mdl-textfield__input" type="text" onkeydown="if (event.keyCode == 13 && this.value) window.location.href = 'FOP/Index/searchURL?q=' + encodeURIComponent(this.value) + '&from=<?php echo htmlentities(urlencode(\FOP\Util::getBackUrl())); ?>';" value="<?php echo htmlentities($_GET['q'] ?? ''); ?>" style="border-bottom: 1px solid white;"/><label class="mdl-textfield__label" style="color: inherit"><?php echo(_('search')); ?> - <?php
		if (strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) {
			// MAC: Control+ davor
			echo 'Control + ';
		}
		if (strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox') !== false) {
			// Firefox
			if (strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) {
				// MAC: Control + Alt + key
				echo 'Alt + F';
			} else {
				echo 'Alt + Shift + F';
			}
		} else {
			// Internet Explorer, Chrome, Safari, Opera
			echo 'Alt + F';
		}
	?></label></div></span><i onclick='addFav(null)' class='material-icons fop-favorites' id='favorites_button'>star_border</i>
				</div>
      		</header>


				<?php  \EasyEditor\Navigation::render(); ?>
      
				<main class="mdl-layout__content" id="content">
					<div class="fop-content">
						<?php } ?>
						
							<div class="content" id="1">
								

								<div
								 
								id="cardform-fop_fints_buchung"
								style="width: 100%; height: 100%;"
								class='mdl-grid'
									ng-controller="FormFop_fints_buchung" ng-init="form = <?php echo htmlentities(json_encode([]));
									?>;"
								>
								<?php
								 ?>
								<div id='fop-upbar'></div>
								<?php \DataView\Fop_fints_buchung::renderScript(); ?>
									<?php
									$features = [];
									if (true && (true)) {
									$feature = [
										'id' => 'main_table',
										'title' => _('table'),
										'order' => '500-100', // 500-100 (50)
										'mode' => 'area', // area (51) / tab (50)
										'position' => 'full', // 
										'collapsed' => 0, // 0 (51) / 1 (50)
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => null
									];
									$features[$feature['id']] = $feature;
									}
									

									
									/* load order from database
										schema: fop_form_feature(user, form, subid, key, value)
										key = (order, mode, position, collapsed)
									*/
									$upbar_collapsed = false;
									// default values
									foreach (\FOP\Database::query('SELECT subid, '.qi('key').', (SELECT '.qi('value').' FROM fop_form_feature b WHERE a.subid = b.subid AND a.'.qi('key').' = b.'.qi('key').' AND '.qi('user').' = '.intval(\FOP\User::getID()).' GROUP BY '.qi('value').' ORDER BY COUNT(*) DESC LIMIT 1) AS '.qi('value').' FROM fop_form_feature a WHERE '.qi('user').' = '.intval(\FOP\User::getID()).' GROUP BY subid, '.qi('key'))->fetchAll(\PDO::FETCH_ASSOC) AS $setting) {
										if (isset($features[$setting['subid']])) {
											$features[$setting['subid']][$setting['key']] = $setting['value'];
										}
									}
									// form specific special values
									foreach (\FOP\Database::query('SELECT subid, '.qi('key').', '.qi('value').' FROM fop_form_feature a WHERE form = \'fop_fints_buchung\' AND '.qi('user').' = '.intval(\FOP\User::getID()).'')->fetchAll(\PDO::FETCH_ASSOC) AS $setting) {
										if (isset($features[$setting['subid']])) {
											$features[$setting['subid']][$setting['key']] = $setting['value'];
										} else if ($setting['subid'] == 'upbar' && $setting['key'] == 'collapsed') {
											$upbar_collapsed = (bool) $setting['value'];
										}
									}

									/* fill in the content of the features */
									if (true && (true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['main_table']);
										?>
	<?php if (((\FOP\User::getBuchhaltung()) && (\FOP\User::getBuchhaltung())) && (!\FOP\User::getIsGuest())) { ?>
	<div id="fop_fints_buchung-table" class="fop-dv"><?php
		if (\EasyEditor\FormFeature::isCollapsed()) {
			// #3198 lazy rendering:
			echo '<div class="fop-lazy-reload" onclick="reloadfop_fints_buchung()"></div>'; // CSS class .fop-lazy-reload will be clicked after being showed
		} else {
			\DataView\Fop_fints_buchung::renderTabTableAction();
		}
	?></div>
	<?php } ?>
	<?php
										\EasyEditor\FormFeature::pop();
										$features['main_table']['html'] = ob_get_contents();
										ob_end_clean();
									}
									

									uasort($features, function ($a, $b) {
										return strnatcmp($a['order'], $b['order']);
									});
									foreach ($features AS $feature) {
										\EasyEditor\FormFeature::render($feature);
									}
									?><script type='text/javascript'>
										$(function(){
											// bei Änderungen: prüfen, ob Form geändert wurde
											var formData = $('#cardform-fop_fints_buchung').serialize();
											document.body.onbeforeunload = function () {
												if (formData != $('#cardform-fop_fints_buchung').serialize()) {
													return 'Form data has changed - are you sure??';
												}
											};
											$('#cardform-fop_fints_buchung').on('submit', function () {
												document.body.onbeforeunload = undefined;
											});
											<?php if ($upbar_collapsed) {
												?>$('#fop-bar-mainbutton').click();<?php
											} ?>
											$('#fop-bar-mainbutton').click(function () {
												setTimeout(function () {
													setCFF('upbar', 'collapsed', $('#fop-bar-container').is(':visible') ? 0 : 1);
												}, 440); /* perfect timing for fadeOut */
											});
										});
										
										function setCFF(id, key, value) {
											<?php if(!\FOP\User::getIsGuest()) { ?>
											$.get('FOP/Index/setCFF?form=fop_fints_buchung&subid=' + encodeURIComponent(id) + '&key=' + encodeURIComponent(key) + '&value=' + encodeURIComponent(value)).then(function () {
												if (key == 'reset') {
													location.reload();
												}
											});
											<?php } /* EditAccess */ ?>
										}
										function setCFFOrder(fids) {
											<?php if(!\FOP\User::getIsGuest()) { ?>
											$.get('FOP/Index/setCFFOrder?form=fop_fints_buchung&fids=' + encodeURIComponent(JSON.stringify(fids)));
											<?php } /* EditAccess */ ?>
										}
										$(function () {
											refreshTabHeaders($('#cardform-fop_fints_buchung')); /* provided in js/form.js */
											// preselection
											if (location.hash.startsWith('#select:')) {
												$('[name="' + window.location.hash.slice(8) + '"]').focus().select();
											} else {
												$('#cardform-fop_fints_buchung input[type!="hidden"],textarea,select[tabindex!="-1"]').not('.fop-disabled *').filter(':visible:first').focus().select();
											}
										});

										$(window).keydown(function(event) {
											 if (event.ctrlKey && String.fromCharCode(event.which).toLowerCase() == 's') {
												 event.preventDefault();
												 $('button[type=submit]').click();
												 return false;
											 }
										});

										
										$(document).on('keyup',function(evt) {
										   if (evt.keyCode == 27) {
												if (window.parent) {
													window.close(); // iframe:close
												} else {
													window.history.back();
												}
											}
												});
										
									</script>

							</div>
							

							</div>
							<div class="content" id="focus-supersearch">
		<script type='text/javascript'>
			$(function () {
				var focusfield = $('#supersearch');
				
				if (focusfield.length) {
					focusfield[0].focus();
					focusfield[0].select();
				}
			});
		</script>
	
							</div>
						<?php if (!isset($_GET['popup'])) { ?>
					</div>
				</main>
				
			</div>
		<?php } else { ?></div><?php } ?>
<?php if (!isset($_GET['popup'])) { ?><div class='fop-seal'></div><?php } ?></body></html><?php
    
  }


  
  

  
  
}



