Find file
Fetching contributors…
Cannot retrieve contributors at this time
347 lines (334 sloc) 21 KB
<!doctype html public "-//W30//DTD W3 HTML 2.0//EN">
<!-- This file was generated using SDF 2.001 by
Ian Clatworthy ( SDF is freely
available from -->
<TITLE>Interchange + QuickBooks HOWTO</TITLE>
<BODY BGCOLOR="ffffff" LINK="993333">
<DIV CLASS="header">
<DIV CLASS="navigate">
<P ALIGN="Center"><A HREF="index.html" TARGET="_top">Catalog</A></P>
<DIV CLASS="title">
<P><IMG SRC="iclogo.gif" ALIGN="Right"></P>
<H1 CLASS="doc-title">Interchange + QuickBooks HOWTO</H1>
<ADDRESS CLASS="doc-author"></ADDRESS>
<BR CLEAR="All">
<DIV CLASS="contents">
<H2>Table of Contents</H2>
<A HREF="#Introduction">1. Introduction</A><UL>
<A HREF="#Summary Description">1.1. Summary Description</A>
<A HREF="#Audience">1.2. Audience</A>
<A HREF="#Contact the author">1.3. Contact the author</A>
<A HREF="#Version">1.4. Version</A></UL>
<A HREF="#Description">2. Description</A>
<A HREF="#Contents">3. Contents</A>
<A HREF="#Installation">4. Installation</A><UL>
<A HREF="#Terms and locations">4.1. Terms and locations</A>
<A HREF="#Create and copy directories and files">4.2. Create and copy directories and files</A>
<A HREF="#Quick Installation Script">4.3. Quick Installation Script</A>
<A HREF="#Admin UI Usage">4.4. Admin UI Usage</A>
<A HREF="#Additional database fields -- userdb">4.5. Additional database fields -- userdb</A>
<A HREF="#Additional database fields -- inventory">4.6. Additional database fields -- inventory</A>
<A HREF="#Additional database fields -- inventory">4.7. Additional database fields -- inventory</A>
<A HREF="#Modify catalog.cfg with additions:">4.8. Modify catalog.cfg with additions:</A>
<A HREF="#Add quickbooks order route">4.9. Add quickbooks order route</A>
<A HREF="#Additional Variables">4.10. Additional Variables</A>
<A HREF="#Restart the catalog">4.11. Restart the catalog</A>
<A HREF="#Export the items">4.12. Export the items</A>
<A HREF="#Test">4.13. Test</A></UL>
<A HREF="#Usage">5. Usage</A><UL>
<A HREF="#Accessing Admin UI Features">5.1. Accessing Admin UI Features</A>
<A HREF="#Generating IIF Files">5.2. Generating IIF Files</A></UL>
<A HREF="#Discussion">6. Discussion</A><UL>
<A HREF="#Sales Tax">6.1. Sales Tax</A>
<A HREF="#Shipping">6.2. Shipping</A>
<A HREF="#Customer Imports">6.3. Customer Imports</A>
<A HREF="#IIF generation at time of order">6.4. IIF generation at time of order</A></UL>
<A HREF="#Credits">A. Credits</A>
<A HREF="#Document history">B. Document history</A>
<A HREF="#Resources">C. Resources</A><UL>
<A HREF="#Documentation">C.1. Documentation</A></UL></UL>
<DIV CLASS="main">
<H1><A NAME="Introduction">1. Introduction</A></H1>
<H2><A NAME="Summary Description">1.1. Summary Description</A></H2>
<P>Interchange QuickBooks -- QuickBooks support for transactions and items</P>
<H2><A NAME="Audience">1.2. Audience</A></H2>
<P>Users who already have Quickbooks setup and are familiar with it, in addition to having the foundation (or other) catalog correctly working.</P>
<H2><A NAME="Contact the author">1.3. Contact the author</A></H2>
<P>If you find any spelling errors, technical slip-ups, mistakes, subliminal messages, or if you wish to send feedback, critique, remarks, comments, or if you wish to contribute examples, instructions for alternative platforms, chapters, or other material, please do so.</P>
<P>The preferred method of submitting changes is in the form of a context diff against the SDF source file (ic_howto_qb.sdf). Please address your correspondence to:</P>
<P>Volunteer Maintainer, Dan Browning <A HREF=""></A></P>
<P>Original Author, Mike Heins <A HREF=""></A></P>
<H2><A NAME="Version">1.4. Version</A></H2>
<P>This document describes software based on Interchange 4.5 and later.</P>
<H1><A NAME="Description">2. Description</A></H1>
<P>Interchange is a business-to-business and business-to-consumer internet ordering and cataloguing product. It has the ability to take orders via the World Wide Web, and store transaction data.</P>
<P>This document describes how to interface Interchange with QuickBooks, the popular small-business accounting program from Intuit.</P>
<P>QuickBooks has an import/export format called IIF, a mnemonic for Intuit Interchange Format. Fitting, eh?</P>
<P>The standard capabilities of Interchange allow production of IIF files for transaction passing. With some support from Interchange UserTags, it can even import and export item listings.</P>
<H1><A NAME="Contents">3. Contents</A></H1>
<P>The extension files can be found in the Interchange tarball under the '<TT>extensions/quickbooks</TT>' directory. The following files are used with this extension:</P>
usertag/import_quicken_items UserTag for importing items
usertag/export_quicken_items UserTag for exporting items
usertag/export_quicken_coa.tag UserTag for exporting Chart Of Accounts
usertag/get_quicken_orders.tag UserTag for exporting orders
pages/admin/quickbooks/* Menu support for Interchange UI
qb.catalog.cfg Quickbooks configuration.
<H1><A NAME="Installation">4. Installation</A></H1>
<P>To set up this extension, the basic steps are:</P>
<LI>Create and copy directories and files.
<LI>Add additional database fields.
<LI>Modify catalog.cfg with additions.
<LI>Add &quot;quickbooks&quot; order route to checkout pages.
<LI>Restart Interchange.
<LI>Export your items from Interchange catalog (or import your existing QuickBooks items to Interchange).
<H2><A NAME="Terms and locations">4.1. Terms and locations</A></H2>
<P>Several terms are used in the examples.</P>
<P><B>Catalog Directory</B></P>
This is the main directory for the catalog, where catalog.cfg resides. It will have a NAME, the name for the catalog. (Some common Interchange demo names are <TT>foundation</TT>, <TT>construct</TT>, <TT>barry</TT>, and <TT>simple</TT>.)
Common locations:
/var/lib/interchange/NAME /usr/local/interchange/catalogs/NAME $HOME/catalogs/NAME
We will use the path <TT>/var/lib/interchange/foundation</TT> in these examples.</UL>
<P><B>Interchange software directory</B></P>
This is the main directory for your Interchange server, where the file <TT>interchange.cfg</TT> resides. Common locations:
/usr/lib/interchange /usr/local/interchange $HOME/ic
We will use the path <TT>/usr/lib/interchange</TT> in these examples.</UL>
<P><B>Interchange tarball directory</B></P>
The quickbooks files are located in the untarred distribution file, before installation of Interchange is performed.</UL>
<P><B>Interchange User</B></P>
The Interchange daemon runs as a user ID that cannot be root. It will require write permission on directories it must modify to do its work.
We will use the user ID <TT>interch</TT> in these examples.</UL>
<H2><A NAME="Create and copy directories and files">4.2. Create and copy directories and files</A></H2>
<P>This extension requires you to add some files to your catalog.</P>
<P>It is assumed you have tools and knowledge to create directories with the proper permissions. Any directories that will contain varying files like order transaction logs will require write permission for the Interchange daemon user; pages and configuration only need have read permission.</P>
<H2><A NAME="Quick Installation Script">4.3. Quick Installation Script</A></H2>
<P>This script will install the necessary files for you. To use it, you must first create a new file, and paste the template script (below) into it. Then, modify the environment variables to match your environment.</P>
<P>the variables to your environment. Alternately, you can follow the more detailed installation instructions that follow it.</P>
<P>Note that if you are not using a 4.9.8+ version of Interchange, you will need to manually install the qb_safe.filter by copying it from the 4.9.8 code/Filter/qb_safe.filter into your Interchange version.</P>
# ================ o&lt; === Quick Installation Script === &gt;o ================
# Modify these three variables to match your environment.
export QB=/path/to/interchange/extensions/quickbooks
export VENDROOT=/usr/local/interchange
export CATROOT=/home/interch/catalogs/foundation
mkdir -p $CATROOT/include/menus $CATROOT/vars
cp -r $QB/pages/admin/quickbooks \
cp -i $QB/usertag/* \
# Alternate usertag installation style:
#mkdir -p $CATROOT/usertags/global
#cp -i $QB/usertag/* \
# $CATROOT/usertags/global
# Then include the global/*.tag in your interchange.cfg
# Variables that optionally modify the export process, along with
# their help entries.
cat $QB/products/variable.txt.append &gt;&gt; \
cat $QB/products/mv_metadata.asc.append &gt;&gt; \
# Menu entries: start with the existing menu, then add ours.
cp -i $VENDROOT/lib/UI/pages/include/menus/Admin.txt \
cat $QB/menus/Admin.txt.append &gt;&gt; \
# Some configuration changes.
cat &gt;&gt; $CATROOT/catalog.cfg &lt;&lt;EOF
DirConfig Variable vars
# You can remove these requires if you don't want to use the
# Quickbooks UI menu items
Require usertag import_quicken_items
Require usertag export_quicken_items
# ================ o&lt; === Quick Installation Script === &gt;o ================
<H2><A NAME="Admin UI Usage">4.4. Admin UI Usage</A></H2>
<P>After successful installation, there should be a &quot;Quickbooks&quot; menu item under the &quot;Admin&quot; category. From there, you can &quot;generate IIF files&quot;, download them, and perform other Quickbooks-related tasks.</P>
<P><B>Make orders directory</B></P>
Create the directory <TT>orders</TT> in your Catalog Directory if it doesn't already exist. (It may be a symbolic link to another location.) It must have write permission on it.
cd /var/lib/interchange/foundation mkdir orders
If you are doing this as root, also do:
chown interch orders
This directory is used to store the QuickBooks IIF files produced for orders. The files are created with the form:
Each day will have a file, and when a day is complete you should download the orders. (There are other schemes possible.)</UL>
<P><B>Copy pages</B></P>
You will want the Interchange UI support if you are using the UI. It provides links for importing/exporting items, downloading and viewing IIF files, and possibly other functions over time. At the UNIX command line:
cd /usr/lib/interchange/ cp -r extensions/quickbooks/pages/admin/quickbooks \ /var/lib/interchange/foundation/pages</UL>
<P><B>Copy usertags</B></P>
If you want to use the UI item import/export, two usertags are required. The easiest thing is just to copy them to the Interchange software directory subdirectory <TT>code/UI_Tag</TT>, which is #included as a part of the UI configuration file.
cd /usr/lib/interchange cp -i extensions/quickbooks/usertag/* code/UI_Tag</UL>
<H2><A NAME="Additional database fields -- userdb">4.5. Additional database fields -- userdb</A></H2>
<P>If your catalog is not based on a 4.6+ version of the foundation catalog, you may not have some of the additional database fields necessary. If you want the user to retain their customer number, add the following field to the &quot;userdb&quot; table:</P>
<P>It can be an integer number field if your database needs that information. To add the field in MySQL, you can issue the following queries at the mysql prompt:</P>
<P>alter table userdb add column customer_number int;</P>
<P>If you don't add it, it just means that a new customer number will be assigned every time.</P>
<P>WARNING If you are using Interchange DBM files and have live data it is not recommended you add this field unless you are positive you will not overwrite your data. If you are not a developer, get one to help you. In any case, back up your userdb.gdbm or userdb.db file first.</P>
<H2><A NAME="Additional database fields -- inventory">4.6. Additional database fields -- inventory</A></H2>
<P>Quicken also needs an account to debit for the split transactions it uses to track item sales. If you don't create these fields to relate to each SKU, the account &quot;Other Income&quot; will be used in the exports.</P>
<P>Add the following fields to the &quot;inventory&quot; table:</P>
<P>account cogs_account</P>
<P>To add the fields in MySQL, you can issue the following queries at the mysql prompt:</P>
<P>alter table inventory add column account char(20); alter table inventory add column cogs_account char(20);</P>
<H2><A NAME="Additional database fields -- inventory">4.7. Additional database fields -- inventory</A></H2>
<P>Quicken also needs an tax agency field for sales tax Add the following fields to the &quot;state&quot; table:</P>
<P>account cogs_account</P>
<P>To add the fields in MySQL, you can issue the following query at the mysql prompt:</P>
<P>alter table state add column qb_tax_agency varchar(255);</P>
<P>Other SQL databases will have similar facilities.</P>
<P>If you are using Interchange DBM files, just export the inventory database, stop the Interchange server (to prevent corruption), add the fields on the first line by editing the <TT>inventory.txt</TT> file, then restart Interchange.</P>
<H2><A NAME="Modify catalog.cfg with additions:">4.8. Modify catalog.cfg with additions:</A></H2>
<P>Add the entries in qb.catalog.cfg to catalog.cfg (you can use an include statement if you wish).</P>
<P>There are some Require directives to ensure that the needed UserTag definitions are included in the catalog, as well as the Route which is used</P>
<H2><A NAME="Add quickbooks order route">4.9. Add quickbooks order route</A></H2>
<P>In the Interchange UI, there is a Preferences area &quot;ORDER_ROUTES&quot;. You should add the <TT>quickbooks</TT> route. Place it after the transaction logging step, i.e.</P>
<P>code ORDER_ROUTES Variable log quickbooks main copy_user</P>
<P>ADVANCED, If you know Interchange Variable settings, you can add it directly:</P>
<P>Variable ORDER_ROUTES log quickbooks main copy_user</P>
<P>Also, you can use other methods to set order routes. See the Interchange reference documentation.</P>
<H2><A NAME="Additional Variables">4.10. Additional Variables</A></H2>
<P>Optionally, you may specify some variables that modify the behavior of the Quickbooks export feature. Documentation for these variables is provided via item-specific meta data, which can be added to your mv_metadata.asc file for automatic display by the Admin UI.</P>
<P>See the installation script at the top of this document for commands that will append the empty variables to your variable.txt and the help information to your mv_metadata.asc files.</P>
<H2><A NAME="Restart the catalog">4.11. Restart the catalog</A></H2>
<P>This can be done by restarting the Interchange server or by clicking <TT>Apply Changes</TT> in the UI.</P>
<H2><A NAME="Export the items">4.12. Export the items</A></H2>
<P>You can access the Quickbooks UI index by making your URL:</P>
<P><A HREF="http://YOURCATALOG_URL/admin/quickbooks/index">http://YOURCATALOG_URL/admin/quickbooks/index</A></P>
<P>It will provide options for importing and exporting items. This is necessary so QuickBooks will be able to take orders for your items.</P>
<P>QuickBooks uses the product &quot;name&quot; as an SKU, along with an integer reference number. Either you need to make your SKUs match the integer reference number, or you must ensure your product title is unique.</P>
<H2><A NAME="Test">4.13. Test</A></H2>
<P>Place a test order on your Interchange catalog once you have finished installing. You should find a file in the <TT>orders</TT> directory with the name <TT>qbYYYYMMDD.iif</TT>. (YYYY=year, MM=month, DD=day.) Transfer this file to your QuickBooks machine and run File/Import and select that file as the source. This should import the customer and order into the system. If it doesn't work, it may be due to lack of sales tax or shipping definitions, discussed below.</P>
<H1><A NAME="Usage">5. Usage</A></H1>
<H2><A NAME="Accessing Admin UI Features">5.1. Accessing Admin UI Features</A></H2>
<P>A typical installation will cause the Administrative User Interface Features to become available via the top level menu:</P>
<LI>Login to the Admin UI
<P>You should then be presented with a menu of the Admin UI features.</P>
<H2><A NAME="Generating IIF Files">5.2. Generating IIF Files</A></H2>
<P>To generate the IIF files, access the corresponding page from the Admin UI Quickbooks Menu (Administration -&gt; Quickbooks -&gt; Generate IIF Files).</P>
<P>You will be presented with a query tool. Select the query options that you would like and submit your query. Among the query options, you have the option to input a QB transaction number. This will be the first number that is used when generating the IIF files, and it will be incremented for each sequential order in the query.</P>
<P>You will be notified of its success or failure. The resulting page will:</P>
<LI>Inform you of the success or failure of the query.
<LI>Provide a link to the &quot;results&quot; IIF file (which includes all of the orders found by the query). Note that this &quot;results&quot; IIf file is overwritten every time a query is run.
<LI>Provide a link for each IIF file (one per order). This can be used as a backup, or for importing one-by-one instead of all at once.</UL>
<H1><A NAME="Discussion">6. Discussion</A></H1>
<P>The interface provided works for the sample company data distributed with QuickBooks. There are certain requirements to make sure it works in your environment.</P>
<P>Also, you can change the configuration by editing the file etc/trans_quickbooks to suit your IIF file needs.</P>
<H2><A NAME="Sales Tax">6.1. Sales Tax</A></H2>
<P>QuickBooks has a taxing system whereby tax rates are defined by customer location. There is usually also a generic <TT>Sales Tax Item</TT>, such as contained in the sample company data. This allows Interchange to calculate the sales tax. If that item is not present then you will need to create it, or specify your tax item using the <TT>QB_SALES_TAX_ITEM</TT> variable.</P>
<H2><A NAME="Shipping">6.2. Shipping</A></H2>
<P>Interchange will add a generic item <TT>Shipping</TT> to each order that has a shipping cost. Its MEMO field will contain the text description of the mode. If that item is not in your QuickBooks item definitions, then you must create it, or specify your shipping item using the <TT>QB_SHIPPING_ITEM</TT> variable.</P>
<H2><A NAME="Customer Imports">6.3. Customer Imports</A></H2>
<P>To generate a QuickBooks transtype of INVOICE, a CUSTOMER is required. Interchange outputs a CUST IIF record for each sale with the customer information. Since QuickBooks uses the customer name or company to generate the unique listing, we place the Interchange username in parentheses after the company or name.</P>
<H2><A NAME="IIF generation at time of order">6.4. IIF generation at time of order</A></H2>
<P>As of 4.9, the IIF generation was moved from an order route into the Admin UI. This was done so that the IIF generation process could be fine tuned without restarting Interchange and placing an order. If you need the IIF file generated at the time of order, you can still access the pre-4.9.6 files in <TT>extensions/quickbooks/legacy</TT>.</P>
<H1><A NAME="Credits">A. Credits</A></H1>
<LI><B>Mike Heins</B>: This document was copied from the original POD documentation (<TT>extensions/quickbooks/ic_qb.pod</TT>) written by Mike Heins <A HREF=""></A>.
<LI><B>Dan Browning</B>: Updated by Dan Browning <A HREF=""></A>.</UL>
<H1><A NAME="Document history">B. Document history</A></H1>
<LI>July 20, 2002. Initial revision.</UL>
<H1><A NAME="Resources">C. Resources</A></H1>
<H2><A NAME="Documentation">C.1. Documentation</A></H2>
<LI>What are the IIF File Headers? <A HREF=""></A>
<LI>Also see the Quickbooks Help item, &quot;Reference guide to import files&quot;</UL>
<P>Copyright 2002-2007 Interchange Development Group. Freely redistributable
under the terms of the GNU General Public License.</P>
<DIV CLASS="footer">
<DIV CLASS="navigate">
<P ALIGN="Center"><A HREF="index.html" TARGET="_top">Catalog</A></P>
<ADDRESS><SPAN CLASS="doc-id">ic_howto_qb-1.6</SPAN> <SPAN CLASS="doc-status">(Draft)</SPAN></ADDRESS>
<ADDRESS CLASS="doc-modified">10 January 2006</ADDRESS>
<ADDRESS CLASS="copyright">Copyright &copy; Mike Heins &lt;<A HREF=""></A>&gt;, Dan Browning &lt;<A HREF=""></A>&gt;</ADDRESS>