<?xml version="1.0" encoding="UTF-8" ?>
<!-- $Header: /cvsroot/autodoc/autodoc/xml.tmpl,v 1.2 2006/05/16 19:01:27 rbt Exp $ -->

<book id="database.ledgersmb" xreflabel="ledgersmb database schema"><title>ledgersmb Model</title>




  <chapter id="public.schema"
           xreflabel="public">
    <title>Schema public</title>
    <para>Standard public schema</para>


      <section id="public.table.acc-trans"
               xreflabel="public.acc_trans">
        <title id="public.table.acc-trans-title">
         Table:
         
         <structname>acc_trans</structname>
        </title>
 


        <para>
          <variablelist>
            <title>
              Structure of <structname>acc_trans</structname>
            </title>


            <varlistentry>
              <term><structfield>trans_id</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>chart_id</structfield></term>
              <listitem><para>
                <type>integer</type>







                <literal>NOT NULL</literal>






                <literal>REFERENCES</literal> <xref linkend="public.table.chart"/>


              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>amount</structfield></term>
              <listitem><para>
                <type>numeric</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>transdate</structfield></term>
              <listitem><para>
                <type>date</type>





                <literal>DEFAULT (&apos;now&apos;::text)::date</literal>



              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>source</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>cleared</structfield></term>
              <listitem><para>
                <type>boolean</type>





                <literal>DEFAULT false</literal>



              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>fx_transaction</structfield></term>
              <listitem><para>
                <type>boolean</type>





                <literal>DEFAULT false</literal>



              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>project_id</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>memo</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>invoice_id</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>entry_id</structfield></term>
              <listitem><para>
                <type>serial</type>


                <literal>PRIMARY KEY</literal>













              </para>

            </listitem>
          </varlistentry>

        </variablelist>





        <variablelist>
          <title>Indexes on acc_trans</title>

          <varlistentry>
            <term>acc_trans_chart_id_key</term>
            <listitem><para>chart_id</para></listitem>
          </varlistentry>



          <varlistentry>
            <term>acc_trans_source_key</term>
            <listitem><para>lower(source)</para></listitem>
          </varlistentry>



          <varlistentry>
            <term>acc_trans_trans_id_key</term>
            <listitem><para>trans_id</para></listitem>
          </varlistentry>



          <varlistentry>
            <term>acc_trans_transdate_key</term>
            <listitem><para>transdate</para></listitem>
          </varlistentry>

        </variablelist>








      </para>
    </section>

      <section id="public.table.ap"
               xreflabel="public.ap">
        <title id="public.table.ap-title">
         Table:
         
         <structname>ap</structname>
        </title>
 


        <para>
          <variablelist>
            <title>
              Structure of <structname>ap</structname>
            </title>


            <varlistentry>
              <term><structfield>id</structfield></term>
              <listitem><para>
                <type>integer</type>


                <literal>PRIMARY KEY</literal>









                <literal>DEFAULT nextval(&apos;id&apos;::regclass)</literal>





              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>invnumber</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>transdate</structfield></term>
              <listitem><para>
                <type>date</type>





                <literal>DEFAULT (&apos;now&apos;::text)::date</literal>



              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>vendor_id</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>taxincluded</structfield></term>
              <listitem><para>
                <type>boolean</type>





                <literal>DEFAULT false</literal>



              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>amount</structfield></term>
              <listitem><para>
                <type>numeric</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>netamount</structfield></term>
              <listitem><para>
                <type>numeric</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>paid</structfield></term>
              <listitem><para>
                <type>numeric</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>datepaid</structfield></term>
              <listitem><para>
                <type>date</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>duedate</structfield></term>
              <listitem><para>
                <type>date</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>invoice</structfield></term>
              <listitem><para>
                <type>boolean</type>





                <literal>DEFAULT false</literal>



              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>ordnumber</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>curr</structfield></term>
              <listitem><para>
                <type>character(3)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>notes</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>employee_id</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>till</structfield></term>
              <listitem><para>
                <type>character varying(20)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>quonumber</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>intnotes</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>department_id</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>shipvia</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>language_code</structfield></term>
              <listitem><para>
                <type>character varying(6)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>ponumber</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>shippingpoint</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>terms</structfield></term>
              <listitem><para>
                <type>smallint</type>







              </para>

            </listitem>
          </varlistentry>

        </variablelist>





        <variablelist>
          <title>Indexes on ap</title>

          <varlistentry>
            <term>ap_employee_id_key</term>
            <listitem><para>employee_id</para></listitem>
          </varlistentry>



          <varlistentry>
            <term>ap_id_key</term>
            <listitem><para>id</para></listitem>
          </varlistentry>



          <varlistentry>
            <term>ap_invnumber_key</term>
            <listitem><para>invnumber</para></listitem>
          </varlistentry>



          <varlistentry>
            <term>ap_ordnumber_key</term>
            <listitem><para>ordnumber</para></listitem>
          </varlistentry>



          <varlistentry>
            <term>ap_quonumber_key</term>
            <listitem><para>quonumber</para></listitem>
          </varlistentry>



          <varlistentry>
            <term>ap_transdate_key</term>
            <listitem><para>transdate</para></listitem>
          </varlistentry>



          <varlistentry>
            <term>ap_vendor_id_key</term>
            <listitem><para>vendor_id</para></listitem>
          </varlistentry>

        </variablelist>








      </para>
    </section>

      <section id="public.table.ar"
               xreflabel="public.ar">
        <title id="public.table.ar-title">
         Table:
         
         <structname>ar</structname>
        </title>
 


        <para>
          <variablelist>
            <title>
              Structure of <structname>ar</structname>
            </title>


            <varlistentry>
              <term><structfield>id</structfield></term>
              <listitem><para>
                <type>integer</type>


                <literal>PRIMARY KEY</literal>









                <literal>DEFAULT nextval(&apos;id&apos;::regclass)</literal>





              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>invnumber</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>transdate</structfield></term>
              <listitem><para>
                <type>date</type>





                <literal>DEFAULT (&apos;now&apos;::text)::date</literal>



              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>customer_id</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>taxincluded</structfield></term>
              <listitem><para>
                <type>boolean</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>amount</structfield></term>
              <listitem><para>
                <type>numeric</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>netamount</structfield></term>
              <listitem><para>
                <type>numeric</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>paid</structfield></term>
              <listitem><para>
                <type>numeric</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>datepaid</structfield></term>
              <listitem><para>
                <type>date</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>duedate</structfield></term>
              <listitem><para>
                <type>date</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>invoice</structfield></term>
              <listitem><para>
                <type>boolean</type>





                <literal>DEFAULT false</literal>



              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>shippingpoint</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>terms</structfield></term>
              <listitem><para>
                <type>smallint</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>notes</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>curr</structfield></term>
              <listitem><para>
                <type>character(3)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>ordnumber</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>employee_id</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>till</structfield></term>
              <listitem><para>
                <type>character varying(20)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>quonumber</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>intnotes</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>department_id</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>shipvia</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>language_code</structfield></term>
              <listitem><para>
                <type>character varying(6)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>ponumber</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

        </variablelist>





        <variablelist>
          <title>Indexes on ar</title>

          <varlistentry>
            <term>ar_customer_id_key</term>
            <listitem><para>customer_id</para></listitem>
          </varlistentry>



          <varlistentry>
            <term>ar_employee_id_key</term>
            <listitem><para>employee_id</para></listitem>
          </varlistentry>



          <varlistentry>
            <term>ar_id_key</term>
            <listitem><para>id</para></listitem>
          </varlistentry>



          <varlistentry>
            <term>ar_invnumber_key</term>
            <listitem><para>invnumber</para></listitem>
          </varlistentry>



          <varlistentry>
            <term>ar_ordnumber_key</term>
            <listitem><para>ordnumber</para></listitem>
          </varlistentry>



          <varlistentry>
            <term>ar_quonumber_key</term>
            <listitem><para>quonumber</para></listitem>
          </varlistentry>



          <varlistentry>
            <term>ar_transdate_key</term>
            <listitem><para>transdate</para></listitem>
          </varlistentry>

        </variablelist>








      </para>
    </section>

      <section id="public.table.assembly"
               xreflabel="public.assembly">
        <title id="public.table.assembly-title">
         Table:
         
         <structname>assembly</structname>
        </title>
 


        <para>
          <variablelist>
            <title>
              Structure of <structname>assembly</structname>
            </title>


            <varlistentry>
              <term><structfield>id</structfield></term>
              <listitem><para>
                <type>integer</type>


                <literal>PRIMARY KEY</literal>













              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>parts_id</structfield></term>
              <listitem><para>
                <type>integer</type>


                <literal>PRIMARY KEY</literal>













              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>qty</structfield></term>
              <listitem><para>
                <type>numeric</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>bom</structfield></term>
              <listitem><para>
                <type>boolean</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>adj</structfield></term>
              <listitem><para>
                <type>boolean</type>







              </para>

            </listitem>
          </varlistentry>

        </variablelist>





        <variablelist>
          <title>Indexes on assembly</title>

          <varlistentry>
            <term>assembly_id_key</term>
            <listitem><para>id</para></listitem>
          </varlistentry>

        </variablelist>








      </para>
    </section>

      <section id="public.table.audittrail"
               xreflabel="public.audittrail">
        <title id="public.table.audittrail-title">
         Table:
         
         <structname>audittrail</structname>
        </title>
 


        <para>
          <variablelist>
            <title>
              Structure of <structname>audittrail</structname>
            </title>


            <varlistentry>
              <term><structfield>trans_id</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>tablename</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>reference</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>formname</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>action</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>transdate</structfield></term>
              <listitem><para>
                <type>timestamp without time zone</type>





                <literal>DEFAULT now()</literal>



              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>employee_id</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>entry_id</structfield></term>
              <listitem><para>
                <type>bigserial</type>


                <literal>PRIMARY KEY</literal>













              </para>

            </listitem>
          </varlistentry>

        </variablelist>





        <variablelist>
          <title>Indexes on audittrail</title>

          <varlistentry>
            <term>audittrail_trans_id_key</term>
            <listitem><para>trans_id</para></listitem>
          </varlistentry>

        </variablelist>








      </para>
    </section>

      <section id="public.table.business"
               xreflabel="public.business">
        <title id="public.table.business-title">
         Table:
         
         <structname>business</structname>
        </title>
 


        <para>
          <variablelist>
            <title>
              Structure of <structname>business</structname>
            </title>


            <varlistentry>
              <term><structfield>id</structfield></term>
              <listitem><para>
                <type>integer</type>


                <literal>PRIMARY KEY</literal>









                <literal>DEFAULT nextval(&apos;id&apos;::regclass)</literal>





              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>description</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>discount</structfield></term>
              <listitem><para>
                <type>numeric</type>







              </para>

            </listitem>
          </varlistentry>

        </variablelist>










      </para>
    </section>

      <section id="public.table.chart"
               xreflabel="public.chart">
        <title id="public.table.chart-title">
         Table:
         
         <structname>chart</structname>
        </title>
 


        <para>
          <variablelist>
            <title>
              Structure of <structname>chart</structname>
            </title>


            <varlistentry>
              <term><structfield>id</structfield></term>
              <listitem><para>
                <type>integer</type>


                <literal>PRIMARY KEY</literal>









                <literal>DEFAULT nextval(&apos;id&apos;::regclass)</literal>





              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>accno</structfield></term>
              <listitem><para>
                <type>text</type>



                <literal>NOT NULL</literal>





              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>description</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>charttype</structfield></term>
              <listitem><para>
                <type>character(1)</type>





                <literal>DEFAULT &apos;A&apos;::bpchar</literal>



              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>category</structfield></term>
              <listitem><para>
                <type>character(1)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>link</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>gifi_accno</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>contra</structfield></term>
              <listitem><para>
                <type>boolean</type>





                <literal>DEFAULT false</literal>



              </para>

            </listitem>
          </varlistentry>

        </variablelist>





        <variablelist>
          <title>Indexes on chart</title>

          <varlistentry>
            <term>chart_category_key</term>
            <listitem><para>category</para></listitem>
          </varlistentry>



          <varlistentry>
            <term>chart_gifi_accno_key</term>
            <listitem><para>gifi_accno</para></listitem>
          </varlistentry>



          <varlistentry>
            <term>chart_id_key</term>
            <listitem><para>id</para></listitem>
          </varlistentry>



          <varlistentry>
            <term>chart_link_key</term>
            <listitem><para>link</para></listitem>
          </varlistentry>

        </variablelist>





        <itemizedlist>
          <title>
            Tables referencing acc_trans via Foreign Key Constraints
          </title>

          <listitem>
            <para>
              <xref linkend="public.table.acc-trans"/>
            </para>
          </listitem>



          <listitem>
            <para>
              <xref linkend="public.table.partstax"/>
            </para>
          </listitem>



          <listitem>
            <para>
              <xref linkend="public.table.tax"/>
            </para>
          </listitem>

        </itemizedlist>






      </para>
    </section>

      <section id="public.table.custom-field-catalog"
               xreflabel="public.custom_field_catalog">
        <title id="public.table.custom-field-catalog-title">
         Table:
         
         <structname>custom_field_catalog</structname>
        </title>
 


        <para>
          <variablelist>
            <title>
              Structure of <structname>custom_field_catalog</structname>
            </title>


            <varlistentry>
              <term><structfield>field_id</structfield></term>
              <listitem><para>
                <type>serial</type>


                <literal>PRIMARY KEY</literal>













              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>table_id</structfield></term>
              <listitem><para>
                <type>integer</type>












                <literal>REFERENCES</literal> <xref linkend="public.table.custom-table-catalog"/>


              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>field_name</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

        </variablelist>










      </para>
    </section>

      <section id="public.table.custom-table-catalog"
               xreflabel="public.custom_table_catalog">
        <title id="public.table.custom-table-catalog-title">
         Table:
         
         <structname>custom_table_catalog</structname>
        </title>
 


        <para>
          <variablelist>
            <title>
              Structure of <structname>custom_table_catalog</structname>
            </title>


            <varlistentry>
              <term><structfield>table_id</structfield></term>
              <listitem><para>
                <type>serial</type>


                <literal>PRIMARY KEY</literal>













              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>extends</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>table_name</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

        </variablelist>







        <itemizedlist>
          <title>
            Tables referencing custom_field_catalog via Foreign Key Constraints
          </title>

          <listitem>
            <para>
              <xref linkend="public.table.custom-field-catalog"/>
            </para>
          </listitem>

        </itemizedlist>






      </para>
    </section>

      <section id="public.table.customer"
               xreflabel="public.customer">
        <title id="public.table.customer-title">
         Table:
         
         <structname>customer</structname>
        </title>
 


        <para>
          <variablelist>
            <title>
              Structure of <structname>customer</structname>
            </title>


            <varlistentry>
              <term><structfield>id</structfield></term>
              <listitem><para>
                <type>integer</type>


                <literal>PRIMARY KEY</literal>









                <literal>DEFAULT nextval(&apos;id&apos;::regclass)</literal>





              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>name</structfield></term>
              <listitem><para>
                <type>character varying(64)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>address1</structfield></term>
              <listitem><para>
                <type>character varying(32)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>address2</structfield></term>
              <listitem><para>
                <type>character varying(32)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>city</structfield></term>
              <listitem><para>
                <type>character varying(32)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>state</structfield></term>
              <listitem><para>
                <type>character varying(32)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>zipcode</structfield></term>
              <listitem><para>
                <type>character varying(10)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>country</structfield></term>
              <listitem><para>
                <type>character varying(32)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>contact</structfield></term>
              <listitem><para>
                <type>character varying(64)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>phone</structfield></term>
              <listitem><para>
                <type>character varying(20)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>fax</structfield></term>
              <listitem><para>
                <type>character varying(20)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>email</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>notes</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>discount</structfield></term>
              <listitem><para>
                <type>numeric</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>taxincluded</structfield></term>
              <listitem><para>
                <type>boolean</type>





                <literal>DEFAULT false</literal>



              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>creditlimit</structfield></term>
              <listitem><para>
                <type>numeric</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>terms</structfield></term>
              <listitem><para>
                <type>smallint</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>customernumber</structfield></term>
              <listitem><para>
                <type>character varying(32)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>cc</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>bcc</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>business_id</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>taxnumber</structfield></term>
              <listitem><para>
                <type>character varying(32)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>sic_code</structfield></term>
              <listitem><para>
                <type>character varying(6)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>iban</structfield></term>
              <listitem><para>
                <type>character varying(34)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>bic</structfield></term>
              <listitem><para>
                <type>character varying(11)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>employee_id</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>language_code</structfield></term>
              <listitem><para>
                <type>character varying(6)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>pricegroup_id</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>curr</structfield></term>
              <listitem><para>
                <type>character(3)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>startdate</structfield></term>
              <listitem><para>
                <type>date</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>enddate</structfield></term>
              <listitem><para>
                <type>date</type>







              </para>

            </listitem>
          </varlistentry>

        </variablelist>





        <variablelist>
          <title>Indexes on customer</title>

          <varlistentry>
            <term>customer_contact_key</term>
            <listitem><para>lower((contact)::text)</para></listitem>
          </varlistentry>



          <varlistentry>
            <term>customer_customernumber_key</term>
            <listitem><para>customernumber</para></listitem>
          </varlistentry>



          <varlistentry>
            <term>customer_id_key</term>
            <listitem><para>id</para></listitem>
          </varlistentry>



          <varlistentry>
            <term>customer_name_key</term>
            <listitem><para>lower((name)::text)</para></listitem>
          </varlistentry>

        </variablelist>








      </para>
    </section>

      <section id="public.table.customertax"
               xreflabel="public.customertax">
        <title id="public.table.customertax-title">
         Table:
         
         <structname>customertax</structname>
        </title>
 


        <para>
          <variablelist>
            <title>
              Structure of <structname>customertax</structname>
            </title>


            <varlistentry>
              <term><structfield>customer_id</structfield></term>
              <listitem><para>
                <type>integer</type>


                <literal>PRIMARY KEY</literal>













              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>chart_id</structfield></term>
              <listitem><para>
                <type>integer</type>


                <literal>PRIMARY KEY</literal>













              </para>

            </listitem>
          </varlistentry>

        </variablelist>





        <variablelist>
          <title>Indexes on customertax</title>

          <varlistentry>
            <term>customer_customer_id_key</term>
            <listitem><para>customer_id</para></listitem>
          </varlistentry>

        </variablelist>








      </para>
    </section>

      <section id="public.table.defaults"
               xreflabel="public.defaults">
        <title id="public.table.defaults-title">
         Table:
         
         <structname>defaults</structname>
        </title>
 


        <para>
          <variablelist>
            <title>
              Structure of <structname>defaults</structname>
            </title>


            <varlistentry>
              <term><structfield>setting_key</structfield></term>
              <listitem><para>
                <type>text</type>


                <literal>PRIMARY KEY</literal>













              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>value</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

        </variablelist>










      </para>
    </section>

      <section id="public.table.department"
               xreflabel="public.department">
        <title id="public.table.department-title">
         Table:
         
         <structname>department</structname>
        </title>
 


        <para>
          <variablelist>
            <title>
              Structure of <structname>department</structname>
            </title>


            <varlistentry>
              <term><structfield>id</structfield></term>
              <listitem><para>
                <type>integer</type>


                <literal>PRIMARY KEY</literal>









                <literal>DEFAULT nextval(&apos;id&apos;::regclass)</literal>





              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>description</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>role</structfield></term>
              <listitem><para>
                <type>character(1)</type>





                <literal>DEFAULT &apos;P&apos;::bpchar</literal>



              </para>

            </listitem>
          </varlistentry>

        </variablelist>





        <variablelist>
          <title>Indexes on department</title>

          <varlistentry>
            <term>department_id_key</term>
            <listitem><para>id</para></listitem>
          </varlistentry>

        </variablelist>








      </para>
    </section>

      <section id="public.table.dpt-trans"
               xreflabel="public.dpt_trans">
        <title id="public.table.dpt-trans-title">
         Table:
         
         <structname>dpt_trans</structname>
        </title>
 


        <para>
          <variablelist>
            <title>
              Structure of <structname>dpt_trans</structname>
            </title>


            <varlistentry>
              <term><structfield>trans_id</structfield></term>
              <listitem><para>
                <type>integer</type>


                <literal>PRIMARY KEY</literal>













              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>department_id</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

        </variablelist>










      </para>
    </section>

      <section id="public.table.employee"
               xreflabel="public.employee">
        <title id="public.table.employee-title">
         Table:
         
         <structname>employee</structname>
        </title>
 


        <para>
          <variablelist>
            <title>
              Structure of <structname>employee</structname>
            </title>


            <varlistentry>
              <term><structfield>id</structfield></term>
              <listitem><para>
                <type>integer</type>


                <literal>PRIMARY KEY</literal>









                <literal>DEFAULT nextval(&apos;id&apos;::regclass)</literal>





              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>login</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>name</structfield></term>
              <listitem><para>
                <type>character varying(64)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>address1</structfield></term>
              <listitem><para>
                <type>character varying(32)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>address2</structfield></term>
              <listitem><para>
                <type>character varying(32)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>city</structfield></term>
              <listitem><para>
                <type>character varying(32)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>state</structfield></term>
              <listitem><para>
                <type>character varying(32)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>zipcode</structfield></term>
              <listitem><para>
                <type>character varying(10)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>country</structfield></term>
              <listitem><para>
                <type>character varying(32)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>workphone</structfield></term>
              <listitem><para>
                <type>character varying(20)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>homephone</structfield></term>
              <listitem><para>
                <type>character varying(20)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>startdate</structfield></term>
              <listitem><para>
                <type>date</type>





                <literal>DEFAULT (&apos;now&apos;::text)::date</literal>



              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>enddate</structfield></term>
              <listitem><para>
                <type>date</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>notes</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>role</structfield></term>
              <listitem><para>
                <type>character varying(20)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>sales</structfield></term>
              <listitem><para>
                <type>boolean</type>





                <literal>DEFAULT false</literal>



              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>email</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>ssn</structfield></term>
              <listitem><para>
                <type>character varying(20)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>iban</structfield></term>
              <listitem><para>
                <type>character varying(34)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>bic</structfield></term>
              <listitem><para>
                <type>character varying(11)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>managerid</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>employeenumber</structfield></term>
              <listitem><para>
                <type>character varying(32)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>dob</structfield></term>
              <listitem><para>
                <type>date</type>







              </para>

            </listitem>
          </varlistentry>

        </variablelist>





        <variablelist>
          <title>Indexes on employee</title>

          <varlistentry>
            <term>employee_id_key</term>
            <listitem><para>id</para></listitem>
          </varlistentry>



          <varlistentry>
            <term>employee_name_key</term>
            <listitem><para>lower((name)::text)</para></listitem>
          </varlistentry>

        </variablelist>








      </para>
    </section>

      <section id="public.table.exchangerate"
               xreflabel="public.exchangerate">
        <title id="public.table.exchangerate-title">
         Table:
         
         <structname>exchangerate</structname>
        </title>
 


        <para>
          <variablelist>
            <title>
              Structure of <structname>exchangerate</structname>
            </title>


            <varlistentry>
              <term><structfield>curr</structfield></term>
              <listitem><para>
                <type>character(3)</type>


                <literal>PRIMARY KEY</literal>













              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>transdate</structfield></term>
              <listitem><para>
                <type>date</type>


                <literal>PRIMARY KEY</literal>













              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>buy</structfield></term>
              <listitem><para>
                <type>numeric</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>sell</structfield></term>
              <listitem><para>
                <type>numeric</type>







              </para>

            </listitem>
          </varlistentry>

        </variablelist>





        <variablelist>
          <title>Indexes on exchangerate</title>

          <varlistentry>
            <term>exchangerate_ct_key</term>
            <listitem><para>curr, transdate</para></listitem>
          </varlistentry>

        </variablelist>








      </para>
    </section>

      <section id="public.table.gifi"
               xreflabel="public.gifi">
        <title id="public.table.gifi-title">
         Table:
         
         <structname>gifi</structname>
        </title>
 


        <para>
          <variablelist>
            <title>
              Structure of <structname>gifi</structname>
            </title>


            <varlistentry>
              <term><structfield>accno</structfield></term>
              <listitem><para>
                <type>text</type>


                <literal>PRIMARY KEY</literal>













              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>description</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

        </variablelist>










      </para>
    </section>

      <section id="public.table.gl"
               xreflabel="public.gl">
        <title id="public.table.gl-title">
         Table:
         
         <structname>gl</structname>
        </title>
 


        <para>
          <variablelist>
            <title>
              Structure of <structname>gl</structname>
            </title>


            <varlistentry>
              <term><structfield>id</structfield></term>
              <listitem><para>
                <type>integer</type>


                <literal>PRIMARY KEY</literal>









                <literal>DEFAULT nextval(&apos;id&apos;::regclass)</literal>





              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>reference</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>description</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>transdate</structfield></term>
              <listitem><para>
                <type>date</type>





                <literal>DEFAULT (&apos;now&apos;::text)::date</literal>



              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>employee_id</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>notes</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>department_id</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

        </variablelist>





        <variablelist>
          <title>Indexes on gl</title>

          <varlistentry>
            <term>gl_description_key</term>
            <listitem><para>lower(description)</para></listitem>
          </varlistentry>



          <varlistentry>
            <term>gl_employee_id_key</term>
            <listitem><para>employee_id</para></listitem>
          </varlistentry>



          <varlistentry>
            <term>gl_id_key</term>
            <listitem><para>id</para></listitem>
          </varlistentry>



          <varlistentry>
            <term>gl_reference_key</term>
            <listitem><para>reference</para></listitem>
          </varlistentry>



          <varlistentry>
            <term>gl_transdate_key</term>
            <listitem><para>transdate</para></listitem>
          </varlistentry>

        </variablelist>








      </para>
    </section>

      <section id="public.table.inventory"
               xreflabel="public.inventory">
        <title id="public.table.inventory-title">
         Table:
         
         <structname>inventory</structname>
        </title>
 


        <para>
          <variablelist>
            <title>
              Structure of <structname>inventory</structname>
            </title>


            <varlistentry>
              <term><structfield>warehouse_id</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>parts_id</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>trans_id</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>orderitems_id</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>qty</structfield></term>
              <listitem><para>
                <type>numeric</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>shippingdate</structfield></term>
              <listitem><para>
                <type>date</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>employee_id</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>entry_id</structfield></term>
              <listitem><para>
                <type>serial</type>


                <literal>PRIMARY KEY</literal>













              </para>

            </listitem>
          </varlistentry>

        </variablelist>










      </para>
    </section>

      <section id="public.table.invoice"
               xreflabel="public.invoice">
        <title id="public.table.invoice-title">
         Table:
         
         <structname>invoice</structname>
        </title>
 


        <para>
          <variablelist>
            <title>
              Structure of <structname>invoice</structname>
            </title>


            <varlistentry>
              <term><structfield>id</structfield></term>
              <listitem><para>
                <type>integer</type>


                <literal>PRIMARY KEY</literal>









                <literal>DEFAULT nextval(&apos;invoiceid&apos;::regclass)</literal>





              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>trans_id</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>parts_id</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>description</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>qty</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>allocated</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>sellprice</structfield></term>
              <listitem><para>
                <type>numeric</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>fxsellprice</structfield></term>
              <listitem><para>
                <type>numeric</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>discount</structfield></term>
              <listitem><para>
                <type>real</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>assemblyitem</structfield></term>
              <listitem><para>
                <type>boolean</type>





                <literal>DEFAULT false</literal>



              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>unit</structfield></term>
              <listitem><para>
                <type>character varying(5)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>project_id</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>deliverydate</structfield></term>
              <listitem><para>
                <type>date</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>serialnumber</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>notes</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

        </variablelist>





        <variablelist>
          <title>Indexes on invoice</title>

          <varlistentry>
            <term>invoice_id_key</term>
            <listitem><para>id</para></listitem>
          </varlistentry>



          <varlistentry>
            <term>invoice_trans_id_key</term>
            <listitem><para>trans_id</para></listitem>
          </varlistentry>

        </variablelist>








      </para>
    </section>

      <section id="public.table.jcitems"
               xreflabel="public.jcitems">
        <title id="public.table.jcitems-title">
         Table:
         
         <structname>jcitems</structname>
        </title>
 


        <para>
          <variablelist>
            <title>
              Structure of <structname>jcitems</structname>
            </title>


            <varlistentry>
              <term><structfield>id</structfield></term>
              <listitem><para>
                <type>integer</type>


                <literal>PRIMARY KEY</literal>









                <literal>DEFAULT nextval(&apos;jcitemsid&apos;::regclass)</literal>





              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>project_id</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>parts_id</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>description</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>qty</structfield></term>
              <listitem><para>
                <type>numeric</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>allocated</structfield></term>
              <listitem><para>
                <type>numeric</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>sellprice</structfield></term>
              <listitem><para>
                <type>numeric</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>fxsellprice</structfield></term>
              <listitem><para>
                <type>numeric</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>serialnumber</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>checkedin</structfield></term>
              <listitem><para>
                <type>timestamp with time zone</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>checkedout</structfield></term>
              <listitem><para>
                <type>timestamp with time zone</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>employee_id</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>notes</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

        </variablelist>





        <variablelist>
          <title>Indexes on jcitems</title>

          <varlistentry>
            <term>jcitems_id_key</term>
            <listitem><para>id</para></listitem>
          </varlistentry>

        </variablelist>








      </para>
    </section>

      <section id="public.table.language"
               xreflabel="public.language">
        <title id="public.table.language-title">
         Table:
         
         <structname>language</structname>
        </title>
 


        <para>
          <variablelist>
            <title>
              Structure of <structname>language</structname>
            </title>


            <varlistentry>
              <term><structfield>code</structfield></term>
              <listitem><para>
                <type>character varying(6)</type>


                <literal>PRIMARY KEY</literal>













              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>description</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

        </variablelist>










      </para>
    </section>

      <section id="public.table.makemodel"
               xreflabel="public.makemodel">
        <title id="public.table.makemodel-title">
         Table:
         
         <structname>makemodel</structname>
        </title>
 


        <para>
          <variablelist>
            <title>
              Structure of <structname>makemodel</structname>
            </title>


            <varlistentry>
              <term><structfield>parts_id</structfield></term>
              <listitem><para>
                <type>integer</type>


                <literal>PRIMARY KEY</literal>













              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>make</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>model</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

        </variablelist>





        <variablelist>
          <title>Indexes on makemodel</title>

          <varlistentry>
            <term>makemodel_make_key</term>
            <listitem><para>lower(make)</para></listitem>
          </varlistentry>



          <varlistentry>
            <term>makemodel_model_key</term>
            <listitem><para>lower(model)</para></listitem>
          </varlistentry>



          <varlistentry>
            <term>makemodel_parts_id_key</term>
            <listitem><para>parts_id</para></listitem>
          </varlistentry>

        </variablelist>








      </para>
    </section>

      <section id="public.table.oe"
               xreflabel="public.oe">
        <title id="public.table.oe-title">
         Table:
         
         <structname>oe</structname>
        </title>
 


        <para>
          <variablelist>
            <title>
              Structure of <structname>oe</structname>
            </title>


            <varlistentry>
              <term><structfield>id</structfield></term>
              <listitem><para>
                <type>integer</type>


                <literal>PRIMARY KEY</literal>









                <literal>DEFAULT nextval(&apos;id&apos;::regclass)</literal>





              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>ordnumber</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>transdate</structfield></term>
              <listitem><para>
                <type>date</type>





                <literal>DEFAULT (&apos;now&apos;::text)::date</literal>



              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>vendor_id</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>customer_id</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>amount</structfield></term>
              <listitem><para>
                <type>numeric</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>netamount</structfield></term>
              <listitem><para>
                <type>numeric</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>reqdate</structfield></term>
              <listitem><para>
                <type>date</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>taxincluded</structfield></term>
              <listitem><para>
                <type>boolean</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>shippingpoint</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>notes</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>curr</structfield></term>
              <listitem><para>
                <type>character(3)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>employee_id</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>closed</structfield></term>
              <listitem><para>
                <type>boolean</type>





                <literal>DEFAULT false</literal>



              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>quotation</structfield></term>
              <listitem><para>
                <type>boolean</type>





                <literal>DEFAULT false</literal>



              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>quonumber</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>intnotes</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>department_id</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>shipvia</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>language_code</structfield></term>
              <listitem><para>
                <type>character varying(6)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>ponumber</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>terms</structfield></term>
              <listitem><para>
                <type>smallint</type>







              </para>

            </listitem>
          </varlistentry>

        </variablelist>





        <variablelist>
          <title>Indexes on oe</title>

          <varlistentry>
            <term>oe_employee_id_key</term>
            <listitem><para>employee_id</para></listitem>
          </varlistentry>



          <varlistentry>
            <term>oe_id_key</term>
            <listitem><para>id</para></listitem>
          </varlistentry>



          <varlistentry>
            <term>oe_ordnumber_key</term>
            <listitem><para>ordnumber</para></listitem>
          </varlistentry>



          <varlistentry>
            <term>oe_transdate_key</term>
            <listitem><para>transdate</para></listitem>
          </varlistentry>

        </variablelist>








      </para>
    </section>

      <section id="public.table.orderitems"
               xreflabel="public.orderitems">
        <title id="public.table.orderitems-title">
         Table:
         
         <structname>orderitems</structname>
        </title>
 


        <para>
          <variablelist>
            <title>
              Structure of <structname>orderitems</structname>
            </title>


            <varlistentry>
              <term><structfield>id</structfield></term>
              <listitem><para>
                <type>integer</type>


                <literal>PRIMARY KEY</literal>









                <literal>DEFAULT nextval(&apos;orderitemsid&apos;::regclass)</literal>





              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>trans_id</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>parts_id</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>description</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>qty</structfield></term>
              <listitem><para>
                <type>numeric</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>sellprice</structfield></term>
              <listitem><para>
                <type>numeric</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>discount</structfield></term>
              <listitem><para>
                <type>numeric</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>unit</structfield></term>
              <listitem><para>
                <type>character varying(5)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>project_id</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>reqdate</structfield></term>
              <listitem><para>
                <type>date</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>ship</structfield></term>
              <listitem><para>
                <type>numeric</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>serialnumber</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>notes</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

        </variablelist>





        <variablelist>
          <title>Indexes on orderitems</title>

          <varlistentry>
            <term>orderitems_id_key</term>
            <listitem><para>id</para></listitem>
          </varlistentry>



          <varlistentry>
            <term>orderitems_trans_id_key</term>
            <listitem><para>trans_id</para></listitem>
          </varlistentry>

        </variablelist>








      </para>
    </section>

      <section id="public.table.parts"
               xreflabel="public.parts">
        <title id="public.table.parts-title">
         Table:
         
         <structname>parts</structname>
        </title>
 


        <para>
          <variablelist>
            <title>
              Structure of <structname>parts</structname>
            </title>


            <varlistentry>
              <term><structfield>id</structfield></term>
              <listitem><para>
                <type>integer</type>


                <literal>PRIMARY KEY</literal>









                <literal>DEFAULT nextval(&apos;id&apos;::regclass)</literal>





              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>partnumber</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>description</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>unit</structfield></term>
              <listitem><para>
                <type>character varying(5)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>listprice</structfield></term>
              <listitem><para>
                <type>numeric</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>sellprice</structfield></term>
              <listitem><para>
                <type>numeric</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>lastcost</structfield></term>
              <listitem><para>
                <type>numeric</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>priceupdate</structfield></term>
              <listitem><para>
                <type>date</type>





                <literal>DEFAULT (&apos;now&apos;::text)::date</literal>



              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>weight</structfield></term>
              <listitem><para>
                <type>numeric</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>onhand</structfield></term>
              <listitem><para>
                <type>numeric</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>notes</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>makemodel</structfield></term>
              <listitem><para>
                <type>boolean</type>





                <literal>DEFAULT false</literal>



              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>assembly</structfield></term>
              <listitem><para>
                <type>boolean</type>





                <literal>DEFAULT false</literal>



              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>alternate</structfield></term>
              <listitem><para>
                <type>boolean</type>





                <literal>DEFAULT false</literal>



              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>rop</structfield></term>
              <listitem><para>
                <type>real</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>inventory_accno_id</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>income_accno_id</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>expense_accno_id</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>bin</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>obsolete</structfield></term>
              <listitem><para>
                <type>boolean</type>





                <literal>DEFAULT false</literal>



              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>bom</structfield></term>
              <listitem><para>
                <type>boolean</type>





                <literal>DEFAULT false</literal>



              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>image</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>drawing</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>microfiche</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>partsgroup_id</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>project_id</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>avgcost</structfield></term>
              <listitem><para>
                <type>numeric</type>







              </para>

            </listitem>
          </varlistentry>

        </variablelist>





        <variablelist>
          <title>Indexes on parts</title>

          <varlistentry>
            <term>parts_description_key</term>
            <listitem><para>lower(description)</para></listitem>
          </varlistentry>



          <varlistentry>
            <term>parts_id_key</term>
            <listitem><para>id</para></listitem>
          </varlistentry>



          <varlistentry>
            <term>parts_partnumber_key</term>
            <listitem><para>lower(partnumber)</para></listitem>
          </varlistentry>

        </variablelist>





        <itemizedlist>
          <title>
            Tables referencing partstax via Foreign Key Constraints
          </title>

          <listitem>
            <para>
              <xref linkend="public.table.partstax"/>
            </para>
          </listitem>

        </itemizedlist>






      </para>
    </section>

      <section id="public.table.partscustomer"
               xreflabel="public.partscustomer">
        <title id="public.table.partscustomer-title">
         Table:
         
         <structname>partscustomer</structname>
        </title>
 


        <para>
          <variablelist>
            <title>
              Structure of <structname>partscustomer</structname>
            </title>


            <varlistentry>
              <term><structfield>parts_id</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>customer_id</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>pricegroup_id</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>pricebreak</structfield></term>
              <listitem><para>
                <type>numeric</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>sellprice</structfield></term>
              <listitem><para>
                <type>numeric</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>validfrom</structfield></term>
              <listitem><para>
                <type>date</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>validto</structfield></term>
              <listitem><para>
                <type>date</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>curr</structfield></term>
              <listitem><para>
                <type>character(3)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>entry_id</structfield></term>
              <listitem><para>
                <type>serial</type>


                <literal>PRIMARY KEY</literal>













              </para>

            </listitem>
          </varlistentry>

        </variablelist>










      </para>
    </section>

      <section id="public.table.partsgroup"
               xreflabel="public.partsgroup">
        <title id="public.table.partsgroup-title">
         Table:
         
         <structname>partsgroup</structname>
        </title>
 


        <para>
          <variablelist>
            <title>
              Structure of <structname>partsgroup</structname>
            </title>


            <varlistentry>
              <term><structfield>id</structfield></term>
              <listitem><para>
                <type>integer</type>


                <literal>PRIMARY KEY</literal>









                <literal>DEFAULT nextval(&apos;id&apos;::regclass)</literal>





              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>partsgroup</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

        </variablelist>





        <variablelist>
          <title>Indexes on partsgroup</title>

          <varlistentry>
            <term>partsgroup_id_key</term>
            <listitem><para>id</para></listitem>
          </varlistentry>

        </variablelist>








      </para>
    </section>

      <section id="public.table.partstax"
               xreflabel="public.partstax">
        <title id="public.table.partstax-title">
         Table:
         
         <structname>partstax</structname>
        </title>
 


        <para>
          <variablelist>
            <title>
              Structure of <structname>partstax</structname>
            </title>


            <varlistentry>
              <term><structfield>parts_id</structfield></term>
              <listitem><para>
                <type>integer</type>






                <literal>PRIMARY KEY</literal>












                <literal>REFERENCES</literal> <xref linkend="public.table.parts"/>




              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>chart_id</structfield></term>
              <listitem><para>
                <type>integer</type>






                <literal>PRIMARY KEY</literal>












                <literal>REFERENCES</literal> <xref linkend="public.table.chart"/>




              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>taxcategory_id</structfield></term>
              <listitem><para>
                <type>integer</type>












                <literal>REFERENCES</literal> <xref linkend="public.table.taxcategory"/>


              </para>

            </listitem>
          </varlistentry>

        </variablelist>





        <variablelist>
          <title>Indexes on partstax</title>

          <varlistentry>
            <term>partstax_parts_id_key</term>
            <listitem><para>parts_id</para></listitem>
          </varlistentry>

        </variablelist>








      </para>
    </section>

      <section id="public.table.partsvendor"
               xreflabel="public.partsvendor">
        <title id="public.table.partsvendor-title">
         Table:
         
         <structname>partsvendor</structname>
        </title>
 


        <para>
          <variablelist>
            <title>
              Structure of <structname>partsvendor</structname>
            </title>


            <varlistentry>
              <term><structfield>vendor_id</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>parts_id</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>partnumber</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>leadtime</structfield></term>
              <listitem><para>
                <type>smallint</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>lastcost</structfield></term>
              <listitem><para>
                <type>numeric</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>curr</structfield></term>
              <listitem><para>
                <type>character(3)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>entry_id</structfield></term>
              <listitem><para>
                <type>serial</type>


                <literal>PRIMARY KEY</literal>













              </para>

            </listitem>
          </varlistentry>

        </variablelist>





        <variablelist>
          <title>Indexes on partsvendor</title>

          <varlistentry>
            <term>partsvendor_parts_id_key</term>
            <listitem><para>parts_id</para></listitem>
          </varlistentry>



          <varlistentry>
            <term>partsvendor_vendor_id_key</term>
            <listitem><para>vendor_id</para></listitem>
          </varlistentry>

        </variablelist>








      </para>
    </section>

      <section id="public.table.pricegroup"
               xreflabel="public.pricegroup">
        <title id="public.table.pricegroup-title">
         Table:
         
         <structname>pricegroup</structname>
        </title>
 


        <para>
          <variablelist>
            <title>
              Structure of <structname>pricegroup</structname>
            </title>


            <varlistentry>
              <term><structfield>id</structfield></term>
              <listitem><para>
                <type>integer</type>


                <literal>PRIMARY KEY</literal>









                <literal>DEFAULT nextval(&apos;id&apos;::regclass)</literal>





              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>pricegroup</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

        </variablelist>





        <variablelist>
          <title>Indexes on pricegroup</title>

          <varlistentry>
            <term>pricegroup_id_key</term>
            <listitem><para>id</para></listitem>
          </varlistentry>



          <varlistentry>
            <term>pricegroup_pricegroup_key</term>
            <listitem><para>pricegroup</para></listitem>
          </varlistentry>

        </variablelist>








      </para>
    </section>

      <section id="public.table.project"
               xreflabel="public.project">
        <title id="public.table.project-title">
         Table:
         
         <structname>project</structname>
        </title>
 


        <para>
          <variablelist>
            <title>
              Structure of <structname>project</structname>
            </title>


            <varlistentry>
              <term><structfield>id</structfield></term>
              <listitem><para>
                <type>integer</type>


                <literal>PRIMARY KEY</literal>









                <literal>DEFAULT nextval(&apos;id&apos;::regclass)</literal>





              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>projectnumber</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>description</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>startdate</structfield></term>
              <listitem><para>
                <type>date</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>enddate</structfield></term>
              <listitem><para>
                <type>date</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>parts_id</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>production</structfield></term>
              <listitem><para>
                <type>numeric</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>completed</structfield></term>
              <listitem><para>
                <type>numeric</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>customer_id</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

        </variablelist>





        <variablelist>
          <title>Indexes on project</title>

          <varlistentry>
            <term>project_id_key</term>
            <listitem><para>id</para></listitem>
          </varlistentry>

        </variablelist>








      </para>
    </section>

      <section id="public.table.recurring"
               xreflabel="public.recurring">
        <title id="public.table.recurring-title">
         Table:
         
         <structname>recurring</structname>
        </title>
 


        <para>
          <variablelist>
            <title>
              Structure of <structname>recurring</structname>
            </title>


            <varlistentry>
              <term><structfield>id</structfield></term>
              <listitem><para>
                <type>integer</type>


                <literal>PRIMARY KEY</literal>













              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>reference</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>startdate</structfield></term>
              <listitem><para>
                <type>date</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>nextdate</structfield></term>
              <listitem><para>
                <type>date</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>enddate</structfield></term>
              <listitem><para>
                <type>date</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>repeat</structfield></term>
              <listitem><para>
                <type>smallint</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>unit</structfield></term>
              <listitem><para>
                <type>character varying(6)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>howmany</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>payment</structfield></term>
              <listitem><para>
                <type>boolean</type>





                <literal>DEFAULT false</literal>



              </para>

            </listitem>
          </varlistentry>

        </variablelist>










      </para>
    </section>

      <section id="public.table.recurringemail"
               xreflabel="public.recurringemail">
        <title id="public.table.recurringemail-title">
         Table:
         
         <structname>recurringemail</structname>
        </title>
 


        <para>
          <variablelist>
            <title>
              Structure of <structname>recurringemail</structname>
            </title>


            <varlistentry>
              <term><structfield>id</structfield></term>
              <listitem><para>
                <type>integer</type>


                <literal>PRIMARY KEY</literal>













              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>formname</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>format</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>message</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

        </variablelist>










      </para>
    </section>

      <section id="public.table.recurringprint"
               xreflabel="public.recurringprint">
        <title id="public.table.recurringprint-title">
         Table:
         
         <structname>recurringprint</structname>
        </title>
 


        <para>
          <variablelist>
            <title>
              Structure of <structname>recurringprint</structname>
            </title>


            <varlistentry>
              <term><structfield>id</structfield></term>
              <listitem><para>
                <type>integer</type>


                <literal>PRIMARY KEY</literal>













              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>formname</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>format</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>printer</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

        </variablelist>










      </para>
    </section>

      <section id="public.table.shipto"
               xreflabel="public.shipto">
        <title id="public.table.shipto-title">
         Table:
         
         <structname>shipto</structname>
        </title>
 


        <para>
          <variablelist>
            <title>
              Structure of <structname>shipto</structname>
            </title>


            <varlistentry>
              <term><structfield>trans_id</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>shiptoname</structfield></term>
              <listitem><para>
                <type>character varying(64)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>shiptoaddress1</structfield></term>
              <listitem><para>
                <type>character varying(32)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>shiptoaddress2</structfield></term>
              <listitem><para>
                <type>character varying(32)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>shiptocity</structfield></term>
              <listitem><para>
                <type>character varying(32)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>shiptostate</structfield></term>
              <listitem><para>
                <type>character varying(32)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>shiptozipcode</structfield></term>
              <listitem><para>
                <type>character varying(10)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>shiptocountry</structfield></term>
              <listitem><para>
                <type>character varying(32)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>shiptocontact</structfield></term>
              <listitem><para>
                <type>character varying(64)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>shiptophone</structfield></term>
              <listitem><para>
                <type>character varying(20)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>shiptofax</structfield></term>
              <listitem><para>
                <type>character varying(20)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>shiptoemail</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>entry_id</structfield></term>
              <listitem><para>
                <type>serial</type>


                <literal>PRIMARY KEY</literal>













              </para>

            </listitem>
          </varlistentry>

        </variablelist>





        <variablelist>
          <title>Indexes on shipto</title>

          <varlistentry>
            <term>shipto_trans_id_key</term>
            <listitem><para>trans_id</para></listitem>
          </varlistentry>

        </variablelist>








      </para>
    </section>

      <section id="public.table.sic"
               xreflabel="public.sic">
        <title id="public.table.sic-title">
         Table:
         
         <structname>sic</structname>
        </title>
 


        <para>
          <variablelist>
            <title>
              Structure of <structname>sic</structname>
            </title>


            <varlistentry>
              <term><structfield>code</structfield></term>
              <listitem><para>
                <type>character varying(6)</type>


                <literal>PRIMARY KEY</literal>













              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>sictype</structfield></term>
              <listitem><para>
                <type>character(1)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>description</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

        </variablelist>










      </para>
    </section>

      <section id="public.table.status"
               xreflabel="public.status">
        <title id="public.table.status-title">
         Table:
         
         <structname>status</structname>
        </title>
 


        <para>
          <variablelist>
            <title>
              Structure of <structname>status</structname>
            </title>


            <varlistentry>
              <term><structfield>trans_id</structfield></term>
              <listitem><para>
                <type>integer</type>


                <literal>PRIMARY KEY</literal>













              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>formname</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>printed</structfield></term>
              <listitem><para>
                <type>boolean</type>





                <literal>DEFAULT false</literal>



              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>emailed</structfield></term>
              <listitem><para>
                <type>boolean</type>





                <literal>DEFAULT false</literal>



              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>spoolfile</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

        </variablelist>





        <variablelist>
          <title>Indexes on status</title>

          <varlistentry>
            <term>status_trans_id_key</term>
            <listitem><para>trans_id</para></listitem>
          </varlistentry>

        </variablelist>








      </para>
    </section>

      <section id="public.table.tax"
               xreflabel="public.tax">
        <title id="public.table.tax-title">
         Table:
         
         <structname>tax</structname>
        </title>
 


        <para>
          <variablelist>
            <title>
              Structure of <structname>tax</structname>
            </title>


            <varlistentry>
              <term><structfield>chart_id</structfield></term>
              <listitem><para>
                <type>integer</type>






                <literal>PRIMARY KEY</literal>












                <literal>REFERENCES</literal> <xref linkend="public.table.chart"/>




              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>rate</structfield></term>
              <listitem><para>
                <type>numeric</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>taxnumber</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>validto</structfield></term>
              <listitem><para>
                <type>date</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>pass</structfield></term>
              <listitem><para>
                <type>integer</type>



                <literal>NOT NULL</literal>





              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>taxmodule_id</structfield></term>
              <listitem><para>
                <type>integer</type>







                <literal>NOT NULL</literal>



                <literal>DEFAULT 1</literal>




                <literal>REFERENCES</literal> <xref linkend="public.table.taxmodule"/>


              </para>

            </listitem>
          </varlistentry>

        </variablelist>










      </para>
    </section>

      <section id="public.table.taxcategory"
               xreflabel="public.taxcategory">
        <title id="public.table.taxcategory-title">
         Table:
         
         <structname>taxcategory</structname>
        </title>
 


        <para>
          <variablelist>
            <title>
              Structure of <structname>taxcategory</structname>
            </title>


            <varlistentry>
              <term><structfield>taxcategory_id</structfield></term>
              <listitem><para>
                <type>serial</type>


                <literal>PRIMARY KEY</literal>













              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>taxcategoryname</structfield></term>
              <listitem><para>
                <type>text</type>



                <literal>NOT NULL</literal>





              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>taxmodule_id</structfield></term>
              <listitem><para>
                <type>integer</type>







                <literal>NOT NULL</literal>






                <literal>REFERENCES</literal> <xref linkend="public.table.taxmodule"/>


              </para>

            </listitem>
          </varlistentry>

        </variablelist>







        <itemizedlist>
          <title>
            Tables referencing partstax via Foreign Key Constraints
          </title>

          <listitem>
            <para>
              <xref linkend="public.table.partstax"/>
            </para>
          </listitem>

        </itemizedlist>






      </para>
    </section>

      <section id="public.table.taxmodule"
               xreflabel="public.taxmodule">
        <title id="public.table.taxmodule-title">
         Table:
         
         <structname>taxmodule</structname>
        </title>
 


        <para>
          <variablelist>
            <title>
              Structure of <structname>taxmodule</structname>
            </title>


            <varlistentry>
              <term><structfield>taxmodule_id</structfield></term>
              <listitem><para>
                <type>serial</type>


                <literal>PRIMARY KEY</literal>













              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>taxmodulename</structfield></term>
              <listitem><para>
                <type>text</type>



                <literal>NOT NULL</literal>





              </para>

            </listitem>
          </varlistentry>

        </variablelist>







        <itemizedlist>
          <title>
            Tables referencing tax via Foreign Key Constraints
          </title>

          <listitem>
            <para>
              <xref linkend="public.table.tax"/>
            </para>
          </listitem>



          <listitem>
            <para>
              <xref linkend="public.table.taxcategory"/>
            </para>
          </listitem>

        </itemizedlist>






      </para>
    </section>

      <section id="public.table.transactions"
               xreflabel="public.transactions">
        <title id="public.table.transactions-title">
         Table:
         
         <structname>transactions</structname>
        </title>
 


        <para>
          <variablelist>
            <title>
              Structure of <structname>transactions</structname>
            </title>


            <varlistentry>
              <term><structfield>id</structfield></term>
              <listitem><para>
                <type>integer</type>


                <literal>PRIMARY KEY</literal>













              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>table_name</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

        </variablelist>










      </para>
    </section>

      <section id="public.table.translation"
               xreflabel="public.translation">
        <title id="public.table.translation-title">
         Table:
         
         <structname>translation</structname>
        </title>
 


        <para>
          <variablelist>
            <title>
              Structure of <structname>translation</structname>
            </title>


            <varlistentry>
              <term><structfield>trans_id</structfield></term>
              <listitem><para>
                <type>integer</type>


                <literal>PRIMARY KEY</literal>













              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>language_code</structfield></term>
              <listitem><para>
                <type>character varying(6)</type>


                <literal>PRIMARY KEY</literal>













              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>description</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

        </variablelist>





        <variablelist>
          <title>Indexes on translation</title>

          <varlistentry>
            <term>translation_trans_id_key</term>
            <listitem><para>trans_id</para></listitem>
          </varlistentry>

        </variablelist>








      </para>
    </section>

      <section id="public.table.vendor"
               xreflabel="public.vendor">
        <title id="public.table.vendor-title">
         Table:
         
         <structname>vendor</structname>
        </title>
 


        <para>
          <variablelist>
            <title>
              Structure of <structname>vendor</structname>
            </title>


            <varlistentry>
              <term><structfield>id</structfield></term>
              <listitem><para>
                <type>integer</type>


                <literal>PRIMARY KEY</literal>









                <literal>DEFAULT nextval(&apos;id&apos;::regclass)</literal>





              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>name</structfield></term>
              <listitem><para>
                <type>character varying(64)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>address1</structfield></term>
              <listitem><para>
                <type>character varying(32)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>address2</structfield></term>
              <listitem><para>
                <type>character varying(32)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>city</structfield></term>
              <listitem><para>
                <type>character varying(32)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>state</structfield></term>
              <listitem><para>
                <type>character varying(32)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>zipcode</structfield></term>
              <listitem><para>
                <type>character varying(10)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>country</structfield></term>
              <listitem><para>
                <type>character varying(32)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>contact</structfield></term>
              <listitem><para>
                <type>character varying(64)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>phone</structfield></term>
              <listitem><para>
                <type>character varying(20)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>fax</structfield></term>
              <listitem><para>
                <type>character varying(20)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>email</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>notes</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>terms</structfield></term>
              <listitem><para>
                <type>smallint</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>taxincluded</structfield></term>
              <listitem><para>
                <type>boolean</type>





                <literal>DEFAULT false</literal>



              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>vendornumber</structfield></term>
              <listitem><para>
                <type>character varying(32)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>cc</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>bcc</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>gifi_accno</structfield></term>
              <listitem><para>
                <type>character varying(30)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>business_id</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>taxnumber</structfield></term>
              <listitem><para>
                <type>character varying(32)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>sic_code</structfield></term>
              <listitem><para>
                <type>character varying(6)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>discount</structfield></term>
              <listitem><para>
                <type>numeric</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>creditlimit</structfield></term>
              <listitem><para>
                <type>numeric</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>iban</structfield></term>
              <listitem><para>
                <type>character varying(34)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>bic</structfield></term>
              <listitem><para>
                <type>character varying(11)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>employee_id</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>language_code</structfield></term>
              <listitem><para>
                <type>character varying(6)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>pricegroup_id</structfield></term>
              <listitem><para>
                <type>integer</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>curr</structfield></term>
              <listitem><para>
                <type>character(3)</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>startdate</structfield></term>
              <listitem><para>
                <type>date</type>







              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>enddate</structfield></term>
              <listitem><para>
                <type>date</type>







              </para>

            </listitem>
          </varlistentry>

        </variablelist>





        <variablelist>
          <title>Indexes on vendor</title>

          <varlistentry>
            <term>vendor_contact_key</term>
            <listitem><para>lower((contact)::text)</para></listitem>
          </varlistentry>



          <varlistentry>
            <term>vendor_id_key</term>
            <listitem><para>id</para></listitem>
          </varlistentry>



          <varlistentry>
            <term>vendor_name_key</term>
            <listitem><para>lower((name)::text)</para></listitem>
          </varlistentry>



          <varlistentry>
            <term>vendor_vendornumber_key</term>
            <listitem><para>vendornumber</para></listitem>
          </varlistentry>

        </variablelist>








      </para>
    </section>

      <section id="public.table.vendortax"
               xreflabel="public.vendortax">
        <title id="public.table.vendortax-title">
         Table:
         
         <structname>vendortax</structname>
        </title>
 


        <para>
          <variablelist>
            <title>
              Structure of <structname>vendortax</structname>
            </title>


            <varlistentry>
              <term><structfield>vendor_id</structfield></term>
              <listitem><para>
                <type>integer</type>


                <literal>PRIMARY KEY</literal>













              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>chart_id</structfield></term>
              <listitem><para>
                <type>integer</type>


                <literal>PRIMARY KEY</literal>













              </para>

            </listitem>
          </varlistentry>

        </variablelist>





        <variablelist>
          <title>Indexes on vendortax</title>

          <varlistentry>
            <term>vendortax_vendor_id_key</term>
            <listitem><para>vendor_id</para></listitem>
          </varlistentry>

        </variablelist>








      </para>
    </section>

      <section id="public.table.warehouse"
               xreflabel="public.warehouse">
        <title id="public.table.warehouse-title">
         Table:
         
         <structname>warehouse</structname>
        </title>
 


        <para>
          <variablelist>
            <title>
              Structure of <structname>warehouse</structname>
            </title>


            <varlistentry>
              <term><structfield>id</structfield></term>
              <listitem><para>
                <type>integer</type>


                <literal>PRIMARY KEY</literal>









                <literal>DEFAULT nextval(&apos;id&apos;::regclass)</literal>





              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>description</structfield></term>
              <listitem><para>
                <type>text</type>







              </para>

            </listitem>
          </varlistentry>

        </variablelist>










      </para>
    </section>

      <section id="public.table.yearend"
               xreflabel="public.yearend">
        <title id="public.table.yearend-title">
         Table:
         
         <structname>yearend</structname>
        </title>
 


        <para>
          <variablelist>
            <title>
              Structure of <structname>yearend</structname>
            </title>


            <varlistentry>
              <term><structfield>trans_id</structfield></term>
              <listitem><para>
                <type>integer</type>


                <literal>PRIMARY KEY</literal>













              </para>

            </listitem>
          </varlistentry>

            <varlistentry>
              <term><structfield>transdate</structfield></term>
              <listitem><para>
                <type>date</type>







              </para>

            </listitem>
          </varlistentry>

        </variablelist>










      </para>
    </section>



<!-- Function add_custom_field( character varying, character varying, character varying ) -->
    <section id="public.function.add-custom-field-character-varying-character-varying-character-varying"
             xreflabel="publicadd_custom_field( character varying, character varying, character varying )">
      <title id="public.function.add-custom-field-character-varying-character-varying-character-varying-title">
       add_custom_field( character varying, character varying, character varying )
      </title>
      <titleabbrev id="public.function.add-custom-field-character-varying-character-varying-character-varying-titleabbrev">
       add_custom_field( character varying, character varying, character varying )
      </titleabbrev>

      <para>
       <segmentedlist>
        <title>Function Properties</title>
        <?dbhtml list-presentation="list"?>
        <segtitle>Language</segtitle>
        <segtitle>Return Type</segtitle>
        <seglistitem>
         <seg>PLPGSQL</seg>
         <seg>boolean</seg>
        </seglistitem>
       </segmentedlist>
 
       
        <programlisting>
DECLARE
table_name ALIAS FOR $1;
new_field_name ALIAS FOR $2;
field_datatype ALIAS FOR $3;

BEGIN
	EXECUTE &#39;SELECT TABLE_ID FROM custom_table_catalog 
		WHERE extends = &#39;&#39;&#39; || table_name || &#39;&#39;&#39; &#39;;
	IF NOT FOUND THEN
		BEGIN
			INSERT INTO custom_table_catalog (extends) 
				VALUES (table_name);
			EXECUTE &#39;CREATE TABLE custom_&#39;||table_name || 
				&#39; (row_id INT PRIMARY KEY)&#39;;
		EXCEPTION WHEN duplicate_table THEN
			-- do nothing
		END;
	END IF;
	EXECUTE &#39;INSERT INTO custom_field_catalog (field_name, table_id)
	VALUES ( &#39;&#39;&#39; || new_field_name ||&#39;&#39;&#39;, (SELECT table_id FROM custom_table_catalog
		WHERE extends = &#39;&#39;&#39;|| table_name || &#39;&#39;&#39;))&#39;;
	EXECUTE &#39;ALTER TABLE custom_&#39;||table_name || &#39; ADD COLUMN &#39; 
		|| new_field_name || &#39; &#39; || field_datatype;
	RETURN TRUE;
END;
</programlisting>
      </para>
    </section>

<!-- Function avgcost( integer ) -->
    <section id="public.function.avgcost-integer"
             xreflabel="publicavgcost( integer )">
      <title id="public.function.avgcost-integer-title">
       avgcost( integer )
      </title>
      <titleabbrev id="public.function.avgcost-integer-titleabbrev">
       avgcost( integer )
      </titleabbrev>

      <para>
       <segmentedlist>
        <title>Function Properties</title>
        <?dbhtml list-presentation="list"?>
        <segtitle>Language</segtitle>
        <segtitle>Return Type</segtitle>
        <seglistitem>
         <seg>PLPGSQL</seg>
         <seg>double precision</seg>
        </seglistitem>
       </segmentedlist>
 
       
        <programlisting>

DECLARE

v_cost float;
v_qty float;
v_parts_id alias for $1;

BEGIN

  SELECT INTO v_cost, v_qty SUM(i.sellprice * i.qty), SUM(i.qty)
  FROM invoice i
  JOIN ap a ON (a.id = i.trans_id)
  WHERE i.parts_id = v_parts_id;
  
  IF v_cost IS NULL THEN
    v_cost := 0;
  END IF;

  IF NOT v_qty IS NULL THEN
    IF v_qty = 0 THEN
      v_cost := 0;
    ELSE
      v_cost := v_cost/v_qty;
    END IF;
  END IF;

RETURN v_cost;
END;
</programlisting>
      </para>
    </section>

<!-- Function check_department(  ) -->
    <section id="public.function.check-department"
             xreflabel="publiccheck_department(  )">
      <title id="public.function.check-department-title">
       check_department(  )
      </title>
      <titleabbrev id="public.function.check-department-titleabbrev">
       check_department(  )
      </titleabbrev>

      <para>
       <segmentedlist>
        <title>Function Properties</title>
        <?dbhtml list-presentation="list"?>
        <segtitle>Language</segtitle>
        <segtitle>Return Type</segtitle>
        <seglistitem>
         <seg>PLPGSQL</seg>
         <seg>&quot;trigger&quot;</seg>
        </seglistitem>
       </segmentedlist>
 
       
        <programlisting>

declare
  dpt_id int;

begin
 
  if new.department_id = 0 then
    delete from dpt_trans where trans_id = new.id;
    return NULL;
  end if;

  select into dpt_id trans_id from dpt_trans where trans_id = new.id;
  
  if dpt_id &gt; 0 then
    update dpt_trans set department_id = new.department_id where trans_id = dpt_id;
  else
    insert into dpt_trans (trans_id, department_id) values (new.id, new.department_id);
  end if;
return NULL;

end;
</programlisting>
      </para>
    </section>

<!-- Function check_inventory(  ) -->
    <section id="public.function.check-inventory"
             xreflabel="publiccheck_inventory(  )">
      <title id="public.function.check-inventory-title">
       check_inventory(  )
      </title>
      <titleabbrev id="public.function.check-inventory-titleabbrev">
       check_inventory(  )
      </titleabbrev>

      <para>
       <segmentedlist>
        <title>Function Properties</title>
        <?dbhtml list-presentation="list"?>
        <segtitle>Language</segtitle>
        <segtitle>Return Type</segtitle>
        <seglistitem>
         <seg>PLPGSQL</seg>
         <seg>&quot;trigger&quot;</seg>
        </seglistitem>
       </segmentedlist>
 
       
        <programlisting>

declare
  itemid int;
  row_data inventory%rowtype;

begin

  if not old.quotation then
    for row_data in select * from inventory where trans_id = old.id loop
      select into itemid id from orderitems where trans_id = old.id and id = row_data.orderitems_id;

      if itemid is null then
	delete from inventory where trans_id = old.id and orderitems_id = row_data.orderitems_id;
      end if;
    end loop;
  end if;
return old;
end;
</programlisting>
      </para>
    </section>

<!-- Function del_customer(  ) -->
    <section id="public.function.del-customer"
             xreflabel="publicdel_customer(  )">
      <title id="public.function.del-customer-title">
       del_customer(  )
      </title>
      <titleabbrev id="public.function.del-customer-titleabbrev">
       del_customer(  )
      </titleabbrev>

      <para>
       <segmentedlist>
        <title>Function Properties</title>
        <?dbhtml list-presentation="list"?>
        <segtitle>Language</segtitle>
        <segtitle>Return Type</segtitle>
        <seglistitem>
         <seg>PLPGSQL</seg>
         <seg>&quot;trigger&quot;</seg>
        </seglistitem>
       </segmentedlist>
 
       
        <programlisting>
begin
  delete from shipto where trans_id = old.id;
  delete from customertax where customer_id = old.id;
  delete from partscustomer where customer_id = old.id;
  return NULL;
end;
</programlisting>
      </para>
    </section>

<!-- Function del_department(  ) -->
    <section id="public.function.del-department"
             xreflabel="publicdel_department(  )">
      <title id="public.function.del-department-title">
       del_department(  )
      </title>
      <titleabbrev id="public.function.del-department-titleabbrev">
       del_department(  )
      </titleabbrev>

      <para>
       <segmentedlist>
        <title>Function Properties</title>
        <?dbhtml list-presentation="list"?>
        <segtitle>Language</segtitle>
        <segtitle>Return Type</segtitle>
        <seglistitem>
         <seg>PLPGSQL</seg>
         <seg>&quot;trigger&quot;</seg>
        </seglistitem>
       </segmentedlist>
 
       
        <programlisting>
begin
  delete from dpt_trans where trans_id = old.id;
  return NULL;
end;
</programlisting>
      </para>
    </section>

<!-- Function del_exchangerate(  ) -->
    <section id="public.function.del-exchangerate"
             xreflabel="publicdel_exchangerate(  )">
      <title id="public.function.del-exchangerate-title">
       del_exchangerate(  )
      </title>
      <titleabbrev id="public.function.del-exchangerate-titleabbrev">
       del_exchangerate(  )
      </titleabbrev>

      <para>
       <segmentedlist>
        <title>Function Properties</title>
        <?dbhtml list-presentation="list"?>
        <segtitle>Language</segtitle>
        <segtitle>Return Type</segtitle>
        <seglistitem>
         <seg>PLPGSQL</seg>
         <seg>&quot;trigger&quot;</seg>
        </seglistitem>
       </segmentedlist>
 
       
        <programlisting>

declare
  t_transdate date;
  t_curr char(3);
  t_id int;
  d_curr text;

begin

  select into d_curr substr(value,1,3) from defaults where setting_key = &#39;curr&#39;;
  
  if TG_RELNAME = &#39;ar&#39; then
    select into t_curr, t_transdate curr, transdate from ar where id = old.id;
  end if;
  if TG_RELNAME = &#39;ap&#39; then
    select into t_curr, t_transdate curr, transdate from ap where id = old.id;
  end if;
  if TG_RELNAME = &#39;oe&#39; then
    select into t_curr, t_transdate curr, transdate from oe where id = old.id;
  end if;

  if d_curr != t_curr then

    select into t_id a.id from acc_trans ac
    join ar a on (a.id = ac.trans_id)
    where a.curr = t_curr
    and ac.transdate = t_transdate

    except select a.id from ar a where a.id = old.id
    
    union
    
    select a.id from acc_trans ac
    join ap a on (a.id = ac.trans_id)
    where a.curr = t_curr
    and ac.transdate = t_transdate
    
    except select a.id from ap a where a.id = old.id
    
    union
    
    select o.id from oe o
    where o.curr = t_curr
    and o.transdate = t_transdate
    
    except select o.id from oe o where o.id = old.id;

    if not found then
      delete from exchangerate where curr = t_curr and transdate = t_transdate;
    end if;
  end if;
return old;

end;
</programlisting>
      </para>
    </section>

<!-- Function del_recurring(  ) -->
    <section id="public.function.del-recurring"
             xreflabel="publicdel_recurring(  )">
      <title id="public.function.del-recurring-title">
       del_recurring(  )
      </title>
      <titleabbrev id="public.function.del-recurring-titleabbrev">
       del_recurring(  )
      </titleabbrev>

      <para>
       <segmentedlist>
        <title>Function Properties</title>
        <?dbhtml list-presentation="list"?>
        <segtitle>Language</segtitle>
        <segtitle>Return Type</segtitle>
        <seglistitem>
         <seg>PLPGSQL</seg>
         <seg>&quot;trigger&quot;</seg>
        </seglistitem>
       </segmentedlist>
 
       
        <programlisting>
BEGIN
  DELETE FROM recurring WHERE id = old.id;
  DELETE FROM recurringemail WHERE id = old.id;
  DELETE FROM recurringprint WHERE id = old.id;
  RETURN NULL;
END;
</programlisting>
      </para>
    </section>

<!-- Function del_vendor(  ) -->
    <section id="public.function.del-vendor"
             xreflabel="publicdel_vendor(  )">
      <title id="public.function.del-vendor-title">
       del_vendor(  )
      </title>
      <titleabbrev id="public.function.del-vendor-titleabbrev">
       del_vendor(  )
      </titleabbrev>

      <para>
       <segmentedlist>
        <title>Function Properties</title>
        <?dbhtml list-presentation="list"?>
        <segtitle>Language</segtitle>
        <segtitle>Return Type</segtitle>
        <seglistitem>
         <seg>PLPGSQL</seg>
         <seg>&quot;trigger&quot;</seg>
        </seglistitem>
       </segmentedlist>
 
       
        <programlisting>
begin
  delete from shipto where trans_id = old.id;
  delete from vendortax where vendor_id = old.id;
  delete from partsvendor where vendor_id = old.id;
  return NULL;
end;
</programlisting>
      </para>
    </section>

<!-- Function del_yearend(  ) -->
    <section id="public.function.del-yearend"
             xreflabel="publicdel_yearend(  )">
      <title id="public.function.del-yearend-title">
       del_yearend(  )
      </title>
      <titleabbrev id="public.function.del-yearend-titleabbrev">
       del_yearend(  )
      </titleabbrev>

      <para>
       <segmentedlist>
        <title>Function Properties</title>
        <?dbhtml list-presentation="list"?>
        <segtitle>Language</segtitle>
        <segtitle>Return Type</segtitle>
        <seglistitem>
         <seg>PLPGSQL</seg>
         <seg>&quot;trigger&quot;</seg>
        </seglistitem>
       </segmentedlist>
 
       
        <programlisting>
begin
  delete from yearend where trans_id = old.id;
  return NULL;
end;
</programlisting>
      </para>
    </section>

<!-- Function drop_custom_field( character varying, character varying ) -->
    <section id="public.function.drop-custom-field-character-varying-character-varying"
             xreflabel="publicdrop_custom_field( character varying, character varying )">
      <title id="public.function.drop-custom-field-character-varying-character-varying-title">
       drop_custom_field( character varying, character varying )
      </title>
      <titleabbrev id="public.function.drop-custom-field-character-varying-character-varying-titleabbrev">
       drop_custom_field( character varying, character varying )
      </titleabbrev>

      <para>
       <segmentedlist>
        <title>Function Properties</title>
        <?dbhtml list-presentation="list"?>
        <segtitle>Language</segtitle>
        <segtitle>Return Type</segtitle>
        <seglistitem>
         <seg>PLPGSQL</seg>
         <seg>boolean</seg>
        </seglistitem>
       </segmentedlist>
 
       
        <programlisting>
DECLARE
table_name ALIAS FOR $1;
custom_field_name ALIAS FOR $2;
BEGIN
	DELETE FROM custom_field_catalog 
	WHERE field_name = custom_field_name AND 
		table_id = (SELECT table_id FROM custom_table_catalog 
			WHERE extends = table_name);
	EXECUTE &#39;ALTER TABLE custom_&#39; || table_name || 
		&#39; DROP COLUMN &#39; || custom_field_name;
	RETURN TRUE;	
END;
</programlisting>
      </para>
    </section>

<!-- Function lastcost( integer ) -->
    <section id="public.function.lastcost-integer"
             xreflabel="publiclastcost( integer )">
      <title id="public.function.lastcost-integer-title">
       lastcost( integer )
      </title>
      <titleabbrev id="public.function.lastcost-integer-titleabbrev">
       lastcost( integer )
      </titleabbrev>

      <para>
       <segmentedlist>
        <title>Function Properties</title>
        <?dbhtml list-presentation="list"?>
        <segtitle>Language</segtitle>
        <segtitle>Return Type</segtitle>
        <seglistitem>
         <seg>PLPGSQL</seg>
         <seg>double precision</seg>
        </seglistitem>
       </segmentedlist>
 
       
        <programlisting>

DECLARE

v_cost float;
v_parts_id alias for $1;

BEGIN

  SELECT INTO v_cost sellprice FROM invoice i
  JOIN ap a ON (a.id = i.trans_id)
  WHERE i.parts_id = v_parts_id
  ORDER BY a.transdate desc, a.id desc
  LIMIT 1;

  IF v_cost IS NULL THEN
    v_cost := 0;
  END IF;

RETURN v_cost;
END;
</programlisting>
      </para>
    </section>

<!-- Function trigger_parts_short(  ) -->
    <section id="public.function.trigger-parts-short"
             xreflabel="publictrigger_parts_short(  )">
      <title id="public.function.trigger-parts-short-title">
       trigger_parts_short(  )
      </title>
      <titleabbrev id="public.function.trigger-parts-short-titleabbrev">
       trigger_parts_short(  )
      </titleabbrev>

      <para>
       <segmentedlist>
        <title>Function Properties</title>
        <?dbhtml list-presentation="list"?>
        <segtitle>Language</segtitle>
        <segtitle>Return Type</segtitle>
        <seglistitem>
         <seg>PLPGSQL</seg>
         <seg>&quot;trigger&quot;</seg>
        </seglistitem>
       </segmentedlist>
 
       
        <programlisting>
BEGIN
  IF NEW.onhand &gt;= NEW.rop THEN
    NOTIFY parts_short;
  END IF;
  RETURN NEW;
END;
</programlisting>
      </para>
    </section>

<!-- Function update_user( integer, text ) -->
    <section id="public.function.update-user-integer-text"
             xreflabel="publicupdate_user( integer, text )">
      <title id="public.function.update-user-integer-text-title">
       update_user( integer, text )
      </title>
      <titleabbrev id="public.function.update-user-integer-text-titleabbrev">
       update_user( integer, text )
      </titleabbrev>

      <para>
       <segmentedlist>
        <title>Function Properties</title>
        <?dbhtml list-presentation="list"?>
        <segtitle>Language</segtitle>
        <segtitle>Return Type</segtitle>
        <seglistitem>
         <seg>SQL</seg>
         <seg>integer</seg>
        </seglistitem>
       </segmentedlist>
 
        Takes int4 which is users.id and text which is username. Will update username based on id. Username is unique 
        <programlisting>
   UPDATE users SET username = &#39;$2&#39; WHERE id = $1;
   SELECT 1;
   </programlisting>
      </para>
    </section>

  </chapter>

</book>

