<?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 customer]]></title>
	<link rel="self" href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=7406&amp;type=atom" />
	<updated>2020-12-25T03:17:09Z</updated>
	<generator>PunBB</generator>
	<id>https://frontaccounting.com/punbb/viewtopic.php?id=7406</id>
		<entry>
			<title type="html"><![CDATA[Re: Anatomy of adding 1 customer]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=38819#p38819" />
			<content type="html"><![CDATA[<p>hi did you write the code? is it available ?</p>]]></content>
			<author>
				<name><![CDATA[sewkar]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=18980</uri>
			</author>
			<updated>2020-12-25T03:17:09Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=38819#p38819</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Anatomy of adding 1 customer]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=31139#p31139" />
			<content type="html"><![CDATA[<p>This is useful. I will be writing the customer migration code, soon. Thank you.</p>]]></content>
			<author>
				<name><![CDATA[oakstreet1]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=42263</uri>
			</author>
			<updated>2018-03-16T16:57:43Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=31139#p31139</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Anatomy of adding 1 customer]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=31133#p31133" />
			<content type="html"><![CDATA[<p>Analysing the diffs of backups before and after adding 1 Customer resulted in a set of INSERT statements when parsed out and sequences with variable extractions done resulted in the following (Assumed TB_PREF=3_):<br /></p><div class="codebox"><pre><code>SET @Customer  := &quot;PKA Enterprises&quot;;
SET @CustShort := &quot;PKA&quot;;
SET @Phone     := &quot;28557841&quot;;
SET @EMail     := &quot;pka@example.com&quot;;
SET @Address   := &quot;Joe Smith Road\nTimbuktoo - Z9HG34&quot;;
SET @GST       := &quot;1234578&quot;;
SET @Location  := &#039;DEF&#039;;
SET @DefCurr   := (SELECT `value` FROM `3_sys_prefs` WHERE `name`=&quot;curr_default&quot; AND `category`=&quot;setup.company&quot;);
SET @Credit    := (SELECT `value` FROM `3_sys_prefs` WHERE `name`=&quot;default_credit_limit&quot; AND `category`=&quot;glsetup.customer&quot;);
SET @DfPayAc   := (SELECT `value` FROM `3_sys_prefs` WHERE `name`=&quot;default_prompt_payment_act&quot; AND `category`=&quot;glsetup.sales&quot;);
SET @PrPayAc   := (SELECT `value` FROM `3_sys_prefs` WHERE `name`=&quot;default_sales_discount_act&quot; AND `category`=&quot;glsetup.sales&quot;);
SET @DrsAc     := (SELECT `value` FROM `3_sys_prefs` WHERE `name`=&quot;debtors_act&quot; AND `category`=&quot;glsetup.sales&quot;);

INSERT INTO `3_debtors_master` VALUES
(NULL, @Customer, @CustShort, @Address, @GST, @DefCurr, &#039;1&#039;, &#039;0&#039;, &#039;0&#039;, &#039;1&#039;, &#039;4&#039;, &#039;0&#039;, &#039;0&#039;, @Credit, &#039;&#039;, &#039;0&#039;);
SET @DrNum := (SELECT LAST_INSERT_ID());

INSERT INTO `3_cust_branch` VALUES
(NULL, @DrNum, @Customer, @CustShort, @Address, &#039;1&#039;, &#039;1&#039;, @Location, &#039;1&#039;, &#039;&#039;, @PrPayAc, @DrsAc, @DfPayAc, &#039;1&#039;, @Address, &#039;0&#039;, &#039;&#039;, NULL, &#039;0&#039;);
SET @BranchID := (SELECT LAST_INSERT_ID());

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

INSERT INTO `3_crm_contacts` VALUES
(NULL, @PersonID, &#039;cust_branch&#039;, &#039;general&#039;, @BranchID),
(NULL, @PersonID, &#039;customer&#039;, &#039;general&#039;, @DrNum);</code></pre></div><p>Here, first a customer is created and then a branch for the said customer.<br />Then one Person is created.<br />This Person is then allotted to both -&nbsp; customer and cust_branch.</p><p>The above can be useful for bulk importing of customers from disparate systems.</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2018-03-16T12:12:31Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=31133#p31133</id>
		</entry>
</feed>
