<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[FrontAccounting forum — Group Total in Trial Balance]]></title>
	<link rel="self" href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=6951&amp;type=atom" />
	<updated>2017-09-08T06:01:31Z</updated>
	<generator>PunBB</generator>
	<id>https://frontaccounting.com/punbb/viewtopic.php?id=6951</id>
		<entry>
			<title type="html"><![CDATA[Re: Group Total in Trial Balance]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=28589#p28589" />
			<content type="html"><![CDATA[<p>You can simply copy and paste it in Excel and take Print out.</p>]]></content>
			<author>
				<name><![CDATA[boxygen]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=20175</uri>
			</author>
			<updated>2017-09-08T06:01:31Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=28589#p28589</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Group Total in Trial Balance]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=28552#p28552" />
			<content type="html"><![CDATA[<p>Thanks @joe.<br /><a href="https://github.com/FrontAccountingERP/FA/commit/8c7f32852c8ac0f8ec2ecb78fe86c3ed71587ba0">Committed</a></p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2017-09-02T15:47:50Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=28552#p28552</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Group Total in Trial Balance]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=28532#p28532" />
			<content type="html"><![CDATA[<p>Ah, @boxygen, we had some overlap here. Of course your opinion is of great value.</p><p>We will simply include it in the screen TB report without an option.</p><p>Will be committed later this evening.</p><p>Joe</p>]]></content>
			<author>
				<name><![CDATA[joe]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=3</uri>
			</author>
			<updated>2017-08-31T15:43:56Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=28532#p28532</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Group Total in Trial Balance]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=28531#p28531" />
			<content type="html"><![CDATA[<p>Yes, we could call it Group Totals only instead of use it together with the normal TB.</p><p>In that case it would be easier to read.</p><p>Joe</p>]]></content>
			<author>
				<name><![CDATA[joe]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=3</uri>
			</author>
			<updated>2017-08-31T15:39:23Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=28531#p28531</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Group Total in Trial Balance]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=28530#p28530" />
			<content type="html"><![CDATA[<p>I think without an option the Group Total shall be available. For Quick Account Overview we need Group Total as well.</p>]]></content>
			<author>
				<name><![CDATA[boxygen]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=20175</uri>
			</author>
			<updated>2017-08-31T15:34:58Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=28530#p28530</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Group Total in Trial Balance]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=28528#p28528" />
			<content type="html"><![CDATA[<p>It will need an earlier separate traversal into another array.....<br />Or make it appear only in the Summary report.</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2017-08-31T15:27:20Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=28528#p28528</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Group Total in Trial Balance]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=28526#p28526" />
			<content type="html"><![CDATA[<p>@notrinos</p><p>This is a catch 22 situation. The group totals are calculated during the traversal of the accounts.</p><p>Joe</p>]]></content>
			<author>
				<name><![CDATA[joe]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=3</uri>
			</author>
			<updated>2017-08-31T12:16:58Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=28526#p28526</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Group Total in Trial Balance]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=28525#p28525" />
			<content type="html"><![CDATA[<p>I think we don&#039;t need to add a line at the bottom of every group which will make the report confusing.</p><p>Just add as follows and don&#039;t need the option:<br /><a href="http://imgur.com/ABqVoPe">http://imgur.com/ABqVoPe</a></p>]]></content>
			<author>
				<name><![CDATA[notrinos]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=36772</uri>
			</author>
			<updated>2017-08-31T11:58:55Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=28525#p28525</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Group Total in Trial Balance]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=28524#p28524" />
			<content type="html"><![CDATA[<p>Hello again,</p><p>I have been looking at this. It looks cool, but I would rather split the options line into two, It is already too long, and add a new option &#039;Group Totals&#039;.</p><p>The reason for doing it this way is that many is used to the way it works now. They use it as a quick account overview.</p><p>If you want the group totals, simple check the value &#039;Group Totals&#039;.</p><p>What do you guys say to that?</p><p>/Joe</p>]]></content>
			<author>
				<name><![CDATA[joe]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=3</uri>
			</author>
			<updated>2017-08-31T09:56:16Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=28524#p28524</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Group Total in Trial Balance]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=28520#p28520" />
			<content type="html"><![CDATA[<p>Maybe a good idea.</p><p>Will have a look.</p><p>Joe</p>]]></content>
			<author>
				<name><![CDATA[joe]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=3</uri>
			</author>
			<updated>2017-08-30T12:30:47Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=28520#p28520</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Group Total in Trial Balance]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=28519#p28519" />
			<content type="html"><![CDATA[<p>Before and After Screenshots attached.</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2017-08-30T11:14:08Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=28519#p28519</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Group Total in Trial Balance]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=28518#p28518" />
			<content type="html"><![CDATA[<p>The file at <strong>gl/inquiry/gl_trial_balance.php</strong> is sought to be altered using the essential diff as:<br /></p><div class="codebox"><pre><code>--- gl/inquiry/gl_trial_balance.php    Thu Nov 12 03:19:51 2015
+++ gl/inquiry/gl_trial_balance.php    Wed Aug 30 15:59:57 2017
@@ -84,6 +84,16 @@
         $begin = $_POST[&#039;TransFromDate&#039;];
     $begin = add_days($begin, -1);
 
+    $Apdeb=$pdeb;
+    $Apcre=$pcre;
+    $Acdeb=$cdeb;
+    $Accre=$ccre;
+    $Atdeb=$tdeb;
+    $Atcre=$tcre;
+    $Apbal=$pbal;
+    $Acbal=$cbal;
+    $Atbal=$tbal;
+
     while ($account = db_fetch($accounts))
     {
         //Print Type Title if it has atleast one non-zero account    
@@ -157,6 +167,29 @@
 
         }
         display_trial_balance($accounttype[&quot;id&quot;], $accounttype[&quot;name&quot;].&#039; (&#039;.$typename.&#039;)&#039;);
+    }
+
+    if (!check_value(&#039;Balance&#039;))
+    {
+        start_row(&quot;class=&#039;inquirybg&#039; style=&#039;font-weight:bold&#039;&quot;);
+        label_cell(_(&quot;Total&quot;) .&quot; - &quot;.$typename, &quot;colspan=2&quot;);
+
+        amount_cell($pdeb-$Apdeb );
+        amount_cell($pcre-$Apcre);
+        amount_cell($cdeb-$Acdeb );
+        amount_cell($ccre-$Accre );
+        amount_cell($tdeb-$Atdeb );
+        amount_cell($tcre-$Atcre);
+        end_row();
+    }
+    else
+    {
+    start_row(&quot;class=&#039;inquirybg&#039; style=&#039;font-weight:bold&#039;&quot;);
+    label_cell(_(&quot;Total&quot;) .&quot; - &quot;.$typename , &quot;colspan=2&quot;);
+    display_debit_or_credit_cells($pbal-$Apbal);
+    display_debit_or_credit_cells($cbal-$Acbal );
+    display_debit_or_credit_cells($tbal-$Atbal);
+    end_row();
     }
 }
 </code></pre></div><p>@joe: want to include this in the core?<br />The attachment has a few whitespace fixes as well.</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2017-08-30T10:32:44Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=28518#p28518</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Group Total in Trial Balance]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=28516#p28516" />
			<content type="html"><![CDATA[<p>Yes, group total is very useful, hoping it will be implemented next release.</p><p>another thread here:<br />https://frontaccounting.com/punbb/viewtopic.php?id=4913</p>]]></content>
			<author>
				<name><![CDATA[notrinos]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=36772</uri>
			</author>
			<updated>2017-08-30T09:33:31Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=28516#p28516</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Group Total in Trial Balance]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=28514#p28514" />
			<content type="html"><![CDATA[<p>With Few modification we can have Group Total in Trial Balance. This is very needful in analyzing groups. Below is the code</p><p>&lt;?php<br />/**********************************************************************<br />&nbsp; &nbsp; Copyright (C) FrontAccounting, LLC.<br />&nbsp; &nbsp; Released under the terms of the GNU General Public License, GPL,<br />&nbsp; &nbsp; as published by the Free Software Foundation, either version 3<br />&nbsp; &nbsp; of the License, or (at your option) any later version.<br />&nbsp; &nbsp; This program is distributed in the hope that it will be useful,<br />&nbsp; &nbsp; but WITHOUT ANY WARRANTY; without even the implied warranty of<br />&nbsp; &nbsp; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.<br />&nbsp; &nbsp; See the License here &lt;http://www.gnu.org/licenses/gpl-3.0.html&gt;.<br />***********************************************************************/<br />$page_security = &#039;SA_GLANALYTIC&#039;;<br />$path_to_root=&quot;../..&quot;;</p><p>include_once($path_to_root . &quot;/includes/session.inc&quot;);</p><p>include_once($path_to_root . &quot;/includes/ui.inc&quot;);<br />include_once($path_to_root . &quot;/includes/date_functions.inc&quot;);<br />include_once($path_to_root . &quot;/admin/db/fiscalyears_db.inc&quot;);<br />include_once($path_to_root . &quot;/includes/data_checks.inc&quot;);</p><p>include_once($path_to_root . &quot;/gl/includes/gl_db.inc&quot;);</p><p>$js = &quot;&quot;;<br />if (user_use_date_picker())<br />&nbsp; &nbsp; $js = get_js_date_picker();</p><p>page(_($help_context = &quot;Trial Balance&quot;), false, false, &quot;&quot;, $js);</p><p>$k = 0;<br />$pdeb = $pcre = $cdeb = $ccre = $tdeb = $tcre = $pbal = $cbal = $tbal = 0;</p><p>//----------------------------------------------------------------------------------------------------<br />// Ajax updates<br />//<br />if (get_post(&#039;Show&#039;))<br />{<br />&nbsp; &nbsp; $Ajax-&gt;activate(&#039;balance_tbl&#039;);<br />}</p><br /><p>function gl_inquiry_controls()<br />{<br />&nbsp; &nbsp; $dim = get_company_pref(&#039;use_dimension&#039;);<br />&nbsp; &nbsp; start_form();</p><p>&nbsp; &nbsp; start_table(TABLESTYLE_NOBORDER);</p><p>&nbsp; &nbsp; $date = today();<br />&nbsp; &nbsp; if (!isset($_POST[&#039;TransToDate&#039;]))<br />&nbsp; &nbsp; &nbsp; &nbsp; $_POST[&#039;TransToDate&#039;] = end_month($date);<br />&nbsp; &nbsp; if (!isset($_POST[&#039;TransFromDate&#039;]))<br />&nbsp; &nbsp; &nbsp; &nbsp; $_POST[&#039;TransFromDate&#039;] = add_days(end_month($date), -user_transaction_days());<br />&nbsp; &nbsp; date_cells(_(&quot;From:&quot;), &#039;TransFromDate&#039;);<br />&nbsp; &nbsp; date_cells(_(&quot;To:&quot;), &#039;TransToDate&#039;);<br />&nbsp; &nbsp; if ($dim &gt;= 1)<br />&nbsp; &nbsp; &nbsp; &nbsp; dimensions_list_cells(_(&quot;Dimension&quot;).&quot; 1:&quot;, &#039;Dimension&#039;, null, true, &quot; &quot;, false, 1);<br />&nbsp; &nbsp; if ($dim &gt; 1)<br />&nbsp; &nbsp; &nbsp; &nbsp; dimensions_list_cells(_(&quot;Dimension&quot;).&quot; 2:&quot;, &#039;Dimension2&#039;, null, true, &quot; &quot;, false, 2);<br />&nbsp; &nbsp; check_cells(_(&quot;No zero values&quot;), &#039;NoZero&#039;, null);<br />&nbsp; &nbsp; check_cells(_(&quot;Only balances&quot;), &#039;Balance&#039;, null);</p><p>&nbsp; &nbsp; submit_cells(&#039;Show&#039;,_(&quot;Show&quot;),&#039;&#039;,&#039;&#039;, &#039;default&#039;);<br />&nbsp; &nbsp; end_table();<br />&nbsp; &nbsp; end_form();<br />}</p><p>//----------------------------------------------------------------------------------------------------</p><p>function display_trial_balance($type, $typename)<br />{<br />&nbsp; &nbsp; global $path_to_root, $SysPrefs,<br />&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; $k, $pdeb, $pcre, $cdeb, $ccre, $tdeb, $tcre, $pbal, $cbal, $tbal;</p><p>&nbsp; &nbsp; $printtitle = 0; //Flag for printing type name</p><p>&nbsp; &nbsp; $k = 0;</p><p>&nbsp; &nbsp; //Get Accounts directly under this group/type<br />&nbsp; &nbsp; $accounts = get_gl_accounts(null, null, $type);</p><p>&nbsp; &nbsp; $begin = get_fiscalyear_begin_for_date($_POST[&#039;TransFromDate&#039;]);<br />&nbsp; &nbsp; if (date1_greater_date2($begin, $_POST[&#039;TransFromDate&#039;]))<br />&nbsp; &nbsp; &nbsp; &nbsp; $begin = $_POST[&#039;TransFromDate&#039;];<br />&nbsp; &nbsp; $begin = add_days($begin, -1);</p><p>&nbsp; &nbsp; $Apdeb=$pdeb;<br />&nbsp; &nbsp; &nbsp; &nbsp; $Apcre=$pcre;<br />&nbsp; &nbsp; &nbsp; &nbsp; $Acdeb=$cdeb;<br />&nbsp; &nbsp; &nbsp; &nbsp; $Accre=$ccre;<br />&nbsp; &nbsp; &nbsp; &nbsp; $Atdeb=$tdeb;<br />&nbsp; &nbsp; &nbsp; &nbsp; $Atcre=$tcre;<br />&nbsp; &nbsp; &nbsp; &nbsp; $Apbal=$pbal;<br />&nbsp; &nbsp; &nbsp; &nbsp; $Acbal=$cbal;<br />&nbsp; &nbsp; &nbsp; &nbsp; $Atbal=$tbal;</p><br /><p>&nbsp; &nbsp; while ($account = db_fetch($accounts))<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; //Print Type Title if it has atleast one non-zero account<br />&nbsp; &nbsp; &nbsp; &nbsp; if (!$printtitle)<br />&nbsp; &nbsp; &nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; start_row(&quot;class=&#039;inquirybg&#039; style=&#039;font-weight:bold&#039;&quot;);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; label_cell(_(&quot;Group&quot;).&quot; - &quot;.$type .&quot; - &quot;.$typename, &quot;colspan=8&quot;);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end_row();<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $printtitle = 1;<br />&nbsp; &nbsp; &nbsp; &nbsp; }</p><p>&nbsp; &nbsp; &nbsp; &nbsp; // FA doesn&#039;t really clear the closed year, therefore the brought forward balance includes all the transactions from the past, even though the balance is null.<br />&nbsp; &nbsp; &nbsp; &nbsp; // If we want to remove the balanced part for the past years, this option removes the common part from from the prev and tot figures.<br />&nbsp; &nbsp; &nbsp; &nbsp; if (@$SysPrefs-&gt;clear_trial_balance_opening)<br />&nbsp; &nbsp; &nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $open = get_balance($account[&quot;account_code&quot;], $_POST[&#039;Dimension&#039;], $_POST[&#039;Dimension2&#039;], $begin,&nbsp; $begin, false, true);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $offset = min($open[&#039;debit&#039;], $open[&#039;credit&#039;]);<br />&nbsp; &nbsp; &nbsp; &nbsp; } else<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $offset = 0;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; $prev = get_balance($account[&quot;account_code&quot;], $_POST[&#039;Dimension&#039;], $_POST[&#039;Dimension2&#039;], $begin, $_POST[&#039;TransFromDate&#039;], false, false);<br />&nbsp; &nbsp; &nbsp; &nbsp; $curr = get_balance($account[&quot;account_code&quot;], $_POST[&#039;Dimension&#039;], $_POST[&#039;Dimension2&#039;], $_POST[&#039;TransFromDate&#039;], $_POST[&#039;TransToDate&#039;], true, true);<br />&nbsp; &nbsp; &nbsp; &nbsp; $tot = get_balance($account[&quot;account_code&quot;], $_POST[&#039;Dimension&#039;], $_POST[&#039;Dimension2&#039;], $begin, $_POST[&#039;TransToDate&#039;], false, true);<br />&nbsp; &nbsp; &nbsp; &nbsp; if (check_value(&quot;NoZero&quot;) &amp;&amp; !$prev[&#039;balance&#039;] &amp;&amp; !$curr[&#039;balance&#039;] &amp;&amp; !$tot[&#039;balance&#039;])<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; continue;<br />&nbsp; &nbsp; &nbsp; &nbsp; alt_table_row_color($k);</p><p>&nbsp; &nbsp; &nbsp; &nbsp; $url = &quot;&lt;a href=&#039;$path_to_root/gl/inquiry/gl_account_inquiry.php?TransFromDate=&quot; . $_POST[&quot;TransFromDate&quot;] . &quot;&amp;TransToDate=&quot; . $_POST[&quot;TransToDate&quot;] . &quot;&amp;account=&quot; . $account[&quot;account_code&quot;] . &quot;&amp;Dimension=&quot; . $_POST[&quot;Dimension&quot;] . &quot;&amp;Dimension2=&quot; . $_POST[&quot;Dimension2&quot;] . &quot;&#039;&gt;&quot; . $account[&quot;account_code&quot;] . &quot;&lt;/a&gt;&quot;;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; label_cell($url);<br />&nbsp; &nbsp; &nbsp; &nbsp; label_cell($account[&quot;account_name&quot;]);<br />&nbsp; &nbsp; &nbsp; &nbsp; if (check_value(&#039;Balance&#039;))<br />&nbsp; &nbsp; &nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; display_debit_or_credit_cells($prev[&#039;balance&#039;]);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; display_debit_or_credit_cells($curr[&#039;balance&#039;]);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; display_debit_or_credit_cells($tot[&#039;balance&#039;]);</p><p>&nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; &nbsp; &nbsp; else<br />&nbsp; &nbsp; &nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; amount_cell($prev[&#039;debit&#039;]-$offset);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; amount_cell($prev[&#039;credit&#039;]-$offset);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; amount_cell($curr[&#039;debit&#039;]);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; amount_cell($curr[&#039;credit&#039;]);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; amount_cell($tot[&#039;debit&#039;]-$offset);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; amount_cell($tot[&#039;credit&#039;]-$offset);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $pdeb += $prev[&#039;debit&#039;];<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $pcre += $prev[&#039;credit&#039;];<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $cdeb += $curr[&#039;debit&#039;];<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $ccre += $curr[&#039;credit&#039;];<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $tdeb += $tot[&#039;debit&#039;];<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $tcre += $tot[&#039;credit&#039;];<br />&nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; &nbsp; &nbsp; $pbal += $prev[&#039;balance&#039;];<br />&nbsp; &nbsp; &nbsp; &nbsp; $cbal += $curr[&#039;balance&#039;];<br />&nbsp; &nbsp; &nbsp; &nbsp; $tbal += $tot[&#039;balance&#039;];<br />&nbsp; &nbsp; &nbsp; &nbsp; end_row();<br />&nbsp; &nbsp; }</p><p>&nbsp; &nbsp; //Get Account groups/types under this group/type<br />&nbsp; &nbsp; $result = get_account_types(false, false, $type);<br />&nbsp; &nbsp; while ($accounttype=db_fetch($result))<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; //Print Type Title if has sub types and not previously printed<br />&nbsp; &nbsp; &nbsp; &nbsp; if (!$printtitle)<br />&nbsp; &nbsp; &nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; start_row(&quot;class=&#039;inquirybg&#039; style=&#039;font-weight:bold&#039;&quot;);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; label_cell(_(&quot;Group&quot;).&quot; - &quot;.$type .&quot; - &quot;.$typename, &quot;colspan=8&quot;);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end_row();<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $printtitle = 1;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; &nbsp; &nbsp; display_trial_balance($accounttype[&quot;id&quot;], $accounttype[&quot;name&quot;].&#039; (&#039;.$typename.&#039;)&#039;);<br />&nbsp; &nbsp; }</p><p>&nbsp; &nbsp; //added by faisal for group total</p><p>&nbsp; &nbsp; if (!check_value(&#039;Balance&#039;))<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; start_row(&quot;class=&#039;inquirybg&#039; style=&#039;font-weight:bold&#039;&quot;);<br />&nbsp; &nbsp; &nbsp; &nbsp; label_cell(_(&quot;Total&quot;) .&quot; - &quot;.$typename, &quot;colspan=2&quot;);</p><p>&nbsp; &nbsp; &nbsp; &nbsp; amount_cell($pdeb-$Apdeb );<br />&nbsp; &nbsp; &nbsp; &nbsp; amount_cell($pcre-$Apcre);<br />&nbsp; &nbsp; &nbsp; &nbsp; amount_cell($cdeb-$Acdeb );<br />&nbsp; &nbsp; &nbsp; &nbsp; amount_cell($ccre-$Accre );<br />&nbsp; &nbsp; &nbsp; &nbsp; amount_cell($tdeb-$Atdeb );<br />&nbsp; &nbsp; &nbsp; &nbsp; amount_cell($tcre-$Atcre);<br />&nbsp; &nbsp; &nbsp; &nbsp; end_row();<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; else<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; start_row(&quot;class=&#039;inquirybg&#039; style=&#039;font-weight:bold&#039;&quot;);<br />&nbsp; &nbsp; label_cell(_(&quot;Total&quot;) .&quot; - &quot;.$typename , &quot;colspan=2&quot;);<br />&nbsp; &nbsp; display_debit_or_credit_cells($pbal-$Apbal);<br />&nbsp; &nbsp; display_debit_or_credit_cells($cbal-$Acbal );<br />&nbsp; &nbsp; display_debit_or_credit_cells($tbal-$Atbal);<br />&nbsp; &nbsp; end_row();<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp;&nbsp; //end by faisal for group total<br />}</p><p>//----------------------------------------------------------------------------------------------------</p><p>gl_inquiry_controls();</p><p>if (isset($_POST[&#039;TransFromDate&#039;]))<br />{<br />&nbsp; &nbsp; $row = get_current_fiscalyear();<br />&nbsp; &nbsp; if (date1_greater_date2($_POST[&#039;TransFromDate&#039;], sql2date($row[&#039;end&#039;])))<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; display_error(_(&quot;The from date cannot be bigger than the fiscal year end.&quot;));<br />&nbsp; &nbsp; &nbsp; &nbsp; set_focus(&#039;TransFromDate&#039;);<br />&nbsp; &nbsp; &nbsp; &nbsp; return;<br />&nbsp; &nbsp; }<br />}<br />div_start(&#039;balance_tbl&#039;);<br />if (!isset($_POST[&#039;Dimension&#039;]))<br />&nbsp; &nbsp; $_POST[&#039;Dimension&#039;] = 0;<br />if (!isset($_POST[&#039;Dimension2&#039;]))<br />&nbsp; &nbsp; $_POST[&#039;Dimension2&#039;] = 0;<br />start_table(TABLESTYLE);<br />$tableheader =&nbsp; &quot;&lt;tr&gt;<br />&nbsp; &nbsp; &lt;td rowspan=2 class=&#039;tableheader&#039;&gt;&quot; . _(&quot;Account&quot;) . &quot;&lt;/td&gt;<br />&nbsp; &nbsp; &lt;td rowspan=2 class=&#039;tableheader&#039;&gt;&quot; . _(&quot;Account Name&quot;) . &quot;&lt;/td&gt;<br />&nbsp; &nbsp; &lt;td colspan=2 class=&#039;tableheader&#039;&gt;&quot; . _(&quot;Brought Forward&quot;) . &quot;&lt;/td&gt;<br />&nbsp; &nbsp; &lt;td colspan=2 class=&#039;tableheader&#039;&gt;&quot; . _(&quot;This Period&quot;) . &quot;&lt;/td&gt;<br />&nbsp; &nbsp; &lt;td colspan=2 class=&#039;tableheader&#039;&gt;&quot; . _(&quot;Balance&quot;) . &quot;&lt;/td&gt;<br />&nbsp; &nbsp; &lt;/tr&gt;&lt;tr&gt;<br />&nbsp; &nbsp; &lt;td class=&#039;tableheader&#039;&gt;&quot; . _(&quot;Debit&quot;) . &quot;&lt;/td&gt;<br />&nbsp; &nbsp; &lt;td class=&#039;tableheader&#039;&gt;&quot; . _(&quot;Credit&quot;) . &quot;&lt;/td&gt;<br />&nbsp; &nbsp; &lt;td class=&#039;tableheader&#039;&gt;&quot; . _(&quot;Debit&quot;) . &quot;&lt;/td&gt;<br />&nbsp; &nbsp; &lt;td class=&#039;tableheader&#039;&gt;&quot; . _(&quot;Credit&quot;) . &quot;&lt;/td&gt;<br />&nbsp; &nbsp; &lt;td class=&#039;tableheader&#039;&gt;&quot; . _(&quot;Debit&quot;) . &quot;&lt;/td&gt;<br />&nbsp; &nbsp; &lt;td class=&#039;tableheader&#039;&gt;&quot; . _(&quot;Credit&quot;) . &quot;&lt;/td&gt;<br />&nbsp; &nbsp; &lt;/tr&gt;&quot;;</p><p>echo $tableheader;</p><p>//display_trial_balance();</p><p>$classresult = get_account_classes(false);<br />while ($class = db_fetch($classresult))<br />{<br />&nbsp; &nbsp; start_row(&quot;class=&#039;inquirybg&#039; style=&#039;font-weight:bold&#039;&quot;);<br />&nbsp; &nbsp; label_cell(_(&quot;Class&quot;).&quot; - &quot;.$class[&#039;cid&#039;] .&quot; - &quot;.$class[&#039;class_name&#039;], &quot;colspan=8&quot;);<br />&nbsp; &nbsp; end_row();</p><p>&nbsp; &nbsp; //Get Account groups/types under this group/type with no parents<br />&nbsp; &nbsp; $typeresult = get_account_types(false, $class[&#039;cid&#039;], -1);<br />&nbsp; &nbsp; while ($accounttype=db_fetch($typeresult))<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; display_trial_balance($accounttype[&quot;id&quot;], $accounttype[&quot;name&quot;]);<br />&nbsp; &nbsp; }<br />}</p><p>&nbsp; &nbsp; if (!check_value(&#039;Balance&#039;))<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; start_row(&quot;class=&#039;inquirybg&#039; style=&#039;font-weight:bold&#039;&quot;);<br />&nbsp; &nbsp; &nbsp; &nbsp; label_cell(_(&quot;Total&quot;) .&quot; - &quot;.$_POST[&#039;TransToDate&#039;], &quot;colspan=2&quot;);<br />&nbsp; &nbsp; &nbsp; &nbsp; amount_cell($pdeb);<br />&nbsp; &nbsp; &nbsp; &nbsp; amount_cell($pcre);<br />&nbsp; &nbsp; &nbsp; &nbsp; amount_cell($cdeb);<br />&nbsp; &nbsp; &nbsp; &nbsp; amount_cell($ccre);<br />&nbsp; &nbsp; &nbsp; &nbsp; amount_cell($tdeb);<br />&nbsp; &nbsp; &nbsp; &nbsp; amount_cell($tcre);<br />&nbsp; &nbsp; &nbsp; &nbsp; end_row();<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; start_row(&quot;class=&#039;inquirybg&#039; style=&#039;font-weight:bold&#039;&quot;);<br />&nbsp; &nbsp; label_cell(_(&quot;Ending Balance&quot;) .&quot; - &quot;.$_POST[&#039;TransToDate&#039;], &quot;colspan=2&quot;);<br />&nbsp; &nbsp; display_debit_or_credit_cells($pbal);<br />&nbsp; &nbsp; display_debit_or_credit_cells($cbal);<br />&nbsp; &nbsp; display_debit_or_credit_cells($tbal);<br />&nbsp; &nbsp; end_row();</p><p>&nbsp; &nbsp; end_table(1);<br />&nbsp; &nbsp; if (($pbal = round2($pbal, user_price_dec())) != 0 &amp;&amp; $_POST[&#039;Dimension&#039;] == 0 &amp;&amp; $_POST[&#039;Dimension2&#039;] == 0)<br />&nbsp; &nbsp; &nbsp; &nbsp; display_warning(_(&quot;The Opening Balance is not in balance, probably due to a non closed Previous Fiscalyear.&quot;));<br />&nbsp; &nbsp; div_end();</p><p>//----------------------------------------------------------------------------------------------------</p><p>end_page();</p>]]></content>
			<author>
				<name><![CDATA[boxygen]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=20175</uri>
			</author>
			<updated>2017-08-30T05:01:01Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=28514#p28514</id>
		</entry>
</feed>
