All postings in the C/BOOKS are done by dates. All transactions have an entry date. It is this date that decides which accounting period they should be recorded in. When closing routines are run, they select transactions by the date of the transaction. This allows you to have several periods open at one time. It also means you can move a transaction to another period, simply by changing the transaction date.
Two entirely separate sets of balances are kept in the accounting system. One set of balances is maintained by the posting routine; these balances are stored in every master and transaction record. They are updated as each transaction is entered, and so always reflect the current balance for each account. A second set of balances for the general ledger is kept by the closing routines; these balances are the ending balances for each accounting period.
When closing routines are run, they take the ending balance of the previous period for each general ledger account, and apply all of the transactions of the current period, to come up with a new ending general ledger balance. NOTE: The closing routines only deal with ending balances that are stored in the general ledger. The posting routines work with the current balance field that is stored in master and transaction records. The current balance is kept independent of the ending balances. By having the closing routines re-do the work of the transactions, it becomes possible to close and reclose any period. The only requirement for re-closing a period, is that all of the transactions for that period must be present in the system.