Modified effective dates to be part of the ledger entry, not the transaction. This is the logically correct way, as a transaction is simply a collection of entries which might be anywhere from completely aligned to totally disjoint from one another (more likely the former). As a practical example, consider a move-in invoice, with security deposit (effective immediately with no end date), a prorated rent (effective move-in day through the end of the first month), and first full months rent (effective beginning of next month through the end of next month). There is certainly more work to be done on this, and testing was minimal. It does seem to be functioning though, so I'm checking in.
git-svn-id: file:///svn-source/pmgr/branches/invoice_receipt_20090629@256 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -948,7 +948,6 @@ CREATE TABLE `pmgr_transactions` (
|
||||
-- NOT NULL,
|
||||
|
||||
`stamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`through_date` DATE DEFAULT NULL,
|
||||
`due_date` DATE DEFAULT NULL,
|
||||
|
||||
-- REVISIT <AP>: 20090604
|
||||
@@ -970,13 +969,28 @@ 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,
|
||||
-- Effective date may be used for a variety of entries
|
||||
-- charges & payments are not always effective at the
|
||||
-- time of transaction. Through date, on the other hand,
|
||||
-- will probably only be relevant for charges, such as
|
||||
-- rent, which is effective for a range of dates.
|
||||
`effective_date` DATE DEFAULT NULL, -- first day
|
||||
`through_date` DATE DEFAULT NULL, -- last day
|
||||
|
||||
`monetary_source_id` INT(10) UNSIGNED DEFAULT NULL, -- NULL if internal transfer
|
||||
`transaction_id` INT(10) UNSIGNED NOT NULL,
|
||||
`customer_id` INT(10) UNSIGNED DEFAULT NULL,
|
||||
`lease_id` INT(10) UNSIGNED DEFAULT NULL,
|
||||
`amount` FLOAT(12,2) NOT NULL,
|
||||
|
||||
-- REVISIT <AP>: 20090707
|
||||
-- Experimental. Considering automatically hooking
|
||||
-- charges to their invoice. This may help ease the
|
||||
-- ongoing accounting dilema that we've been having.
|
||||
-- It might allow us to keep the underlying invoice
|
||||
-- ledgers without having to expose the user to them.
|
||||
`root_transaction_id` INT(10) UNSIGNED DEFAULT NULL,
|
||||
|
||||
`debit_ledger_id` INT(10) UNSIGNED NOT NULL,
|
||||
`credit_ledger_id` INT(10) UNSIGNED NOT NULL,
|
||||
|
||||
|
||||
Reference in New Issue
Block a user