		<title>KONTAK DAGANG</title>
       	
        <meta charset='UTF-8'>
 		
        <link href="https://fonts.googleapis.com/css?family=Open+Sans|Roboto" rel="stylesheet"> 		
        <link href="<?php echo $thisPage . "adm1n/css/style.css"; ?>" rel="stylesheet" type="text/css">
		<link href="<?php echo $thisPage . "adm1n/css/pagination.css"; ?>" rel="stylesheet" type="text/css">

		<link href="<?php echo $thisPage; ?>buttons/hover.css" rel="stylesheet" media="all">
		<link href="<?php echo $thisPage; ?>buttons/demo-page.css" rel="stylesheet" media="all">
		
		<script type="text/javascript" src="<?php echo $thisPage; ?>js/messages.js"></script>
        <link rel="stylesheet" type="text/css" href="<?php echo $thisPage; ?>css/messages.css" />
        <link rel="stylesheet" type="text/css" href="<?php echo $thisPage; ?>css/captcha.css" />
		
		<?php
		echo '
		<script src="'.$thisPage.'adm1n/js/jquery.min.js"></script>
		<script src="'.$thisPage.'adm1n/js/modernizr.js"></script>
		<script src="'.$thisPage.'js/jquery.cookie.js"></script>
		';
		
		$temp = '';//$thisUrl . 'admin/php_functions.php';
		//include_once ($temp);
		
		require_once ($thisUrl.'functions/form_creator.php');
		require_once ($thisUrl.'adm1n/functions/getFormValue.php');

		$s_text = (isset($_REQUEST["s_text"]) ? $_REQUEST["s_text"] : '');
		//echo "<br>Text Search: ".$s_text;
		
		$page = (isset($_SESSION['page']) ? $_SESSION['page'] : (isset($_REQUEST['page']) ? $_REQUEST['page'] : null));
		$perhalaman = 15;

		if ($page){
			$start=($page - 1) * $perhalaman;
		} else {
			$start=0;
		}

		$day = date('d'); $month = date('m');
		$bulan = array(
			"Oktober"   => "10",
			"Nopember"  => "11",
			"Desember"  => "12"
		);							

		$fromDay   = (isset($_POST["fromDay"])   ? $_POST["fromDay"]   : null);
		$fromMonth = (isset($_POST["fromMonth"]) ? $_POST["fromMonth"] : null);									
		$toDay     = (isset($_POST["toDay"])     ? $_POST["toDay"]     : null);
		$toMonth   = (isset($_POST["toMonth"])   ? $_POST["toMonth"]   : null);
		$tglNAMA = $date_start = $date_end = '2022';
		
		if (isset($_POST["fromMonth"])) {
			$tglNAMA 	.= '-'.$_POST["fromMonth"];
			$date_start .= '-'.$_POST["fromMonth"];
		} else {
			$tglNAMA 	.= '-'.$month;
			$date_start .= '-'.$month;
		}
		if (isset($_POST["fromDay"])) {
			$tglNAMA 	.= '-'.$_POST["fromDay"];
			$date_start .= '-'.$_POST["fromDay"];
		} else {
			$tglNAMA 	.= '-'.$day;
			$date_start .= '-'.$day;
		}

		if (isset($_POST["toMonth"])) {
			$date_end .= '-'.$_POST["toMonth"];
		} else {
			$date_end .= '-'.$month;
		}
		if (isset($_POST["toDay"])) {
			$date_end .= '-'.$_POST["toDay"];
		} else {
			$date_end .= '-'.$day;
		}

		//echo "tglNAMA: ".$tglNAMA;
		//echo "data_start: ".$data_start;

		$sql  = 
		" SELECT * FROM exhibitor_list ";
		//" WHERE tglNAMA = '".$data["tglNAMA"]."' ";
		if ($s_text) 
			$sql .= " WHERE UPPER(companyName) like '%".strtoupper($s_text)."%' ";
		$sql .= " order by companyName ";
		
		$max = mysqli_num_rows(mysqli_query($conn, $sql));
		//echo $sql; 
		$sql  .= " LIMIT $start, $perhalaman";
		//echo $sql; 

		$sql2 = 
		"SELECT * FROM kontak_dagang_transaksi, kontak_dagang_header, exhibitor_list " .
		"WHERE to_exhibitor_id = exhibitorID " .
		"AND header_id = to_kontak_dagang_header LIMIT $start, $perhalaman ";
		
		if (isset($_COOKIE["exhibitorID"])) {
			$sql3 = 
			"SELECT header_id FROM kontak_dagang_header " .
			"WHERE to_exhibitor_id = '".$_COOKIE["exhibitorID"]."' " .
			"AND tgl_transaksi = '".$_COOKIE["tglNAMA"]."' ";
			if ($hasil3 = mysqli_query($conn, $sql3)) {
				while ($data3 = mysqli_fetch_array($hasil3)) {
					$header_id = $data3["header_id"]; 
				}
			}
		}

		if (isset($header_id)) {
			$sql2 = 
			"SELECT * FROM kontak_dagang_transaksi " .
			"WHERE to_kontak_dagang_header = '".$header_id."'";
		}
		
		//echo $sql3;
		?>
        <script>
            //paste this code under head tag or in a seperate js file.
            // Wait for window load
            $(window).load(function() {
                // Animate loader off screen
                $(".se-pre-con").fadeOut("slow");;
            });
        </script>

		<script>
            $(document).ready(function () {
              $('#nav > li > a').click(function(e){
                 if ($(this).attr('class') != 'active'){
                   $('#nav li ul').slideUp();
                   $(this).next().slideToggle();
                   $('#nav li a').removeClass('active');
                   $(this).addClass('active');
                 }
                 e.preventDefault();
              });
            });
        </script>
		<?php //echo $sql;  ?>
		<script type="text/javascript" language="javascript">
			my_function = null;
			$(document).ready(function() { /// Wait till page is loaded
				$('#tab-content').load('property-detailed.php #tab-content-1', function() {
					 /// can add another function here
				});
				$('#tab1').click(function(){
				  $('#tab-content').load('property-detailed.php #tab-content-1', function() {
					  $(".se-pre-con").fadeOut("slow");;
					   /// can add another function here
				  });
				});
				$('#tab2').click(function(){
				  $('#tab-content').load('property-detailed.php #tab-content-2', function() {
					  $(".se-pre-con").fadeOut("slow");;
					   /// can add another function here
				  });
				});
				$('#tab3').click(function(){
				  $('#tab-content').load('property-detailed.php #tab-content-3', function() {
					   $(".se-pre-con").fadeOut("slow");;		
					   /// can add another function here
				  });
				});
			}); //// End of Wait till page is loaded
			
			<?php			
			//echo $sql; 
			if ($hasil = mysqli_query($conn, $sql)) {
				if (mysqli_num_rows($hasil)) {
					echo '
					$(document).ready(function() {';
					while ($data = mysqli_fetch_array($hasil)) {
						echo '
						$(\'#'.$data["exhibitorID"].'-listCompany\').click(function() {  
							$.cookie(\'action\', \'entryForm\');
							$.cookie(\'exhibitorID\', \''.$data["exhibitorID"].'\');
							$.cookie(\'tglNAMA\', \''.$tglNAMA.'\');
							$(\'form#formManageForm\').submit();
						});';
					}
					echo '
					});';
				}
			}

			//echo $sql; 
			if ($hasil = mysqli_query($conn, $sql2)) {
				if (mysqli_num_rows($hasil)) {
					echo '
					$(document).ready(function() {';
					while ($data = mysqli_fetch_array($hasil)) {
						echo '
						$(\'#'.$data["transaksiID"].'-kontakDagang\').click(function() {  
							$.cookie(\'action\', \'viewKontakDagang\');
							$.cookie(\'header_id\', \''.$data["header_id"].'\');
							$.cookie(\'transaksiID\', \''.$data["transaksiID"].'\');
							$(\'form#formKontakDagang\').submit();
						});';
					}
					echo '
					});';
				}
			}

			?>			
        	
        </script>

        <?php
        echo '
		<script>
			function deleteCookie() {
				var cookies = document.cookie.split(";");
				for (var i = 0; i < cookies.length; i++) {
					var cookie = cookies[i];
					var eqPos = cookie.indexOf("=");
					var name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie;
					document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT";
				}
			}				
		
			$(document).ready(function() {
				$(\'#submitformEntryForm\').click(function() { 
					$(\'form#formEntryForm\').submit();
				});
	
				$(\'#10\').click(function() { 
					deleteCookie();
				});

				$(\'#submitformKelengkapanData\').click(function() { 
					$(\'form#formKelengkapanData\').submit();
				});

				$(\'#cancelformKelengkapanData\').click(function() { 
					$(\'input[name="action"]\').val(\'entryForm\');
					$(\'form#formKelengkapanData\').submit();
				});

				$(\'#submitformNewTransaction\').click(function() { 
					$(\'form#formNewTransaction\').submit();
				});

				$(\'#submitformViewKontakDagang\').click(function() { 
					$(\'form#formViewKontakDagang\').submit();
				});
				
				$(\'#submitformBackToMain\').click(function() { 
					deleteCookie();
					$(\'form#formBackToMain\').submit();
				});

				$(\'#submitformEditKontakDagang\').click(function() { 
					$(\'form#formEditKontakDagang\').submit();
				});
				

				$(\'#submitformLaporan\').click(function() { 
					$(\'form#formLaporan\').submit();
				});
				
			});
		</script>';
		?>





