Friday, October 3, 2008

reserved nominal accounts

as mentioned earlier, some nominal accounts need to be protected from manual user input, such as the sales and purchase ledgers and the VAT control accounts. Also, any accounts that will be used as bank accounts can be flagged to be reconciled against an actual bank statement. both of these tasks can be achieved by means of the same feature.

it would be tempting to add a column in the core_nom_accounts table to indicate whether the account was restricted or not (or is a bank account). But, that goes against my normalization rules because you only need to reference reserved records, not all of them.

So i am going to create a new table that contains 2 fields, 1 to reference the unique id of the nominal account and 1 to indicate its function.

CREATE TABLE core_nom_reserved(id SMALLINT UNSIGNED, reserveType VARCHAR(2), PRIMARY KEY(id, reserveType))

Now really i should make reserveType a foreign key to another table but i cant be bothered. its a very simple reference that doesn't need much explanation. I will use codes like SL for Sales Ledger, PL for Purchase Ledger, VS for VAT Sales, VP for VAT Purchases, VC for VAT Control and BA for Bank Account (can be more than one).

No comments: