Documents and posting
Balances and turnovers, documents, posting, accumulation register movements, stock control and locks.
14 questions
JuniorTheoryVery commonWhat are a document's movements, and where are they stored?
What are a document's movements, and where are they stored?
Movements are register records made at posting: rows with the document in Регистратор, its date in Период, plus dimensions and resources. They live in the register's tables, not the document's, and code fills them via Движения.
Common mistakes
- ✗Thinking reports read documents directly: they read register tables filled by the movements
- ✗Mixing up a table section with movements: the table section is the input, the movements are register rows
Follow-up questions
- →How do you see the movements of a posted document in Enterprise mode?
- →Why does every movement carry the document that made it?
JuniorTheoryVery commonWhat is posting a document, and what happens while it runs?
What is posting a document, and what happens while it runs?
Posting reflects a document in accounting. The platform calls ОбработкаПроведения in the object module, the code fills record sets in Движения, and they are written with the document in one transaction; Проведен becomes Истина.
Common mistakes
- ✗Treating posting as saving: a document can be written without posting and then makes no movements
- ✗Writing movements in a separate transaction after posting: they are written with the document in one transaction
Follow-up questions
- →What does the parameter
РежимПроведенияofОбработкаПроведенияtell the handler? - →How does writing a document differ from posting it?
JuniorTheoryCommonHow many pens were in stock at the end of the day on 05.11?
How many pens were in stock at the end of the day on 05.11?
40
Open full question →Common mistakes
- ✗Adding up every movement regardless of its date: a balance on a date sums only the movements up to that date
- ✗Leaving out the movements of the day itself: the balance at the end of a day includes them
Follow-up questions
- →How do you get the pen turnover for the period from 02.11 to 06.11?
- →How does the balance at the start of a day differ from the one at its end?
JuniorTheoryCommonCan a catalog item be the recorder of register records?
Can a catalog item be the recorder of register records?
No. Only a document can be a recorder: its movements keep it in Регистратор and live and go with its posting. A catalog's code may write records to an independent information register, but such records have no recorder at all.
Common mistakes
- ✗Trying to make movements from a catalog's write event: a register with a recorder accepts only documents
- ✗Thinking an independent information register needs a recorder: any code writes its records, and they keep no recorder
Follow-up questions
- →Why does an accumulation register always need a recorder?
- →When does it make sense to subordinate an information register to a document?
JuniorTheoryCommonHow does a document differ from a catalog from the platform's point of view?
How does a document differ from a catalog from the platform's point of view?
A document has a date and can be posted: posting makes movements in registers
Common mistakes
- ✗Taking a table section for the mark of a document: a catalog can have one too, and what sets a document apart is its date and posting
- ✗Keeping events such as a sale in a catalog: it has no event date and no posting, so it makes no movements
Follow-up questions
- →Can a catalog be the recorder of an accumulation register?
- →What changes in the infobase when a document is posted?
JuniorDebuggingCommonWhy does the register hold no movements after this document is posted?
Why does the register hold no movements after this document is posted?
Движения.ОстаткиТоваров.Записывать is not set, so the record set is not written
Common mistakes
- ✗Expecting the rows added to
Движенияto be written by themselves: under «Записывать выбранные» the set needsЗаписывать = Истина - ✗Looking for the cause in
Отказ: without an explicitОтказ = Истинаposting is not cancelled, and the movements are lost because of the flag
Follow-up questions
- →How does the «Записывать модифицированные» mode differ from «Записывать выбранные»?
- →Why is
Записать()usually not called on a record set insideОбработкаПроведения?
JuniorTheoryCommonWhat pen balance on warehouse А will the register show?
What pen balance on warehouse А will the register show?
30
Open full question →Common mistakes
- ✗Adding up the movements of every warehouse: the balance is kept per combination of dimensions, and warehouse А has its own
- ✗Subtracting another item's expense from the pen balance: клей is a different value of the Товар dimension
Follow-up questions
- →What pen balance across all warehouses does this register show?
- →What changes if the Склад dimension is removed from the register?
JuniorTheoryCommonHow many pens does document №5 write off after it is posted again?
How many pens does document №5 write off after it is posted again?
4
Open full question →Common mistakes
- ✗Expecting re-posting to add movements to the old ones: the old movements of the document are deleted, and new ones are written
- ✗Expecting the register to write the difference between the old and new quantities: the document writes its full set of movements again
Follow-up questions
- →What happens to a document's movements when it is unposted?
- →Which field of a movement links it to the document that wrote it?
JuniorTheoryCommonWhy does accounting store goods movements rather than one current balance number?
Why does accounting store goods movements rather than one current balance number?
From movements you get the balance on any date and can see where it came from
Common mistakes
- ✗Expecting movements to be kept to save space: there are more of them, and they are kept for the balance on any date and the history
- ✗Expecting one balance number to serve a report for a past date: a past balance comes from the movements up to that date
Follow-up questions
- →How does a balance differ from the turnover for a period?
- →How do you correct a wrong expense without editing the balance number by hand?
MiddleTheoryCommonWhy does posting with a stock check need a managed lock?
Why does posting with a stock check need a managed lock?
Two documents posted at once can both read one balance and both write it off: a plain read does not stop others. An exclusive БлокировкаДанных on the register by goods and warehouse, set before the read, makes the second posting wait.
Common mistakes
- ✗Relying on the transaction to protect the balance check: without a lock two postings read the same balance
- ✗Setting the lock after reading the balance: the read must come after the lock
Follow-up questions
- →Why lock only the document's goods and warehouses rather than the whole register?
- →What happens when two documents lock the same goods in opposite order?
MiddleTheoryCommonWhat is a document's moment of time, and why do queries use it?
What is a document's moment of time, and why do queries use it?
The moment of time is the document's date together with its reference, ordering documents that share a date and time. Passed to a virtual table such as Остатки, МоментВремени() gives the balance right before the document, without its movements.
Common mistakes
- ✗Ordering same-dated documents by date alone: the moment of time adds the reference to break the tie
- ✗Expecting
Остаткиat the document's moment to include its own movements: they are left out
Follow-up questions
- →How does
Новый Граница(МоментВремени, ВидГраницы.Включая)change the result? - →Why is the date alone not enough to order documents?
MiddleTheoryCommonHow does operational posting of a document differ from non-operational posting?
How does operational posting of a document differ from non-operational posting?
A document dated today is posted operationally: the deal happens now, so the handler checks current balances. One dated in the past or future is posted non-operationally, usually without the check. The handler gets the mode in РежимПроведения.
Common mistakes
- ✗Checking balances in every posting mode: a document entered in the past is usually posted without the check
- ✗Thinking non-operational posting writes movements later: both modes write them in the posting transaction
Follow-up questions
- →Which document property has to allow operational posting at all?
- →Why can balances at a document's moment differ from the current balances?
MiddleTheoryCommonHow does the new stock control method at posting differ from the old one?
How does the new stock control method at posting differ from the old one?
The old method reads balances first, compares them with the document and only then writes movements. The new one writes the expense movements first, then queries the balance after them: a negative balance means a shortage, and posting is cancelled.
Common mistakes
- ✗Reading balances before writing movements in a new configuration: the new method writes first, then checks for a negative balance
- ✗Querying the balance before the record set is written: the query then misses this document's movements
Follow-up questions
- →Why does the new method call
Записать()on the record set insideОбработкаПроведения? - →Why does the new method usually read fewer rows than the old one?
SeniorDesignCommonTwo clerks post sales of the last 5 pens from one warehouse at the same moment. The sale document checks stock in ОбработкаПроведения, the configuration uses managed locks, and both documents are posted operationally. Design the posting so that the pens are never written off twice and a shortage cancels only the document that comes second. Say what you lock, at which step, and how you check the balance.
Two clerks post sales of the last 5 pens from one warehouse at the same moment. The sale document checks stock in ОбработкаПроведения, the configuration uses managed locks, and both documents are posted operationally. Design the posting so that the pens are never written off twice and a shortage cancels only the document that comes second. Say what you lock, at which step, and how you check the balance.
In the posting transaction: lock the register for the document's goods and warehouse with an exclusive БлокировкаДанных, write the expense movements, query the balance; a negative one sets Отказ. The second posting waits, then sees the write-off.
Common mistakes
- ✗Checking the balance before taking the lock: both postings read the same 5 pens
- ✗Locking the whole register: sales of unrelated goods wait for no reason
- ✗Reading the balance before the expense movements are written: the check misses this document's own write-off
Follow-up questions
- →How would you order the locks for documents with many goods so that two postings never deadlock?
- →How does splitting the register's totals change the waiting in this scenario?