public function get_summary($year, $month) { $db = new dbControl(); // create db controller $query = "Select acct_account.account_type, acct_account.account_desc , SUM(acct_official_receipt_entries.debit) as debit , \r\n\t\t\t\t\t\tSUM(acct_official_receipt_entries.credit) as credit\r\n\t\t\t\t From acct_account, acct_official_receipt_entries, acct_official_receipt_reference\t\r\n\t\t\t\t Where acct_account.id = acct_official_receipt_entries.acct_account_id\r\n\t\t\t\t\t\tAND acct_official_receipt_entries.acct_official_receipt_reference_id = acct_official_receipt_reference.id\r\n\t\t\t\t\t\tAND MONTH(acct_official_receipt_reference.trans_date) = '" . $month . "'\r\n\t\t\t\t\t\tAND YEAR(acct_official_receipt_reference.trans_date) = '" . $year . "'\r\n\t\t\t\t GROUP BY acct_account.account_desc"; return $db->query($query); //query it then return the result set }
private function authenticate($user, $pass) { $db = new dbControl(); $db->connect(); $rs = $db->query("SELECT * \r\n\t\t\t\t\t\t\tFROM `sf_guard_user` \r\n\t\t\t\t\t\t\tWHERE MD5(`username`) = '" . $user . "'\r\n\t\t\t\t\t\t\tAND MD5(`password`) = '" . $pass . "'"); while ($row = $rs->FetchRow()) { $this->user = $row['username']; } if ($rs->RecordCount() == 0) { header("Location: system/sf_guard_logger/loginError.php"); } }
public function show_balances($year, $month) { $db = new dbControl(); $query = "SELECT\r\n\t\t\t\t\taccount.account_desc AS 'Account',\r\n\t\t\t\t\taccount.account_type AS 'Account Type',\r\n\t\t\t\t\tSUM(general_ledger.crb_debit + general_ledger.cdb_debit + general_ledger.jv_debit) AS 'Debit',\r\n\t\t\t\t\tSUM(general_ledger.crb_credit + general_ledger.cdb_credit + general_ledger.jv_credit) AS 'Credit'\r\n\t\t\t\t FROM\r\n\t\t\t\t\taccount, general_ledger\r\n\t\t\t\t WHERE\r\n\t\t\t\t\tgeneral_ledger.account_id = account.id\r\n\t\t\t\t\tAND month <= " . $month . "\r\n\t\t\t\t\tAND year <= " . $year . "\r\n\t\t\t\t GROUP BY\r\n\t\t\t\t\taccount.id"; return $db->query($query); }