<style>
.panel-green {
    border-color: #5cb85c;
}
.panel-yellow {
    border-color: #f0ad4e;
}
.panel-red {
    border-color: #d9534f;
}
.panel-green > .panel-heading {
    border-color: #5cb85c;
    color: white;
    background-color: #5cb85c;
}
.panel-yellow > .panel-heading {
    border-color: #f0ad4e;
    color: white;
    background-color: #f0ad4e;
}
.panel-red > .panel-heading {
    border-color: #d9534f;
    color: white;
    background-color: #d9534f;
}
.huge {
    font-size: 20px;
}
.panel-green > a {
    color: #5cb85c;
}
.panel-yellow > a {
    color: #f0ad4e;
}
.panel-red > a {
    color: #d9534f;
}
</style>
<?php
	$j = $this->db->query("select sum(grand_total) as total from transaksi where status='1' and date(created_date)='".date("Y-m-d")."'")->result_array(); 
	$totalj =  $j[0]['total'];

	$b = $this->db->query("select sum(total) as total from transaksi where status='1' and date(created_date)='".date("Y-m-d")."'")->result_array(); 
	$totalb =  $b[0]['total'];

	$s = $this->db->query("select count(*) as total from barang where status='1' and date(created_date)='".date("Y-m-d")."'")->result_array(); 
	$totals =  $s[0]['total'];

	$u = $this->db->query("select count(*) as total from supplier where status='1' and date(created_date)='".date("Y-m-d")."'")->result_array(); 
	$totalu =  $u[0]['total'];
	
	//laba
	$item = $this->model_global->get_data(array('select' => '*', 'table' => 'item','where' => array('status' => 1,"date(created_date)"=>date("Y-m-d"))));   
	$ju = 0;
	$mod = 0;
	$un = 0;
	foreach($item as $i){
		$ju = $ju+$i["total"];
		$ui = $i["harga_beli"] * $i["qty"];
		$mod = $mod + $ui;
	}
	$un = $ju - $mod;

?>
<h1 class="page-header">
	Selamat Datang <b><?php echo $datasession["idUser"];?></b>
</h1>
<div class="panel panel-default">
	<div class="panel-heading">
		<div class="row">
			<div class='col-sm-6'></div>
			<div class='col-sm-6' align='right'>

			</div>
		</div>
	</div>
	<div class="panel-body">  
		<br>
		<?php if($datasession['akses']=="1"){?>
		<div class="row">
			<div class="col-lg-3 col-md-6">
				<div class="panel panel-primary">
					<div class="panel-heading">
						<div class="row">
							<div class="col-xs-3">
								<i class="fa fa-dollar fa-5x"></i>
							</div>
							<div class="col-xs-9 text-right">
								<div class="huge">Rp. <?=number_format($totalj)?></div>
								<div>Total Penjualan</div>
							</div>
						</div>
					</div>
					<a href="<?=$url?>penjualan">
						<div class="panel-footer">
							<span class="pull-left">View Details</span>
							<span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
							<div class="clearfix"></div>
						</div>
					</a>
				</div>
			</div>
			<div class="col-lg-3 col-md-6">
				<div class="panel panel-green">
					<div class="panel-heading">
						<div class="row">
							<div class="col-xs-3">
								<i class="fa fa-shopping-cart fa-5x"></i>
							</div>
							<div class="col-xs-9 text-right">
								<div class="huge">Rp. <?=number_format($un)?></div>
								<div>Total Laba</div>
							</div>
						</div>
					</div>
					<a href="<?=$url?>">
						<div class="panel-footer">
							<span class="pull-left">View Details</span>
							<span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
							<div class="clearfix"></div>
						</div>
					</a>
				</div>
			</div>
			<div class="col-lg-3 col-md-6">
				<div class="panel panel-yellow">
					<div class="panel-heading">
						<div class="row">
							<div class="col-xs-3">
								<i class="fa fa-briefcase fa-5x"></i>
							</div>
							<div class="col-xs-9 text-right">
								<div class="huge"><?=$totals?></div>
								<div>Total Barang</div>
							</div>
						</div>
					</div>
					<a href="<?=$url?>barang">
						<div class="panel-footer">
							<span class="pull-left">View Details</span>
							<span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
							<div class="clearfix"></div>
						</div>
					</a>
				</div>
			</div>
			<div class="col-lg-3 col-md-6">
				<div class="panel panel-red">
					<div class="panel-heading">
						<div class="row">
							<div class="col-xs-3">
								<i class="fa fa-users fa-5x"></i>
							</div>
							<div class="col-xs-9 text-right">
								<div class="huge"><?=$totalu?></div>
								<div>Total Distributor</div>
							</div>
						</div>
					</div>
					<a href="<?=$url?>supplier">
						<div class="panel-footer">
							<span class="pull-left">View Details</span>
							<span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
							<div class="clearfix"></div>
						</div>
					</a>
				</div>
			</div>
		</div>	
		<?php }?>		
	</div>
</div>