<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[FrontAccounting forum — Void a Transaction Functionality]]></title>
	<link rel="self" href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=7249&amp;type=atom" />
	<updated>2018-01-16T15:39:30Z</updated>
	<generator>PunBB</generator>
	<id>https://frontaccounting.com/punbb/viewtopic.php?id=7249</id>
		<entry>
			<title type="html"><![CDATA[Re: Void a Transaction Functionality]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=30532#p30532" />
			<content type="html"><![CDATA[<p>I&#039;ve been concentrating on the reference # number, I should be working on the trans_no and id number in debtor_trans and voided respectively.</p><p>In File: includes\references.inc</p><div class="codebox"><pre><code>193:     function _get($type, $trans_no=0, $ref=null)
194:     


203:         $sql = &quot;SELECT `$ref_fld` 
204:                 FROM `$trans_table` tbl
205:                     LEFT JOIN &quot;.TB_PREF.&quot;voided v ON 
206:                 tbl.`$tno_fld`=v.id AND v.type=$type&quot;
207:             .&quot; WHERE ISNULL(v.id)&quot;
208:             .($type_fld ? &quot; AND tbl.`$type_fld`=$type&quot; : &#039;&#039;);
209:         if ($ref)
210:         {
211:             $sql .= &quot; AND tbl.`$ref_fld`=&quot;.db_escape(trim($ref));
212:             if ($trans_no)
213:                 $sql .= &quot; AND tbl.`$tno_fld` != &quot;.db_escape($trans_no);
214:         } else {
215:             $sql .= &quot; AND tbl.`$tno_fld`=&quot;.db_escape($trans_no);
216:         }</code></pre></div><p>It checks that the reference number has not been used, so do I need to add the compare statement before this?</p>]]></content>
			<author>
				<name><![CDATA[poncho1234]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=19944</uri>
			</author>
			<updated>2018-01-16T15:39:30Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=30532#p30532</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Void a Transaction Functionality]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=30526#p30526" />
			<content type="html"><![CDATA[<p>Just an additional comment.</p><p>I think that both kinds of voiding are needed. When you change it, you may find the way it works now is quite often useful. <br />Here for your scenario we issue Credit Notes too(if invoice is already printed and delivered, no matter what is the reason to cancel it).<br />I think you might get into &quot;user&quot; problems if many people use your system and have too many empty/voided invoices if you don&#039;t have the option to void it like it is voided now. It might cause extra tax inspections for example...<br />Voiding is used here when everything is still internal and you are sure you can fix the problem quietly and smoothly.</p>]]></content>
			<author>
				<name><![CDATA[stefan]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=20008</uri>
			</author>
			<updated>2018-01-15T08:09:28Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=30526#p30526</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Void a Transaction Functionality]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=30524#p30524" />
			<content type="html"><![CDATA[<p>There is no guarantee that the the $ref will have the $ref of the trans_no as the first part. It is better to rely on the pattern to extract it or rely on the trans_no directly. Consider the case of straddling fiscal years.</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2018-01-15T05:53:46Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=30524#p30524</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Void a Transaction Functionality]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=30522#p30522" />
			<content type="html"><![CDATA[<p>Can I use:-</p><p>SELECT GREATEST MAX(CAST(SUBSTR($ref_fld, &quot;.(strlen($prefix)+1).&quot;,LENGTH($ref_fld)-&quot;.(strlen($postfix)+strlen($prefix)).&quot;) AS UNSIGNED)), MAX(Sql to voided table)</p><p>or would it be better to use a CASE statement?</p>]]></content>
			<author>
				<name><![CDATA[poncho1234]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=19944</uri>
			</author>
			<updated>2018-01-14T20:30:37Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=30522#p30522</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Void a Transaction Functionality]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=30512#p30512" />
			<content type="html"><![CDATA[<p>ah...</p><p>so I should be looking at:-</p><p>File:&nbsp; includes\references.inc<br /></p><div class="codebox"><pre><code>83:     function _parse_next($type, $template, $context=null)
84:     {</code></pre></div><p>this section:-</p><p>File: includes\references.inc<br /></p><div class="codebox"><pre><code>169:         // retrieve last ref number in the refline from original transaction table
170:         $sql = &quot;SELECT MAX(CAST(SUBSTR($ref_fld, &quot;.(strlen($prefix)+1).&quot;,LENGTH($ref_fld)-&quot;.(strlen($postfix)+strlen($prefix)).&quot;) AS UNSIGNED))&quot;
171:                 .&quot; FROM `$trans_table` tbl
172:                     LEFT JOIN &quot;.TB_PREF.&quot;voided v ON tbl.`$tno_fld`=v.id AND v.type=$type&quot;
173:                 .&quot; WHERE ISNULL(v.id)&quot;
174:                 .($type_fld ? &quot; AND tbl.`$type_fld`=$type&quot; : &#039;&#039;)
175:                 .&quot; AND `$ref_fld` REGEXP &quot;.db_escape(&#039;^&#039;.preg_quote($prefix).&#039;[0-9]*&#039;.preg_quote($postfix).&#039;$&#039;);
176:         $result = db_query($sql, &#039;cannot retrieve last reference&#039;);
177:         $result = db_fetch_row($result);</code></pre></div><p>?<br />My understanding of this (and my knowledge of sql is worse than php!) and ignoring the Regex..<br />Select the largest reference from debitor_trans<br />Join table with voided where id and type match</p><p>so this function returns the result which is then increased or decresed in function _increment($reference, $back=false) <br />&nbsp; &nbsp; {</p><p>so the changes need to be made in function _parse_next.....???</p>]]></content>
			<author>
				<name><![CDATA[poncho1234]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=19944</uri>
			</author>
			<updated>2018-01-13T14:24:57Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=30512#p30512</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Void a Transaction Functionality]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=30501#p30501" />
			<content type="html"><![CDATA[<p>The said function just saves the <strong>reflines.pattern</strong> field during setting of the <strong>Setup =&gt; Transaction Preferences</strong>.</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2018-01-13T06:20:33Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=30501#p30501</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Void a Transaction Functionality]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=30497#p30497" />
			<content type="html"><![CDATA[<p>Is the current function this one:-</p><p>File: <strong>includes/db/class.reflines_db.inc</strong><br /></p><div class="codebox"><pre><code>168:     function save_next($type, $reference, $line=null)
169:     {</code></pre></div><p>?</p>]]></content>
			<author>
				<name><![CDATA[poncho1234]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=19944</uri>
			</author>
			<updated>2018-01-12T16:26:23Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=30497#p30497</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Void a Transaction Functionality]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=30496#p30496" />
			<content type="html"><![CDATA[<p>What happens if last 2 got voided?</p><p>hence:</p><p>search refs, find highest value for that type (and year if new templated numbering is used)<br />search voided for highest value for that type (and year if new templated numbering is used)<br />Take the larger of the two and increment by 1</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2018-01-12T15:49:34Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=30496#p30496</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Void a Transaction Functionality]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=30495#p30495" />
			<content type="html"><![CDATA[<p>You may have to give me some better clues...please</p><p>So... <br />search refs, find highest value for that type<br />if id equals id in voided <br />increment ref by 2<br />else <br />increment ref by 1</p>]]></content>
			<author>
				<name><![CDATA[poncho1234]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=19944</uri>
			</author>
			<updated>2018-01-12T15:44:04Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=30495#p30495</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Void a Transaction Functionality]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=30488#p30488" />
			<content type="html"><![CDATA[<p>If the voided transactions too are taken into account when the greatest customer transaction is considered, it might alleviate this situation.</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2018-01-12T04:49:23Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=30488#p30488</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Void a Transaction Functionality]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=30481#p30481" />
			<content type="html"><![CDATA[<p>After a little more research it seems the ref # is obtained from customer transaction, choosing the last (greatest) value as the last invoice was voided it selects the voided ref # for the next invoice.</p><p>The other work around is to manually increase the ref # for the next invoice, but you have to remember to do it which is not ideal.</p>]]></content>
			<author>
				<name><![CDATA[poncho1234]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=19944</uri>
			</author>
			<updated>2018-01-11T19:08:32Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=30481#p30481</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Void a Transaction Functionality]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=30453#p30453" />
			<content type="html"><![CDATA[<p>After a little research, it seems this change was made for 2.3, </p><div class="quotebox"><blockquote><p>Today version 2.3RC1 of FrontAccounting has been released. This is a release candidate, so we would stress in announce it is not ready for production use, but all users are encouraged to made migration tests on it. Please do not test extensions as they are subject to changes before final 2.3 version. Features added after 2.3beta are emphasized.</p><p>If you have already installed preliminary 2.3RC release, please just extract 2.3RC1 tarball to your FrontAccounting directory; no additional maintenance is required. Otherwise follow instructions in bundled update.html file.</p><p>News in FrontAccounting 2.3<br />-----------------------------------<br />Common<br />- Allow reuse of references previously used on voided transactions</p></blockquote></div><br /><p>but I cannot find out why it was changed? there seems to be a couple of posts pre 2.3 where users want change invoice???</p><p>Do you know the forum post where this was discussed?</p><p><s>I think the code is the following added to admin\db\voiding_db.inc</s></p><p><s>109:&nbsp; &nbsp; &nbsp;$Refs-&gt;restore_last($type, $type_no);</s></p><p><s>Please note line number is from 3.1 version... it&#039;s line 128 in latest version.<br /></s><br />@apmuthu, your solution requires that a new invoice be created, this is not always the case, thanks for the suggestion, but I will stick with credit notes</p>]]></content>
			<author>
				<name><![CDATA[poncho1234]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=19944</uri>
			</author>
			<updated>2018-01-09T20:26:20Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=30453#p30453</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Void a Transaction Functionality]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=30435#p30435" />
			<content type="html"><![CDATA[<p>For now, create the new invoice and then void the previous one so that you do not void the last one.</p><p>@joe / @itronics: if this is a code bug, we need to fix it forthwith.</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2018-01-07T07:09:26Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=30435#p30435</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Void a Transaction Functionality]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=30428#p30428" />
			<content type="html"><![CDATA[<p>If you create the following invoices:-<br />Sys. # &nbsp; &nbsp; &nbsp; &nbsp; Invoice #<br />&nbsp; &nbsp; 1&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1<br />&nbsp; &nbsp; 2&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2<br />&nbsp; &nbsp; 3&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 3<br />&nbsp; &nbsp; 4&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 4<br />&nbsp; &nbsp; 5&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 5</p><p>If you then void transaction # 2 you get the following:-<br />Sys. # &nbsp; &nbsp; &nbsp; &nbsp; Invoice #<br />&nbsp; &nbsp; 1&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1<br />&nbsp; &nbsp; 3&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 3<br />&nbsp; &nbsp; 4&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;4<br />&nbsp; &nbsp; 5&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;5</p><p>Which for me gives the correct functionality</p><p>However if I void the last transaction - #5 and then create a new invoice you get:-<br />Sys. # &nbsp; &nbsp; &nbsp; &nbsp; Invoice #<br />&nbsp; &nbsp; 1&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1<br />&nbsp; &nbsp; 3&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 3<br />&nbsp; &nbsp; 4&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 4<br />&nbsp; &nbsp; 6&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 5</p><p>So ignoring ‘Legalities’ and if you have already printed / issued the invoice there are now two invoices numbered #5 (If this invoice was voided and another created after there would be three invoices #5 and so on)</p><p>So:<br />1.&nbsp; &nbsp; This is not consistent.<br />2.&nbsp; &nbsp; This could be confusing<br />3.&nbsp; &nbsp; In Colombia this is illegal (In essence invoicing software must show the same functionality as traditional pre-printed invoices, where an annulled invoice would be written or stamped ‘Annulled’ on all copies)<br />My current work around is not to void invoices, but issue credit notes.</p>]]></content>
			<author>
				<name><![CDATA[poncho1234]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=19944</uri>
			</author>
			<updated>2018-01-06T20:30:14Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=30428#p30428</id>
		</entry>
</feed>
