<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[FrontAccounting forum — [SOLVED]: sales_orders.type=0 not in Template Invoice listing]]></title>
	<link rel="self" href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=5432&amp;type=atom" />
	<updated>2014-12-30T19:35:18Z</updated>
	<generator>PunBB</generator>
	<id>https://frontaccounting.com/punbb/viewtopic.php?id=5432</id>
		<entry>
			<title type="html"><![CDATA[Re: [SOLVED]: sales_orders.type=0 not in Template Invoice listing]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=21968#p21968" />
			<content type="html"><![CDATA[<p>The <strong>Tmpl</strong> checkbox needs to be checked (ticked) in the <strong>Sales =&gt; Sales Order Inquiry</strong> to set the <strong>sales_orders.type=1</strong>.</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2014-12-30T19:35:18Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=21968#p21968</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[[SOLVED]: sales_orders.type=0 not in Template Invoice listing]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=21966#p21966" />
			<content type="html"><![CDATA[<p><strong>Sales =&gt; Template Invoice</strong></p><p>If we had earlier entered a Direct Invoice, then <strong>sales_orders.type=0</strong> and will not display it in the Invoice Template listing.</p><p>This is due to line 503-504 in <strong>sales/includes/db/sales_order_db.inc</strong>:<br /></p><div class="codebox"><pre><code>        elseif ($filter==&#039;InvoiceTemplates&#039; || $filter==&#039;DeliveryTemplates&#039;)
            $sql .= &quot; AND sorder.type=1&quot;;</code></pre></div><p>Is this the intended functionality?</p><p>What are the possible values of the <strong>sales_orders.type</strong> field and what do they indicate?</p><p>Even a fresh sales order results in <strong>sales_orders.type</strong> field being 0.</p><p>Also if a direct invoice is entered, the Invoice id is incremented but the Sales Order number is not incremented as seen in the <strong>Setup =&gt; Forms Setup</strong> screen. When the next sales order entry is made, the Sales Order number is incremented from it&#039;s old wrong value and hence remains wrong in the <strong>Setup =&gt; Forms Setup</strong> display.</p><p>Hence the <strong>next_reference</strong> field in the <strong>sys_types</strong> table can easily become out of sync with actuals. Instead of incrementing the values in the next_reference field, it is better to use the <strong>last_insert_id() + 1</strong> or take max of field from appropriate table&#039;s primary key.</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2014-12-30T18:51:38Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=21966#p21966</id>
		</entry>
</feed>
