I'm still in the middle of moving onto a ledger based system. However, I'm am now changing how transactions and entries relate back to the customer. I'll be using a ledger for each lease (for rent, late charges, security deposits, etc), and a ledger for each customer (for POS, non-specific deposits such as reservations or covering mulitple units, bad debt writeoff, and possibly customer credits, when not obviously lease specific). This coming change might not be in the right direction, so I want to capture the work as is right now. This change set is not fully functional. Many operations do work, but there are obviously transaction problems with units and customers.

git-svn-id: file:///svn-source/pmgr/branches/ledger_transactions_20090605@71 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-06-06 20:18:56 +00:00
parent 30b934823c
commit f3ffa3c079
54 changed files with 3066 additions and 2125 deletions

View File

@@ -448,44 +448,6 @@ CREATE TABLE `pmgr_site_areas` (
-- ##
-- ----------------------------------------------------------------------
-- ----------------------------------------------------------------------
-- TABLE pmgr_unit_types
DROP TABLE IF EXISTS `pmgr_unit_types`;
CREATE TABLE `pmgr_unit_types` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`code` VARCHAR(12) NOT NULL, -- User style "id"
`name` VARCHAR(80) NOT NULL,
`comment` VARCHAR(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- ----------------------------------------------------------------------
-- ----------------------------------------------------------------------
-- TABLE pmgr_unit_sizes
DROP TABLE IF EXISTS `pmgr_unit_sizes`;
CREATE TABLE `pmgr_unit_sizes` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`unit_type_id` INT(10) UNSIGNED NOT NULL,
`code` VARCHAR(12) NOT NULL, -- User style "id"
`name` VARCHAR(80) NOT NULL,
`width` SMALLINT UNSIGNED NOT NULL, -- inches
`depth` SMALLINT UNSIGNED NOT NULL, -- inches
`height` SMALLINT UNSIGNED DEFAULT NULL, -- inches
`comment` VARCHAR(255) DEFAULT NULL,
`deposit` FLOAT(12,2) DEFAULT NULL,
`amount` FLOAT(12,2) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- ----------------------------------------------------------------------
-- ----------------------------------------------------------------------
-- TABLE pmgr_units
@@ -525,6 +487,44 @@ CREATE TABLE `pmgr_units` (
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- ----------------------------------------------------------------------
-- ----------------------------------------------------------------------
-- TABLE pmgr_unit_types
DROP TABLE IF EXISTS `pmgr_unit_types`;
CREATE TABLE `pmgr_unit_types` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`code` VARCHAR(12) NOT NULL, -- User style "id"
`name` VARCHAR(80) NOT NULL,
`comment` VARCHAR(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- ----------------------------------------------------------------------
-- ----------------------------------------------------------------------
-- TABLE pmgr_unit_sizes
DROP TABLE IF EXISTS `pmgr_unit_sizes`;
CREATE TABLE `pmgr_unit_sizes` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`unit_type_id` INT(10) UNSIGNED NOT NULL,
`code` VARCHAR(12) NOT NULL, -- User style "id"
`name` VARCHAR(80) NOT NULL,
`width` SMALLINT UNSIGNED NOT NULL, -- inches
`depth` SMALLINT UNSIGNED NOT NULL, -- inches
`height` SMALLINT UNSIGNED DEFAULT NULL, -- inches
`comment` VARCHAR(255) DEFAULT NULL,
`deposit` FLOAT(12,2) DEFAULT NULL,
`amount` FLOAT(12,2) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- ######################################################################
-- ######################################################################
@@ -619,18 +619,16 @@ CREATE TABLE `pmgr_actions_late_schedules` (
-- ######################################################################
-- ######################################################################
-- ##
-- ## LEASES
-- ## CUSTOMERS
-- ##
-- ----------------------------------------------------------------------
-- ----------------------------------------------------------------------
-- TABLE pmgr_lease_types
-- TABLE pmgr_customers
DROP TABLE IF EXISTS `pmgr_lease_types`;
CREATE TABLE `pmgr_lease_types` (
DROP TABLE IF EXISTS `pmgr_customers`;
CREATE TABLE `pmgr_customers` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`code` VARCHAR(12) NOT NULL, -- User style "id"
`name` VARCHAR(80) NOT NULL,
`comment` VARCHAR(255) DEFAULT NULL,
@@ -638,6 +636,44 @@ CREATE TABLE `pmgr_lease_types` (
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- ----------------------------------------------------------------------
-- ----------------------------------------------------------------------
-- TABLE pmgr_contacts_customers
DROP TABLE IF EXISTS `pmgr_contacts_customers`;
CREATE TABLE `pmgr_contacts_customers` (
`contact_id` INT(10) UNSIGNED NOT NULL,
`customer_id` INT(10) UNSIGNED NOT NULL,
-- What type of contact is this for the lease?
`type` ENUM('TENANT', -- TENANT
'ALTERNATE') -- ALTERNATE CONTACT ONLY
NOT NULL DEFAULT 'TENANT',
-- If the tenant is active as part of the lease
`active` TINYINT DEFAULT 1,
`comment` VARCHAR(255) DEFAULT NULL,
PRIMARY KEY (`customer_id`, `contact_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- ######################################################################
-- ######################################################################
-- ######################################################################
-- ######################################################################
-- ######################################################################
-- ######################################################################
-- ######################################################################
-- ######################################################################
-- ######################################################################
-- ##
-- ## LEASES
-- ##
-- ----------------------------------------------------------------------
-- ----------------------------------------------------------------------
-- TABLE pmgr_leases
@@ -652,7 +688,7 @@ CREATE TABLE `pmgr_leases` (
`lease_type_id` INT(10) UNSIGNED NOT NULL,
`unit_id` INT(10) UNSIGNED NOT NULL,
`primary_contact_id` INT(10) UNSIGNED DEFAULT NULL, -- NOT NULL,
`customer_id` INT(10) UNSIGNED NOT NULL,
`late_schedule_id` INT(10) UNSIGNED DEFAULT NULL,
`lease_date` DATE NOT NULL,
@@ -678,24 +714,16 @@ CREATE TABLE `pmgr_leases` (
-- ----------------------------------------------------------------------
-- ----------------------------------------------------------------------
-- TABLE pmgr_contacts_leases
DROP TABLE IF EXISTS `pmgr_contacts_leases`;
CREATE TABLE `pmgr_contacts_leases` (
`lease_id` INT(10) UNSIGNED NOT NULL,
`contact_id` INT(10) UNSIGNED NOT NULL,
-- What type of contact is this for the lease?
`type` ENUM('TENANT', -- TENANT
'ALTERNATE') -- ALTERNATE CONTACT ONLY
NOT NULL DEFAULT 'TENANT',
-- If the tenant is active as part of the lease
`active` TINYINT DEFAULT 1,
-- TABLE pmgr_lease_types
DROP TABLE IF EXISTS `pmgr_lease_types`;
CREATE TABLE `pmgr_lease_types` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`code` VARCHAR(12) NOT NULL, -- User style "id"
`name` VARCHAR(80) NOT NULL,
`comment` VARCHAR(255) DEFAULT NULL,
PRIMARY KEY (`lease_id`, `contact_id`)
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
@@ -726,7 +754,7 @@ CREATE TABLE `pmgr_reservations` (
-- If NULL, `id` will be used
`number` VARCHAR(20) DEFAULT NULL,
`contact_id` INT(10) UNSIGNED NOT NULL,
`customer_id` INT(10) UNSIGNED NOT NULL,
`deposit` FLOAT(12,2) DEFAULT NULL,
`reservation_date` DATE NOT NULL,
@@ -784,125 +812,166 @@ DROP TABLE IF EXISTS `pmgr_accounts`;
CREATE TABLE `pmgr_accounts` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`type` ENUM('ASSET',
'LIABILITY',
'EQUITY',
'INCOME',
'EXPENSE')
NOT NULL DEFAULT 'ASSET',
-- Security Level
`level` INT UNSIGNED DEFAULT 1,
`name` VARCHAR(80) NOT NULL,
`external_account` INT(10) UNSIGNED DEFAULT NULL,
`external_name` VARCHAR(80) DEFAULT NULL,
`comment` VARCHAR(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- ######################################################################
-- ######################################################################
-- ######################################################################
-- ######################################################################
-- ######################################################################
-- ######################################################################
-- ######################################################################
-- ######################################################################
-- ######################################################################
-- ##
-- ## CHARGES
-- ##
-- ----------------------------------------------------------------------
-- ----------------------------------------------------------------------
-- TABLE pmgr_charge_types
DROP TABLE IF EXISTS `pmgr_charge_types`;
CREATE TABLE `pmgr_charge_types` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` VARCHAR(80) NOT NULL,
`comment` VARCHAR(255) DEFAULT NULL,
`account_id` INT(10) UNSIGNED NOT NULL, -- quickbooks tracking
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
LOCK TABLES `pmgr_charge_types` WRITE;
INSERT INTO `pmgr_charge_types` (`id`, `name`, `account_id`)
LOCK TABLES `pmgr_accounts` WRITE;
INSERT INTO `pmgr_accounts` (`id`, `type`, `name`)
VALUES
(1, 'Security Deposit', 0),
(2, 'Rent', 0),
(3, 'Late Charge', 0);
(1, 'ASSET', 'A/R'),
(2, 'LIABILITY', 'A/P'),
(3, 'LIABILITY', 'Tax'),
(4, 'LIABILITY', 'Customer Credit'),
(5, 'ASSET', 'Bank'),
(6, 'ASSET', 'Cash'),
(7, 'LIABILITY', 'Security Deposit'),
(8, 'INCOME', 'Rent'),
(9, 'INCOME', 'Late Charge');
UNLOCK TABLES;
-- ----------------------------------------------------------------------
-- ----------------------------------------------------------------------
-- TABLE pmgr_charges
DROP TABLE IF EXISTS `pmgr_charges`;
CREATE TABLE `pmgr_charges` (
-- ######################################################################
-- ######################################################################
-- ######################################################################
-- ######################################################################
-- ######################################################################
-- ######################################################################
-- ######################################################################
-- ######################################################################
-- ######################################################################
-- ##
-- ## LEDGERS
-- ##
-- ----------------------------------------------------------------------
-- ----------------------------------------------------------------------
-- TABLE pmgr_ledgers
--
-- REVISIT <AP>: 20090605
-- We may not really need a ledgers table.
-- It's not clear to me though, as we very
-- possibly need to close out certain
-- ledgers every so often, and just carry
-- the balance forward (year end, etc).
DROP TABLE IF EXISTS `pmgr_ledgers`;
CREATE TABLE `pmgr_ledgers` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`charge_type_id` INT(10) UNSIGNED NOT NULL,
`lease_id` INT(10) UNSIGNED NOT NULL,
`charge_date` DATE NOT NULL,
`charge_to_date` DATE DEFAULT NULL,
`due_date` DATE DEFAULT NULL,
`amount` FLOAT(12,2) NOT NULL,
`tax` FLOAT(12,2) NOT NULL,
`total` FLOAT(12,2) NOT NULL,
-- REVISIT <AP>: 20090605
-- If ledgers do need to be closed, then we'll need
-- to add several parameters indicating the period
-- this particular ledger is valid and so on.
`name` VARCHAR(80) DEFAULT NULL,
`account_id` INT(10) UNSIGNED NOT NULL,
`closed` INT UNSIGNED DEFAULT 0,
`comment` VARCHAR(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- -- ----------------------------------------------------------------------
-- -- ----------------------------------------------------------------------
-- -- TABLE pmgr_invoices
-- ----------------------------------------------------------------------
-- ----------------------------------------------------------------------
-- TABLE pmgr_transactions
-- DROP TABLE IF EXISTS `pmgr_invoices`;
-- CREATE TABLE `pmgr_invoices` (
-- `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
-- `stamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
DROP TABLE IF EXISTS `pmgr_transactions`;
CREATE TABLE `pmgr_transactions` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
-- `comment` VARCHAR(255) DEFAULT NULL,
`stamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
`through_date` DATE DEFAULT NULL,
`due_date` DATE DEFAULT NULL,
-- PRIMARY KEY (`id`)
-- ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- REVISIT <AP>: 20090604
-- It really seems this is too restrictive. One tenant
-- should be able to, within a single transaction, pay
-- for their own charges and another tenant's as well.
-- customer_id may need to move to ledger_entries
`customer_id` INT(10) UNSIGNED NOT NULL,
-- REVISIT <AP>: 20090604
-- How should we track which charges have been paid?
-- `related_transaction_id` INT(10) UNSIGNED NOT NULL,
-- `related_entry_id` INT(10) UNSIGNED NOT NULL,
-- -- ----------------------------------------------------------------------
-- -- ----------------------------------------------------------------------
-- -- TABLE pmgr_charges_invoices
`comment` VARCHAR(255) DEFAULT NULL,
-- DROP TABLE IF EXISTS `pmgr_charges_invoices`;
-- CREATE TABLE `pmgr_charges_invoices` (
-- `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
-- `charge_id` INT(10) UNSIGNED NOT NULL,
-- `invoice_id` INT(10) UNSIGNED NOT NULL,
-- `amount` FLOAT(12,2) NOT NULL,
-- PRIMARY KEY (`id`)
-- ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- ######################################################################
-- ######################################################################
-- ######################################################################
-- ######################################################################
-- ######################################################################
-- ######################################################################
-- ######################################################################
-- ######################################################################
-- ######################################################################
-- ##
-- ## PAYMENTS
-- ##
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- ----------------------------------------------------------------------
-- ----------------------------------------------------------------------
-- TABLE pmgr_payment_types
-- TABLE pmgr_ledger_entries
DROP TABLE IF EXISTS `pmgr_payment_types`;
CREATE TABLE `pmgr_payment_types` (
DROP TABLE IF EXISTS `pmgr_ledger_entries`;
CREATE TABLE `pmgr_ledger_entries` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` VARCHAR(80) DEFAULT NULL,
`monetary_source_id` INT(10) UNSIGNED DEFAULT NULL, -- NULL if internal transfer
`transaction_id` INT(10) UNSIGNED NOT NULL,
`amount` FLOAT(12,2) NOT NULL,
`debit_ledger_id` INT(10) UNSIGNED NOT NULL,
`credit_ledger_id` INT(10) UNSIGNED NOT NULL,
`comment` VARCHAR(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- ----------------------------------------------------------------------
-- ----------------------------------------------------------------------
-- TABLE pmgr_monetary_sources
DROP TABLE IF EXISTS `pmgr_monetary_sources`;
CREATE TABLE `pmgr_monetary_sources` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` VARCHAR(80) DEFAULT NULL,
monetary_type_id INT(10) UNSIGNED NOT NULL,
-- REVISIT <AP>: 20090605
-- Check Number;
-- Routing Number, Account Number;
-- Card Number, Expiration Date; CCV2 Code
-- etc.
`comment` VARCHAR(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- ----------------------------------------------------------------------
-- ----------------------------------------------------------------------
-- TABLE pmgr_monetary_types
DROP TABLE IF EXISTS `pmgr_monetary_types`;
CREATE TABLE `pmgr_monetary_types` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` VARCHAR(80) NOT NULL,
@@ -912,180 +981,21 @@ CREATE TABLE `pmgr_payment_types` (
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
LOCK TABLES `pmgr_payment_types` WRITE;
INSERT INTO `pmgr_payment_types` (`id`, `name`, `tillable`)
LOCK TABLES `pmgr_monetary_types` WRITE;
INSERT INTO `pmgr_monetary_types` (`id`, `name`, `tillable`)
VALUES
(1, 'Cash', 1),
(2, 'Check', 1),
(3, 'Money Order', 1),
(4, 'ACH', 0),
(5, 'Debit Card', 0),
(6, 'Credit Card', 0),
(7, 'Other Tillable', 1),
(8, 'Other Non-Tillable', 0);
-- (1, 'Transfer', 0),
(2, 'Cash', 1),
(3, 'Check', 1),
(4, 'Money Order', 1),
(5, 'ACH', 0),
(6, 'Debit Card', 0),
(7, 'Credit Card', 0),
(8, 'Other Tillable', 1),
(9, 'Other Non-Tillable', 0);
UNLOCK TABLES;
-- ----------------------------------------------------------------------
-- ----------------------------------------------------------------------
-- TABLE pmgr_payments
DROP TABLE IF EXISTS `pmgr_payments`;
CREATE TABLE `pmgr_payments` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`receipt_id` INT(10) UNSIGNED NOT NULL,
`payment_type_id` INT(10) UNSIGNED NOT NULL,
`amount` FLOAT(12,2) NOT NULL,
`comment` VARCHAR(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- ######################################################################
-- ######################################################################
-- ######################################################################
-- ######################################################################
-- ######################################################################
-- ######################################################################
-- ######################################################################
-- ######################################################################
-- ######################################################################
-- ##
-- ## CREDITS
-- ##
-- ----------------------------------------------------------------------
-- ----------------------------------------------------------------------
-- TABLE pmgr_credit_types
-- DROP TABLE IF EXISTS `pmgr_credit_types`;
-- CREATE TABLE `pmgr_credit_types` (
-- `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
-- `name` VARCHAR(80) NOT NULL,
-- `comment` VARCHAR(255) DEFAULT NULL,
-- `account_id` INT(10) UNSIGNED NOT NULL, -- quickbooks tracking
-- PRIMARY KEY (`id`)
-- ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- LOCK TABLES `pmgr_credit_types` WRITE;
-- INSERT INTO `pmgr_credit_types` (`id`, `name`, `account_id`)
-- VALUES
-- (1, 'Security Deposit', 0),
-- (2, 'Rent', 0),
-- (3, 'Late Credit', 0);
-- UNLOCK TABLES;
-- ----------------------------------------------------------------------
-- ----------------------------------------------------------------------
-- TABLE pmgr_credits
DROP TABLE IF EXISTS `pmgr_credits`;
CREATE TABLE `pmgr_credits` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
-- `credit_type_id` INT(10) UNSIGNED NOT NULL,
`lease_id` INT(10) UNSIGNED NOT NULL,
`credit_date` DATE NOT NULL,
`credit_to_date` DATE DEFAULT NULL,
`due_date` DATE DEFAULT NULL,
`amount` FLOAT(12,2) NOT NULL,
`tax` FLOAT(12,2) NOT NULL,
`total` FLOAT(12,2) NOT NULL,
`comment` VARCHAR(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- ######################################################################
-- ######################################################################
-- ######################################################################
-- ######################################################################
-- ######################################################################
-- ######################################################################
-- ######################################################################
-- ######################################################################
-- ######################################################################
-- ##
-- ## RECEIPTS
-- ##
-- # Charge
-- # - Issued against customer lease
-- # - associated with account (i.e. QuickBooks account / category)
-- # Receipt
-- # - Collections of payments paid at one time
-- # Payment
-- # - Credited towards customer (or lease?)
-- # - may be more than customer owes
-- # - cash/check/charge/ach/etc
-- # Reconciliation
-- # - Associates a payment with the charge
-- # - Indicates amount of credit towards charge
-- # - Payments may cover several charges
-- # - Several payments may cover the same charge
-- Which charges haven not been paid?
-- SELECT C.id AS cid, C.total AS total, COALESCE(SUM(R.amount),0) AS paid
-- FROM pmgr_charges C
-- LEFT JOIN pmgr_charges_receipts R ON R.charge_id = C.id
-- GROUP BY C.id
-- HAVING paid < C.total
-- SELECT ChL.lid AS lid, U.name, C.display_name,
-- SUM(ChL.total) AS total, SUM(ChL.paid) AS paid,
-- SUM(ChL.total) - SUM(ChL.paid) AS owing
-- FROM (SELECT Ch.lease_id AS lid, Ch.total AS total, COALESCE(SUM(R.amount),0) AS paid
-- FROM pmgr_charges Ch
-- LEFT JOIN pmgr_charges_receipts R ON R.charge_id = Ch.id
-- WHERE Ch.due_date < NOW()
-- GROUP BY Ch.id
-- HAVING paid < Ch.total) ChL
-- LEFT JOIN pmgr_leases L ON L.id = ChL.lid
-- LEFT JOIN pmgr_lease_contacts Lc ON Lc.lease_id = L.id AND Lc.type = 'TENANT'
-- LEFT JOIN pmgr_contacts C ON C.id = Lc.contact_id
-- LEFT JOIN pmgr_units U ON U.id = L.unit_id
-- ----------------------------------------------------------------------
-- ----------------------------------------------------------------------
-- TABLE pmgr_receipts
DROP TABLE IF EXISTS `pmgr_receipts`;
CREATE TABLE `pmgr_receipts` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`stamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
`comment` VARCHAR(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- ----------------------------------------------------------------------
-- ----------------------------------------------------------------------
-- TABLE pmgr_charges_receipts
DROP TABLE IF EXISTS `pmgr_charges_receipts`;
CREATE TABLE `pmgr_charges_receipts` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`charge_id` INT(10) UNSIGNED NOT NULL,
-- REVISIT <AP>: 20090514
-- THIS SHOULD BE RECEIPT_ID, NOT PAYMENT_ID, RIGHT??
`receipt_id` INT(10) UNSIGNED NOT NULL,
`amount` FLOAT(12,2) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- ######################################################################