Berkah Bersama Arafah

buku tabungan

A commitment to innovation and sustainability

Études is a pioneering firm that seamlessly merges creativity and functionality to redefine architectural excellence.

Building exterior in Toronto, Canada

A passion for creating spaces

Our comprehensive suite of professional services caters to a diverse clientele, ranging from homeowners to commercial developers.

Renovation and restoration

Experience the fusion of imagination and expertise with Études Architectural Solutions.

Continuous Support

Experience the fusion of imagination and expertise with Études Architectural Solutions.

App Access

Experience the fusion of imagination and expertise with Études Architectural Solutions.

Consulting

Experience the fusion of imagination and expertise with Études Architectural Solutions.

Project Management

Experience the fusion of imagination and expertise with Études Architectural Solutions.

Architectural Solutions

Experience the fusion of imagination and expertise with Études Architectural Solutions.

An array of resources

Our comprehensive suite of professional services caters to a diverse clientele, ranging from homeowners to commercial developers.

Études Architect App

  • Collaborate with fellow architects.
  • Showcase your projects.
  • Experience the world of architecture.
Tourist taking photo of a building
Windows of a building in Nuremberg, Germany

Études Newsletter

  • A world of thought-provoking articles.
  • Case studies that celebrate architecture.
  • Exclusive access to design insights.

“Études has saved us thousands of hours of work and has unlocked insights we never thought possible.”

Annie Steiner

CEO, Greenprint

Watch, Read, Listen

Join 900+ subscribers

Stay in the loop with everything you need to know.

<?php
/*
Template Name: Member Data Page
*/

// Fungsi untuk menampilkan form dan hasil data
function display_member_data() {
    global $wpdb;

    // Inisialisasi variabel
    $output = '';
    $member_number = '';

    // Cek jika form disubmit
    if (isset($_POST['member_number']) && !empty($_POST['member_number'])) {
        // Sanitasi input
        $member_number = sanitize_text_field($_POST['member_number']);

        // Query untuk mendapatkan data anggota
        $member = $wpdb->get_row($wpdb->prepare(
            "SELECT * FROM wp_members WHERE member_number = %s",
            $member_number
        ));

        // Query untuk mendapatkan mutasi tabungan
        $transactions = $wpdb->get_results($wpdb->prepare(
            "SELECT * FROM wp_transactions WHERE member_number = %s ORDER BY transaction_date DESC",
            $member_number
        ));

        // Cek jika anggota ditemukan
        if ($member) {
            $output .= '<h2>Data Anggota</h2>';
            $output .= '<p><strong>Nomor Anggota:</strong> ' . esc_html($member->member_number) . '</p>';
            $output .= '<p><strong>Nama:</strong> ' . esc_html($member->name) . '</p>';
            $output .= '<p><strong>Alamat:</strong> ' . esc_html($member->address) . '</p>';

            // Hitung total tabungan
            $total_savings = 0;
            foreach ($transactions as $transaction) {
                $total_savings += $transaction->amount;
            }
            $output .= '<p><strong>Total Tabungan:</strong> Rp ' . number_format($total_savings, 2, ',', '.') . '</p>';

            // Tampilkan mutasi tabungan
            if ($transactions) {
                $output .= '<h3>Mutasi Tabungan</h3>';
                $output .= '<table class="member-transactions">';
                $output .= '<tr><th>Tanggal</th><th>Nominal</th></tr>';
                foreach ($transactions as $transaction) {
                    $output .= '<tr>';
                    $output .= '<td>' . esc_html(date('d-m-Y', strtotime($transaction->transaction_date))) . '</td>';
                    $output .= '<td>Rp ' . number_format($transaction->amount, 2, ',', '.') . '</td>';
                    $output .= '</tr>';
                }
                $output .= '</table>';
            } else {
                $output .= '<p>Tidak ada mutasi tabungan untuk anggota ini.</p>';
            }
        } else {
            $output .= '<p>Nomor anggota tidak ditemukan.</p>';
        }
    }

    // Form input nomor anggota
    $output .= '<form method="post" action="">';
    $output .= '<label for="member_number">Masukkan Nomor Anggota:</label>';
    $output .= '<input type="text" name="member_number" id="member_number" value="' . esc_attr($member_number) . '" required>';
    $output .= '<input type="submit" value="Cek Data">';
    $output .= '</form>';

    return $output;
}

// Shortcode untuk menampilkan form dan data
add_shortcode('member_data', 'display_member_data');

// CSS untuk tabel
add_action('wp_head', function() {
    echo '<style>
        .member-transactions {
            width: 100%;
            border-collapse: collapse;
            margin-top: 20px;
        }
        .member-transactions th, .member-transactions td {
            border: 1px solid #ddd;
            padding: 8px;
            text-align: left;
        }
        .member-transactions th {
            background-color: #f2f2f2;
        }
        form {
            margin-bottom: 20px;
        }
        label {
            display: block;
            margin-bottom: 5px;
        }
        input[type="text"] {
            padding: 8px;
            width: 200px;
            margin-bottom: 10px;
        }
        input[type="submit"] {
            padding: 8px 16px;
            background-color: #0073aa;
            color: white;
            border: none;
            cursor: pointer;
        }
        input[type="submit"]:hover {
            background-color: #005177;
        }
    </style>';
});
?>
Scroll to Top