Location: PHPKode > projects > Gsys > treasury/add_payment.php
//Filename : add_payment.php
//Description : Add payment for individual users
//Author :  darc
//Last modified :  2006.12.24

    include '../includes/auth_ec.php';
    include '../includes/db.php';
    //If the form has been submitted.
    if($_POST["submitted"] == "TRUE")
         $pin_tmp = "";
         $pin_tmp = $_POST['member_name'];
         $amount =  $_POST['amount'];
         $added_by = $_POST['added_by'];
         $description = $_POST['description'];

        //Check for early payment checkbox
        if($_POST["early_payment"] == TRUE)
            $early_sql = "SELECT * FROM misc WHERE label = 'early_credit_amount'";
            $result = mysql_query($early_sql,$connection) or die(mysql_error());
            $early_credit = mysql_result($result, 0, 'data');
            $amount += $early_credit;

         $sql = "INSERT INTO financial (transaction_num, pin_num, amount, date_time, description, added_by) VALUES ('', '$pin_tmp', '$amount', NOW(), '$description', '$added_by');";
         $result = mysql_query($sql,$connection) or die(mysql_error());
         $success = "$$amount payment successfully added.<br /><br />";
         unset($pin_temp, $description, $added_by, $amount);
<head><title>Add Payment</title>
<link href="../includes/index.css" rel="stylesheet" type="text/css">

<body class="body">
<br />
<table width="810" height="626" border="0" align="center" cellpadding="15">
    <td height="128" colspan="2"><img src="../images/eg_banner.gif" width="810" height="172"></td>
    <td width="27%" height="488" valign="top"> <?php include '../includes/nav.inc'; ?></td>
    <td width="53%" valign="top">
    <br />
    <span class="success"><?PHP echo $success; ?></span>
    <br />

<strong>Add payment for specific member:</strong>
<br /><br />
<form method="post" action="add_payment.php">
<input type="hidden" name="added_by" value="<?php session_start(); echo $_SESSION[current_user]; ?>">

<strong>Member Name:</strong><SELECT NAME="member_name">

<?php  //populate list with active users
        $sql = "SELECT pin_num, l_name, f_name, status FROM brothers WHERE l_name != \"\" && status != \"alumnus\" ORDER BY l_name;";
         $result = mysql_query($sql,$connection) or die(mysql_error);
         while($row =mysql_fetch_array($result))
			$l_name = $row['l_name'];
			$f_name = $row['f_name'];
			$pin_num = $row['pin_num'];
			echo "<OPTION VALUE=\"$pin_num\">$l_name, $f_name";
<br /><br />
<INPUT TYPE="text" NAME="amount" SIZE="3"><br /><br />
<strong>Description:</strong><br />
<textarea cols="40" rows="5" name="description"></textarea>
<br />
    Early Payment?
        <input type="checkbox" name="early_payment">
<br />
<input type="hidden" name="submitted" value="TRUE" />
<INPUT TYPE="SUBMIT" NAME="submit" VALUE="Add Payment" />

<br /><br />
Add checkbox for option to send new charge notification to brothers.email with amount, description, and payment deadlines.
Return current item: Gsys