<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[FrontAccounting forum — Anatomy of adding 1 Supplier]]></title>
	<link rel="self" href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=7407&amp;type=atom" />
	<updated>2018-03-16T21:16:00Z</updated>
	<generator>PunBB</generator>
	<id>https://frontaccounting.com/punbb/viewtopic.php?id=7407</id>
		<entry>
			<title type="html"><![CDATA[Anatomy of adding 1 Supplier]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=31144#p31144" />
			<content type="html"><![CDATA[<p>Taking the sql backup diffs between before and after adding a single Supplier, the following sequence of SQL statements are observed (Assumed TB_PREF=3_):<br /></p><div class="codebox"><pre><code>SET @Supplier  := &quot;Finger Chips Intl.&quot;;
SET @SuppShort := &quot;FCI&quot;;
SET @Contact   := &quot;Jackson&quot;;
SET @Phone     := &quot;568974521&quot;;
SET @EMail     := &quot;supplier1@example.com&quot;;
SET @Website   := &quot;http://www.fci.com&quot;;
SET @Address   := &quot;Alpha Street,\nGladystown - 654543&quot;;
SET @GST       := &quot;8954587411&quot;;
SET @DefCurr   := (SELECT `value` FROM `3_sys_prefs` WHERE `name`=&quot;curr_default&quot; AND `category`=&quot;setup.company&quot;);
SET @CredAc    := (SELECT `value` FROM `3_sys_prefs` WHERE `name`=&quot;creditors_act&quot; AND `category`=&quot;glsetup.purchase&quot;);
SET @PayDsctAc := (SELECT `value` FROM `3_sys_prefs` WHERE `name`=&quot;pyt_discount_act&quot; AND `category`=&quot;glsetup.purchase&quot;);

INSERT INTO `3_suppliers` VALUES
(NULL, @Supplier, @SuppShort, @Address, &#039;&#039;, @Phone, &#039;&#039;, &#039;&#039;, @Website, &#039;&#039;, @DefCurr, &#039;4&#039;, &#039;0&#039;, &#039;0&#039;, &#039;0&#039;, &#039;1&#039;, &#039;0&#039;, &#039;&#039;, @CredAc, @PayDsctAc, &#039;&#039;, &#039;0&#039;);
SET @SupplierID := (SELECT LAST_INSERT_ID());

INSERT INTO `3_crm_persons` VALUES
(NULL, @SuppShort, @Contact, NULL, @Address, @GST, NULL, NULL, @EMail, NULL, &#039;&#039;, &#039;0&#039;);
SET @PersonID := (SELECT LAST_INSERT_ID());

INSERT INTO `3_crm_contacts` VALUES
(NULL, @PersonID, &#039;supplier&#039;, &#039;general&#039;, @SupplierID);</code></pre></div><p>Here, first a Supplier is created.<br />Then a Person is created.<br />Finally, this new&nbsp; Person is assigned to the new Supplier as a Contact.</p><p>The above can be useful for bulk importing of suppliers from disparate systems.</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2018-03-16T21:16:00Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=31144#p31144</id>
		</entry>
</feed>
