<?php
	require_once("config/connect.php");
	require_once("config/pageConfig.php");
	require_once("global_functions.php");
	check_login('', '', 'ENABLERKEY_ADMIN_DATEN_IMPORT');
	$message="";
	
	register_shutdown_function("importTimeoutError");
	
	
	if(isset($_POST['dataImputForm'])) {
		
		$bruttoSwitch=true;
		if(!isset($_POST['csvBruttoSwitch'])){	$bruttoSwitch=false;			}
		
		$target_dir = "uploads/imports/";
			$target_file = $target_dir .date('Ymd_H-i-s')."_".basename($_FILES["fileToUpload"]["name"]);
			$uploadOk = 1;
			$fSizeLimit=1500000;				#	500000
			$fSize=$_FILES["fileToUpload"]["size"];
			$fType=pathinfo($target_file,PATHINFO_EXTENSION );
			
			if(strtolower(pathinfo($target_file,PATHINFO_EXTENSION )) == 'csv' && $_FILES["fileToUpload"]["size"] < $fSizeLimit){

				 if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
					$message.="Die Datei ". $target_file. " wurde hochgeladen.<br />";					
				} else {
					$message.="Fehler beim hochladen der Datei !!!<br />";
				}
				
				if($fSize > 300000 && $fSize <= 600000) set_time_limit(120);
				else if($fSize > 600000 && $fSize <= 900000) set_time_limit(180);
				else if($fSize > 900000 && $fSize <= 1500000) set_time_limit(240);
							
				$ipSuccess=importFromCsv($target_file, 'productsImport', ';', false, $bruttoSwitch );
		
				set_time_limit(30);
				if(is_array($ipSuccess) ) {
					$message='';
					print_r($ipSuccess);
				}
				else $message=preg_replace('/\n/', '<br />', $ipSuccess);
			}
			else $message.="Falscher Datei Type (".$fType.") oder Dateigröße (". $fSizeLimit ." / ".$fSize .") !!<br />Datei Import abgebrochen.<br />";
	}
	
	else if(isset($_POST['csbDatenFormForm'])){
			$bruttoSwitch=false;
			if(isset($_POST['csbBruttoSwitch']) && $_POST['csbBruttoSwitch'] == 'on') $bruttoSwitch=true;
			else $bruttoSwitch=false;
			writeLog(basename( __FILE__)." ". __LINE__ , "brutto: ".$bruttoSwitch." / ");
			
			$target_dir = "export_import/";
			$target_file = $target_dir .basename($_FILES["fileToUploadCsbSql"]["name"]);
			$uploadOk = 1;
			$fSizeLimit=5000000;
			$fSize=$_FILES["fileToUploadCsbSql"]["size"];
			$fType=pathinfo($target_file,PATHINFO_EXTENSION );
			
			if(strtolower(pathinfo($target_file,PATHINFO_EXTENSION )) == 'sql'){
				if (move_uploaded_file($_FILES["fileToUploadCsbSql"]["tmp_name"], $target_file)) {
					$message.="Die Datei ". $target_file. " wurde hochgeladen.<br />";
					require_once("export_import/csb.php");
					$writeCsv=exportCsbToFile($target_file);
					if (strpos(strtolower($writeCsv[1]), 'success') == 1){
						$writeCsv[1]=preg_replace(array('/\s/', '/success/i'), "", $writeCsv[1], 1);
						$message.=$writeCsv[1];
						
						$ipSuccess=importFromCsv($writeCsv[0], 'productsImport', ';', false, $bruttoSwitch );
						
						if(is_array($ipSuccess) ) {
							print_r($ipSuccess);
						}
						else $message.=$ipSuccess;
					}
				} else {
					$message.="Fehler beim hochladen der Datei !!!<br />";
				}
			}
			else $message.="Falscher Datei Type (".$fType.") oder Dateigröße (". $fSizeLimit ." / ".$fSize .") !!<br />Datei Import abgebrochen.<br />";
	}
	
	else if(isset($_POST['bildImputForm'])){
		$target_dir = "uploads/imports/";
			$target_file = $target_dir ."_".basename($_FILES["fileToUploadImg"]["name"]);				 
			$uploadOk = 1;
			$fSizeLimit=2000000;
			$fSize=$_FILES["fileToUploadImg"]["size"];
			$fType=pathinfo($target_file,PATHINFO_EXTENSION );
			
			if((strtolower(pathinfo($target_file, PATHINFO_EXTENSION )) == 'png' || strtolower(pathinfo($target_file, PATHINFO_EXTENSION )) == 'jpg'
						 || strtolower(pathinfo($target_file, PATHINFO_EXTENSION )) == 'jpeg')&& $_FILES["fileToUploadImg"]["size"] < $fSizeLimit){
				$logoTarget=false;
				if(isset($_POST['radioLogo'])){
						if($_POST['radioLogo']=='radioLogoBon')	$logoTarget='bonlogo';
						else if($_POST['radioLogo']=='radioLogoA4')		$logoTarget='a4logo';
						else{
							$logoTarget=false;
						}
				}
				
				
				if (move_uploaded_file($_FILES["fileToUploadImg"]["tmp_name"], $target_file) && $logoTarget != false) {
					$message.="Die Datei ". $target_file. " wurde hochgeladen.<br />";
									
					list($imgX, $imgY) = getimagesize($target_file);
					
					$checkImg=mysql_fetch_assoc(mysql_query("SELECT name FROM images WHERE name = '".$logoTarget."'"));
					if($checkImg['name'] == true){
						$storeImg=mysql_query("UPDATE images SET image ='". mysql_real_escape_string(file_get_contents($target_file))."', 
								imgx=".$imgX.", imgy=".$imgY." WHERE name = '".$logoTarget."' ");
					}
					else{
						$storeImg=mysql_query("INSERT INTO images SET image ='". mysql_real_escape_string(file_get_contents($target_file))."', 
							name = '".$logoTarget."', imgx=".$imgX.", imgy=".$imgY." ");
					}
					
					if(!$storeImg)$message.= "Datenbank Insert/Update Fehler. ".mysql_error()."<br />";
					else $message.= "Image Daten in die Datenbank geschrieben.<br />";

				} else {
					$message.="Fehler beim hochladen der Datei !!!<br />";
				}
			}
			else $message.="Falscher Datei Type (".$fType.") oder Dateigröße (". $fSizeLimit ." / ".$fSize .") !!<br />Datei Import abgebrochen.<br />";
	}
	
	else if(isset($_POST['a4TemplImputForm'])){
			$target_dir = "docs/auto_backup/";
			$target_file = $target_dir ."_".basename($_FILES["fileToUploadSqlTempl"]["name"]);				 
			$uploadOk = 1;
			$fSizeLimit=500000;
			$fSize=$_FILES["fileToUploadSqlTempl"]["size"];
			$fType=pathinfo($target_file,PATHINFO_EXTENSION );
			
			if(strtolower(pathinfo($target_file, PATHINFO_EXTENSION )) == 'sql' && $_FILES["fileToUploadSqlTempl"]["size"] < $fSizeLimit){
				if (move_uploaded_file($_FILES["fileToUploadSqlTempl"]["tmp_name"], $target_file)) {
					$message.="Die Datei ". $target_file. " wurde hochgeladen.<br />";
					
					$dataPath=urldecode(AUTOMATISCH_BACKUP_PFAD);	
					$filename=$target_file;
				
					$checkLocation=getenv("HOMEPATH");
					if(preg_match("/users\\\kp_/i", $checkLocation)){
						$command="e:\\Programme\\xampp\\mysql\\bin\\mysql --user=".SQL_USER." --password=".SQL_PW." ".SQL_DB." < ".$filename." ";	
					}
					else {
						$command="c:\\xampp\\mysql\\bin\\mysql --user=".SQL_USER." --password=".SQL_PW." ".SQL_DB." < ".$filename." ";
					}
					
					$output=array();
					
					exec($command, $output, $error_code);
					if($error_code == 0) $message= "Funktion importiert.";
					else $message.="Fehler ".$error_code.", beim Import aufgetreten.<br />";
					
					
				} else {
					$message.="Fehler beim hochladen der Datei !!!<br />";
				}
				
			
			
			}
			else $message.="Falscher Datei Type (".$fType.") oder Dateigröße (". $fSizeLimit ." / ".$fSize .") !!<br />Datei Import abgebrochen.<br />";
	}
	
		$csvImportInfoTxt="Ist Brutto gesetzt werden die Preise aus der CSV Import Datei als Bruttopreise importiert, wenn nicht gesetzt als Nettopreise";
		$csbImportInfoTxt="Ist Brutto gesetzt werden die Preise aus dem CSB Import als Bruttopreise importiert, wenn nicht gesetzt als Nettopreise";
		
		$a4TemplateEinfueden="A4 Template, als php Code in das jeweilige (Rechnung/Lieferschein) Fenster kopieren und speichern.";
		
			#importFieldLieferschTempl{	position:absolute; top:5%; left:2%; width:94%; height:86%; padding:1%; box-shadow:3px 3px 5px #777;	border-radius:5px;					}
			#importFieldRechnTempl{	position:absolute; top:5%; left:2%; width:94%; height:86%; padding:1%; box-shadow:3px 3px 5px #777;						}

	
?>
<!DOCTYPE HTML>
<html>
	<head>
		<title>SITPOS Datenimport</title>
		<?php 	echo META_DATA_ADMIN;
				echo PAGE_CACHE_OFF; ?>
		<style type="text/css">
			<?php include 'include/main.css'; ?>
			<?php include 'include/menue.css'; ?>

			#exportCSVform { position: relative; width: 97%; margin: 12px auto 10px; padding: 5px 4px; border: silver 1px solid; border-radius: 5px; }
			
			.modal-body-style{ display:none; position:absolute; top:0%; left:0%; width:100%; height:100%; background:transparent;					}
			.templateIpModalContent{ position:absolute; top:3%; left:1.5%; width:97%; height:94%; background:#fff; border:1px solid #999;			}
			.importFieldTempl{ 	position:absolute; top:5%; left:2%; width:94%; height:86%; padding:1%; font-size:10px; font-weight:normal; font-family:arial; 
						color:#030;  box-shadow:3px 3px 5px #777;	border-radius:5px;			}
			
	
		</style>
		<link rel="stylesheet" type="text/css" href="jquery/jquery-ui.css">

		<script>
		$(document).ready(function() {
			$('#exportCSVbutton').click(function () {

				$.post("ajax_funktionen.php", {funktion: "get_products"}, function(response) {
					console.log((response)); 
					let csvContent = "";
					response = JSON.parse(response);

					let headers = response.shift();

					headers.forEach(function(entry) {
						csvContent += entry + ";";
					});
					csvContent = csvContent.substring(0, csvContent.length - 1);
					csvContent += "\r\n";
					
					response.forEach(function(entry) {
						for(let key in entry) {
							csvContent += entry[key] + ";";
						}
						csvContent = csvContent.substring(0, csvContent.length - 1);
						csvContent += "\r\n";
					});
					
					let encodedUri = "data:text/csv;charset=utf-8,%EF%BB%BF" + encodeURI(csvContent);
            
        	    	let link = document.createElement("a");
        	    	link.setAttribute("href", encodedUri);
        	    	link.setAttribute("download", "importliste.csv");
        	    	document.body.appendChild(link);
					
	  		    	link.click();

				});

				/*let csvContent = "";
            	tableData.forEach(function(rowData) {
            	    //let row = rowData.join(";");
            	    let row = rowData[0] + ";" + rowData[1] + ";" + (rowData[3]) + ";" + (rowData[4]) + ";"+ (rowData[5]);
            	    csvContent += row + "\r\n";
            	});
		
        	    let encodedUri = "data:text/csv;charset=utf-8,%EF%BB%BF" + encodeURI(csvContent);
            
        	    let link = document.createElement("a");
        	    link.setAttribute("href", encodedUri);
        	    link.setAttribute("download", "report_csv.csv");
        	    document.body.appendChild(link);

	  		    link.click();*/

 				
			});
		});
		
		function openIpModal(targetToSave){
				// beide ausblenden, das entsprechende dann einblenden !
			$("#a4RechnungTemplateImportModal, #a4LieferscheinTemplateImportModal").css({ 'display':'none'			});
			zuz=$("#a4RechnungTemplateImportModal").css('z-index');
			console.log("zIndex von ip ..."+zuz);
			
			if(targetToSave == 'rechnung'){	
				$("#a4RechnungTemplateImportModal").css({ 'display':'block', 'z-index':'99999999'			});
				saveA4Templ(targetToSave, 'loadTemplate');
			}
			else if(targetToSave == 'lieferschein'){	
				$("#a4LieferscheinTemplateImportModal").css({ 'display':'block', 'z-index':'99999999'			});
				saveA4Templ(targetToSave, 'loadTemplate');
			}	
			
		}
		
		function importModalAbbrechen(targetX, targetToClear){
			$("#"+targetX).css({ 'display':'none', 'z-index':'auto'		});
			$("#"+targetToClear).val('');
			$("#rechSaveTemplMsg").html("");
			$("#lieferschSaveTemplMsg").html("");
		}
			
		function saveA4Templ(targetY, dDirection=false){
			
			if(targetY == 'rechnung' && dDirection == 'saveTemplate'){
				templateData=$("#importFieldRechnTempl").val();				
			}
			else if(targetY == 'liefersch' && dDirection == 'saveTemplate'){
				templateData=$("#importFieldLieferschTempl").val();	
			}
			else templateData=false;
			
			console.log(" a4 templ save #-> "+targetY+" templData #-> "+templateData);

			$.ajax({
				type: "POST",
				url: "ajax_funktionen_kp.php",
				dataType : "html",
				data: {	functionKey:"saveA4Templ", a4Target:targetY, templateData:templateData, dDirection:dDirection	},
				async: true,
				success:function(response){
						if(checkJson(response) == true) {
							respArray=JSON.parse(response);
							if(dDirection == 'loadTemplate'){
								$errorMsg="";
								if(respArray[0].toLowerCase() == 'error')$errorMsg='Fehler: ';
								if(respArray[2] == 'rechnung'){
									$("#importFieldRechnTempl").val(respArray[3]);
									$("#rechSaveTemplMsg").html($errorMsg+respArray[1]);
									console.log("response -> \n"+response);
								}
								else if(respArray[2] == 'lieferschein'){
									$("#importFieldLieferschTempl").val(respArray[3]);
									$("#lieferschSaveTemplMsg").html($errorMsg+respArray[1]);
								}
							}
							else if(dDirection == 'saveTemplate'){
								$errorMsg="";
								if(respArray[0].toLowerCase() == 'error')$errorMsg='Fehler: ';
								
								if(respArray[2] == 'rechnung') $("#rechSaveTemplMsg").html($errorMsg+respArray[1]);
								else if(respArray[2] == 'liefersch') $("#lieferschSaveTemplMsg").html($errorMsg+respArray[1]);
								console.log("direction -> saveTempl !!!\n"+respArray[0]+" - "+respArray[1]+"\n\n\n"+respArray[2]);
							}
						}
						else{
							if(targetY == 'rechnung') $("#rechSaveTemplMsg").html(response);
							else if(targetY == 'liefersch') $("#lieferschSaveTemplMsg").html("Wos mochst do ?"+response);
							console.log("Error, Fehlermeldung konnte nicht ausgelesen werden.\n"+response);
						}
				}
			});	
		}
		
		function setFontSize(xDirection, tareaId){
			if(xDirection == 'plus'){
				fSizeNo = ($("#"+tareaId).css('fontSize').replace(/\D/g, '')*1)+1;
				$("#"+tareaId).css({'font-Size':fSizeNo+'px'			});
			}
			else if(xDirection == 'minus'){
				fSizeNo = ($("#"+tareaId).css('fontSize').replace(/\D/g, '')*1)-1;
				$("#"+tareaId).css({'font-Size':fSizeNo+'px'			});
			}
			else{
				$("#"+tareaId).css({'font-Size':'10px'			});
			}
		}
		
		function clearElem(elemId, elemType){
			console.log("clearElem "+elemId+" angesprochen !!!"+elemType);
			if(elemType=='html')$("#"+elemId).html("");	
			else if(elemType=='val')$("#"+elemId).val("");
		}
			
		</script>

	</head>
	<body >
		<div id="wrapper_admin" class="wrapper_admin">
			<div id="generalDialog"  ></div>
			<?php	menue_anzeigen();		
				#z-index:9999999
			?>
			<div class="cclear"></div>
			<div id="a4LieferscheinTemplateImportModal" class="modal-body modal-body-style" style=";" >			
				<div id="modalContentLs"  class="templateIpModalContent" >
					<button  class="button button_groß orange" onclick="saveA4Templ('liefersch', 'saveTemplate')" style="margin:3px 5px 3px 35px; 
							padding-left:15px; padding-right:15px;"  >Save Lieferschein Template</button>
					<div id="lieferschSaveTemplMsg" class="floatL" style="position:relative; width:35%; height:auto; margin:8px 0px 3px 5px; white-space:nowrap; " ></div>
					<button class="button button_groß orange floatR" onclick="importModalAbbrechen('a4LieferscheinTemplateImportModal', 'importFieldLieferschTempl')"
									style="margin:3px 35px 3px 5px; padding-left:15px; padding-right:15px;" >Schließen</button>					
					<button class="button button_groß orange floatR" onclick="setFontSize('minus', 'importFieldLieferschTempl')" 
							style="margin:3px 35px 3px 5px; padding-left:15px; padding-right:15px;"   >-</button>
					<button class="button button_groß orange floatR" onclick="setFontSize('', 'importFieldLieferschTempl')" 
							style="margin:3px 5px 3px 5px; padding-left:5px; padding-right:5px;"   >-/-</button>
					<button class="button button_groß orange floatR" onclick="setFontSize('plus', 'importFieldLieferschTempl')" 
							style="margin:3px 5px 3px 5px; padding-left:15px; padding-right:15px;"   >+</button>				
									<div class="cclear"></div>
					<textarea id="importFieldLieferschTempl" class="importFieldTempl" onclick="clearElem('lieferschSaveTemplMsg', 'html')";  ></textarea>
				</div>
			</div>
			<div id="a4RechnungTemplateImportModal"  class="modal-body modal-body-style" style="" >
				
				<div id="modalContentRech" class="templateIpModalContent" >
					<button class="button button_groß orange" onclick="saveA4Templ('rechnung', 'saveTemplate')" style="margin:3px 5px 3px 25px; 
							padding-left:15px; padding-right:15px;"  >Save Rechnung Template</button>
					<div id="rechSaveTemplMsg" class="floatL" style="position:relative; width:35%; height:auto; margin:8px 0px 3px 5px; white-space:nowrap;" ></div>
					<button class="button button_groß orange floatR" onclick="importModalAbbrechen('a4RechnungTemplateImportModal', 'importFieldRechnTempl')"
									style="margin:3px 35px 3px 5px; padding-left:15px; padding-right:15px;" >Schließen</button>
					<button class="button button_groß orange floatR" onclick="setFontSize('minus', 'importFieldRechnTempl')" 
							style="margin:3px 35px 3px 5px; padding-left:15px; padding-right:15px;"   >-</button>
					<button class="button button_groß orange floatR" onclick="setFontSize('', 'importFieldRechnTempl')" 
							style="margin:3px 5px 3px 5px; padding-left:5px; padding-right:5px;"   >-/-</button>
					<button class="button button_groß orange floatR" onclick="setFontSize('plus', 'importFieldRechnTempl')" 
							style="margin:3px 5px 3px 5px; padding-left:15px; padding-right:15px;"   >+</button>
					
				
									<div class="cclear"></div>		
					<textarea id="importFieldRechnTempl" class="importFieldTempl"  onclick="clearElem('rechSaveTemplMsg', 'html')"; ></textarea>
				</div>
			</div> 
		
		
			
			<div id="adminContent" style="">
				<div class='dataImportContentDiv'>
					<h4 class="adminTxtHeaderH4">Produkt Daten Import<span style="font-size: 0.8em; font-weight:bold; font-style:italic;" > (CSV Datei erforderlich)</span></h4>
					<!--<p class="adminTxt adminTxtUpload" >Die import Datei muss ein "csv" sein.</p>-->
					<form id="uploadForm" action="daten_import.php" method="post" enctype="multipart/form-data" 
							onSubmit="document.getElementById('uploadSubmitBut').setAttribute('disabled','disabled');">
						<input type="hidden" name="dataImputForm" />	
						Datei auswählen:
						<input type="file" name="fileToUpload" id="fileToUpload" />
						<label for="csvBruttoSwitch" >Brutto</label><input type="checkbox" id='csvBruttoSwitch' name='csvBruttoSwitch' value='on' checked />
						<button class="configInfoBut" type="button"
							onclick="openGeneralDialog('configInfo', 'Import Info, Brutto Button', '<p class=\'configDialogContent\' ><?php echo $csvImportInfoTxt; ?></p>', 'wrapper_admin');">i</button>
						
					<!--	<input type="submit" id="uploadSubmitBut" value="Datei importieren" name="submit" />	-->
						<button class="button button_groß orange ipSubmitBut" type="submit" id="uploadSubmitBut" value="Datei importieren" name="submit" >CSV importieren</button>
					</form>
					
					<h4 class="adminTxtHeaderH4">Bild, Logo Import<span style="font-size:0.8em; font-weight:bold; font-style:italic;" > (PNG od. JPG/JPEG Datei erforderlich)</span></h4>
					<!--<p class="adminTxt adminTxtUpload" >Das Bild muss ein png od. jpg/jpeg sein.</p>-->
						
					
					<form id="uploadFormImg" action="daten_import.php" method="post" enctype="multipart/form-data" 
							onSubmit="document.getElementById('uploadSubmiImgtBut').setAttribute('disabled','disabled');">
								<div style='position:relative; width:40%; margin:5px auto; padding:3px 5px; border:#8d6c7c 1px solid; border-radius:2px;'>
									<div class='floatL' ><label class='uploadRadioLabel' for="bonLogoRadio">Bon Logo</label>
											<input checked id="bonLogoRadio" type='radio' name='radioLogo' value="radioLogoBon" /></div>
									<div class='floatR' ><label class='uploadRadioLabel' for="a4LogoRadio">A4 Logo</label>
											<input id="a4LogoRadio" style="margin-right:12px;" type='radio' name='radioLogo' value="radioLogoA4" /></div><div class='cclear'></div>
								</div>
							
							
						<input type="hidden" name="bildImputForm" />	
						Datei auswählen:
						<input type="file" name="fileToUploadImg" id="fileToUploadImg" />
						
					<!--	<input type="submit" id="uploadSubmitBut" value="Datei importieren" name="submit" />	-->
						<button class="button button_groß orange ipSubmitBut" type="submit" id="uploadSubmiImgtBut" value="Datei importieren" name="submit" >Bilddatei importieren</button>
					</form>
					
					<h4 class="adminTxtHeaderH4">A4 Rechnung/Lieferschein Ausdruck Funktion importieren</h4>
					
					
					<form id="uploadFormA4Template" action="daten_import.php" method="post" enctype="multipart/form-data" style="min-height:28px;"	">
						
						<input type="hidden" name="a4TemplImputForm" />
						<!--Datei Auswählen:
								<p class="adminTxt adminTxtUpload" >Die Datei muss eine sql Datei sein.</p>
								onSubmit="document.getElementById('uploadSubmitTemplateBut').setAttribute('disabled','disabled');
						<input type="file" name="fileToUploadSqlTempl" id="fileToUploadSqlTempl" />-->
						
						<button type="button" class="button button_groß orange ipSubmitBut"  style="width:175px;"  onclick="openIpModal('lieferschein')" >A4 Lieferschein</button>
						<button type="button" class="button button_groß orange ipSubmitBut" style="width:175px;" onclick="openIpModal('rechnung')" >A4 Rechnung</button>
						<button class="configInfoBut floatR" type="button" style="margin-right:22px;"
							onclick="openGeneralDialog('configInfo', 'Import A4 Template Info Button', '<p class=\'configDialogContent\' ><?php echo $a4TemplateEinfueden; ?></p>', 'wrapper_admin');">i</button>
						<!--<button class="button button_groß orange ipSubmitBut" type="submit" id="uploadSubmitTemplateBut" value="Datei importieren" name="submit" >Funktion importieren</button>	-->
												
						
					</form>
										
					<h4 class="adminTxtHeaderH4">CSB Daten importieren<span style="font-size:0.8em; font-weight:bold; font-style:italic;" > (SQL Datei erforderlich)</span></h4>
					<!--<p class="adminTxt adminTxtUpload" >Die Datei muss eine sql Datei sein.</p>-->
					
					<form id="uploadFormCSB" action="daten_import.php" method="post" enctype="multipart/form-data" 
							onSubmit="document.getElementById('uploadSubmitCSB_But').setAttribute('disabled','disabled');">
						<input type="hidden" name="csbDatenFormForm" />
						Datei Auswählen:
						<input type="file" name="fileToUploadCsbSql" id="fileToUploadCsbSql" />
						<label for="csbBruttoSwitch" >Brutto</label><input type="checkbox" id='csbBruttoSwitch' name='csbBruttoSwitch' checked />
						<button class="configInfoBut" type="button"
							onclick="openGeneralDialog('configInfo', 'Import Info, Brutto Button', '<p class=\'configDialogContent\' ><?php echo $csbImportInfoTxt; ?></p>', 'wrapper_admin');">i</button>
						<button class="button button_groß orange ipSubmitBut" type="submit" id="uploadSubmitCSB_But" 
							value="Datei importieren" name="submit" >CSB importieren</button>
					</form>

					<h4 class="adminTxtHeaderH4">Artikelstamm exportieren<span style="font-size:0.8em; font-weight:bold; font-style:italic;" > (Ausgabe, CSV Datei)</span></h4>
					<!--<p class="adminTxt adminTxtUpload" >Es wird eine CSV Datei erstellt.</p>-->

					<form id="exportCSVform" method="post" enctype="multipart/form-data" onsubmit="return false;" >
						<input type="hidden" name="exportCSV" />
						<input type="file" name="fileToUploadCsbSql" id="fileToUploadCsbSql" style="visibility: hidden;"  />
						<button class="button button_groß orange ipSubmitBut" id="exportCSVbutton" 
							value="Daten exportieren" name="submit"  >Daten exportieren</button>
						
					</form>
					
					<div id="uploadMessage">
						<?php echo $message; ?>
					</div> 
				
				
				</div>
			</div>
		</div>

	</body>
</html>