<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[FrontAccounting forum — A bug in Report Supplier Balances rep201.php]]></title>
	<link rel="self" href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=7663&amp;type=atom" />
	<updated>2018-08-22T19:18:15Z</updated>
	<generator>PunBB</generator>
	<id>https://frontaccounting.com/punbb/viewtopic.php?id=7663</id>
		<entry>
			<title type="html"><![CDATA[Re: A bug in Report Supplier Balances rep201.php]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=32518#p32518" />
			<content type="html"><![CDATA[<p>Yes, I can verify</p>]]></content>
			<author>
				<name><![CDATA[boxygen]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=20175</uri>
			</author>
			<updated>2018-08-22T19:18:15Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=32518#p32518</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: A bug in Report Supplier Balances rep201.php]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=32516#p32516" />
			<content type="html"><![CDATA[<p><a href="https://github.com/FrontAccountingERP/FA/commit/d25e06f889d2c81871fcb6edb42e53e2ea316601">Committed</a>.<br />Kindly verify if the functionality is okay.</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2018-08-22T15:47:04Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=32516#p32516</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: A bug in Report Supplier Balances rep201.php]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=32445#p32445" />
			<content type="html"><![CDATA[<p>@boxygen</p><p>I am out of office until Friday. Will fix it then and commit. Thanks.</p><p>Joe</p>]]></content>
			<author>
				<name><![CDATA[joe]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=3</uri>
			</author>
			<updated>2018-08-13T09:33:01Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=32445#p32445</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: A bug in Report Supplier Balances rep201.php]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=32444#p32444" />
			<content type="html"><![CDATA[<p>I copied the Logic from <strong>rep101.php</strong> and it worked.</p><div class="codebox"><pre><code>function get_open_balance($supplier_id, $to)
{
    if($to)
        $to = date2sql($to);

        $sql = &quot;SELECT SUM(IF(t.type = &quot;.ST_SUPPINVOICE.&quot; OR (t.type IN (&quot;.ST_JOURNAL.&quot; , &quot;.ST_BANKDEPOSIT.&quot;) AND t.ov_amount&gt;0),
                        -abs(t.ov_amount + t.ov_gst + t.ov_discount), 0)) AS charges,&quot;;

 $sql .= &quot;SUM(IF(t.type != &quot;.ST_SUPPINVOICE.&quot; AND NOT(t.type IN (&quot;.ST_JOURNAL.&quot; , &quot;.ST_BANKDEPOSIT.&quot;) AND t.ov_amount&gt;0),
                        abs(t.ov_amount + t.ov_gst + t.ov_discount) * -1, 0)) AS credits,&quot;;

     $sql .= &quot;SUM(IF(t.type != &quot;.ST_SUPPINVOICE.&quot; AND NOT(t.type IN (&quot;.ST_JOURNAL.&quot; , &quot;.ST_BANKDEPOSIT.&quot;)), t.alloc * -1, t.alloc)) AS Allocated,&quot;;

     $sql .=    &quot;SUM(IF(t.type = &quot;.ST_SUPPINVOICE.&quot;, 1, -1) *
             (abs(t.ov_amount + t.ov_gst + t.ov_discount) - abs(t.alloc))) AS OutStanding
        FROM &quot;.TB_PREF.&quot;supp_trans t
        WHERE t.supplier_id = &quot;.db_escape($supplier_id);
    if ($to)
        $sql .= &quot; AND t.tran_date &lt; &#039;$to&#039;&quot;;
    $sql .= &quot; GROUP BY supplier_id&quot;;

    $result = db_query($sql,&quot;No transactions were returned&quot;);
    return db_fetch($result);
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[boxygen]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=20175</uri>
			</author>
			<updated>2018-08-13T08:41:46Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=32444#p32444</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[A bug in Report Supplier Balances rep201.php]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=32443#p32443" />
			<content type="html"><![CDATA[<p>I found a bug in Supplier Balances Report.</p><p>Check this <a href="https://www.dropbox.com/s/ofa1zn376mdl3xt/BugInSupplierBalances.png?dl=0">screen shot</a> of comparison. Opening Balance of the SUpplier was recorded on 30th June. When we query including 30th June the report shows value correctly under Charges Column But When we query from 1st July the Reports Shows the opening balance wrongly under Credits Column.</p><p>The reason is that the Opening Balance was entered through Journal Entry. and Journal Entry is not being checked in the <strong>get_open_balance()</strong> function in <strong>rep201.php</strong>.</p>]]></content>
			<author>
				<name><![CDATA[boxygen]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=20175</uri>
			</author>
			<updated>2018-08-13T08:00:56Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=32443#p32443</id>
		</entry>
</feed>
