<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[FrontAccounting forum — Create direct invoice programmatically]]></title>
		<link>https://frontaccounting.com/punbb/viewtopic.php?id=2963</link>
		<atom:link href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=2963&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Create direct invoice programmatically.]]></description>
		<lastBuildDate>Fri, 27 Apr 2012 20:12:32 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Create direct invoice programmatically]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=12338#p12338</link>
			<description><![CDATA[<p>I, for one, would find a transaction import module very helpful. Have you made progress on this?</p>]]></description>
			<author><![CDATA[null@example.com (sticmann)]]></author>
			<pubDate>Fri, 27 Apr 2012 20:12:32 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=12338#p12338</guid>
		</item>
		<item>
			<title><![CDATA[Re: Create direct invoice programmatically]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=12171#p12171</link>
			<description><![CDATA[<p>To save people&#039;s time, I got a better solution that works (after I had fixed some missing join columns in the customer and branch tables!), using routines in the sales_order_ui include:</p><p>&nbsp; &nbsp; $entry = new Cart(ST_SALESINVOICE, 0, true);<br />&nbsp; &nbsp; get_customer_details_to_order($entry, $customer_id, $branch_id);<br />&nbsp; &nbsp; add_to_order($entry, $item_code, 1, $gross, 0, $item_title);<br />&nbsp; &nbsp; $entry-&gt;cust_ref = $ref;<br />&nbsp; &nbsp; $taxes = $entry-&gt;get_taxes($shipping);<br />&nbsp; &nbsp; $entry-&gt;write(0);</p><p>When I had created the customer and branch records prior to creating the invoice, I had missed location, and shipper id, both of which are needed in order to re-read the sales order when it generates delivery notes and invoices.</p><p>When I have the customer payment allocation working, I&#039;ll submit the module to Joe in case anyone else finds it useful.</p>]]></description>
			<author><![CDATA[null@example.com (asro)]]></author>
			<pubDate>Fri, 06 Apr 2012 02:55:41 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=12171#p12171</guid>
		</item>
		<item>
			<title><![CDATA[Create direct invoice programmatically]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=12170#p12170</link>
			<description><![CDATA[<p>I&#039;m struggling with an add-on I&#039;m writing to import transactions from paypal. I have a version working fine creating bank deposits as cash sales, but what I&#039;d really like to do is create/update customer records, create direct invoices, and then allocate payments. The reason being that many customers might start with a paypal payment but later get invoiced directly for other work. Having all their details already in the system makes it less work later.</p><p>I have tried stepping though the cart class as a direct invoice is entered in the screen, and as far as I can see the following code might be the minimum required:</p><p>&nbsp; &nbsp; $entry = new Cart(ST_SALESINVOICE, 0);<br />&nbsp; &nbsp; $entry-&gt;set_customer($customer_id, $company, $currency, 0, -1, 0); <br />&nbsp; &nbsp; $myrow = get_sales_type($paypal_sales_type_id);<br />&nbsp; &nbsp; $entry-&gt;set_sales_type($myrow[&#039;id&#039;], $myrow[&#039;sales_type&#039;],<br />&nbsp; &nbsp; &nbsp; &nbsp; $myrow[&#039;tax_included&#039;], $myrow[&#039;factor&#039;]);<br />&nbsp; &nbsp; $entry-&gt;add_to_cart(0, $item_code, 1, $gross, 0, 0, $item_title, 0, 0, 0);<br />&nbsp; &nbsp; $taxes = $entry-&gt;get_taxes($shipping);<br />&nbsp; &nbsp; $entry-&gt;write(1);</p><p>There is a value in every variable, and the customer records have been set up, and I&#039;ve created direct invoices through FA using those generated customers.</p><p>But when I run my import I get an error for every transaction:</p><p>You have missing or invalid sales document in database (type:30, number:x).</p><p>Is anyone able to help?</p><p>Many thanks<br />Alastair</p>]]></description>
			<author><![CDATA[null@example.com (asro)]]></author>
			<pubDate>Thu, 05 Apr 2012 23:59:45 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=12170#p12170</guid>
		</item>
	</channel>
</rss>
