The transaction table is the core of the application. It records amounts of inventory moving from one area to another. It also implements a Single Table Inheritance pattern to capture data about different types of transactions.

<?php
--
--
Table structure for table `transaction`
--

CREATE TABLE `transaction` (
  `
transaction_id` int(10) unsigned NOT NULL auto_increment,
  `
debit_account_id` int(10) unsigned NOT NULL default '0',
  `
credit_account_id` int(10) unsigned NOT NULL default '0',
  `
created` datetime NOT NULL default '0000-00-00 00:00:00',
  `
date` date NOT NULL default '0000-00-00',
  `
category_id` int(10) unsigned NULL default '0',
  `
amount` double(10,2) NOT NULL default '0.00',
  `
memo` text,
  `
batch_number` int(10) default '0',
  `
unit_number` int(10) default '0',
  `
ia_number` int(10) default '0',
  `
fma_number` int(10) default '0',
  `
cases` int(10) default '0',
  `
html_tag` text,
 
PRIMARY KEY  (`transaction_id`),
 
KEY `IDX_transaction_debit_account_id` (`debit_account_id`),
 
KEY `IDX_transaction_credit_account_id` (`credit_account_id`),
 
KEY `IDX_transaction_category_id` (`category_id`),
 
KEY `IDX_transaction_batch_number` (`batch_number`),
 
KEY `IDX_transaction_unit_number` (`unit_number`),
 
KEY `IDX_transaction_ia_number` (`ia_number`),
 
KEY `IDX_transaction_fma_number` (`fma_number`),
 
KEY `IDX_transaction_cases` (`cases`),
 
KEY `IDX_transaction_date` (`date`),
 
KEY `IDX_transaction_created` (`created`)
)
ENGINE=InnoDB DEFAULT CHARSET=utf8;
?>