<?php 
include 'dheader.php'; 
?>
	<div class="modal fade hidden-print" id="myModal" tabindex="-1" role="dialog" aria-hidden="true"></div>
	<div class="wrapper ">
		<?php include 'leftbar.php'; ?>
		<!-- left-bar -->

		<?php include 'topbar.php'; ?>
			<!-- top-bar -->
			<div class="main-content">




<div class="text-center">					

	
	<div class="row">
		<?php
			$countItems = $db->query("SELECT DISTINCT invoiceNo FROM customerinvoice WHERE sale_type = 'Sale' AND php_date = '".date("Y/m/d")."'");
			$i = 0;
			while($count = $countItems->fetchArray()){
				$i++;
			}

		?>
		<div class="col-lg-3 col-md-6 col-sm-6 col-xs-12" <?php echo (@$_SESSION['salestab'] == '') ? 'style="display:none;"': ''; ?>>
			<a href="sales.php">
				<div class="dashboard-stats">
					<div class="left">
						<h3 class="flatBluec"><?php echo $i; ?></h3>
						<h4>Total Today Sale</h4>
					</div>
					<div class="right flatBlue">
						<i class="ion-ios-cart"></i>
					</div>
				</div>
			</a>
		</div>
		<?php
			$countItems = $db->query("SELECT count(*) AS totalItems FROM itemsetup");
			$count = $countItems->fetchArray();
		?>
		<div class="col-lg-3 col-md-6 col-sm-6 col-xs-12" <?php echo (@$_SESSION['itemstab'] == '') ? 'style="display:none;"': ''; ?>>
			<a href="items.php">
				<div class="dashboard-stats">
					<div class="left">
						<h3 class="flatBluec"><?php echo $count['totalItems']; ?></h3>
						<h4>Total Items</h4>
					</div>
					<div class="right flatRed">
						<i class="ion ion-android-archive"></i>
					</div>
				</div>
			</a>
		</div>
		<?php
			$countCustomers = $db->query("SELECT count(*) AS totalCustomers FROM customer_setup");
			$count = $countCustomers->fetchArray();
		?>
		<div class="col-lg-3 col-md-6 col-sm-6 col-xs-12" <?php echo (@$_SESSION['customertab'] == '') ? 'style="display:none;"': ''; ?>>
			<a href="customers.php">
				<div class="dashboard-stats" id="totalCustomers">
					<div class="left">
						<h3 class="flatGreenc"><?php echo $count['totalCustomers']; ?></h3>
						<h4>Total Customers</h4>
					</div>
					<div class="right flatGreen">
						<i class="ion ion-ios-people-outline"></i>
					</div>
				</div>
			</a>
		</div>
		<?php
			$countsuppliers = $db->query("SELECT count(*) AS totalSuppliers FROM supplier_setup");
			$count = $countsuppliers->fetchArray();
		?>
		<div class="col-lg-3 col-md-6 col-sm-6 col-xs-12" <?php echo (@$_SESSION['suppliertab'] == '') ? 'style="display:none;"': ''; ?>>
			<a href="suppliers.php">
				<div class="dashboard-stats">
					<div class="left">
						<h3 class="flatOrangec"><?php echo $count['totalSuppliers']; ?></h3>
						<h4>Total Suppliers</h4>
					</div>
					<div class="right flatOrange">
						<i class="ion ion-ios-people-outline"></i>
					</div>
				</div>
			</a>
		</div>
	</div>
</div>

<h5 class="text-center">Welcome to PHP Point Of Sale, choose a common task below to get started!</h5>
<div class="row quick-actions">

  			<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
			<div class="list-group">
					<a class="list-group-item" href="closeout-report.php?sdate=<?php echo date("m/d/Y"); ?>&edate=<?php echo date("m/d/Y"); ?>" <?php echo (@$_SESSION['reportscloseout'] == '') ? 'style="display:none;"': ''; ?>> <i class="ion-clock"></i> Today's closeout report</a>
			</div>
		</div>
		
			<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
			<div class="list-group">
					<a class="list-group-item" href="sales-report.php?type=All&by=All&sdate=<?php echo date("m/d/Y"); ?>&edate=<?php echo date("m/d/Y"); ?>" <?php echo (@$_SESSION['reportssales'] == '') ? 'style="display:none;"': ''; ?>> <i class="ion-stats-bars"></i> Today's detailed sales report</a>
			</div>
		</div>

		<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
			<div class="list-group">
					<a class="list-group-item" href="sales.php" <?php echo (@$_SESSION['salestab'] == '') ? 'style="display:none;"': ''; ?>> <i class="icon ti-shopping-cart"></i>Start a New Sale</a>
			</div>
		</div>
		
			<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
			<div class="list-group">
					<a class="list-group-item" href="items-report.php?item=All&sdate=<?php echo date("m/d/Y"); ?>&edate=<?php echo date("m/d/Y"); ?>" <?php echo (@$_SESSION['reportsitems'] == '') ? 'style="display:none;"': ''; ?>> <i class="ion-clipboard"></i> Today's summary items report</a>
			</div>
		</div>
			
	
		<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
			<div class="list-group">
					<a class="list-group-item" href="paycustomer.php" <?php echo (@$_SESSION['customermakepayment'] == '') ? 'style="display:none;"': ''; ?>> <i class="ion-ios-cloud-upload"></i> Start a New Receiving</a>
			</div>
		</div>

		<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
			<div class="list-group">
					<a class="list-group-item" href="paysuppliers.php" <?php echo (@$_SESSION['suppliermakepayment'] == '') ? 'style="display:none;"': ''; ?>> <i class="ion-ios-cloud-download"></i> Start a New Sending</a>
			</div>
		</div>
		
		
		
</div>
	</div>



<!-- Location Message to employee -->
<script>
	$(document).ready(function(){

		$("#dismiss_mercury").click(function(e){
			e.preventDefault();
			$.get($(this).attr('href'));
			$("#mercury_container").fadeOut();
			
		});

		$("#dismiss_test_mode").click(function(e){
			e.preventDefault();
			$.get($(this).attr('href'));
			$("#test_mode_container").fadeOut();
		});
	
		

					var data = {
				labels: ["19"],
				datasets: [
				{
					fillColor : "#5d9bfb",
					strokeColor : "#5d9bfb",
					highlightFill : "#5d9bfb",
					highlightStroke : "#5d9bfb",
					data: ["1"]				}
				]
			};
			var ctx = document.getElementById("charts").getContext("2d");
			var myBarChart = new Chart(ctx).Bar(data, {
				responsive : true
			});
		
	        

		$('.piluku-tabs a').on('click',function(e) {
			e.preventDefault();
			$('.piluku-tabs li').removeClass('active');
			$(this).parent('li').addClass('active');
			var type = $(this).attr('data-type');
			$.post('https://demo.phppointofsale.com/index.php/home/sales_widget/'+type+'', function(res)
			{
				var obj = jQuery.parseJSON(res);
				if(obj.message)
				{
					$(".chart").html(obj.message);
					return false;
				}
				
				renderChart(obj.day, obj.count);
				
				myBarChart.update();
			});
		});

		function renderChart(label,data){

		    $(".chart").html("").html('<canvas id="charts" width="400" height="400"></canvas>');
		    var lineChartData = {
		        labels : label,
		        datasets : [
		            {
		                fillColor : "#5d9bfb",
						strokeColor : "#5d9bfb",
						highlightFill : "#5d9bfb",
						highlightStroke : "#5d9bfb",
		                data : data
		            }
		        ]

		    }
		    var canvas = document.getElementById("charts");
		    var ctx = canvas.getContext("2d");

		    myLine = new Chart(ctx).Bar(lineChartData, {
		        responsive: true,
		        maintainAspectRatio: false
		    });
		}
	});
</script>

<?php include 'dfooter.php'; ?>