<?php

/*
* ____          _____   _____ ______ _____  
*|  _ \   /\   |  __ \ / ____|  ____|  __ \ 
*| |_) | /  \  | |  | | |  __| |__  | |__) |
*|  _ < / /\ \ | |  | | | |_ |  __| |  _  / 
*| |_) / ____ \| |__| | |__| | |____| | \ \ 
*|____/_/    \_\_____/ \_____|______|_|  \_\
* Open Source Financial Management
* Visit http://www.badger-finance.org 
*
**/
define('BADGER_ROOT', '../..');
require_once BADGER_ROOT . '/includes/fileHeaderFrontEnd.inc.php';
require_once BADGER_ROOT . '/modules/account/AccountManager.class.php';
require_once BADGER_ROOT . '/modules/account/accountCommon.php';
header('Content-Type: text/plain');
/*
$am = new AccountManager($badgerDb);
$account = $am->getAccountById(1);
$startDate = new Date();
$endDate = new Date('2006-03-31');

$values = getDailyAmount($account, $startDate, $endDate);

print_r($values);
*/
print_r(getSpendingMoney(1, new Date('2003-10-10')));
<?php

/*
* ____          _____   _____ ______ _____  
*|  _ \   /\   |  __ \ / ____|  ____|  __ \ 
*| |_) | /  \  | |  | | |  __| |__  | |__) |
*|  _ < / /\ \ | |  | | | |_ |  __| |  _  / 
*| |_) / ____ \| |__| | |__| | |____| | \ \ 
*|____/_/    \_\_____/ \_____|______|_|  \_\
* Open Source Financial Management
* Visit http://badger.berlios.org 
*
**/
define('BADGER_ROOT', '../..');
require_once BADGER_ROOT . '/includes/fileHeaderBackEnd.inc.php';
require_once BADGER_ROOT . '/modules/account/accountCommon.php';
//help functions for automatical calculation of pocket money from the finished transactions
$startSpendingDate = getGPC($_POST, 'startDate', 'DateFormatted');
$accountId = getGPC($_POST, 'selectedAccount', 'int');
$spendingMoney = getSpendingMoney($accountId, $startSpendingDate);
$spendingMoney->mul(-1);
$calculatedPocketMoney = $spendingMoney->getFormatted();
echo $calculatedPocketMoney;
require_once BADGER_ROOT . "/includes/fileFooter.php";
Example #3
0
 $endDateToolTip = $widgets->addToolTip(getBadgerTranslation2("forecast", "endDateToolTip"));
 //get accounts from db & field to select the account for forecsatung
 $am = new AccountManager($badgerDb);
 $account = array();
 while ($currentAccount = $am->getNextAccount()) {
     $account[$currentAccount->getId()] = $currentAccount->getTitle();
 }
 $accountLabel = $widgets->createLabel("selectedAccount", getBadgerTranslation2("forecast", "accountField") . ":", true);
 $accountField = $widgets->createSelectField("selectedAccount", $account, $_POST["selectedAccount"], getBadgerTranslation2("forecast", "accountToolTip"), true, 'style="width: 10em;"');
 //field to select saving target, default is 0
 $savingTargetLabel = $widgets->createLabel("savingTarget", getBadgerTranslation2("forecast", "savingTargetField") . ":", true);
 $savingTargetField = $widgets->createField("savingTarget", 5, $_POST["savingTarget"], getBadgerTranslation2("forecast", "savingTargetToolTip"), true, "text", 'style="width: 10em;"');
 //field to insert pocketmoney1
 $pocketMoney1Label = $widgets->createLabel("pocketmoney1", getBadgerTranslation2("forecast", "pocketMoney1Field") . ":", true);
 $startSpendingDate = new Date($_POST["startDate"], true);
 $spendingMoney = getSpendingMoney($_POST["selectedAccount"], $startSpendingDate);
 $spendingMoney->mul(-1);
 $calculatedPocketMoney = $spendingMoney->getFormatted();
 $pocketMoney1Field = $widgets->createField("pocketmoney1", 5, $_POST["pocketmoney1"], getBadgerTranslation2("forecast", "pocketMoney1ToolTip"), true, "text", 'style="width: 10em;"');
 //field to insert pocketmoney2
 $pocketMoney2Label = $widgets->createLabel("pocketmoney2", getBadgerTranslation2("forecast", "pocketMoney2Field") . ":", true);
 $pocketMoney2Field = $widgets->createField("pocketmoney2", 5, $calculatedPocketMoney, getBadgerTranslation2("forecast", "pocketMoney2ToolTip"), true, "text", 'style="width: 10em;"');
 //checkbox for lower limit graph
 $lowerLimitLabel = getBadgerTranslation2("forecast", "lowerLimitLabel") . ":";
 if (isset($_POST["lowerLimitBox"])) {
     $lowerLimitBox = "<input type=\"checkbox\" name=\"lowerLimitBox\" value=\"select\" checked=\"checked\"/>";
 } else {
     $lowerLimitBox = "<input type=\"checkbox\" name=\"lowerLimitBox\" value=\"select\" />";
 }
 $lowerLimitToolTip = $widgets->addToolTip(getBadgerTranslation2("forecast", "lowerLimitToolTip"));
 //checkbox for upper limit graph