COMMENT ON TABLE CHARGE IS 'Charges and Payments table. Holds the information regarding the transactions an individual account has made--including: charges, payments, why the transaction occured, when the transaction happened, the type of account and whether it''s been printed.';


COMMENT ON COLUMN charge.SUPPORT_ACCT IS 'Account associated with the transaction row.';
COMMENT ON COLUMN charge.TERM_ID IS 'Term_id number to reference a specific school term. (I.e. 1145 references Spring 2014). This is used as a FOREIGN KEY to connect with the other tables.';
COMMENT ON COLUMN charge.DEBIT IS 'Amount that the account has been charged by the subscription service on a specific transaction.';
COMMENT ON COLUMN charge.CREDIT IS 'Amount the account has paid to the subscription service on a specific transaction.';
COMMENT ON COLUMN charge.REASON IS 'Reason the transaction occured.';
COMMENT ON COLUMN charge.COMMENTS IS 'Additional comments on the transaction. This appears to be a mostly stale column as only 15 items have this filled in.';
COMMENT ON COLUMN charge.DATE IS 'Date and time of the transaction in the format: yyyy-mm-dd 24h:min:sec.decimal_seconds';
COMMENT ON COLUMN charge.DEL_WHEN_REGEN IS 'Used when adding charges to a user. It is a failsafe to ensure that someone is not double charged during the same term. It also marks a row for deletion just before generating a bill so it is calculated fresh every time. Upon creating a new term all of the rows with a del_when_regen value of true are set to del_when_regen = false.';
COMMENT ON COLUMN charge.TYPE IS 'Specifies the whether account is subscription or personal.';
COMMENT ON COLUMN charge.HAS_BEEN_PRINTED IS 'Indicates an item has been printed. It is only set to true when the Clear Bills button is pressed in Admin, FORE spreadsheet.';

COMMENT ON TABLE REL_ACCT_USER IS 'A relations table one that relates user_ids with support_ids (i.e. subscription codes). A single user may be related to more than one subscription.';


COMMENT ON COLUMN rel_acct_user.SUPPORT_ACCT IS 'Subscription Code. Links to Support_Acct table.';
COMMENT ON COLUMN rel_acct_user.USER_ID IS 'User''s ID. Links to users table.';
COMMENT ON COLUMN rel_acct_user.REL_STATUS IS 'Status of the user. Links to user_FLDS table.';

COMMENT ON TABLE SUPPORT_ACCT IS 'Information regarding the individual subscriptions and their current status. ';

COMMENT ON COLUMN SUPPORT_ACCT.SUPPORT_ID IS 'Subscription ID. Relates to supportCode in Inventory db.  ';
COMMENT ON COLUMN SUPPORT_ACCT.INACTIVATION_DATE IS 'Date subscription became inactive. Keep for records.';
COMMENT ON COLUMN SUPPORT_ACCT.COMMENTS IS 'HTML formatted comment';
COMMENT ON COLUMN SUPPORT_ACCT.BILLING_STATUS IS 'Numeric (0,1,9). English bill, dont bill, or undecided.';
COMMENT ON COLUMN SUPPORT_ACCT.DATE_CREATE IS 'Date subscription was created.';
COMMENT ON COLUMN SUPPORT_ACCT.DATE_EDIT IS 'Date last edited.';
COMMENT ON COLUMN SUPPORT_ACCT.MFCF_SUPPORT IS 'Link to a MFCF help page. Can be NULL. Most if not all links here are stale.';
COMMENT ON COLUMN SUPPORT_ACCT.WEBSITE IS 'Can be NULL.';
COMMENT ON COLUMN SUPPORT_ACCT.GROUP_NAME IS 'Describes what group the subscription is related to. Must not be NULL.';
COMMENT ON COLUMN SUPPORT_ACCT.ORG_UNIT IS 'Organizational Unit. Only used for organization purposes. Not used in any code branching. Currently only ''CS'' and NULL. ';

COMMENT ON TABLE SUPPORT_TERM IS 'Data relating to the subscription status of the subscription accounts on a by term basis. I.e. units billed and type of account etc.';

COMMENT ON COLUMN SUPPORT_TERM.UNITS_DD IS 'Dedicated units the subscription was billed for, for the given term. These work different than desktops since they are charged hourly.';
COMMENT ON COLUMN SUPPORT_TERM.UNITS_DK IS 'Desktop units the subscription was billed for, for the given term. Refers to computer units. Not necessarily equal to the number of Computer items linked to a subscription in inventory db.';
COMMENT ON COLUMN SUPPORT_TERM.TYPE IS 'Type of account: ''dedicated or desktop''.';
COMMENT ON COLUMN SUPPORT_TERM.SUPPORT_ACCT IS 'Subscription account code. Links to support_acct table.';
COMMENT ON COLUMN SUPPORT_TERM.TERM_ID IS 'Numerical term id which represents a year and season (Fall, Winter, Spring).';
COMMENT ON COLUMN SUPPORT_TERM.POC IS 'Point of Contact. LINKS to Users table. There will only be one point of contact for a given subscription.';

COMMENT ON TABLE TERM IS 'Information about each term such as the cost of the subscription for dedicated and desktop subscriptions for a given term. Also has templates for latex.';

COMMENT ON COLUMN TERM.NUMERICAL_ID IS 'ID number of the term.';
COMMENT ON COLUMN TERM.UNIT_COST IS 'Cost per unit for the term.';
COMMENT ON COLUMN TERM.MACHINE_COST IS 'Cost per desktop machine for the term.';
COMMENT ON COLUMN TERM.UNIT_HR IS 'Cost of an hour of a unit for term.';
COMMENT ON COLUMN TERM.LATEX_TEMPLATE_DD IS 'Latex template used for printing the bills for dedicated term subscriptions.';
COMMENT ON COLUMN TERM.LATEX_TEMPLATE_DK IS 'Latex template used for printing the bill for desktop term subscriptions. ';
COMMENT ON COLUMN TERM.UNIT_HR_DK IS 'Desktop unit cost (per hour) for the term.';
COMMENT ON COLUMN TERM.DD_BILL_PAGINATION IS 'Number of dedicated units to paginate on bills.';
COMMENT ON COLUMN TERM.DK_BILL_PAGINATION IS 'Number of desktop units to paginate on bills.';

COMMENT ON TABLE USER_FLDS IS 'Table used for categorizing users and creating new categories if desired. Every user will have an associated rel_status from here. ';


COMMENT ON COLUMN USER_FLDS.REL_STATUS IS 'Primary key for the table and thus a unique integer identifier by which to relate each row.';
COMMENT ON COLUMN USER_FLDS.FIELD_NAME IS 'Computer/code friendly field name, not meant to be viewed.';
COMMENT ON COLUMN USER_FLDS.FORM_NAME IS 'Label that will be displayed in subscriptions.';
COMMENT ON COLUMN USER_FLDS.BILLING_FIELD IS 'Determines whether or not the user should be billed for their subscriptions.';
COMMENT ON COLUMN USER_FLDS.ORDER_LIST IS 'Unique column used to change the order of results when database is queried. I.e. used in conjunction with an ORDER BY SQL command.';

COMMENT ON TABLE USER_PAYMENTS IS 'Subscription payment default information for auto-filling payment form. Also holds some stored account numbers.';

COMMENT ON COLUMN USER_PAYMENTS.SUPPORT_ID IS 'Subscription code which relates to Support_acct table.';
COMMENT ON COLUMN USER_PAYMENTS.USERNAME IS 'User associated with the subscription and partly responsible for payment';
COMMENT ON COLUMN USER_PAYMENTS.METHOD IS 'Preferred method of payment for the given subscription. Valid values are: ''%'', ''even'', or ''$''.';
COMMENT ON COLUMN USER_PAYMENTS.VALUE IS 'Value is used when the method requires it. If the method was ''%'' or ''$''.';
COMMENT ON COLUMN USER_PAYMENTS.ACCOUNT_NUMBER IS 'Account number of the user. Doesn''t necessarily need to be filled in.';

COMMENT ON TABLE USERS IS 'List of users as well as expiry dates and privilege flags for database use/access.';

COMMENT ON COLUMN USERS.EXPIRE IS 'Can be null or it can accept a date in the format: yyyy-mm-dd. The purpose is to determine whether a user should still be active in the system.';
COMMENT ON COLUMN USERS.FLAGS IS 'String field which can be null as well. Represents user privileges when accessing the database. ''r'' read. ''d'' delete. ''b'' bill. ''m'' modify.';

