ITCSNormTables
Наследование 
Функции и процедуры
Интерфейс на нормировочные и справочные таблицы
См. также:
ITcs_Application2
.GetLookupTables,
ITcs_Application2
.GetNormSettingTables,
ITcs_Application2
.GetRationingTables
Пример на VB Script:
Sub Test()
'
' Копирование таблицы
'
Dim iTables
Dim dTables
Dim TableParams
Dim TableParams2
Dim TableParamValue
Dim TableParamValue2
Dim TableValues
Dim TableValue
Dim IdTableValue
Dim ArrayCountValue()
Dim ArrayIdValue()
Dim ArrayIdValue2()
Dim ArrayIdTableParamValue()
Dim pz()
Dim cnP, cn, cnt, cMax, ks
Dim I, NodeId
Set iTables = TCSApp.GetNormSettingTables
iTables.UserModuleName = iTables.UniqueUserModuleName
If iTables.RunModuleForSelect("Выберите таблицу трудового нормирования для копирования", False) Then
Set dTables = TCSApp.GetNormSettingTables
I = dTables.Locate( "ID", iTables.Properties("ID").AsInteger, 0 )
NodeId = iTables.DbTree.Selected.NodeId
Set dTables = TCSApp.GetNormSettingTables
I = dTables.Locate( "ID", iTables.Properties("ID").AsInteger, 0 )
dTables.DbTree.DbNodeByNodeId(NodeId).Selected = True
Call dTables.CreateNew
dTables.Properties("NOTE").Value = iTables.Properties("NOTE").Value + " (копия)"
dTables.Properties("NAME").Value = iTables.Properties("NAME").Value + " (копия)"
dTables.Properties("KIND_OF_TIME").Value = iTables.Properties("KIND_OF_TIME").Value
dTables.Properties("TIME_IN").Value = iTables.Properties("TIME_IN").Value
dTables.Properties("IS_COEFFICIENT").Value = iTables.Properties("IS_COEFFICIENT").Value
dTables.Properties("COEFFICIENT_TABLE_ID").Value = iTables.Properties("COEFFICIENT_TABLE_ID").Value
dTables.Properties("TABLE_REM").Value = iTables.Properties("TABLE_REM").Value
On Error Resume Next
Call dTables.SaveChanges
Call dTables.CancelChanges
Set TableParams = iTables.Properties("TableParams").AsIDispatch
Set TableParams2 = dTables.Properties("TableParams").AsIDispatch
cnP = 0
cMax = 0
TableParams.First
Do While Not TableParams.EOF
Call TableParams2.CreateNew
TableParams2.Properties("TABLE_PARAM_NAME").Value = TableParams.Properties("TABLE_PARAM_NAME").Value
Call TableParams2.SaveChanges
cnP = cnP + 1
Redim Preserve ArrayCountValue(cnP)
ArrayCountValue(cnP) = 0
Set TableParamValue = TableParams.Properties("TableParamValue").AsIDispatch
Set TableParamValue2 = TableParams2.Properties("TableParamValue").AsIDispatch
TableParamValue.First
Do While Not TableParamValue.EOF
Call TableParamValue2.CreateNew
TableParamValue2.Properties("TABLE_PARAMVALUE_NAME").Value = TableParamValue.Properties("TABLE_PARAMVALUE_NAME").Value
Call TableParamValue2.SaveChanges
ArrayCountValue(cnP) = ArrayCountValue(cnP) + 1
TableParamValue.Next
Loop
If ArrayCountValue(cnP) > cMax Then
cMax = ArrayCountValue(cnP)
End If
TableParams.Next
Loop
Redim ArrayIdValue(cnP,cMax)
Redim ArrayIdValue2(cnP,cMax)
TableParams.First
TableParams2.First
For cn = 1 To cnP
Set TableParamValue = TableParams.Properties("TableParamValue").AsIDispatch
Set TableParamValue2 = TableParams2.Properties("TableParamValue").AsIDispatch
TableParamValue.First
TableParamValue2.First
For cnt = 1 To ArrayCountValue(cn)
ArrayIdValue(cn,cnt) = TableParamValue.Properties("ID").AsInteger
ArrayIdValue2(cn,cnt) = TableParamValue2.Properties("ID").AsInteger
TableParamValue.Next
TableParamValue2.Next
Next
TableParams.Next
TableParams2.Next
Next
Redim ArrayIdTableParamValue(cnP-1)
ks = ArrayCountValue(1)
For cn = 2 To cnP
ks = ks * ArrayCountValue(cn)
Next
Redim pz(cnP)
For cn = 1 To cnP
pz(cn) = 1
Next
For cnt = 1 To ks
For cn = 1 To cnP
ArrayIdTableParamValue(cn-1) = ArrayIdValue(cn,pz(cn))
Next
IdTableValue = iTables.GetIDTableValue( ArrayIdTableParamValue )
If IdTableValue <> -1 Then
TableValue = iTables.GetTableValue( IdTableValue )
For cn = 1 To cnP
ArrayIdTableParamValue(cn-1) = ArrayIdValue2(cn,pz(cn))
Next
Call dTables.AddTableValue( ArrayIdTableParamValue, TableValue )
End If
For cn = cnP To 1 Step -1
If pz(cn) < ArrayCountValue(cn) Then
pz(cn) = pz(cn) + 1
Exit For
Else
pz(cn) = 1
End If
Next
Next
Set TableParamValue = Nothing
Set TableParamValue2 = Nothing
Set TableParams = Nothing
Set TableParams2 = Nothing
Set TableValues = dTables.Properties("TableValues").AsIDispatch
I = TableValues.ShowModal("Смотрим что получилось")
Set TableValues = Nothing
End If
End Sub