WorkFerret/tables/charge: Difference between revisions
< WorkFerret | tables
Jump to navigation
Jump to search
(Created page with "==About== * '''Purpose''': Tracks charges to clients and amounts received in payment, making it possible to generate statements. ==History== * '''2016-10-18''' initial design...") |
m (5 revisions imported: moving from htyp) |
||
(4 intermediate revisions by the same user not shown) | |||
Line 3: | Line 3: | ||
==History== | ==History== | ||
* '''2016-10-18''' initial design | * '''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== | ==SQL== | ||
<mysql>CREATE TABLE `charge` ( | <mysql>CREATE TABLE `charge` ( | ||
`ID` INT(4) NOT NULL AUTO_INCREMENT, | `ID` INT(4) NOT NULL AUTO_INCREMENT, | ||
`ID_Proj` INT(4) NOT NULL COMMENT "Project to which this session applies", | `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", | `WhenEffect` DATETIME NOT NULL COMMENT "effective date of the charge", | ||
`Amount` DECIMAL(9,2) NOT NULL COMMENT "charge amount ( | `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", | `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...)", |
Latest revision as of 20:32, 1 May 2022
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>