WorkFerret/tables/charge: Difference between revisions

From Woozle Writes Code
Jump to navigation Jump to search
No edit summary
No edit summary
Line 5: Line 5:
* '''2016-10-19''' some more timestamps
* '''2016-10-19''' some more timestamps
* '''2016-10-20''' void timestamp
* '''2016-10-20''' void timestamp
* '''2016-10-23''' Decided, for multiple reasons, that "owed to us" should be positive and "paid to us" should be negative.
** Reasons: (1) Name of table is "charge", not "payment"; (2) statement makes more sense in terms of amounts owed to us.
==SQL==
==SQL==
<mysql>CREATE TABLE  `charge` (
<mysql>CREATE TABLE  `charge` (
Line 14: Line 16:
   `WhenConfirm` DATETIME    DEFAULT NULL COMMENT "when this charge was confirmed",
   `WhenConfirm` DATETIME    DEFAULT NULL COMMENT "when this charge was confirmed",
   `WhenVoided` DATETIME    DEFAULT NULL COMMENT "when this charge was voided",
   `WhenVoided` DATETIME    DEFAULT NULL COMMENT "when this charge was voided",
   `Amount`    DECIMAL(9,2)    NOT NULL COMMENT "charge amount (neg = owed to us, pos = payment to us)",
   `Amount`    DECIMAL(9,2)    NOT NULL COMMENT "charge amount (pos = owed to us, neg = payment to us)",
   `Sort`      DECIMAL(7,4) DEFAULT NULL COMMENT "sorting order for multiple charges on same date",
   `Sort`      DECIMAL(7,4) DEFAULT NULL COMMENT "sorting order for multiple charges on same date",
   `Code`      VARCHAR(255) DEFAULT NULL COMMENT "identifying numbers, with a prefix (CHK, INVC...)",
   `Code`      VARCHAR(255) DEFAULT NULL COMMENT "identifying numbers, with a prefix (CHK, INVC...)",

Revision as of 12:22, 23 October 2016

About

  • Purpose: Tracks charges to clients and amounts received in payment, making it possible to generate statements.

History

  • 2016-10-18 initial design
  • 2016-10-19 some more timestamps
  • 2016-10-20 void timestamp
  • 2016-10-23 Decided, for multiple reasons, that "owed to us" should be positive and "paid to us" should be negative.
    • Reasons: (1) Name of table is "charge", not "payment"; (2) statement makes more sense in terms of amounts owed to us.

SQL

<mysql>CREATE TABLE `charge` (

 `ID`         INT(4)           NOT NULL AUTO_INCREMENT,
 `ID_Proj`    INT(4)           NOT NULL COMMENT "Project to which this session applies",
 `WhenCreated` DATETIME        NOT NULL COMMENT "when this record was created",
 `WhenEdited` DATETIME     DEFAULT NULL COMMENT "when this record was last edited",
 `WhenEffect` DATETIME         NOT NULL COMMENT "effective date of the charge",
 `WhenConfirm` DATETIME     DEFAULT NULL COMMENT "when this charge was confirmed",
 `WhenVoided` DATETIME     DEFAULT NULL COMMENT "when this charge was voided",
 `Amount`     DECIMAL(9,2)     NOT NULL COMMENT "charge amount (pos = owed to us, neg = payment to us)",
 `Sort`       DECIMAL(7,4) DEFAULT NULL COMMENT "sorting order for multiple charges on same date",
 `Code`       VARCHAR(255) DEFAULT NULL COMMENT "identifying numbers, with a prefix (CHK, INVC...)",
 `ID_Invc`    INT(4)       DEFAULT NULL COMMENT "invoice ID, where applicable",
 `Descr`      TEXT         DEFAULT NULL COMMENT "charge summary, for statements",
 `Notes`      TEXT         DEFAULT NULL COMMENT "internal notes, for reference",
  PRIMARY KEY(`ID`)

) ENGINE=InnoDB;</mysql>