<?
	if($user_status > 0) {
?>

<?
//*********************************************************************************
// Original Website By : Niadesain.com Di Jual melalui http://niadesain.com
// Please Call / SMS : 081384745483 (support@niadesain.com)
// Niadesain.com - Jasa Pembuatan Website Paling Murah dan Paling Lengkap
//*********************************************************************************
?>
<style type="text/css">
<!--
.style5 {color: #CCCCCC; font-size: x-small; }
.style6 {color: #000000}
.style8 {font-size: 9px}
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
.style9 {
	color: #000066;
	font-weight: bold;
}
.style14 {color: #333333; font-size: 11px; font-family: Verdana, Arial, Helvetica, sans-serif; }
.style16 {
	color: #FF0000;
	font-size: 11px;
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-weight: bold;
}
.style22 {
	color: #FF0000;
	font-weight: bold;
}
.style21 {color: #333333; font-size: 12px; font-family: Verdana, Arial, Helvetica, sans-serif; }
.style23 {
	color: #333333;
	font-size: 14px;
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-weight: bold;
}
	.blink { animation: blink-animation 1s steps(2, start) infinite; -webkit-animation: blink-animation 1s steps(2, start) infinite; } @keyframes blink-animation { to { visibility: hidden; } } @-webkit-keyframes blink-animation { to { visibility: hidden; } }
-->
</style>
<div class="ch00">
  <table width="575" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td height="35" colspan="3"><div align="center" class="style9"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">FORM AMBIL KOMISI </font></div></td>
    </tr>
    <tr>
      <td width="10">&nbsp;</td>
      <td><p>
        <?
//$tgaktif = $db->dataku("tglaktif", $user_session);
$paket = $db->dataupline("paket", $user_session);
$db->select("tglbayar", "komisi", "username='$user_session'", "tglbayar asc");
$row=$db->fetch_row();		
$dtfrom2 = $row[0];
$dtto = date("Y-m-d H:i:s");
if($paket > 1 AND $paket <=3) {		
	$total0 = $db->totalkomisi($user_session, "AND (tglbayar BETWEEN '$dtfrom2' AND '$dtto') and status=0 ");
	$widrl = $db->bayarkomisi($user_session, "AND (tglbayar BETWEEN '$dtfrom2' AND '$dtto')");
	$total01 = $db->totalkomisi("$user_session-01", "AND (tglbayar BETWEEN '$dtfrom2' AND '$dtto') and status=0 ");
	$widrl01 = $db->bayarkomisi("$user_session-01", "AND (tglbayar BETWEEN '$dtfrom2' AND '$dtto')");
	$total02 = $db->totalkomisi("$user_session-02", "AND (tglbayar BETWEEN '$dtfrom2' AND '$dtto') and status=0 ");
	$widrl02 = $db->bayarkomisi("$user_session-02", "AND (tglbayar BETWEEN '$dtfrom2' AND '$dtto')");
	
	$totale = ($total0 + $total01 + $total02);
	$widrle = ($widrl + $widrl01 + $widrl02);
	$tarik = $totale - $widrle;

} elseif($paket > 3 AND $paket <=7) {		
	$total0 = $db->totalkomisi($user_session, "AND (tglbayar BETWEEN '$dtfrom2' AND '$dtto') and status=0 and ");
	$widrl = $db->bayarkomisi($user_session, "AND (tglbayar BETWEEN '$dtfrom2' AND '$dtto')");
	$total01 = $db->totalkomisi("$user_session-01", "AND (tglbayar BETWEEN '$dtfrom2' AND '$dtto') and status=0 ");
	$widrl01 = $db->bayarkomisi("$user_session-01", "AND (tglbayar BETWEEN '$dtfrom2' AND '$dtto')");
	$total02 = $db->totalkomisi("$user_session-02", "AND (tglbayar BETWEEN '$dtfrom2' AND '$dtto') and status=0 ");
	$widrl02 = $db->bayarkomisi("$user_session-02", "AND (tglbayar BETWEEN '$dtfrom2' AND '$dtto')");
	$total03 = $db->totalkomisi("$user_session-03", "AND (tglbayar BETWEEN '$dtfrom2' AND '$dtto') and status=0 ");
	$widrl03 = $db->bayarkomisi("$user_session-03", "AND (tglbayar BETWEEN '$dtfrom2' AND '$dtto')");
	$total04 = $db->totalkomisi("$user_session-04", "AND (tglbayar BETWEEN '$dtfrom2' AND '$dtto') and status=0 ");
	$widrl04 = $db->bayarkomisi("$user_session-04", "AND (tglbayar BETWEEN '$dtfrom2' AND '$dtto')");
	$total05 = $db->totalkomisi("$user_session-05", "AND (tglbayar BETWEEN '$dtfrom2' AND '$dtto') and status=0 ");
	$widrl05 = $db->bayarkomisi("$user_session-05", "AND (tglbayar BETWEEN '$dtfrom2' AND '$dtto')");
	$total06 = $db->totalkomisi("$user_session-06", "AND (tglbayar BETWEEN '$dtfrom2' AND '$dtto') and status=0 ");
	$widrl06 = $db->bayarkomisi("$user_session-06", "AND (tglbayar BETWEEN '$dtfrom2' AND '$dtto')");
	
	
	$totale = ($total0 + $total01 + $total02 + $total03 + $total04 + $total05 + $total06);
	$widrle = ($widrl + $widrl01 + $widrl02 + $widrl03 + $widrl04 + $widrl05 + $widrl06);
	$tarik = $totale - $widrle;

} else {
	$total0 = $db->totalkomisi($user_session, "AND (tglbayar BETWEEN '$dtfrom2' AND '$dtto') and status=0 ");
	$widrl = $db->bayarkomisi($user_session, "AND (tglbayar BETWEEN '$dtfrom2' AND '$dtto')");
	$tarik = $total0 - $widrl;
	$biayatrf = ($tarik)*($db->config("potpph"))/100;
	$potongan = $db->config("potadmin") + $biayatrf;
	$tarik2 = $tarik - $potongan;
	$minimalwd = $db->config("minwd") + 10000;
$totale = $total0;
$hpadminnya = $db->config("hpsms");
}	
?>
</p>
          <div id="module"> <font color="#FF6600">
            <?
if( $kirim == "submit") {
	$db->select("rp", "transfer", "userid='$user_session'");
	$tp = 0;
	$sql = mysql_query("select rp from transfer where userid='$user_session'");
	$hit = mysql_num_rows($sql);
	while($row=$db->fetch_row()) {
		$tp = $tp + $row[0];
	}
	if($komisi <= $db->config("minwd")) {
            warning("Maaf, komisi yang anda masukkan belum mencukupi untuk ditransfer!<br>Silahkan Ulangi lagi!<br>Komisi anda : ".rupiah($tarik)."");
            return false;
        }
	$pending = $totale - $tp;
	$kode = kwitansi();	
	if($komisi <= $pending) {
		if($tujuan == "E-walet") {
			$st = 1;
			$pesanx = "Komisi Anda telah berhasil ditransfer ke akun E-walet Anda.";
			$tgbyr = $clientdate;
			$biayatrf = ($komisi)*($db->config("potpph"))/100;
	        $potongan = $db->config("potadmin") + $biayatrf;
	        $tarik2 = $komisi - $potongan;
			$wdnyak = $tarik2;		
			$db->insert("dataewalet", "", "'', '$kode', 'admin-1', '$wdnyak', 'Transfer komisi', '$user_session', '$clientdate', 1"); 
			$db->insert("kwitansi", "", "'', '$kode', '$ket', '$clientdate'");
		} else {
			$st = 0;
			$pesanx = "Permintaan penarikan komisi telah terkirim.";
		}	
			//require_once('signup2.php');	
	   if($komisi >= $db->config("minwd") && $komisi <= $tarik) {
	   $feekomisi=(($komisi)*(95)/100);
		$db->insert("transfer", "", "'', '$user_session', '$clientdate', '$tgbyr', '$komisi', $st, '$tujuan', '$kode'");
		echo "<p align=center><b>$pesanx</b></p>"; 
		//require_once('signup2.php');	
	   } else {
		// Insert your code for showing an error message here
		//echo "<p align=center><font color="#FF6600"><b>Maaf, komisi anda belum mencukupi untuk ditransfer atau angka yang anda masukkan melebihi jumlah komisi anda!</font>";
			warning("Maaf, komisi yang anda masukkan belum mencukupi untuk ditransfer!<br>Silahkan Ulangi lagi!<br>Komisi anda : ".rupiah($tarik)."");
			
	?>
          </font> </div>
          <form action="" method="post" name="form1" id="form1">
            <table width="535" border="0" align="center" cellpadding="2" cellspacing="0">
              <tr>
                <td align="right"><div align="center" class="style8"><font color="#000000" size="2" face="Arial, Helvetica, sans-serif"><strong>Masukkan jumlah komisi yang akan diminta : </strong></font><font size="2" face="Arial, Helvetica, sans-serif"><br />
                        <span class="style6"><strong>Minimum Withdrawl (Rp 100.000)</strong></span></font><br />
                        <span class="style16">Masukkan nominal diatas 100000, misal 110000 </span></div></td>
              </tr>
              <tr>
                <td align="right"><div align="center"> <font size="2" face="Arial, Helvetica, sans-serif">
                  <input name="kirim" type="hidden" id="kirim" value="submit" size="10" />
                    <em style="font-size:10px"><br>
                </em></font></div></td>
              </tr>
              <tr>
                <td align="right"><div align="center" class="style5">
                    <p><font color="#000000" size="2" face="Arial, Helvetica, sans-serif">(tanpa tanda titik, misal 150000) </font></p>
                </div></td>
              </tr>
              <tr>
                <td align="right"><font size="2" face="Arial, Helvetica, sans-serif">&nbsp;</font></td>
              </tr>
              <tr>
                <td align="right"><div align="center" class="style8"><font color="#333333" size="2" face="Arial, Helvetica, sans-serif"><strong>Komisi tersebut ditransfer ke :</strong></font></div></td>
              </tr>
              <tr>
                <td align="right"><font size="2" face="Arial, Helvetica, sans-serif">
                  <label> </label>
                  </font>
                    <div align="center"> <font size="2" face="Arial, Helvetica, sans-serif">
                      <select name="tujuan" id="tujuan">
                        <option value="bank" selected><?= $db->dataku("bank",$user_session)?></option>
                      </select>
                  </font></div></td>
              </tr>
              <tr>
                <td align="center"><div align="center"><font size="2"><font face="Verdana, Arial, Helvetica, sans-serif"><font face="Arial, Helvetica, sans-serif"></font></font></font></div>
                    <font size="2" face="Arial, Helvetica, sans-serif">
                    <input type="submit" name="Submit" value="KIRIMKAN KOMISI SAYA" class="tombol" />
                  </font></td>
              </tr>
            </table>
          </form>
          <p>
            <?		
		}		
   } else {
   		$err = 1;
		$error = "<p align=center  style='color:#FF6600'><b>Maaf, komisi yang anda minta melebihi jumlah komisi yang dimiliki atau Anda telah melakukan penarikan komisi dan saat ini statusnya Pending!</b></font></p>";
	}	
} else {


?>
</p>
          <div align="center"><strong><font size="2" face="tahoma,verdana,arial,helvetica,sans-serif">KOMISI YANG DAPAT DITARIK: </font></strong></div>
          <table width="200" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#FF9933">
            
            <tr>
              <td height="25" align="center" bordercolor="#FFFFFF" bgcolor="#FF9933"><font color="#FF9900" class="style23"><font color="#000000"><?= rupiah($tarik); ?></font></font></td>
            </tr>
          </table>
          <div id="totkom">
            <div align="center"></div>
          </div>          
          <form action="" method="post" name="form1" id="form1">
            <table width="535" border="0" align="center" cellpadding="2" cellspacing="0">
              <tr>
                <td align="right"><div align="center">
                    <p><span class="style8"><font color="#000000" size="2" face="Arial, Helvetica, sans-serif"><strong>Masukkan jumlah komisi yang akan diminta : </strong></font><font size="2" face="Arial, Helvetica, sans-serif"><br />
                          <span class="style6"><strong>Minimum Withdrawl (</strong></span></font><font color="#FF9900"><strong><font color="#000000"><strong><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
                          <?= rupiah($db->config("minwd")); ?>
                          </font></strong></font></strong></font><font size="2" face="Arial, Helvetica, sans-serif"><span class="style6"><strong>)</strong></span></font><br />
                          <span class="style16">Masukkan nominal diatas </span></span><span class="style16"><span class="style22"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><?= rupiah($db->config("minwd")); ?>
                          </font></span></span><span class="style8"><span class="style16">, misal <font size="2" face="Verdana, Arial, Helvetica, sans-serif">
                          <?= rupiah($minimalwd); ?>
                          </font> </span></span></p>
                </div></td>
              </tr>
              <tr>
                <td align="right"><div align="center"> <font size="2" face="Verdana, Arial, Helvetica, sans-serif">
					<script>
  function test_fn(test_value) {
    var test_value = test_value.replace(/[^0-9]+/g, "");
    document.getElementById("komisi").value = test_value;
  }
</script>
                    <input name="komisi" type="number" id="komisi" onKeyUp="test_fn(this.value)" size="20" />
                    <input name="kirim" type="hidden" id="kirim" value="submit" size="10" />
                </font></div></td>
              </tr>
              <tr>
                <td align="right"><div align="center"><span class="style5">
                <div class="blink";><font color="#000000" size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong style="color: #F8080C">--Tanpa tanda baca--</strong></font></div>
                </span><span style="color: #0B0B0B">                Cukup tulis seperti ini: <span style="color: #F70408"><strong></strong></span></span><span style="color: #F70408"><strong><span class="style5"><font color="#000000" size="2" face="Verdana, Arial, Helvetica, sans-serif" style="color: #EF1115">
                <?= $minimalwd ?>
                </font></span></strong><span class="style5"><font color="#000000" size="2" face="Verdana, Arial, Helvetica, sans-serif"></font></span></span></div></td>
              </tr>
              <tr>
                <td align="right" bgcolor="#FFFFCC"><div align="center"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Komisi yang diterima akan dikurangi: PPH <span class="style21">
                  <?= $db->config("potpph"); ?>
                  %</span> Dan biaya transfer</font><font color="#FF9900"><strong><font color="#000000"><strong><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
  <?= rupiah($db->config("potadmin")); ?>
  </font></strong></font></strong></font><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> <br />
  </font><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> </font></div></td>
              </tr>
              <tr>
                <td align="right"><div align="center" class="style8"><font color="#333333" size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Komisi tersebut ditransfer ke :</strong></font></div></td>
              </tr>
              <tr>
                <td align="right"><div align="center"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
                  <label>
                          <select name="tujuan" id="tujuan">
                            <option value="Rekening Bank" selected><?= $db->dataku("bank",$user_session)?></option>
                          </select>
                  </label>
                </font></div></td>
              </tr>
              <tr>
                <td align="center"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">&nbsp;</font></td>
              </tr>
              <tr>
                <td align="center"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
                  <input type="submit" name="Submit" value="KIRIMKAN KOMISI SAYA" class="tombol" />
                </font></td>
              </tr>
              <tr>
                <td align="center"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">&nbsp;</font></td>
              </tr>
              <tr>
                <td align="center"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">&nbsp;</font></td>
              </tr>
            </table>
          </form>          <p>
            <?
 }
 	if($err == 1) echo $error;
 ?>
          </p>
          <h2 align="center"><font color="#FF6633">WITHDRAWL HISTORY</font> </h2>
          <table width="100%" border="1" align="center" cellpadding="1" cellspacing="0">
            <tr class="tbl_header">
              <td width="5%" align="center"><span class="style14">NO.</span></td>
              <td width="16%" align="center"><span class="style14">TGL</span></td>
              <td width="16%" align="center"><span class="style14">JUMLAH WD</span></td>
			  <td width="16%" align="center"><span class="style14">DITERIMA</span></td>
              <td width="21%" align="center"><span class="style14">TRANSFER KE</span></td>
              <td width="16%" align="center"><span class="style14">STATUS</span></td>
            </tr>
            <?	
$db->select("tglminta, rp, status, tglbayar, tujuan", "transfer", "userid='$user_session'", "tglbayar");
$nom=1;
while($row=$db->fetch_row()) {
	if(is_odd($nom) > 0) {
		$class = "tblrow_ganjil";
	} else {
		$class = "tblrow_genap";
	} 
	if($row[2] > 0) {
		$status = "<b>Sukses</b>";
	} else {
		$status = "Pending";
	}	
$biayatrf = ($row[1])*($db->config("potpph"))/100;
$potongan = $db->config("potadmin") + $biayatrf;
$wdnya = ($row[1]) - $potongan;			
	echo "<tr class=$class>
       <td class='style6' align=center>$nom.</td>
       <td class='style6' align=center>".date("d-m-Y", strtotime($row[0]))."</td>
       <td class='style6' align=center>".rupiah($row[1])."</td>
	   <td class='style6' align=center>".rupiah($wdnya)."</td>
       <td class='style6' align=center>$row[4]</td>
	    <td class='style6' align=center>$status</td>
     </tr>";
	 $nom++;
}	 
?>
      </table>          
          <p>&nbsp; </p></td>
      <td width="10">&nbsp;</td>
    </tr>
    <tr>
      <td colspan="3">&nbsp;</td>
    </tr>
  </table>
</div>
<div class="cc01">
<div id="module">
  <p>
    <?
} else {
echo "<meta http-equiv=\"refresh\" content=\"1; url=illegal.html\">";
}
?>
    <script language="JavaScript" type="text/javascript">
 var frmvalidator = new Validator("form1");
  frmvalidator.addValidation("komisi","req","Berapa jumlah komisi yang anda minta?");
   </script>
  </p>
  <script language="JavaScript" type="text/javascript">
 var frmvalidator = new Validator("form1");
  frmvalidator.addValidation("komisi","req","Berapa jumlah komisi yang anda minta?");
   </script>
</div>
</div>
