Пример #1
0
//include the mail class to send the mails to new sign up
include '../class.mail.php';
$mail = new Mail();
//getting values from withdrawal form
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $frozen_amount = $_POST['frozen'];
    $withdraw = $_POST['withdraw'];
    $membership_id = $_POST['membership_id'];
}
//initialize the total amount
$amount = 0;
$withdraw_amount = 0;
//checking for frozen money or not
if ($frozen_amount == 0) {
    //getting the debited amount from database
    $transactions = $managedata->getValue_twoCoditions("money_transfer_log", "*", "membership_id", $membership_id, "frozen_money", 0);
    //getting the amount debited to that member
    foreach ($transactions as $transaction) {
        //only debited values
        if (!empty($transaction['debit'])) {
            $amount = $amount + $transaction['debit'];
        }
    }
    //getting the withdrawal amount from database
    $withdraws = $managedata->getValue_twoCoditions("withdraw_log", "*", "membership_id", $membership_id, "frozen_money", 0);
    //getting the amount withdrawal to that member
    if (!empty($withdraws[0])) {
        foreach ($withdraws as $withdrawal) {
            $withdraw_amount = $withdraw_amount + $withdrawal['withdraw_amount'];
        }
    }