Ejemplo n.º 1
0
 private function assertSameCategoryAsCurrent($p_oldCategory)
 {
     $v_currentCategory = $this->r_cloudBankServer->execQuery('SELECT name FROM ledger_account WHERE id = :accountID', array(':accountID' => $p_oldCategory['id']));
     if (!CloudBankServer::IsEqual($p_oldCategory, $v_currentCategory[0], array('name' => 'name'))) {
         throw new Exception("The Category to be modified ({$p_oldCategory['id']}) does " . "not exist or has been modified by another session. Please " . "try again.");
     }
 }
Ejemplo n.º 2
0
#!/usr/bin/php
<?php 
require_once dirname(__FILE__) . '/../server/CloudBankServer.php';
require_once dirname(__FILE__) . '/../server/SchemaDef.php';
//   require_once('SCA/SCA.php');
CloudBankServer::Singleton()->tryQuery('
      ALTER TABLE event ADD statement_item_id VARCHAR(16)
   ');
CloudBankServer::Singleton()->tryQuery('
      ALTER TABLE event ADD is_cleared BOOLEAN DEFAULT 0
   ');
CloudBankServer::Singleton()->tryQuery('DROP VIEW account_events');
$g_createSchemaStatements = SchemaDef::CreateSchemaStatements();
foreach (array('account_events', 'statement_item', 'statement_item_unmatched', 'event_statement_item_match', 'event_matched') as $v_dBObject) {
    CloudBankServer::Singleton()->tryQuery($g_createSchemaStatements[$v_dBObject]);
}
Ejemplo n.º 3
0
 private function prepareRelatedAccounts($p_accountID, $p_otherAccountID, $p_amount_client, &$p_debitLedgerAccountID, &$p_creditLedgerAccountID, &$p_amount)
 {
     $this->assertLedgerAccountExists($p_accountID, CloudBankConsts::LedgerAccountType_Account);
     $this->assertLedgerAccountExists($p_otherAccountID);
     CloudBankServer::SwapIf($p_amount_client < 0, $p_accountID, $p_otherAccountID, $p_debitLedgerAccountID, $p_creditLedgerAccountID);
     $p_amount = abs($p_amount_client);
 }
Ejemplo n.º 4
0
#!/usr/bin/php
<?php 
require_once dirname(__FILE__) . '/../server/CloudBankServer.php';
$p_account_name = $argv[1];
$p_date = $argv[2];
CloudBankServer::Singleton()->beginTransaction();
$v_ledgerAccountID = CloudBankServer::Singleton()->execQuery('SELECT id FROM ledger_account WHERE name = :name', array(':name' => $p_account_name));
if (!$v_ledgerAccountID) {
    exit;
}
CloudBankServer::Singleton()->execQuery('
	 UPDATE event
	 SET is_cleared = 1
	 WHERE
	    (
	       credit_ledger_account_id = :ledger_account_id OR
	       debit_ledger_account_id = :ledger_account_id
	    ) AND date <= :date
      ', array(':ledger_account_id' => $v_ledgerAccountID[0]['id'], ':date' => $p_date));
CloudBankServer::Singleton()->commitTransaction();
Ejemplo n.º 5
0
 public function __construct()
 {
     $this->r_cloudBankServer = CloudBankServer::Singleton();
 }
Ejemplo n.º 6
0
#!/usr/bin/php
<?php 
require_once dirname(__FILE__) . '/../server/CloudBankServer.php';
require_once dirname(__FILE__) . '/../server/SchemaDef.php';
require_once 'SCA/SCA.php';
foreach (SchemaDef::CreateSchemaStatements() as $v_dBObject => $v_sQLStatement) {
    CloudBankServer::Singleton()->tryQuery($v_sQLStatement);
}
$v_ledgerAccountService = SCA::getService(dirname(__FILE__) . '/../server/LedgerAccountService.php');
$v_ledgerAccountService->createBeginningAccount();