<?php
	require_once("config/pageConfig.php");
	require_once("global_functions.php");

		if(defined('LAENDERKENNUNG_DE') && LAENDERKENNUNG_DE == 'DE'){
			$financeRep="<option value='GDPdU_export' >GDPdU Export</option>";
		}
		else{
			$financeRep="<option value='report_dep' >DEP7 - Datenerfassungsprotokoll</option>";
			$financeRep.="<option value='report_dep_131' >DEP131 - Datenerfassungsprotokoll</option>";
		}
			
						
		$reportMenuFinanceExport="<select id='adminReportSelect' class='adminReportSelect orange' >
															
								<option value='' >Report auswählen</option>
								".$financeRep."
								<option value='report_total_revenue' >Gesamt Umsatz</option>														
							
						</select>";
		$GDPdUBut=false;
		if(defined('LAENDERKENNUNG_DE') && LAENDERKENNUNG_DE == 'DE'){
			$GDPdUBut="<button id='adminReportGDPdUBut' class='button orange adminReportBut' style='display:none;' 
												onclick=\"displayReportDiv($('#adminReportSelect option:selected').prop('value'), 'downloadReport' )\">Download Report
					</button>";
		}						
						
		$reportList = 	$reportMenuFinanceExport."
						<div id='adminReportSubDivB'></div>
						
						<div class='adminReportDateDivFinanceExp' >
							<p  >Von: </p><input id='reportDateStartField' type='text' class='datepicker adminPmeInputMed_2'  name='filter_date_from' size='' />
								<button class='dateIpClearButFinanceExp' onclick=\"cclearFieldVal('reportDateStartField')\">
										<img class='adminReportDelBut' src='images/kp-delete.png' /></button>
							<p >Bis: </p><input id='reportDateEndField' type='text' class='datepicker adminPmeInputMed_2' name='filter_date_to'  size='' />
							<button class='dateIpClearButFinanceExp' onclick=\"cclearFieldVal('reportDateEndField')\">
										<img class='adminReportDelBut' src='images/kp-delete.png' /></button>
						</div><div class='cclear'></div>
							<button class='button orange adminReportBut' onclick=\"displayReportDiv($('#adminReportSelect option:selected').prop('value'), 'screen' )\">Report anzeigen</button>
							<button id='adminReportPdfBut' class='button orange adminReportBut' 
												onclick=\"displayReportDiv($('#adminReportSelect option:selected').prop('value'), 'exportPDF' )\">Report Export PDF
							</button>
							".$GDPdUBut."
							<button id='adminReportExcelCsvBut' class='button orange adminReportButCsvL' 
												onclick=\"displayReportDiv($('#adminReportSelect option:selected').prop('value'), 'exportExcelCSV' )\"> Excel CSV&nbsp
							</button>
							<button id='adminReportDosCsvBut' class='button orange adminReportButCsvR' 
												onclick=\"displayReportDiv($('#adminReportSelect option:selected').prop('value'), 'exportDosCSV' )\"> Dos CSV
							</button>
							<button id='downloader' class='' style='visibility:hidden'  download ></button>";


	$reportContent="<div id='report_total_revenue' class='reportContentDiv'></div>
					<div id='report_dep' class='reportContentDiv'></div>
					<div id='report_dep_131' class='reportContentDiv'></div>
					<div id='GDPdU_export' class='reportContentDiv'></div>
					<div id='report_message' class='reportContentDiv'></div>";
	
	$menH=14;
	 preg_match('/\d+px/', SCHRIFT_DEFAULT, $match);
	if($match[0]== true){
		$fontS=preg_replace('/\D+/', '', $match[0]);
		if($fontS > 16 && $fontS <= 20){	$menH=18;	}
		else if($fontS > 20 && $fontS <= 24){	$menH=22;	}				
	}
	 $contH=93-$menH;
	 
	 # Aufruf der Ajax Report Funktion -> function displayReportDiv()   in global_js_functions.js
	
?>

<!DOCTYPE HTML>
<html>
	<head>
		<title>SITPOS Finanzdaten Export</title>
		<?php 	echo META_DATA_ADMIN;  ?>
		<script src="jquery/datepicker-de.js"></script>
		<link rel="stylesheet" type="text/css" href="jquery/jquery-ui.css" >
		<style type="text/css">
			<?php include 'include/main.css'; ?>
			<?php include 'include/menue.css'; 
			
			echo "#menu {height:".$menH."%; }";
			echo "#adminReportContent {height:".$contH."%; }";
			echo ".menuDivLeft{ border:none;	} ";
			
			?>
		
		</style>
		<script>
			$(function() {	
					$("#adminReportSelect").change(function() {		
						$("#report_total_revenue, #report_dep, #report_message").html('');
						$("#adminReportPdfBut, #adminReportExcelCsvBut, #adminReportDosCsvBut, #reportDateStartField, #reportDateEndField").prop( "disabled", false ).removeAttr('style');
							if($("#adminReportExcelCsvBut").prop("disabled") == true){
								$("#adminReportExcelCsvBut, #adminReportDosCsvBut").prop( "disabled", false ).removeAttr('style');
							}
							if($("#adminReportSelect option:selected").val() == 'report_dep_131'){
								$("#adminReportPdfBut, #adminReportExcelCsvBut, #adminReportDosCsvBut").prop( "disabled", true ).css({"background":"#aaa", "cursor":"default", "border":"none"	});					
							}
							if($("#adminReportSelect option:selected").val() == 'report_dep'){
								$("#adminReportPdfBut, #adminReportExcelCsvBut, #adminReportDosCsvBut").prop( "disabled", true ).css({"background":"#aaa", "cursor":"default", "border":"none"	});					
							}
							else if($("#adminReportSelect option:selected").val() == 'GDPdU_export'){
								$("#adminReportExcelCsvBut, #adminReportDosCsvBut, #adminReportPdfBut").css({"display":"none"	});
								$("#adminReportGDPdUBut").css({"display":"block"	});
							}
					})
			});
			
						
						
			gdpduCompany=0;
			gdpduStandort=0;
			gdpduComment=0;
			
		<?php 

			if(defined('LAENDERKENNUNG_DE') && LAENDERKENNUNG_DE == 'DE'){
		?>
				gdpduCompany="<?php echo strlen(GDPdU_EXPORT_FIRMA); ?>";
				gdpduStandort="<?php echo strlen(GDPdU_EXPORT_STANDORT); ?>";
				gdpduComment="<?php echo strlen(GDPdU_EXPORT_COMMENT); ?>";
		<?php
			}
			
		?>
			
		</script>
		
	</head>
	<body >

		<div id="wrapper_admin" class="wrapper_admin">
			<div id="adminOperatorDiv" class="schrift" ><?php  echo  $reportList ?></div>
			<?php 	menue_anzeigen();?>
			<div id="adminReportContent">
				<?php echo $reportContent; ?>
			</div>
			
		</div>
	</body>
</html>