- <?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.lsmb13-new" xreflabel="lsmb13-new database schema"><title>lsmb13-new 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 ('now'::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>serial</type>
- <literal>PRIMARY KEY</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 ('now'::text)::date</literal>
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>entity_id</structfield></term>
- <listitem><para>
- <type>integer</type>
- <literal>REFERENCES</literal> <xref linkend="public.table.entity"/>
- </para>
- <para>
- Used to be customer_id, but customer is now metadata. You need to push to entity
- </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>person_id</structfield></term>
- <listitem><para>
- <type>integer</type>
- <literal>NOT NULL</literal>
- <literal>REFERENCES</literal> <xref linkend="public.table.person"/>
- </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_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>
- </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>serial</type>
- <literal>PRIMARY KEY</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 ('now'::text)::date</literal>
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>entity_id</structfield></term>
- <listitem><para>
- <type>integer</type>
- <literal>REFERENCES</literal> <xref linkend="public.table.entity"/>
- </para>
- <para>
- Used to be customer_id, but customer is now metadata. You need to push to entity
- </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>person_id</structfield></term>
- <listitem><para>
- <type>integer</type>
- <literal>NOT NULL</literal>
- <literal>REFERENCES</literal> <xref linkend="public.table.person"/>
- </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_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>person_id</structfield></term>
- <listitem><para>
- <type>integer</type>
- <literal>NOT NULL</literal>
- <literal>REFERENCES</literal> <xref linkend="public.table.person"/>
- </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>serial</type>
- <literal>PRIMARY KEY</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>serial</type>
- <literal>PRIMARY KEY</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 'A'::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.company"
- xreflabel="public.company">
- <title id="public.table.company-title">
- Table:
-
- <structname>company</structname>
- </title>
-
- <para>
- <variablelist>
- <title>
- Structure of <structname>company</structname>
- </title>
- <varlistentry>
- <term><structfield>id</structfield></term>
- <listitem><para>
- <type>serial</type>
- <literal>UNIQUE</literal>
- <literal>NOT NULL</literal>
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>entity_id</structfield></term>
- <listitem><para>
- <type>integer</type>
- <literal>NOT NULL</literal>
- <literal>REFERENCES</literal> <xref linkend="public.table.entity"/>
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>legal_name</structfield></term>
- <listitem><para>
- <type>text</type>
- <literal>PRIMARY KEY</literal>
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>entity_class_id</structfield></term>
- <listitem><para>
- <type>integer</type>
- <literal>NOT NULL</literal>
- <literal>REFERENCES</literal> <xref linkend="public.table.entity-class"/>
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>primary_location_id</structfield></term>
- <listitem><para>
- <type>integer</type>
- <literal>PRIMARY KEY</literal>
- <literal>REFERENCES</literal> <xref linkend="public.table.location"/>
- </para>
- <para>
- This is the location that should show up by default for any forms
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>tax_id</structfield></term>
- <listitem><para>
- <type>text</type>
- </para>
- <para>
- In the US this would be a EIN.
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
- <variablelist>
- <title>Constraints on company</title>
- <varlistentry>
- <term>company_legal_name_check</term>
- <listitem><para>CHECK ((legal_name ~ '[[:alnum:]_]'::text))</para></listitem>
- </varlistentry>
- </variablelist>
- <itemizedlist>
- <title>
- Tables referencing company_to_contact via Foreign Key Constraints
- </title>
- <listitem>
- <para>
- <xref linkend="public.table.company-to-contact"/>
- </para>
- </listitem>
- <listitem>
- <para>
- <xref linkend="public.table.company-to-entity"/>
- </para>
- </listitem>
- <listitem>
- <para>
- <xref linkend="public.table.company-to-location"/>
- </para>
- </listitem>
- </itemizedlist>
- </para>
- </section>
- <section id="public.table.company-to-contact"
- xreflabel="public.company_to_contact">
- <title id="public.table.company-to-contact-title">
- Table:
-
- <structname>company_to_contact</structname>
- </title>
-
- <para>
- To keep track of the relationship between multiple contact methods and a single company
- </para>
- <para>
- <variablelist>
- <title>
- Structure of <structname>company_to_contact</structname>
- </title>
- <varlistentry>
- <term><structfield>company_id</structfield></term>
- <listitem><para>
- <type>integer</type>
- <literal>PRIMARY KEY</literal>
- <literal>REFERENCES</literal> <xref linkend="public.table.company"/>
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>contact_class_id</structfield></term>
- <listitem><para>
- <type>integer</type>
- <literal>PRIMARY KEY</literal>
- <literal>REFERENCES</literal> <xref linkend="public.table.contact-class"/>
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>contact</structfield></term>
- <listitem><para>
- <type>text</type>
- <literal>PRIMARY KEY</literal>
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
- <variablelist>
- <title>Constraints on company_to_contact</title>
- <varlistentry>
- <term>company_to_contact_contact_check</term>
- <listitem><para>CHECK ((contact ~ '[[:alnum:]_]'::text))</para></listitem>
- </varlistentry>
- </variablelist>
- </para>
- </section>
- <section id="public.table.company-to-entity"
- xreflabel="public.company_to_entity">
- <title id="public.table.company-to-entity-title">
- Table:
-
- <structname>company_to_entity</structname>
- </title>
-
- <para>
- <variablelist>
- <title>
- Structure of <structname>company_to_entity</structname>
- </title>
- <varlistentry>
- <term><structfield>company_id</structfield></term>
- <listitem><para>
- <type>integer</type>
- <literal>PRIMARY KEY</literal>
- <literal>REFERENCES</literal> <xref linkend="public.table.company"/>
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>entity_id</structfield></term>
- <listitem><para>
- <type>integer</type>
- <literal>PRIMARY KEY</literal>
- <literal>REFERENCES</literal> <xref linkend="public.table.entity"/>
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>related_how</structfield></term>
- <listitem><para>
- <type>text</type>
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>created</structfield></term>
- <listitem><para>
- <type>date</type>
- <literal>NOT NULL</literal>
- <literal>DEFAULT ('now'::text)::date</literal>
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
- <variablelist>
- <title>Constraints on company_to_entity</title>
- <varlistentry>
- <term>company_to_entity_check</term>
- <listitem><para>CHECK ((entity_id <> company_id))</para></listitem>
- </varlistentry>
- </variablelist>
- </para>
- </section>
- <section id="public.table.company-to-location"
- xreflabel="public.company_to_location">
- <title id="public.table.company-to-location-title">
- Table:
-
- <structname>company_to_location</structname>
- </title>
-
- <para>
- <variablelist>
- <title>
- Structure of <structname>company_to_location</structname>
- </title>
- <varlistentry>
- <term><structfield>location_id</structfield></term>
- <listitem><para>
- <type>integer</type>
- <literal>PRIMARY KEY</literal>
- <literal>REFERENCES</literal> <xref linkend="public.table.location"/>
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>company_id</structfield></term>
- <listitem><para>
- <type>integer</type>
- <literal>PRIMARY KEY</literal>
- <literal>REFERENCES</literal> <xref linkend="public.table.company"/>
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
- </para>
- </section>
- <section id="public.table.contact-class"
- xreflabel="public.contact_class">
- <title id="public.table.contact-class-title">
- Table:
-
- <structname>contact_class</structname>
- </title>
-
- <para>
- <variablelist>
- <title>
- Structure of <structname>contact_class</structname>
- </title>
- <varlistentry>
- <term><structfield>id</structfield></term>
- <listitem><para>
- <type>serial</type>
- <literal>UNIQUE</literal>
- <literal>NOT NULL</literal>
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>class</structfield></term>
- <listitem><para>
- <type>text</type>
- <literal>PRIMARY KEY</literal>
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
- <variablelist>
- <title>Constraints on contact_class</title>
- <varlistentry>
- <term>contact_class_class_check</term>
- <listitem><para>CHECK (("class" ~ '[[:alnum:]_]'::text))</para></listitem>
- </varlistentry>
- </variablelist>
- <itemizedlist>
- <title>
- Tables referencing company_to_contact via Foreign Key Constraints
- </title>
- <listitem>
- <para>
- <xref linkend="public.table.company-to-contact"/>
- </para>
- </listitem>
- <listitem>
- <para>
- <xref linkend="public.table.person-to-contact"/>
- </para>
- </listitem>
- </itemizedlist>
- </para>
- </section>
- <section id="public.table.country"
- xreflabel="public.country">
- <title id="public.table.country-title">
- Table:
-
- <structname>country</structname>
- </title>
-
- <para>
- <variablelist>
- <title>
- Structure of <structname>country</structname>
- </title>
- <varlistentry>
- <term><structfield>id</structfield></term>
- <listitem><para>
- <type>serial</type>
- <literal>PRIMARY KEY</literal>
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>name</structfield></term>
- <listitem><para>
- <type>text</type>
- <literal>NOT NULL</literal>
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>short_name</structfield></term>
- <listitem><para>
- <type>text</type>
- <literal>NOT NULL</literal>
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>itu</structfield></term>
- <listitem><para>
- <type>text</type>
- </para>
- <para>
- The ITU Telecommunication Standardization Sector code for calling internationally. For example, the US is 1, Great Britain is 44
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
- <variablelist>
- <title>Constraints on country</title>
- <varlistentry>
- <term>country_name_check</term>
- <listitem><para>CHECK ((name ~ '[[:alnum:]_]'::text))</para></listitem>
- </varlistentry>
- <varlistentry>
- <term>country_short_name_check</term>
- <listitem><para>CHECK ((short_name ~ '[[:alnum:]_]'::text))</para></listitem>
- </varlistentry>
- </variablelist>
- <itemizedlist>
- <title>
- Tables referencing location via Foreign Key Constraints
- </title>
- <listitem>
- <para>
- <xref linkend="public.table.location"/>
- </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>
- This is now a metadata table that holds information specific to customers. Source info is not part of the entity management
- </para>
- <para>
- <variablelist>
- <title>
- Structure of <structname>customer</structname>
- </title>
- <varlistentry>
- <term><structfield>id</structfield></term>
- <listitem><para>
- <type>serial</type>
- <literal>PRIMARY KEY</literal>
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>entity_id</structfield></term>
- <listitem><para>
- <type>integer</type>
- <literal>REFERENCES</literal> <xref linkend="public.table.entity"/>
- </para>
- <para>
- This is the relationship between entities and customers
- </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>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>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>
- <literal>DEFAULT ('now'::text)::date</literal>
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>enddate</structfield></term>
- <listitem><para>
- <type>date</type>
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>invoice_notes</structfield></term>
- <listitem><para>
- <type>text</type>
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
- <variablelist>
- <title>Indexes on customer</title>
- <varlistentry>
- <term>customer_customernumber_key</term>
- <listitem><para>customernumber</para></listitem>
- </varlistentry>
- <varlistentry>
- <term>customer_id_key</term>
- <listitem><para>id</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>serial</type>
- <literal>PRIMARY KEY</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 'P'::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>
- Is a metadata table specific to employees
- </para>
- <para>
- <variablelist>
- <title>
- Structure of <structname>employee</structname>
- </title>
- <varlistentry>
- <term><structfield>id</structfield></term>
- <listitem><para>
- <type>serial</type>
- <literal>PRIMARY KEY</literal>
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>entity_id</structfield></term>
- <listitem><para>
- <type>integer</type>
- <literal>NOT NULL</literal>
- <literal>REFERENCES</literal> <xref linkend="public.table.entity"/>
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>login</structfield></term>
- <listitem><para>
- <type>text</type>
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>startdate</structfield></term>
- <listitem><para>
- <type>date</type>
- <literal>DEFAULT ('now'::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>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>
- </para>
- </section>
- <section id="public.table.entity"
- xreflabel="public.entity">
- <title id="public.table.entity-title">
- Table:
-
- <structname>entity</structname>
- </title>
-
- <para>
- The primary entity table to map to all contacts
- </para>
- <para>
- <variablelist>
- <title>
- Structure of <structname>entity</structname>
- </title>
- <varlistentry>
- <term><structfield>id</structfield></term>
- <listitem><para>
- <type>serial</type>
- <literal>PRIMARY KEY</literal>
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>name</structfield></term>
- <listitem><para>
- <type>text</type>
- </para>
- <para>
- This is the common name of an entity. If it was a person it may be Joshua Drake, a company Acme Corp. You may also choose to use a domain such as commandprompt.com
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>entity_class</structfield></term>
- <listitem><para>
- <type>integer</type>
- <literal>NOT NULL</literal>
- <literal>REFERENCES</literal> <xref linkend="public.table.entity-class"/>
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
- <variablelist>
- <title>Constraints on entity</title>
- <varlistentry>
- <term>entity_name_check</term>
- <listitem><para>CHECK ((name ~ '[[:alnum:]_]'::text))</para></listitem>
- </varlistentry>
- </variablelist>
- <itemizedlist>
- <title>
- Tables referencing ap via Foreign Key Constraints
- </title>
- <listitem>
- <para>
- <xref linkend="public.table.ap"/>
- </para>
- </listitem>
- <listitem>
- <para>
- <xref linkend="public.table.ar"/>
- </para>
- </listitem>
- <listitem>
- <para>
- <xref linkend="public.table.company"/>
- </para>
- </listitem>
- <listitem>
- <para>
- <xref linkend="public.table.company-to-entity"/>
- </para>
- </listitem>
- <listitem>
- <para>
- <xref linkend="public.table.customer"/>
- </para>
- </listitem>
- <listitem>
- <para>
- <xref linkend="public.table.employee"/>
- </para>
- </listitem>
- <listitem>
- <para>
- <xref linkend="public.table.entity-class-to-entity"/>
- </para>
- </listitem>
- <listitem>
- <para>
- <xref linkend="public.table.entity-other-name"/>
- </para>
- </listitem>
- <listitem>
- <para>
- <xref linkend="public.table.oe"/>
- </para>
- </listitem>
- <listitem>
- <para>
- <xref linkend="public.table.partsvendor"/>
- </para>
- </listitem>
- <listitem>
- <para>
- <xref linkend="public.table.person"/>
- </para>
- </listitem>
- <listitem>
- <para>
- <xref linkend="public.table.person-to-entity"/>
- </para>
- </listitem>
- <listitem>
- <para>
- <xref linkend="public.table.vendor"/>
- </para>
- </listitem>
- </itemizedlist>
- </para>
- </section>
- <section id="public.table.entity-class"
- xreflabel="public.entity_class">
- <title id="public.table.entity-class-title">
- Table:
-
- <structname>entity_class</structname>
- </title>
-
- <para>
- Defines the class type such as vendor, customer, contact, employee
- </para>
- <para>
- <variablelist>
- <title>
- Structure of <structname>entity_class</structname>
- </title>
- <varlistentry>
- <term><structfield>id</structfield></term>
- <listitem><para>
- <type>serial</type>
- <literal>PRIMARY KEY</literal>
- </para>
- <para>
- The first 7 values are reserved and permanent
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>class</structfield></term>
- <listitem><para>
- <type>text</type>
- <literal>NOT NULL</literal>
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>active</structfield></term>
- <listitem><para>
- <type>boolean</type>
- <literal>NOT NULL</literal>
- <literal>DEFAULT true</literal>
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
- <variablelist>
- <title>Constraints on entity_class</title>
- <varlistentry>
- <term>entity_class_class_check</term>
- <listitem><para>CHECK (("class" ~ '[[:alnum:]_]'::text))</para></listitem>
- </varlistentry>
- </variablelist>
- <itemizedlist>
- <title>
- Tables referencing company via Foreign Key Constraints
- </title>
- <listitem>
- <para>
- <xref linkend="public.table.company"/>
- </para>
- </listitem>
- <listitem>
- <para>
- <xref linkend="public.table.entity"/>
- </para>
- </listitem>
- <listitem>
- <para>
- <xref linkend="public.table.entity-class-to-entity"/>
- </para>
- </listitem>
- </itemizedlist>
- </para>
- </section>
- <section id="public.table.entity-class-to-entity"
- xreflabel="public.entity_class_to_entity">
- <title id="public.table.entity-class-to-entity-title">
- Table:
-
- <structname>entity_class_to_entity</structname>
- </title>
-
- <para>
- Relation builder for classes to entity
- </para>
- <para>
- <variablelist>
- <title>
- Structure of <structname>entity_class_to_entity</structname>
- </title>
- <varlistentry>
- <term><structfield>entity_class_id</structfield></term>
- <listitem><para>
- <type>integer</type>
- <literal>PRIMARY KEY</literal>
- <literal>REFERENCES</literal> <xref linkend="public.table.entity-class"/>
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>entity_id</structfield></term>
- <listitem><para>
- <type>integer</type>
- <literal>PRIMARY KEY</literal>
- <literal>REFERENCES</literal> <xref linkend="public.table.entity"/>
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
- </para>
- </section>
- <section id="public.table.entity-other-name"
- xreflabel="public.entity_other_name">
- <title id="public.table.entity-other-name-title">
- Table:
-
- <structname>entity_other_name</structname>
- </title>
-
- <para>
- Similar to company_other_name, a person may be jd, Joshua Drake, linuxpoet... all are the same person.
- </para>
- <para>
- <variablelist>
- <title>
- Structure of <structname>entity_other_name</structname>
- </title>
- <varlistentry>
- <term><structfield>entity_id</structfield></term>
- <listitem><para>
- <type>integer</type>
- <literal>PRIMARY KEY</literal>
- <literal>REFERENCES</literal> <xref linkend="public.table.entity"/>
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>other_name</structfield></term>
- <listitem><para>
- <type>text</type>
- <literal>PRIMARY KEY</literal>
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
- <variablelist>
- <title>Constraints on entity_other_name</title>
- <varlistentry>
- <term>entity_other_name_other_name_check</term>
- <listitem><para>CHECK ((other_name ~ '[[:alnum:]_]'::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>serial</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>description</structfield></term>
- <listitem><para>
- <type>text</type>
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>transdate</structfield></term>
- <listitem><para>
- <type>date</type>
- <literal>DEFAULT ('now'::text)::date</literal>
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>person_id</structfield></term>
- <listitem><para>
- <type>integer</type>
- <literal>REFERENCES</literal> <xref linkend="public.table.person"/>
- </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_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>person_id</structfield></term>
- <listitem><para>
- <type>integer</type>
- <literal>NOT NULL</literal>
- <literal>REFERENCES</literal> <xref linkend="public.table.person"/>
- </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>serial</type>
- <literal>PRIMARY KEY</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>serial</type>
- <literal>PRIMARY KEY</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>person_id</structfield></term>
- <listitem><para>
- <type>integer</type>
- <literal>NOT NULL</literal>
- <literal>REFERENCES</literal> <xref linkend="public.table.person"/>
- </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.location"
- xreflabel="public.location">
- <title id="public.table.location-title">
- Table:
-
- <structname>location</structname>
- </title>
-
- <para>
- <variablelist>
- <title>
- Structure of <structname>location</structname>
- </title>
- <varlistentry>
- <term><structfield>id</structfield></term>
- <listitem><para>
- <type>serial</type>
- <literal>PRIMARY KEY</literal>
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>line_one</structfield></term>
- <listitem><para>
- <type>text</type>
- <literal>NOT NULL</literal>
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>line_two</structfield></term>
- <listitem><para>
- <type>text</type>
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>line_three</structfield></term>
- <listitem><para>
- <type>text</type>
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>city_province</structfield></term>
- <listitem><para>
- <type>text</type>
- <literal>NOT NULL</literal>
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>country_id</structfield></term>
- <listitem><para>
- <type>integer</type>
- <literal>NOT NULL</literal>
- <literal>REFERENCES</literal> <xref linkend="public.table.country"/>
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>mail_code</structfield></term>
- <listitem><para>
- <type>text</type>
- <literal>NOT NULL</literal>
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
- <variablelist>
- <title>Constraints on location</title>
- <varlistentry>
- <term>location_city_province_check</term>
- <listitem><para>CHECK ((city_province ~ '[[:alnum:]_]'::text))</para></listitem>
- </varlistentry>
- <varlistentry>
- <term>location_line_one_check</term>
- <listitem><para>CHECK ((line_one ~ '[[:alnum:]_]'::text))</para></listitem>
- </varlistentry>
- <varlistentry>
- <term>location_mail_code_check</term>
- <listitem><para>CHECK ((mail_code ~ '[[:alnum:]_]'::text))</para></listitem>
- </varlistentry>
- </variablelist>
- <itemizedlist>
- <title>
- Tables referencing company via Foreign Key Constraints
- </title>
- <listitem>
- <para>
- <xref linkend="public.table.company"/>
- </para>
- </listitem>
- <listitem>
- <para>
- <xref linkend="public.table.company-to-location"/>
- </para>
- </listitem>
- <listitem>
- <para>
- <xref linkend="public.table.person"/>
- </para>
- </listitem>
- <listitem>
- <para>
- <xref linkend="public.table.person-to-company"/>
- </para>
- </listitem>
- </itemizedlist>
- </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>serial</type>
- <literal>PRIMARY KEY</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 ('now'::text)::date</literal>
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>entity_id</structfield></term>
- <listitem><para>
- <type>integer</type>
- <literal>NOT NULL</literal>
- <literal>REFERENCES</literal> <xref linkend="public.table.entity"/>
- </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>person_id</structfield></term>
- <listitem><para>
- <type>integer</type>
- <literal>NOT NULL</literal>
- <literal>REFERENCES</literal> <xref linkend="public.table.person"/>
- </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>
- <varlistentry>
- <term><structfield>oe_class_id</structfield></term>
- <listitem><para>
- <type>integer</type>
- <literal>NOT NULL</literal>
- <literal>REFERENCES</literal> <xref linkend="public.table.oe-class"/>
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
- <variablelist>
- <title>Indexes on oe</title>
- <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.oe-class"
- xreflabel="public.oe_class">
- <title id="public.table.oe-class-title">
- Table:
-
- <structname>oe_class</structname>
- </title>
-
- <para>
- This could probably be done better. But I need to remove the customer_id/vendor_id relationship and instead rely on a classification
- </para>
- <para>
- <variablelist>
- <title>
- Structure of <structname>oe_class</structname>
- </title>
- <varlistentry>
- <term><structfield>id</structfield></term>
- <listitem><para>
- <type>smallint</type>
- <literal>UNIQUE</literal>
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>oe_class</structfield></term>
- <listitem><para>
- <type>text</type>
- <literal>PRIMARY KEY</literal>
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
- <variablelist>
- <title>Constraints on oe_class</title>
- <varlistentry>
- <term>oe_class_id_check</term>
- <listitem><para>CHECK (((id = 1) OR (id = 2)))</para></listitem>
- </varlistentry>
- </variablelist>
- <itemizedlist>
- <title>
- Tables referencing oe via Foreign Key Constraints
- </title>
- <listitem>
- <para>
- <xref linkend="public.table.oe"/>
- </para>
- </listitem>
- </itemizedlist>
- </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>serial</type>
- <literal>PRIMARY KEY</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>serial</type>
- <literal>PRIMARY KEY</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 ('now'::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>serial</type>
- <literal>PRIMARY KEY</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>entity_id</structfield></term>
- <listitem><para>
- <type>integer</type>
- <literal>NOT NULL</literal>
- <literal>REFERENCES</literal> <xref linkend="public.table.entity"/>
- </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>
- </variablelist>
- </para>
- </section>
- <section id="public.table.person"
- xreflabel="public.person">
- <title id="public.table.person-title">
- Table:
-
- <structname>person</structname>
- </title>
-
- <para>
- Every person, must have an entity to derive a common or display name. The correct way to get class information on a person would be person.entity_id->entity_class_to_entity.entity_id.
- </para>
- <para>
- <variablelist>
- <title>
- Structure of <structname>person</structname>
- </title>
- <varlistentry>
- <term><structfield>id</structfield></term>
- <listitem><para>
- <type>serial</type>
- <literal>PRIMARY KEY</literal>
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>entity_id</structfield></term>
- <listitem><para>
- <type>integer</type>
- <literal>NOT NULL</literal>
- <literal>REFERENCES</literal> <xref linkend="public.table.entity"/>
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>salutation_id</structfield></term>
- <listitem><para>
- <type>integer</type>
- <literal>REFERENCES</literal> <xref linkend="public.table.salutation"/>
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>first_name</structfield></term>
- <listitem><para>
- <type>text</type>
- <literal>NOT NULL</literal>
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>middle_name</structfield></term>
- <listitem><para>
- <type>text</type>
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>last_name</structfield></term>
- <listitem><para>
- <type>text</type>
- <literal>NOT NULL</literal>
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>primary_location_id</structfield></term>
- <listitem><para>
- <type>integer</type>
- <literal>REFERENCES</literal> <xref linkend="public.table.location"/>
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
- <variablelist>
- <title>Constraints on person</title>
- <varlistentry>
- <term>person_first_name_check</term>
- <listitem><para>CHECK ((first_name ~ '[[:alnum:]_]'::text))</para></listitem>
- </varlistentry>
- <varlistentry>
- <term>person_last_name_check</term>
- <listitem><para>CHECK ((last_name ~ '[[:alnum:]_]'::text))</para></listitem>
- </varlistentry>
- </variablelist>
- <itemizedlist>
- <title>
- Tables referencing ap via Foreign Key Constraints
- </title>
- <listitem>
- <para>
- <xref linkend="public.table.ap"/>
- </para>
- </listitem>
- <listitem>
- <para>
- <xref linkend="public.table.ar"/>
- </para>
- </listitem>
- <listitem>
- <para>
- <xref linkend="public.table.audittrail"/>
- </para>
- </listitem>
- <listitem>
- <para>
- <xref linkend="public.table.gl"/>
- </para>
- </listitem>
- <listitem>
- <para>
- <xref linkend="public.table.inventory"/>
- </para>
- </listitem>
- <listitem>
- <para>
- <xref linkend="public.table.jcitems"/>
- </para>
- </listitem>
- <listitem>
- <para>
- <xref linkend="public.table.oe"/>
- </para>
- </listitem>
- <listitem>
- <para>
- <xref linkend="public.table.person-to-company"/>
- </para>
- </listitem>
- <listitem>
- <para>
- <xref linkend="public.table.person-to-contact"/>
- </para>
- </listitem>
- <listitem>
- <para>
- <xref linkend="public.table.person-to-entity"/>
- </para>
- </listitem>
- </itemizedlist>
- </para>
- </section>
- <section id="public.table.person-to-company"
- xreflabel="public.person_to_company">
- <title id="public.table.person-to-company-title">
- Table:
-
- <structname>person_to_company</structname>
- </title>
-
- <para>
- <variablelist>
- <title>
- Structure of <structname>person_to_company</structname>
- </title>
- <varlistentry>
- <term><structfield>location_id</structfield></term>
- <listitem><para>
- <type>integer</type>
- <literal>PRIMARY KEY</literal>
- <literal>REFERENCES</literal> <xref linkend="public.table.location"/>
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>person_id</structfield></term>
- <listitem><para>
- <type>integer</type>
- <literal>PRIMARY KEY</literal>
- <literal>REFERENCES</literal> <xref linkend="public.table.person"/>
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
- </para>
- </section>
- <section id="public.table.person-to-contact"
- xreflabel="public.person_to_contact">
- <title id="public.table.person-to-contact-title">
- Table:
-
- <structname>person_to_contact</structname>
- </title>
-
- <para>
- To keep track of the relationship between multiple contact methods and a single individual
- </para>
- <para>
- <variablelist>
- <title>
- Structure of <structname>person_to_contact</structname>
- </title>
- <varlistentry>
- <term><structfield>person_id</structfield></term>
- <listitem><para>
- <type>integer</type>
- <literal>PRIMARY KEY</literal>
- <literal>REFERENCES</literal> <xref linkend="public.table.person"/>
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>contact_class_id</structfield></term>
- <listitem><para>
- <type>integer</type>
- <literal>PRIMARY KEY</literal>
- <literal>REFERENCES</literal> <xref linkend="public.table.contact-class"/>
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>contact</structfield></term>
- <listitem><para>
- <type>text</type>
- <literal>PRIMARY KEY</literal>
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
- <variablelist>
- <title>Constraints on person_to_contact</title>
- <varlistentry>
- <term>person_to_contact_contact_check</term>
- <listitem><para>CHECK ((contact ~ '[[:alnum:]_]'::text))</para></listitem>
- </varlistentry>
- </variablelist>
- </para>
- </section>
- <section id="public.table.person-to-entity"
- xreflabel="public.person_to_entity">
- <title id="public.table.person-to-entity-title">
- Table:
-
- <structname>person_to_entity</structname>
- </title>
-
- <para>
- <variablelist>
- <title>
- Structure of <structname>person_to_entity</structname>
- </title>
- <varlistentry>
- <term><structfield>person_id</structfield></term>
- <listitem><para>
- <type>integer</type>
- <literal>PRIMARY KEY</literal>
- <literal>REFERENCES</literal> <xref linkend="public.table.person"/>
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>entity_id</structfield></term>
- <listitem><para>
- <type>integer</type>
- <literal>PRIMARY KEY</literal>
- <literal>REFERENCES</literal> <xref linkend="public.table.entity"/>
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>related_how</structfield></term>
- <listitem><para>
- <type>text</type>
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>created</structfield></term>
- <listitem><para>
- <type>date</type>
- <literal>NOT NULL</literal>
- <literal>DEFAULT ('now'::text)::date</literal>
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
- <variablelist>
- <title>Constraints on person_to_entity</title>
- <varlistentry>
- <term>person_to_entity_check</term>
- <listitem><para>CHECK ((entity_id <> person_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>serial</type>
- <literal>PRIMARY KEY</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>serial</type>
- <literal>PRIMARY KEY</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.salutation"
- xreflabel="public.salutation">
- <title id="public.table.salutation-title">
- Table:
-
- <structname>salutation</structname>
- </title>
-
- <para>
- <variablelist>
- <title>
- Structure of <structname>salutation</structname>
- </title>
- <varlistentry>
- <term><structfield>id</structfield></term>
- <listitem><para>
- <type>serial</type>
- <literal>UNIQUE</literal>
- <literal>NOT NULL</literal>
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>salutation</structfield></term>
- <listitem><para>
- <type>text</type>
- <literal>PRIMARY KEY</literal>
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
- <itemizedlist>
- <title>
- Tables referencing person via Foreign Key Constraints
- </title>
- <listitem>
- <para>
- <xref linkend="public.table.person"/>
- </para>
- </listitem>
- </itemizedlist>
- </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>
- Now a meta data table
- </para>
- <para>
- <variablelist>
- <title>
- Structure of <structname>vendor</structname>
- </title>
- <varlistentry>
- <term><structfield>id</structfield></term>
- <listitem><para>
- <type>serial</type>
- <literal>PRIMARY KEY</literal>
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><structfield>entity_id</structfield></term>
- <listitem><para>
- <type>integer</type>
- <literal>NOT NULL</literal>
- <literal>REFERENCES</literal> <xref linkend="public.table.entity"/>
- </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>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_id_key</term>
- <listitem><para>id</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>
- </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>serial</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.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 'SELECT TABLE_ID FROM custom_table_catalog
- WHERE extends = ''' || table_name || ''' ';
- IF NOT FOUND THEN
- BEGIN
- INSERT INTO custom_table_catalog (extends)
- VALUES (table_name);
- EXECUTE 'CREATE TABLE custom_'||table_name ||
- ' (row_id INT PRIMARY KEY)';
- EXCEPTION WHEN duplicate_table THEN
- -- do nothing
- END;
- END IF;
- EXECUTE 'INSERT INTO custom_field_catalog (field_name, table_id)
- VALUES ( ''' || new_field_name ||''', (SELECT table_id FROM custom_table_catalog
- WHERE extends = '''|| table_name || '''))';
- EXECUTE 'ALTER TABLE custom_'||table_name || ' ADD COLUMN '
- || new_field_name || ' ' || 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>"trigger"</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 > 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>"trigger"</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>"trigger"</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>"trigger"</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>"trigger"</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 = 'curr';
-
- if TG_RELNAME = 'ar' then
- select into t_curr, t_transdate curr, transdate from ar where id = old.id;
- end if;
- if TG_RELNAME = 'ap' then
- select into t_curr, t_transdate curr, transdate from ap where id = old.id;
- end if;
- if TG_RELNAME = 'oe' 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>"trigger"</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>"trigger"</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>"trigger"</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 'ALTER TABLE custom_' || table_name ||
- ' DROP COLUMN ' || 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>"trigger"</seg>
- </seglistitem>
- </segmentedlist>
-
-
- <programlisting>
- BEGIN
- IF NEW.onhand >= 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 = '$2' WHERE id = $1;
- SELECT 1;
- </programlisting>
- </para>
- </section>
- </chapter>
- </book>
|