Quintiq file version 2.0
|
#parent: #root
|
StaticMethod Update (
|
Accounts accounts,
|
Boolean isbatcheditparent,
|
Account parent,
|
Boolean isbatcheditaccounttype,
|
String accounttype,
|
Boolean isbatcheditreporttype,
|
String reporttype,
|
Boolean isbatcheditbudget,
|
Real budget,
|
Boolean isbatcheditdefaultcost,
|
Real defaultcost,
|
String defaultcostdriver,
|
Number defaultlengthoftime,
|
String defaulttimeunit
|
)
|
{
|
Description: 'Batch update accounts'
|
TextBody:
|
[*
|
// Batch update the selected set of accounts
|
traverse( accounts, Elements, account )
|
{
|
// Set the corresponding parent, account type, report type, and budget according to the batch edit settings
|
parent := ifexpr( isbatcheditparent, parent, account.Parent() );
|
accounttype := ifexpr( isbatcheditaccounttype, accounttype, account.AccountTypeName() );
|
reporttype := ifexpr( isbatcheditreporttype, reporttype, account.ReportType() );
|
budget := ifexpr( isbatcheditbudget, budget, account.Budget() );
|
|
// If default cost attributes are not selected to be batch edited,
|
if( not isbatcheditdefaultcost )
|
{
|
defaultcost := account.DefaultCost();
|
defaultcostdriver := account.DefaultCostDriver();
|
defaultlengthoftime := account.DefaultLengthOfTime();
|
defaulttimeunit := account.DefaultTimeUnit();
|
}
|
|
// Update account's attributes
|
account.Update( guard( parent.Name(), '' ), accounttype, reporttype, budget,
|
defaultcost, defaultcostdriver, defaultlengthoftime, defaulttimeunit, account.IsPercentage() );
|
}
|
|
// This will update all the accounts
|
scenariomanager := accounts.Element( 0 ).ScenarioManager();
|
if( not isnull( scenariomanager ) )
|
{
|
scenariomanager.UpdateAccountChanges();
|
}
|
*]
|
}
|