Rerun. Update material cost when quantity on hand is zero. @notrinos.
[fa-stable.git] / dimensions / includes / dimensions_ui.inc
index 9f6bc00566b230c7d0a45077aedc054018953def..1dd0a56cbaf32a7ddad676cafeeccfc9a4282d4d 100644 (file)
@@ -1,13 +1,13 @@
 <?php
 /**********************************************************************
     Copyright (C) FrontAccounting, LLC.
-       Released under the terms of the GNU Affero General Public License,
-       AGPL, as published by the Free Software Foundation, either version 
-       of the License, or (at your option) any later version.
+       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/agpl-3.0.html>.
+    See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
 ***********************************************************************/
 include_once($path_to_root . "/includes/ui.inc");
 
@@ -15,16 +15,9 @@ include_once($path_to_root . "/includes/ui.inc");
 
 function display_dimension_balance($id, $from, $to)
 {
-       global $path_to_root, $table_style;
+       global $path_to_root;
 
-       $from = date2sql($from);
-       $to = date2sql($to);
-       $sql = "SELECT account, ".TB_PREF."chart_master.account_name, sum(amount) AS amt FROM
-               ".TB_PREF."gl_trans,".TB_PREF."chart_master WHERE
-               ".TB_PREF."gl_trans.account = ".TB_PREF."chart_master.account_code AND
-               (dimension_id = $id OR dimension2_id = $id) AND
-               tran_date >= '$from' AND tran_date <= '$to' GROUP BY account";
-       $result = db_query($sql, "Transactions could not be calculated");
+       $result = get_dimension_balance_all($id, $from, $to);
 
     if (db_num_rows($result) == 0)
     {
@@ -34,7 +27,7 @@ function display_dimension_balance($id, $from, $to)
     {
                display_heading2(_("Balance for this Dimension"));
                br();
-               start_table($table_style);
+               start_table(TABLESTYLE);
                $th = array(_("Account"), _("Debit"), _("Credit"));
                table_header($th);
 
@@ -68,4 +61,3 @@ function display_dimension_balance($id, $from, $to)
 
 //--------------------------------------------------------------------------------------
 
-?>
\ No newline at end of file