<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[FrontAccounting forum — Sales Invoices and Credit Notes united reference counting]]></title>
	<link rel="self" href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=7007&amp;type=atom" />
	<updated>2017-12-14T15:19:52Z</updated>
	<generator>PunBB</generator>
	<id>https://frontaccounting.com/punbb/viewtopic.php?id=7007</id>
		<entry>
			<title type="html"><![CDATA[Re: Sales Invoices and Credit Notes united reference counting]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=29989#p29989" />
			<content type="html"><![CDATA[<p>Here it is, it works on the identical reflines for Sales Invoices and Credit Notes.<br />Maybe it&#039;s too simple, but that&#039;s what I needed and I&#039;m happy with it.</p><p>CAUTION - I haven&#039;t made data checks as I use alone this system. <br />For the moment it is not impossible to manually create Sales Invoice and Credit Note with same numbers.<br />I mean if you change the displayed reference number...</p><p>Also note, here it is with mb_strlen </p><p>This is the changed part in _parse_next function:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $prefix = $match[1];<br />&nbsp; &nbsp; &nbsp; &nbsp; $postfix = $match[3];</p><p>&nbsp; &nbsp; &nbsp; &nbsp; $db_info = get_systype_db_info($type);<br />&nbsp; &nbsp; &nbsp; &nbsp; $trans_table = $db_info[0];<br />&nbsp; &nbsp; &nbsp; &nbsp; $type_fld = $db_info[1];<br />&nbsp; &nbsp; &nbsp; &nbsp; $tno_fld = $db_info[2];<br />&nbsp; &nbsp; &nbsp; &nbsp; $ref_fld = $db_info[3];<br />&nbsp; &nbsp; &nbsp; &nbsp; $type_sec = &#039;&#039;;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// change starts here<br />&nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; if($type== ST_CUSTCREDIT || $type== ST_SALESINVOICE)&nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; $type_sec = &#039;10,11&#039;;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // don&#039;t laugh, it works fine <img src="https://frontaccounting.com/punbb/img/smilies/smile.png" width="15" height="15" alt="smile" /><br />&nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; &nbsp; &nbsp; else<br />&nbsp; &nbsp; &nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; $type_sec= $type;<br />&nbsp; &nbsp; &nbsp; &nbsp; }</p><p>&nbsp; &nbsp; &nbsp; &nbsp; // retrieve last ref number in the refline from original transaction table<br />&nbsp; &nbsp; &nbsp; &nbsp; $sql = &quot;SELECT MAX(CAST(SUBSTR($ref_fld, &quot;.(mb_strlen($prefix)+1).&quot;,LENGTH($ref_fld)-&quot;.(mb_strlen($postfix)+mb_strlen($prefix)).&quot;) AS UNSIGNED))&quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .&quot; FROM `$trans_table` tbl<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; LEFT JOIN &quot;.TB_PREF.&quot;voided v ON tbl.`$tno_fld`=v.id AND v.type in ($type_sec)&quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .&quot; WHERE ISNULL(v.id)&quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .($type_fld ? &quot; AND tbl.`$type_fld`in ($type_sec)&quot; : &#039;&#039;)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .&quot; AND `$ref_fld` REGEXP &quot;.db_escape(&#039;^&#039;.preg_quote($prefix).&#039;[0-9]*&#039;.preg_quote($postfix).&#039;$&#039;);<br />&nbsp; &nbsp; &nbsp; &nbsp; $result = db_query($sql, &#039;cannot retrieve last reference&#039;);<br />&nbsp; &nbsp; &nbsp; &nbsp; $result = db_fetch_row($result);</p>]]></content>
			<author>
				<name><![CDATA[stefan]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=20008</uri>
			</author>
			<updated>2017-12-14T15:19:52Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=29989#p29989</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Sales Invoices and Credit Notes united reference counting]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=29969#p29969" />
			<content type="html"><![CDATA[<p>@stefan: would you like to submit the function changes?</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2017-12-13T18:17:30Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=29969#p29969</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Sales Invoices and Credit Notes united reference counting]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=29944#p29944" />
			<content type="html"><![CDATA[<p>I gave no feedback, but changing a little the function _parse_next works fine...</p>]]></content>
			<author>
				<name><![CDATA[stefan]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=20008</uri>
			</author>
			<updated>2017-12-12T09:43:32Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=29944#p29944</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Sales Invoices and Credit Notes united reference counting]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=28871#p28871" />
			<content type="html"><![CDATA[<p>That&#039;s only way, you need to edit the code of reference and put it as of your needs. Me too changed it like this. i mean the reference functions to create custom reference prefix</p>]]></content>
			<author>
				<name><![CDATA[kvvaradha]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=19348</uri>
			</author>
			<updated>2017-10-06T13:30:24Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=28871#p28871</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Sales Invoices and Credit Notes united reference counting]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=28858#p28858" />
			<content type="html"><![CDATA[<p>No standard fix. Hack the Credit Note script and alter the way the new reference is generated to take it as the next one from the invoices series and then use that in the Credit Note set.</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2017-10-05T13:39:51Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=28858#p28858</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Sales Invoices and Credit Notes united reference counting]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=28823#p28823" />
			<content type="html"><![CDATA[<p>I want to unite the references of Sales Invoices and Credit Notes.</p><p>Example: Invoice 1, Invoice 2, Credit Note 3, Invoice 4, Credit Note 5....</p><p>I can manually put the needed number, but that&#039;s not the point.<br />What must I do?</p>]]></content>
			<author>
				<name><![CDATA[stefan]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=20008</uri>
			</author>
			<updated>2017-10-04T06:27:30Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=28823#p28823</id>
		</entry>
</feed>
