Rating:
27
Joined: Apr 5, 2012
Company: 1TÇ Şirketi - Merv Bilgi İşlem Otomasyonu Yazılım Ltd. Şti.
Hi,
We have two documents: 1. Accounting Doc. This document doesn't contain tabular section. In form as tabular section viewed register record set table. For ExtraDimension 1,2,3 fields typelink is setted form according account.
So when user choose account, extradimension 1,2,3 fields are automatically become readonly or not.
2. Another Document. This document contain tabular section. In tab. section there are 4 attributes Account, ExtraDimension 1,2,3. For ExtraDimension 1,2,3 fields typelink is setted form according account.
So when user choose account, extradimension 1,2,3 fields are NOT automatically become readonly or not.
Question: The logical work of TypeLink property is changed according table type? Or it's little bug?
The first one is you need to get account parameters:
Code
Query = New Query;
Query.SetParameter("Account", Account);
Query.Text =
"SELECT
| Accounting.Ref,
| Accounting.Parent,
| Accounting.Code,
| Accounting.Description,
| Accounting.Type,
| Accounting.OffBalance,
| Accounting.DontUse,
| Accounting.ByCurrency,
| Accounting.ByQuantity,
| Accounting.ByDepartment,
| Accounting.ForTaxes
|FROM
| ChartOfAccounts.Accounting AS Accounting
|WHERE
| Accounting.Ref = &Account
|;
|
|////////////////////////////////////////////////////////////////////////////////
|SELECT
| ChartOfAccountsAccountingAnalytics.LineNumber AS LineNumber,
| ChartOfAccountsAccountingAnalytics.ExtDimensionType AS AnalyticalDimensionType,
| ChartOfAccountsAccountingAnalytics.ExtDimensionType.Description AS Description,
| ChartOfAccountsAccountingAnalytics.ExtDimensionType.ValueType AS ValueType,
| ChartOfAccountsAccountingAnalytics.TurnoversOnly AS TurnoversOnly,
| ChartOfAccountsAccountingAnalytics.ByAmount AS ByAmount
|FROM
| ChartOfAccounts.Accounting.ExtDimensionTypes AS ChartOfAccountsAccountingAnalytics
|WHERE
| ChartOfAccountsAccountingAnalytics.Ref = &Account
|
|ORDER BY
| ChartOfAccountsAccountingAnalytics.LineNumber";
ResultArray = Query.ExecuteBatch();
Selection = ResultArray[0].Select();
If Selection.Next() Then
FillPropertyValues(AccountData, Selection);
EndIf;
AnalyticalDimensionTypesSelection = ResultArray[1].Select();
AccountData.AnalyticalDimensionCount = AnalyticalDimensionTypesSelection.Count();
Index = 0;
While AnalyticalDimensionTypesSelection.Next() Do
Index = Index + 1;
AccountData.Insert("AnalyticalDimensionType" + Index,
AnalyticalDimensionTypesSelection.AnalyticalDimensionType);
AccountData.Insert("AnalyticalDimensionType" + Index + "Description",
AnalyticalDimensionTypesSelection.Description);
AccountData.Insert("AnalyticalDimensionType" + Index + "ValueType",
AnalyticalDimensionTypesSelection.ValueType);
AccountData.Insert("AnalyticalDimensionType" + Index + "ByAmount",
AnalyticalDimensionTypesSelection.ByAmount);
AccountData.Insert("AnalyticalDimensionType" + Index + "TurnoversOnly",
AnalyticalDimensionTypesSelection.TurnoversOnly);
EndDo;
Code
Function GetMaxAnalyticalDimensionCount() Export
Return Metadata.ChartsOfAccounts.Accounting.MaxExtDimensionCount;
EndFunction
Then set form attributes to let this data be used in Conditional appearance:
Code
For Index = 1 to MaxAnalyticalDimensionCount Do
If ObjectFields.Property("AnalyticalDimension" + Index) Then
Object[ObjectFields["AnalyticalDimension" + Index] + "Enabled"]
= (Index <= AccountData.AnalyticalDimensionCount);
EndIf;
EndDo;
And the second is Conditional appearance. The current recommendation is to set Conditional appearance using Script as it it easier to monitor when you make changes in your applied solution.
Code
For Index = 1 To AccountingServerCallCached.GetMaxAnalyticalDimensionCount() Do
ConditionalAppearanceItem = ConditionalAppearance.Items.Add();
AdjustedField = ConditionalAppearanceItem.Fields.Items.Add();
AdjustedField.Field = New DataCompositionField("RecordsAnalyticalDimension" + Index);
FilterItem = ConditionalAppearanceItem.Filter.Items.Add(
Type("DataCompositionFilterItem"));
FilterItem.LeftValue = New DataCompositionField("Object.Records.AnalyticalDimension"
+ Index + "Enabled");
FilterItem.ComparisonType = DataCompositionComparisonType.Equal;
FilterItem.RightValue = False;
ConditionalAppearanceItem.Appearance.SetParameterValue("Enabled", False);
EndDo;
I have prepared a complete example for you. See the attached .cf file for that.
Hello Murat, How can I multiply ChartOfAccounts by company?
Sample ChartOfAccounts A company 100 XXX 200 XXX 500 XXX ChartOfAccounts B company 100 XXX 200 XXX 500 XXX ChartOfAccounts C company 100 XXX 200 XXX 500 XXX
Hello, Company A Company B Company C I want to make a separate account plan for these companies. I do not want the account amounts to be confused. I want to get a separate trial. If there is a single account plan, I cannot parse and accounts get confused. Sample Company A 600.01.01 account Company B 600.01.002 account Company C 600.01.003.001 account this can happen.
What 1c solution are you using now? Is this an existing solution or you want to make your own fr om scratch ?
Basically in 1c there is no need to make the way you want to do. All information in accounting registers is kept with dimensions/filters of the company and account number. So, you can filter accounting information by company and/or account number. For example all information for Company A on account 600.01.01 in accounting register is kept separately of Company B and so on. So, you just need to make 1 chart of accounts and provide dimension for companies in it.
If you still prefer to see separate accounts for each company you can have one single chart of accounts still but make a filter for each account and link it to certain company. It will mean that account 600.01.01 belong to company A, 600.01.003.001 account to Company C, etc. Then use this filter in each form wh ere you open account for selection.
Hope this is helpful t you. If you need more information about it or need further help you can contact me on info@rufinor.ru