Customer Payment, Supplier Payment: early discount support.
[fa-stable.git] / gl / includes / gl_db.inc
index 8e894234de33225268218400f047b6f9a198c248..7a9c49002b7198914918fa9ab7dbf90b166fdddb 100644 (file)
@@ -1,20 +1,43 @@
-<?php\r
-\r
-include_once($path_to_root . "/includes/banking.inc");\r
-\r
-include_once($path_to_root . "/gl/includes/db/gl_db_trans.inc");\r
-include_once($path_to_root . "/gl/includes/db/gl_db_bank_trans.inc");\r
-include_once($path_to_root . "/gl/includes/db/gl_db_banking.inc");\r
-include_once($path_to_root . "/gl/includes/db/gl_db_bank_accounts.inc");\r
-include_once($path_to_root . "/gl/includes/db/gl_db_currencies.inc");\r
-include_once($path_to_root . "/gl/includes/db/gl_db_rates.inc");\r
-include_once($path_to_root . "/gl/includes/db/gl_db_accounts.inc");\r
-include_once($path_to_root . "/gl/includes/db/gl_db_account_types.inc");\r
-include_once($path_to_root . "/gl/includes/db/gl_db_bank_trans_types.inc");\r
-\r
-//--------------------------------------------------------------------------------\r
-\r
-\r
-                                               \r
-\r
-?>
\ No newline at end of file
+<?php
+/**********************************************************************
+    Copyright (C) FrontAccounting, LLC.
+       Released under the terms of the GNU General Public License, GPL, 
+       as published by the Free Software Foundation, either version 3 
+       of the License, or (at your option) any later version.
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+    See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
+***********************************************************************/
+include_once($path_to_root . "/includes/banking.inc");
+
+include_once($path_to_root . "/gl/includes/db/gl_db_trans.inc");
+include_once($path_to_root . "/gl/includes/db/gl_journal.inc");
+include_once($path_to_root . "/gl/includes/db/gl_db_bank_trans.inc");
+include_once($path_to_root . "/gl/includes/db/gl_db_banking.inc");
+include_once($path_to_root . "/gl/includes/db/gl_db_bank_accounts.inc");
+include_once($path_to_root . "/gl/includes/db/gl_db_currencies.inc");
+include_once($path_to_root . "/gl/includes/db/gl_db_rates.inc");
+include_once($path_to_root . "/gl/includes/db/gl_db_accounts.inc");
+include_once($path_to_root . "/gl/includes/db/gl_db_account_types.inc");
+//--------------------------------------------------------------------------------
+
+function add_budget($account, $dim1, $dim2, $amounts)
+{
+       begin_transaction(__FUNCTION__, func_get_args());
+
+       foreach($amounts as $date => $amount) {
+               add_update_gl_budget_trans($date, $account, $dim1, $dim2, $amount);
+       }
+       commit_transaction();
+}
+
+function delete_budget($account, $dim1, $dim2, $dates)
+{
+       begin_transaction(__FUNCTION__, func_get_args());
+
+       foreach($amounts as $date) {
+               delete_gl_budget_trans($date, $account, $dim1, $dim2);
+       }
+       commit_transaction();
+}