<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[FrontAccounting forum — Journal Entries Round to 2 decimal places on add, not update]]></title>
	<link rel="self" href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=7491&amp;type=atom" />
	<updated>2018-05-02T14:33:43Z</updated>
	<generator>PunBB</generator>
	<id>https://frontaccounting.com/punbb/viewtopic.php?id=7491</id>
		<entry>
			<title type="html"><![CDATA[Re: Journal Entries Round to 2 decimal places on add, not update]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=31558#p31558" />
			<content type="html"><![CDATA[<p>I did check it -- dropped log statements in methodically (just downloaded yesterday, code is new to me, and php is not my strong suite).</p><p>The gl_items class (which is the culprit) is defined in items_cart.inc, not intuitive, but can&#039;t hide from grep <img src="https://frontaccounting.com/punbb/img/smilies/smile.png" width="15" height="15" alt="smile" /></p><p>EDIT:&nbsp; To also be clear, it&#039;s not just the display.&nbsp; When an item is added to the gl_items list it uses the constructor in the gl_items class which does the rounding, so the rounded number is what gets pushed to the sql table.</p>]]></content>
			<author>
				<name><![CDATA[ed45626]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=42498</uri>
			</author>
			<updated>2018-05-02T14:33:43Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=31558#p31558</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Journal Entries Round to 2 decimal places on add, not update]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=31553#p31553" />
			<content type="html"><![CDATA[<p>Items in the Cart are used for both display and for populating the tables. To conserve screen real-estate, the display is generally rounded off to 2 decimal places. Hopefully all the 8 digit amounts can fit into the Chart of Account table fields.</p><p>It is the <strong>function add_gl_item</strong> that needs to be fixed - inspect the value of $amount at the point when <strong>$this-&gt;gl_items[] = new gl_item(.....</strong> is executed whether it has the 8 digits in the decimals at line 130.</p><p>@joe: Worth fixing.</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2018-05-02T08:10:50Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=31553#p31553</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Journal Entries Round to 2 decimal places on add, not update]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=31552#p31552" />
			<content type="html"><![CDATA[<p>We need 8 decimal places for GL entries and despite setting the precision adding a new journal entry always rounded to 2 places.</p><p>If we go back and update the entry, then the full number would stay.</p><p>In <strong>includes/ui/items_cart.inc</strong>, the definition for <strong>class gl_item</strong> ignores the user precision at line 535 (<a href="https://github.com/FrontAccountingERP/FA/blob/master/includes/ui/items_cart.inc#L534">line 534</a> in the GitMaster):<br /></p><div class="codebox"><pre><code>$this-&gt;amount = round($amount, 2);</code></pre></div><p>Whereas the <strong>function update_gl_item</strong> does not round (line 161):<br /></p><div class="codebox"><pre><code>$this-&gt;gl_items[$index]-&gt;amount = $amount;</code></pre></div><p>I&#039;ve hacked the file, but would probably be better to update -- not sure where to submit a pull request on sourceforge.</p><p>Thanks!</p>]]></content>
			<author>
				<name><![CDATA[ed45626]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=42498</uri>
			</author>
			<updated>2018-05-02T03:48:22Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=31552#p31552</id>
		</entry>
</feed>
