<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[FrontAccounting forum — Invoice not converting from DN due to float bug]]></title>
	<link rel="self" href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=9900&amp;type=atom" />
	<updated>2022-07-26T14:59:55Z</updated>
	<generator>PunBB</generator>
	<id>https://frontaccounting.com/punbb/viewtopic.php?id=9900</id>
		<entry>
			<title type="html"><![CDATA[Re: Invoice not converting from DN due to float bug]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=41295#p41295" />
			<content type="html"><![CDATA[<p>ok great !<br />let me check, thanks again <img src="https://frontaccounting.com/punbb/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></content>
			<author>
				<name><![CDATA[dz]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=44997</uri>
			</author>
			<updated>2022-07-26T14:59:55Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=41295#p41295</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Invoice not converting from DN due to float bug]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=41262#p41262" />
			<content type="html"><![CDATA[<p>Hello again,</p><p>I found the problem. It was not inside function check_num, but from function check_quantities in customer_invoice.php and customer_delivery.php.<br />Inside these functions the $max value was calculated and due to a floating bug in PHP got a very small overlay.<br />This has been fixed in these two functions, check_quantities. </p><p>/sales/customer_delivery.php can be downloaded <a href="https://sourceforge.net/p/frontaccounting/git/ci/master/tree/sales/customer_delivery.php">here</a>.<br />/sales/customer_invoice.php can be downloaded <a href="https://sourceforge.net/p/frontaccounting/git/ci/master/tree/sales/customer_invoice.php">here</a>.</p><p>Joe</p>]]></content>
			<author>
				<name><![CDATA[joe]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=3</uri>
			</author>
			<updated>2022-07-17T10:03:10Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=41262#p41262</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Invoice not converting from DN due to float bug]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=41261#p41261" />
			<content type="html"><![CDATA[<p>ok Thanks joe, let me check that <img src="https://frontaccounting.com/punbb/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></content>
			<author>
				<name><![CDATA[dz]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=44997</uri>
			</author>
			<updated>2022-07-15T20:17:29Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=41261#p41261</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Invoice not converting from DN due to float bug]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=41257#p41257" />
			<content type="html"><![CDATA[<p>Hello @dz. <br />Yes I will be glad to assist, had I have a clue about this. We are working otherwise with a DELTA value in current_user.inc (about line 540), can this be used? <br />Does any expert on this have a good solution?</p><p>Joe</p>]]></content>
			<author>
				<name><![CDATA[joe]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=3</uri>
			</author>
			<updated>2022-07-15T14:23:23Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=41257#p41257</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Invoice not converting from DN due to float bug]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=41254#p41254" />
			<content type="html"><![CDATA[<p>@joe Kindly advise</p>]]></content>
			<author>
				<name><![CDATA[dz]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=44997</uri>
			</author>
			<updated>2022-07-15T09:14:20Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=41254#p41254</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Invoice not converting from DN due to float bug]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=41235#p41235" />
			<content type="html"><![CDATA[<p>While converting the delivery note to the invoice the system is showing the following error:</p><p>Selected quantity cannot be less than quantity credited nor more than quantity not invoiced yet.</p><p>To re-produce <br />1 i created an SO and DN of 28 pieces.<br />2. Invoiced 19.60 pcs<br />3. and now while invoicing the remaining 8.40 pcs i get the above error.</p><p>I have checked the above in FA&#039;s latest build as well.</p><p>While investigating i found that in the following function in data_checks.inc, the $num&gt;$max is going true. please note that both $num and $max are both 8.4, and $num can not be greater than $max.</p><p> But if i subtract $num-$max it gives me 1.7763568394003E-15(which should be zero). I googled it and found out that this is due to the shortcoming of floating point arithmetic.</p><p>Reference Function<br />function check_num($postname, $min=null, $max=null, $dflt=0) {<br />&nbsp; &nbsp; if(!isset($_POST[$postname]))<br />&nbsp; &nbsp;&nbsp; &nbsp;return 0;<br />&nbsp; &nbsp; $num = input_num($postname, $dflt);<br />&nbsp; &nbsp; if ($num === false || $num === null) <br />&nbsp; &nbsp;&nbsp; &nbsp;return 0;<br />&nbsp; &nbsp; if (isset($min) &amp;&amp; ($num&lt;$min)) <br />&nbsp; &nbsp;&nbsp; &nbsp;return 0;<br />&nbsp; &nbsp; if (isset($max) &amp;&amp; ($num&gt;$max)) <br />&nbsp; &nbsp;&nbsp; &nbsp;return 0;<br />&nbsp; &nbsp; return 1;<br />}</p><p>Should i add a rounding value like 0.00001 in $num for comparing it with $min and $max?</p><p>Kindly advise.</p>]]></content>
			<author>
				<name><![CDATA[dz]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=44997</uri>
			</author>
			<updated>2022-07-06T17:26:03Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=41235#p41235</id>
		</entry>
</feed>
