<?php
	require_once("config/connect.php");
	require_once("config/pageConfig.php");
	require_once("global_functions.php");
	require_once("sITeditor/sITeditor.php");
	require_once("api/telefon/telefon_funktionen.php");
	
	check_login('', '', 'BENUTZERRECHT_KUNDEN_ANLEGEN');
	
?>

	<script src="include/global_js_functions.js"></script>
	<style type="text/css">
		<?php include 'include/main.css'; ?>
		<?php include 'include/menue.css'; ?>
	
	</style>

	<link rel="stylesheet" type="text/css" href="sITeditor/sITeditor.css">
	
</head>
<body>

<?php

	menue_anzeigen();
	echo '<div id="wrapper_bon" class="wrapper_bon">';
	

	$konfiguration= array (
		'table'		=> 'abgeschlossener_bon',
		'key'		=> 'bon_id',
		'functions' => array (	'add' => true,
								'delete' => true,
								'edit' => true,
								'autoedit' => false,
								'view' => true,
								'copy' => true,
								'download_csv' => true,
								'download_pdf' => true,
								'css' => 'width:100px; min-width:100px; ',
								'style' => 'image'
							),
		'user_search_filter'	=> array (
								'fields' 	=> array ('bon_id'),
								'default_filter_value'		=> '',
								'anzahl_ergebnisse' => 1000
						),
		'orderby'		=> ' ORDER by bon_id DESC ',
		'fields'	=> array(
			array (
				'feldname' 	=> 'bon_id',
				'type' 		=> 'text',
				'header'	=> 'ID',
				'view_options'	=> array ('table_list', 'view', 'edit'),
				'edit_input_option' => array('size' => '10', 'maxlength'=>'10'),
				'readonly' 	=> true
			),
			array (
				'feldname' 	=> 'dummy1',
				'type' 		=> 'ajax_function',
				'button_text'=> 'A4',
				'header'	=> 'A4 Rechnung',
				'php_file'	=>	'ajax_funktionen.php?funktion=bon_ausdrucken_a4_pdf&requestId=§§id§§&requestFunktion=bonJournalPrint',
				'css_option' => array('css_table_list' => 'width:90px;'),
				'view_options'	=> array ('table_list'),
				'readonly' 	=> true
			),
			array (
				'feldname' 	=> 'dummy1',
				'type' 		=> 'iframe_dialog',
				'button_text'=> 'Eink&auml;ufe',
				'header'	=> 'Eink&auml;ufe',
				'php_file'	=>	'ajax_funktionen.php?funktion=kunden_einkaeufe_anzeigen&kunden_id=§§id§§',
				'css_option' => array('css_table_list' => 'width:90px;'),
				'view_options'	=> array ('table_list'),
				'readonly' 	=> true
			),
			array (
				'feldname' 	=> 'kunden_id',
				'type' 		=> 'table_lookup',
				'lookup_table' => array (
								'table' => 'kunden',
								'lookup_field' => 'id',
								'lookup_filter' => 'geloescht<>1',
								'lookup_show_fields' => array (
									'firma', 'nachname' 
								),
								'lookup_show_fields_glue' => '-',
								),
				'edit'		=> 'lookup',
				'view_options'	=> array ('table_list', 'view', 'edit'),
				'css_option' => array('css_table_list' => 'width:20%;'),
				'header'	=> 'Kunde',
				'edit_input_option' => array('size' => '10', 'maxlength'=>'10'),
				'validation' => 'required'
			),
			array (
				'feldname' 	=> 'verkaufer_id',
				'type' 		=> 'table_lookup',
				'lookup_table' => array (
								'table' => 'benutzer',
								'lookup_field' => 'id',
								'lookup_filter' => 'geloescht<>1',
								'lookup_show_fields' => array (
									'name' 
								),
								'lookup_show_fields_glue' => '-',
								),
				'edit'		=> 'lookup',
				'view_options'	=> array ('table_list', 'view', 'edit'),
				'css_option' => array('css_table_list' => 'width:20%;'),
				'header'	=> 'Kunde',
				'edit_input_option' => array('size' => '10', 'maxlength'=>'10'),
				'validation' => 'required'
			),
			array (
				'feldname' 	=> 'verkaufer_id',
				'type' 		=> 'text',
				'view_options'	=> array ('table_list', 'view', 'edit'),
				'header'	=> 'Verkäufer ID'
			),
			array (
				'feldname' 	=> 'gesamt_summe',
				'type' 		=> 'text',
				'view_options'	=> array ('table_list', 'view', 'edit'),
				'header'	=> 'Bonsumme'
			),
			array (
				'feldname' 	=> 'bon_erstellt_datum',
				'type' 		=> 'text',
				'view_options'	=> array ('table_list', 'view', 'edit'),
				'header'	=> 'Bon Datum'
			),
		)
	
	);
	

	//$konfiguration=sIT_editor_view_user_search_filter($konfiguration);
	sIT_editor_tabelle($konfiguration);
?>


</div>  <!-- end of wrapper div -->

</body>
