if ($eGiveFund[$fundId]) { $eGiveFund[$fundId] .= "," . $eGiveFundName; } else { $eGiveFund[$fundId] = $eGiveFundName; } if ($amount[$fundId]) { $amount[$fundId] += $totalAmount; } else { $amount[$fundId] = $totalAmount; } } if ($amount) { // eGive records can be 'zero' for two reasons: a) intentional zero to suspend giving, or b) rejected bank transfer ksort($amount, SORT_NUMERIC); $fundIds = implode(",", array_keys($amount)); $groupKey = genGroupKey($transId, $famID, $fundIds, $date); foreach ($amount as $fundId => $am) { $comment = $eGiveFund[$fundId]; if ($famID) { updateDB($famID, $transId, $date, $name, $am, $fundId, $comment, $frequency, $groupKey); } else { $missingValue = $transId . "|" . $date . "|" . $egiveID . "|" . $name . "|" . $am . "|" . $fundId . "|" . $comment . "|" . $frequency . "|" . $groupKey; $giftDataMissingEgiveID[] = $missingValue; ++$importError; } } } } } } $url = $eGiveURL . "/api/logout/?apiKey=" . $eGiveApiKey;
$sSQL = "SELECT * FROM autopayment_aut WHERE " . $enableStr . " AND aut_NextPayDate<='" . date('Y-m-d') . "'"; $rsAuthorizedPayments = RunQuery($sSQL); while ($aAutoPayment = mysql_fetch_array($rsAuthorizedPayments)) { extract($aAutoPayment); if ($dep_Type == "CreditCard") { $method = "CREDITCARD"; } else { $method = "BANKDRAFT"; } $dateToday = date("Y-m-d"); $amount = $aut_Amount; $FYID = $aut_FYID; $interval = $aut_Interval; $fund = $aut_Fund; $authDate = $aut_NextPayDate; $sGroupKey = genGroupKey($aut_ID, $aut_FamID, $fund, $dateToday); // Check for this automatic payment already loaded into this deposit slip $sSQL = "SELECT plg_plgID FROM pledge_plg WHERE plg_depID=" . $dep_ID . " AND plg_aut_ID=" . $aut_ID; $rsDupPayment = RunQuery($sSQL); $dupCnt = mysql_num_rows($rsDupPayment); if ($amount > 0.0 && $dupCnt == 0) { $sSQL = "INSERT INTO pledge_plg (plg_FamID, \n\t\t\t\t\t\t\t\t\t\t\tplg_FYID, \n\t\t\t\t\t\t\t\t\t\t\tplg_date, \n\t\t\t\t\t\t\t\t\t\t\tplg_amount, \n\t\t\t\t\t\t\t\t\t\t\tplg_method, \n\t\t\t\t\t\t\t\t\t\t\tplg_DateLastEdited, \n\t\t\t\t\t\t\t\t\t\t\tplg_EditedBy, \n\t\t\t\t\t\t\t\t\t\t\tplg_PledgeOrPayment, \n\t\t\t\t\t\t\t\t\t\t\tplg_fundID, \n\t\t\t\t\t\t\t\t\t\t\tplg_depID,\n\t\t\t\t\t\t\t\t\t\t\tplg_aut_ID,\n\t\t\t\t\t\t\t\t\t\t\tplg_CheckNo,\n\t\t\t\t\t\t\t\t\t\t\tplg_GroupKey)\n\t\t\t\t\t\t\t\tVALUES (" . $aut_FamID . "," . $FYID . "," . "'" . date("Y-m-d") . "'," . $amount . "," . "'" . $method . "'," . "'" . date("Y-m-d") . "'," . $_SESSION['iUserID'] . "," . "'Payment'," . $fund . "," . $dep_ID . "," . $aut_ID . "," . $aut_Serial . "," . "'" . $sGroupKey . "')"; RunQuery($sSQL); } } } else { if (isset($_POST["DepositSlipRunTransactions"])) { $dDate = FilterInput($_POST["Date"]); $sComment = FilterInput($_POST["Comment"]); if (array_key_exists("Closed", $_POST)) { $bClosed = FilterInput($_POST["Closed"]);
} if (!$sGroupKey) { if ($iMethod == "CHECK") { $sGroupKey = genGroupKey($iCheckNo, $iFamily, $fun_id, $dDate); } elseif ($iMethod == "BANKDRAFT") { if (!$iAutID) { $iAutID = "draft"; } $sGroupKey = genGroupKey($iAutID, $iFamily, $fun_id, $dDate); } elseif ($iMethod == "CREDITCARD") { if (!$iAutID) { $iAutID = "credit"; } $sGroupKey = genGroupKey($iAutID, $iFamily, $fun_id, $dDate); } else { $sGroupKey = genGroupKey("cash", $iFamily, $fun_id, $dDate); } } $sSQL = "INSERT INTO pledge_plg (plg_famID, plg_FYID, plg_date, plg_amount, plg_schedule, plg_method, plg_comment, plg_DateLastEdited, plg_EditedBy, plg_PledgeOrPayment, plg_fundID, plg_depID, plg_CheckNo, plg_scanString, plg_aut_ID, plg_NonDeductible, plg_GroupKey)\n\t\t\tVALUES ('" . $iFamily . "','" . $iFYID . "','" . $dDate . "','" . $nAmount[$fun_id] . "','" . $iSchedule . "','" . $iMethod . "','" . $sComment[$fun_id] . "'"; $sSQL .= ",'" . date("YmdHis") . "'," . $_SESSION['iUserID'] . ",'" . $PledgeOrPayment . "'," . $fun_id . "," . $iCurrentDeposit . "," . $iCheckNo . ",'" . $tScanString . "','" . $iAutID . "','" . $nNonDeductible[$fun_id] . "','" . $sGroupKey . "')"; } if ($sSQL) { RunQuery($sSQL); unset($sSQL); } } // end foreach of $fundId2Name if (isset($_POST["PledgeSubmit"])) { // Check for redirection to another page after saving information: (ie. PledgeEditor.php?previousPage=prev.php?a=1;b=2;c=3) if ($linkBack != "") { Redirect($linkBack);