Fixed many issues in output HTML code according to HTML 4.01 Transitional format.
[fa-stable.git] / gl / inquiry / balance_sheet.php
index eafb4855c020dab506f1d5d45bb82b9b41faef1d..7bec22c03eedbe89eb31d964f380879f0b389bb1 100644 (file)
@@ -57,28 +57,27 @@ function display_type ($type, $typename, $from, $to, $convert, $dimension, $dime
        //Get Accounts directly under this group/type
        $result = get_gl_accounts(null, null, $type);   
                
-       while ($account=db_fetch($result))
-       {
-               $prev_balance = get_gl_balance_from_to("", $from, $account["account_code"], $dimension, $dimension2);
-               $curr_balance = get_gl_trans_from_to($from, $to, $account["account_code"], $dimension, $dimension2);
-               if (!$prev_balance && !$curr_balance)
-                       continue;
-               
-               if ($drilldown && $levelptr == 0)
-               {
-                       $url = "<a href='$path_to_root/gl/inquiry/gl_account_inquiry.php?TransFromDate=" 
-                               . $from . "&TransToDate=" . $to . "&Dimension=" . $dimension . "&Dimension2=" . $dimension2 
-                               . "&account=" . $account['account_code'] . "'>" . $account['account_code'] 
-                               ." ". $account['account_name'] ."</a>";                         
-                               
-                       start_row("class='stockmankobg'");
-                       label_cell($url);
-                       amount_cell(($curr_balance + $prev_balance) * $convert);
-                       end_row();
-               }
-               
-               $acctstotal += $curr_balance + $prev_balance;
-       }
+       while ($account=db_fetch($result))
+    {
+        $net_balance = get_gl_trans_from_to("", $to, $account["account_code"], $dimension, $dimension2);
+        if (!$net_balance)
+            continue;
+        
+        if ($drilldown && $levelptr == 0)
+        {
+            $url = "<a href='$path_to_root/gl/inquiry/gl_account_inquiry.php?TransFromDate=" 
+                . $from . "&TransToDate=" . $to . "&Dimension=" . $dimension . "&Dimension2=" . $dimension2 
+                . "&account=" . $account['account_code'] . "'>" . $account['account_code'] 
+                ." ". $account['account_name'] ."</a>";                
+                
+            start_row("class='stockmankobg'");
+            label_cell($url);
+            amount_cell(($net_balance) * $convert);
+            end_row();
+        }
+        
+        $acctstotal += $net_balance;
+    }  
        
        $levelptr = 1;
 
@@ -109,7 +108,7 @@ function display_type ($type, $typename, $from, $to, $convert, $dimension, $dime
                {
                        $url = "<a href='$path_to_root/gl/inquiry/balance_sheet.php?TransFromDate=" 
                                . $from . "&TransToDate=" . $to . "&Dimension=" . $dimension . "&Dimension2=" . $dimension2 
-                               . "&AccGrp=" . $type ."'>" . $typename ."</a>";
+                               . "&AccGrp=" . $type ."'>" . $type . " " . $typename ."</a>";
                                
                        alt_table_row_color($k);
                        label_cell($url);
@@ -157,7 +156,7 @@ function display_balance_sheet()
 
        div_start('balance_tbl');
        
-       start_table(TABLESTYLE, "width=30%");                   
+       start_table(TABLESTYLE, "width='30%'");
                
        if (!$drilldown) //Root Level
        {               
@@ -173,7 +172,7 @@ function display_balance_sheet()
                while ($class = db_fetch($classresult))
                {       
                        $classclose = 0.0;
-                       $convert = get_class_type_convert($class["ctype"]);             
+                       $convert = get_class_type_convert($class["ctype"]);
                        $ctype = $class["ctype"];
                        $classname = $class["class_name"];      
 
@@ -192,7 +191,7 @@ function display_balance_sheet()
                                {
                                        $url = "<a href='$path_to_root/gl/inquiry/balance_sheet.php?TransFromDate=" 
                                                . $from . "&TransToDate=" . $to . "&Dimension=" . $dimension . "&Dimension2=" . $dimension2 
-                                               . "&AccGrp=" . $accounttype['id'] ."'>" . $accounttype['name'] ."</a>"; 
+                                               . "&AccGrp=" . $accounttype['id'] ."'>" . $accounttype['id']." ".$accounttype['name'] ."</a>";  
                                        alt_table_row_color($k);
                                        label_cell($url);
                                        amount_cell($TypeTotal * $convert);
@@ -250,7 +249,7 @@ function display_balance_sheet()
                $convert = get_class_type_convert($class["ctype"]); 
                
                //Print Class Name      
-               table_section_title(get_account_type_name($_POST["AccGrp"]));   
+               table_section_title($_POST["AccGrp"]. " " . get_account_type_name($_POST["AccGrp"]));   
                
                $classclose = display_type($accounttype["id"], $accounttype["name"], $from, $to, 
                        $convert, $dimension, $dimension2, $drilldown, $path_to_root);