Desktop version

Main > Forum > 1C:Enterprise Platform > Studying 1C:Enterprise platform > Document totals calculation

Forum

Search UsersRules
Document totals calculation
#1
Active user
Points:: 0
Joined:: Jul 18, 2012

Hi!

I have a new question: when the document totals should be calculated what is the right beh * avior: to calculate it on each tabular section attribute change or during posting? For example I have a document with tabular section containing the following attributes: Item, Quantity, Price, Amount and overall Total attribute of the document.

And one more question: what if to store prices in the information register to update them all at a time? I’m not sure if it is useful feature…

Profile
#2
Active user
Points:: 2
Joined:: Sep 16, 2011

Hi, Lies Susann,

You need to add a procedure for calculating totals and use it in separate OnChange event handlers for each attribute which, if changed, influences the total values.

Profile
#3
Active user
Points:: 0
Joined:: Jul 18, 2012

Thank you, Xin Wang!

And what if I have a document with 10-100 thousand lines and calculate totals for each change event wouldn’t it be too slow for a user?

Profile
#4
Just came
Points:: 0
Joined:: May 5, 2012

In standard 1C configurations(like 1C Accounting for Ukraine or 1C Trade Management for Ukraine), total amount calculates at the procedure "Before Write".

Profile
#5
Just came
Points:: 0
Joined:: Nov 2, 2011

Quote
Lies Susann wrote:
I have a new question: when the document totals should be calculated what is the right beh * avior: to calculate it on each tabular section attribute change or during posting?
As the user will wish :-)
If you care about performance, you can calculate totals inside OnEditEnd event handler.
You can use local variables for storing totals and decrease totals inside "BeforeRowChange"  and increase new totals inside "OnEditEnd"

Profile
#6
Active user
Points:: 0
Joined:: Jul 18, 2012

Thank you! That is interesting idea to calculate overall total incrementally.

Profile
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)



© 1C LLC. All rights reserved
1C Company respects the privacy of our customers and visitors
to our Web-site.