summaryrefslogtreecommitdiff
path: root/doc/database/ledgersmb.xml
blob: 6fc88fa189fb45fff5938db16930d799859cbc43 (plain)
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!-- $Header: /cvsroot/autodoc/autodoc/xml.tmpl,v 1.2 2006/05/16 19:01:27 rbt Exp $ -->
  3. <book id="database.lsmb13-new" xreflabel="lsmb13-new database schema"><title>lsmb13-new Model</title>
  4. <chapter id="public.schema"
  5. xreflabel="public">
  6. <title>Schema public</title>
  7. <para>Standard public schema</para>
  8. <section id="public.table.acc-trans"
  9. xreflabel="public.acc_trans">
  10. <title id="public.table.acc-trans-title">
  11. Table:
  12. <structname>acc_trans</structname>
  13. </title>
  14. <para>
  15. <variablelist>
  16. <title>
  17. Structure of <structname>acc_trans</structname>
  18. </title>
  19. <varlistentry>
  20. <term><structfield>trans_id</structfield></term>
  21. <listitem><para>
  22. <type>integer</type>
  23. </para>
  24. </listitem>
  25. </varlistentry>
  26. <varlistentry>
  27. <term><structfield>chart_id</structfield></term>
  28. <listitem><para>
  29. <type>integer</type>
  30. <literal>NOT NULL</literal>
  31. <literal>REFERENCES</literal> <xref linkend="public.table.chart"/>
  32. </para>
  33. </listitem>
  34. </varlistentry>
  35. <varlistentry>
  36. <term><structfield>amount</structfield></term>
  37. <listitem><para>
  38. <type>numeric</type>
  39. </para>
  40. </listitem>
  41. </varlistentry>
  42. <varlistentry>
  43. <term><structfield>transdate</structfield></term>
  44. <listitem><para>
  45. <type>date</type>
  46. <literal>DEFAULT (&apos;now&apos;::text)::date</literal>
  47. </para>
  48. </listitem>
  49. </varlistentry>
  50. <varlistentry>
  51. <term><structfield>source</structfield></term>
  52. <listitem><para>
  53. <type>text</type>
  54. </para>
  55. </listitem>
  56. </varlistentry>
  57. <varlistentry>
  58. <term><structfield>cleared</structfield></term>
  59. <listitem><para>
  60. <type>boolean</type>
  61. <literal>DEFAULT false</literal>
  62. </para>
  63. </listitem>
  64. </varlistentry>
  65. <varlistentry>
  66. <term><structfield>fx_transaction</structfield></term>
  67. <listitem><para>
  68. <type>boolean</type>
  69. <literal>DEFAULT false</literal>
  70. </para>
  71. </listitem>
  72. </varlistentry>
  73. <varlistentry>
  74. <term><structfield>project_id</structfield></term>
  75. <listitem><para>
  76. <type>integer</type>
  77. </para>
  78. </listitem>
  79. </varlistentry>
  80. <varlistentry>
  81. <term><structfield>memo</structfield></term>
  82. <listitem><para>
  83. <type>text</type>
  84. </para>
  85. </listitem>
  86. </varlistentry>
  87. <varlistentry>
  88. <term><structfield>invoice_id</structfield></term>
  89. <listitem><para>
  90. <type>integer</type>
  91. </para>
  92. </listitem>
  93. </varlistentry>
  94. <varlistentry>
  95. <term><structfield>entry_id</structfield></term>
  96. <listitem><para>
  97. <type>serial</type>
  98. <literal>PRIMARY KEY</literal>
  99. </para>
  100. </listitem>
  101. </varlistentry>
  102. </variablelist>
  103. <variablelist>
  104. <title>Indexes on acc_trans</title>
  105. <varlistentry>
  106. <term>acc_trans_chart_id_key</term>
  107. <listitem><para>chart_id</para></listitem>
  108. </varlistentry>
  109. <varlistentry>
  110. <term>acc_trans_source_key</term>
  111. <listitem><para>lower(source)</para></listitem>
  112. </varlistentry>
  113. <varlistentry>
  114. <term>acc_trans_trans_id_key</term>
  115. <listitem><para>trans_id</para></listitem>
  116. </varlistentry>
  117. <varlistentry>
  118. <term>acc_trans_transdate_key</term>
  119. <listitem><para>transdate</para></listitem>
  120. </varlistentry>
  121. </variablelist>
  122. </para>
  123. </section>
  124. <section id="public.table.ap"
  125. xreflabel="public.ap">
  126. <title id="public.table.ap-title">
  127. Table:
  128. <structname>ap</structname>
  129. </title>
  130. <para>
  131. <variablelist>
  132. <title>
  133. Structure of <structname>ap</structname>
  134. </title>
  135. <varlistentry>
  136. <term><structfield>id</structfield></term>
  137. <listitem><para>
  138. <type>serial</type>
  139. <literal>PRIMARY KEY</literal>
  140. </para>
  141. </listitem>
  142. </varlistentry>
  143. <varlistentry>
  144. <term><structfield>invnumber</structfield></term>
  145. <listitem><para>
  146. <type>text</type>
  147. </para>
  148. </listitem>
  149. </varlistentry>
  150. <varlistentry>
  151. <term><structfield>transdate</structfield></term>
  152. <listitem><para>
  153. <type>date</type>
  154. <literal>DEFAULT (&apos;now&apos;::text)::date</literal>
  155. </para>
  156. </listitem>
  157. </varlistentry>
  158. <varlistentry>
  159. <term><structfield>entity_id</structfield></term>
  160. <listitem><para>
  161. <type>integer</type>
  162. <literal>REFERENCES</literal> <xref linkend="public.table.entity"/>
  163. </para>
  164. <para>
  165. Used to be customer_id, but customer is now metadata. You need to push to entity
  166. </para>
  167. </listitem>
  168. </varlistentry>
  169. <varlistentry>
  170. <term><structfield>taxincluded</structfield></term>
  171. <listitem><para>
  172. <type>boolean</type>
  173. <literal>DEFAULT false</literal>
  174. </para>
  175. </listitem>
  176. </varlistentry>
  177. <varlistentry>
  178. <term><structfield>amount</structfield></term>
  179. <listitem><para>
  180. <type>numeric</type>
  181. </para>
  182. </listitem>
  183. </varlistentry>
  184. <varlistentry>
  185. <term><structfield>netamount</structfield></term>
  186. <listitem><para>
  187. <type>numeric</type>
  188. </para>
  189. </listitem>
  190. </varlistentry>
  191. <varlistentry>
  192. <term><structfield>paid</structfield></term>
  193. <listitem><para>
  194. <type>numeric</type>
  195. </para>
  196. </listitem>
  197. </varlistentry>
  198. <varlistentry>
  199. <term><structfield>datepaid</structfield></term>
  200. <listitem><para>
  201. <type>date</type>
  202. </para>
  203. </listitem>
  204. </varlistentry>
  205. <varlistentry>
  206. <term><structfield>duedate</structfield></term>
  207. <listitem><para>
  208. <type>date</type>
  209. </para>
  210. </listitem>
  211. </varlistentry>
  212. <varlistentry>
  213. <term><structfield>invoice</structfield></term>
  214. <listitem><para>
  215. <type>boolean</type>
  216. <literal>DEFAULT false</literal>
  217. </para>
  218. </listitem>
  219. </varlistentry>
  220. <varlistentry>
  221. <term><structfield>ordnumber</structfield></term>
  222. <listitem><para>
  223. <type>text</type>
  224. </para>
  225. </listitem>
  226. </varlistentry>
  227. <varlistentry>
  228. <term><structfield>curr</structfield></term>
  229. <listitem><para>
  230. <type>character(3)</type>
  231. </para>
  232. </listitem>
  233. </varlistentry>
  234. <varlistentry>
  235. <term><structfield>notes</structfield></term>
  236. <listitem><para>
  237. <type>text</type>
  238. </para>
  239. </listitem>
  240. </varlistentry>
  241. <varlistentry>
  242. <term><structfield>person_id</structfield></term>
  243. <listitem><para>
  244. <type>integer</type>
  245. <literal>NOT NULL</literal>
  246. <literal>REFERENCES</literal> <xref linkend="public.table.person"/>
  247. </para>
  248. </listitem>
  249. </varlistentry>
  250. <varlistentry>
  251. <term><structfield>till</structfield></term>
  252. <listitem><para>
  253. <type>character varying(20)</type>
  254. </para>
  255. </listitem>
  256. </varlistentry>
  257. <varlistentry>
  258. <term><structfield>quonumber</structfield></term>
  259. <listitem><para>
  260. <type>text</type>
  261. </para>
  262. </listitem>
  263. </varlistentry>
  264. <varlistentry>
  265. <term><structfield>intnotes</structfield></term>
  266. <listitem><para>
  267. <type>text</type>
  268. </para>
  269. </listitem>
  270. </varlistentry>
  271. <varlistentry>
  272. <term><structfield>department_id</structfield></term>
  273. <listitem><para>
  274. <type>integer</type>
  275. </para>
  276. </listitem>
  277. </varlistentry>
  278. <varlistentry>
  279. <term><structfield>shipvia</structfield></term>
  280. <listitem><para>
  281. <type>text</type>
  282. </para>
  283. </listitem>
  284. </varlistentry>
  285. <varlistentry>
  286. <term><structfield>language_code</structfield></term>
  287. <listitem><para>
  288. <type>character varying(6)</type>
  289. </para>
  290. </listitem>
  291. </varlistentry>
  292. <varlistentry>
  293. <term><structfield>ponumber</structfield></term>
  294. <listitem><para>
  295. <type>text</type>
  296. </para>
  297. </listitem>
  298. </varlistentry>
  299. <varlistentry>
  300. <term><structfield>shippingpoint</structfield></term>
  301. <listitem><para>
  302. <type>text</type>
  303. </para>
  304. </listitem>
  305. </varlistentry>
  306. <varlistentry>
  307. <term><structfield>terms</structfield></term>
  308. <listitem><para>
  309. <type>smallint</type>
  310. </para>
  311. </listitem>
  312. </varlistentry>
  313. </variablelist>
  314. <variablelist>
  315. <title>Indexes on ap</title>
  316. <varlistentry>
  317. <term>ap_id_key</term>
  318. <listitem><para>id</para></listitem>
  319. </varlistentry>
  320. <varlistentry>
  321. <term>ap_invnumber_key</term>
  322. <listitem><para>invnumber</para></listitem>
  323. </varlistentry>
  324. <varlistentry>
  325. <term>ap_ordnumber_key</term>
  326. <listitem><para>ordnumber</para></listitem>
  327. </varlistentry>
  328. <varlistentry>
  329. <term>ap_quonumber_key</term>
  330. <listitem><para>quonumber</para></listitem>
  331. </varlistentry>
  332. <varlistentry>
  333. <term>ap_transdate_key</term>
  334. <listitem><para>transdate</para></listitem>
  335. </varlistentry>
  336. </variablelist>
  337. </para>
  338. </section>
  339. <section id="public.table.ar"
  340. xreflabel="public.ar">
  341. <title id="public.table.ar-title">
  342. Table:
  343. <structname>ar</structname>
  344. </title>
  345. <para>
  346. <variablelist>
  347. <title>
  348. Structure of <structname>ar</structname>
  349. </title>
  350. <varlistentry>
  351. <term><structfield>id</structfield></term>
  352. <listitem><para>
  353. <type>serial</type>
  354. <literal>PRIMARY KEY</literal>
  355. </para>
  356. </listitem>
  357. </varlistentry>
  358. <varlistentry>
  359. <term><structfield>invnumber</structfield></term>
  360. <listitem><para>
  361. <type>text</type>
  362. </para>
  363. </listitem>
  364. </varlistentry>
  365. <varlistentry>
  366. <term><structfield>transdate</structfield></term>
  367. <listitem><para>
  368. <type>date</type>
  369. <literal>DEFAULT (&apos;now&apos;::text)::date</literal>
  370. </para>
  371. </listitem>
  372. </varlistentry>
  373. <varlistentry>
  374. <term><structfield>entity_id</structfield></term>
  375. <listitem><para>
  376. <type>integer</type>
  377. <literal>REFERENCES</literal> <xref linkend="public.table.entity"/>
  378. </para>
  379. <para>
  380. Used to be customer_id, but customer is now metadata. You need to push to entity
  381. </para>
  382. </listitem>
  383. </varlistentry>
  384. <varlistentry>
  385. <term><structfield>taxincluded</structfield></term>
  386. <listitem><para>
  387. <type>boolean</type>
  388. </para>
  389. </listitem>
  390. </varlistentry>
  391. <varlistentry>
  392. <term><structfield>amount</structfield></term>
  393. <listitem><para>
  394. <type>numeric</type>
  395. </para>
  396. </listitem>
  397. </varlistentry>
  398. <varlistentry>
  399. <term><structfield>netamount</structfield></term>
  400. <listitem><para>
  401. <type>numeric</type>
  402. </para>
  403. </listitem>
  404. </varlistentry>
  405. <varlistentry>
  406. <term><structfield>paid</structfield></term>
  407. <listitem><para>
  408. <type>numeric</type>
  409. </para>
  410. </listitem>
  411. </varlistentry>
  412. <varlistentry>
  413. <term><structfield>datepaid</structfield></term>
  414. <listitem><para>
  415. <type>date</type>
  416. </para>
  417. </listitem>
  418. </varlistentry>
  419. <varlistentry>
  420. <term><structfield>duedate</structfield></term>
  421. <listitem><para>
  422. <type>date</type>
  423. </para>
  424. </listitem>
  425. </varlistentry>
  426. <varlistentry>
  427. <term><structfield>invoice</structfield></term>
  428. <listitem><para>
  429. <type>boolean</type>
  430. <literal>DEFAULT false</literal>
  431. </para>
  432. </listitem>
  433. </varlistentry>
  434. <varlistentry>
  435. <term><structfield>shippingpoint</structfield></term>
  436. <listitem><para>
  437. <type>text</type>
  438. </para>
  439. </listitem>
  440. </varlistentry>
  441. <varlistentry>
  442. <term><structfield>terms</structfield></term>
  443. <listitem><para>
  444. <type>smallint</type>
  445. </para>
  446. </listitem>
  447. </varlistentry>
  448. <varlistentry>
  449. <term><structfield>notes</structfield></term>
  450. <listitem><para>
  451. <type>text</type>
  452. </para>
  453. </listitem>
  454. </varlistentry>
  455. <varlistentry>
  456. <term><structfield>curr</structfield></term>
  457. <listitem><para>
  458. <type>character(3)</type>
  459. </para>
  460. </listitem>
  461. </varlistentry>
  462. <varlistentry>
  463. <term><structfield>ordnumber</structfield></term>
  464. <listitem><para>
  465. <type>text</type>
  466. </para>
  467. </listitem>
  468. </varlistentry>
  469. <varlistentry>
  470. <term><structfield>person_id</structfield></term>
  471. <listitem><para>
  472. <type>integer</type>
  473. <literal>NOT NULL</literal>
  474. <literal>REFERENCES</literal> <xref linkend="public.table.person"/>
  475. </para>
  476. </listitem>
  477. </varlistentry>
  478. <varlistentry>
  479. <term><structfield>till</structfield></term>
  480. <listitem><para>
  481. <type>character varying(20)</type>
  482. </para>
  483. </listitem>
  484. </varlistentry>
  485. <varlistentry>
  486. <term><structfield>quonumber</structfield></term>
  487. <listitem><para>
  488. <type>text</type>
  489. </para>
  490. </listitem>
  491. </varlistentry>
  492. <varlistentry>
  493. <term><structfield>intnotes</structfield></term>
  494. <listitem><para>
  495. <type>text</type>
  496. </para>
  497. </listitem>
  498. </varlistentry>
  499. <varlistentry>
  500. <term><structfield>department_id</structfield></term>
  501. <listitem><para>
  502. <type>integer</type>
  503. </para>
  504. </listitem>
  505. </varlistentry>
  506. <varlistentry>
  507. <term><structfield>shipvia</structfield></term>
  508. <listitem><para>
  509. <type>text</type>
  510. </para>
  511. </listitem>
  512. </varlistentry>
  513. <varlistentry>
  514. <term><structfield>language_code</structfield></term>
  515. <listitem><para>
  516. <type>character varying(6)</type>
  517. </para>
  518. </listitem>
  519. </varlistentry>
  520. <varlistentry>
  521. <term><structfield>ponumber</structfield></term>
  522. <listitem><para>
  523. <type>text</type>
  524. </para>
  525. </listitem>
  526. </varlistentry>
  527. </variablelist>
  528. <variablelist>
  529. <title>Indexes on ar</title>
  530. <varlistentry>
  531. <term>ar_id_key</term>
  532. <listitem><para>id</para></listitem>
  533. </varlistentry>
  534. <varlistentry>
  535. <term>ar_invnumber_key</term>
  536. <listitem><para>invnumber</para></listitem>
  537. </varlistentry>
  538. <varlistentry>
  539. <term>ar_ordnumber_key</term>
  540. <listitem><para>ordnumber</para></listitem>
  541. </varlistentry>
  542. <varlistentry>
  543. <term>ar_quonumber_key</term>
  544. <listitem><para>quonumber</para></listitem>
  545. </varlistentry>
  546. <varlistentry>
  547. <term>ar_transdate_key</term>
  548. <listitem><para>transdate</para></listitem>
  549. </varlistentry>
  550. </variablelist>
  551. </para>
  552. </section>
  553. <section id="public.table.assembly"
  554. xreflabel="public.assembly">
  555. <title id="public.table.assembly-title">
  556. Table:
  557. <structname>assembly</structname>
  558. </title>
  559. <para>
  560. <variablelist>
  561. <title>
  562. Structure of <structname>assembly</structname>
  563. </title>
  564. <varlistentry>
  565. <term><structfield>id</structfield></term>
  566. <listitem><para>
  567. <type>integer</type>
  568. <literal>PRIMARY KEY</literal>
  569. </para>
  570. </listitem>
  571. </varlistentry>
  572. <varlistentry>
  573. <term><structfield>parts_id</structfield></term>
  574. <listitem><para>
  575. <type>integer</type>
  576. <literal>PRIMARY KEY</literal>
  577. </para>
  578. </listitem>
  579. </varlistentry>
  580. <varlistentry>
  581. <term><structfield>qty</structfield></term>
  582. <listitem><para>
  583. <type>numeric</type>
  584. </para>
  585. </listitem>
  586. </varlistentry>
  587. <varlistentry>
  588. <term><structfield>bom</structfield></term>
  589. <listitem><para>
  590. <type>boolean</type>
  591. </para>
  592. </listitem>
  593. </varlistentry>
  594. <varlistentry>
  595. <term><structfield>adj</structfield></term>
  596. <listitem><para>
  597. <type>boolean</type>
  598. </para>
  599. </listitem>
  600. </varlistentry>
  601. </variablelist>
  602. <variablelist>
  603. <title>Indexes on assembly</title>
  604. <varlistentry>
  605. <term>assembly_id_key</term>
  606. <listitem><para>id</para></listitem>
  607. </varlistentry>
  608. </variablelist>
  609. </para>
  610. </section>
  611. <section id="public.table.audittrail"
  612. xreflabel="public.audittrail">
  613. <title id="public.table.audittrail-title">
  614. Table:
  615. <structname>audittrail</structname>
  616. </title>
  617. <para>
  618. <variablelist>
  619. <title>
  620. Structure of <structname>audittrail</structname>
  621. </title>
  622. <varlistentry>
  623. <term><structfield>trans_id</structfield></term>
  624. <listitem><para>
  625. <type>integer</type>
  626. </para>
  627. </listitem>
  628. </varlistentry>
  629. <varlistentry>
  630. <term><structfield>tablename</structfield></term>
  631. <listitem><para>
  632. <type>text</type>
  633. </para>
  634. </listitem>
  635. </varlistentry>
  636. <varlistentry>
  637. <term><structfield>reference</structfield></term>
  638. <listitem><para>
  639. <type>text</type>
  640. </para>
  641. </listitem>
  642. </varlistentry>
  643. <varlistentry>
  644. <term><structfield>formname</structfield></term>
  645. <listitem><para>
  646. <type>text</type>
  647. </para>
  648. </listitem>
  649. </varlistentry>
  650. <varlistentry>
  651. <term><structfield>action</structfield></term>
  652. <listitem><para>
  653. <type>text</type>
  654. </para>
  655. </listitem>
  656. </varlistentry>
  657. <varlistentry>
  658. <term><structfield>transdate</structfield></term>
  659. <listitem><para>
  660. <type>timestamp without time zone</type>
  661. <literal>DEFAULT now()</literal>
  662. </para>
  663. </listitem>
  664. </varlistentry>
  665. <varlistentry>
  666. <term><structfield>person_id</structfield></term>
  667. <listitem><para>
  668. <type>integer</type>
  669. <literal>NOT NULL</literal>
  670. <literal>REFERENCES</literal> <xref linkend="public.table.person"/>
  671. </para>
  672. </listitem>
  673. </varlistentry>
  674. <varlistentry>
  675. <term><structfield>entry_id</structfield></term>
  676. <listitem><para>
  677. <type>bigserial</type>
  678. <literal>PRIMARY KEY</literal>
  679. </para>
  680. </listitem>
  681. </varlistentry>
  682. </variablelist>
  683. <variablelist>
  684. <title>Indexes on audittrail</title>
  685. <varlistentry>
  686. <term>audittrail_trans_id_key</term>
  687. <listitem><para>trans_id</para></listitem>
  688. </varlistentry>
  689. </variablelist>
  690. </para>
  691. </section>
  692. <section id="public.table.business"
  693. xreflabel="public.business">
  694. <title id="public.table.business-title">
  695. Table:
  696. <structname>business</structname>
  697. </title>
  698. <para>
  699. <variablelist>
  700. <title>
  701. Structure of <structname>business</structname>
  702. </title>
  703. <varlistentry>
  704. <term><structfield>id</structfield></term>
  705. <listitem><para>
  706. <type>serial</type>
  707. <literal>PRIMARY KEY</literal>
  708. </para>
  709. </listitem>
  710. </varlistentry>
  711. <varlistentry>
  712. <term><structfield>description</structfield></term>
  713. <listitem><para>
  714. <type>text</type>
  715. </para>
  716. </listitem>
  717. </varlistentry>
  718. <varlistentry>
  719. <term><structfield>discount</structfield></term>
  720. <listitem><para>
  721. <type>numeric</type>
  722. </para>
  723. </listitem>
  724. </varlistentry>
  725. </variablelist>
  726. </para>
  727. </section>
  728. <section id="public.table.chart"
  729. xreflabel="public.chart">
  730. <title id="public.table.chart-title">
  731. Table:
  732. <structname>chart</structname>
  733. </title>
  734. <para>
  735. <variablelist>
  736. <title>
  737. Structure of <structname>chart</structname>
  738. </title>
  739. <varlistentry>
  740. <term><structfield>id</structfield></term>
  741. <listitem><para>
  742. <type>serial</type>
  743. <literal>PRIMARY KEY</literal>
  744. </para>
  745. </listitem>
  746. </varlistentry>
  747. <varlistentry>
  748. <term><structfield>accno</structfield></term>
  749. <listitem><para>
  750. <type>text</type>
  751. <literal>NOT NULL</literal>
  752. </para>
  753. </listitem>
  754. </varlistentry>
  755. <varlistentry>
  756. <term><structfield>description</structfield></term>
  757. <listitem><para>
  758. <type>text</type>
  759. </para>
  760. </listitem>
  761. </varlistentry>
  762. <varlistentry>
  763. <term><structfield>charttype</structfield></term>
  764. <listitem><para>
  765. <type>character(1)</type>
  766. <literal>DEFAULT &apos;A&apos;::bpchar</literal>
  767. </para>
  768. </listitem>
  769. </varlistentry>
  770. <varlistentry>
  771. <term><structfield>category</structfield></term>
  772. <listitem><para>
  773. <type>character(1)</type>
  774. </para>
  775. </listitem>
  776. </varlistentry>
  777. <varlistentry>
  778. <term><structfield>link</structfield></term>
  779. <listitem><para>
  780. <type>text</type>
  781. </para>
  782. </listitem>
  783. </varlistentry>
  784. <varlistentry>
  785. <term><structfield>gifi_accno</structfield></term>
  786. <listitem><para>
  787. <type>text</type>
  788. </para>
  789. </listitem>
  790. </varlistentry>
  791. <varlistentry>
  792. <term><structfield>contra</structfield></term>
  793. <listitem><para>
  794. <type>boolean</type>
  795. <literal>DEFAULT false</literal>
  796. </para>
  797. </listitem>
  798. </varlistentry>
  799. </variablelist>
  800. <variablelist>
  801. <title>Indexes on chart</title>
  802. <varlistentry>
  803. <term>chart_category_key</term>
  804. <listitem><para>category</para></listitem>
  805. </varlistentry>
  806. <varlistentry>
  807. <term>chart_gifi_accno_key</term>
  808. <listitem><para>gifi_accno</para></listitem>
  809. </varlistentry>
  810. <varlistentry>
  811. <term>chart_id_key</term>
  812. <listitem><para>id</para></listitem>
  813. </varlistentry>
  814. <varlistentry>
  815. <term>chart_link_key</term>
  816. <listitem><para>link</para></listitem>
  817. </varlistentry>
  818. </variablelist>
  819. <itemizedlist>
  820. <title>
  821. Tables referencing acc_trans via Foreign Key Constraints
  822. </title>
  823. <listitem>
  824. <para>
  825. <xref linkend="public.table.acc-trans"/>
  826. </para>
  827. </listitem>
  828. <listitem>
  829. <para>
  830. <xref linkend="public.table.partstax"/>
  831. </para>
  832. </listitem>
  833. <listitem>
  834. <para>
  835. <xref linkend="public.table.tax"/>
  836. </para>
  837. </listitem>
  838. </itemizedlist>
  839. </para>
  840. </section>
  841. <section id="public.table.company"
  842. xreflabel="public.company">
  843. <title id="public.table.company-title">
  844. Table:
  845. <structname>company</structname>
  846. </title>
  847. <para>
  848. <variablelist>
  849. <title>
  850. Structure of <structname>company</structname>
  851. </title>
  852. <varlistentry>
  853. <term><structfield>id</structfield></term>
  854. <listitem><para>
  855. <type>serial</type>
  856. <literal>UNIQUE</literal>
  857. <literal>NOT NULL</literal>
  858. </para>
  859. </listitem>
  860. </varlistentry>
  861. <varlistentry>
  862. <term><structfield>entity_id</structfield></term>
  863. <listitem><para>
  864. <type>integer</type>
  865. <literal>NOT NULL</literal>
  866. <literal>REFERENCES</literal> <xref linkend="public.table.entity"/>
  867. </para>
  868. </listitem>
  869. </varlistentry>
  870. <varlistentry>
  871. <term><structfield>legal_name</structfield></term>
  872. <listitem><para>
  873. <type>text</type>
  874. <literal>PRIMARY KEY</literal>
  875. </para>
  876. </listitem>
  877. </varlistentry>
  878. <varlistentry>
  879. <term><structfield>entity_class_id</structfield></term>
  880. <listitem><para>
  881. <type>integer</type>
  882. <literal>NOT NULL</literal>
  883. <literal>REFERENCES</literal> <xref linkend="public.table.entity-class"/>
  884. </para>
  885. </listitem>
  886. </varlistentry>
  887. <varlistentry>
  888. <term><structfield>primary_location_id</structfield></term>
  889. <listitem><para>
  890. <type>integer</type>
  891. <literal>PRIMARY KEY</literal>
  892. <literal>REFERENCES</literal> <xref linkend="public.table.location"/>
  893. </para>
  894. <para>
  895. This is the location that should show up by default for any forms
  896. </para>
  897. </listitem>
  898. </varlistentry>
  899. <varlistentry>
  900. <term><structfield>tax_id</structfield></term>
  901. <listitem><para>
  902. <type>text</type>
  903. </para>
  904. <para>
  905. In the US this would be a EIN.
  906. </para>
  907. </listitem>
  908. </varlistentry>
  909. </variablelist>
  910. <variablelist>
  911. <title>Constraints on company</title>
  912. <varlistentry>
  913. <term>company_legal_name_check</term>
  914. <listitem><para>CHECK ((legal_name ~ &apos;[[:alnum:]_]&apos;::text))</para></listitem>
  915. </varlistentry>
  916. </variablelist>
  917. <itemizedlist>
  918. <title>
  919. Tables referencing company_to_contact via Foreign Key Constraints
  920. </title>
  921. <listitem>
  922. <para>
  923. <xref linkend="public.table.company-to-contact"/>
  924. </para>
  925. </listitem>
  926. <listitem>
  927. <para>
  928. <xref linkend="public.table.company-to-entity"/>
  929. </para>
  930. </listitem>
  931. <listitem>
  932. <para>
  933. <xref linkend="public.table.company-to-location"/>
  934. </para>
  935. </listitem>
  936. </itemizedlist>
  937. </para>
  938. </section>
  939. <section id="public.table.company-to-contact"
  940. xreflabel="public.company_to_contact">
  941. <title id="public.table.company-to-contact-title">
  942. Table:
  943. <structname>company_to_contact</structname>
  944. </title>
  945. <para>
  946. To keep track of the relationship between multiple contact methods and a single company
  947. </para>
  948. <para>
  949. <variablelist>
  950. <title>
  951. Structure of <structname>company_to_contact</structname>
  952. </title>
  953. <varlistentry>
  954. <term><structfield>company_id</structfield></term>
  955. <listitem><para>
  956. <type>integer</type>
  957. <literal>PRIMARY KEY</literal>
  958. <literal>REFERENCES</literal> <xref linkend="public.table.company"/>
  959. </para>
  960. </listitem>
  961. </varlistentry>
  962. <varlistentry>
  963. <term><structfield>contact_class_id</structfield></term>
  964. <listitem><para>
  965. <type>integer</type>
  966. <literal>PRIMARY KEY</literal>
  967. <literal>REFERENCES</literal> <xref linkend="public.table.contact-class"/>
  968. </para>
  969. </listitem>
  970. </varlistentry>
  971. <varlistentry>
  972. <term><structfield>contact</structfield></term>
  973. <listitem><para>
  974. <type>text</type>
  975. <literal>PRIMARY KEY</literal>
  976. </para>
  977. </listitem>
  978. </varlistentry>
  979. </variablelist>
  980. <variablelist>
  981. <title>Constraints on company_to_contact</title>
  982. <varlistentry>
  983. <term>company_to_contact_contact_check</term>
  984. <listitem><para>CHECK ((contact ~ &apos;[[:alnum:]_]&apos;::text))</para></listitem>
  985. </varlistentry>
  986. </variablelist>
  987. </para>
  988. </section>
  989. <section id="public.table.company-to-entity"
  990. xreflabel="public.company_to_entity">
  991. <title id="public.table.company-to-entity-title">
  992. Table:
  993. <structname>company_to_entity</structname>
  994. </title>
  995. <para>
  996. <variablelist>
  997. <title>
  998. Structure of <structname>company_to_entity</structname>
  999. </title>
  1000. <varlistentry>
  1001. <term><structfield>company_id</structfield></term>
  1002. <listitem><para>
  1003. <type>integer</type>
  1004. <literal>PRIMARY KEY</literal>
  1005. <literal>REFERENCES</literal> <xref linkend="public.table.company"/>
  1006. </para>
  1007. </listitem>
  1008. </varlistentry>
  1009. <varlistentry>
  1010. <term><structfield>entity_id</structfield></term>
  1011. <listitem><para>
  1012. <type>integer</type>
  1013. <literal>PRIMARY KEY</literal>
  1014. <literal>REFERENCES</literal> <xref linkend="public.table.entity"/>
  1015. </para>
  1016. </listitem>
  1017. </varlistentry>
  1018. <varlistentry>
  1019. <term><structfield>related_how</structfield></term>
  1020. <listitem><para>
  1021. <type>text</type>
  1022. </para>
  1023. </listitem>
  1024. </varlistentry>
  1025. <varlistentry>
  1026. <term><structfield>created</structfield></term>
  1027. <listitem><para>
  1028. <type>date</type>
  1029. <literal>NOT NULL</literal>
  1030. <literal>DEFAULT (&apos;now&apos;::text)::date</literal>
  1031. </para>
  1032. </listitem>
  1033. </varlistentry>
  1034. </variablelist>
  1035. <variablelist>
  1036. <title>Constraints on company_to_entity</title>
  1037. <varlistentry>
  1038. <term>company_to_entity_check</term>
  1039. <listitem><para>CHECK ((entity_id &lt;&gt; company_id))</para></listitem>
  1040. </varlistentry>
  1041. </variablelist>
  1042. </para>
  1043. </section>
  1044. <section id="public.table.company-to-location"
  1045. xreflabel="public.company_to_location">
  1046. <title id="public.table.company-to-location-title">
  1047. Table:
  1048. <structname>company_to_location</structname>
  1049. </title>
  1050. <para>
  1051. <variablelist>
  1052. <title>
  1053. Structure of <structname>company_to_location</structname>
  1054. </title>
  1055. <varlistentry>
  1056. <term><structfield>location_id</structfield></term>
  1057. <listitem><para>
  1058. <type>integer</type>
  1059. <literal>PRIMARY KEY</literal>
  1060. <literal>REFERENCES</literal> <xref linkend="public.table.location"/>
  1061. </para>
  1062. </listitem>
  1063. </varlistentry>
  1064. <varlistentry>
  1065. <term><structfield>company_id</structfield></term>
  1066. <listitem><para>
  1067. <type>integer</type>
  1068. <literal>PRIMARY KEY</literal>
  1069. <literal>REFERENCES</literal> <xref linkend="public.table.company"/>
  1070. </para>
  1071. </listitem>
  1072. </varlistentry>
  1073. </variablelist>
  1074. </para>
  1075. </section>
  1076. <section id="public.table.contact-class"
  1077. xreflabel="public.contact_class">
  1078. <title id="public.table.contact-class-title">
  1079. Table:
  1080. <structname>contact_class</structname>
  1081. </title>
  1082. <para>
  1083. <variablelist>
  1084. <title>
  1085. Structure of <structname>contact_class</structname>
  1086. </title>
  1087. <varlistentry>
  1088. <term><structfield>id</structfield></term>
  1089. <listitem><para>
  1090. <type>serial</type>
  1091. <literal>UNIQUE</literal>
  1092. <literal>NOT NULL</literal>
  1093. </para>
  1094. </listitem>
  1095. </varlistentry>
  1096. <varlistentry>
  1097. <term><structfield>class</structfield></term>
  1098. <listitem><para>
  1099. <type>text</type>
  1100. <literal>PRIMARY KEY</literal>
  1101. </para>
  1102. </listitem>
  1103. </varlistentry>
  1104. </variablelist>
  1105. <variablelist>
  1106. <title>Constraints on contact_class</title>
  1107. <varlistentry>
  1108. <term>contact_class_class_check</term>
  1109. <listitem><para>CHECK ((&quot;class&quot; ~ &apos;[[:alnum:]_]&apos;::text))</para></listitem>
  1110. </varlistentry>
  1111. </variablelist>
  1112. <itemizedlist>
  1113. <title>
  1114. Tables referencing company_to_contact via Foreign Key Constraints
  1115. </title>
  1116. <listitem>
  1117. <para>
  1118. <xref linkend="public.table.company-to-contact"/>
  1119. </para>
  1120. </listitem>
  1121. <listitem>
  1122. <para>
  1123. <xref linkend="public.table.person-to-contact"/>
  1124. </para>
  1125. </listitem>
  1126. </itemizedlist>
  1127. </para>
  1128. </section>
  1129. <section id="public.table.country"
  1130. xreflabel="public.country">
  1131. <title id="public.table.country-title">
  1132. Table:
  1133. <structname>country</structname>
  1134. </title>
  1135. <para>
  1136. <variablelist>
  1137. <title>
  1138. Structure of <structname>country</structname>
  1139. </title>
  1140. <varlistentry>
  1141. <term><structfield>id</structfield></term>
  1142. <listitem><para>
  1143. <type>serial</type>
  1144. <literal>PRIMARY KEY</literal>
  1145. </para>
  1146. </listitem>
  1147. </varlistentry>
  1148. <varlistentry>
  1149. <term><structfield>name</structfield></term>
  1150. <listitem><para>
  1151. <type>text</type>
  1152. <literal>NOT NULL</literal>
  1153. </para>
  1154. </listitem>
  1155. </varlistentry>
  1156. <varlistentry>
  1157. <term><structfield>short_name</structfield></term>
  1158. <listitem><para>
  1159. <type>text</type>
  1160. <literal>NOT NULL</literal>
  1161. </para>
  1162. </listitem>
  1163. </varlistentry>
  1164. <varlistentry>
  1165. <term><structfield>itu</structfield></term>
  1166. <listitem><para>
  1167. <type>text</type>
  1168. </para>
  1169. <para>
  1170. The ITU Telecommunication Standardization Sector code for calling internationally. For example, the US is 1, Great Britain is 44
  1171. </para>
  1172. </listitem>
  1173. </varlistentry>
  1174. </variablelist>
  1175. <variablelist>
  1176. <title>Constraints on country</title>
  1177. <varlistentry>
  1178. <term>country_name_check</term>
  1179. <listitem><para>CHECK ((name ~ &apos;[[:alnum:]_]&apos;::text))</para></listitem>
  1180. </varlistentry>
  1181. <varlistentry>
  1182. <term>country_short_name_check</term>
  1183. <listitem><para>CHECK ((short_name ~ &apos;[[:alnum:]_]&apos;::text))</para></listitem>
  1184. </varlistentry>
  1185. </variablelist>
  1186. <itemizedlist>
  1187. <title>
  1188. Tables referencing location via Foreign Key Constraints
  1189. </title>
  1190. <listitem>
  1191. <para>
  1192. <xref linkend="public.table.location"/>
  1193. </para>
  1194. </listitem>
  1195. </itemizedlist>
  1196. </para>
  1197. </section>
  1198. <section id="public.table.custom-field-catalog"
  1199. xreflabel="public.custom_field_catalog">
  1200. <title id="public.table.custom-field-catalog-title">
  1201. Table:
  1202. <structname>custom_field_catalog</structname>
  1203. </title>
  1204. <para>
  1205. <variablelist>
  1206. <title>
  1207. Structure of <structname>custom_field_catalog</structname>
  1208. </title>
  1209. <varlistentry>
  1210. <term><structfield>field_id</structfield></term>
  1211. <listitem><para>
  1212. <type>serial</type>
  1213. <literal>PRIMARY KEY</literal>
  1214. </para>
  1215. </listitem>
  1216. </varlistentry>
  1217. <varlistentry>
  1218. <term><structfield>table_id</structfield></term>
  1219. <listitem><para>
  1220. <type>integer</type>
  1221. <literal>REFERENCES</literal> <xref linkend="public.table.custom-table-catalog"/>
  1222. </para>
  1223. </listitem>
  1224. </varlistentry>
  1225. <varlistentry>
  1226. <term><structfield>field_name</structfield></term>
  1227. <listitem><para>
  1228. <type>text</type>
  1229. </para>
  1230. </listitem>
  1231. </varlistentry>
  1232. </variablelist>
  1233. </para>
  1234. </section>
  1235. <section id="public.table.custom-table-catalog"
  1236. xreflabel="public.custom_table_catalog">
  1237. <title id="public.table.custom-table-catalog-title">
  1238. Table:
  1239. <structname>custom_table_catalog</structname>
  1240. </title>
  1241. <para>
  1242. <variablelist>
  1243. <title>
  1244. Structure of <structname>custom_table_catalog</structname>
  1245. </title>
  1246. <varlistentry>
  1247. <term><structfield>table_id</structfield></term>
  1248. <listitem><para>
  1249. <type>serial</type>
  1250. <literal>PRIMARY KEY</literal>
  1251. </para>
  1252. </listitem>
  1253. </varlistentry>
  1254. <varlistentry>
  1255. <term><structfield>extends</structfield></term>
  1256. <listitem><para>
  1257. <type>text</type>
  1258. </para>
  1259. </listitem>
  1260. </varlistentry>
  1261. <varlistentry>
  1262. <term><structfield>table_name</structfield></term>
  1263. <listitem><para>
  1264. <type>text</type>
  1265. </para>
  1266. </listitem>
  1267. </varlistentry>
  1268. </variablelist>
  1269. <itemizedlist>
  1270. <title>
  1271. Tables referencing custom_field_catalog via Foreign Key Constraints
  1272. </title>
  1273. <listitem>
  1274. <para>
  1275. <xref linkend="public.table.custom-field-catalog"/>
  1276. </para>
  1277. </listitem>
  1278. </itemizedlist>
  1279. </para>
  1280. </section>
  1281. <section id="public.table.customer"
  1282. xreflabel="public.customer">
  1283. <title id="public.table.customer-title">
  1284. Table:
  1285. <structname>customer</structname>
  1286. </title>
  1287. <para>
  1288. This is now a metadata table that holds information specific to customers. Source info is not part of the entity management
  1289. </para>
  1290. <para>
  1291. <variablelist>
  1292. <title>
  1293. Structure of <structname>customer</structname>
  1294. </title>
  1295. <varlistentry>
  1296. <term><structfield>id</structfield></term>
  1297. <listitem><para>
  1298. <type>serial</type>
  1299. <literal>PRIMARY KEY</literal>
  1300. </para>
  1301. </listitem>
  1302. </varlistentry>
  1303. <varlistentry>
  1304. <term><structfield>entity_id</structfield></term>
  1305. <listitem><para>
  1306. <type>integer</type>
  1307. <literal>REFERENCES</literal> <xref linkend="public.table.entity"/>
  1308. </para>
  1309. <para>
  1310. This is the relationship between entities and customers
  1311. </para>
  1312. </listitem>
  1313. </varlistentry>
  1314. <varlistentry>
  1315. <term><structfield>discount</structfield></term>
  1316. <listitem><para>
  1317. <type>numeric</type>
  1318. </para>
  1319. </listitem>
  1320. </varlistentry>
  1321. <varlistentry>
  1322. <term><structfield>taxincluded</structfield></term>
  1323. <listitem><para>
  1324. <type>boolean</type>
  1325. <literal>DEFAULT false</literal>
  1326. </para>
  1327. </listitem>
  1328. </varlistentry>
  1329. <varlistentry>
  1330. <term><structfield>creditlimit</structfield></term>
  1331. <listitem><para>
  1332. <type>numeric</type>
  1333. </para>
  1334. </listitem>
  1335. </varlistentry>
  1336. <varlistentry>
  1337. <term><structfield>terms</structfield></term>
  1338. <listitem><para>
  1339. <type>smallint</type>
  1340. </para>
  1341. </listitem>
  1342. </varlistentry>
  1343. <varlistentry>
  1344. <term><structfield>customernumber</structfield></term>
  1345. <listitem><para>
  1346. <type>character varying(32)</type>
  1347. </para>
  1348. </listitem>
  1349. </varlistentry>
  1350. <varlistentry>
  1351. <term><structfield>cc</structfield></term>
  1352. <listitem><para>
  1353. <type>text</type>
  1354. </para>
  1355. </listitem>
  1356. </varlistentry>
  1357. <varlistentry>
  1358. <term><structfield>bcc</structfield></term>
  1359. <listitem><para>
  1360. <type>text</type>
  1361. </para>
  1362. </listitem>
  1363. </varlistentry>
  1364. <varlistentry>
  1365. <term><structfield>business_id</structfield></term>
  1366. <listitem><para>
  1367. <type>integer</type>
  1368. </para>
  1369. </listitem>
  1370. </varlistentry>
  1371. <varlistentry>
  1372. <term><structfield>sic_code</structfield></term>
  1373. <listitem><para>
  1374. <type>character varying(6)</type>
  1375. </para>
  1376. </listitem>
  1377. </varlistentry>
  1378. <varlistentry>
  1379. <term><structfield>iban</structfield></term>
  1380. <listitem><para>
  1381. <type>character varying(34)</type>
  1382. </para>
  1383. </listitem>
  1384. </varlistentry>
  1385. <varlistentry>
  1386. <term><structfield>bic</structfield></term>
  1387. <listitem><para>
  1388. <type>character varying(11)</type>
  1389. </para>
  1390. </listitem>
  1391. </varlistentry>
  1392. <varlistentry>
  1393. <term><structfield>language_code</structfield></term>
  1394. <listitem><para>
  1395. <type>character varying(6)</type>
  1396. </para>
  1397. </listitem>
  1398. </varlistentry>
  1399. <varlistentry>
  1400. <term><structfield>pricegroup_id</structfield></term>
  1401. <listitem><para>
  1402. <type>integer</type>
  1403. </para>
  1404. </listitem>
  1405. </varlistentry>
  1406. <varlistentry>
  1407. <term><structfield>curr</structfield></term>
  1408. <listitem><para>
  1409. <type>character(3)</type>
  1410. </para>
  1411. </listitem>
  1412. </varlistentry>
  1413. <varlistentry>
  1414. <term><structfield>startdate</structfield></term>
  1415. <listitem><para>
  1416. <type>date</type>
  1417. <literal>DEFAULT (&apos;now&apos;::text)::date</literal>
  1418. </para>
  1419. </listitem>
  1420. </varlistentry>
  1421. <varlistentry>
  1422. <term><structfield>enddate</structfield></term>
  1423. <listitem><para>
  1424. <type>date</type>
  1425. </para>
  1426. </listitem>
  1427. </varlistentry>
  1428. <varlistentry>
  1429. <term><structfield>invoice_notes</structfield></term>
  1430. <listitem><para>
  1431. <type>text</type>
  1432. </para>
  1433. </listitem>
  1434. </varlistentry>
  1435. </variablelist>
  1436. <variablelist>
  1437. <title>Indexes on customer</title>
  1438. <varlistentry>
  1439. <term>customer_customernumber_key</term>
  1440. <listitem><para>customernumber</para></listitem>
  1441. </varlistentry>
  1442. <varlistentry>
  1443. <term>customer_id_key</term>
  1444. <listitem><para>id</para></listitem>
  1445. </varlistentry>
  1446. </variablelist>
  1447. </para>
  1448. </section>
  1449. <section id="public.table.customertax"
  1450. xreflabel="public.customertax">
  1451. <title id="public.table.customertax-title">
  1452. Table:
  1453. <structname>customertax</structname>
  1454. </title>
  1455. <para>
  1456. <variablelist>
  1457. <title>
  1458. Structure of <structname>customertax</structname>
  1459. </title>
  1460. <varlistentry>
  1461. <term><structfield>customer_id</structfield></term>
  1462. <listitem><para>
  1463. <type>integer</type>
  1464. <literal>PRIMARY KEY</literal>
  1465. </para>
  1466. </listitem>
  1467. </varlistentry>
  1468. <varlistentry>
  1469. <term><structfield>chart_id</structfield></term>
  1470. <listitem><para>
  1471. <type>integer</type>
  1472. <literal>PRIMARY KEY</literal>
  1473. </para>
  1474. </listitem>
  1475. </varlistentry>
  1476. </variablelist>
  1477. <variablelist>
  1478. <title>Indexes on customertax</title>
  1479. <varlistentry>
  1480. <term>customer_customer_id_key</term>
  1481. <listitem><para>customer_id</para></listitem>
  1482. </varlistentry>
  1483. </variablelist>
  1484. </para>
  1485. </section>
  1486. <section id="public.table.defaults"
  1487. xreflabel="public.defaults">
  1488. <title id="public.table.defaults-title">
  1489. Table:
  1490. <structname>defaults</structname>
  1491. </title>
  1492. <para>
  1493. <variablelist>
  1494. <title>
  1495. Structure of <structname>defaults</structname>
  1496. </title>
  1497. <varlistentry>
  1498. <term><structfield>setting_key</structfield></term>
  1499. <listitem><para>
  1500. <type>text</type>
  1501. <literal>PRIMARY KEY</literal>
  1502. </para>
  1503. </listitem>
  1504. </varlistentry>
  1505. <varlistentry>
  1506. <term><structfield>value</structfield></term>
  1507. <listitem><para>
  1508. <type>text</type>
  1509. </para>
  1510. </listitem>
  1511. </varlistentry>
  1512. </variablelist>
  1513. </para>
  1514. </section>
  1515. <section id="public.table.department"
  1516. xreflabel="public.department">
  1517. <title id="public.table.department-title">
  1518. Table:
  1519. <structname>department</structname>
  1520. </title>
  1521. <para>
  1522. <variablelist>
  1523. <title>
  1524. Structure of <structname>department</structname>
  1525. </title>
  1526. <varlistentry>
  1527. <term><structfield>id</structfield></term>
  1528. <listitem><para>
  1529. <type>serial</type>
  1530. <literal>PRIMARY KEY</literal>
  1531. </para>
  1532. </listitem>
  1533. </varlistentry>
  1534. <varlistentry>
  1535. <term><structfield>description</structfield></term>
  1536. <listitem><para>
  1537. <type>text</type>
  1538. </para>
  1539. </listitem>
  1540. </varlistentry>
  1541. <varlistentry>
  1542. <term><structfield>role</structfield></term>
  1543. <listitem><para>
  1544. <type>character(1)</type>
  1545. <literal>DEFAULT &apos;P&apos;::bpchar</literal>
  1546. </para>
  1547. </listitem>
  1548. </varlistentry>
  1549. </variablelist>
  1550. <variablelist>
  1551. <title>Indexes on department</title>
  1552. <varlistentry>
  1553. <term>department_id_key</term>
  1554. <listitem><para>id</para></listitem>
  1555. </varlistentry>
  1556. </variablelist>
  1557. </para>
  1558. </section>
  1559. <section id="public.table.dpt-trans"
  1560. xreflabel="public.dpt_trans">
  1561. <title id="public.table.dpt-trans-title">
  1562. Table:
  1563. <structname>dpt_trans</structname>
  1564. </title>
  1565. <para>
  1566. <variablelist>
  1567. <title>
  1568. Structure of <structname>dpt_trans</structname>
  1569. </title>
  1570. <varlistentry>
  1571. <term><structfield>trans_id</structfield></term>
  1572. <listitem><para>
  1573. <type>integer</type>
  1574. <literal>PRIMARY KEY</literal>
  1575. </para>
  1576. </listitem>
  1577. </varlistentry>
  1578. <varlistentry>
  1579. <term><structfield>department_id</structfield></term>
  1580. <listitem><para>
  1581. <type>integer</type>
  1582. </para>
  1583. </listitem>
  1584. </varlistentry>
  1585. </variablelist>
  1586. </para>
  1587. </section>
  1588. <section id="public.table.employee"
  1589. xreflabel="public.employee">
  1590. <title id="public.table.employee-title">
  1591. Table:
  1592. <structname>employee</structname>
  1593. </title>
  1594. <para>
  1595. Is a metadata table specific to employees
  1596. </para>
  1597. <para>
  1598. <variablelist>
  1599. <title>
  1600. Structure of <structname>employee</structname>
  1601. </title>
  1602. <varlistentry>
  1603. <term><structfield>id</structfield></term>
  1604. <listitem><para>
  1605. <type>serial</type>
  1606. <literal>PRIMARY KEY</literal>
  1607. </para>
  1608. </listitem>
  1609. </varlistentry>
  1610. <varlistentry>
  1611. <term><structfield>entity_id</structfield></term>
  1612. <listitem><para>
  1613. <type>integer</type>
  1614. <literal>NOT NULL</literal>
  1615. <literal>REFERENCES</literal> <xref linkend="public.table.entity"/>
  1616. </para>
  1617. </listitem>
  1618. </varlistentry>
  1619. <varlistentry>
  1620. <term><structfield>login</structfield></term>
  1621. <listitem><para>
  1622. <type>text</type>
  1623. </para>
  1624. </listitem>
  1625. </varlistentry>
  1626. <varlistentry>
  1627. <term><structfield>startdate</structfield></term>
  1628. <listitem><para>
  1629. <type>date</type>
  1630. <literal>DEFAULT (&apos;now&apos;::text)::date</literal>
  1631. </para>
  1632. </listitem>
  1633. </varlistentry>
  1634. <varlistentry>
  1635. <term><structfield>enddate</structfield></term>
  1636. <listitem><para>
  1637. <type>date</type>
  1638. </para>
  1639. </listitem>
  1640. </varlistentry>
  1641. <varlistentry>
  1642. <term><structfield>notes</structfield></term>
  1643. <listitem><para>
  1644. <type>text</type>
  1645. </para>
  1646. </listitem>
  1647. </varlistentry>
  1648. <varlistentry>
  1649. <term><structfield>role</structfield></term>
  1650. <listitem><para>
  1651. <type>character varying(20)</type>
  1652. </para>
  1653. </listitem>
  1654. </varlistentry>
  1655. <varlistentry>
  1656. <term><structfield>sales</structfield></term>
  1657. <listitem><para>
  1658. <type>boolean</type>
  1659. <literal>DEFAULT false</literal>
  1660. </para>
  1661. </listitem>
  1662. </varlistentry>
  1663. <varlistentry>
  1664. <term><structfield>ssn</structfield></term>
  1665. <listitem><para>
  1666. <type>character varying(20)</type>
  1667. </para>
  1668. </listitem>
  1669. </varlistentry>
  1670. <varlistentry>
  1671. <term><structfield>iban</structfield></term>
  1672. <listitem><para>
  1673. <type>character varying(34)</type>
  1674. </para>
  1675. </listitem>
  1676. </varlistentry>
  1677. <varlistentry>
  1678. <term><structfield>bic</structfield></term>
  1679. <listitem><para>
  1680. <type>character varying(11)</type>
  1681. </para>
  1682. </listitem>
  1683. </varlistentry>
  1684. <varlistentry>
  1685. <term><structfield>managerid</structfield></term>
  1686. <listitem><para>
  1687. <type>integer</type>
  1688. </para>
  1689. </listitem>
  1690. </varlistentry>
  1691. <varlistentry>
  1692. <term><structfield>employeenumber</structfield></term>
  1693. <listitem><para>
  1694. <type>character varying(32)</type>
  1695. </para>
  1696. </listitem>
  1697. </varlistentry>
  1698. <varlistentry>
  1699. <term><structfield>dob</structfield></term>
  1700. <listitem><para>
  1701. <type>date</type>
  1702. </para>
  1703. </listitem>
  1704. </varlistentry>
  1705. </variablelist>
  1706. </para>
  1707. </section>
  1708. <section id="public.table.entity"
  1709. xreflabel="public.entity">
  1710. <title id="public.table.entity-title">
  1711. Table:
  1712. <structname>entity</structname>
  1713. </title>
  1714. <para>
  1715. The primary entity table to map to all contacts
  1716. </para>
  1717. <para>
  1718. <variablelist>
  1719. <title>
  1720. Structure of <structname>entity</structname>
  1721. </title>
  1722. <varlistentry>
  1723. <term><structfield>id</structfield></term>
  1724. <listitem><para>
  1725. <type>serial</type>
  1726. <literal>PRIMARY KEY</literal>
  1727. </para>
  1728. </listitem>
  1729. </varlistentry>
  1730. <varlistentry>
  1731. <term><structfield>name</structfield></term>
  1732. <listitem><para>
  1733. <type>text</type>
  1734. </para>
  1735. <para>
  1736. 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
  1737. </para>
  1738. </listitem>
  1739. </varlistentry>
  1740. <varlistentry>
  1741. <term><structfield>entity_class</structfield></term>
  1742. <listitem><para>
  1743. <type>integer</type>
  1744. <literal>NOT NULL</literal>
  1745. <literal>REFERENCES</literal> <xref linkend="public.table.entity-class"/>
  1746. </para>
  1747. </listitem>
  1748. </varlistentry>
  1749. </variablelist>
  1750. <variablelist>
  1751. <title>Constraints on entity</title>
  1752. <varlistentry>
  1753. <term>entity_name_check</term>
  1754. <listitem><para>CHECK ((name ~ &apos;[[:alnum:]_]&apos;::text))</para></listitem>
  1755. </varlistentry>
  1756. </variablelist>
  1757. <itemizedlist>
  1758. <title>
  1759. Tables referencing ap via Foreign Key Constraints
  1760. </title>
  1761. <listitem>
  1762. <para>
  1763. <xref linkend="public.table.ap"/>
  1764. </para>
  1765. </listitem>
  1766. <listitem>
  1767. <para>
  1768. <xref linkend="public.table.ar"/>
  1769. </para>
  1770. </listitem>
  1771. <listitem>
  1772. <para>
  1773. <xref linkend="public.table.company"/>
  1774. </para>
  1775. </listitem>
  1776. <listitem>
  1777. <para>
  1778. <xref linkend="public.table.company-to-entity"/>
  1779. </para>
  1780. </listitem>
  1781. <listitem>
  1782. <para>
  1783. <xref linkend="public.table.customer"/>
  1784. </para>
  1785. </listitem>
  1786. <listitem>
  1787. <para>
  1788. <xref linkend="public.table.employee"/>
  1789. </para>
  1790. </listitem>
  1791. <listitem>
  1792. <para>
  1793. <xref linkend="public.table.entity-class-to-entity"/>
  1794. </para>
  1795. </listitem>
  1796. <listitem>
  1797. <para>
  1798. <xref linkend="public.table.entity-other-name"/>
  1799. </para>
  1800. </listitem>
  1801. <listitem>
  1802. <para>
  1803. <xref linkend="public.table.oe"/>
  1804. </para>
  1805. </listitem>
  1806. <listitem>
  1807. <para>
  1808. <xref linkend="public.table.partsvendor"/>
  1809. </para>
  1810. </listitem>
  1811. <listitem>
  1812. <para>
  1813. <xref linkend="public.table.person"/>
  1814. </para>
  1815. </listitem>
  1816. <listitem>
  1817. <para>
  1818. <xref linkend="public.table.person-to-entity"/>
  1819. </para>
  1820. </listitem>
  1821. <listitem>
  1822. <para>
  1823. <xref linkend="public.table.vendor"/>
  1824. </para>
  1825. </listitem>
  1826. </itemizedlist>
  1827. </para>
  1828. </section>
  1829. <section id="public.table.entity-class"
  1830. xreflabel="public.entity_class">
  1831. <title id="public.table.entity-class-title">
  1832. Table:
  1833. <structname>entity_class</structname>
  1834. </title>
  1835. <para>
  1836. Defines the class type such as vendor, customer, contact, employee
  1837. </para>
  1838. <para>
  1839. <variablelist>
  1840. <title>
  1841. Structure of <structname>entity_class</structname>
  1842. </title>
  1843. <varlistentry>
  1844. <term><structfield>id</structfield></term>
  1845. <listitem><para>
  1846. <type>serial</type>
  1847. <literal>PRIMARY KEY</literal>
  1848. </para>
  1849. <para>
  1850. The first 7 values are reserved and permanent
  1851. </para>
  1852. </listitem>
  1853. </varlistentry>
  1854. <varlistentry>
  1855. <term><structfield>class</structfield></term>
  1856. <listitem><para>
  1857. <type>text</type>
  1858. <literal>NOT NULL</literal>
  1859. </para>
  1860. </listitem>
  1861. </varlistentry>
  1862. <varlistentry>
  1863. <term><structfield>active</structfield></term>
  1864. <listitem><para>
  1865. <type>boolean</type>
  1866. <literal>NOT NULL</literal>
  1867. <literal>DEFAULT true</literal>
  1868. </para>
  1869. </listitem>
  1870. </varlistentry>
  1871. </variablelist>
  1872. <variablelist>
  1873. <title>Constraints on entity_class</title>
  1874. <varlistentry>
  1875. <term>entity_class_class_check</term>
  1876. <listitem><para>CHECK ((&quot;class&quot; ~ &apos;[[:alnum:]_]&apos;::text))</para></listitem>
  1877. </varlistentry>
  1878. </variablelist>
  1879. <itemizedlist>
  1880. <title>
  1881. Tables referencing company via Foreign Key Constraints
  1882. </title>
  1883. <listitem>
  1884. <para>
  1885. <xref linkend="public.table.company"/>
  1886. </para>
  1887. </listitem>
  1888. <listitem>
  1889. <para>
  1890. <xref linkend="public.table.entity"/>
  1891. </para>
  1892. </listitem>
  1893. <listitem>
  1894. <para>
  1895. <xref linkend="public.table.entity-class-to-entity"/>
  1896. </para>
  1897. </listitem>
  1898. </itemizedlist>
  1899. </para>
  1900. </section>
  1901. <section id="public.table.entity-class-to-entity"
  1902. xreflabel="public.entity_class_to_entity">
  1903. <title id="public.table.entity-class-to-entity-title">
  1904. Table:
  1905. <structname>entity_class_to_entity</structname>
  1906. </title>
  1907. <para>
  1908. Relation builder for classes to entity
  1909. </para>
  1910. <para>
  1911. <variablelist>
  1912. <title>
  1913. Structure of <structname>entity_class_to_entity</structname>
  1914. </title>
  1915. <varlistentry>
  1916. <term><structfield>entity_class_id</structfield></term>
  1917. <listitem><para>
  1918. <type>integer</type>
  1919. <literal>PRIMARY KEY</literal>
  1920. <literal>REFERENCES</literal> <xref linkend="public.table.entity-class"/>
  1921. </para>
  1922. </listitem>
  1923. </varlistentry>
  1924. <varlistentry>
  1925. <term><structfield>entity_id</structfield></term>
  1926. <listitem><para>
  1927. <type>integer</type>
  1928. <literal>PRIMARY KEY</literal>
  1929. <literal>REFERENCES</literal> <xref linkend="public.table.entity"/>
  1930. </para>
  1931. </listitem>
  1932. </varlistentry>
  1933. </variablelist>
  1934. </para>
  1935. </section>
  1936. <section id="public.table.entity-other-name"
  1937. xreflabel="public.entity_other_name">
  1938. <title id="public.table.entity-other-name-title">
  1939. Table:
  1940. <structname>entity_other_name</structname>
  1941. </title>
  1942. <para>
  1943. Similar to company_other_name, a person may be jd, Joshua Drake, linuxpoet... all are the same person.
  1944. </para>
  1945. <para>
  1946. <variablelist>
  1947. <title>
  1948. Structure of <structname>entity_other_name</structname>
  1949. </title>
  1950. <varlistentry>
  1951. <term><structfield>entity_id</structfield></term>
  1952. <listitem><para>
  1953. <type>integer</type>
  1954. <literal>PRIMARY KEY</literal>
  1955. <literal>REFERENCES</literal> <xref linkend="public.table.entity"/>
  1956. </para>
  1957. </listitem>
  1958. </varlistentry>
  1959. <varlistentry>
  1960. <term><structfield>other_name</structfield></term>
  1961. <listitem><para>
  1962. <type>text</type>
  1963. <literal>PRIMARY KEY</literal>
  1964. </para>
  1965. </listitem>
  1966. </varlistentry>
  1967. </variablelist>
  1968. <variablelist>
  1969. <title>Constraints on entity_other_name</title>
  1970. <varlistentry>
  1971. <term>entity_other_name_other_name_check</term>
  1972. <listitem><para>CHECK ((other_name ~ &apos;[[:alnum:]_]&apos;::text))</para></listitem>
  1973. </varlistentry>
  1974. </variablelist>
  1975. </para>
  1976. </section>
  1977. <section id="public.table.exchangerate"
  1978. xreflabel="public.exchangerate">
  1979. <title id="public.table.exchangerate-title">
  1980. Table:
  1981. <structname>exchangerate</structname>
  1982. </title>
  1983. <para>
  1984. <variablelist>
  1985. <title>
  1986. Structure of <structname>exchangerate</structname>
  1987. </title>
  1988. <varlistentry>
  1989. <term><structfield>curr</structfield></term>
  1990. <listitem><para>
  1991. <type>character(3)</type>
  1992. <literal>PRIMARY KEY</literal>
  1993. </para>
  1994. </listitem>
  1995. </varlistentry>
  1996. <varlistentry>
  1997. <term><structfield>transdate</structfield></term>
  1998. <listitem><para>
  1999. <type>date</type>
  2000. <literal>PRIMARY KEY</literal>
  2001. </para>
  2002. </listitem>
  2003. </varlistentry>
  2004. <varlistentry>
  2005. <term><structfield>buy</structfield></term>
  2006. <listitem><para>
  2007. <type>numeric</type>
  2008. </para>
  2009. </listitem>
  2010. </varlistentry>
  2011. <varlistentry>
  2012. <term><structfield>sell</structfield></term>
  2013. <listitem><para>
  2014. <type>numeric</type>
  2015. </para>
  2016. </listitem>
  2017. </varlistentry>
  2018. </variablelist>
  2019. <variablelist>
  2020. <title>Indexes on exchangerate</title>
  2021. <varlistentry>
  2022. <term>exchangerate_ct_key</term>
  2023. <listitem><para>curr, transdate</para></listitem>
  2024. </varlistentry>
  2025. </variablelist>
  2026. </para>
  2027. </section>
  2028. <section id="public.table.gifi"
  2029. xreflabel="public.gifi">
  2030. <title id="public.table.gifi-title">
  2031. Table:
  2032. <structname>gifi</structname>
  2033. </title>
  2034. <para>
  2035. <variablelist>
  2036. <title>
  2037. Structure of <structname>gifi</structname>
  2038. </title>
  2039. <varlistentry>
  2040. <term><structfield>accno</structfield></term>
  2041. <listitem><para>
  2042. <type>text</type>
  2043. <literal>PRIMARY KEY</literal>
  2044. </para>
  2045. </listitem>
  2046. </varlistentry>
  2047. <varlistentry>
  2048. <term><structfield>description</structfield></term>
  2049. <listitem><para>
  2050. <type>text</type>
  2051. </para>
  2052. </listitem>
  2053. </varlistentry>
  2054. </variablelist>
  2055. </para>
  2056. </section>
  2057. <section id="public.table.gl"
  2058. xreflabel="public.gl">
  2059. <title id="public.table.gl-title">
  2060. Table:
  2061. <structname>gl</structname>
  2062. </title>
  2063. <para>
  2064. <variablelist>
  2065. <title>
  2066. Structure of <structname>gl</structname>
  2067. </title>
  2068. <varlistentry>
  2069. <term><structfield>id</structfield></term>
  2070. <listitem><para>
  2071. <type>serial</type>
  2072. <literal>PRIMARY KEY</literal>
  2073. </para>
  2074. </listitem>
  2075. </varlistentry>
  2076. <varlistentry>
  2077. <term><structfield>reference</structfield></term>
  2078. <listitem><para>
  2079. <type>text</type>
  2080. </para>
  2081. </listitem>
  2082. </varlistentry>
  2083. <varlistentry>
  2084. <term><structfield>description</structfield></term>
  2085. <listitem><para>
  2086. <type>text</type>
  2087. </para>
  2088. </listitem>
  2089. </varlistentry>
  2090. <varlistentry>
  2091. <term><structfield>transdate</structfield></term>
  2092. <listitem><para>
  2093. <type>date</type>
  2094. <literal>DEFAULT (&apos;now&apos;::text)::date</literal>
  2095. </para>
  2096. </listitem>
  2097. </varlistentry>
  2098. <varlistentry>
  2099. <term><structfield>person_id</structfield></term>
  2100. <listitem><para>
  2101. <type>integer</type>
  2102. <literal>REFERENCES</literal> <xref linkend="public.table.person"/>
  2103. </para>
  2104. </listitem>
  2105. </varlistentry>
  2106. <varlistentry>
  2107. <term><structfield>notes</structfield></term>
  2108. <listitem><para>
  2109. <type>text</type>
  2110. </para>
  2111. </listitem>
  2112. </varlistentry>
  2113. <varlistentry>
  2114. <term><structfield>department_id</structfield></term>
  2115. <listitem><para>
  2116. <type>integer</type>
  2117. </para>
  2118. </listitem>
  2119. </varlistentry>
  2120. </variablelist>
  2121. <variablelist>
  2122. <title>Indexes on gl</title>
  2123. <varlistentry>
  2124. <term>gl_description_key</term>
  2125. <listitem><para>lower(description)</para></listitem>
  2126. </varlistentry>
  2127. <varlistentry>
  2128. <term>gl_id_key</term>
  2129. <listitem><para>id</para></listitem>
  2130. </varlistentry>
  2131. <varlistentry>
  2132. <term>gl_reference_key</term>
  2133. <listitem><para>reference</para></listitem>
  2134. </varlistentry>
  2135. <varlistentry>
  2136. <term>gl_transdate_key</term>
  2137. <listitem><para>transdate</para></listitem>
  2138. </varlistentry>
  2139. </variablelist>
  2140. </para>
  2141. </section>
  2142. <section id="public.table.inventory"
  2143. xreflabel="public.inventory">
  2144. <title id="public.table.inventory-title">
  2145. Table:
  2146. <structname>inventory</structname>
  2147. </title>
  2148. <para>
  2149. <variablelist>
  2150. <title>
  2151. Structure of <structname>inventory</structname>
  2152. </title>
  2153. <varlistentry>
  2154. <term><structfield>warehouse_id</structfield></term>
  2155. <listitem><para>
  2156. <type>integer</type>
  2157. </para>
  2158. </listitem>
  2159. </varlistentry>
  2160. <varlistentry>
  2161. <term><structfield>parts_id</structfield></term>
  2162. <listitem><para>
  2163. <type>integer</type>
  2164. </para>
  2165. </listitem>
  2166. </varlistentry>
  2167. <varlistentry>
  2168. <term><structfield>trans_id</structfield></term>
  2169. <listitem><para>
  2170. <type>integer</type>
  2171. </para>
  2172. </listitem>
  2173. </varlistentry>
  2174. <varlistentry>
  2175. <term><structfield>orderitems_id</structfield></term>
  2176. <listitem><para>
  2177. <type>integer</type>
  2178. </para>
  2179. </listitem>
  2180. </varlistentry>
  2181. <varlistentry>
  2182. <term><structfield>qty</structfield></term>
  2183. <listitem><para>
  2184. <type>numeric</type>
  2185. </para>
  2186. </listitem>
  2187. </varlistentry>
  2188. <varlistentry>
  2189. <term><structfield>shippingdate</structfield></term>
  2190. <listitem><para>
  2191. <type>date</type>
  2192. </para>
  2193. </listitem>
  2194. </varlistentry>
  2195. <varlistentry>
  2196. <term><structfield>person_id</structfield></term>
  2197. <listitem><para>
  2198. <type>integer</type>
  2199. <literal>NOT NULL</literal>
  2200. <literal>REFERENCES</literal> <xref linkend="public.table.person"/>
  2201. </para>
  2202. </listitem>
  2203. </varlistentry>
  2204. <varlistentry>
  2205. <term><structfield>entry_id</structfield></term>
  2206. <listitem><para>
  2207. <type>serial</type>
  2208. <literal>PRIMARY KEY</literal>
  2209. </para>
  2210. </listitem>
  2211. </varlistentry>
  2212. </variablelist>
  2213. </para>
  2214. </section>
  2215. <section id="public.table.invoice"
  2216. xreflabel="public.invoice">
  2217. <title id="public.table.invoice-title">
  2218. Table:
  2219. <structname>invoice</structname>
  2220. </title>
  2221. <para>
  2222. <variablelist>
  2223. <title>
  2224. Structure of <structname>invoice</structname>
  2225. </title>
  2226. <varlistentry>
  2227. <term><structfield>id</structfield></term>
  2228. <listitem><para>
  2229. <type>serial</type>
  2230. <literal>PRIMARY KEY</literal>
  2231. </para>
  2232. </listitem>
  2233. </varlistentry>
  2234. <varlistentry>
  2235. <term><structfield>trans_id</structfield></term>
  2236. <listitem><para>
  2237. <type>integer</type>
  2238. </para>
  2239. </listitem>
  2240. </varlistentry>
  2241. <varlistentry>
  2242. <term><structfield>parts_id</structfield></term>
  2243. <listitem><para>
  2244. <type>integer</type>
  2245. </para>
  2246. </listitem>
  2247. </varlistentry>
  2248. <varlistentry>
  2249. <term><structfield>description</structfield></term>
  2250. <listitem><para>
  2251. <type>text</type>
  2252. </para>
  2253. </listitem>
  2254. </varlistentry>
  2255. <varlistentry>
  2256. <term><structfield>qty</structfield></term>
  2257. <listitem><para>
  2258. <type>integer</type>
  2259. </para>
  2260. </listitem>
  2261. </varlistentry>
  2262. <varlistentry>
  2263. <term><structfield>allocated</structfield></term>
  2264. <listitem><para>
  2265. <type>integer</type>
  2266. </para>
  2267. </listitem>
  2268. </varlistentry>
  2269. <varlistentry>
  2270. <term><structfield>sellprice</structfield></term>
  2271. <listitem><para>
  2272. <type>numeric</type>
  2273. </para>
  2274. </listitem>
  2275. </varlistentry>
  2276. <varlistentry>
  2277. <term><structfield>fxsellprice</structfield></term>
  2278. <listitem><para>
  2279. <type>numeric</type>
  2280. </para>
  2281. </listitem>
  2282. </varlistentry>
  2283. <varlistentry>
  2284. <term><structfield>discount</structfield></term>
  2285. <listitem><para>
  2286. <type>real</type>
  2287. </para>
  2288. </listitem>
  2289. </varlistentry>
  2290. <varlistentry>
  2291. <term><structfield>assemblyitem</structfield></term>
  2292. <listitem><para>
  2293. <type>boolean</type>
  2294. <literal>DEFAULT false</literal>
  2295. </para>
  2296. </listitem>
  2297. </varlistentry>
  2298. <varlistentry>
  2299. <term><structfield>unit</structfield></term>
  2300. <listitem><para>
  2301. <type>character varying(5)</type>
  2302. </para>
  2303. </listitem>
  2304. </varlistentry>
  2305. <varlistentry>
  2306. <term><structfield>project_id</structfield></term>
  2307. <listitem><para>
  2308. <type>integer</type>
  2309. </para>
  2310. </listitem>
  2311. </varlistentry>
  2312. <varlistentry>
  2313. <term><structfield>deliverydate</structfield></term>
  2314. <listitem><para>
  2315. <type>date</type>
  2316. </para>
  2317. </listitem>
  2318. </varlistentry>
  2319. <varlistentry>
  2320. <term><structfield>serialnumber</structfield></term>
  2321. <listitem><para>
  2322. <type>text</type>
  2323. </para>
  2324. </listitem>
  2325. </varlistentry>
  2326. <varlistentry>
  2327. <term><structfield>notes</structfield></term>
  2328. <listitem><para>
  2329. <type>text</type>
  2330. </para>
  2331. </listitem>
  2332. </varlistentry>
  2333. </variablelist>
  2334. <variablelist>
  2335. <title>Indexes on invoice</title>
  2336. <varlistentry>
  2337. <term>invoice_id_key</term>
  2338. <listitem><para>id</para></listitem>
  2339. </varlistentry>
  2340. <varlistentry>
  2341. <term>invoice_trans_id_key</term>
  2342. <listitem><para>trans_id</para></listitem>
  2343. </varlistentry>
  2344. </variablelist>
  2345. </para>
  2346. </section>
  2347. <section id="public.table.jcitems"
  2348. xreflabel="public.jcitems">
  2349. <title id="public.table.jcitems-title">
  2350. Table:
  2351. <structname>jcitems</structname>
  2352. </title>
  2353. <para>
  2354. <variablelist>
  2355. <title>
  2356. Structure of <structname>jcitems</structname>
  2357. </title>
  2358. <varlistentry>
  2359. <term><structfield>id</structfield></term>
  2360. <listitem><para>
  2361. <type>serial</type>
  2362. <literal>PRIMARY KEY</literal>
  2363. </para>
  2364. </listitem>
  2365. </varlistentry>
  2366. <varlistentry>
  2367. <term><structfield>project_id</structfield></term>
  2368. <listitem><para>
  2369. <type>integer</type>
  2370. </para>
  2371. </listitem>
  2372. </varlistentry>
  2373. <varlistentry>
  2374. <term><structfield>parts_id</structfield></term>
  2375. <listitem><para>
  2376. <type>integer</type>
  2377. </para>
  2378. </listitem>
  2379. </varlistentry>
  2380. <varlistentry>
  2381. <term><structfield>description</structfield></term>
  2382. <listitem><para>
  2383. <type>text</type>
  2384. </para>
  2385. </listitem>
  2386. </varlistentry>
  2387. <varlistentry>
  2388. <term><structfield>qty</structfield></term>
  2389. <listitem><para>
  2390. <type>numeric</type>
  2391. </para>
  2392. </listitem>
  2393. </varlistentry>
  2394. <varlistentry>
  2395. <term><structfield>allocated</structfield></term>
  2396. <listitem><para>
  2397. <type>numeric</type>
  2398. </para>
  2399. </listitem>
  2400. </varlistentry>
  2401. <varlistentry>
  2402. <term><structfield>sellprice</structfield></term>
  2403. <listitem><para>
  2404. <type>numeric</type>
  2405. </para>
  2406. </listitem>
  2407. </varlistentry>
  2408. <varlistentry>
  2409. <term><structfield>fxsellprice</structfield></term>
  2410. <listitem><para>
  2411. <type>numeric</type>
  2412. </para>
  2413. </listitem>
  2414. </varlistentry>
  2415. <varlistentry>
  2416. <term><structfield>serialnumber</structfield></term>
  2417. <listitem><para>
  2418. <type>text</type>
  2419. </para>
  2420. </listitem>
  2421. </varlistentry>
  2422. <varlistentry>
  2423. <term><structfield>checkedin</structfield></term>
  2424. <listitem><para>
  2425. <type>timestamp with time zone</type>
  2426. </para>
  2427. </listitem>
  2428. </varlistentry>
  2429. <varlistentry>
  2430. <term><structfield>checkedout</structfield></term>
  2431. <listitem><para>
  2432. <type>timestamp with time zone</type>
  2433. </para>
  2434. </listitem>
  2435. </varlistentry>
  2436. <varlistentry>
  2437. <term><structfield>person_id</structfield></term>
  2438. <listitem><para>
  2439. <type>integer</type>
  2440. <literal>NOT NULL</literal>
  2441. <literal>REFERENCES</literal> <xref linkend="public.table.person"/>
  2442. </para>
  2443. </listitem>
  2444. </varlistentry>
  2445. <varlistentry>
  2446. <term><structfield>notes</structfield></term>
  2447. <listitem><para>
  2448. <type>text</type>
  2449. </para>
  2450. </listitem>
  2451. </varlistentry>
  2452. </variablelist>
  2453. <variablelist>
  2454. <title>Indexes on jcitems</title>
  2455. <varlistentry>
  2456. <term>jcitems_id_key</term>
  2457. <listitem><para>id</para></listitem>
  2458. </varlistentry>
  2459. </variablelist>
  2460. </para>
  2461. </section>
  2462. <section id="public.table.language"
  2463. xreflabel="public.language">
  2464. <title id="public.table.language-title">
  2465. Table:
  2466. <structname>language</structname>
  2467. </title>
  2468. <para>
  2469. <variablelist>
  2470. <title>
  2471. Structure of <structname>language</structname>
  2472. </title>
  2473. <varlistentry>
  2474. <term><structfield>code</structfield></term>
  2475. <listitem><para>
  2476. <type>character varying(6)</type>
  2477. <literal>PRIMARY KEY</literal>
  2478. </para>
  2479. </listitem>
  2480. </varlistentry>
  2481. <varlistentry>
  2482. <term><structfield>description</structfield></term>
  2483. <listitem><para>
  2484. <type>text</type>
  2485. </para>
  2486. </listitem>
  2487. </varlistentry>
  2488. </variablelist>
  2489. </para>
  2490. </section>
  2491. <section id="public.table.location"
  2492. xreflabel="public.location">
  2493. <title id="public.table.location-title">
  2494. Table:
  2495. <structname>location</structname>
  2496. </title>
  2497. <para>
  2498. <variablelist>
  2499. <title>
  2500. Structure of <structname>location</structname>
  2501. </title>
  2502. <varlistentry>
  2503. <term><structfield>id</structfield></term>
  2504. <listitem><para>
  2505. <type>serial</type>
  2506. <literal>PRIMARY KEY</literal>
  2507. </para>
  2508. </listitem>
  2509. </varlistentry>
  2510. <varlistentry>
  2511. <term><structfield>line_one</structfield></term>
  2512. <listitem><para>
  2513. <type>text</type>
  2514. <literal>NOT NULL</literal>
  2515. </para>
  2516. </listitem>
  2517. </varlistentry>
  2518. <varlistentry>
  2519. <term><structfield>line_two</structfield></term>
  2520. <listitem><para>
  2521. <type>text</type>
  2522. </para>
  2523. </listitem>
  2524. </varlistentry>
  2525. <varlistentry>
  2526. <term><structfield>line_three</structfield></term>
  2527. <listitem><para>
  2528. <type>text</type>
  2529. </para>
  2530. </listitem>
  2531. </varlistentry>
  2532. <varlistentry>
  2533. <term><structfield>city_province</structfield></term>
  2534. <listitem><para>
  2535. <type>text</type>
  2536. <literal>NOT NULL</literal>
  2537. </para>
  2538. </listitem>
  2539. </varlistentry>
  2540. <varlistentry>
  2541. <term><structfield>country_id</structfield></term>
  2542. <listitem><para>
  2543. <type>integer</type>
  2544. <literal>NOT NULL</literal>
  2545. <literal>REFERENCES</literal> <xref linkend="public.table.country"/>
  2546. </para>
  2547. </listitem>
  2548. </varlistentry>
  2549. <varlistentry>
  2550. <term><structfield>mail_code</structfield></term>
  2551. <listitem><para>
  2552. <type>text</type>
  2553. <literal>NOT NULL</literal>
  2554. </para>
  2555. </listitem>
  2556. </varlistentry>
  2557. </variablelist>
  2558. <variablelist>
  2559. <title>Constraints on location</title>
  2560. <varlistentry>
  2561. <term>location_city_province_check</term>
  2562. <listitem><para>CHECK ((city_province ~ &apos;[[:alnum:]_]&apos;::text))</para></listitem>
  2563. </varlistentry>
  2564. <varlistentry>
  2565. <term>location_line_one_check</term>
  2566. <listitem><para>CHECK ((line_one ~ &apos;[[:alnum:]_]&apos;::text))</para></listitem>
  2567. </varlistentry>
  2568. <varlistentry>
  2569. <term>location_mail_code_check</term>
  2570. <listitem><para>CHECK ((mail_code ~ &apos;[[:alnum:]_]&apos;::text))</para></listitem>
  2571. </varlistentry>
  2572. </variablelist>
  2573. <itemizedlist>
  2574. <title>
  2575. Tables referencing company via Foreign Key Constraints
  2576. </title>
  2577. <listitem>
  2578. <para>
  2579. <xref linkend="public.table.company"/>
  2580. </para>
  2581. </listitem>
  2582. <listitem>
  2583. <para>
  2584. <xref linkend="public.table.company-to-location"/>
  2585. </para>
  2586. </listitem>
  2587. <listitem>
  2588. <para>
  2589. <xref linkend="public.table.person"/>
  2590. </para>
  2591. </listitem>
  2592. <listitem>
  2593. <para>
  2594. <xref linkend="public.table.person-to-company"/>
  2595. </para>
  2596. </listitem>
  2597. </itemizedlist>
  2598. </para>
  2599. </section>
  2600. <section id="public.table.makemodel"
  2601. xreflabel="public.makemodel">
  2602. <title id="public.table.makemodel-title">
  2603. Table:
  2604. <structname>makemodel</structname>
  2605. </title>
  2606. <para>
  2607. <variablelist>
  2608. <title>
  2609. Structure of <structname>makemodel</structname>
  2610. </title>
  2611. <varlistentry>
  2612. <term><structfield>parts_id</structfield></term>
  2613. <listitem><para>
  2614. <type>integer</type>
  2615. <literal>PRIMARY KEY</literal>
  2616. </para>
  2617. </listitem>
  2618. </varlistentry>
  2619. <varlistentry>
  2620. <term><structfield>make</structfield></term>
  2621. <listitem><para>
  2622. <type>text</type>
  2623. </para>
  2624. </listitem>
  2625. </varlistentry>
  2626. <varlistentry>
  2627. <term><structfield>model</structfield></term>
  2628. <listitem><para>
  2629. <type>text</type>
  2630. </para>
  2631. </listitem>
  2632. </varlistentry>
  2633. </variablelist>
  2634. <variablelist>
  2635. <title>Indexes on makemodel</title>
  2636. <varlistentry>
  2637. <term>makemodel_make_key</term>
  2638. <listitem><para>lower(make)</para></listitem>
  2639. </varlistentry>
  2640. <varlistentry>
  2641. <term>makemodel_model_key</term>
  2642. <listitem><para>lower(model)</para></listitem>
  2643. </varlistentry>
  2644. <varlistentry>
  2645. <term>makemodel_parts_id_key</term>
  2646. <listitem><para>parts_id</para></listitem>
  2647. </varlistentry>
  2648. </variablelist>
  2649. </para>
  2650. </section>
  2651. <section id="public.table.oe"
  2652. xreflabel="public.oe">
  2653. <title id="public.table.oe-title">
  2654. Table:
  2655. <structname>oe</structname>
  2656. </title>
  2657. <para>
  2658. <variablelist>
  2659. <title>
  2660. Structure of <structname>oe</structname>
  2661. </title>
  2662. <varlistentry>
  2663. <term><structfield>id</structfield></term>
  2664. <listitem><para>
  2665. <type>serial</type>
  2666. <literal>PRIMARY KEY</literal>
  2667. </para>
  2668. </listitem>
  2669. </varlistentry>
  2670. <varlistentry>
  2671. <term><structfield>ordnumber</structfield></term>
  2672. <listitem><para>
  2673. <type>text</type>
  2674. </para>
  2675. </listitem>
  2676. </varlistentry>
  2677. <varlistentry>
  2678. <term><structfield>transdate</structfield></term>
  2679. <listitem><para>
  2680. <type>date</type>
  2681. <literal>DEFAULT (&apos;now&apos;::text)::date</literal>
  2682. </para>
  2683. </listitem>
  2684. </varlistentry>
  2685. <varlistentry>
  2686. <term><structfield>entity_id</structfield></term>
  2687. <listitem><para>
  2688. <type>integer</type>
  2689. <literal>NOT NULL</literal>
  2690. <literal>REFERENCES</literal> <xref linkend="public.table.entity"/>
  2691. </para>
  2692. </listitem>
  2693. </varlistentry>
  2694. <varlistentry>
  2695. <term><structfield>amount</structfield></term>
  2696. <listitem><para>
  2697. <type>numeric</type>
  2698. </para>
  2699. </listitem>
  2700. </varlistentry>
  2701. <varlistentry>
  2702. <term><structfield>netamount</structfield></term>
  2703. <listitem><para>
  2704. <type>numeric</type>
  2705. </para>
  2706. </listitem>
  2707. </varlistentry>
  2708. <varlistentry>
  2709. <term><structfield>reqdate</structfield></term>
  2710. <listitem><para>
  2711. <type>date</type>
  2712. </para>
  2713. </listitem>
  2714. </varlistentry>
  2715. <varlistentry>
  2716. <term><structfield>taxincluded</structfield></term>
  2717. <listitem><para>
  2718. <type>boolean</type>
  2719. </para>
  2720. </listitem>
  2721. </varlistentry>
  2722. <varlistentry>
  2723. <term><structfield>shippingpoint</structfield></term>
  2724. <listitem><para>
  2725. <type>text</type>
  2726. </para>
  2727. </listitem>
  2728. </varlistentry>
  2729. <varlistentry>
  2730. <term><structfield>notes</structfield></term>
  2731. <listitem><para>
  2732. <type>text</type>
  2733. </para>
  2734. </listitem>
  2735. </varlistentry>
  2736. <varlistentry>
  2737. <term><structfield>curr</structfield></term>
  2738. <listitem><para>
  2739. <type>character(3)</type>
  2740. </para>
  2741. </listitem>
  2742. </varlistentry>
  2743. <varlistentry>
  2744. <term><structfield>person_id</structfield></term>
  2745. <listitem><para>
  2746. <type>integer</type>
  2747. <literal>NOT NULL</literal>
  2748. <literal>REFERENCES</literal> <xref linkend="public.table.person"/>
  2749. </para>
  2750. </listitem>
  2751. </varlistentry>
  2752. <varlistentry>
  2753. <term><structfield>closed</structfield></term>
  2754. <listitem><para>
  2755. <type>boolean</type>
  2756. <literal>DEFAULT false</literal>
  2757. </para>
  2758. </listitem>
  2759. </varlistentry>
  2760. <varlistentry>
  2761. <term><structfield>quotation</structfield></term>
  2762. <listitem><para>
  2763. <type>boolean</type>
  2764. <literal>DEFAULT false</literal>
  2765. </para>
  2766. </listitem>
  2767. </varlistentry>
  2768. <varlistentry>
  2769. <term><structfield>quonumber</structfield></term>
  2770. <listitem><para>
  2771. <type>text</type>
  2772. </para>
  2773. </listitem>
  2774. </varlistentry>
  2775. <varlistentry>
  2776. <term><structfield>intnotes</structfield></term>
  2777. <listitem><para>
  2778. <type>text</type>
  2779. </para>
  2780. </listitem>
  2781. </varlistentry>
  2782. <varlistentry>
  2783. <term><structfield>department_id</structfield></term>
  2784. <listitem><para>
  2785. <type>integer</type>
  2786. </para>
  2787. </listitem>
  2788. </varlistentry>
  2789. <varlistentry>
  2790. <term><structfield>shipvia</structfield></term>
  2791. <listitem><para>
  2792. <type>text</type>
  2793. </para>
  2794. </listitem>
  2795. </varlistentry>
  2796. <varlistentry>
  2797. <term><structfield>language_code</structfield></term>
  2798. <listitem><para>
  2799. <type>character varying(6)</type>
  2800. </para>
  2801. </listitem>
  2802. </varlistentry>
  2803. <varlistentry>
  2804. <term><structfield>ponumber</structfield></term>
  2805. <listitem><para>
  2806. <type>text</type>
  2807. </para>
  2808. </listitem>
  2809. </varlistentry>
  2810. <varlistentry>
  2811. <term><structfield>terms</structfield></term>
  2812. <listitem><para>
  2813. <type>smallint</type>
  2814. </para>
  2815. </listitem>
  2816. </varlistentry>
  2817. <varlistentry>
  2818. <term><structfield>oe_class_id</structfield></term>
  2819. <listitem><para>
  2820. <type>integer</type>
  2821. <literal>NOT NULL</literal>
  2822. <literal>REFERENCES</literal> <xref linkend="public.table.oe-class"/>
  2823. </para>
  2824. </listitem>
  2825. </varlistentry>
  2826. </variablelist>
  2827. <variablelist>
  2828. <title>Indexes on oe</title>
  2829. <varlistentry>
  2830. <term>oe_id_key</term>
  2831. <listitem><para>id</para></listitem>
  2832. </varlistentry>
  2833. <varlistentry>
  2834. <term>oe_ordnumber_key</term>
  2835. <listitem><para>ordnumber</para></listitem>
  2836. </varlistentry>
  2837. <varlistentry>
  2838. <term>oe_transdate_key</term>
  2839. <listitem><para>transdate</para></listitem>
  2840. </varlistentry>
  2841. </variablelist>
  2842. </para>
  2843. </section>
  2844. <section id="public.table.oe-class"
  2845. xreflabel="public.oe_class">
  2846. <title id="public.table.oe-class-title">
  2847. Table:
  2848. <structname>oe_class</structname>
  2849. </title>
  2850. <para>
  2851. This could probably be done better. But I need to remove the customer_id/vendor_id relationship and instead rely on a classification
  2852. </para>
  2853. <para>
  2854. <variablelist>
  2855. <title>
  2856. Structure of <structname>oe_class</structname>
  2857. </title>
  2858. <varlistentry>
  2859. <term><structfield>id</structfield></term>
  2860. <listitem><para>
  2861. <type>smallint</type>
  2862. <literal>UNIQUE</literal>
  2863. </para>
  2864. </listitem>
  2865. </varlistentry>
  2866. <varlistentry>
  2867. <term><structfield>oe_class</structfield></term>
  2868. <listitem><para>
  2869. <type>text</type>
  2870. <literal>PRIMARY KEY</literal>
  2871. </para>
  2872. </listitem>
  2873. </varlistentry>
  2874. </variablelist>
  2875. <variablelist>
  2876. <title>Constraints on oe_class</title>
  2877. <varlistentry>
  2878. <term>oe_class_id_check</term>
  2879. <listitem><para>CHECK (((id = 1) OR (id = 2)))</para></listitem>
  2880. </varlistentry>
  2881. </variablelist>
  2882. <itemizedlist>
  2883. <title>
  2884. Tables referencing oe via Foreign Key Constraints
  2885. </title>
  2886. <listitem>
  2887. <para>
  2888. <xref linkend="public.table.oe"/>
  2889. </para>
  2890. </listitem>
  2891. </itemizedlist>
  2892. </para>
  2893. </section>
  2894. <section id="public.table.orderitems"
  2895. xreflabel="public.orderitems">
  2896. <title id="public.table.orderitems-title">
  2897. Table:
  2898. <structname>orderitems</structname>
  2899. </title>
  2900. <para>
  2901. <variablelist>
  2902. <title>
  2903. Structure of <structname>orderitems</structname>
  2904. </title>
  2905. <varlistentry>
  2906. <term><structfield>id</structfield></term>
  2907. <listitem><para>
  2908. <type>serial</type>
  2909. <literal>PRIMARY KEY</literal>
  2910. </para>
  2911. </listitem>
  2912. </varlistentry>
  2913. <varlistentry>
  2914. <term><structfield>trans_id</structfield></term>
  2915. <listitem><para>
  2916. <type>integer</type>
  2917. </para>
  2918. </listitem>
  2919. </varlistentry>
  2920. <varlistentry>
  2921. <term><structfield>parts_id</structfield></term>
  2922. <listitem><para>
  2923. <type>integer</type>
  2924. </para>
  2925. </listitem>
  2926. </varlistentry>
  2927. <varlistentry>
  2928. <term><structfield>description</structfield></term>
  2929. <listitem><para>
  2930. <type>text</type>
  2931. </para>
  2932. </listitem>
  2933. </varlistentry>
  2934. <varlistentry>
  2935. <term><structfield>qty</structfield></term>
  2936. <listitem><para>
  2937. <type>numeric</type>
  2938. </para>
  2939. </listitem>
  2940. </varlistentry>
  2941. <varlistentry>
  2942. <term><structfield>sellprice</structfield></term>
  2943. <listitem><para>
  2944. <type>numeric</type>
  2945. </para>
  2946. </listitem>
  2947. </varlistentry>
  2948. <varlistentry>
  2949. <term><structfield>discount</structfield></term>
  2950. <listitem><para>
  2951. <type>numeric</type>
  2952. </para>
  2953. </listitem>
  2954. </varlistentry>
  2955. <varlistentry>
  2956. <term><structfield>unit</structfield></term>
  2957. <listitem><para>
  2958. <type>character varying(5)</type>
  2959. </para>
  2960. </listitem>
  2961. </varlistentry>
  2962. <varlistentry>
  2963. <term><structfield>project_id</structfield></term>
  2964. <listitem><para>
  2965. <type>integer</type>
  2966. </para>
  2967. </listitem>
  2968. </varlistentry>
  2969. <varlistentry>
  2970. <term><structfield>reqdate</structfield></term>
  2971. <listitem><para>
  2972. <type>date</type>
  2973. </para>
  2974. </listitem>
  2975. </varlistentry>
  2976. <varlistentry>
  2977. <term><structfield>ship</structfield></term>
  2978. <listitem><para>
  2979. <type>numeric</type>
  2980. </para>
  2981. </listitem>
  2982. </varlistentry>
  2983. <varlistentry>
  2984. <term><structfield>serialnumber</structfield></term>
  2985. <listitem><para>
  2986. <type>text</type>
  2987. </para>
  2988. </listitem>
  2989. </varlistentry>
  2990. <varlistentry>
  2991. <term><structfield>notes</structfield></term>
  2992. <listitem><para>
  2993. <type>text</type>
  2994. </para>
  2995. </listitem>
  2996. </varlistentry>
  2997. </variablelist>
  2998. <variablelist>
  2999. <title>Indexes on orderitems</title>
  3000. <varlistentry>
  3001. <term>orderitems_id_key</term>
  3002. <listitem><para>id</para></listitem>
  3003. </varlistentry>
  3004. <varlistentry>
  3005. <term>orderitems_trans_id_key</term>
  3006. <listitem><para>trans_id</para></listitem>
  3007. </varlistentry>
  3008. </variablelist>
  3009. </para>
  3010. </section>
  3011. <section id="public.table.parts"
  3012. xreflabel="public.parts">
  3013. <title id="public.table.parts-title">
  3014. Table:
  3015. <structname>parts</structname>
  3016. </title>
  3017. <para>
  3018. <variablelist>
  3019. <title>
  3020. Structure of <structname>parts</structname>
  3021. </title>
  3022. <varlistentry>
  3023. <term><structfield>id</structfield></term>
  3024. <listitem><para>
  3025. <type>serial</type>
  3026. <literal>PRIMARY KEY</literal>
  3027. </para>
  3028. </listitem>
  3029. </varlistentry>
  3030. <varlistentry>
  3031. <term><structfield>partnumber</structfield></term>
  3032. <listitem><para>
  3033. <type>text</type>
  3034. </para>
  3035. </listitem>
  3036. </varlistentry>
  3037. <varlistentry>
  3038. <term><structfield>description</structfield></term>
  3039. <listitem><para>
  3040. <type>text</type>
  3041. </para>
  3042. </listitem>
  3043. </varlistentry>
  3044. <varlistentry>
  3045. <term><structfield>unit</structfield></term>
  3046. <listitem><para>
  3047. <type>character varying(5)</type>
  3048. </para>
  3049. </listitem>
  3050. </varlistentry>
  3051. <varlistentry>
  3052. <term><structfield>listprice</structfield></term>
  3053. <listitem><para>
  3054. <type>numeric</type>
  3055. </para>
  3056. </listitem>
  3057. </varlistentry>
  3058. <varlistentry>
  3059. <term><structfield>sellprice</structfield></term>
  3060. <listitem><para>
  3061. <type>numeric</type>
  3062. </para>
  3063. </listitem>
  3064. </varlistentry>
  3065. <varlistentry>
  3066. <term><structfield>lastcost</structfield></term>
  3067. <listitem><para>
  3068. <type>numeric</type>
  3069. </para>
  3070. </listitem>
  3071. </varlistentry>
  3072. <varlistentry>
  3073. <term><structfield>priceupdate</structfield></term>
  3074. <listitem><para>
  3075. <type>date</type>
  3076. <literal>DEFAULT (&apos;now&apos;::text)::date</literal>
  3077. </para>
  3078. </listitem>
  3079. </varlistentry>
  3080. <varlistentry>
  3081. <term><structfield>weight</structfield></term>
  3082. <listitem><para>
  3083. <type>numeric</type>
  3084. </para>
  3085. </listitem>
  3086. </varlistentry>
  3087. <varlistentry>
  3088. <term><structfield>onhand</structfield></term>
  3089. <listitem><para>
  3090. <type>numeric</type>
  3091. </para>
  3092. </listitem>
  3093. </varlistentry>
  3094. <varlistentry>
  3095. <term><structfield>notes</structfield></term>
  3096. <listitem><para>
  3097. <type>text</type>
  3098. </para>
  3099. </listitem>
  3100. </varlistentry>
  3101. <varlistentry>
  3102. <term><structfield>makemodel</structfield></term>
  3103. <listitem><para>
  3104. <type>boolean</type>
  3105. <literal>DEFAULT false</literal>
  3106. </para>
  3107. </listitem>
  3108. </varlistentry>
  3109. <varlistentry>
  3110. <term><structfield>assembly</structfield></term>
  3111. <listitem><para>
  3112. <type>boolean</type>
  3113. <literal>DEFAULT false</literal>
  3114. </para>
  3115. </listitem>
  3116. </varlistentry>
  3117. <varlistentry>
  3118. <term><structfield>alternate</structfield></term>
  3119. <listitem><para>
  3120. <type>boolean</type>
  3121. <literal>DEFAULT false</literal>
  3122. </para>
  3123. </listitem>
  3124. </varlistentry>
  3125. <varlistentry>
  3126. <term><structfield>rop</structfield></term>
  3127. <listitem><para>
  3128. <type>real</type>
  3129. </para>
  3130. </listitem>
  3131. </varlistentry>
  3132. <varlistentry>
  3133. <term><structfield>inventory_accno_id</structfield></term>
  3134. <listitem><para>
  3135. <type>integer</type>
  3136. </para>
  3137. </listitem>
  3138. </varlistentry>
  3139. <varlistentry>
  3140. <term><structfield>income_accno_id</structfield></term>
  3141. <listitem><para>
  3142. <type>integer</type>
  3143. </para>
  3144. </listitem>
  3145. </varlistentry>
  3146. <varlistentry>
  3147. <term><structfield>expense_accno_id</structfield></term>
  3148. <listitem><para>
  3149. <type>integer</type>
  3150. </para>
  3151. </listitem>
  3152. </varlistentry>
  3153. <varlistentry>
  3154. <term><structfield>bin</structfield></term>
  3155. <listitem><para>
  3156. <type>text</type>
  3157. </para>
  3158. </listitem>
  3159. </varlistentry>
  3160. <varlistentry>
  3161. <term><structfield>obsolete</structfield></term>
  3162. <listitem><para>
  3163. <type>boolean</type>
  3164. <literal>DEFAULT false</literal>
  3165. </para>
  3166. </listitem>
  3167. </varlistentry>
  3168. <varlistentry>
  3169. <term><structfield>bom</structfield></term>
  3170. <listitem><para>
  3171. <type>boolean</type>
  3172. <literal>DEFAULT false</literal>
  3173. </para>
  3174. </listitem>
  3175. </varlistentry>
  3176. <varlistentry>
  3177. <term><structfield>image</structfield></term>
  3178. <listitem><para>
  3179. <type>text</type>
  3180. </para>
  3181. </listitem>
  3182. </varlistentry>
  3183. <varlistentry>
  3184. <term><structfield>drawing</structfield></term>
  3185. <listitem><para>
  3186. <type>text</type>
  3187. </para>
  3188. </listitem>
  3189. </varlistentry>
  3190. <varlistentry>
  3191. <term><structfield>microfiche</structfield></term>
  3192. <listitem><para>
  3193. <type>text</type>
  3194. </para>
  3195. </listitem>
  3196. </varlistentry>
  3197. <varlistentry>
  3198. <term><structfield>partsgroup_id</structfield></term>
  3199. <listitem><para>
  3200. <type>integer</type>
  3201. </para>
  3202. </listitem>
  3203. </varlistentry>
  3204. <varlistentry>
  3205. <term><structfield>project_id</structfield></term>
  3206. <listitem><para>
  3207. <type>integer</type>
  3208. </para>
  3209. </listitem>
  3210. </varlistentry>
  3211. <varlistentry>
  3212. <term><structfield>avgcost</structfield></term>
  3213. <listitem><para>
  3214. <type>numeric</type>
  3215. </para>
  3216. </listitem>
  3217. </varlistentry>
  3218. </variablelist>
  3219. <variablelist>
  3220. <title>Indexes on parts</title>
  3221. <varlistentry>
  3222. <term>parts_description_key</term>
  3223. <listitem><para>lower(description)</para></listitem>
  3224. </varlistentry>
  3225. <varlistentry>
  3226. <term>parts_id_key</term>
  3227. <listitem><para>id</para></listitem>
  3228. </varlistentry>
  3229. <varlistentry>
  3230. <term>parts_partnumber_key</term>
  3231. <listitem><para>lower(partnumber)</para></listitem>
  3232. </varlistentry>
  3233. </variablelist>
  3234. <itemizedlist>
  3235. <title>
  3236. Tables referencing partstax via Foreign Key Constraints
  3237. </title>
  3238. <listitem>
  3239. <para>
  3240. <xref linkend="public.table.partstax"/>
  3241. </para>
  3242. </listitem>
  3243. </itemizedlist>
  3244. </para>
  3245. </section>
  3246. <section id="public.table.partscustomer"
  3247. xreflabel="public.partscustomer">
  3248. <title id="public.table.partscustomer-title">
  3249. Table:
  3250. <structname>partscustomer</structname>
  3251. </title>
  3252. <para>
  3253. <variablelist>
  3254. <title>
  3255. Structure of <structname>partscustomer</structname>
  3256. </title>
  3257. <varlistentry>
  3258. <term><structfield>parts_id</structfield></term>
  3259. <listitem><para>
  3260. <type>integer</type>
  3261. </para>
  3262. </listitem>
  3263. </varlistentry>
  3264. <varlistentry>
  3265. <term><structfield>customer_id</structfield></term>
  3266. <listitem><para>
  3267. <type>integer</type>
  3268. </para>
  3269. </listitem>
  3270. </varlistentry>
  3271. <varlistentry>
  3272. <term><structfield>pricegroup_id</structfield></term>
  3273. <listitem><para>
  3274. <type>integer</type>
  3275. </para>
  3276. </listitem>
  3277. </varlistentry>
  3278. <varlistentry>
  3279. <term><structfield>pricebreak</structfield></term>
  3280. <listitem><para>
  3281. <type>numeric</type>
  3282. </para>
  3283. </listitem>
  3284. </varlistentry>
  3285. <varlistentry>
  3286. <term><structfield>sellprice</structfield></term>
  3287. <listitem><para>
  3288. <type>numeric</type>
  3289. </para>
  3290. </listitem>
  3291. </varlistentry>
  3292. <varlistentry>
  3293. <term><structfield>validfrom</structfield></term>
  3294. <listitem><para>
  3295. <type>date</type>
  3296. </para>
  3297. </listitem>
  3298. </varlistentry>
  3299. <varlistentry>
  3300. <term><structfield>validto</structfield></term>
  3301. <listitem><para>
  3302. <type>date</type>
  3303. </para>
  3304. </listitem>
  3305. </varlistentry>
  3306. <varlistentry>
  3307. <term><structfield>curr</structfield></term>
  3308. <listitem><para>
  3309. <type>character(3)</type>
  3310. </para>
  3311. </listitem>
  3312. </varlistentry>
  3313. <varlistentry>
  3314. <term><structfield>entry_id</structfield></term>
  3315. <listitem><para>
  3316. <type>serial</type>
  3317. <literal>PRIMARY KEY</literal>
  3318. </para>
  3319. </listitem>
  3320. </varlistentry>
  3321. </variablelist>
  3322. </para>
  3323. </section>
  3324. <section id="public.table.partsgroup"
  3325. xreflabel="public.partsgroup">
  3326. <title id="public.table.partsgroup-title">
  3327. Table:
  3328. <structname>partsgroup</structname>
  3329. </title>
  3330. <para>
  3331. <variablelist>
  3332. <title>
  3333. Structure of <structname>partsgroup</structname>
  3334. </title>
  3335. <varlistentry>
  3336. <term><structfield>id</structfield></term>
  3337. <listitem><para>
  3338. <type>serial</type>
  3339. <literal>PRIMARY KEY</literal>
  3340. </para>
  3341. </listitem>
  3342. </varlistentry>
  3343. <varlistentry>
  3344. <term><structfield>partsgroup</structfield></term>
  3345. <listitem><para>
  3346. <type>text</type>
  3347. </para>
  3348. </listitem>
  3349. </varlistentry>
  3350. </variablelist>
  3351. <variablelist>
  3352. <title>Indexes on partsgroup</title>
  3353. <varlistentry>
  3354. <term>partsgroup_id_key</term>
  3355. <listitem><para>id</para></listitem>
  3356. </varlistentry>
  3357. </variablelist>
  3358. </para>
  3359. </section>
  3360. <section id="public.table.partstax"
  3361. xreflabel="public.partstax">
  3362. <title id="public.table.partstax-title">
  3363. Table:
  3364. <structname>partstax</structname>
  3365. </title>
  3366. <para>
  3367. <variablelist>
  3368. <title>
  3369. Structure of <structname>partstax</structname>
  3370. </title>
  3371. <varlistentry>
  3372. <term><structfield>parts_id</structfield></term>
  3373. <listitem><para>
  3374. <type>integer</type>
  3375. <literal>PRIMARY KEY</literal>
  3376. <literal>REFERENCES</literal> <xref linkend="public.table.parts"/>
  3377. </para>
  3378. </listitem>
  3379. </varlistentry>
  3380. <varlistentry>
  3381. <term><structfield>chart_id</structfield></term>
  3382. <listitem><para>
  3383. <type>integer</type>
  3384. <literal>PRIMARY KEY</literal>
  3385. <literal>REFERENCES</literal> <xref linkend="public.table.chart"/>
  3386. </para>
  3387. </listitem>
  3388. </varlistentry>
  3389. <varlistentry>
  3390. <term><structfield>taxcategory_id</structfield></term>
  3391. <listitem><para>
  3392. <type>integer</type>
  3393. <literal>REFERENCES</literal> <xref linkend="public.table.taxcategory"/>
  3394. </para>
  3395. </listitem>
  3396. </varlistentry>
  3397. </variablelist>
  3398. <variablelist>
  3399. <title>Indexes on partstax</title>
  3400. <varlistentry>
  3401. <term>partstax_parts_id_key</term>
  3402. <listitem><para>parts_id</para></listitem>
  3403. </varlistentry>
  3404. </variablelist>
  3405. </para>
  3406. </section>
  3407. <section id="public.table.partsvendor"
  3408. xreflabel="public.partsvendor">
  3409. <title id="public.table.partsvendor-title">
  3410. Table:
  3411. <structname>partsvendor</structname>
  3412. </title>
  3413. <para>
  3414. <variablelist>
  3415. <title>
  3416. Structure of <structname>partsvendor</structname>
  3417. </title>
  3418. <varlistentry>
  3419. <term><structfield>entity_id</structfield></term>
  3420. <listitem><para>
  3421. <type>integer</type>
  3422. <literal>NOT NULL</literal>
  3423. <literal>REFERENCES</literal> <xref linkend="public.table.entity"/>
  3424. </para>
  3425. </listitem>
  3426. </varlistentry>
  3427. <varlistentry>
  3428. <term><structfield>parts_id</structfield></term>
  3429. <listitem><para>
  3430. <type>integer</type>
  3431. </para>
  3432. </listitem>
  3433. </varlistentry>
  3434. <varlistentry>
  3435. <term><structfield>partnumber</structfield></term>
  3436. <listitem><para>
  3437. <type>text</type>
  3438. </para>
  3439. </listitem>
  3440. </varlistentry>
  3441. <varlistentry>
  3442. <term><structfield>leadtime</structfield></term>
  3443. <listitem><para>
  3444. <type>smallint</type>
  3445. </para>
  3446. </listitem>
  3447. </varlistentry>
  3448. <varlistentry>
  3449. <term><structfield>lastcost</structfield></term>
  3450. <listitem><para>
  3451. <type>numeric</type>
  3452. </para>
  3453. </listitem>
  3454. </varlistentry>
  3455. <varlistentry>
  3456. <term><structfield>curr</structfield></term>
  3457. <listitem><para>
  3458. <type>character(3)</type>
  3459. </para>
  3460. </listitem>
  3461. </varlistentry>
  3462. <varlistentry>
  3463. <term><structfield>entry_id</structfield></term>
  3464. <listitem><para>
  3465. <type>serial</type>
  3466. <literal>PRIMARY KEY</literal>
  3467. </para>
  3468. </listitem>
  3469. </varlistentry>
  3470. </variablelist>
  3471. <variablelist>
  3472. <title>Indexes on partsvendor</title>
  3473. <varlistentry>
  3474. <term>partsvendor_parts_id_key</term>
  3475. <listitem><para>parts_id</para></listitem>
  3476. </varlistentry>
  3477. </variablelist>
  3478. </para>
  3479. </section>
  3480. <section id="public.table.person"
  3481. xreflabel="public.person">
  3482. <title id="public.table.person-title">
  3483. Table:
  3484. <structname>person</structname>
  3485. </title>
  3486. <para>
  3487. 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-&gt;entity_class_to_entity.entity_id.
  3488. </para>
  3489. <para>
  3490. <variablelist>
  3491. <title>
  3492. Structure of <structname>person</structname>
  3493. </title>
  3494. <varlistentry>
  3495. <term><structfield>id</structfield></term>
  3496. <listitem><para>
  3497. <type>serial</type>
  3498. <literal>PRIMARY KEY</literal>
  3499. </para>
  3500. </listitem>
  3501. </varlistentry>
  3502. <varlistentry>
  3503. <term><structfield>entity_id</structfield></term>
  3504. <listitem><para>
  3505. <type>integer</type>
  3506. <literal>NOT NULL</literal>
  3507. <literal>REFERENCES</literal> <xref linkend="public.table.entity"/>
  3508. </para>
  3509. </listitem>
  3510. </varlistentry>
  3511. <varlistentry>
  3512. <term><structfield>salutation_id</structfield></term>
  3513. <listitem><para>
  3514. <type>integer</type>
  3515. <literal>REFERENCES</literal> <xref linkend="public.table.salutation"/>
  3516. </para>
  3517. </listitem>
  3518. </varlistentry>
  3519. <varlistentry>
  3520. <term><structfield>first_name</structfield></term>
  3521. <listitem><para>
  3522. <type>text</type>
  3523. <literal>NOT NULL</literal>
  3524. </para>
  3525. </listitem>
  3526. </varlistentry>
  3527. <varlistentry>
  3528. <term><structfield>middle_name</structfield></term>
  3529. <listitem><para>
  3530. <type>text</type>
  3531. </para>
  3532. </listitem>
  3533. </varlistentry>
  3534. <varlistentry>
  3535. <term><structfield>last_name</structfield></term>
  3536. <listitem><para>
  3537. <type>text</type>
  3538. <literal>NOT NULL</literal>
  3539. </para>
  3540. </listitem>
  3541. </varlistentry>
  3542. <varlistentry>
  3543. <term><structfield>primary_location_id</structfield></term>
  3544. <listitem><para>
  3545. <type>integer</type>
  3546. <literal>REFERENCES</literal> <xref linkend="public.table.location"/>
  3547. </para>
  3548. </listitem>
  3549. </varlistentry>
  3550. </variablelist>
  3551. <variablelist>
  3552. <title>Constraints on person</title>
  3553. <varlistentry>
  3554. <term>person_first_name_check</term>
  3555. <listitem><para>CHECK ((first_name ~ &apos;[[:alnum:]_]&apos;::text))</para></listitem>
  3556. </varlistentry>
  3557. <varlistentry>
  3558. <term>person_last_name_check</term>
  3559. <listitem><para>CHECK ((last_name ~ &apos;[[:alnum:]_]&apos;::text))</para></listitem>
  3560. </varlistentry>
  3561. </variablelist>
  3562. <itemizedlist>
  3563. <title>
  3564. Tables referencing ap via Foreign Key Constraints
  3565. </title>
  3566. <listitem>
  3567. <para>
  3568. <xref linkend="public.table.ap"/>
  3569. </para>
  3570. </listitem>
  3571. <listitem>
  3572. <para>
  3573. <xref linkend="public.table.ar"/>
  3574. </para>
  3575. </listitem>
  3576. <listitem>
  3577. <para>
  3578. <xref linkend="public.table.audittrail"/>
  3579. </para>
  3580. </listitem>
  3581. <listitem>
  3582. <para>
  3583. <xref linkend="public.table.gl"/>
  3584. </para>
  3585. </listitem>
  3586. <listitem>
  3587. <para>
  3588. <xref linkend="public.table.inventory"/>
  3589. </para>
  3590. </listitem>
  3591. <listitem>
  3592. <para>
  3593. <xref linkend="public.table.jcitems"/>
  3594. </para>
  3595. </listitem>
  3596. <listitem>
  3597. <para>
  3598. <xref linkend="public.table.oe"/>
  3599. </para>
  3600. </listitem>
  3601. <listitem>
  3602. <para>
  3603. <xref linkend="public.table.person-to-company"/>
  3604. </para>
  3605. </listitem>
  3606. <listitem>
  3607. <para>
  3608. <xref linkend="public.table.person-to-contact"/>
  3609. </para>
  3610. </listitem>
  3611. <listitem>
  3612. <para>
  3613. <xref linkend="public.table.person-to-entity"/>
  3614. </para>
  3615. </listitem>
  3616. </itemizedlist>
  3617. </para>
  3618. </section>
  3619. <section id="public.table.person-to-company"
  3620. xreflabel="public.person_to_company">
  3621. <title id="public.table.person-to-company-title">
  3622. Table:
  3623. <structname>person_to_company</structname>
  3624. </title>
  3625. <para>
  3626. <variablelist>
  3627. <title>
  3628. Structure of <structname>person_to_company</structname>
  3629. </title>
  3630. <varlistentry>
  3631. <term><structfield>location_id</structfield></term>
  3632. <listitem><para>
  3633. <type>integer</type>
  3634. <literal>PRIMARY KEY</literal>
  3635. <literal>REFERENCES</literal> <xref linkend="public.table.location"/>
  3636. </para>
  3637. </listitem>
  3638. </varlistentry>
  3639. <varlistentry>
  3640. <term><structfield>person_id</structfield></term>
  3641. <listitem><para>
  3642. <type>integer</type>
  3643. <literal>PRIMARY KEY</literal>
  3644. <literal>REFERENCES</literal> <xref linkend="public.table.person"/>
  3645. </para>
  3646. </listitem>
  3647. </varlistentry>
  3648. </variablelist>
  3649. </para>
  3650. </section>
  3651. <section id="public.table.person-to-contact"
  3652. xreflabel="public.person_to_contact">
  3653. <title id="public.table.person-to-contact-title">
  3654. Table:
  3655. <structname>person_to_contact</structname>
  3656. </title>
  3657. <para>
  3658. To keep track of the relationship between multiple contact methods and a single individual
  3659. </para>
  3660. <para>
  3661. <variablelist>
  3662. <title>
  3663. Structure of <structname>person_to_contact</structname>
  3664. </title>
  3665. <varlistentry>
  3666. <term><structfield>person_id</structfield></term>
  3667. <listitem><para>
  3668. <type>integer</type>
  3669. <literal>PRIMARY KEY</literal>
  3670. <literal>REFERENCES</literal> <xref linkend="public.table.person"/>
  3671. </para>
  3672. </listitem>
  3673. </varlistentry>
  3674. <varlistentry>
  3675. <term><structfield>contact_class_id</structfield></term>
  3676. <listitem><para>
  3677. <type>integer</type>
  3678. <literal>PRIMARY KEY</literal>
  3679. <literal>REFERENCES</literal> <xref linkend="public.table.contact-class"/>
  3680. </para>
  3681. </listitem>
  3682. </varlistentry>
  3683. <varlistentry>
  3684. <term><structfield>contact</structfield></term>
  3685. <listitem><para>
  3686. <type>text</type>
  3687. <literal>PRIMARY KEY</literal>
  3688. </para>
  3689. </listitem>
  3690. </varlistentry>
  3691. </variablelist>
  3692. <variablelist>
  3693. <title>Constraints on person_to_contact</title>
  3694. <varlistentry>
  3695. <term>person_to_contact_contact_check</term>
  3696. <listitem><para>CHECK ((contact ~ &apos;[[:alnum:]_]&apos;::text))</para></listitem>
  3697. </varlistentry>
  3698. </variablelist>
  3699. </para>
  3700. </section>
  3701. <section id="public.table.person-to-entity"
  3702. xreflabel="public.person_to_entity">
  3703. <title id="public.table.person-to-entity-title">
  3704. Table:
  3705. <structname>person_to_entity</structname>
  3706. </title>
  3707. <para>
  3708. <variablelist>
  3709. <title>
  3710. Structure of <structname>person_to_entity</structname>
  3711. </title>
  3712. <varlistentry>
  3713. <term><structfield>person_id</structfield></term>
  3714. <listitem><para>
  3715. <type>integer</type>
  3716. <literal>PRIMARY KEY</literal>
  3717. <literal>REFERENCES</literal> <xref linkend="public.table.person"/>
  3718. </para>
  3719. </listitem>
  3720. </varlistentry>
  3721. <varlistentry>
  3722. <term><structfield>entity_id</structfield></term>
  3723. <listitem><para>
  3724. <type>integer</type>
  3725. <literal>PRIMARY KEY</literal>
  3726. <literal>REFERENCES</literal> <xref linkend="public.table.entity"/>
  3727. </para>
  3728. </listitem>
  3729. </varlistentry>
  3730. <varlistentry>
  3731. <term><structfield>related_how</structfield></term>
  3732. <listitem><para>
  3733. <type>text</type>
  3734. </para>
  3735. </listitem>
  3736. </varlistentry>
  3737. <varlistentry>
  3738. <term><structfield>created</structfield></term>
  3739. <listitem><para>
  3740. <type>date</type>
  3741. <literal>NOT NULL</literal>
  3742. <literal>DEFAULT (&apos;now&apos;::text)::date</literal>
  3743. </para>
  3744. </listitem>
  3745. </varlistentry>
  3746. </variablelist>
  3747. <variablelist>
  3748. <title>Constraints on person_to_entity</title>
  3749. <varlistentry>
  3750. <term>person_to_entity_check</term>
  3751. <listitem><para>CHECK ((entity_id &lt;&gt; person_id))</para></listitem>
  3752. </varlistentry>
  3753. </variablelist>
  3754. </para>
  3755. </section>
  3756. <section id="public.table.pricegroup"
  3757. xreflabel="public.pricegroup">
  3758. <title id="public.table.pricegroup-title">
  3759. Table:
  3760. <structname>pricegroup</structname>
  3761. </title>
  3762. <para>
  3763. <variablelist>
  3764. <title>
  3765. Structure of <structname>pricegroup</structname>
  3766. </title>
  3767. <varlistentry>
  3768. <term><structfield>id</structfield></term>
  3769. <listitem><para>
  3770. <type>serial</type>
  3771. <literal>PRIMARY KEY</literal>
  3772. </para>
  3773. </listitem>
  3774. </varlistentry>
  3775. <varlistentry>
  3776. <term><structfield>pricegroup</structfield></term>
  3777. <listitem><para>
  3778. <type>text</type>
  3779. </para>
  3780. </listitem>
  3781. </varlistentry>
  3782. </variablelist>
  3783. <variablelist>
  3784. <title>Indexes on pricegroup</title>
  3785. <varlistentry>
  3786. <term>pricegroup_id_key</term>
  3787. <listitem><para>id</para></listitem>
  3788. </varlistentry>
  3789. <varlistentry>
  3790. <term>pricegroup_pricegroup_key</term>
  3791. <listitem><para>pricegroup</para></listitem>
  3792. </varlistentry>
  3793. </variablelist>
  3794. </para>
  3795. </section>
  3796. <section id="public.table.project"
  3797. xreflabel="public.project">
  3798. <title id="public.table.project-title">
  3799. Table:
  3800. <structname>project</structname>
  3801. </title>
  3802. <para>
  3803. <variablelist>
  3804. <title>
  3805. Structure of <structname>project</structname>
  3806. </title>
  3807. <varlistentry>
  3808. <term><structfield>id</structfield></term>
  3809. <listitem><para>
  3810. <type>serial</type>
  3811. <literal>PRIMARY KEY</literal>
  3812. </para>
  3813. </listitem>
  3814. </varlistentry>
  3815. <varlistentry>
  3816. <term><structfield>projectnumber</structfield></term>
  3817. <listitem><para>
  3818. <type>text</type>
  3819. </para>
  3820. </listitem>
  3821. </varlistentry>
  3822. <varlistentry>
  3823. <term><structfield>description</structfield></term>
  3824. <listitem><para>
  3825. <type>text</type>
  3826. </para>
  3827. </listitem>
  3828. </varlistentry>
  3829. <varlistentry>
  3830. <term><structfield>startdate</structfield></term>
  3831. <listitem><para>
  3832. <type>date</type>
  3833. </para>
  3834. </listitem>
  3835. </varlistentry>
  3836. <varlistentry>
  3837. <term><structfield>enddate</structfield></term>
  3838. <listitem><para>
  3839. <type>date</type>
  3840. </para>
  3841. </listitem>
  3842. </varlistentry>
  3843. <varlistentry>
  3844. <term><structfield>parts_id</structfield></term>
  3845. <listitem><para>
  3846. <type>integer</type>
  3847. </para>
  3848. </listitem>
  3849. </varlistentry>
  3850. <varlistentry>
  3851. <term><structfield>production</structfield></term>
  3852. <listitem><para>
  3853. <type>numeric</type>
  3854. </para>
  3855. </listitem>
  3856. </varlistentry>
  3857. <varlistentry>
  3858. <term><structfield>completed</structfield></term>
  3859. <listitem><para>
  3860. <type>numeric</type>
  3861. </para>
  3862. </listitem>
  3863. </varlistentry>
  3864. <varlistentry>
  3865. <term><structfield>customer_id</structfield></term>
  3866. <listitem><para>
  3867. <type>integer</type>
  3868. </para>
  3869. </listitem>
  3870. </varlistentry>
  3871. </variablelist>
  3872. <variablelist>
  3873. <title>Indexes on project</title>
  3874. <varlistentry>
  3875. <term>project_id_key</term>
  3876. <listitem><para>id</para></listitem>
  3877. </varlistentry>
  3878. </variablelist>
  3879. </para>
  3880. </section>
  3881. <section id="public.table.recurring"
  3882. xreflabel="public.recurring">
  3883. <title id="public.table.recurring-title">
  3884. Table:
  3885. <structname>recurring</structname>
  3886. </title>
  3887. <para>
  3888. <variablelist>
  3889. <title>
  3890. Structure of <structname>recurring</structname>
  3891. </title>
  3892. <varlistentry>
  3893. <term><structfield>id</structfield></term>
  3894. <listitem><para>
  3895. <type>integer</type>
  3896. <literal>PRIMARY KEY</literal>
  3897. </para>
  3898. </listitem>
  3899. </varlistentry>
  3900. <varlistentry>
  3901. <term><structfield>reference</structfield></term>
  3902. <listitem><para>
  3903. <type>text</type>
  3904. </para>
  3905. </listitem>
  3906. </varlistentry>
  3907. <varlistentry>
  3908. <term><structfield>startdate</structfield></term>
  3909. <listitem><para>
  3910. <type>date</type>
  3911. </para>
  3912. </listitem>
  3913. </varlistentry>
  3914. <varlistentry>
  3915. <term><structfield>nextdate</structfield></term>
  3916. <listitem><para>
  3917. <type>date</type>
  3918. </para>
  3919. </listitem>
  3920. </varlistentry>
  3921. <varlistentry>
  3922. <term><structfield>enddate</structfield></term>
  3923. <listitem><para>
  3924. <type>date</type>
  3925. </para>
  3926. </listitem>
  3927. </varlistentry>
  3928. <varlistentry>
  3929. <term><structfield>repeat</structfield></term>
  3930. <listitem><para>
  3931. <type>smallint</type>
  3932. </para>
  3933. </listitem>
  3934. </varlistentry>
  3935. <varlistentry>
  3936. <term><structfield>unit</structfield></term>
  3937. <listitem><para>
  3938. <type>character varying(6)</type>
  3939. </para>
  3940. </listitem>
  3941. </varlistentry>
  3942. <varlistentry>
  3943. <term><structfield>howmany</structfield></term>
  3944. <listitem><para>
  3945. <type>integer</type>
  3946. </para>
  3947. </listitem>
  3948. </varlistentry>
  3949. <varlistentry>
  3950. <term><structfield>payment</structfield></term>
  3951. <listitem><para>
  3952. <type>boolean</type>
  3953. <literal>DEFAULT false</literal>
  3954. </para>
  3955. </listitem>
  3956. </varlistentry>
  3957. </variablelist>
  3958. </para>
  3959. </section>
  3960. <section id="public.table.recurringemail"
  3961. xreflabel="public.recurringemail">
  3962. <title id="public.table.recurringemail-title">
  3963. Table:
  3964. <structname>recurringemail</structname>
  3965. </title>
  3966. <para>
  3967. <variablelist>
  3968. <title>
  3969. Structure of <structname>recurringemail</structname>
  3970. </title>
  3971. <varlistentry>
  3972. <term><structfield>id</structfield></term>
  3973. <listitem><para>
  3974. <type>integer</type>
  3975. <literal>PRIMARY KEY</literal>
  3976. </para>
  3977. </listitem>
  3978. </varlistentry>
  3979. <varlistentry>
  3980. <term><structfield>formname</structfield></term>
  3981. <listitem><para>
  3982. <type>text</type>
  3983. </para>
  3984. </listitem>
  3985. </varlistentry>
  3986. <varlistentry>
  3987. <term><structfield>format</structfield></term>
  3988. <listitem><para>
  3989. <type>text</type>
  3990. </para>
  3991. </listitem>
  3992. </varlistentry>
  3993. <varlistentry>
  3994. <term><structfield>message</structfield></term>
  3995. <listitem><para>
  3996. <type>text</type>
  3997. </para>
  3998. </listitem>
  3999. </varlistentry>
  4000. </variablelist>
  4001. </para>
  4002. </section>
  4003. <section id="public.table.recurringprint"
  4004. xreflabel="public.recurringprint">
  4005. <title id="public.table.recurringprint-title">
  4006. Table:
  4007. <structname>recurringprint</structname>
  4008. </title>
  4009. <para>
  4010. <variablelist>
  4011. <title>
  4012. Structure of <structname>recurringprint</structname>
  4013. </title>
  4014. <varlistentry>
  4015. <term><structfield>id</structfield></term>
  4016. <listitem><para>
  4017. <type>integer</type>
  4018. <literal>PRIMARY KEY</literal>
  4019. </para>
  4020. </listitem>
  4021. </varlistentry>
  4022. <varlistentry>
  4023. <term><structfield>formname</structfield></term>
  4024. <listitem><para>
  4025. <type>text</type>
  4026. </para>
  4027. </listitem>
  4028. </varlistentry>
  4029. <varlistentry>
  4030. <term><structfield>format</structfield></term>
  4031. <listitem><para>
  4032. <type>text</type>
  4033. </para>
  4034. </listitem>
  4035. </varlistentry>
  4036. <varlistentry>
  4037. <term><structfield>printer</structfield></term>
  4038. <listitem><para>
  4039. <type>text</type>
  4040. </para>
  4041. </listitem>
  4042. </varlistentry>
  4043. </variablelist>
  4044. </para>
  4045. </section>
  4046. <section id="public.table.salutation"
  4047. xreflabel="public.salutation">
  4048. <title id="public.table.salutation-title">
  4049. Table:
  4050. <structname>salutation</structname>
  4051. </title>
  4052. <para>
  4053. <variablelist>
  4054. <title>
  4055. Structure of <structname>salutation</structname>
  4056. </title>
  4057. <varlistentry>
  4058. <term><structfield>id</structfield></term>
  4059. <listitem><para>
  4060. <type>serial</type>
  4061. <literal>UNIQUE</literal>
  4062. <literal>NOT NULL</literal>
  4063. </para>
  4064. </listitem>
  4065. </varlistentry>
  4066. <varlistentry>
  4067. <term><structfield>salutation</structfield></term>
  4068. <listitem><para>
  4069. <type>text</type>
  4070. <literal>PRIMARY KEY</literal>
  4071. </para>
  4072. </listitem>
  4073. </varlistentry>
  4074. </variablelist>
  4075. <itemizedlist>
  4076. <title>
  4077. Tables referencing person via Foreign Key Constraints
  4078. </title>
  4079. <listitem>
  4080. <para>
  4081. <xref linkend="public.table.person"/>
  4082. </para>
  4083. </listitem>
  4084. </itemizedlist>
  4085. </para>
  4086. </section>
  4087. <section id="public.table.shipto"
  4088. xreflabel="public.shipto">
  4089. <title id="public.table.shipto-title">
  4090. Table:
  4091. <structname>shipto</structname>
  4092. </title>
  4093. <para>
  4094. <variablelist>
  4095. <title>
  4096. Structure of <structname>shipto</structname>
  4097. </title>
  4098. <varlistentry>
  4099. <term><structfield>trans_id</structfield></term>
  4100. <listitem><para>
  4101. <type>integer</type>
  4102. </para>
  4103. </listitem>
  4104. </varlistentry>
  4105. <varlistentry>
  4106. <term><structfield>shiptoname</structfield></term>
  4107. <listitem><para>
  4108. <type>character varying(64)</type>
  4109. </para>
  4110. </listitem>
  4111. </varlistentry>
  4112. <varlistentry>
  4113. <term><structfield>shiptoaddress1</structfield></term>
  4114. <listitem><para>
  4115. <type>character varying(32)</type>
  4116. </para>
  4117. </listitem>
  4118. </varlistentry>
  4119. <varlistentry>
  4120. <term><structfield>shiptoaddress2</structfield></term>
  4121. <listitem><para>
  4122. <type>character varying(32)</type>
  4123. </para>
  4124. </listitem>
  4125. </varlistentry>
  4126. <varlistentry>
  4127. <term><structfield>shiptocity</structfield></term>
  4128. <listitem><para>
  4129. <type>character varying(32)</type>
  4130. </para>
  4131. </listitem>
  4132. </varlistentry>
  4133. <varlistentry>
  4134. <term><structfield>shiptostate</structfield></term>
  4135. <listitem><para>
  4136. <type>character varying(32)</type>
  4137. </para>
  4138. </listitem>
  4139. </varlistentry>
  4140. <varlistentry>
  4141. <term><structfield>shiptozipcode</structfield></term>
  4142. <listitem><para>
  4143. <type>character varying(10)</type>
  4144. </para>
  4145. </listitem>
  4146. </varlistentry>
  4147. <varlistentry>
  4148. <term><structfield>shiptocountry</structfield></term>
  4149. <listitem><para>
  4150. <type>character varying(32)</type>
  4151. </para>
  4152. </listitem>
  4153. </varlistentry>
  4154. <varlistentry>
  4155. <term><structfield>shiptocontact</structfield></term>
  4156. <listitem><para>
  4157. <type>character varying(64)</type>
  4158. </para>
  4159. </listitem>
  4160. </varlistentry>
  4161. <varlistentry>
  4162. <term><structfield>shiptophone</structfield></term>
  4163. <listitem><para>
  4164. <type>character varying(20)</type>
  4165. </para>
  4166. </listitem>
  4167. </varlistentry>
  4168. <varlistentry>
  4169. <term><structfield>shiptofax</structfield></term>
  4170. <listitem><para>
  4171. <type>character varying(20)</type>
  4172. </para>
  4173. </listitem>
  4174. </varlistentry>
  4175. <varlistentry>
  4176. <term><structfield>shiptoemail</structfield></term>
  4177. <listitem><para>
  4178. <type>text</type>
  4179. </para>
  4180. </listitem>
  4181. </varlistentry>
  4182. <varlistentry>
  4183. <term><structfield>entry_id</structfield></term>
  4184. <listitem><para>
  4185. <type>serial</type>
  4186. <literal>PRIMARY KEY</literal>
  4187. </para>
  4188. </listitem>
  4189. </varlistentry>
  4190. </variablelist>
  4191. <variablelist>
  4192. <title>Indexes on shipto</title>
  4193. <varlistentry>
  4194. <term>shipto_trans_id_key</term>
  4195. <listitem><para>trans_id</para></listitem>
  4196. </varlistentry>
  4197. </variablelist>
  4198. </para>
  4199. </section>
  4200. <section id="public.table.sic"
  4201. xreflabel="public.sic">
  4202. <title id="public.table.sic-title">
  4203. Table:
  4204. <structname>sic</structname>
  4205. </title>
  4206. <para>
  4207. <variablelist>
  4208. <title>
  4209. Structure of <structname>sic</structname>
  4210. </title>
  4211. <varlistentry>
  4212. <term><structfield>code</structfield></term>
  4213. <listitem><para>
  4214. <type>character varying(6)</type>
  4215. <literal>PRIMARY KEY</literal>
  4216. </para>
  4217. </listitem>
  4218. </varlistentry>
  4219. <varlistentry>
  4220. <term><structfield>sictype</structfield></term>
  4221. <listitem><para>
  4222. <type>character(1)</type>
  4223. </para>
  4224. </listitem>
  4225. </varlistentry>
  4226. <varlistentry>
  4227. <term><structfield>description</structfield></term>
  4228. <listitem><para>
  4229. <type>text</type>
  4230. </para>
  4231. </listitem>
  4232. </varlistentry>
  4233. </variablelist>
  4234. </para>
  4235. </section>
  4236. <section id="public.table.status"
  4237. xreflabel="public.status">
  4238. <title id="public.table.status-title">
  4239. Table:
  4240. <structname>status</structname>
  4241. </title>
  4242. <para>
  4243. <variablelist>
  4244. <title>
  4245. Structure of <structname>status</structname>
  4246. </title>
  4247. <varlistentry>
  4248. <term><structfield>trans_id</structfield></term>
  4249. <listitem><para>
  4250. <type>integer</type>
  4251. <literal>PRIMARY KEY</literal>
  4252. </para>
  4253. </listitem>
  4254. </varlistentry>
  4255. <varlistentry>
  4256. <term><structfield>formname</structfield></term>
  4257. <listitem><para>
  4258. <type>text</type>
  4259. </para>
  4260. </listitem>
  4261. </varlistentry>
  4262. <varlistentry>
  4263. <term><structfield>printed</structfield></term>
  4264. <listitem><para>
  4265. <type>boolean</type>
  4266. <literal>DEFAULT false</literal>
  4267. </para>
  4268. </listitem>
  4269. </varlistentry>
  4270. <varlistentry>
  4271. <term><structfield>emailed</structfield></term>
  4272. <listitem><para>
  4273. <type>boolean</type>
  4274. <literal>DEFAULT false</literal>
  4275. </para>
  4276. </listitem>
  4277. </varlistentry>
  4278. <varlistentry>
  4279. <term><structfield>spoolfile</structfield></term>
  4280. <listitem><para>
  4281. <type>text</type>
  4282. </para>
  4283. </listitem>
  4284. </varlistentry>
  4285. </variablelist>
  4286. <variablelist>
  4287. <title>Indexes on status</title>
  4288. <varlistentry>
  4289. <term>status_trans_id_key</term>
  4290. <listitem><para>trans_id</para></listitem>
  4291. </varlistentry>
  4292. </variablelist>
  4293. </para>
  4294. </section>
  4295. <section id="public.table.tax"
  4296. xreflabel="public.tax">
  4297. <title id="public.table.tax-title">
  4298. Table:
  4299. <structname>tax</structname>
  4300. </title>
  4301. <para>
  4302. <variablelist>
  4303. <title>
  4304. Structure of <structname>tax</structname>
  4305. </title>
  4306. <varlistentry>
  4307. <term><structfield>chart_id</structfield></term>
  4308. <listitem><para>
  4309. <type>integer</type>
  4310. <literal>PRIMARY KEY</literal>
  4311. <literal>REFERENCES</literal> <xref linkend="public.table.chart"/>
  4312. </para>
  4313. </listitem>
  4314. </varlistentry>
  4315. <varlistentry>
  4316. <term><structfield>rate</structfield></term>
  4317. <listitem><para>
  4318. <type>numeric</type>
  4319. </para>
  4320. </listitem>
  4321. </varlistentry>
  4322. <varlistentry>
  4323. <term><structfield>taxnumber</structfield></term>
  4324. <listitem><para>
  4325. <type>text</type>
  4326. </para>
  4327. </listitem>
  4328. </varlistentry>
  4329. <varlistentry>
  4330. <term><structfield>validto</structfield></term>
  4331. <listitem><para>
  4332. <type>date</type>
  4333. </para>
  4334. </listitem>
  4335. </varlistentry>
  4336. <varlistentry>
  4337. <term><structfield>pass</structfield></term>
  4338. <listitem><para>
  4339. <type>integer</type>
  4340. <literal>NOT NULL</literal>
  4341. </para>
  4342. </listitem>
  4343. </varlistentry>
  4344. <varlistentry>
  4345. <term><structfield>taxmodule_id</structfield></term>
  4346. <listitem><para>
  4347. <type>integer</type>
  4348. <literal>NOT NULL</literal>
  4349. <literal>DEFAULT 1</literal>
  4350. <literal>REFERENCES</literal> <xref linkend="public.table.taxmodule"/>
  4351. </para>
  4352. </listitem>
  4353. </varlistentry>
  4354. </variablelist>
  4355. </para>
  4356. </section>
  4357. <section id="public.table.taxcategory"
  4358. xreflabel="public.taxcategory">
  4359. <title id="public.table.taxcategory-title">
  4360. Table:
  4361. <structname>taxcategory</structname>
  4362. </title>
  4363. <para>
  4364. <variablelist>
  4365. <title>
  4366. Structure of <structname>taxcategory</structname>
  4367. </title>
  4368. <varlistentry>
  4369. <term><structfield>taxcategory_id</structfield></term>
  4370. <listitem><para>
  4371. <type>serial</type>
  4372. <literal>PRIMARY KEY</literal>
  4373. </para>
  4374. </listitem>
  4375. </varlistentry>
  4376. <varlistentry>
  4377. <term><structfield>taxcategoryname</structfield></term>
  4378. <listitem><para>
  4379. <type>text</type>
  4380. <literal>NOT NULL</literal>
  4381. </para>
  4382. </listitem>
  4383. </varlistentry>
  4384. <varlistentry>
  4385. <term><structfield>taxmodule_id</structfield></term>
  4386. <listitem><para>
  4387. <type>integer</type>
  4388. <literal>NOT NULL</literal>
  4389. <literal>REFERENCES</literal> <xref linkend="public.table.taxmodule"/>
  4390. </para>
  4391. </listitem>
  4392. </varlistentry>
  4393. </variablelist>
  4394. <itemizedlist>
  4395. <title>
  4396. Tables referencing partstax via Foreign Key Constraints
  4397. </title>
  4398. <listitem>
  4399. <para>
  4400. <xref linkend="public.table.partstax"/>
  4401. </para>
  4402. </listitem>
  4403. </itemizedlist>
  4404. </para>
  4405. </section>
  4406. <section id="public.table.taxmodule"
  4407. xreflabel="public.taxmodule">
  4408. <title id="public.table.taxmodule-title">
  4409. Table:
  4410. <structname>taxmodule</structname>
  4411. </title>
  4412. <para>
  4413. <variablelist>
  4414. <title>
  4415. Structure of <structname>taxmodule</structname>
  4416. </title>
  4417. <varlistentry>
  4418. <term><structfield>taxmodule_id</structfield></term>
  4419. <listitem><para>
  4420. <type>serial</type>
  4421. <literal>PRIMARY KEY</literal>
  4422. </para>
  4423. </listitem>
  4424. </varlistentry>
  4425. <varlistentry>
  4426. <term><structfield>taxmodulename</structfield></term>
  4427. <listitem><para>
  4428. <type>text</type>
  4429. <literal>NOT NULL</literal>
  4430. </para>
  4431. </listitem>
  4432. </varlistentry>
  4433. </variablelist>
  4434. <itemizedlist>
  4435. <title>
  4436. Tables referencing tax via Foreign Key Constraints
  4437. </title>
  4438. <listitem>
  4439. <para>
  4440. <xref linkend="public.table.tax"/>
  4441. </para>
  4442. </listitem>
  4443. <listitem>
  4444. <para>
  4445. <xref linkend="public.table.taxcategory"/>
  4446. </para>
  4447. </listitem>
  4448. </itemizedlist>
  4449. </para>
  4450. </section>
  4451. <section id="public.table.transactions"
  4452. xreflabel="public.transactions">
  4453. <title id="public.table.transactions-title">
  4454. Table:
  4455. <structname>transactions</structname>
  4456. </title>
  4457. <para>
  4458. <variablelist>
  4459. <title>
  4460. Structure of <structname>transactions</structname>
  4461. </title>
  4462. <varlistentry>
  4463. <term><structfield>id</structfield></term>
  4464. <listitem><para>
  4465. <type>integer</type>
  4466. <literal>PRIMARY KEY</literal>
  4467. </para>
  4468. </listitem>
  4469. </varlistentry>
  4470. <varlistentry>
  4471. <term><structfield>table_name</structfield></term>
  4472. <listitem><para>
  4473. <type>text</type>
  4474. </para>
  4475. </listitem>
  4476. </varlistentry>
  4477. </variablelist>
  4478. </para>
  4479. </section>
  4480. <section id="public.table.translation"
  4481. xreflabel="public.translation">
  4482. <title id="public.table.translation-title">
  4483. Table:
  4484. <structname>translation</structname>
  4485. </title>
  4486. <para>
  4487. <variablelist>
  4488. <title>
  4489. Structure of <structname>translation</structname>
  4490. </title>
  4491. <varlistentry>
  4492. <term><structfield>trans_id</structfield></term>
  4493. <listitem><para>
  4494. <type>integer</type>
  4495. <literal>PRIMARY KEY</literal>
  4496. </para>
  4497. </listitem>
  4498. </varlistentry>
  4499. <varlistentry>
  4500. <term><structfield>language_code</structfield></term>
  4501. <listitem><para>
  4502. <type>character varying(6)</type>
  4503. <literal>PRIMARY KEY</literal>
  4504. </para>
  4505. </listitem>
  4506. </varlistentry>
  4507. <varlistentry>
  4508. <term><structfield>description</structfield></term>
  4509. <listitem><para>
  4510. <type>text</type>
  4511. </para>
  4512. </listitem>
  4513. </varlistentry>
  4514. </variablelist>
  4515. <variablelist>
  4516. <title>Indexes on translation</title>
  4517. <varlistentry>
  4518. <term>translation_trans_id_key</term>
  4519. <listitem><para>trans_id</para></listitem>
  4520. </varlistentry>
  4521. </variablelist>
  4522. </para>
  4523. </section>
  4524. <section id="public.table.vendor"
  4525. xreflabel="public.vendor">
  4526. <title id="public.table.vendor-title">
  4527. Table:
  4528. <structname>vendor</structname>
  4529. </title>
  4530. <para>
  4531. Now a meta data table
  4532. </para>
  4533. <para>
  4534. <variablelist>
  4535. <title>
  4536. Structure of <structname>vendor</structname>
  4537. </title>
  4538. <varlistentry>
  4539. <term><structfield>id</structfield></term>
  4540. <listitem><para>
  4541. <type>serial</type>
  4542. <literal>PRIMARY KEY</literal>
  4543. </para>
  4544. </listitem>
  4545. </varlistentry>
  4546. <varlistentry>
  4547. <term><structfield>entity_id</structfield></term>
  4548. <listitem><para>
  4549. <type>integer</type>
  4550. <literal>NOT NULL</literal>
  4551. <literal>REFERENCES</literal> <xref linkend="public.table.entity"/>
  4552. </para>
  4553. </listitem>
  4554. </varlistentry>
  4555. <varlistentry>
  4556. <term><structfield>terms</structfield></term>
  4557. <listitem><para>
  4558. <type>smallint</type>
  4559. </para>
  4560. </listitem>
  4561. </varlistentry>
  4562. <varlistentry>
  4563. <term><structfield>taxincluded</structfield></term>
  4564. <listitem><para>
  4565. <type>boolean</type>
  4566. <literal>DEFAULT false</literal>
  4567. </para>
  4568. </listitem>
  4569. </varlistentry>
  4570. <varlistentry>
  4571. <term><structfield>vendornumber</structfield></term>
  4572. <listitem><para>
  4573. <type>character varying(32)</type>
  4574. </para>
  4575. </listitem>
  4576. </varlistentry>
  4577. <varlistentry>
  4578. <term><structfield>cc</structfield></term>
  4579. <listitem><para>
  4580. <type>text</type>
  4581. </para>
  4582. </listitem>
  4583. </varlistentry>
  4584. <varlistentry>
  4585. <term><structfield>bcc</structfield></term>
  4586. <listitem><para>
  4587. <type>text</type>
  4588. </para>
  4589. </listitem>
  4590. </varlistentry>
  4591. <varlistentry>
  4592. <term><structfield>gifi_accno</structfield></term>
  4593. <listitem><para>
  4594. <type>character varying(30)</type>
  4595. </para>
  4596. </listitem>
  4597. </varlistentry>
  4598. <varlistentry>
  4599. <term><structfield>business_id</structfield></term>
  4600. <listitem><para>
  4601. <type>integer</type>
  4602. </para>
  4603. </listitem>
  4604. </varlistentry>
  4605. <varlistentry>
  4606. <term><structfield>taxnumber</structfield></term>
  4607. <listitem><para>
  4608. <type>character varying(32)</type>
  4609. </para>
  4610. </listitem>
  4611. </varlistentry>
  4612. <varlistentry>
  4613. <term><structfield>sic_code</structfield></term>
  4614. <listitem><para>
  4615. <type>character varying(6)</type>
  4616. </para>
  4617. </listitem>
  4618. </varlistentry>
  4619. <varlistentry>
  4620. <term><structfield>discount</structfield></term>
  4621. <listitem><para>
  4622. <type>numeric</type>
  4623. </para>
  4624. </listitem>
  4625. </varlistentry>
  4626. <varlistentry>
  4627. <term><structfield>creditlimit</structfield></term>
  4628. <listitem><para>
  4629. <type>numeric</type>
  4630. </para>
  4631. </listitem>
  4632. </varlistentry>
  4633. <varlistentry>
  4634. <term><structfield>iban</structfield></term>
  4635. <listitem><para>
  4636. <type>character varying(34)</type>
  4637. </para>
  4638. </listitem>
  4639. </varlistentry>
  4640. <varlistentry>
  4641. <term><structfield>bic</structfield></term>
  4642. <listitem><para>
  4643. <type>character varying(11)</type>
  4644. </para>
  4645. </listitem>
  4646. </varlistentry>
  4647. <varlistentry>
  4648. <term><structfield>language_code</structfield></term>
  4649. <listitem><para>
  4650. <type>character varying(6)</type>
  4651. </para>
  4652. </listitem>
  4653. </varlistentry>
  4654. <varlistentry>
  4655. <term><structfield>pricegroup_id</structfield></term>
  4656. <listitem><para>
  4657. <type>integer</type>
  4658. </para>
  4659. </listitem>
  4660. </varlistentry>
  4661. <varlistentry>
  4662. <term><structfield>curr</structfield></term>
  4663. <listitem><para>
  4664. <type>character(3)</type>
  4665. </para>
  4666. </listitem>
  4667. </varlistentry>
  4668. <varlistentry>
  4669. <term><structfield>startdate</structfield></term>
  4670. <listitem><para>
  4671. <type>date</type>
  4672. </para>
  4673. </listitem>
  4674. </varlistentry>
  4675. <varlistentry>
  4676. <term><structfield>enddate</structfield></term>
  4677. <listitem><para>
  4678. <type>date</type>
  4679. </para>
  4680. </listitem>
  4681. </varlistentry>
  4682. </variablelist>
  4683. <variablelist>
  4684. <title>Indexes on vendor</title>
  4685. <varlistentry>
  4686. <term>vendor_id_key</term>
  4687. <listitem><para>id</para></listitem>
  4688. </varlistentry>
  4689. <varlistentry>
  4690. <term>vendor_vendornumber_key</term>
  4691. <listitem><para>vendornumber</para></listitem>
  4692. </varlistentry>
  4693. </variablelist>
  4694. </para>
  4695. </section>
  4696. <section id="public.table.vendortax"
  4697. xreflabel="public.vendortax">
  4698. <title id="public.table.vendortax-title">
  4699. Table:
  4700. <structname>vendortax</structname>
  4701. </title>
  4702. <para>
  4703. <variablelist>
  4704. <title>
  4705. Structure of <structname>vendortax</structname>
  4706. </title>
  4707. <varlistentry>
  4708. <term><structfield>vendor_id</structfield></term>
  4709. <listitem><para>
  4710. <type>integer</type>
  4711. <literal>PRIMARY KEY</literal>
  4712. </para>
  4713. </listitem>
  4714. </varlistentry>
  4715. <varlistentry>
  4716. <term><structfield>chart_id</structfield></term>
  4717. <listitem><para>
  4718. <type>integer</type>
  4719. <literal>PRIMARY KEY</literal>
  4720. </para>
  4721. </listitem>
  4722. </varlistentry>
  4723. </variablelist>
  4724. </para>
  4725. </section>
  4726. <section id="public.table.warehouse"
  4727. xreflabel="public.warehouse">
  4728. <title id="public.table.warehouse-title">
  4729. Table:
  4730. <structname>warehouse</structname>
  4731. </title>
  4732. <para>
  4733. <variablelist>
  4734. <title>
  4735. Structure of <structname>warehouse</structname>
  4736. </title>
  4737. <varlistentry>
  4738. <term><structfield>id</structfield></term>
  4739. <listitem><para>
  4740. <type>serial</type>
  4741. <literal>PRIMARY KEY</literal>
  4742. </para>
  4743. </listitem>
  4744. </varlistentry>
  4745. <varlistentry>
  4746. <term><structfield>description</structfield></term>
  4747. <listitem><para>
  4748. <type>text</type>
  4749. </para>
  4750. </listitem>
  4751. </varlistentry>
  4752. </variablelist>
  4753. </para>
  4754. </section>
  4755. <section id="public.table.yearend"
  4756. xreflabel="public.yearend">
  4757. <title id="public.table.yearend-title">
  4758. Table:
  4759. <structname>yearend</structname>
  4760. </title>
  4761. <para>
  4762. <variablelist>
  4763. <title>
  4764. Structure of <structname>yearend</structname>
  4765. </title>
  4766. <varlistentry>
  4767. <term><structfield>trans_id</structfield></term>
  4768. <listitem><para>
  4769. <type>integer</type>
  4770. <literal>PRIMARY KEY</literal>
  4771. </para>
  4772. </listitem>
  4773. </varlistentry>
  4774. <varlistentry>
  4775. <term><structfield>transdate</structfield></term>
  4776. <listitem><para>
  4777. <type>date</type>
  4778. </para>
  4779. </listitem>
  4780. </varlistentry>
  4781. </variablelist>
  4782. </para>
  4783. </section>
  4784. <!-- Function add_custom_field( character varying, character varying, character varying ) -->
  4785. <section id="public.function.add-custom-field-character-varying-character-varying-character-varying"
  4786. xreflabel="publicadd_custom_field( character varying, character varying, character varying )">
  4787. <title id="public.function.add-custom-field-character-varying-character-varying-character-varying-title">
  4788. add_custom_field( character varying, character varying, character varying )
  4789. </title>
  4790. <titleabbrev id="public.function.add-custom-field-character-varying-character-varying-character-varying-titleabbrev">
  4791. add_custom_field( character varying, character varying, character varying )
  4792. </titleabbrev>
  4793. <para>
  4794. <segmentedlist>
  4795. <title>Function Properties</title>
  4796. <?dbhtml list-presentation="list"?>
  4797. <segtitle>Language</segtitle>
  4798. <segtitle>Return Type</segtitle>
  4799. <seglistitem>
  4800. <seg>PLPGSQL</seg>
  4801. <seg>boolean</seg>
  4802. </seglistitem>
  4803. </segmentedlist>
  4804. <programlisting>
  4805. DECLARE
  4806. table_name ALIAS FOR $1;
  4807. new_field_name ALIAS FOR $2;
  4808. field_datatype ALIAS FOR $3;
  4809. BEGIN
  4810. EXECUTE &#39;SELECT TABLE_ID FROM custom_table_catalog
  4811. WHERE extends = &#39;&#39;&#39; || table_name || &#39;&#39;&#39; &#39;;
  4812. IF NOT FOUND THEN
  4813. BEGIN
  4814. INSERT INTO custom_table_catalog (extends)
  4815. VALUES (table_name);
  4816. EXECUTE &#39;CREATE TABLE custom_&#39;||table_name ||
  4817. &#39; (row_id INT PRIMARY KEY)&#39;;
  4818. EXCEPTION WHEN duplicate_table THEN
  4819. -- do nothing
  4820. END;
  4821. END IF;
  4822. EXECUTE &#39;INSERT INTO custom_field_catalog (field_name, table_id)
  4823. VALUES ( &#39;&#39;&#39; || new_field_name ||&#39;&#39;&#39;, (SELECT table_id FROM custom_table_catalog
  4824. WHERE extends = &#39;&#39;&#39;|| table_name || &#39;&#39;&#39;))&#39;;
  4825. EXECUTE &#39;ALTER TABLE custom_&#39;||table_name || &#39; ADD COLUMN &#39;
  4826. || new_field_name || &#39; &#39; || field_datatype;
  4827. RETURN TRUE;
  4828. END;
  4829. </programlisting>
  4830. </para>
  4831. </section>
  4832. <!-- Function avgcost( integer ) -->
  4833. <section id="public.function.avgcost-integer"
  4834. xreflabel="publicavgcost( integer )">
  4835. <title id="public.function.avgcost-integer-title">
  4836. avgcost( integer )
  4837. </title>
  4838. <titleabbrev id="public.function.avgcost-integer-titleabbrev">
  4839. avgcost( integer )
  4840. </titleabbrev>
  4841. <para>
  4842. <segmentedlist>
  4843. <title>Function Properties</title>
  4844. <?dbhtml list-presentation="list"?>
  4845. <segtitle>Language</segtitle>
  4846. <segtitle>Return Type</segtitle>
  4847. <seglistitem>
  4848. <seg>PLPGSQL</seg>
  4849. <seg>double precision</seg>
  4850. </seglistitem>
  4851. </segmentedlist>
  4852. <programlisting>
  4853. DECLARE
  4854. v_cost float;
  4855. v_qty float;
  4856. v_parts_id alias for $1;
  4857. BEGIN
  4858. SELECT INTO v_cost, v_qty SUM(i.sellprice * i.qty), SUM(i.qty)
  4859. FROM invoice i
  4860. JOIN ap a ON (a.id = i.trans_id)
  4861. WHERE i.parts_id = v_parts_id;
  4862. IF v_cost IS NULL THEN
  4863. v_cost := 0;
  4864. END IF;
  4865. IF NOT v_qty IS NULL THEN
  4866. IF v_qty = 0 THEN
  4867. v_cost := 0;
  4868. ELSE
  4869. v_cost := v_cost/v_qty;
  4870. END IF;
  4871. END IF;
  4872. RETURN v_cost;
  4873. END;
  4874. </programlisting>
  4875. </para>
  4876. </section>
  4877. <!-- Function check_department( ) -->
  4878. <section id="public.function.check-department"
  4879. xreflabel="publiccheck_department( )">
  4880. <title id="public.function.check-department-title">
  4881. check_department( )
  4882. </title>
  4883. <titleabbrev id="public.function.check-department-titleabbrev">
  4884. check_department( )
  4885. </titleabbrev>
  4886. <para>
  4887. <segmentedlist>
  4888. <title>Function Properties</title>
  4889. <?dbhtml list-presentation="list"?>
  4890. <segtitle>Language</segtitle>
  4891. <segtitle>Return Type</segtitle>
  4892. <seglistitem>
  4893. <seg>PLPGSQL</seg>
  4894. <seg>&quot;trigger&quot;</seg>
  4895. </seglistitem>
  4896. </segmentedlist>
  4897. <programlisting>
  4898. declare
  4899. dpt_id int;
  4900. begin
  4901. if new.department_id = 0 then
  4902. delete from dpt_trans where trans_id = new.id;
  4903. return NULL;
  4904. end if;
  4905. select into dpt_id trans_id from dpt_trans where trans_id = new.id;
  4906. if dpt_id &gt; 0 then
  4907. update dpt_trans set department_id = new.department_id where trans_id = dpt_id;
  4908. else
  4909. insert into dpt_trans (trans_id, department_id) values (new.id, new.department_id);
  4910. end if;
  4911. return NULL;
  4912. end;
  4913. </programlisting>
  4914. </para>
  4915. </section>
  4916. <!-- Function check_inventory( ) -->
  4917. <section id="public.function.check-inventory"
  4918. xreflabel="publiccheck_inventory( )">
  4919. <title id="public.function.check-inventory-title">
  4920. check_inventory( )
  4921. </title>
  4922. <titleabbrev id="public.function.check-inventory-titleabbrev">
  4923. check_inventory( )
  4924. </titleabbrev>
  4925. <para>
  4926. <segmentedlist>
  4927. <title>Function Properties</title>
  4928. <?dbhtml list-presentation="list"?>
  4929. <segtitle>Language</segtitle>
  4930. <segtitle>Return Type</segtitle>
  4931. <seglistitem>
  4932. <seg>PLPGSQL</seg>
  4933. <seg>&quot;trigger&quot;</seg>
  4934. </seglistitem>
  4935. </segmentedlist>
  4936. <programlisting>
  4937. declare
  4938. itemid int;
  4939. row_data inventory%rowtype;
  4940. begin
  4941. if not old.quotation then
  4942. for row_data in select * from inventory where trans_id = old.id loop
  4943. select into itemid id from orderitems where trans_id = old.id and id = row_data.orderitems_id;
  4944. if itemid is null then
  4945. delete from inventory where trans_id = old.id and orderitems_id = row_data.orderitems_id;
  4946. end if;
  4947. end loop;
  4948. end if;
  4949. return old;
  4950. end;
  4951. </programlisting>
  4952. </para>
  4953. </section>
  4954. <!-- Function del_customer( ) -->
  4955. <section id="public.function.del-customer"
  4956. xreflabel="publicdel_customer( )">
  4957. <title id="public.function.del-customer-title">
  4958. del_customer( )
  4959. </title>
  4960. <titleabbrev id="public.function.del-customer-titleabbrev">
  4961. del_customer( )
  4962. </titleabbrev>
  4963. <para>
  4964. <segmentedlist>
  4965. <title>Function Properties</title>
  4966. <?dbhtml list-presentation="list"?>
  4967. <segtitle>Language</segtitle>
  4968. <segtitle>Return Type</segtitle>
  4969. <seglistitem>
  4970. <seg>PLPGSQL</seg>
  4971. <seg>&quot;trigger&quot;</seg>
  4972. </seglistitem>
  4973. </segmentedlist>
  4974. <programlisting>
  4975. begin
  4976. delete from shipto where trans_id = old.id;
  4977. delete from customertax where customer_id = old.id;
  4978. delete from partscustomer where customer_id = old.id;
  4979. return NULL;
  4980. end;
  4981. </programlisting>
  4982. </para>
  4983. </section>
  4984. <!-- Function del_department( ) -->
  4985. <section id="public.function.del-department"
  4986. xreflabel="publicdel_department( )">
  4987. <title id="public.function.del-department-title">
  4988. del_department( )
  4989. </title>
  4990. <titleabbrev id="public.function.del-department-titleabbrev">
  4991. del_department( )
  4992. </titleabbrev>
  4993. <para>
  4994. <segmentedlist>
  4995. <title>Function Properties</title>
  4996. <?dbhtml list-presentation="list"?>
  4997. <segtitle>Language</segtitle>
  4998. <segtitle>Return Type</segtitle>
  4999. <seglistitem>
  5000. <seg>PLPGSQL</seg>
  5001. <seg>&quot;trigger&quot;</seg>
  5002. </seglistitem>
  5003. </segmentedlist>
  5004. <programlisting>
  5005. begin
  5006. delete from dpt_trans where trans_id = old.id;
  5007. return NULL;
  5008. end;
  5009. </programlisting>
  5010. </para>
  5011. </section>
  5012. <!-- Function del_exchangerate( ) -->
  5013. <section id="public.function.del-exchangerate"
  5014. xreflabel="publicdel_exchangerate( )">
  5015. <title id="public.function.del-exchangerate-title">
  5016. del_exchangerate( )
  5017. </title>
  5018. <titleabbrev id="public.function.del-exchangerate-titleabbrev">
  5019. del_exchangerate( )
  5020. </titleabbrev>
  5021. <para>
  5022. <segmentedlist>
  5023. <title>Function Properties</title>
  5024. <?dbhtml list-presentation="list"?>
  5025. <segtitle>Language</segtitle>
  5026. <segtitle>Return Type</segtitle>
  5027. <seglistitem>
  5028. <seg>PLPGSQL</seg>
  5029. <seg>&quot;trigger&quot;</seg>
  5030. </seglistitem>
  5031. </segmentedlist>
  5032. <programlisting>
  5033. declare
  5034. t_transdate date;
  5035. t_curr char(3);
  5036. t_id int;
  5037. d_curr text;
  5038. begin
  5039. select into d_curr substr(value,1,3) from defaults where setting_key = &#39;curr&#39;;
  5040. if TG_RELNAME = &#39;ar&#39; then
  5041. select into t_curr, t_transdate curr, transdate from ar where id = old.id;
  5042. end if;
  5043. if TG_RELNAME = &#39;ap&#39; then
  5044. select into t_curr, t_transdate curr, transdate from ap where id = old.id;
  5045. end if;
  5046. if TG_RELNAME = &#39;oe&#39; then
  5047. select into t_curr, t_transdate curr, transdate from oe where id = old.id;
  5048. end if;
  5049. if d_curr != t_curr then
  5050. select into t_id a.id from acc_trans ac
  5051. join ar a on (a.id = ac.trans_id)
  5052. where a.curr = t_curr
  5053. and ac.transdate = t_transdate
  5054. except select a.id from ar a where a.id = old.id
  5055. union
  5056. select a.id from acc_trans ac
  5057. join ap a on (a.id = ac.trans_id)
  5058. where a.curr = t_curr
  5059. and ac.transdate = t_transdate
  5060. except select a.id from ap a where a.id = old.id
  5061. union
  5062. select o.id from oe o
  5063. where o.curr = t_curr
  5064. and o.transdate = t_transdate
  5065. except select o.id from oe o where o.id = old.id;
  5066. if not found then
  5067. delete from exchangerate where curr = t_curr and transdate = t_transdate;
  5068. end if;
  5069. end if;
  5070. return old;
  5071. end;
  5072. </programlisting>
  5073. </para>
  5074. </section>
  5075. <!-- Function del_recurring( ) -->
  5076. <section id="public.function.del-recurring"
  5077. xreflabel="publicdel_recurring( )">
  5078. <title id="public.function.del-recurring-title">
  5079. del_recurring( )
  5080. </title>
  5081. <titleabbrev id="public.function.del-recurring-titleabbrev">
  5082. del_recurring( )
  5083. </titleabbrev>
  5084. <para>
  5085. <segmentedlist>
  5086. <title>Function Properties</title>
  5087. <?dbhtml list-presentation="list"?>
  5088. <segtitle>Language</segtitle>
  5089. <segtitle>Return Type</segtitle>
  5090. <seglistitem>
  5091. <seg>PLPGSQL</seg>
  5092. <seg>&quot;trigger&quot;</seg>
  5093. </seglistitem>
  5094. </segmentedlist>
  5095. <programlisting>
  5096. BEGIN
  5097. DELETE FROM recurring WHERE id = old.id;
  5098. DELETE FROM recurringemail WHERE id = old.id;
  5099. DELETE FROM recurringprint WHERE id = old.id;
  5100. RETURN NULL;
  5101. END;
  5102. </programlisting>
  5103. </para>
  5104. </section>
  5105. <!-- Function del_vendor( ) -->
  5106. <section id="public.function.del-vendor"
  5107. xreflabel="publicdel_vendor( )">
  5108. <title id="public.function.del-vendor-title">
  5109. del_vendor( )
  5110. </title>
  5111. <titleabbrev id="public.function.del-vendor-titleabbrev">
  5112. del_vendor( )
  5113. </titleabbrev>
  5114. <para>
  5115. <segmentedlist>
  5116. <title>Function Properties</title>
  5117. <?dbhtml list-presentation="list"?>
  5118. <segtitle>Language</segtitle>
  5119. <segtitle>Return Type</segtitle>
  5120. <seglistitem>
  5121. <seg>PLPGSQL</seg>
  5122. <seg>&quot;trigger&quot;</seg>
  5123. </seglistitem>
  5124. </segmentedlist>
  5125. <programlisting>
  5126. begin
  5127. delete from shipto where trans_id = old.id;
  5128. delete from vendortax where vendor_id = old.id;
  5129. delete from partsvendor where vendor_id = old.id;
  5130. return NULL;
  5131. end;
  5132. </programlisting>
  5133. </para>
  5134. </section>
  5135. <!-- Function del_yearend( ) -->
  5136. <section id="public.function.del-yearend"
  5137. xreflabel="publicdel_yearend( )">
  5138. <title id="public.function.del-yearend-title">
  5139. del_yearend( )
  5140. </title>
  5141. <titleabbrev id="public.function.del-yearend-titleabbrev">
  5142. del_yearend( )
  5143. </titleabbrev>
  5144. <para>
  5145. <segmentedlist>
  5146. <title>Function Properties</title>
  5147. <?dbhtml list-presentation="list"?>
  5148. <segtitle>Language</segtitle>
  5149. <segtitle>Return Type</segtitle>
  5150. <seglistitem>
  5151. <seg>PLPGSQL</seg>
  5152. <seg>&quot;trigger&quot;</seg>
  5153. </seglistitem>
  5154. </segmentedlist>
  5155. <programlisting>
  5156. begin
  5157. delete from yearend where trans_id = old.id;
  5158. return NULL;
  5159. end;
  5160. </programlisting>
  5161. </para>
  5162. </section>
  5163. <!-- Function drop_custom_field( character varying, character varying ) -->
  5164. <section id="public.function.drop-custom-field-character-varying-character-varying"
  5165. xreflabel="publicdrop_custom_field( character varying, character varying )">
  5166. <title id="public.function.drop-custom-field-character-varying-character-varying-title">
  5167. drop_custom_field( character varying, character varying )
  5168. </title>
  5169. <titleabbrev id="public.function.drop-custom-field-character-varying-character-varying-titleabbrev">
  5170. drop_custom_field( character varying, character varying )
  5171. </titleabbrev>
  5172. <para>
  5173. <segmentedlist>
  5174. <title>Function Properties</title>
  5175. <?dbhtml list-presentation="list"?>
  5176. <segtitle>Language</segtitle>
  5177. <segtitle>Return Type</segtitle>
  5178. <seglistitem>
  5179. <seg>PLPGSQL</seg>
  5180. <seg>boolean</seg>
  5181. </seglistitem>
  5182. </segmentedlist>
  5183. <programlisting>
  5184. DECLARE
  5185. table_name ALIAS FOR $1;
  5186. custom_field_name ALIAS FOR $2;
  5187. BEGIN
  5188. DELETE FROM custom_field_catalog
  5189. WHERE field_name = custom_field_name AND
  5190. table_id = (SELECT table_id FROM custom_table_catalog
  5191. WHERE extends = table_name);
  5192. EXECUTE &#39;ALTER TABLE custom_&#39; || table_name ||
  5193. &#39; DROP COLUMN &#39; || custom_field_name;
  5194. RETURN TRUE;
  5195. END;
  5196. </programlisting>
  5197. </para>
  5198. </section>
  5199. <!-- Function lastcost( integer ) -->
  5200. <section id="public.function.lastcost-integer"
  5201. xreflabel="publiclastcost( integer )">
  5202. <title id="public.function.lastcost-integer-title">
  5203. lastcost( integer )
  5204. </title>
  5205. <titleabbrev id="public.function.lastcost-integer-titleabbrev">
  5206. lastcost( integer )
  5207. </titleabbrev>
  5208. <para>
  5209. <segmentedlist>
  5210. <title>Function Properties</title>
  5211. <?dbhtml list-presentation="list"?>
  5212. <segtitle>Language</segtitle>
  5213. <segtitle>Return Type</segtitle>
  5214. <seglistitem>
  5215. <seg>PLPGSQL</seg>
  5216. <seg>double precision</seg>
  5217. </seglistitem>
  5218. </segmentedlist>
  5219. <programlisting>
  5220. DECLARE
  5221. v_cost float;
  5222. v_parts_id alias for $1;
  5223. BEGIN
  5224. SELECT INTO v_cost sellprice FROM invoice i
  5225. JOIN ap a ON (a.id = i.trans_id)
  5226. WHERE i.parts_id = v_parts_id
  5227. ORDER BY a.transdate desc, a.id desc
  5228. LIMIT 1;
  5229. IF v_cost IS NULL THEN
  5230. v_cost := 0;
  5231. END IF;
  5232. RETURN v_cost;
  5233. END;
  5234. </programlisting>
  5235. </para>
  5236. </section>
  5237. <!-- Function trigger_parts_short( ) -->
  5238. <section id="public.function.trigger-parts-short"
  5239. xreflabel="publictrigger_parts_short( )">
  5240. <title id="public.function.trigger-parts-short-title">
  5241. trigger_parts_short( )
  5242. </title>
  5243. <titleabbrev id="public.function.trigger-parts-short-titleabbrev">
  5244. trigger_parts_short( )
  5245. </titleabbrev>
  5246. <para>
  5247. <segmentedlist>
  5248. <title>Function Properties</title>
  5249. <?dbhtml list-presentation="list"?>
  5250. <segtitle>Language</segtitle>
  5251. <segtitle>Return Type</segtitle>
  5252. <seglistitem>
  5253. <seg>PLPGSQL</seg>
  5254. <seg>&quot;trigger&quot;</seg>
  5255. </seglistitem>
  5256. </segmentedlist>
  5257. <programlisting>
  5258. BEGIN
  5259. IF NEW.onhand &gt;= NEW.rop THEN
  5260. NOTIFY parts_short;
  5261. END IF;
  5262. RETURN NEW;
  5263. END;
  5264. </programlisting>
  5265. </para>
  5266. </section>
  5267. <!-- Function update_user( integer, text ) -->
  5268. <section id="public.function.update-user-integer-text"
  5269. xreflabel="publicupdate_user( integer, text )">
  5270. <title id="public.function.update-user-integer-text-title">
  5271. update_user( integer, text )
  5272. </title>
  5273. <titleabbrev id="public.function.update-user-integer-text-titleabbrev">
  5274. update_user( integer, text )
  5275. </titleabbrev>
  5276. <para>
  5277. <segmentedlist>
  5278. <title>Function Properties</title>
  5279. <?dbhtml list-presentation="list"?>
  5280. <segtitle>Language</segtitle>
  5281. <segtitle>Return Type</segtitle>
  5282. <seglistitem>
  5283. <seg>SQL</seg>
  5284. <seg>integer</seg>
  5285. </seglistitem>
  5286. </segmentedlist>
  5287. Takes int4 which is users.id and text which is username. Will update username based on id. Username is unique
  5288. <programlisting>
  5289. UPDATE users SET username = &#39;$2&#39; WHERE id = $1;
  5290. SELECT 1;
  5291. </programlisting>
  5292. </para>
  5293. </section>
  5294. </chapter>
  5295. </book>