<?php
$getid = $link->hrefquery ();

$id = $getid [1];
if ($id != '') {
	$query = $db->delete ( 'clients', array ('id' => $id ) );
	if ($query) {
		?>
<div id="hide">
	<div id="gritter-notice-wrapper">
		<div id="gritter-item-1" class="gritter-item-wrapper gritter-success"
			style="">
			<div class="gritter-top"></div>
			<div class="gritter-item">

				<div class="gritter-without-image">
					<span class="gritter-title">
						<div class="gritter-close" id="gritterremove"
							style="display: inline;"></div>
					</span>
					<p>Deleted successfully...</p>
				</div>
				<div style="clear: both"></div>
			</div>
			<div class="gritter-bottom"></div>
		</div>
	</div>
</div>
<?php
	
	} else {
		?>
<div class="hide1">
	<div id="gritter-notice-wrapper">
		<div id="gritter-item-2" class="gritter-item-wrapper gritter-warning"
			style="">
			<div class="gritter-top"></div>
			<div class="gritter-item">
				<div class="gritter-close" id="gritterremove"
					style="display: inline;"></div>
				<h5>Oops! There Are Some Problem In Deleted...</h5>
				<div style="clear: both"></div>
			</div>
			<div class="gritter-bottom"></div>
		</div>
	</div>
</div>
<?php
	
	}
}
?>
<?php

if (isset ( $_POST ['submit'] ) && $_POST ['check'] == 'date') {
	
	$clientdate = $_POST ['date'];
	
	$final = explode ( '-', $clientdate ['final'] );
	$clientdate ['date1'] = $final [0];
	$clientdate ['date2'] = $final [1];
	
	$clientdate1 = strtotime ( $clientdate ['date1'] );
	
	$clientdate2 = strtotime ( $clientdate ['date2'] );
	
	$time = $db->get_all ( 'clients' );
	
	foreach ( $time as $row ) {
		$dtime = $row ['time'];
		$clientdatenew = date ( "d-m-Y", strtotime ( $dtime ) );
		$db_time = strtotime ( $clientdatenew );
		
		if ($clientdate1 <= $db_time && $clientdate2 >= $db_time) {
			
			$select [] = $row;
		
		} else {
			$warning = "<div class='hide1'>
				  <div id='gritter-notice-wrapper'>
					<div id='gritter-item-2' class='gritter-item-wrapper gritter-warning' style=''>
						<div class='gritter-top'></div>
						<div class='gritter-item'>
							<div class='gritter-close' id='gritterremove' style='display: inline;'></div>
								<h5>
									Oops! There Is No Data For Required Date...
								</h5>
							 <div style='clear:both'></div>
						</div>
						<div class='gritter-bottom'></div>
					</div>
				  </div>
			    </div>";
		}
	}
	if ($select == '') {
		echo $warning;
		$query = $db->get_all ( 'clients', array ('id' => 0 ) );
	} else {
		$query = $select;
	}
} 

else {
	$query = $db->get_all ( 'clients' );
}
?>