<?php
ob_start();
(@include ('../dt_page/lic.php')) or die("<script>alert(\"You not have a license to use this script on this domain, Please contact www.primadesain.com to purchase a license.\");"."window.location = './index.php'</script>");
$lic=$license;if(!$lic){echo "<script>alert(\"You not have a license to use this script on this domain, Please contact www.primadesain.com to purchase a license.\");"."window.location = './index.php'</script>";}$svr=$_SERVER['SERVER_NAME'];$c=curl_init();curl_setopt($c,CURLOPT_URL,"http://www.primadesain.com/verifylicenses.php");curl_setopt($c,CURLOPT_TIMEOUT,30);curl_setopt($c,CURLOPT_POST,1);curl_setopt($c,CURLOPT_RETURNTRANSFER,1);$postfields='svr='.$svr.'&lic='.$lic;curl_setopt($c,CURLOPT_POSTFIELDS,$postfields);$result=curl_exec($c);if($result=="fail"){echo "<script>alert(\"You not have a license to use this script on this domain, Please contact www.primadesain.com to purchase a license.\");"."window.location = './index.php'</script>";die();}
if (basename($_SERVER['SCRIPT_FILENAME']) == basename(__FILE__)){
echo "<p align=center><br><br><br><br><br><br><font size=\"6\" color=\"#FF0000\">ILLEGAL ACCESS !!";
echo "<meta http-equiv=\"refresh\" content=\"2; url=../index.php\">";
exit();} 
?>
  <!-- Content Header (Page header) -->
    <section class="content-header">
      <h1>
        Wallet 
      </h1>
      <ol class="breadcrumb">
        <li class="breadcrumb-item"><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
        <li class="breadcrumb-item active">Virtual Balance</li>
      </ol>
    </section>


    <section class="content">
    
<?php 
$server = $_SERVER['SERVER_NAME'];

$c = curl_init(); 
// Set the full url path to point to your verifyLicense.php on your server 
curl_setopt($c, CURLOPT_URL, "http://www.primadesain.com/verifydomains.php"); 
curl_setopt($c, CURLOPT_TIMEOUT, 30); 
curl_setopt($c, CURLOPT_POST, 1); 
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); 

$postfields = 'svr='.$server; 
curl_setopt($c, CURLOPT_POSTFIELDS, $postfields); 
$result = curl_exec($c); 

if ($result=="fail") { 
echo "<p style='font-family:Arial, Helvetica, sans-serif; margin-top:80px; font-size:16px; line-height:180%; letter-spacing:2px;' align='center'><img src='https://primadesain.com/images/block.png' width='90' height='90' /></br></br>You not have a license to use this script on this domain,<br>Please contact us to purchase a license.<br><strong><a href='http://www.primadesain.com'>www.primadesain.com</a></strong></p><br><p style='font-family:Arial, Helvetica, sans-serif; margin-top:30px; font-size:12px; line-height:180%; letter-spacing:2px;' align='center'>&copy; 2009 - ".date ("Y")." www.primadesain.com</p>";
die(); }
?>

<?php
if($db->dataku("status", $user_session) == 0 || $db->dataku("blokir", $user_session) == 1) {
echo "<div class='alert alert-danger alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'></button>".$LANG["status0"]."</div>";
}else{
?>

    <div class="row">
            	<div class="col-md-12">
                
                  <div class="box box-solid bg-dark">
            <div class="box-header with-border">
              <h3 class="box-title">Virtual Balance [<?  $saldoawalete = $db->myswalet($user_session);
			 $pendingawalete = $db->myswaletpending($user_session);
			 $totalawalete = $saldoawalete-$pendingawalete; 
			 if($totalawalete > 0){ echo rupiah($totalawalete); }else{ echo rupiah(0);} ?>]</h3>
            </div>
            <!-- /.box-header -->
            <div class="box-body">
				<div class="table-responsive">
				  <table id="example" class="table table-bordered table-hover display nowrap margin-top-10 w-p100">            
                
     <thead class="bg-primary-600"> 
												<tr>
													<th width="10%">NO</th>
							<th width="20%">DATE</th>
							<th width="10%">TYPE</th>
							<th width="20%">AMOUNT</th>
							<th width="30%">NOTE</th>
							<th width="6%">STATUS</th>
												</tr>
											</thead>
											<tbody> 
      
                
	<?
if($_GET["co"]){ 
	$db->select("kode, uraian, username, jumlah, tujuan, tgl, status, tglproses, accid, accid2", "dataswalet", "username='$user_session' and kode='".$_GET["co"]."' or tujuan='$user_session' and kode='".$_GET["co"]."'", "tgl desc");
}else{
	$db->select("kode, uraian, username, jumlah, tujuan, tgl, status, tglproses, accid, accid2", "dataswalet", "username='$user_session' or tujuan='$user_session'", "tgl desc");
}
	
		while($row=$db->fetch_row()) {
			if($row[2] == "admin-1") {
				$user = "admin";
			} else {
				$user = $row[2];
			}		
			if($row[4] == $user_session) {
				$ket = "$row[1]";
			} else {
				$ket = 	"$row[1]";
			}
			if($row[2] == $user_session) {
				$type = "<span class='btn btn-warning btn-xs' style='font-size:11px'>Debet</span>";
			} else {
				$type = "<span class='btn btn-primary btn-xs' style='font-size:11px'>Credit</span";
			}	
			if(is_odd($nom) == 0) {
				$class = "tblrow_ganjil";
			} else {
				$class = "tblrow_genap";
			} 	
			if($row[7] == "0000-00-00 00:00:00"){
		$dtpros = "<span class='btn btn-success btn-xs' style='font-size:11px'>Done</span>";
	}else{
		$dtpros = "<span class='btn btn-success btn-xs' style='font-size:11px'>Done</span>";
	}
			if($row[6] > 0) {
				$st = $dtpros;
			} else {
				$st = "<span class='btn btn-danger btn-xs'>Pending</span>";
			}	
			
			if($row[2] == $user_session) {
				$style = "<font color='#FF6600'>";
			} else {
				$style = "<font>";
			}		
			
		
	$cdo = $row[0];		
$sqlc = mysql_query("SELECT * FROM invoice WHERE kode='$cdo'");
$numc = mysql_num_rows($sqlc);
$rowc = mysql_fetch_array($sqlc);
$invc = $rowc['file'];			
				
?>
          <tr>
            <td align="center"><?php echo $style; ?><?= $row[0]; ?></font></td>
            <td align="center"><?php echo $style; ?><?= $row[5]; ?></font></td>
            <td align="center"><?php echo $style; ?><?= $type; ?></font></td>
            
            <td align="center"><?php echo $style; ?><?= rupiah($row[3]); ?></font></td>
            <td align="center"><?php echo $style; ?><?= $ket; ?></font></td>
           
            <td align="center"><?php echo $style; ?><?= $st; ?></font></td>
    </tr>
	<?
		}
	?>
              </tbody>
            </table>
                  </div>
                    </div>
                </div>
			</div>
            
			</div>
			<!-- END PAGE CONTENT -->       
   
   

   <?
   
}
   ?>
<?php ob_flush(); ?>