====== Locking model ====== Main goal: not add new records with dates inside the locked period. New invoice or cost date never keep into the locking period. For example, if the invoice_date can be Mar 29, and the Match is locked -- FDM will calculate next unlocking date -- Apr 1. ===== The table "Lockes" ===== |Field |Description |Example | |year |The year of the locked period |2011 | |month |The month number (1..12) of the locked period |3 | |locked |The locking state (0..1) |1 | Primary keys is year + month. The table is controlled by forms [[lockes|Lock Month]] and [[edit:lockes|Lock Month Edit]]. ===== Locking in the Cost Edit form ===== Cost records contain the invoice date and the payment date. For the locking model important date is invoice date. Known locking states: |Locked |Date processing | |0 |Any changes in the record are allowing, on submit FDM will calculate nearest date in the unlocking period. | |1 |No changes allowed. User with unlocking rights can unlock the record. | ===== Locking in the Box Office Edit form ===== Box office records are binded by SQL with invoices table that contains the invoice date. For the locking model important date is invoice date. Known locking states: |Locked |Date processing | |0 |Any changes in the record are allowing, on submit FDM will calculate nearest date in the unlocking period. If the record is not complete -- FDM calculate invoiced date as start date + 7 | |1 |No changes allowed. User with unlocking rights can unlock the record. | Here's is the locking model is simpler -- after unlock user can change the invoice date, it'll be calculated based on the Lockes table. "Complete" is not checked -- means the record is not finished. Not all days of week are filled by numbers. Everyday user can add more or edit other days. And when user will finished -- he can check the box "Complete". "Locked" -- if not checked, user can check it, and the form will become locked. And only proved user will can unlock it. ===== Locking in the Flat Edit form ===== The form is simpler than box office edit. And it's working similar to box office edit form. ===== Locking in Inserting forms ===== Inserting forms are [[box office]], [[flat sale]], [[cost]]. If the invoice date is in the locked period -- FDM calculated it into the nearest unlocked period. Therefore any new record will never be in old reports that were printed in past. This is the locking goal.