[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb: [2027] trunk/sql/Pg-database.sql



Revision: 2027
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2027&view=rev
Author:   einhverfr
Date:     2008-01-04 09:59:41 -0800 (Fri, 04 Jan 2008)

Log Message:
-----------
New tables by David Mora for payment tracking

Modified Paths:
--------------
    trunk/sql/Pg-database.sql

Modified: trunk/sql/Pg-database.sql
===================================================================
--- trunk/sql/Pg-database.sql	2007-12-31 23:45:01 UTC (rev 2026)
+++ trunk/sql/Pg-database.sql	2008-01-04 17:59:41 UTC (rev 2027)
@@ -724,6 +724,34 @@
 
 COMMENT ON COLUMN ap.entity_id IS $$ Used to be customer_id, but customer is now metadata. You need to push to entity $$;
 
+-- Payment stuff by David Mora
+
+CREATE TABLE payment (
+  id serial primary key,
+  reference text NOT NULL,
+  payment_class integer NOT NULL,
+  amount numeric NOT NULL,
+  payment_date date default current_date,
+  closed bool default FALSE,
+  person_id integer references person(id),
+  currency char(3),
+  notes text,
+  department_id integer default 0);
+
+COMMENT ON TABLE payment IS $$ This table will store the main data on a payment, prepayment, overpayment, etc... $$;
+COMMENT ON COLUMN payment.reference IS $$ This field will store the code for both receipts and payment orders, it will be differentiate by payment_class  $$;
+COMMENT ON COLUMN payment.closed IS $$ This will store the current state of a payment/receipt order $$;
+CREATE  INDEX payment_id_idx ON Payment(id);
+
+CREATE TABLE payment_links (
+  payment_id integer references Payment(id),
+  transaction_id integer NOT NULL,
+  amount numeric);
+COMMENT ON TABLE payment_links IS $$ This table will link payment to ar/ap transactions $$;
+COMMENT ON COLUMN payment_links.transaction_id IS $$ This column lacks some data integrity controls that must be implemented in the future $$;
+  
+
+
 --
 CREATE TABLE taxmodule (
   taxmodule_id serial PRIMARY KEY,


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.