DB-Schema geaendert um in invoice und orderitems die Variablen ordnumber_$i, transdat...
[kivitendo-erp.git] / sql / lx-office.sql
index d2c0bca..2408033 100644 (file)
@@ -109,12 +109,23 @@ CREATE TABLE "defaults" (
        "rfqnumber" text,
         "customernumber" text,
         "vendornumber" text,
+        "audittrail" bool default 'f',
         "articlenumber" text,
         "servicenumber" text,
         "itime" timestamp DEFAULT now(),
         "mtime" timestamp
 );
-INSERT INTO defaults (version) VALUES ('2.1.2');
+INSERT INTO defaults (version,audittrail) VALUES ('2.1.2', 't');
+
+CREATE TABLE audittrail (
+        "trans_id" int,
+        "tablename" text,
+        "reference" text,
+        "formname" text,
+        "action" text,
+        "transdate" timestamp default current_timestamp,
+        "employee_id" int
+);
 
 CREATE TABLE "acc_trans" (
        "trans_id" integer,
@@ -149,7 +160,11 @@ CREATE TABLE "invoice" (
        "deliverydate" date,
        "serialnumber" text,
         "itime" timestamp DEFAULT now(),
-        "mtime" timestamp
+        "mtime" timestamp,
+        "pricegroup_id" integer,
+        "ordnumber" text,
+        "transdate" text,
+        "cusordnumber" text
 );
 
 CREATE TABLE "vendor" (
@@ -230,7 +245,8 @@ CREATE TABLE "customer" (
         "username" varchar(50),
         "user_password" varchar(12),
         "salesman_id" integer,
-        "c_vendor_id" text
+        "c_vendor_id" text,
+        "klass" integer DEFAULT 0
         
 );
 
@@ -370,7 +386,7 @@ CREATE TABLE "oe" (
 );
 
 CREATE TABLE "orderitems" (
-       "trans_id" integer REFERENCES oe (id),
+       "trans_id" integer,
        "parts_id" integer REFERENCES parts (id),
        "description" text,
        "qty" real,
@@ -383,7 +399,11 @@ CREATE TABLE "orderitems" (
        "serialnumber" text,
        "id" integer DEFAULT nextval('orderitemsid'::text) PRIMARY KEY,
         "itime" timestamp DEFAULT now(),
-        "mtime" timestamp
+        "mtime" timestamp,
+        "pricegroup_id" integer,
+        "ordnumber" text,
+        "transdate" text,
+        "cusordnumber" text
 );
 
 CREATE TABLE "exchangerate" (
@@ -417,6 +437,8 @@ CREATE TABLE "employee" (
 CREATE TABLE "shipto" (
        "trans_id" integer,
        "shiptoname" character varying(75),
+        "shiptodepartment_1" character varying(75),
+        "shiptodepartment_2" character varying(75),
        "shiptostreet" character varying(75),
        "shiptozipcode" character varying(75),
        "shiptocity" character varying(75),
@@ -538,6 +560,22 @@ CREATE TABLE "licenseinvoice" (
   license_id integer
 );
 
+-- Preisgruppenverwaltung
+CREATE TABLE "pricegroup" (
+  "id" integer DEFAULT nextval('id'::text),
+  "pricegroup" text not null,
+  PRIMARY KEY (id)
+);
+--Preisverwaltung der Preisgruppen
+CREATE TABLE "prices" (
+  "parts_id" integer REFERENCES parts(id),
+  "pricegroup_id" integer REFERENCES pricegroup(id),
+  "price" numeric(15,5)
+);
+
+
+
+
 -- Table of tax authoritys
 -- for module ustva
 -- Lx office