<?

require_once("../dasar/session.php");
require_once("conn.php");
$menu1='active';
$nama = '';
$tgl_aktivitas = '';

$kode = $_SESSION['kode'];
require_once("general.php");

$idate=date('Y-m-d');
$conn=mysqli_connect("$host","$user","$pass") or die("koneksi gagal");
mysqli_select_db($conn,"$db");

$query = mysqli_query($conn,"SELECT * FROM mutasi where kode_reseller='$kode' order by kode desc");
$record = mysqli_fetch_array($query);
$saldo = $record['saldo_akhir'];
$saldo =number_format($saldo,0,',','.');

$query2 = mysqli_query($conn,"SELECT * FROM komisi where kode_reseller='$kode'");
$record2 = mysqli_fetch_array($query2);
$komisi = $record2['jumlah'];
$komisi=number_format($komisi,0,',','.');


$exe = mysqli_query($conn,"SELECT * FROM reseller where kode ='$kode'");
while($record = mysqli_fetch_array($exe)){
                       

$nama = $record['nama'];
$tgl_aktivitas = $record['tgl_aktivitas'];
$ipoin = $record['poin'];
$poin = number_format($ipoin,0,',','.');

}
?>
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="description" content="">
        <meta name="author" content="">

        <title>Selamat datang di Web Report Linkup Tronik</title>

        <!-- Bootstrap Core CSS -->
        <link href="../css/bootstrap.min.css" rel="stylesheet">

        <!-- MetisMenu CSS -->
        <link href="../css/metisMenu.min.css" rel="stylesheet">

        <!-- Custom CSS -->
        <link href="../css/startmin.css" rel="stylesheet">

        <!-- Custom Fonts -->
        <link href="../css/font-awesome.min.css" rel="stylesheet" type="text/css">
 <link rel="icon" href="../favicon.ico" type="image/icon"/>
        <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
        <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
        <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
        <![endif]-->
    </head>
    <body>

        <div id="wrapper">

            <?
			require_once("nav.php");
			?>

            <div id="page-wrapper">
                <div class="row">
                    <div class="col-lg-12">
                        <h1 class="page-header">Selamat Datang</h1>
                    </div>
                    <!-- /.col-lg-12 -->
                </div>
                <!-- /.row -->
                <div class="row">
					<div class="col-lg-9 col-md-6">
						<div class="col-xs-12">
							<h3><i class="fa fa-user"></i>&nbsp;&nbsp;<? echo $kode ;?> - <? echo $nama ;?></h3><br>
							<i class="fa fa-pencil-square-o fa-fw"></i>&nbsp;&nbsp;Aktivitas Terakhir : <? echo $tgl_aktivitas ;?><br>
							<i class="fa fa-dollar fa-fw"></i>&nbsp;&nbsp;Saldo saat ini         : Rp <? echo $saldo ;?><br>
							<i class="fa fa-money fa-fw"></i>&nbsp;&nbsp;Komisi         : Rp <? echo $komisi ;?><br>
							<i class="fa fa-star-o fa-fw"></i>&nbsp;&nbsp;Poin         : <? echo $poin ;?>
						</div>
					</div>
					<!--<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>Saldo Rp</div>
										<div class="huge"><? echo $saldo ;?></div>
                                        
                                    </div>
                                </div>
                            </div>
                            
                        </div>
                    </div>-->
				</div>
				<hr>

				<div class="row">
					<div class="col-lg-3 col-md-6" title="Transaksi sukses hari ini">
                        <div class="panel panel-primary">
                            <div class="panel-heading">
                                <div class="row">
                                    <div class="col-xs-3">
                                        <i class="fa fa-check-square-o fa-5x"></i>
                                    </div>
                                    <div class="col-xs-9 text-right">
                                        <div class="huge"><? echo $lsukses; ?></div>
                                        <div>Transaksi Sukses</div>
                                    </div>
                                </div>
                            </div>
                            <a href="#">
                               
                            </a>
                        </div>
                    </div>
                    <div class="col-lg-3 col-md-6" title="Transaksi gagal hari ini">
                        <div class="panel panel-red">
                            <div class="panel-heading">
                                <div class="row">
                                    <div class="col-xs-3">
                                        <i class="fa fa-times-circle-o fa-5x"></i>
                                    </div>
                                    <div class="col-xs-9 text-right">
                                        <div class="huge"><? echo $lgagal; ?></div>
                                        <div>Transaksi Gagal</div>
                                    </div>
                                </div>
                            </div>
                            <a href="#">
                                
                            </a>
                        </div>
                    </div>
                    <div class="col-lg-3 col-md-6" title="Transaksi pending hari ini">
                        <div class="panel panel-yellow">
                            <div class="panel-heading">
                                <div class="row">
                                    <div class="col-xs-3">
                                        <i class="fa fa-question-circle-o fa-5x"></i>
                                    </div>
                                    <div class="col-xs-9 text-right">
                                        <div class="huge"><? echo $lpend; ?></div>
                                        <div>Transaksi Pending</div>
                                    </div>
                                </div>
                            </div>
                            <a href="#">
                                
                            </a>
                        </div>
                    </div>
                    <div class="col-lg-3 col-md-6" title="Total transaksi hari ini">
                        <div class="panel panel-green">
                            <div class="panel-heading">
                                <div class="row">
                                    <div class="col-xs-3">
                                        <i class="fa fa-chevron-circle-right fa-5x"></i>
                                    </div>
                                    <div class="col-xs-9 text-right">
                                        <div class="huge"><? echo $ltotal; ?></div>
                                        <div>Semua Transaksi</div>
                                    </div>
                                </div>
                            </div>
                            <a href="#">
                                
                            </a>
                        </div>
                    </div>
                </div>
				<hr>
                <!-- /.row -->
                
                <div class="row">
                    
                    <?
                    $berita = mysqli_query($conn,"SELECT * FROM berita");
                    $no = 1;
					while($record = mysqli_fetch_array($berita)){
                       
                        $judul = $record['judul'];
                        $isi = $record['isi'];
                        
                        
                        if ($no==1)
                        {
                            $bg='panel-green';
                        }
                        else if($no==2)
                        {
                            $bg='panel-yellow';
                        }
                        else
                        {
                            $bg='panel-red';
                        }
                        $no++;
    				    ?>
                        <div class="col-lg-4">
                            <div class="panel <? echo $bg;?>">
                                <div class="panel-heading">
                                    <? echo $judul;?>
                                </div>
                                <div class="panel-body">
                                    <p><? echo $isi;?></p>
                                </div>
                                <!--<div class="panel-footer">
                                    Panel Footer
                                </div> -->
                            </div>
                            <!-- /.col-lg-4 -->
                        </div>
                        
                    <?
					    }
					?>
                </div>
                <!-- /.row -->
               
            </div>
            <!-- /#page-wrapper -->

        </div>
        <!-- /#wrapper -->

        <!-- jQuery -->
        <script src="../js/jquery.min.js"></script>

        <!-- Bootstrap Core JavaScript -->
        <script src="../js/bootstrap.min.js"></script>

        <!-- Metis Menu Plugin JavaScript -->
        <script src="../js/metisMenu.min.js"></script>

        <!-- Custom Theme JavaScript -->
        <script src="../js/startmin.js"></script>
    <?
        include 'chat.php';
    ?>
    </body>
</html>
