<?php
    include('../loginsession.php');
    error_reporting(E_ALL);
    $filename = __FILE__;  //---Nama file saat ini
    $filenameshort = $filename;
    if (strlen($filename) > 48) {$filenameshort = substr($filename, 48);}
    $save = mysqli_query($conn, "INSERT INTO novia_abc_user_logs (userid,filename) VALUES ('$userini_id','$filenameshort')");
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//ID" "http://www.w3.org/TR/html4/frameset.dtd">
<html lang="id">
<head>
	<title>CATATAN 01</title>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link href="../images/balance.ico" rel="icon" type="image/icon" />

	<style>
		body {
            margin: 0;
            background-color: #bbb;
            color : #fff;
            background-image : url('../images/main_bg.png');
            }
		a { text-decoration: none; color:inherit;}
		a:hover {color:#FF00FF;}
		.btn-pastel-green {
          background-color: #cdecbc; /* Hijau Pastel */
          border: none;
          color: #356859;
          padding: 10px 10px;
          text-align: center;
          text-decoration: none;
          display: inline-block;
          font-size: 21px;
          font-family: "Times New Roman";
          margin: 4px 2px;
          cursor: pointer;
          border-radius: 8px;
          transition-duration: 0.4s;
          width:48%;
        }

        .btn-pastel-green:hover {
          background-color: #9ab87a; /* Hijau Pastel yang lebih gelap */
          color: white;
        }
	
    </style>	
</head>
<body>
<br>
<a href="../coding/coding_main.php" title="Lihat Keuangan Hari ini"><button style="padding : 10px; width:100%; background-color:#546E7A;">CODING</button></a>
<br>
<br>
    <div><a href="../index.php"><img src="../images/logo_blue.png" alt="Deskripsi Gambar" width="100%" height="auto"></a></div>
    <?php
    
    
    $sql = "SELECT * FROM novia_abc_users ORDER BY id ASC";
    $result = $conn->query($sql);
    if ($result->num_rows > 0) {
        while($row = $result->fetch_assoc()) {
            $id = $row['id'];
            if ($id != 3){
    		//--------
                $TotalPinjaman = 0;
                $sql1 = "SELECT * FROM novia_abc_cash_loan WHERE userid = $id ORDER BY id ASC";
                $result1 = $conn->query($sql1);
                if ($result1->num_rows > 0) {
                    while($row1 = $result1->fetch_assoc()) {
                        $TotalPinjaman += $row1['nilai'];
                    }
                }
    		//--------
	?>
    	<button class="btn-pastel-green"><a href="cash-piutang-user.php?userid=<?php echo $row['id'] ?>" style="font-size:16px;" title="Total Piutang"><?php echo $row['name']."<br>Total = ".$TotalPinjaman ?></a></button>
	    
    <?php
            }
        }
    }
    ?>
    
    
    
    
</body>