From 1924a4cf4557412a87b5f76fe56485b73f1e5530 Mon Sep 17 00:00:00 2001 From: DitriXNew Date: Tue, 9 Jan 2024 03:30:03 +0300 Subject: [PATCH] Translate --- .../R5022T_Expenses/ManagerModule.bsl | 10 +- .../R6020B_BatchBalance/ManagerModule.bsl | 7 +- .../R6060T_CostOfGoodsSold/ManagerModule.bsl | 7 +- .../ManagerModule.bsl | 10 +- .../ChartsOfAccounts/Basic/ObjectModule.bsl | 4 +- IRP/src/CommonForms/ReportForm/Form.form | 35 + IRP/src/CommonForms/ReportForm/Module.bsl | 278 +- .../CommonModules/AccountingServer/Module.bsl | 96 +- .../AccountingServerReuse/Module.bsl | 4 +- .../AdvancesRelevanceServer/Module.bsl | 2 +- .../CommonFunctionsServer/Module.bsl | 177 +- .../CommonModules/CurrenciesServer/Module.bsl | 98 +- .../ObjectAccessFullAccess/Module.bsl | 21 +- .../OffsetOfAdvancesServer/Module.bsl | 41 +- .../CommonModules/PostingServer/Module.bsl | 507 ++-- .../UndopostingServer/Module.bsl | 46 +- IRP/src/Configuration/Configuration.mdo | 6 +- .../AnaliseDocumentMovements.mdo | 2 +- .../ManagerModule.bsl | 25 +- .../ManagerModule.bsl | 25 +- .../Documents/BankPayment/ManagerModule.bsl | 260 +- .../Documents/BankReceipt/ManagerModule.bsl | 332 +-- .../Documents/CashPayment/ManagerModule.bsl | 260 +- .../Documents/CashReceipt/ManagerModule.bsl | 267 +- .../Documents/CashStatement/ManagerModule.bsl | 64 +- .../ManagerModule.bsl | 2 +- .../Documents/CreditNote/ManagerModule.bsl | 18 +- IRP/src/Documents/DebitNote/ManagerModule.bsl | 18 +- .../ManagerModule.bsl | 2 +- .../ManagerModule.bsl | 10 +- .../JournalEntry/Forms/DocumentForm/Form.form | 7 + .../ManagerModule.bsl | 2 +- .../Documents/OpeningEntry/ManagerModule.bsl | 236 +- .../ProductionPlanning/ManagerModule.bsl | 2 +- .../ManagerModule.bsl | 8 +- .../PurchaseInvoice/ManagerModule.bsl | 228 +- .../PurchaseReturn/ManagerModule.bsl | 2 +- .../RetailReturnReceipt/ManagerModule.bsl | 243 +- .../RetailSalesReceipt/ManagerModule.bsl | 2 +- .../Documents/SalesInvoice/ManagerModule.bsl | 14 +- .../ManagerModule.bsl | 2 +- .../Documents/SalesReturn/ManagerModule.bsl | 180 +- .../ManagerModule.bsl | 2 +- .../ManagerModule.bsl | 2 +- IRP/src/Documents/WorkSheet/ManagerModule.bsl | 2 +- .../UseAccounting/UseAccounting.mdo | 4 + .../Forms/RecordForm/Form.form | 50 + .../Forms/RecordForm/Module.bsl | 9 +- .../T9012S_AccountsPartner.mdo | 24 + .../AccountAnalysis/AccountAnalysis.mdo | 38 + .../Reports/AccountAnalysis/ManagerModule.bsl | 94 + .../MainDataCompositionSchema/Template.dcs | 944 +++++++ IRP/src/Reports/AccountCard/AccountCard.mdo | 38 + .../MainDataCompositionSchema/Template.dcs | 2396 +++++++++++++++++ .../Templates/Template/Template.dcs | 2 +- .../MainDataCompositionSchema/Template.dcs | 4 +- .../MainDataCompositionSchema/Template.dcs | 2 +- .../Templates/Template/Template.dcs | 2 +- .../Templates/Template/Template.dcs | 2 +- .../Templates/Template/Template.dcs | 2 +- .../Templates/Template/Template.dcs | 2 +- .../Templates/Template/Template.dcs | 2 +- .../Reports/TrialBalance/ManagerModule.bsl | 51 + .../MainDataCompositionSchema/Template.dcs | 1965 ++++++++++++++ IRP/src/Reports/TrialBalance/TrialBalance.mdo | 38 + .../TrialBalanceByAccount/ManagerModule.bsl | 97 + .../MainDataCompositionSchema/Template.dcs | 2192 +++++++++++++++ .../TrialBalanceByAccount.mdo | 38 + IRP/src/Subsystems/Accounting/Accounting.mdo | 4 + features/External/TestDataBase.feature | 106 +- .../_9910AccountingSettings.feature | 218 +- 71 files changed, 10253 insertions(+), 1637 deletions(-) create mode 100644 IRP/src/Reports/AccountAnalysis/AccountAnalysis.mdo create mode 100644 IRP/src/Reports/AccountAnalysis/ManagerModule.bsl create mode 100644 IRP/src/Reports/AccountAnalysis/Templates/MainDataCompositionSchema/Template.dcs create mode 100644 IRP/src/Reports/AccountCard/AccountCard.mdo create mode 100644 IRP/src/Reports/AccountCard/Templates/MainDataCompositionSchema/Template.dcs create mode 100644 IRP/src/Reports/TrialBalance/ManagerModule.bsl create mode 100644 IRP/src/Reports/TrialBalance/Templates/MainDataCompositionSchema/Template.dcs create mode 100644 IRP/src/Reports/TrialBalance/TrialBalance.mdo create mode 100644 IRP/src/Reports/TrialBalanceByAccount/ManagerModule.bsl create mode 100644 IRP/src/Reports/TrialBalanceByAccount/Templates/MainDataCompositionSchema/Template.dcs create mode 100644 IRP/src/Reports/TrialBalanceByAccount/TrialBalanceByAccount.mdo diff --git a/IRP/src/AccumulationRegisters/R5022T_Expenses/ManagerModule.bsl b/IRP/src/AccumulationRegisters/R5022T_Expenses/ManagerModule.bsl index 8ae60a6fd0..5988f8d603 100644 --- a/IRP/src/AccumulationRegisters/R5022T_Expenses/ManagerModule.bsl +++ b/IRP/src/AccumulationRegisters/R5022T_Expenses/ManagerModule.bsl @@ -98,19 +98,23 @@ Procedure Expenses_LoadRecords(CalculationMovementCostRef) Export CurrenciesParameters = New Structure(); PostingDataTables = New Map(); - PostingDataTables.Insert(RecordSet, New Structure("RecordSet", ExpenseTable)); + + ExpenseTableSettings = PostingServer.PostingTableSettings(RecordSet.Metadata().Name, ExpenseTable, RecordSet); + PostingDataTables.Insert(RecordSet.Metadata(), ExpenseTableSettings); + ArrayOfPostingInfo = New Array(); For Each DataTable In PostingDataTables Do ArrayOfPostingInfo.Add(DataTable); EndDo; CurrenciesParameters.Insert("Object", QuerySelection.Document); + CurrenciesParameters.Insert("Metadata", QuerySelection.Document.Metadata()); CurrenciesParameters.Insert("ArrayOfPostingInfo", ArrayOfPostingInfo); CurrenciesServer.PreparePostingDataTables(CurrenciesParameters, Undefined); For Each ItemOfPostingInfo In ArrayOfPostingInfo Do - If TypeOf(ItemOfPostingInfo.Key) = Type("AccumulationRegisterRecordSet.R5022T_Expenses") Then + If ItemOfPostingInfo.Key = Metadata.AccumulationRegisters.R5022T_Expenses Then RecordSet.Read(); - For Each RowPostingInfo In ItemOfPostingInfo.Value.RecordSet Do + For Each RowPostingInfo In ItemOfPostingInfo.Value.PrepareTable Do FillPropertyValues(RecordSet.Add(), RowPostingInfo); EndDo; RecordSet.SetActive(True); diff --git a/IRP/src/AccumulationRegisters/R6020B_BatchBalance/ManagerModule.bsl b/IRP/src/AccumulationRegisters/R6020B_BatchBalance/ManagerModule.bsl index ee30586fa6..204dd0289e 100644 --- a/IRP/src/AccumulationRegisters/R6020B_BatchBalance/ManagerModule.bsl +++ b/IRP/src/AccumulationRegisters/R6020B_BatchBalance/ManagerModule.bsl @@ -30,7 +30,7 @@ Procedure BatchBalance_Clear(DocObjectRef, Cancel) Export EndDo; EndProcedure -Procedure BatchBalance_CollectRecords(DocObject) Export +Function BatchBalance_CollectRecords(DocObject) Export Query = New Query; Query.Text = "SELECT @@ -198,9 +198,8 @@ Procedure BatchBalance_CollectRecords(DocObject) Export |WHERE | R6040T_BatchShortageIncoming.Document = &Document"; Query.SetParameter("Document", DocObject.Ref); - QueryResult = Query.Execute(); - DocObject.RegisterRecords.R6020B_BatchBalance.Load(QueryResult.Unload()); -EndProcedure + Return Query.Execute().Unload(); +EndFunction Procedure BatchBalance_LoadRecords(CalculationMovementCostRef) Export Query = New Query; diff --git a/IRP/src/AccumulationRegisters/R6060T_CostOfGoodsSold/ManagerModule.bsl b/IRP/src/AccumulationRegisters/R6060T_CostOfGoodsSold/ManagerModule.bsl index 84452d5881..55f04279db 100644 --- a/IRP/src/AccumulationRegisters/R6060T_CostOfGoodsSold/ManagerModule.bsl +++ b/IRP/src/AccumulationRegisters/R6060T_CostOfGoodsSold/ManagerModule.bsl @@ -32,7 +32,7 @@ Procedure CostOfGoodsSold_Clear(DocObjectRef, Cancel) Export EndDo; EndProcedure -Procedure CostOfGoodsSold_CollectRecords(DocObject) Export +Function CostOfGoodsSold_CollectRecords(DocObject) Export Query = New Query; Query.Text = "SELECT @@ -249,9 +249,8 @@ Procedure CostOfGoodsSold_CollectRecords(DocObject) Export | OR BatchWiseBalance.AllocatedRevenueTaxAmount <> 0)"; Query.SetParameter("Document", DocObject.Ref); - QueryResult = Query.Execute(); - DocObject.RegisterRecords.R6060T_CostOfGoodsSold.Load(QueryResult.Unload()); -EndProcedure + Return Query.Execute().Unload(); +EndFunction Procedure CostOfGoodsSold_LoadRecords(CalculationMovementCostRef) Export Query = New Query; diff --git a/IRP/src/AccumulationRegisters/R8510B_BookValueOfFixedAsset/ManagerModule.bsl b/IRP/src/AccumulationRegisters/R8510B_BookValueOfFixedAsset/ManagerModule.bsl index b318abbd7e..072d7f69f7 100644 --- a/IRP/src/AccumulationRegisters/R8510B_BookValueOfFixedAsset/ManagerModule.bsl +++ b/IRP/src/AccumulationRegisters/R8510B_BookValueOfFixedAsset/ManagerModule.bsl @@ -72,19 +72,23 @@ Procedure BookValueOfFixedAsset_LoadRecords(CalculationMovementCostRef) Export CurrenciesParameters = New Structure(); PostingDataTables = New Map(); - PostingDataTables.Insert(RecordSet, New Structure("RecordSet", BookValueTable)); + + BookValueTableSettings = PostingServer.PostingTableSettings(RecordSet.Metadata().Name, BookValueTable, RecordSet); + PostingDataTables.Insert(RecordSet.Metadata(), BookValueTableSettings); + ArrayOfPostingInfo = New Array(); For Each DataTable In PostingDataTables Do ArrayOfPostingInfo.Add(DataTable); EndDo; CurrenciesParameters.Insert("Object", QuerySelection.Document); + CurrenciesParameters.Insert("Metadata", QuerySelection.Document.Metadata()); CurrenciesParameters.Insert("ArrayOfPostingInfo", ArrayOfPostingInfo); CurrenciesServer.PreparePostingDataTables(CurrenciesParameters, Undefined); For Each ItemOfPostingInfo In ArrayOfPostingInfo Do - If TypeOf(ItemOfPostingInfo.Key) = Type("AccumulationRegisterRecordSet.R8510B_BookValueOfFixedAsset") Then + If ItemOfPostingInfo.Key = Metadata.AccumulationRegisters.R8510B_BookValueOfFixedAsset Then RecordSet.Read(); - For Each RowPostingInfo In ItemOfPostingInfo.Value.RecordSet Do + For Each RowPostingInfo In ItemOfPostingInfo.Value.PrepareTable Do FillPropertyValues(RecordSet.Add(), RowPostingInfo); EndDo; RecordSet.SetActive(True); diff --git a/IRP/src/ChartsOfAccounts/Basic/ObjectModule.bsl b/IRP/src/ChartsOfAccounts/Basic/ObjectModule.bsl index 2469f73a92..502f46c9e3 100644 --- a/IRP/src/ChartsOfAccounts/Basic/ObjectModule.bsl +++ b/IRP/src/ChartsOfAccounts/Basic/ObjectModule.bsl @@ -6,7 +6,9 @@ Procedure BeforeWrite(Cancel) Result = GetSearchCodeAndOrder(ThisObject.Code); ThisObject.SearchCode = Result.SearchCode; - ThisObject.Order = Result.Order; + If Not ValueIsFilled(ThisObject.Order) Then + ThisObject.Order = Result.Order; + EndIf; EndProcedure Function GetSearchCodeAndOrder(_Code) diff --git a/IRP/src/CommonForms/ReportForm/Form.form b/IRP/src/CommonForms/ReportForm/Form.form index daa443c665..fd7d0419a4 100644 --- a/IRP/src/CommonForms/ReportForm/Form.form +++ b/IRP/src/CommonForms/ReportForm/Form.form @@ -1061,6 +1061,10 @@ Left true + + DetailProcessing + ResultDetailProcessing + 100 true 10 @@ -1517,6 +1521,31 @@ + + IsDetailProcessing + + <key>en</key> + <value>Is detail processing</value> + + + <key>ru</key> + <value>Обрабатывается детализация</value> + + + <key>tr</key> + <value>Detal işleniyor</value> + + 5 + + Boolean + + + true + + + true + + CustomParameters @@ -1567,6 +1596,12 @@ </action> <currentRowUse>Auto</currentRowUse> </formCommands> + <parameters> + <name>IsDetailProcessing</name> + <valueType> + <types>Boolean</types> + </valueType> + </parameters> <commandInterface> <navigationPanel/> <commandBar/> diff --git a/IRP/src/CommonForms/ReportForm/Module.bsl b/IRP/src/CommonForms/ReportForm/Module.bsl index 9fc8b5f82f..80f813ca3d 100644 --- a/IRP/src/CommonForms/ReportForm/Module.bsl +++ b/IRP/src/CommonForms/ReportForm/Module.bsl @@ -1,13 +1,20 @@ + #Region FormEventHandlers &AtServer Procedure OnCreateAtServer(Cancel, StandardProcessing) - ReportFullName = ReportName(); + ThisObject.IsDetailProcessing = Parameters.IsDetailProcessing; + ReportFullName = ReportName(ThisObject); ExternalCommandsServer.CreateCommands(ThisObject, ReportFullName, Enums.FormTypes.ObjectForm); EndProcedure &AtClient Procedure OnOpen(Cancel) + If ThisObject.IsDetailProcessing Then + ThisObject.VariantModified = False; + ComposeResult(); + EndIf; + CustomParametersSwitch(); EditReportSwitch(); EndProcedure @@ -47,9 +54,9 @@ EndProcedure #Region Private -&AtServer -Function ReportName() - SplittedFormName = StrSplit(ThisObject.FormName, "."); +&AtClientAtServerNoContext +Function ReportName(Form) + SplittedFormName = StrSplit(Form.FormName, "."); SplittedFormName.Delete(SplittedFormName.UBound()); Return StrConcat(SplittedFormName, "."); EndFunction @@ -65,4 +72,265 @@ Procedure EditReportSwitch() Items.Result.Edit = Items.FormEditReport.Check; EndProcedure -#EndRegion \ No newline at end of file +#EndRegion + +&AtClient +Procedure ResultDetailProcessing(Item, Details, StandardProcessing, AdditionalParameters) + _ReportName = StrSplit(ThisObject.FormName, ".")[1]; + ReportsWithDetailProcessing = GetReportsWithDetailProcesing(); + If ReportsWithDetailProcessing.Find(_ReportName) = Undefined Then + Return; // report not support detail processing + EndIf; + + DetailsInfo = ExtractDetailsInfo(_ReportName, Details); + + If Not DetailsInfo.AdditionalDetailsActions.MenuList.Count() Then + Return; // additional menu list is empty + EndIf; + + StandardProcessing = False; + + SourceOfSettings = New DataCompositionAvailableSettingsSource(ThisObject.Report); + DetailsProcess = New DataCompositionDetailsProcess(ThisObject.DetailsData, SourceOfSettings); + + StandardActions = New Array(); + StandardActions.Add(DataCompositionDetailsProcessingAction.ApplyAppearance); + StandardActions.Add(DataCompositionDetailsProcessingAction.DrillDown); + StandardActions.Add(DataCompositionDetailsProcessingAction.Filter); + StandardActions.Add(DataCompositionDetailsProcessingAction.Group); + StandardActions.Add(DataCompositionDetailsProcessingAction.OpenValue); + StandardActions.Add(DataCompositionDetailsProcessingAction.Order); + StandardActions.Add(DataCompositionDetailsProcessingAction.None); + + NotifyParameters = New Structure("Details, DetailsInfo, ReportName", Details, DetailsInfo, _ReportName); + + Notify = New NotifyDescription("DoDetailProcess", ThisObject, NotifyParameters); + DetailsProcess.ShowActionChoice(Notify, Details, StandardActions, DetailsInfo.AdditionalDetailsActions.MenuList); +EndProcedure + +&AtClient +Procedure DoDetailProcess(SelectedAction, ApplyingSettings, NotifyParams) Экспорт + + If SelectedAction = DataCompositionDetailsProcessingAction.None Then + Return; + ElsIf SelectedAction = DataCompositionDetailsProcessingAction.DrillDown + Or SelectedAction = DataCompositionDetailsProcessingAction.ApplyAppearance + Or SelectedAction = DataCompositionDetailsProcessingAction.Filter + Or SelectedAction = DataCompositionDetailsProcessingAction.Group + Or SelectedAction = DataCompositionDetailsProcessingAction.Order Then + + DetailsProcessDescription = New DataCompositionDetailsProcessDescription(ThisObject.DetailsData, NotifyParams.Details, ApplyingSettings); + + ReportParameters = New Structure(); + ReportParameters.Insert("GenerateOnOpen", True); + ReportParameters.Insert("Details" , DetailsProcessDescription); + + OpenForm(ThisObject.FormName, ReportParameters, , New UUID()); + + ElsIf SelectedAction = DataCompositionDetailsProcessingAction.OpenValue Then + ShowValue(,ApplyingSettings); + Else + + OtherReportFormName = NotifyParams.DetailsInfo.AdditionalDetailsActions.OtherReportMapping[SelectedAction]; + OtherReportForm = GetForm(OtherReportFormName, New Structure("IsDetailProcessing", True), ThisObject, New UUID()); + + SettingsComposer1 = ThisObject.Report.SettingsComposer; + SettingsComposer2 = OtherReportForm.Report.SettingsComposer; + + ApplyingFilters = GetApplyingFilters(NotifyParams.ReportName, SelectedAction, NotifyParams.DetailsInfo.DetailValuesMap); + + If ApplyingFilters.Property("DataParameters") Then + For Each DataParameter In ApplyingFilters.DataParameters Do + SourceParameter = GetSettingsComposerParameter(SettingsComposer1, DataParameter.Key); + SetSettingsComposerParameter(SettingsComposer2, DataParameter.Value, SourceParameter.Value, SourceParameter.Use); + EndDo; + EndIf; + + If ApplyingFilters.Property("UserFilters") Then + For Each UserFilter In ApplyingFilters.UserFilters Do + SourceFilter = GetSettingsComposerFilter(SettingsComposer1, UserFilter.Key); + If SourceFilter <> Undefined And SourceFilter.Use Then + _Name = UserFilter.Value; + _Value = SourceFilter.Value; + _ComparisonType = SourceFilter.ComparisonType; + SetSettingsComposerFilter(SettingsComposer2, _Name, _Value, _ComparisonType); + EndIf; + EndDo; + EndIf; + + If ApplyingFilters.Property("DetailsFilters") Then + For Each DetailFilter In ApplyingFilters.DetailsFilters Do + _Name = DetailFilter.Value.FieldName; + _Value = DetailFilter.Key; + _ComparisonType = DetailFilter.Value.ComparisonType; + SetSettingsComposerFilter(SettingsComposer2, _Name, _Value, _ComparisonType); + EndDo; + EndIf; + + If ApplyingFilters.Property("DetailsFiltersGroupOR") Then + For Each GroupItem In ApplyingFilters.DetailsFiltersGroupOR Do + GroupOr = CreateSettingsComposerFilterGroup(SettingsComposer2, "OR"); + For Each FilterItem In GroupItem Do + For Each DetailFilter In FilterItem Do + _Name = DetailFilter.Value.FieldName; + _Value = DetailFilter.Key; + _ComparisonType = DetailFilter.Value.ComparisonType; + AddSettingsComposerFilterToGroup(SettingsComposer2, GroupOr, _Name, _Value, _ComparisonType); + EndDo; + EndDo; + EndDo; + EndIf; + + OtherReportForm.Open(); + EndIf; +EndProcedure + +&AtServer +Function ExtractDetailsInfo(_ReportName, Details) + DetailsDataPaths = Reports[_ReportName].GetDetailsDataPaths(); + ArrayOfDetailsDataPaths = StrSplit(DetailsDataPaths, ","); + For i=0 To ArrayOfDetailsDataPaths.Count() -1 Do + ArrayOfDetailsDataPaths[i] = TrimAll(ArrayOfDetailsDataPaths[i]); + EndDo; + + Data = GetFromTempStorage(ThisObject.DetailsData); + DetailValuesMap = Новый Map(); + FillMapByDataPaths(Data.Items[Details], DetailValuesMap, ArrayOfDetailsDataPaths); + + AdditionalDetailsActions = Reports[_ReportName].GetAdditionalDetailsActions(DetailValuesMap); + + Return New Structure("DetailValuesMap, AdditionalDetailsActions", DetailValuesMap, AdditionalDetailsActions); +EndFunction + +&AtServer +Procedure FillMapByDataPaths(FieldOrGroup, DetailValuesMap, ArrayOfDetailsDataPaths) + ArrayOfParents = FieldOrGroup.GetParents(); + For Each Parent In ArrayOfParents Do + If TypeOf(Parent) = Type("DataCompositionGroupDetailsItem") Then + FillMapByDataPaths(Parent, DetailValuesMap, ArrayOfDetailsDataPaths); + ElsIf TypeOf(Parent) = Type("DataCompositionFieldDetailsItem") Then + ArrayOfFields = Parent.GetFields(); + For Each FieldInfo In ArrayOfFields Do + If ArrayOfDetailsDataPaths.Find(FieldInfo.Field) <> Undefined + And Not ValueIsFilled(DetailValuesMap[FieldInfo.Field]) Then + DetailValuesMap[FieldInfo.Field] = FieldInfo.Value; + EndIf; + FillMapByDataPaths(Parent, DetailValuesMap, ArrayOfDetailsDataPaths); + EndDo; + EndIf; + EndDo; +EndProcedure + +&AtServer +Function GetApplyingFilters(_ReportName, SelectedAction, DetailValuesMap) + Return Reports[_ReportName].GetApplyingFilters(SelectedAction, DetailValuesMap); +EndFunction + +&AtClient +Function GetSettingsComposerFilter(SettingsComposer, Name) + FindField = New DataCompositionField(Name); + For Each Item In SettingsComposer.Settings.Filter.Items Do + If Item.LeftValue = FindField Then + UserFilterItem = SettingsComposer.UserSettings.Items.Find(Item.UserSettingID); + Filter = New Structure(); + Filter.Insert("Value", UserFilterItem.RightValue); + Filter.Insert("Use", UserFilterItem.Use); + Filter.Insert("ComparisonType", UserFilterItem.ComparisonType); + Return Filter; + EndIf; + EndDo;; + Return Undefined; +EndFunction + +&AtClient +Function GetSettingsComposerParameter(SettingsComposer, Name) + Id = SettingsComposer.Settings.DataParameters.Items.Find(Name).UserSettingID; + Parameter = SettingsComposer.UserSettings.Items.Find(Id); + Return New Structure("Value, Use", Parameter.Value, Parameter.Use); +EndFunction + +&AtClient +Procedure SetSettingsComposerParameter(SettingsComposer, Name, Value, Use) + Id = SettingsComposer.Settings.DataParameters.Items.Find(Name).UserSettingID; + Parameter = SettingsComposer.UserSettings.Items.Find(Id); + Parameter.Value = Value; + Parameter.Use = Use; +EndProcedure + +&AtClient +Procedure SetSettingsComposerFilter(SettingsComposer, Name, Value, ComparisonType) + Field = New DataCompositionField(Name); + + FilterItem = Undefined; + For Each Item In SettingsComposer.Settings.Filter.Items Do + If Item.LeftValue = Field Then + FilterItem = Item; + Break; + EndIf; + EndDo; + + If FilterItem <> Undefined Then + UserFilterItem = SettingsComposer.UserSettings.Items.Find(FilterItem.UserSettingID); + UserFilterItem.ComparisonType = ComparisonType; + UserFilterItem.Use = True; + UserFilterItem.RightValue = Value; + Return; + EndIf; + + Found = False; + For Each Item In SettingsComposer.UserSettings.Items Do + If TypeOf(Item) = Type("DataCompositionFilter") Then + UserFilterItem = Item.Items.Add(Type("DataCompositionFilterItem")); + UserFilterItem.LeftValue = Field; + UserFilterItem.ComparisonType = ComparisonType; + UserFilterItem.Use = True; + UserFilterItem.RightValue = Value; + Found = True; + EndIf; + EndDo; + + If Not Found Then + If SettingsComposer.Settings.Filter.FilterAvailableFields.Items.Find(Name) <> Undefined Then + UserFilterItem = SettingsComposer.Settings.Filter.Items.Add(Type("DataCompositionFilterItem")); + UserFilterItem.LeftValue = Field; + UserFilterItem.ComparisonType = ComparisonType; + UserFilterItem.Use = True; + UserFilterItem.RightValue = Value; + UserFilterItem.UserSettingID = New UUID(); + EndIf; + EndIf; +EndProcedure + +&AtClient +Function CreateSettingsComposerFilterGroup(SettingsComposer, GroupType) + FilterGroup = SettingsComposer.Settings.Filter.Items.Add(Type("DataCompositionFilterItemGroup")); + If Upper(GroupType) = "OR" Then + FilterGroup.GroupType = DataCompositionFilterItemsGroupType.OrGroup; + ElsIf Upper(GroupType) = "NOT" Then + FilterGroup.GroupType = DataCompositionFilterItemsGroupType.NotGroup; + ElsIf Upper(GroupType) = "AND" Then + FilterGroup.GroupType = DataCompositionFilterItemsGroupType.AndGroup; + EndIf; + Return FilterGroup; +EndFunction + +&AtClient +Procedure AddSettingsComposerFilterToGroup(SettingsComposer, FilterGroup, Name, Value, ComparisonType) + If SettingsComposer.Settings.Filter.FilterAvailableFields.Items.Find(Name) <> Undefined Then + UserFilterItem = FilterGroup.Items.Add(Type("DataCompositionFilterItem")); + UserFilterItem.LeftValue = New DataCompositionField(Name); + UserFilterItem.ComparisonType = ComparisonType; + UserFilterItem.Use = True; + UserFilterItem.RightValue = Value; +// UserFilterItem.UserSettingID = New UUID(); + EndIf; +EndProcedure + +&AtClient +Function GetReportsWithDetailProcesing() + ReportsWithDetails = New Array(); + ReportsWithDetails.Add("TrialBalance"); + ReportsWithDetails.Add("TrialBalanceByAccount"); + ReportsWithDetails.Add("AccountAnalysis"); + Return ReportsWithDetails; +EndFunction diff --git a/IRP/src/CommonModules/AccountingServer/Module.bsl b/IRP/src/CommonModules/AccountingServer/Module.bsl index 3ca368363c..3177463048 100644 --- a/IRP/src/CommonModules/AccountingServer/Module.bsl +++ b/IRP/src/CommonModules/AccountingServer/Module.bsl @@ -490,16 +490,16 @@ Function __GetT9011S_AccountsCashAccount(Period, Company, LedgerTypeVariant, Cas Return Result; EndFunction -Function GetT9012S_AccountsPartner(AccountParameters, Partner, Agreement) Export +Function GetT9012S_AccountsPartner(AccountParameters, Partner, Agreement, Currency) Export Return AccountingServerReuse.GetT9012S_AccountsPartner_Reuse( // Return __GetT9012S_AccountsPartner( AccountParameters.Period, AccountParameters.Company, AccountParameters.LedgerTypeVariant, - Partner, Agreement); + Partner, Agreement, Currency); EndFunction -Function __GetT9012S_AccountsPartner(Period, Company, LedgerTypeVariant, Partner, Agreement) Export +Function __GetT9012S_AccountsPartner(Period, Company, LedgerTypeVariant, Partner, Agreement, Currency) Export Query = New Query(); Query.Text = "SELECT @@ -512,7 +512,8 @@ Function __GetT9012S_AccountsPartner(Period, Company, LedgerTypeVariant, Partner | AND Company = &Company | AND LedgerTypeVariant = &LedgerTypeVariant | AND Agreement = &Agreement - | AND Partner.Ref IS NULL) AS ByAgreement + | AND Partner.Ref IS NULL + | AND Currency.Ref IS NULL) AS ByAgreement | |UNION ALL | @@ -525,20 +526,36 @@ Function __GetT9012S_AccountsPartner(Period, Company, LedgerTypeVariant, Partner | AND Company = &Company | AND LedgerTypeVariant = &LedgerTypeVariant | AND Partner = &Partner - | AND Agreement.Ref IS NULL) AS ByPartner + | AND Agreement.Ref IS NULL + | AND Currency.Ref IS NULL) AS ByPartner + | + |UNION ALL + | + |SELECT + | ByCurrency.AccountAdvancesVendor, + | ByCurrency.AccountTransactionsVendor, + | 3 + |FROM + | InformationRegister.T9012S_AccountsPartner.SliceLast(&Period, Vendor + | AND Company = &Company + | AND LedgerTypeVariant = &LedgerTypeVariant + | AND Currency = &Currency + | AND Agreement.Ref IS NULL + | AND Partner.Ref IS NULL) AS ByCurrency | |UNION ALL | |SELECT | ByCompany.AccountAdvancesVendor, | ByCompany.AccountTransactionsVendor, - | 3 + | 4 |FROM | InformationRegister.T9012S_AccountsPartner.SliceLast(&Period, Vendor | AND Company = &Company | AND LedgerTypeVariant = &LedgerTypeVariant | AND Partner.Ref IS NULL - | AND Agreement.Ref IS NULL) AS ByCompany + | AND Agreement.Ref IS NULL + | AND Currency.Ref IS NULL) AS ByCompany |; | |/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -552,7 +569,8 @@ Function __GetT9012S_AccountsPartner(Period, Company, LedgerTypeVariant, Partner | AND Company = &Company | AND LedgerTypeVariant = &LedgerTypeVariant | AND Agreement = &Agreement - | AND Partner.Ref IS NULL) AS ByAgreement + | AND Partner.Ref IS NULL + | AND Currency.Ref IS NULL) AS ByAgreement | |UNION ALL | @@ -565,20 +583,36 @@ Function __GetT9012S_AccountsPartner(Period, Company, LedgerTypeVariant, Partner | AND Company = &Company | AND LedgerTypeVariant = &LedgerTypeVariant | AND Partner = &Partner - | AND Agreement.Ref IS NULL) AS ByPartner + | AND Agreement.Ref IS NULL + | AND Currency.Ref IS NULL) AS ByPartner + | + |UNION ALL + | + |SELECT + | ByCurrency.AccountAdvancesCustomer, + | ByCurrency.AccountTransactionsCustomer, + | 3 + |FROM + | InformationRegister.T9012S_AccountsPartner.SliceLast(&Period, Customer + | AND Company = &Company + | AND LedgerTypeVariant = &LedgerTypeVariant + | AND Currency = &Currency + | AND Agreement.Ref IS NULL + | AND Partner.Ref IS NULL) AS ByCurrency | |UNION ALL | |SELECT | ByCompany.AccountAdvancesCustomer, | ByCompany.AccountTransactionsCustomer, - | 3 + | 4 |FROM | InformationRegister.T9012S_AccountsPartner.SliceLast(&Period, Customer | AND Company = &Company | AND LedgerTypeVariant = &LedgerTypeVariant | AND Partner.Ref IS NULL - | AND Agreement.Ref IS NULL) AS ByCompany + | AND Agreement.Ref IS NULL + | AND Currency.Ref IS NULL) AS ByCompany |; | |///////////////////////////////////////////////////////////////////////////////////////////////////// @@ -592,7 +626,8 @@ Function __GetT9012S_AccountsPartner(Period, Company, LedgerTypeVariant, Partner | AND Company = &Company | AND LedgerTypeVariant = &LedgerTypeVariant | AND Agreement = &Agreement - | AND Partner.Ref IS NULL) AS ByAgreement + | AND Partner.Ref IS NULL + | AND Currency.Ref IS NULL) AS ByAgreement | |UNION ALL | @@ -605,14 +640,29 @@ Function __GetT9012S_AccountsPartner(Period, Company, LedgerTypeVariant, Partner | AND Company = &Company | AND LedgerTypeVariant = &LedgerTypeVariant | AND Partner = &Partner - | AND Agreement.Ref IS NULL) AS ByPartner + | AND Agreement.Ref IS NULL + | AND Currency.Ref IS NULL) AS ByPartner + | + |UNION ALL + | + |SELECT + | ByCurrency.AccountAdvancesOther, + | ByCurrency.AccountTransactionsOther, + | 3 + |FROM + | InformationRegister.T9012S_AccountsPartner.SliceLast(&Period, Other + | AND Company = &Company + | AND LedgerTypeVariant = &LedgerTypeVariant + | AND Currency = &Currency + | AND Agreement.Ref IS NULL + | AND Partner.Ref IS NULL) AS ByCurrency | |UNION ALL | |SELECT | ByCompany.AccountAdvancesOther, | ByCompany.AccountTransactionsOther, - | 3 + | 4 |FROM | InformationRegister.T9012S_AccountsPartner.SliceLast(&Period, Other | AND Company = &Company @@ -661,6 +711,7 @@ Function __GetT9012S_AccountsPartner(Period, Company, LedgerTypeVariant, Partner Query.SetParameter("LedgerTypeVariant" , LedgerTypeVariant); Query.SetParameter("Partner" , Partner); Query.SetParameter("Agreement" , Agreement); + Query.SetParameter("Currency" , Currency); QueryResults = Query.ExecuteBatch(); @@ -925,6 +976,9 @@ Procedure UpdateAccountingTables(Object, EndDo; EndDo; EndIf; + + AccountingRowAnalytics.FillValues(Object.Ref, "Document"); + AccountingExtDimensions.FillValues(Object.Ref, "Document"); EndProcedure Function GetDocumentData(Object, TableRow, MainTableName) @@ -1207,19 +1261,23 @@ Function GetAccountingData_LandedCost(Parameters) CurrenciesParameters = New Structure(); PostingDataTables = New Map(); - PostingDataTables.Insert(RecordSet_AccountingAmounts, New Structure("RecordSet", TableAccountingAmounts)); + + TableAccountingAmountsSettings = PostingServer.PostingTableSettings(RecordSet_AccountingAmounts.Metadata().Name, TableAccountingAmounts, RecordSet_AccountingAmounts); + PostingDataTables.Insert(RecordSet_AccountingAmounts.Metadata(), TableAccountingAmountsSettings); + ArrayOfPostingInfo = New Array(); For Each DataTable In PostingDataTables Do ArrayOfPostingInfo.Add(DataTable); EndDo; CurrenciesParameters.Insert("Object", Parameters.Recorder); + CurrenciesParameters.Insert("Metadata", Parameters.Recorder.Metadata()); CurrenciesParameters.Insert("ArrayOfPostingInfo", ArrayOfPostingInfo); CurrenciesParameters.Insert("IsLandedCost", True); CurrenciesServer.PreparePostingDataTables(CurrenciesParameters, CurrenciesTable); For Each ItemOfPostingInfo In ArrayOfPostingInfo Do - If TypeOf(ItemOfPostingInfo.Key) = Type("AccumulationRegisterRecordSet.T1040T_AccountingAmounts") Then - For Each RowPostingInfo In ItemOfPostingInfo.Value.RecordSet Do + If ItemOfPostingInfo.Key = Metadata.AccumulationRegisters.T1040T_AccountingAmounts Then + For Each RowPostingInfo In ItemOfPostingInfo.Value.PrepareTable Do FillPropertyValues(CalculatedTableAccountingAmounts.Add(), RowPostingInfo); EndDo; EndIf; @@ -1647,8 +1705,8 @@ Procedure UpdateAnalyticsJE(QueryTable) _AccountingExtDimensions, AccountingClientServer.GetDocumentMainTable(Row.Ref)); - _AccountingRowAnalytics.FillValues(True, "Active"); - _AccountingExtDimensions.FillValues(True, "Active"); + //_AccountingRowAnalytics.FillValues(True, "Active"); + //_AccountingExtDimensions.FillValues(True, "Active"); RecordSet_T9050S.Load(_AccountingRowAnalytics); RecordSet_T9050S.Write(); diff --git a/IRP/src/CommonModules/AccountingServerReuse/Module.bsl b/IRP/src/CommonModules/AccountingServerReuse/Module.bsl index a0c1db4501..1d6e4e8bd4 100644 --- a/IRP/src/CommonModules/AccountingServerReuse/Module.bsl +++ b/IRP/src/CommonModules/AccountingServerReuse/Module.bsl @@ -7,8 +7,8 @@ Function GetT9011S_AccountsCashAccount_Reuse(Period, Company, LedgerTypeVariant, Return AccountingServer.__GetT9011S_AccountsCashAccount(Period, Company, LedgerTypeVariant, CashAccount); EndFunction -Function GetT9012S_AccountsPartner_Reuse(Period, Company, LedgerTypeVariant, Partner, Agreement) Export - Return AccountingServer.__GetT9012S_AccountsPartner(Period, Company, LedgerTypeVariant, Partner, Agreement); +Function GetT9012S_AccountsPartner_Reuse(Period, Company, LedgerTypeVariant, Partner, Agreement, Currency) Export + Return AccountingServer.__GetT9012S_AccountsPartner(Period, Company, LedgerTypeVariant, Partner, Agreement, Currency); EndFunction Function GetT9013S_AccountsTax_Reuse(Period, Company, LedgerTypeVariant, Tax, VatRate) Export diff --git a/IRP/src/CommonModules/AdvancesRelevanceServer/Module.bsl b/IRP/src/CommonModules/AdvancesRelevanceServer/Module.bsl index c3b828f3b7..ef5273595a 100644 --- a/IRP/src/CommonModules/AdvancesRelevanceServer/Module.bsl +++ b/IRP/src/CommonModules/AdvancesRelevanceServer/Module.bsl @@ -790,7 +790,7 @@ Procedure SetBound(DocObject, BoundParameters, RelevanceRegisterName) EndProcedure Function CopyRecords(Records, RegisterMetadata, FilterAttribute, FilterByCurrencyMovementType) - RecordsCopy = PostingServer.CreateTable(RegisterMetadata); + RecordsCopy = CommonFunctionsServer.CreateTable(RegisterMetadata); For Each Record In Records Do If ValueIsFilled(Record[FilterAttribute]) Then Continue; diff --git a/IRP/src/CommonModules/CommonFunctionsServer/Module.bsl b/IRP/src/CommonModules/CommonFunctionsServer/Module.bsl index 3560ba7430..5b758fa283 100644 --- a/IRP/src/CommonModules/CommonFunctionsServer/Module.bsl +++ b/IRP/src/CommonModules/CommonFunctionsServer/Module.bsl @@ -1368,7 +1368,7 @@ Procedure __CheckUniqueDescriptions(Cancel, Object) Export Query.SetParameter("Ref", Object.Ref); - Array_where = New Array(); + Array_where = New Array(); // Array Of String For Each KeyValue In QueryParameters Do Array_where.Add(StrTemplate("Table.%1 = &%1", KeyValue.Key)); @@ -1387,3 +1387,178 @@ EndProcedure #EndRegion +#Region Tables + +Function JoinTables(ArrayOfJoiningTables, Fields) Export + + If Not ArrayOfJoiningTables.Count() Then + Return New ValueTable(); + EndIf; + + ArrayOfFieldsPut = New Array(); // Array Of String + ArrayOfFieldsSelect = New Array(); // Array Of String + + Counter = 1; + For Each Field In StrSplit(Fields, ",") Do + ArrayOfFieldsPut.Add(StrTemplate(" tmp.%1 AS %1 ", TrimAll(Field))); + ArrayOfFieldsSelect.Add(StrTemplate(" _tmp_.%1 AS %1 ", TrimAll(Field))); + Counter = Counter + 1; + EndDo; + PutText = StrConcat(ArrayOfFieldsPut, ","); + SelectText = StrConcat(ArrayOfFieldsSelect, ","); + + ArrayOfPutText = New Array(); // Array Of String + ArrayOfSelectText = New Array(); // Array Of String + + Counter = 1; + Query = New Query(); + + DoExecuteQuery = False; + For Each Table In ArrayOfJoiningTables Do + If Not Table.Count() Then + Continue; + EndIf; + DoExecuteQuery = True; + + ArrayOfPutText.Add( + StrTemplate( + "select %1 + |into tmp%2 + |from + | &Table%2 as tmp + |", PutText, String(Counter))); + + ArrayOfSelectText.Add( + StrReplace( + StrTemplate( + "select %1 + |from tmp%2 as tmp%2 + |", SelectText, String(Counter)), "_tmp_", "tmp" + String(Counter))); + + Query.SetParameter("Table" + String(Counter), Table); + Counter = Counter + 1; + EndDo; + + If DoExecuteQuery Then + Query.Text = StrConcat(ArrayOfPutText, " ; ") + " ; " + StrConcat(ArrayOfSelectText, " union all "); + QueryResult = Query.Execute(); + QueryTable = QueryResult.Unload(); + Return QueryTable; + Else + Return New ValueTable(); + EndIf; +EndFunction + +Procedure MergeTables(MasterTable, SourceTable, AddColumnFromSourceTable = "") Export + If Not IsBlankString(AddColumnFromSourceTable) Then + Column = SourceTable.Columns.Find(AddColumnFromSourceTable); + If Not Column = Undefined And MasterTable.Columns.Find(AddColumnFromSourceTable) = Undefined Then + MasterTable.Columns.Add(AddColumnFromSourceTable, Column.ValueType); + EndIf; + EndIf; + For Each Row In SourceTable Do + FillPropertyValues(MasterTable.Add(), Row); + EndDo; +EndProcedure + +Function CreateTable(RegisterMetadata) Export + Table = New ValueTable(); + For Each Item In RegisterMetadata.Dimensions Do + Table.Columns.Add(Item.Name, Item.Type); + EndDo; + + For Each Item In RegisterMetadata.Resources Do + Table.Columns.Add(Item.Name, Item.Type); + EndDo; + For Each Item In RegisterMetadata.Attributes Do + Table.Columns.Add(Item.Name, Item.Type); + EndDo; + + For Each Item In RegisterMetadata.StandardAttributes Do + If Upper(Item.Name) = Upper("Period") Then + Table.Columns.Add(Item.Name, Item.Type); + EndIf; + EndDo; + Return Table; +EndFunction + +// Tables is equal. +// +// Parameters: +// Table1 - ValueTable - Table1 +// Table2 - ValueTable - Table2 +// +// Returns: +// Boolean - Tables is equal +Function TablesIsEqual(Table1, Table2, DeleteColumns = "") Export + If Table1.Count() <> Table2.Count() Then + Return False; + EndIf; + + If Table1.Count() = 0 Then + Return True; + EndIf; + + For Each Column In StrSplit(DeleteColumns, ",") Do + DeleteColumn(Table1, Column); + DeleteColumn(Table2, Column); + EndDo; + + If Table1.Count() = 1 Then + MD5_1 = GetMD5(Table1); + MD5_2 = GetMD5(Table2); + Else + Text = "SELECT + | * + |INTO VTSort1 + |FROM + | &VT1 AS VT1 + |; + |//////////////////////////////////////////////////////////////////////////////// + |SELECT + | * + |INTO VTSort2 + |FROM + | &VT2 AS VT2 + |; + | + |//////////////////////////////////////////////////////////////////////////////// + |SELECT + | * + |FROM + | VTSort1 AS VTSort1 + |AUTOORDER + |; + | + |//////////////////////////////////////////////////////////////////////////////// + |SELECT + | * + |FROM + | VTSort2 AS VTSort2 + |AUTOORDER"; + + Query = New Query(); + Query.Text = Text; + Query.SetParameter("VT1", Table1); + Query.SetParameter("VT2", Table2); + QueryResult = Query.ExecuteBatch(); + + MD5_1 = GetMD5(QueryResult[2].Unload()); + MD5_2 = GetMD5(QueryResult[3].Unload()); + EndIf; + If MD5_1 = MD5_2 Then + Return True; + Else + Return False; + EndIf; + +EndFunction + +Procedure DeleteColumn(Table, ColumnName) Export + If Table.Columns.Find(ColumnName) <> Undefined Then + Table.Columns.Delete(ColumnName); + EndIf; +EndProcedure + + +#EndRegion \ No newline at end of file diff --git a/IRP/src/CommonModules/CurrenciesServer/Module.bsl b/IRP/src/CommonModules/CurrenciesServer/Module.bsl index 73c2ec3a81..3e88223314 100644 --- a/IRP/src/CommonModules/CurrenciesServer/Module.bsl +++ b/IRP/src/CommonModules/CurrenciesServer/Module.bsl @@ -4,16 +4,15 @@ Procedure PreparePostingDataTables(Parameters, CurrencyTable, AddInfo = Undefine ArrayOfPostingInfo = Parameters.ArrayOfPostingInfo; Else For Each PostingInfo In Parameters.PostingDataTables Do - RecordSetMetadata = PostingInfo.Key.Metadata(); If Parameters.Property("MultiCurrencyExcludePostingDataTables") - And Parameters.MultiCurrencyExcludePostingDataTables.Find(RecordSetMetadata) <> Undefined Then + And Parameters.MultiCurrencyExcludePostingDataTables.Find(PostingInfo.Value.Metadata) <> Undefined Then Continue; EndIf; - If Metadata.AccumulationRegisters.Contains(RecordSetMetadata) - Or Metadata.InformationRegisters.Contains(RecordSetMetadata) Then + If Metadata.AccumulationRegisters.Contains(PostingInfo.Value.Metadata) + Or Metadata.InformationRegisters.Contains(PostingInfo.Value.Metadata) Then - Dimension = RecordSetMetadata.Dimensions.Find("CurrencyMovementType"); + Dimension = PostingInfo.Value.Metadata.Dimensions.Find("CurrencyMovementType"); // Register supported multicurrency If Dimension <> Undefined Then ArrayOfPostingInfo.Add(PostingInfo); @@ -22,8 +21,7 @@ Procedure PreparePostingDataTables(Parameters, CurrencyTable, AddInfo = Undefine EndDo; EndIf; - If ArrayOfPostingInfo.Count() And - (Parameters.Object.Metadata().TabularSections.Find("Currencies") <> Undefined Or CurrencyTable <> Undefined) Then + If ArrayOfPostingInfo.Count() And (Parameters.Metadata.TabularSections.Find("Currencies") <> Undefined Or CurrencyTable <> Undefined) Then TempTableManager = New TempTablesManager(); Query = New Query(); Query.TempTablesManager = TempTableManager; @@ -44,28 +42,30 @@ Procedure PreparePostingDataTables(Parameters, CurrencyTable, AddInfo = Undefine _PaymentList.Columns.Add("LegalName"); _PaymentList.Columns.Add("Key"); _PaymentList.Columns.Add("BasisDocument"); + + - If TypeOf(Parameters.Object.Ref) = Type("DocumentRef.CashReceipt") Or TypeOf(Parameters.Object.Ref) = Type("DocumentRef.BankReceipt") Then + If Parameters.Metadata = Metadata.Documents.CashReceipt Or Parameters.Metadata = Metadata.Documents.BankReceipt Then DocumentCondition = True; - RegisterType = Type("AccumulationRegisterRecordSet.R2021B_CustomersTransactions"); + RegisterType = Metadata.AccumulationRegisters.R2021B_CustomersTransactions; For Each RowPaymentList In Parameters.Object.PaymentList Do NewRowPaymentList = _PaymentList.Add(); FillPropertyValues(NewRowPaymentList, RowPaymentList); NewRowPaymentList.LegalName = RowPaymentList.Payer; EndDo; EndIf; - If TypeOf(Parameters.Object.Ref) = Type("DocumentRef.CashPayment") Or TypeOf(Parameters.Object.Ref) = Type("DocumentRef.BankPayment") Then + If Parameters.Metadata = Metadata.Documents.CashPayment Or Parameters.Metadata = Metadata.Documents.BankPayment Then DocumentCondition = True; - RegisterType = Type("AccumulationRegisterRecordSet.R1021B_VendorsTransactions"); + RegisterType = Metadata.AccumulationRegisters.R1021B_VendorsTransactions; For Each RowPaymentList In Parameters.Object.PaymentList Do NewRowPaymentList = _PaymentList.Add(); FillPropertyValues(NewRowPaymentList, RowPaymentList); NewRowPaymentList.LegalName = RowPaymentList.Payee; EndDo; EndIf; - If TypeOf(Parameters.Object.Ref) = Type("DocumentRef.EmployeeCashAdvance") Then + If Parameters.Metadata = Metadata.Documents.EmployeeCashAdvance Then DocumentCondition = True; - RegisterType = Type("AccumulationRegisterRecordSet.R1021B_VendorsTransactions"); + RegisterType = Metadata.AccumulationRegisters.R1021B_VendorsTransactions; For Each RowPaymentList In Parameters.Object.PaymentList Do If Not ValueIsFilled(RowPaymentList.Invoice) Then Continue; @@ -89,12 +89,13 @@ Procedure PreparePostingDataTables(Parameters, CurrencyTable, AddInfo = Undefine TableOfAgreementMovementTypes.Columns.Add("LegalName"); TableOfAgreementMovementTypes.Columns.Add("Amount"); TableOfAgreementMovementTypes.Columns.Add("Key"); - For Each ItemOfPostingInfo In ArrayOfPostingInfo Do - If TypeOf(ItemOfPostingInfo.Key) = RegisterType Then - If ItemOfPostingInfo.Value.Recordset.Columns.Find("Key") = Undefined Then - ItemOfPostingInfo.Value.Recordset.Columns.Add("Key", New TypeDescription(Metadata.DefinedTypes.typeRowID.Type)); + For Each ItemOfPostingInfoRow In ArrayOfPostingInfo Do + ItemOfPostingInfo = ItemOfPostingInfoRow.Value; + If ItemOfPostingInfo.Metadata = RegisterType Then + If ItemOfPostingInfo.PrepareTable.Columns.Find("Key") = Undefined Then + ItemOfPostingInfo.PrepareTable.Columns.Add("Key", New TypeDescription(Metadata.DefinedTypes.typeRowID.Type)); EndIf; - For Each RowRecordSet In ItemOfPostingInfo.Value.Recordset Do + For Each RowRecordSet In ItemOfPostingInfo.PrepareTable Do NewRow = TableOfAgreementMovementTypes.Add(); NewRow.MovementType = RowRecordSet.Agreement.CurrencyMovementType; NewRow.Partner = RowRecordSet.Partner; @@ -157,12 +158,12 @@ Procedure PreparePostingDataTables(Parameters, CurrencyTable, AddInfo = Undefine EndIf; Query.Execute(); - For Each ItemOfPostingInfo In ArrayOfPostingInfo Do - If ItemOfPostingInfo.Value.RecordSet.Count() Then - UseAgreementMovementType = IsUseAgreementMovementType(ItemOfPostingInfo); - UseCurrencyJoin = IsUseCurrencyJoin(Parameters, ItemOfPostingInfo); - ItemOfPostingInfo.Value.RecordSet = ExpandTable(TempTableManager, ItemOfPostingInfo.Value.RecordSet, UseAgreementMovementType, UseCurrencyJoin); - + For Each ItemOfPostingInfoRow In ArrayOfPostingInfo Do + ItemOfPostingInfo = ItemOfPostingInfoRow.Value; + If ItemOfPostingInfo.PrepareTable.Count() Then + UseAgreementMovementType = IsUseAgreementMovementType(ItemOfPostingInfo.Metadata); + UseCurrencyJoin = IsUseCurrencyJoin(Parameters, ItemOfPostingInfo.Metadata); + ItemOfPostingInfo.PrepareTable = ExpandTable(TempTableManager, ItemOfPostingInfo.PrepareTable, UseAgreementMovementType, UseCurrencyJoin); IsOffsetOfAdvances = CommonFunctionsClientServer.GetFromAddInfo(Parameters, "IsOffsetOfAdvances", False); IsLandedCost = CommonFunctionsClientServer.GetFromAddInfo(Parameters, "IsLandedCost", False); @@ -170,29 +171,29 @@ Procedure PreparePostingDataTables(Parameters, CurrencyTable, AddInfo = Undefine If Not IsOffsetOfAdvances And Not IsLandedCost Then // Advances - If TypeOf(ItemOfPostingInfo.Key) = Type("AccumulationRegisterRecordSet.R1020B_AdvancesToVendors") - Or TypeOf(ItemOfPostingInfo.Key) = Type("AccumulationRegisterRecordSet.R2020B_AdvancesFromCustomers") Then + If ItemOfPostingInfo.Metadata = Metadata.AccumulationRegisters.R1020B_AdvancesToVendors + Or ItemOfPostingInfo.Metadata = Metadata.AccumulationRegisters.R2020B_AdvancesFromCustomers Then AdvancesCurrencyRevaluation = GetAdvancesCurrencyRevaluation(Parameters.Object.Ref); For Each Row In AdvancesCurrencyRevaluation Do - FillPropertyValues(ItemOfPostingInfo.Value.RecordSet.Add(), Row); + FillPropertyValues(ItemOfPostingInfo.PrepareTable.Add(), Row); EndDo; EndIf; // Transactions - If TypeOf(ItemOfPostingInfo.Key) = Type("AccumulationRegisterRecordSet.R1021B_VendorsTransactions") - Or TypeOf(ItemOfPostingInfo.Key) = Type("AccumulationRegisterRecordSet.R2021B_CustomersTransactions") Then + If ItemOfPostingInfo.Metadata = Metadata.AccumulationRegisters.R1021B_VendorsTransactions + Or ItemOfPostingInfo.Metadata = Metadata.AccumulationRegisters.R2021B_CustomersTransactions Then TransactionsCurrencyRevaluation = GetTransactionsCurrencyRevaluation(Parameters.Object.Ref); For Each Row In TransactionsCurrencyRevaluation Do - FillPropertyValues(ItemOfPostingInfo.Value.RecordSet.Add(), Row); + FillPropertyValues(ItemOfPostingInfo.PrepareTable.Add(), Row); EndDo; EndIf; // Accounting amounts - If TypeOf(ItemOfPostingInfo.Key) = Type("AccumulationRegisterRecordSet.T1040T_AccountingAmounts") Then + If ItemOfPostingInfo.Metadata = Metadata.AccumulationRegisters.T1040T_AccountingAmounts Then Op = Catalogs.AccountingOperations; AccountingOperations = New ValueTable(); @@ -226,7 +227,7 @@ Procedure PreparePostingDataTables(Parameters, CurrencyTable, AddInfo = Undefine For Each RowAmounts In AccountingAmounts Do For Each RowOperation In AccountingOperations.FindRows(New Structure("DocType, AmountType", TypeOf(Parameters.Object.Ref), RowAmounts.AmountType)) Do For Each OperationItem In RowOperation.Operations Do - NewRow = ItemOfPostingInfo.Value.RecordSet.Add(); + NewRow = ItemOfPostingInfo.PrepareTable.Add(); FillPropertyValues(NewRow, RowAmounts); NewRow.Operation = OperationItem; EndDo; @@ -332,25 +333,30 @@ Function GetAccountingAmounts(DocRef) Return QueryTable; EndFunction -Function IsUseAgreementMovementType(ItemOfPostingInfo) - UseAgreementMovementType = True; - If TypeOf(ItemOfPostingInfo.Key) = Type("AccumulationRegisterRecordSet.R3010B_CashOnHand") Or TypeOf( - ItemOfPostingInfo.Key) = Type("AccumulationRegisterRecordSet.R2020B_AdvancesFromCustomers") Or TypeOf( - ItemOfPostingInfo.Key) = Type("AccumulationRegisterRecordSet.R1020B_AdvancesToVendors") Then - UseAgreementMovementType = False; +Function IsUseAgreementMovementType(RecMetadata) + + TypeOfRecordSetsArray = New Array(); + TypeOfRecordSetsArray.Add(Metadata.AccumulationRegisters.R3010B_CashOnHand); + TypeOfRecordSetsArray.Add(Metadata.AccumulationRegisters.R2020B_AdvancesFromCustomers); + TypeOfRecordSetsArray.Add(Metadata.AccumulationRegisters.R1020B_AdvancesToVendors); + + If TypeOfRecordSetsArray.Find(RecMetadata) = Undefined Then + Return True; + Else + Return False; EndIf; - Return UseAgreementMovementType; + EndFunction -Function IsUseCurrencyJoin(Parameters, ItemOfPostingInfo) +Function IsUseCurrencyJoin(Parameters, RecMetadata) UseCurrencyJoin = False; TypeOfRecordSetsArray = New Array(); - TypeOfRecordSetsArray.Add(Type("AccumulationRegisterRecordSet.R3035T_CashPlanning")); - TypeOfRecordSetsArray.Add(Type("AccumulationRegisterRecordSet.R3010B_CashOnHand")); - TypeOfRecordSetsArray.Add(Type("AccumulationRegisterRecordSet.R3015B_CashAdvance")); - TypeOfRecordSetsArray.Add(Type("AccumulationRegisterRecordSet.R2021B_CustomersTransactions")); - TypeOfRecordSetsArray.Add(Type("AccumulationRegisterRecordSet.R1021B_VendorsTransactions")); + TypeOfRecordSetsArray.Add(Metadata.AccumulationRegisters.R3035T_CashPlanning); + TypeOfRecordSetsArray.Add(Metadata.AccumulationRegisters.R3010B_CashOnHand); + TypeOfRecordSetsArray.Add(Metadata.AccumulationRegisters.R3015B_CashAdvance); + TypeOfRecordSetsArray.Add(Metadata.AccumulationRegisters.R2021B_CustomersTransactions); + TypeOfRecordSetsArray.Add(Metadata.AccumulationRegisters.R1021B_VendorsTransactions); FilterByDocument = False; @@ -364,7 +370,7 @@ Function IsUseCurrencyJoin(Parameters, ItemOfPostingInfo) FilterByDocument = True; EndIf; - If FilterByDocument And TypeOfRecordSetsArray.Find(TypeOf(ItemOfPostingInfo.Key)) <> Undefined Then + If FilterByDocument And TypeOfRecordSetsArray.Find(RecMetadata) <> Undefined Then UseCurrencyJoin = True; EndIf; diff --git a/IRP/src/CommonModules/ObjectAccessFullAccess/Module.bsl b/IRP/src/CommonModules/ObjectAccessFullAccess/Module.bsl index 6ecb44d70e..ca86de528f 100644 --- a/IRP/src/CommonModules/ObjectAccessFullAccess/Module.bsl +++ b/IRP/src/CommonModules/ObjectAccessFullAccess/Module.bsl @@ -120,10 +120,23 @@ Procedure CalculateAndUpdateAccessKey_Document(Source) Source.SetNewObjectRef(Ref); EndIf; - Reg = InformationRegisters.T9100A_ObjectAccessMap.CreateRecordManager(); - Reg.ObjectAccessKeys = AccessKeyRef; - Reg.ObjectRef = Ref; - Reg.Write(); + Query = New Query; + Query.Text = + "SELECT TRUE FROM InformationRegister.T9100A_ObjectAccessMap AS T9100A_ObjectAccessMap + |WHERE + | T9100A_ObjectAccessMap.ObjectRef = &ObjectRef + | AND T9100A_ObjectAccessMap.ObjectAccessKeys = &ObjectAccessKeys"; + + Query.SetParameter("ObjectRef", Ref); + Query.SetParameter("ObjectAccessKeys", AccessKeyRef); + QueryResult = Query.Execute(); + + If QueryResult.IsEmpty() Then + Reg = InformationRegisters.T9100A_ObjectAccessMap.CreateRecordManager(); + Reg.ObjectAccessKeys = AccessKeyRef; + Reg.ObjectRef = Ref; + Reg.Write(); + EndIf; EndProcedure // Update access keys Document. diff --git a/IRP/src/CommonModules/OffsetOfAdvancesServer/Module.bsl b/IRP/src/CommonModules/OffsetOfAdvancesServer/Module.bsl index eaf4a084df..caf9252076 100644 --- a/IRP/src/CommonModules/OffsetOfAdvancesServer/Module.bsl +++ b/IRP/src/CommonModules/OffsetOfAdvancesServer/Module.bsl @@ -888,10 +888,12 @@ Procedure Write_SelfRecords(Parameters, // Currency calculation PostingDataTables = New Map(); - - PostingDataTables.Insert(RecordSet_Advances , New Structure("RecordSet", TableAdvances)); - PostingDataTables.Insert(RecordSet_Transactions , New Structure("RecordSet", TableTransactions)); - PostingDataTables.Insert(RecordSet_AccountingAmounts, New Structure("RecordSet", TableAccountingAmounts)); + RecordSet_AdvancesSettings = PostingServer.PostingTableSettings(RecordSet_Advances.Metadata().Name, TableAdvances, RecordSet_Advances); + PostingDataTables.Insert(RecordSet_Advances.Metadata() , RecordSet_AdvancesSettings); + RecordSet_TransactionsSettings = PostingServer.PostingTableSettings(RecordSet_Transactions.Metadata().Name, TableTransactions, RecordSet_Transactions); + PostingDataTables.Insert(RecordSet_Transactions.Metadata() , RecordSet_TransactionsSettings); + RecordSet_AccountingAmountsSettings = PostingServer.PostingTableSettings(RecordSet_AccountingAmounts.Metadata().Name, TableAccountingAmounts, RecordSet_AccountingAmounts); + PostingDataTables.Insert(RecordSet_AccountingAmounts.Metadata(), RecordSet_AccountingAmountsSettings); ArrayOfPostingInfo = New Array(); For Each DataTable In PostingDataTables Do @@ -900,16 +902,16 @@ Procedure Write_SelfRecords(Parameters, CurrenciesParameters = New Structure(); CurrenciesParameters.Insert("Object", Row.Document); + CurrenciesParameters.Insert("Metadata", Row.Document.Metadata()); CurrenciesParameters.Insert("ArrayOfPostingInfo", ArrayOfPostingInfo); - CurrenciesParameters.Insert("IsOffsetOfAdvances", - CommonFunctionsClientServer.GetFromAddInfo(Parameters, "IsOffsetOfAdvances", False)); + CurrenciesParameters.Insert("IsOffsetOfAdvances", CommonFunctionsClientServer.GetFromAddInfo(Parameters, "IsOffsetOfAdvances", False)); CurrenciesServer.PreparePostingDataTables(CurrenciesParameters, Undefined); // Advances - ItemOfPostingInfo = GetFromPostingInfo(ArrayOfPostingInfo, Type("AccumulationRegisterRecordSet." + Parameters.RegisterName_Advances)); + ItemOfPostingInfo = GetFromPostingInfo(ArrayOfPostingInfo, Metadata.AccumulationRegisters[Parameters.RegisterName_Advances]); RecordSet_Advances.Read(); - For Each RowPostingInfo In ItemOfPostingInfo.Value.RecordSet Do + For Each RowPostingInfo In ItemOfPostingInfo.Value.PrepareTable Do FillPropertyValues(RecordSet_Advances.Add(), RowPostingInfo); EndDo; RecordSet_Advances.SetActive(True); @@ -925,24 +927,15 @@ Procedure Write_SelfRecords(Parameters, RecordSet_Advances.Write(); // Transactions - ItemOfPostingInfo = GetFromPostingInfo(ArrayOfPostingInfo, Type("AccumulationRegisterRecordSet." + Parameters.RegisterName_Transactions)); + ItemOfPostingInfo = GetFromPostingInfo(ArrayOfPostingInfo, Metadata.AccumulationRegisters[Parameters.RegisterName_Transactions]); RecordSet_Transactions.Read(); - For Each RowPostingInfo In ItemOfPostingInfo.Value.RecordSet Do + For Each RowPostingInfo In ItemOfPostingInfo.Value.PrepareTable Do FillPropertyValues(RecordSet_Transactions.Add(), RowPostingInfo); EndDo; RecordSet_Transactions.SetActive(True); RecordSet_Transactions.Write(); - -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// CurrenciesServer.RevaluateCurrency_CustomersTransactions(Parameters, -// RecordSet_Transactions, -// TableAccountingAmounts_CurrencyRevaluation); -// -// RecordSet_Transactions.SetActive(True); -// RecordSet_Transactions.Write(); -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - + CurrenciesServer.RevaluateCurrency_Transactions(Parameters, RecordSet_Transactions, TableTransactions_CurrencyRevaluation, @@ -952,11 +945,11 @@ Procedure Write_SelfRecords(Parameters, RecordSet_Transactions.SetActive(True); RecordSet_Transactions.Write(); - ItemOfPostingInfo = GetFromPostingInfo(ArrayOfPostingInfo, Type("AccumulationRegisterRecordSet.T1040T_AccountingAmounts")); + ItemOfPostingInfo = GetFromPostingInfo(ArrayOfPostingInfo, Metadata.AccumulationRegisters.T1040T_AccountingAmounts); // Accounting amounts (advances) RecordSet_AccountingAmounts.Read(); - For Each RowPostingInfo In ItemOfPostingInfo.Value.RecordSet Do + For Each RowPostingInfo In ItemOfPostingInfo.Value.PrepareTable Do FillPropertyValues(RecordSet_AccountingAmounts.Add(), RowPostingInfo); EndDo; RecordSet_AccountingAmounts.SetActive(True); @@ -977,11 +970,11 @@ EndProcedure Function GetFromPostingInfo(ArrayOfPostingInfo, RecordSetType) For Each ItemOfPostingInfo In ArrayOfPostingInfo Do - If TypeOf(ItemOfPostingInfo.Key) = RecordSetType Then + If ItemOfPostingInfo.Key = RecordSetType Then Return ItemOfPostingInfo; EndIf; EndDo; - Raise StrTemplate("Not found [%1] in arrayf of posting info", RecordSetType); + Raise StrTemplate("Not found [%1] in array of posting info", RecordSetType); EndFunction Procedure WriteTablesToTempTables(Parameters, diff --git a/IRP/src/CommonModules/PostingServer/Module.bsl b/IRP/src/CommonModules/PostingServer/Module.bsl index 9826a72320..463a97e3a0 100644 --- a/IRP/src/CommonModules/PostingServer/Module.bsl +++ b/IRP/src/CommonModules/PostingServer/Module.bsl @@ -1,4 +1,13 @@ +#Region API + +// Post. +// +// Parameters: +// DocObject - DocumentObjectDocumentName, DocumentRefDocumentName - Doc object +// Cancel - Boolean - Cancel +// PostingMode - DocumentPostingMode - Posting mode +// AddInfo - Undefined - Add info Procedure Post(DocObject, Cancel, PostingMode, AddInfo = Undefined) Export If Cancel Then @@ -16,7 +25,7 @@ Procedure Post(DocObject, Cancel, PostingMode, AddInfo = Undefined) Export CurrencyTable = CommonFunctionsClientServer.GetFromAddInfo(AddInfo, "CurrencyTable"); CurrenciesServer.PreparePostingDataTables(Parameters, CurrencyTable, AddInfo); - RegisteredRecords = RegisterRecords(DocObject, Parameters.PostingDataTables, Parameters.Object.RegisterRecords); + RegisteredRecords = RegisterRecords(Parameters); RegisteredRecordsArray = New Array; For Each Record In RegisteredRecords Do @@ -26,7 +35,6 @@ Procedure Post(DocObject, Cancel, PostingMode, AddInfo = Undefined) Export Record.Value.RecordSet.LockForUpdate = True; EndIf; Record.Value.RecordSet.Write(); - WriteInTransaction = True; Else // write only when transaction will be commited Record.Value.RecordSet.Write = True; EndIf; @@ -38,29 +46,55 @@ Procedure Post(DocObject, Cancel, PostingMode, AddInfo = Undefined) Export Parameters.Module.PostingCheckAfterWrite(DocObject.Ref, Cancel, PostingMode, Parameters, AddInfo); EndProcedure +// Get posting parameters. +// +// Parameters: +// DocObject - DocumentRefDocumentName - Doc object +// PostingMode - DocumentPostingMode - Posting mode +// AddInfo - Undefined, Structure - Add info +// +// Returns: +// Structure - Get posting parameters: +// * Cancel - Boolean - +// * Object - DocumentRefDocumentName - +// * PostingByRef - Boolean - +// * IsReposting - Boolean - +// * PointInTime - PointInTime - +// * TempTablesManager - TempTablesManager - +// * Metadata - MetadataObjectDocument - +// * Module - DocumentManagerDocumentName, DocumentManager.SalesOrder - +// * DocumentDataTables - Structure - +// * DocumentDataTables - Map - +// * LockDataSources - Map - +// * PostingDataTables - Array Of KeyAndValue: +// ** Key - MetadataObject - +// ** Value - See PostingTableSettings Function GetPostingParameters(DocObject, PostingMode, AddInfo = Undefined) Cancel = False; Parameters = New Structure(); Parameters.Insert("Cancel", Cancel); Parameters.Insert("Object", DocObject); + Parameters.Insert("PostingByRef", DocObject.Ref = DocObject); Parameters.Insert("IsReposting", False); Parameters.Insert("PointInTime", DocObject.PointInTime()); Parameters.Insert("TempTablesManager", New TempTablesManager()); Parameters.Insert("Metadata", DocObject.Ref.Metadata()); + Parameters.Insert("DocumentDataTables", New Structure); + Parameters.Insert("LockDataSources", New Map); + Parameters.Insert("PostingDataTables", New Map); - Module = Documents[Parameters.Metadata.Name]; + Module = Documents[Parameters.Metadata.Name]; // DocumentManager.SalesOrder, DocumentManagerDocumentName Parameters.Insert("Module", Module); - DocumentDataTables = Module.PostingGetDocumentDataTables(DocObject.Ref, Cancel, PostingMode, Parameters, AddInfo); - Parameters.Insert("DocumentDataTables", DocumentDataTables); + Parameters.DocumentDataTables = Module.PostingGetDocumentDataTables(DocObject.Ref, Cancel, PostingMode, Parameters, AddInfo); + If Cancel Then Parameters.Cancel = True; Return Parameters; EndIf; - LockDataSources = Module.PostingGetLockDataSource(DocObject.Ref, Cancel, PostingMode, Parameters, AddInfo); - Parameters.Insert("LockDataSources", LockDataSources); + Parameters.LockDataSources = Module.PostingGetLockDataSource(DocObject.Ref, Cancel, PostingMode, Parameters, AddInfo); If Cancel Then Parameters.Cancel = True; Return Parameters; @@ -68,8 +102,8 @@ Function GetPostingParameters(DocObject, PostingMode, AddInfo = Undefined) // Save pointers to locks DataLock = Undefined; - If LockDataSources <> Undefined Then - DataLock = SetLock(LockDataSources); + If Parameters.LockDataSources <> Undefined Then + DataLock = SetLock(Parameters.LockDataSources); EndIf; If TypeOf(AddInfo) = Type("Structure") Then AddInfo.Insert("DataLock", DataLock); @@ -81,15 +115,21 @@ Function GetPostingParameters(DocObject, PostingMode, AddInfo = Undefined) Return Parameters; EndIf; - PostingDataTables = Module.PostingGetPostingDataTables(DocObject.Ref, Cancel, PostingMode, Parameters, AddInfo); - If Parameters.Property("PostingDataTables") Then - Parameters.PostingDataTables = PostingDataTables; - Else - Parameters.Insert("PostingDataTables", PostingDataTables); - EndIf; + Parameters.PostingDataTables = Module.PostingGetPostingDataTables(DocObject.Ref, Cancel, PostingMode, Parameters, AddInfo); Return Parameters; EndFunction +// Set lock. +// @skip-check property-return-type, dynamic-access-method-not-found, invocation-parameter-type-intersect, statement-type-change, variable-value-type +// +// Parameters: +// LockDataSources - Map - Lock data sources: +// * Key - Undefined - +// * Value - Structure: +// ** Fields - Array Of String - +// +// Returns: +// DataLock - Set lock Function SetLock(LockDataSources) DataLock = New DataLock(); @@ -107,26 +147,24 @@ Function SetLock(LockDataSources) EndDo; EndDo; If LockDataSources.Count() Then + //@skip-check lock-out-of-try DataLock.Lock(); EndIf; Return DataLock; EndFunction -Function RegisterRecords(DocObject, PostingDataTables, AllRegisterRecords) - For Each RecordSet In AllRegisterRecords Do - If PostingDataTables.Get(RecordSet) = Undefined Then - RecordSet.Write = True; - EndIf; - EndDo; - +// Register records. +// +// Parameters: +// Parameters - See GetPostingParameters +// +// Returns: +// Map - Register records +Function RegisterRecords(Parameters) RegisteredRecords = New Map(); - For Each Row In PostingDataTables Do - If Not Row.Value.Property("RecordSet") Then - Continue; - EndIf; - - RecordSet = Row.Key; - TableForLoad = Row.Value.RecordSet.Copy(); + For Each Row In Parameters.PostingDataTables Do + RecordSet = Row.Value.RecordSet_Document; + TableForLoad = Row.Value.PrepareTable.Copy(); // Set record type If Row.Value.Property("RecordType") Then @@ -141,134 +179,95 @@ Function RegisterRecords(DocObject, PostingDataTables, AllRegisterRecords) TableForLoad.Columns.Add("Active"); TableForLoad.FillValues(True, "Active"); EndIf; - + + If Row.Value.Metadata = Metadata.AccumulationRegisters.R6020B_BatchBalance + Or Row.Value.Metadata = AccumulationRegisters.R6060T_CostOfGoodsSold Then + Continue; //Never rewrite + EndIf; + // MD5 - If RecordSetIsEqual(DocObject, RecordSet, TableForLoad) Then + If RecordSetIsEqual(RecordSet, TableForLoad) Then Continue; EndIf; - + + //If Not Parameters.PostingByRef Then + WriteAdvances(Parameters.Object, Row.Value.Metadata, TableForLoad); + + UpdateCosts(Parameters.Object, Row.Value.Metadata, TableForLoad, RegisteredRecords); + //EndIf; // Set write WriteInTransaction = False; If Row.Value.Property("WriteInTransaction") And Row.Value.WriteInTransaction Then WriteInTransaction = True; EndIf; - - RegisteredRecords.Insert(RecordSet.Metadata(), New Structure("RecordSet, WriteInTransaction", RecordSet, WriteInTransaction)); + Data = New Structure; + Data.Insert("RecordSet", RecordSet); + Data.Insert("WriteInTransaction", WriteInTransaction); + Data.Insert("Metadata", RecordSet.Metadata()); + RegisteredRecords.Insert(RecordSet.Metadata(), Data); EndDo; Return RegisteredRecords; EndFunction -Function RecordSetIsEqual(DocObject, RecordSet, TableForLoad) - If TypeOf(RecordSet) = Type("AccumulationRegisterRecordSet.R6020B_BatchBalance") - Or TypeOf(RecordSet) = Type("AccumulationRegisterRecordSet.R6060T_CostOfGoodsSold") Then - Return True; //Never rewrite - EndIf; - +Function RecordSetIsEqual(RecordSet, TableForLoad) RecordSet.Read(); TableOldRecords = RecordSet.Unload(); RecordSet.Load(TableForLoad); - Result = TablesIsEqual(RecordSet.Unload(), TableOldRecords); - AccReg = Metadata.AccumulationRegisters; - If TypeOf(RecordSet) = Type("AccumulationRegisterRecordSet.R1020B_AdvancesToVendors") Then - AdvancesRelevanceServer.SetBound_Advances(DocObject, TableForLoad, AccReg.R1020B_AdvancesToVendors); - ElsIf TypeOf(RecordSet) = Type("AccumulationRegisterRecordSet.R2020B_AdvancesFromCustomers") Then - AdvancesRelevanceServer.SetBound_Advances(DocObject, TableForLoad, AccReg.R2020B_AdvancesFromCustomers); - ElsIf TypeOf(RecordSet) = Type("AccumulationRegisterRecordSet.R1021B_VendorsTransactions") Then - AdvancesRelevanceServer.SetBound_Transactions(DocObject, TableForLoad, AccReg.R1021B_VendorsTransactions); - ElsIf TypeOf(RecordSet) = Type("AccumulationRegisterRecordSet.R2021B_CustomersTransactions") Then - AdvancesRelevanceServer.SetBound_Transactions(DocObject, TableForLoad, AccReg.R2021B_CustomersTransactions); - ElsIf TypeOf(RecordSet) = Type("AccumulationRegisterRecordSet.R5012B_VendorsAging") Then - AdvancesRelevanceServer.SetBound_Aging(DocObject, TableForLoad, AccReg.R5012B_VendorsAging); - ElsIf TypeOf(RecordSet) = Type("AccumulationRegisterRecordSet.R5011B_CustomersAging") Then - AdvancesRelevanceServer.SetBound_Aging(DocObject, TableForLoad, AccReg.R5011B_CustomersAging); - EndIf; + Result = CommonFunctionsServer.TablesIsEqual(RecordSet.Unload(), TableOldRecords, "Recorder,LineNumber,PointInTime,UniqueID"); - If TypeOf(RecordSet) = Type("InformationRegisterRecordSet.T6020S_BatchKeysInfo") Then - AccumulationRegisters.R6020B_BatchBalance.BatchBalance_CollectRecords(DocObject); - AccumulationRegisters.R6060T_CostOfGoodsSold.CostOfGoodsSold_CollectRecords(DocObject); - TableForLoadEmpty = CreateTable(Metadata.InformationRegisters.T6020S_BatchKeysInfo); - For Each Row In TableForLoad Do - FillPropertyValues(TableForLoadEmpty.Add(), Row); - EndDo; - InformationRegisters.T6030S_BatchRelevance.BatchRelevance_SetBound(DocObject, TableForLoadEmpty); - EndIf; - Return Result; EndFunction -// Tables is equal. -// -// Parameters: -// Table1 - ValueTable - Table1 -// Table2 - ValueTable - Table2 -// -// Returns: -// Boolean - Tables is equal -Function TablesIsEqual(Table1, Table2, DeleteColumns = "Recorder,LineNumber,PointInTime,UniqueID") Export - If Table1.Count() <> Table2.Count() Then - Return False; - EndIf; - - If Table1.Count() = 0 Then - Return True; - EndIf; - - For Each Column In StrSplit(DeleteColumns, ",") Do - DeleteColumn(Table1, Column); - DeleteColumn(Table2, Column); - EndDo; - - If Table1.Count() = 1 Then - MD5_1 = CommonFunctionsServer.GetMD5(Table1); - MD5_2 = CommonFunctionsServer.GetMD5(Table2); - Else - Text = "SELECT - | * - |INTO VTSort1 - |FROM - | &VT1 AS VT1 - |; - |//////////////////////////////////////////////////////////////////////////////// - |SELECT - | * - |INTO VTSort2 - |FROM - | &VT2 AS VT2 - |; - | - |//////////////////////////////////////////////////////////////////////////////// - |SELECT - | * - |FROM - | VTSort1 AS VTSort1 - |AUTOORDER - |; - | - |//////////////////////////////////////////////////////////////////////////////// - |SELECT - | * - |FROM - | VTSort2 AS VTSort2 - |AUTOORDER"; - - Query = New Query(); - Query.Text = Text; - Query.SetParameter("VT1", Table1); - Query.SetParameter("VT2", Table2); - QueryResult = Query.ExecuteBatch(); - - MD5_1 = CommonFunctionsServer.GetMD5(QueryResult[2].Unload()); - MD5_2 = CommonFunctionsServer.GetMD5(QueryResult[3].Unload()); - EndIf; - Return MD5_1 = MD5_2; +#EndRegion -EndFunction +Procedure WriteAdvances(DocObject, RecordMeta, TableForLoad) Export + If RecordMeta = Metadata.AccumulationRegisters.R1020B_AdvancesToVendors Then + AdvancesRelevanceServer.SetBound_Advances(DocObject, TableForLoad, Metadata.AccumulationRegisters.R1020B_AdvancesToVendors); + ElsIf RecordMeta = Metadata.AccumulationRegisters.R2020B_AdvancesFromCustomers Then + AdvancesRelevanceServer.SetBound_Advances(DocObject, TableForLoad, Metadata.AccumulationRegisters.R2020B_AdvancesFromCustomers); + ElsIf RecordMeta = Metadata.AccumulationRegisters.R1021B_VendorsTransactions Then + AdvancesRelevanceServer.SetBound_Transactions(DocObject, TableForLoad, Metadata.AccumulationRegisters.R1021B_VendorsTransactions); + ElsIf RecordMeta = Metadata.AccumulationRegisters.R2021B_CustomersTransactions Then + AdvancesRelevanceServer.SetBound_Transactions(DocObject, TableForLoad, Metadata.AccumulationRegisters.R2021B_CustomersTransactions); + ElsIf RecordMeta = Metadata.AccumulationRegisters.R5012B_VendorsAging Then + AdvancesRelevanceServer.SetBound_Aging(DocObject, TableForLoad, Metadata.AccumulationRegisters.R5012B_VendorsAging); + ElsIf RecordMeta = Metadata.AccumulationRegisters.R5011B_CustomersAging Then + AdvancesRelevanceServer.SetBound_Aging(DocObject, TableForLoad, Metadata.AccumulationRegisters.R5011B_CustomersAging); + EndIf; +EndProcedure -Procedure DeleteColumn(Table, ColumnName) - If Table.Columns.Find(ColumnName) <> Undefined Then - Table.Columns.Delete(ColumnName); +Procedure UpdateCosts(DocObject, RecordMeta, TableForLoad, RegisteredRecords) + If RecordMeta = Metadata.InformationRegisters.T6020S_BatchKeysInfo Then + + R6020B_BatchBalance_RecordSet = AccumulationRegisters.R6020B_BatchBalance.CreateRecordSet(); + R6020B_BatchBalance_RecordSet.Filter.Recorder.Set(DocObject.Ref); + R6020B_BatchBalance = AccumulationRegisters.R6020B_BatchBalance.BatchBalance_CollectRecords(DocObject); + R6020B_BatchBalance_RecordSet.Load(R6020B_BatchBalance); + + Data = New Structure; + Data.Insert("RecordSet", R6020B_BatchBalance_RecordSet); + Data.Insert("WriteInTransaction", True); + Data.Insert("Metadata", R6020B_BatchBalance_RecordSet.Metadata()); + RegisteredRecords.Insert(R6020B_BatchBalance_RecordSet.Metadata(), Data); + + R6060T_CostOfGoodsSold_RecordSet = AccumulationRegisters.R6060T_CostOfGoodsSold.CreateRecordSet(); + R6060T_CostOfGoodsSold_RecordSet.Filter.Recorder.Set(DocObject.Ref); + R6060T_CostOfGoodsSold = AccumulationRegisters.R6060T_CostOfGoodsSold.CostOfGoodsSold_CollectRecords(DocObject); + R6060T_CostOfGoodsSold_RecordSet.Load(R6060T_CostOfGoodsSold); + + Data = New Structure; + Data.Insert("RecordSet", R6060T_CostOfGoodsSold_RecordSet); + Data.Insert("WriteInTransaction", True); + Data.Insert("Metadata", R6060T_CostOfGoodsSold_RecordSet.Metadata()); + RegisteredRecords.Insert(R6060T_CostOfGoodsSold_RecordSet.Metadata(), Data); + + TableForLoadEmpty = CommonFunctionsServer.CreateTable(Metadata.InformationRegisters.T6020S_BatchKeysInfo); + For Each Row In TableForLoad Do + FillPropertyValues(TableForLoadEmpty.Add(), Row); + EndDo; + InformationRegisters.T6030S_BatchRelevance.BatchRelevance_SetBound(DocObject, TableForLoadEmpty); EndIf; EndProcedure @@ -310,99 +309,6 @@ Procedure CalculateQuantityByUnit(DataTable) Export EndDo; EndProcedure -Function JoinTables(ArrayOfJoiningTables, Fields) Export - - If Not ArrayOfJoiningTables.Count() Then - Return New ValueTable(); - EndIf; - - ArrayOfFieldsPut = New Array(); - ArrayOfFieldsSelect = New Array(); - - Counter = 1; - For Each Field In StrSplit(Fields, ",") Do - ArrayOfFieldsPut.Add(StrTemplate(" tmp.%1 AS %1 ", TrimAll(Field))); - ArrayOfFieldsSelect.Add(StrTemplate(" _tmp_.%1 AS %1 ", TrimAll(Field))); - Counter = Counter + 1; - EndDo; - PutText = StrConcat(ArrayOfFieldsPut, ","); - SelectText = StrConcat(ArrayOfFieldsSelect, ","); - - ArrayOfPutText = New Array(); - ArrayOfSelectText = New Array(); - - Counter = 1; - Query = New Query(); - - DoExecuteQuery = False; - For Each Table In ArrayOfJoiningTables Do - If Not Table.Count() Then - Continue; - EndIf; - DoExecuteQuery = True; - - ArrayOfPutText.Add( - StrTemplate( - "select %1 - |into tmp%2 - |from - | &Table%2 as tmp - |", PutText, String(Counter))); - - ArrayOfSelectText.Add( - StrReplace( - StrTemplate( - "select %1 - |from tmp%2 as tmp%2 - |", SelectText, String(Counter)), "_tmp_", "tmp" + String(Counter))); - - Query.SetParameter("Table" + String(Counter), Table); - Counter = Counter + 1; - EndDo; - - If DoExecuteQuery Then - Query.Text = StrConcat(ArrayOfPutText, " ; ") + " ; " + StrConcat(ArrayOfSelectText, " union all "); - QueryResult = Query.Execute(); - QueryTable = QueryResult.Unload(); - Return QueryTable; - Else - Return New ValueTable(); - EndIf; -EndFunction - -Procedure MergeTables(MasterTable, SourceTable, AddColumnFromSourceTable = "") Export - If Not IsBlankString(AddColumnFromSourceTable) Then - Column = SourceTable.Columns.Find(AddColumnFromSourceTable); - If Not Column = Undefined And MasterTable.Columns.Find(AddColumnFromSourceTable) = Undefined Then - MasterTable.Columns.Add(AddColumnFromSourceTable, Column.ValueType); - EndIf; - EndIf; - For Each Row In SourceTable Do - FillPropertyValues(MasterTable.Add(), Row); - EndDo; -EndProcedure - -Function CreateTable(RegisterMetadata) Export - Table = New ValueTable(); - For Each Item In RegisterMetadata.Dimensions Do - Table.Columns.Add(Item.Name, Item.Type); - EndDo; - - For Each Item In RegisterMetadata.Resources Do - Table.Columns.Add(Item.Name, Item.Type); - EndDo; - For Each Item In RegisterMetadata.Attributes Do - Table.Columns.Add(Item.Name, Item.Type); - EndDo; - - For Each Item In RegisterMetadata.StandardAttributes Do - If Upper(Item.Name) = Upper("Period") Then - Table.Columns.Add(Item.Name, Item.Type); - EndIf; - EndDo; - Return Table; -EndFunction - Procedure ShowPostingErrorMessage(QueryTable, Parameters, AddInfo = Undefined) Export If QueryTable.Columns.Find("Unposting") = Undefined Then QueryTable.Columns.Add("Unposting"); @@ -614,7 +520,7 @@ Function PrepareRecordsTables(Dimensions, LineNumberJoinConditionField, ItemList ArrayOfDimensions = StrSplit(Dimensions, ","); JoinCondition = ""; - ArrayOfSelectedFields = New Array(); + ArrayOfSelectedFields = New Array(); // Array Of String For Each ItemOfDimension In ArrayOfDimensions Do If Upper(TrimAll(ItemOfDimension)) = Upper(TrimAll(LineNumberJoinConditionField)) Then Continue; @@ -751,7 +657,7 @@ Procedure CheckBalance_AfterWrite(Ref, Cancel, Parameters, TableNameWithItemKeys EndIf; If Not Records_InDocument.Columns.Count() Then - Records_InDocument = CreateTable(Metadata.AccumulationRegisters.R4011B_FreeStocks); + Records_InDocument = CommonFunctionsServer.CreateTable(Metadata.AccumulationRegisters.R4011B_FreeStocks); EndIf; Exists_R4011B_FreeStocks = CommonFunctionsClientServer.GetFromAddInfo(AddInfo, "Exists_R4011B_FreeStocks"); @@ -778,7 +684,7 @@ Procedure CheckBalance_AfterWrite(Ref, Cancel, Parameters, TableNameWithItemKeys EndIf; If Not Records_InDocument.Columns.Count() Then - Records_InDocument = CreateTable(Metadata.AccumulationRegisters.R4010B_ActualStocks); + Records_InDocument = CommonFunctionsServer.CreateTable(Metadata.AccumulationRegisters.R4010B_ActualStocks); EndIf; Exists_R4010B_ActualStocks = CommonFunctionsClientServer.GetFromAddInfo(AddInfo, "Exists_R4010B_ActualStocks"); @@ -1159,6 +1065,7 @@ Function CheckBalance_ExecuteQuery(Ref, Parameters, Tables, RecordType, Unpostin EndFunction Function UseRegister(Name) Export + // Delete CashInTransit Return Mid(Name, 7, 1) = "_" Or Mid(Name, 4, 1) = "_" Or Mid(Name, 3, 1) = "_"; EndFunction @@ -1201,22 +1108,81 @@ Procedure FillPostingTables(Tables, Ref, QueryArray, Parameters) Export For Each VT In Tables Do QueryTable = GetQueryTableByName(VT.Key, Parameters); If QueryTable.Count() Then - MergeTables(Tables[VT.Key], QueryTable, "RecordType"); + CommonFunctionsServer.MergeTables(Tables[VT.Key], QueryTable, "RecordType"); EndIf; EndDo; EndProcedure +// Set posting data tables. +// +// Parameters: +// PostingDataTables - Map: +// * Key - MetadataObject +// * Value - See PostingTableSettings +// Parameters - See GetPostingParameters +// UseOldRegisters - Boolean - Use old registers Procedure SetPostingDataTables(PostingDataTables, Parameters, UseOldRegisters = False) Export + + RegisterRecords = GetRegisterRecords(Parameters); + For Each Table In Parameters.DocumentDataTables Do If UseOldRegisters Or UseRegister(Table.Key) Then - Settings = New Structure("RegisterName", Table.Key); - Settings.Insert("RecordSet", Table.Value); - Settings.Insert("WriteInTransaction", True); - PostingDataTables.Insert(Parameters.Object.RegisterRecords[Table.Key], Settings); + SetPostingDataTable(PostingDataTables, Parameters, Table.Key, Table.Value, RegisterRecords); EndIf; EndDo; EndProcedure +Function GetRegisterRecords(Parameters) + If Parameters.PostingByRef Then + TmpDoc = Documents[Parameters.Metadata.Name].CreateDocument(); + RegisterRecords = TmpDoc.RegisterRecords; + Else + //@skip-check property-return-type + RegisterRecords = Parameters.Object.RegisterRecords; // RegisterRecordsCollection + EndIf; + + Return RegisterRecords; +EndFunction + +Procedure SetPostingDataTable(PostingDataTables, Parameters, Name, VT, RegisterRecords = Undefined) Export + + If RegisterRecords = Undefined Then + RegisterRecords = GetRegisterRecords(Parameters); + EndIf; + + RecSetData = RegisterRecords[Name]; + If Parameters.PostingByRef Then + RecSetData.Filter.Recorder.Set(Parameters.Object); + EndIf; + Settings = PostingTableSettings(Name, VT, RecSetData); + PostingDataTables.Insert(RecSetData.Metadata(), Settings); +EndProcedure + +// Posting table settings. +// +// Parameters: +// RegisterName - String - +// Table - ValueTable - +// RecSetData - InformationRegisterRecordSetInformationRegisterName, AccountingRegisterRecordSetAccountingRegisterName, CalculationRegisterRecordSetCalculationRegisterName, AccumulationRegisterRecordSetAccumulationRegisterName - Rec set data +// +// Returns: +// Structure - Posting table settings: +// * RegisterName - String - +// * PrepareTable - ValueTable - +// * WriteInTransaction - Boolean - +// * Metadata - MetadataObjectInformationRegister, MetadataObjectAccountingRegister, MetadataObjectCalculationRegister, MetadataObjectAccumulationRegister - +// * RecordSet_Document - AccumulationRegisterRecordSet, InformationRegisterRecordSet - +// * RecordType - Undefined, AccumulationRecordType - +Function PostingTableSettings(RegisterName, Table, RecSetData) Export + Settings = New Structure; + Settings.Insert("RegisterName", RegisterName); + Settings.Insert("PrepareTable", Table); + Settings.Insert("WriteInTransaction", True); + Settings.Insert("Metadata", RecSetData.Metadata()); + Settings.Insert("RecordSet_Document", RecSetData); + Return Settings; +EndFunction + Procedure GetLockDataSource(DataMapWithLockFields, DocumentDataTables, UseOldRegisters = False) Export For Each Register In DocumentDataTables Do If UseOldRegisters Or UseRegister(Register.Key) Then @@ -1229,7 +1195,7 @@ EndProcedure Procedure SetRegisters(Tables, DocumentRef, UseOldRegisters = False) Export For Each Register In DocumentRef.Metadata().RegisterRecords Do If UseOldRegisters Or UseRegister(Register.Name) Then - Tables.Insert(Register.Name, CreateTable(Register)); + Tables.Insert(Register.Name, CommonFunctionsServer.CreateTable(Register)); EndIf; EndDo; EndProcedure @@ -1254,6 +1220,70 @@ Function Exists_R2001T_Sales() Export | R2001T_Sales.Recorder = &Ref"; EndFunction +#Region BatchInfo + +// Get batch keys info settings. +// +// Returns: +// Structure - Get batch keys info settings: +// * Dimensions - String - +// * Totals - String - +// * DataTable - ValueTable - +// * CurrencyMovementType - ChartOfCharacteristicTypesRef.CurrencyMovementType - +Function GetBatchKeysInfoSettings() Export + BatchKeysInfoSettings = New Structure; + BatchKeysInfoSettings.Insert("Dimensions", ""); + BatchKeysInfoSettings.Insert("Totals", ""); + BatchKeysInfoSettings.Insert("DataTable", New ValueTable()); + BatchKeysInfoSettings.Insert("CurrencyMovementType", ChartsOfCharacteristicTypes.CurrencyMovementType.EmptyRef()); + Return BatchKeysInfoSettings; +EndFunction + +// Set batch key info table. +// +// Parameters: +// Parameters - See GetPostingParameters +// BatchKeysInfoSettings - See GetBatchKeysInfoSettings +Procedure SetBatchKeyInfoTable(Parameters, BatchKeysInfoSettings) Export + + If BatchKeysInfoSettings.DataTable.Columns.Find("CurrencyMovementType") = Undefined Then + BatchKeysInfoSettings.DataTable.Columns.Add("CurrencyMovementType", New TypeDescription("ChartOfCharacteristicTypesRef.CurrencyMovementType")); + EndIf; + + TotalsArray = New Array; + For Each Row In StrSplit(BatchKeysInfoSettings.Totals, ", ", False) Do + TotalsArray.Add("SUM(" + Row + ") AS " + Row); + EndDo; + + Query = New Query; + Query.TempTablesManager = Parameters.TempTablesManager; + Query.Text = + "SELECT + | DataTable.* + |INTO tmp_BatchKeysInfo + |FROM + | &DataTable AS DataTable + |; + | + |SELECT + | %1 %2 %3 + |INTO BatchKeysInfo + |FROM + | tmp_BatchKeysInfo + |WHERE + | CurrencyMovementType = &CurrencyMovementType + |GROUP BY + | %1"; + + Query.Text = StrTemplate(Query.Text, BatchKeysInfoSettings.Dimensions, ?(TotalsArray.Count() > 0, ",", ""),StrConcat(TotalsArray, ", ")); + + Query.SetParameter("DataTable", BatchKeysInfoSettings.DataTable); + Query.SetParameter("CurrencyMovementType", BatchKeysInfoSettings.CurrencyMovementType); + Query.Execute(); +EndProcedure + +#EndRegion + #Region CheckDocumentPosting // Check document array. @@ -1297,16 +1327,15 @@ Function CheckDocumentArray(DocumentArray, isJob = False) Export BackgroundJobAPIServer.NotifyStream(Msg); EndIf; - For Each Doc In DocumentArray Do - DocObject = Doc.GetObject(); + DocObject = Doc; Parameters = GetPostingParameters(DocObject, PostingMode, AddInfo); // Multi currency integration CurrencyTable = CommonFunctionsClientServer.GetFromAddInfo(AddInfo, "CurrencyTable"); CurrenciesServer.PreparePostingDataTables(Parameters, CurrencyTable, AddInfo); - RegisteredRecords = RegisterRecords(DocObject, Parameters.PostingDataTables, Parameters.Object.RegisterRecords); + RegisteredRecords = RegisterRecords(Parameters); If RegisteredRecords.Count() > 0 Then Result = New Structure; diff --git a/IRP/src/CommonModules/UndopostingServer/Module.bsl b/IRP/src/CommonModules/UndopostingServer/Module.bsl index 791b294022..7c1ec96c1b 100644 --- a/IRP/src/CommonModules/UndopostingServer/Module.bsl +++ b/IRP/src/CommonModules/UndopostingServer/Module.bsl @@ -1,27 +1,21 @@ +// Undopost. +// +// Parameters: +// DocObject - DocumentObjectDocumentName - Doc object +// Cancel - Boolean - Cancel +// AddInfo - Undefined - Add info Procedure Undopost(DocObject, Cancel, AddInfo = Undefined) Export If Cancel Then Return; EndIf; - For Each RecordSet In DocObject.RegisterRecords Do TableForLoad = New ValueTable(); - AccReg = Metadata.AccumulationRegisters; - If TypeOf(RecordSet) = Type("AccumulationRegisterRecordSet.R1020B_AdvancesToVendors") Then - AdvancesRelevanceServer.SetBound_Advances(DocObject, TableForLoad, AccReg.R1020B_AdvancesToVendors); - ElsIf TypeOf(RecordSet) = Type("AccumulationRegisterRecordSet.R2020B_AdvancesFromCustomers") Then - AdvancesRelevanceServer.SetBound_Advances(DocObject, TableForLoad, AccReg.R2020B_AdvancesFromCustomers); - ElsIf TypeOf(RecordSet) = Type("AccumulationRegisterRecordSet.R1021B_VendorsTransactions") Then - AdvancesRelevanceServer.SetBound_Transactions(DocObject, TableForLoad, AccReg.R1021B_VendorsTransactions); - ElsIf TypeOf(RecordSet) = Type("AccumulationRegisterRecordSet.R2021B_CustomersTransactions") Then - AdvancesRelevanceServer.SetBound_Transactions(DocObject, TableForLoad, AccReg.R2021B_CustomersTransactions); - ElsIf TypeOf(RecordSet) = Type("AccumulationRegisterRecordSet.R5012B_VendorsAging") Then - AdvancesRelevanceServer.SetBound_Aging(DocObject, TableForLoad, AccReg.R5012B_VendorsAging); - ElsIf TypeOf(RecordSet) = Type("AccumulationRegisterRecordSet.R5011B_CustomersAging") Then - AdvancesRelevanceServer.SetBound_Aging(DocObject, TableForLoad, AccReg.R5011B_CustomersAging); - ElsIf TypeOf(RecordSet) = Type("InformationRegisterRecordSet.T6020S_BatchKeysInfo") Then + PostingServer.WriteAdvances(DocObject, RecordSet.Metadata(), TableForLoad); + + If RecordSet.Metadata() = Metadata.InformationRegisters.T6020S_BatchKeysInfo Then InformationRegisters.T6030S_BatchRelevance.BatchRelevance_SetBound(DocObject, - PostingServer.CreateTable(Metadata.InformationRegisters.T6020S_BatchKeysInfo)); + CommonFunctionsServer.CreateTable(Metadata.InformationRegisters.T6020S_BatchKeysInfo)); EndIf; EndDo; @@ -30,25 +24,27 @@ Procedure Undopost(DocObject, Cancel, AddInfo = Undefined) Export Parameters.Insert("IsReposting", False); Parameters.Insert("PointInTime", DocObject.PointInTime()); Parameters.Insert("TempTablesManager", New TempTablesManager()); + Parameters.Insert("DocumentDataTables", New Structure); + Parameters.Insert("LockDataSources", New Map); + Parameters.Insert("PostingDataTables", New Map); + Parameters.Insert("Metadata", DocObject.Ref.Metadata()); + + Module = Documents[DocObject.Ref.Metadata().Name]; // DocumentManager.SalesOrder - Module = Documents[DocObject.Ref.Metadata().Name]; - - DocumentDataTables = Module.UndopostingGetDocumentDataTables(DocObject.Ref, Cancel, Parameters, AddInfo); - Parameters.Insert("DocumentDataTables", DocumentDataTables); + Parameters.DocumentDataTables = Module.UndopostingGetDocumentDataTables(DocObject.Ref, Cancel, Parameters, AddInfo); If Cancel Then Return; EndIf; - LockDataSources = Module.UndopostingGetLockDataSource(DocObject.Ref, Cancel, Parameters, AddInfo); - Parameters.Insert("LockDataSources", LockDataSources); + Parameters.LockDataSources = Module.UndopostingGetLockDataSource(DocObject.Ref, Cancel, Parameters, AddInfo); If Cancel Then Return; EndIf; // Save pointers to locks DataLock = Undefined; - If LockDataSources <> Undefined Then - DataLock = SetLock(LockDataSources); + If Parameters.LockDataSources <> Undefined Then + DataLock = SetLock(Parameters.LockDataSources); EndIf; If TypeOf(AddInfo) = Type("Structure") Then AddInfo.Insert("DataLock", DataLock); @@ -60,7 +56,7 @@ Procedure Undopost(DocObject, Cancel, AddInfo = Undefined) Export EndIf; For Each RecordSet In DocObject.RegisterRecords Do - If Upper(RecordSet.Metadata().Name) = Upper("TM1010B_RowIDMovements") Then + If RecordSet.Metadata() = Metadata.AccumulationRegisters.TM1010B_RowIDMovements Then Continue; EndIf; RecordSet.Clear(); diff --git a/IRP/src/Configuration/Configuration.mdo b/IRP/src/Configuration/Configuration.mdo index 032650fe2b..6d3c6c5fbd 100644 --- a/IRP/src/Configuration/Configuration.mdo +++ b/IRP/src/Configuration/Configuration.mdo @@ -434,8 +434,8 @@ <commonModules>CommonModule.CatCashAccountsServer</commonModules> <commonModules>CommonModule.CatCompaniesClient</commonModules> <commonModules>CommonModule.CatCompaniesServer</commonModules> - <commonModules>CommonModule.CatConfigurationMetadataServer</commonModules> <commonModules>CommonModule.CatExpenseAndRevenueTypesServer</commonModules> + <commonModules>CommonModule.CatConfigurationMetadataServer</commonModules> <commonModules>CommonModule.CatItemsServer</commonModules> <commonModules>CommonModule.CatPartnersServer</commonModules> <commonModules>CommonModule.CatRetailCustomersClient</commonModules> @@ -1233,6 +1233,10 @@ <reports>Report.DetailingSupplies</reports> <reports>Report.ProductionPlanning</reports> <reports>Report.AdditionalDocumentTablesCheck</reports> + <reports>Report.TrialBalance</reports> + <reports>Report.TrialBalanceByAccount</reports> + <reports>Report.AccountCard</reports> + <reports>Report.AccountAnalysis</reports> <dataProcessors>DataProcessor.AnaliseDocumentMovements</dataProcessors> <dataProcessors>DataProcessor.AnalyseXDTO</dataProcessors> <dataProcessors>DataProcessor.BuilderExample</dataProcessors> diff --git a/IRP/src/DataProcessors/AnaliseDocumentMovements/AnaliseDocumentMovements.mdo b/IRP/src/DataProcessors/AnaliseDocumentMovements/AnaliseDocumentMovements.mdo index 4d03b00080..ebe85fa305 100644 --- a/IRP/src/DataProcessors/AnaliseDocumentMovements/AnaliseDocumentMovements.mdo +++ b/IRP/src/DataProcessors/AnaliseDocumentMovements/AnaliseDocumentMovements.mdo @@ -97,7 +97,7 @@ </synonym> <synonym> <key>ru</key> - <value>Регистратор</value> + <value>Документ</value> </synonym> <synonym> <key>tr</key> diff --git a/IRP/src/Documents/AdditionalCostAllocation/ManagerModule.bsl b/IRP/src/Documents/AdditionalCostAllocation/ManagerModule.bsl index f32e1687f5..b5cd090e6f 100644 --- a/IRP/src/Documents/AdditionalCostAllocation/ManagerModule.bsl +++ b/IRP/src/Documents/AdditionalCostAllocation/ManagerModule.bsl @@ -52,7 +52,12 @@ Procedure PostingCheckBeforeWrite(Ref, Cancel, PostingMode, Parameters, AddInfo EndIf; PostingDataTables = New Map; - PostingDataTables.Insert(Parameters.Object.RegisterRecords.R6070T_OtherPeriodsExpenses, New Structure("RecordSet, WriteInTransaction", OtherPeriodsExpensesByBasis, Parameters.IsReposting)); + + R6070T_OtherPeriodsExpenses = Metadata.AccumulationRegisters.R6070T_OtherPeriodsExpenses; + R6070TSettings = PostingServer.PostingTableSettings(R6070T_OtherPeriodsExpenses.Name, OtherPeriodsExpensesByBasis, Parameters.Object.RegisterRecords.R6070T_OtherPeriodsExpenses); + R6070TSettings.WriteInTransaction = Parameters.IsReposting; + PostingDataTables.Insert(R6070T_OtherPeriodsExpenses, R6070TSettings); + Parameters.Insert("PostingDataTables", PostingDataTables); CostAllocationObject = Parameters.Object; @@ -60,8 +65,7 @@ Procedure PostingCheckBeforeWrite(Ref, Cancel, PostingMode, Parameters, AddInfo CurrenciesServer.PreparePostingDataTables(Parameters, CurrencyTable, AddInfo); Parameters.Object = CostAllocationObject; - For Each RowRecordSet In Parameters.PostingDataTables.Get( - Parameters.Object.RegisterRecords.R6070T_OtherPeriodsExpenses).RecordSet Do + For Each RowRecordSet In Parameters.PostingDataTables.Get(R6070T_OtherPeriodsExpenses).PrepareTable Do FillPropertyValues(TableOtherPeriodsExpensesRecalculated.Add(), RowRecordSet); EndDo; EndDo; @@ -81,8 +85,12 @@ Procedure PostingCheckBeforeWrite(Ref, Cancel, PostingMode, Parameters, AddInfo EndIf; PostingDataTables = New Map; - PostingDataTables.Insert(Parameters.Object.RegisterRecords.T6060S_BatchCostAllocationInfo, - New Structure("RecordSet, WriteInTransaction", BatchCostAllocationInfoByBasis, Parameters.IsReposting)); + + T6060S_BatchCostAllocationInfo = Metadata.InformationRegisters.T6060S_BatchCostAllocationInfo; + T6060SSettings = PostingServer.PostingTableSettings(T6060S_BatchCostAllocationInfo.Name, BatchCostAllocationInfoByBasis, Parameters.Object.RegisterRecords.T6060S_BatchCostAllocationInfo); + T6060SSettings.WriteInTransaction = Parameters.IsReposting; + PostingDataTables.Insert(T6060S_BatchCostAllocationInfo, T6060SSettings); + Parameters.Insert("PostingDataTables", PostingDataTables); CostAllocationObject = Parameters.Object; @@ -90,8 +98,7 @@ Procedure PostingCheckBeforeWrite(Ref, Cancel, PostingMode, Parameters, AddInfo CurrenciesServer.PreparePostingDataTables(Parameters, CurrencyTable, AddInfo); Parameters.Object = CostAllocationObject; - For Each RowRecordSet In Parameters.PostingDataTables.Get( - Parameters.Object.RegisterRecords.T6060S_BatchCostAllocationInfo).RecordSet Do + For Each RowRecordSet In Parameters.PostingDataTables.Get(T6060S_BatchCostAllocationInfo).PrepareTable Do FillPropertyValues(BatchCostAllocationInfoRecalculated.Add(), RowRecordSet); EndDo; EndDo; @@ -111,8 +118,8 @@ Procedure PostingCheckBeforeWrite(Ref, Cancel, PostingMode, Parameters, AddInfo BatchKeysInfo.FillValues(Enums.BatchDirection.Receipt, "Direction"); Tables.T6020S_BatchKeysInfo = BatchKeysInfo; - CurrenciesServer.ExcludePostingDataTable(Parameters, Parameters.Object.RegisterRecords.R6070T_OtherPeriodsExpenses.Metadata()); - CurrenciesServer.ExcludePostingDataTable(Parameters, Parameters.Object.RegisterRecords.T6060S_BatchCostAllocationInfo.Metadata()); + CurrenciesServer.ExcludePostingDataTable(Parameters, Metadata.AccumulationRegisters.R6070T_OtherPeriodsExpenses); + CurrenciesServer.ExcludePostingDataTable(Parameters, Metadata.InformationRegisters.T6060S_BatchCostAllocationInfo); EndProcedure Function PostingGetPostingDataTables(Ref, Cancel, PostingMode, Parameters, AddInfo = Undefined) Export diff --git a/IRP/src/Documents/AdditionalRevenueAllocation/ManagerModule.bsl b/IRP/src/Documents/AdditionalRevenueAllocation/ManagerModule.bsl index 2aff04eef2..e02449f3f3 100644 --- a/IRP/src/Documents/AdditionalRevenueAllocation/ManagerModule.bsl +++ b/IRP/src/Documents/AdditionalRevenueAllocation/ManagerModule.bsl @@ -52,7 +52,12 @@ Procedure PostingCheckBeforeWrite(Ref, Cancel, PostingMode, Parameters, AddInfo EndIf; PostingDataTables = New Map; - PostingDataTables.Insert(Parameters.Object.RegisterRecords.R6080T_OtherPeriodsRevenues, New Structure("RecordSet, WriteInTransaction", OtherPeriodsRevenuesByBasis, Parameters.IsReposting)); + + R6080T_OtherPeriodsRevenues = Metadata.AccumulationRegisters.R6080T_OtherPeriodsRevenues; + R6080TSettings = PostingServer.PostingTableSettings(R6080T_OtherPeriodsRevenues.Name, OtherPeriodsRevenuesByBasis, Parameters.Object.RegisterRecords.R6080T_OtherPeriodsRevenues); + R6080TSettings.WriteInTransaction = Parameters.IsReposting; + PostingDataTables.Insert(R6080T_OtherPeriodsRevenues, R6080TSettings); + Parameters.Insert("PostingDataTables", PostingDataTables); RevenueAllocationObject = Parameters.Object; @@ -60,8 +65,7 @@ Procedure PostingCheckBeforeWrite(Ref, Cancel, PostingMode, Parameters, AddInfo CurrenciesServer.PreparePostingDataTables(Parameters, CurrencyTable, AddInfo); Parameters.Object = RevenueAllocationObject; - For Each RowRecordSet In Parameters.PostingDataTables.Get( - Parameters.Object.RegisterRecords.R6080T_OtherPeriodsRevenues).RecordSet Do + For Each RowRecordSet In Parameters.PostingDataTables.Get(R6080T_OtherPeriodsRevenues).PrepareTable Do FillPropertyValues(TableOtherPeriodsRevenuesRecalculated.Add(), RowRecordSet); EndDo; EndDo; @@ -82,8 +86,12 @@ Procedure PostingCheckBeforeWrite(Ref, Cancel, PostingMode, Parameters, AddInfo EndIf; PostingDataTables = New Map; - PostingDataTables.Insert(Parameters.Object.RegisterRecords.T6070S_BatchRevenueAllocationInfo, - New Structure("RecordSet, WriteInTransaction", BatchRevenueAllocationInfoByBasis, Parameters.IsReposting)); + + T6070S_BatchRevenueAllocationInfo = Metadata.InformationRegisters.T6070S_BatchRevenueAllocationInfo; + T6070SSettings = PostingServer.PostingTableSettings(T6070S_BatchRevenueAllocationInfo.Name, BatchRevenueAllocationInfoByBasis, Parameters.Object.RegisterRecords.T6070S_BatchRevenueAllocationInfo); + T6070SSettings.WriteInTransaction = Parameters.IsReposting; + PostingDataTables.Insert(T6070S_BatchRevenueAllocationInfo, T6070SSettings); + Parameters.Insert("PostingDataTables", PostingDataTables); RevenueAllocationObject = Parameters.Object; @@ -91,8 +99,7 @@ Procedure PostingCheckBeforeWrite(Ref, Cancel, PostingMode, Parameters, AddInfo CurrenciesServer.PreparePostingDataTables(Parameters, CurrencyTable, AddInfo); Parameters.Object = RevenueAllocationObject; - For Each RowRecordSet In Parameters.PostingDataTables.Get( - Parameters.Object.RegisterRecords.T6070S_BatchRevenueAllocationInfo).RecordSet Do + For Each RowRecordSet In Parameters.PostingDataTables.Get(T6070S_BatchRevenueAllocationInfo).PrepareTable Do FillPropertyValues(BatchRevenueAllocationInfoRecalculated.Add(), RowRecordSet); EndDo; EndDo; @@ -112,8 +119,8 @@ Procedure PostingCheckBeforeWrite(Ref, Cancel, PostingMode, Parameters, AddInfo BatchKeysInfo.FillValues(Enums.BatchDirection.Receipt, "Direction"); Tables.T6020S_BatchKeysInfo = BatchKeysInfo; - CurrenciesServer.ExcludePostingDataTable(Parameters, Parameters.Object.RegisterRecords.R6080T_OtherPeriodsRevenues.Metadata()); - CurrenciesServer.ExcludePostingDataTable(Parameters, Parameters.Object.RegisterRecords.T6070S_BatchRevenueAllocationInfo.Metadata()); + CurrenciesServer.ExcludePostingDataTable(Parameters, Metadata.AccumulationRegisters.R6080T_OtherPeriodsRevenues); + CurrenciesServer.ExcludePostingDataTable(Parameters, Metadata.InformationRegisters.T6070S_BatchRevenueAllocationInfo); EndProcedure Function PostingGetPostingDataTables(Ref, Cancel, PostingMode, Parameters, AddInfo = Undefined) Export diff --git a/IRP/src/Documents/BankPayment/ManagerModule.bsl b/IRP/src/Documents/BankPayment/ManagerModule.bsl index fb2b897467..a610c98dd6 100644 --- a/IRP/src/Documents/BankPayment/ManagerModule.bsl +++ b/IRP/src/Documents/BankPayment/ManagerModule.bsl @@ -9,153 +9,17 @@ EndFunction #Region Posting Function PostingGetDocumentDataTables(Ref, Cancel, PostingMode, Parameters, AddInfo = Undefined) Export - - AccReg = Metadata.AccumulationRegisters; - Tables = New Structure; - Tables.Insert("CashInTransit", PostingServer.CreateTable(AccReg.CashInTransit)); - - QueryPaymentList = New Query; - QueryPaymentList.Text = GetQueryTextBankPaymentPaymentList(); - QueryPaymentList.SetParameter("Ref", Ref); - QueryResultsPaymentList = QueryPaymentList.Execute(); - QueryTablePaymentList = QueryResultsPaymentList.Unload(); - - Query = New Query; - Query.Text = GetQueryTextQueryTable(); - Query.SetParameter("QueryTable", QueryTablePaymentList); - QueryResults = Query.ExecuteBatch(); - - Tables.CashInTransit = QueryResults[1].Unload(); - QueryArray = GetQueryTextsSecondaryTables(); PostingServer.ExecuteQuery(Ref, QueryArray, Parameters); AccountingServer.CreateAccountingDataTables(Ref, Cancel, PostingMode, Parameters, AddInfo); - Return Tables; -EndFunction -Function GetQueryTextBankPaymentPaymentList() - Return "SELECT - | BankPaymentPaymentList.Ref.Company AS Company, - | BankPaymentPaymentList.Ref.Currency AS Currency, - | BankPaymentPaymentList.Ref.Account AS Account, - | BankPaymentPaymentList.Ref.TransitAccount AS TransitAccount, - | CASE - | WHEN BankPaymentPaymentList.Agreement.ApArPostingDetail = VALUE(Enum.ApArPostingDetail.ByDocuments) - | THEN CASE - | WHEN VALUETYPE(BankPaymentPaymentList.PlaningTransactionBasis) = TYPE(Document.CashTransferOrder) - | AND - | NOT BankPaymentPaymentList.PlaningTransactionBasis.Date IS NULL - | AND - | BankPaymentPaymentList.PlaningTransactionBasis.SendCurrency <> BankPaymentPaymentList.PlaningTransactionBasis.ReceiveCurrency - | THEN BankPaymentPaymentList.PlaningTransactionBasis - | ELSE BankPaymentPaymentList.BasisDocument - | END - | ELSE UNDEFINED - | END AS BasisDocument, - | CASE - | WHEN BankPaymentPaymentList.Agreement = VALUE(Catalog.Agreements.EmptyRef) - | THEN TRUE - | ELSE FALSE - | END - | AND - | NOT CASE - | WHEN VALUETYPE(BankPaymentPaymentList.PlaningTransactionBasis) = TYPE(Document.CashTransferOrder) - | AND - | NOT BankPaymentPaymentList.PlaningTransactionBasis.Date IS NULL - | AND - | BankPaymentPaymentList.PlaningTransactionBasis.SendCurrency <> BankPaymentPaymentList.PlaningTransactionBasis.ReceiveCurrency - | THEN TRUE - | ELSE FALSE - | END AS IsAdvance, - | BankPaymentPaymentList.PlaningTransactionBasis AS PlaningTransactionBasis, - | CASE - | WHEN BankPaymentPaymentList.Agreement.Kind = VALUE(Enum.AgreementKinds.Regular) - | AND BankPaymentPaymentList.Agreement.ApArPostingDetail = VALUE(Enum.ApArPostingDetail.ByStandardAgreement) - | THEN BankPaymentPaymentList.Agreement.StandardAgreement - | ELSE BankPaymentPaymentList.Agreement - | END AS Agreement, - | BankPaymentPaymentList.Partner AS Partner, - | BankPaymentPaymentList.Payee AS Payee, - | BankPaymentPaymentList.Ref.Date AS Period, - | BankPaymentPaymentList.TotalAmount AS Amount, - | CASE - | WHEN VALUETYPE(BankPaymentPaymentList.PlaningTransactionBasis) = TYPE(Document.CashTransferOrder) - | AND - | NOT BankPaymentPaymentList.PlaningTransactionBasis.Date IS NULL - | AND - | BankPaymentPaymentList.PlaningTransactionBasis.SendCurrency = BankPaymentPaymentList.PlaningTransactionBasis.ReceiveCurrency - | THEN TRUE - | ELSE FALSE - | END AS IsMoneyTransfer, - | CASE - | WHEN VALUETYPE(BankPaymentPaymentList.PlaningTransactionBasis) = TYPE(Document.CashTransferOrder) - | AND - | NOT BankPaymentPaymentList.PlaningTransactionBasis.Date IS NULL - | AND - | BankPaymentPaymentList.PlaningTransactionBasis.SendCurrency <> BankPaymentPaymentList.PlaningTransactionBasis.ReceiveCurrency - | THEN TRUE - | ELSE FALSE - | END AS IsMoneyExchange, - | BankPaymentPaymentList.PlaningTransactionBasis.Sender AS FromAccount, - | BankPaymentPaymentList.PlaningTransactionBasis.Receiver AS ToAccount, - | BankPaymentPaymentList.Ref AS PaymentDocument, - | BankPaymentPaymentList.Key AS Key, - | BankPaymentPaymentList.ProfitLossCenter AS ProfitLossCenter, - | BankPaymentPaymentList.ExpenseType AS ExpenseType, - | BankPaymentPaymentList.AdditionalAnalytic AS AdditionalAnalytic, - | BankPaymentPaymentList.Commission AS Commission, - | BankPaymentPaymentList.Ref.Branch AS Branch - |FROM - | Document.BankPayment.PaymentList AS BankPaymentPaymentList - |WHERE - | BankPaymentPaymentList.Ref = &Ref"; -EndFunction + Tables = New Structure; -Function GetQueryTextQueryTable() - Return "SELECT - | QueryTable.Company AS Company, - | QueryTable.Currency AS Currency, - | QueryTable.Account AS Account, - | QueryTable.TransitAccount AS TransitAccount, - | QueryTable.BasisDocument AS BasisDocument, - | QueryTable.IsAdvance, - | QueryTable.PlaningTransactionBasis AS PlaningTransactionBasis, - | QueryTable.Agreement AS Agreement, - | QueryTable.Partner AS Partner, - | QueryTable.Payee AS Payee, - | QueryTable.Period AS Period, - | QueryTable.Amount AS Amount, - | QueryTable.IsMoneyTransfer AS IsMoneyTransfer, - | QueryTable.IsMoneyExchange AS IsMoneyExchange, - | QueryTable.FromAccount AS FromAccount, - | QueryTable.ToAccount AS ToAccount, - | QueryTable.PaymentDocument AS PaymentDocument, - | QueryTable.Key AS Key, - | QueryTable.ProfitLossCenter AS ProfitLossCenter, - | QueryTable.ExpenseType AS ExpenseType, - | QueryTable.AdditionalAnalytic AS AdditionalAnalytic, - | QueryTable.Commission AS Commission, - | QueryTable.Branch - |INTO tmp - |FROM - | &QueryTable AS QueryTable - |; - | - |//[1]////////////////////////////////////////////////////////////////////////////// - |SELECT - | tmp.Company AS Company, - | tmp.PlaningTransactionBasis AS BasisDocument, - | tmp.FromAccount AS FromAccount, - | tmp.ToAccount AS ToAccount, - | tmp.Currency AS Currency, - | tmp.Amount AS Amount, - | tmp.Period, - | tmp.Key - |FROM - | tmp AS tmp - |WHERE - | tmp.IsMoneyTransfer"; + CashInTransit = Metadata.AccumulationRegisters.CashInTransit; + Tables.Insert(CashInTransit.Name, CommonFunctionsServer.CreateTable(CashInTransit)); + + Return Tables; EndFunction Function PostingGetLockDataSource(Ref, Cancel, PostingMode, Parameters, AddInfo = Undefined) Export @@ -187,12 +51,11 @@ EndProcedure Function PostingGetPostingDataTables(Ref, Cancel, PostingMode, Parameters, AddInfo = Undefined) Export PostingDataTables = New Map; - - // CashInIransit - PostingDataTables.Insert(Parameters.Object.RegisterRecords.CashInTransit, New Structure("RecordType, RecordSet", AccumulationRecordType.Receipt, Parameters.DocumentDataTables.CashInTransit)); - PostingServer.SetPostingDataTables(PostingDataTables, Parameters); - + + CashInTransit = Metadata.AccumulationRegisters.CashInTransit; + PostingServer.SetPostingDataTable(PostingDataTables, Parameters, CashInTransit.Name, Parameters.DocumentDataTables[CashInTransit.Name]); + Return PostingDataTables; EndFunction @@ -246,6 +109,7 @@ EndFunction Function GetQueryTextsMasterTables() QueryArray = New Array; + QueryArray.Add(CashInTransit()); QueryArray.Add(R1020B_AdvancesToVendors()); QueryArray.Add(R1021B_VendorsTransactions()); QueryArray.Add(R2020B_AdvancesFromCustomers()); @@ -383,6 +247,98 @@ EndFunction #Region Posting_MainTables +Function CashInTransit() + Return "SELECT + | BankPaymentPaymentList.Ref.Company AS Company, + | BankPaymentPaymentList.Ref.Currency AS Currency, + | BankPaymentPaymentList.Ref.Account AS Account, + | BankPaymentPaymentList.Ref.TransitAccount AS TransitAccount, + | CASE + | WHEN BankPaymentPaymentList.Agreement.ApArPostingDetail = VALUE(Enum.ApArPostingDetail.ByDocuments) + | THEN CASE + | WHEN VALUETYPE(BankPaymentPaymentList.PlaningTransactionBasis) = TYPE(Document.CashTransferOrder) + | AND NOT BankPaymentPaymentList.PlaningTransactionBasis.Date IS NULL + | AND + | BankPaymentPaymentList.PlaningTransactionBasis.SendCurrency <> BankPaymentPaymentList.PlaningTransactionBasis.ReceiveCurrency + | THEN BankPaymentPaymentList.PlaningTransactionBasis + | ELSE BankPaymentPaymentList.BasisDocument + | END + | ELSE UNDEFINED + | END AS BasisDocument, + | CASE + | WHEN BankPaymentPaymentList.Agreement = VALUE(Catalog.Agreements.EmptyRef) + | THEN TRUE + | ELSE FALSE + | END + | AND NOT CASE + | WHEN VALUETYPE(BankPaymentPaymentList.PlaningTransactionBasis) = TYPE(Document.CashTransferOrder) + | AND NOT BankPaymentPaymentList.PlaningTransactionBasis.Date IS NULL + | AND + | BankPaymentPaymentList.PlaningTransactionBasis.SendCurrency <> BankPaymentPaymentList.PlaningTransactionBasis.ReceiveCurrency + | THEN TRUE + | ELSE FALSE + | END AS IsAdvance, + | BankPaymentPaymentList.PlaningTransactionBasis AS PlaningTransactionBasis, + | CASE + | WHEN BankPaymentPaymentList.Agreement.Kind = VALUE(Enum.AgreementKinds.Regular) + | AND BankPaymentPaymentList.Agreement.ApArPostingDetail = VALUE(Enum.ApArPostingDetail.ByStandardAgreement) + | THEN BankPaymentPaymentList.Agreement.StandardAgreement + | ELSE BankPaymentPaymentList.Agreement + | END AS Agreement, + | BankPaymentPaymentList.Partner AS Partner, + | BankPaymentPaymentList.Payee AS Payee, + | BankPaymentPaymentList.Ref.Date AS Period, + | BankPaymentPaymentList.TotalAmount AS Amount, + | CASE + | WHEN VALUETYPE(BankPaymentPaymentList.PlaningTransactionBasis) = TYPE(Document.CashTransferOrder) + | AND NOT BankPaymentPaymentList.PlaningTransactionBasis.Date IS NULL + | AND + | BankPaymentPaymentList.PlaningTransactionBasis.SendCurrency = BankPaymentPaymentList.PlaningTransactionBasis.ReceiveCurrency + | THEN TRUE + | ELSE FALSE + | END AS IsMoneyTransfer, + | CASE + | WHEN VALUETYPE(BankPaymentPaymentList.PlaningTransactionBasis) = TYPE(Document.CashTransferOrder) + | AND NOT BankPaymentPaymentList.PlaningTransactionBasis.Date IS NULL + | AND + | BankPaymentPaymentList.PlaningTransactionBasis.SendCurrency <> BankPaymentPaymentList.PlaningTransactionBasis.ReceiveCurrency + | THEN TRUE + | ELSE FALSE + | END AS IsMoneyExchange, + | BankPaymentPaymentList.PlaningTransactionBasis.Sender AS FromAccount, + | BankPaymentPaymentList.PlaningTransactionBasis.Receiver AS ToAccount, + | BankPaymentPaymentList.Ref AS PaymentDocument, + | BankPaymentPaymentList.Key AS Key, + | BankPaymentPaymentList.ProfitLossCenter AS ProfitLossCenter, + | BankPaymentPaymentList.ExpenseType AS ExpenseType, + | BankPaymentPaymentList.AdditionalAnalytic AS AdditionalAnalytic, + | BankPaymentPaymentList.Commission AS Commission, + | BankPaymentPaymentList.Ref.Branch AS Branch + |INTO TablePaymentList + |FROM + | Document.BankPayment.PaymentList AS BankPaymentPaymentList + |WHERE + | BankPaymentPaymentList.Ref = &Ref + |; + | + |//////////////////////////////////////////////////////////////////////////////// + |SELECT + | VALUE(AccumulationRecordType.Receipt) AS RecordType, + | tmp.Company AS Company, + | tmp.PlaningTransactionBasis AS BasisDocument, + | tmp.FromAccount AS FromAccount, + | tmp.ToAccount AS ToAccount, + | tmp.Currency AS Currency, + | tmp.Amount AS Amount, + | tmp.Period, + | tmp.Key + |INTO CashInTransit + |FROM + | TablePaymentList AS tmp + |WHERE + | tmp.IsMoneyTransfer"; +EndFunction + Function R1020B_AdvancesToVendors() Return "SELECT | VALUE(AccumulationRecordType.Receipt) AS RecordType, @@ -987,7 +943,11 @@ Function GetAnalytics_PaymentToVendor(Parameters) AccountingAnalytics = AccountingServer.GetAccountingAnalyticsResult(Parameters); AccountParameters = AccountingServer.GetAccountParameters(Parameters); - Debit = AccountingServer.GetT9012S_AccountsPartner(AccountParameters, Parameters.RowData.Partner, Parameters.RowData.Agreement); + Debit = AccountingServer.GetT9012S_AccountsPartner(AccountParameters, + Parameters.RowData.Partner, + Parameters.RowData.Agreement, + Parameters.ObjectData.Currency); + IsAdvance = AccountingServer.IsAdvance(Parameters.RowData); If IsAdvance Then If ValueIsFilled(Debit.AccountAdvancesVendor) Then @@ -1017,7 +977,11 @@ Function GetAnalytics_OffsetOfAdvances(Parameters) AccountingAnalytics = AccountingServer.GetAccountingAnalyticsResult(Parameters); AccountParameters = AccountingServer.GetAccountParameters(Parameters); - Accounts = AccountingServer.GetT9012S_AccountsPartner(AccountParameters, Parameters.RowData.Partner, Parameters.RowData.Agreement); + Accounts = AccountingServer.GetT9012S_AccountsPartner(AccountParameters, + Parameters.RowData.Partner, + Parameters.RowData.Agreement, + Parameters.ObjectData.Currency); + If ValueIsFilled(Accounts.AccountTransactionsVendor) Then AccountingAnalytics.Debit = Accounts.AccountTransactionsVendor; EndIf; diff --git a/IRP/src/Documents/BankReceipt/ManagerModule.bsl b/IRP/src/Documents/BankReceipt/ManagerModule.bsl index 54775e634f..7a993b3474 100644 --- a/IRP/src/Documents/BankReceipt/ManagerModule.bsl +++ b/IRP/src/Documents/BankReceipt/ManagerModule.bsl @@ -9,182 +9,17 @@ EndFunction #Region Posting Function PostingGetDocumentDataTables(Ref, Cancel, PostingMode, Parameters, AddInfo = Undefined) Export - AccReg = Metadata.AccumulationRegisters; - Tables = New Structure; - Tables.Insert("CashInTransit", PostingServer.CreateTable(AccReg.CashInTransit)); - Tables.Insert("CashInTransit_POS", PostingServer.CreateTable(AccReg.CashInTransit)); - - QueryPaymentList = New Query; - QueryPaymentList.Text = GetQueryTextBankReceiptPaymentList(); - QueryPaymentList.SetParameter("Ref", Ref); - QueryResultsPaymentList = QueryPaymentList.Execute(); - QueryTablePaymentList = QueryResultsPaymentList.Unload(); - - Query = New Query; - Query.Text = GetQueryTextQueryTable(); - Query.SetParameter("QueryTable", QueryTablePaymentList); - QueryResults = Query.ExecuteBatch(); - - Tables.CashInTransit = QueryResults[1].Unload(); - Tables.CashInTransit_POS = QueryResults[2].Unload(); - QueryArray = GetQueryTextsSecondaryTables(); PostingServer.ExecuteQuery(Ref, QueryArray, Parameters); AccountingServer.CreateAccountingDataTables(Ref, Cancel, PostingMode, Parameters, AddInfo); - Return Tables; -EndFunction - -Function GetQueryTextBankReceiptPaymentList() - Return "SELECT - | BankReceiptPaymentList.Ref.Company AS Company, - | BankReceiptPaymentList.Ref.Currency AS Currency, - | BankReceiptPaymentList.Ref.CurrencyExchange AS CurrencyExchange, - | BankReceiptPaymentList.Ref.Account AS Account, - | BankReceiptPaymentList.Ref.TransitAccount AS TransitAccount, - | CASE - | WHEN BankReceiptPaymentList.Agreement.ApArPostingDetail = VALUE(Enum.ApArPostingDetail.ByDocuments) - | THEN CASE - | WHEN (VALUETYPE(BankReceiptPaymentList.PlaningTransactionBasis) = TYPE(Document.CashTransferOrder) - | OR VALUETYPE(BankReceiptPaymentList.PlaningTransactionBasis) = TYPE(Document.CashStatement)) - | AND NOT BankReceiptPaymentList.PlaningTransactionBasis.Date IS NULL - | AND - | BankReceiptPaymentList.PlaningTransactionBasis.SendCurrency <> BankReceiptPaymentList.PlaningTransactionBasis.ReceiveCurrency - | THEN BankReceiptPaymentList.PlaningTransactionBasis - | ELSE BankReceiptPaymentList.BasisDocument - | END - | ELSE UNDEFINED - | END AS BasisDocument, - | CASE - | WHEN BankReceiptPaymentList.Agreement = VALUE(Catalog.Agreements.EmptyRef) - | THEN TRUE - | ELSE FALSE - | END - | AND NOT CASE - | WHEN (VALUETYPE(BankReceiptPaymentList.PlaningTransactionBasis) = TYPE(Document.CashTransferOrder) - | OR VALUETYPE(BankReceiptPaymentList.PlaningTransactionBasis) = TYPE(Document.CashStatement)) - | AND NOT BankReceiptPaymentList.PlaningTransactionBasis.Date IS NULL - | AND - | BankReceiptPaymentList.PlaningTransactionBasis.SendCurrency <> BankReceiptPaymentList.PlaningTransactionBasis.ReceiveCurrency - | THEN TRUE - | ELSE FALSE - | END AS IsAdvance, - | BankReceiptPaymentList.PlaningTransactionBasis AS PlaningTransactionBasis, - | CASE - | WHEN BankReceiptPaymentList.Agreement.Kind = VALUE(Enum.AgreementKinds.Regular) - | AND BankReceiptPaymentList.Agreement.ApArPostingDetail = VALUE(Enum.ApArPostingDetail.ByStandardAgreement) - | THEN BankReceiptPaymentList.Agreement.StandardAgreement - | ELSE BankReceiptPaymentList.Agreement - | END AS Agreement, - | BankReceiptPaymentList.Partner AS Partner, - | BankReceiptPaymentList.Payer AS Payer, - | BankReceiptPaymentList.Ref.Date AS Period, - | BankReceiptPaymentList.TotalAmount AS Amount, - | BankReceiptPaymentList.AmountExchange AS AmountExchange, - | CASE - | WHEN VALUETYPE(BankReceiptPaymentList.PlaningTransactionBasis) = TYPE(Document.CashTransferOrder) - | AND NOT BankReceiptPaymentList.PlaningTransactionBasis.Date IS NULL - | AND - | BankReceiptPaymentList.PlaningTransactionBasis.SendCurrency = BankReceiptPaymentList.PlaningTransactionBasis.ReceiveCurrency - | THEN TRUE - | ELSE FALSE - | END AS IsMoneyTransfer, - | CASE - | WHEN VALUETYPE(BankReceiptPaymentList.PlaningTransactionBasis) = TYPE(Document.CashTransferOrder) - | AND NOT BankReceiptPaymentList.PlaningTransactionBasis.Date IS NULL - | AND - | BankReceiptPaymentList.PlaningTransactionBasis.SendCurrency <> BankReceiptPaymentList.PlaningTransactionBasis.ReceiveCurrency - | THEN TRUE - | ELSE FALSE - | END AS IsMoneyExchange, - | CASE - | WHEN VALUETYPE(BankReceiptPaymentList.PlaningTransactionBasis) = TYPE(Document.CashStatement) - | AND NOT BankReceiptPaymentList.PlaningTransactionBasis.Date IS NULL - | THEN TRUE - | ELSE FALSE - | END AS TransferFromPOS, - | BankReceiptPaymentList.Ref.Account AS ToAccount_POS, - | BankReceiptPaymentList.POSAccount AS FromAccount_POS, - | BankReceiptPaymentList.PlaningTransactionBasis.Sender AS FromAccount, - | BankReceiptPaymentList.PlaningTransactionBasis.Receiver AS ToAccount, - | BankReceiptPaymentList.Ref AS ReceiptDocument, - | BankReceiptPaymentList.Key, - | BankReceiptPaymentList.ProfitLossCenter AS ProfitLossCenter, - | BankReceiptPaymentList.ExpenseType AS ExpenseType, - | BankReceiptPaymentList.AdditionalAnalytic AS AdditionalAnalytic, - | BankReceiptPaymentList.Commission AS Commission, - | BankReceiptPaymentList.Ref.Branch AS Branch - |FROM - | Document.BankReceipt.PaymentList AS BankReceiptPaymentList - |WHERE - | BankReceiptPaymentList.Ref = &Ref"; -EndFunction + + Tables = New Structure; -Function GetQueryTextQueryTable() - Return "SELECT - | QueryTable.Company AS Company, - | QueryTable.Currency AS Currency, - | QueryTable.CurrencyExchange AS CurrencyExchange, - | QueryTable.Account AS Account, - | QueryTable.TransitAccount AS TransitAccount, - | QueryTable.PlaningTransactionBasis AS PlaningTransactionBasis, - | QueryTable.BasisDocument AS BasisDocument, - | QueryTable.IsAdvance AS IsAdvance, - | QueryTable.Agreement AS Agreement, - | QueryTable.Partner AS Partner, - | QueryTable.Payer AS Payer, - | QueryTable.Period AS Period, - | QueryTable.Amount AS Amount, - | QueryTable.AmountExchange AS AmountExchange, - | QueryTable.IsMoneyTransfer AS IsMoneyTransfer, - | QueryTable.IsMoneyExchange AS IsMoneyExchange, - | QueryTable.FromAccount AS FromAccount, - | QueryTable.ToAccount AS ToAccount, - | QueryTable.ReceiptDocument AS ReceiptDocument, - | QueryTable.Key AS Key, - | QueryTable.TransferFromPOS AS TransferFromPOS, - | QueryTable.ToAccount_POS AS ToAccount_POS, - | QueryTable.FromAccount_POS AS FromAccount_POS, - | QueryTable.ProfitLossCenter AS ProfitLossCenter, - | QueryTable.ExpenseType AS ExpenseType, - | QueryTable.AdditionalAnalytic AS AdditionalAnalytic, - | QueryTable.Commission AS Commission, - | QueryTable.Branch AS Branch - |INTO tmp - |FROM - | &QueryTable AS QueryTable - |; - | - |//[1]////////////////////////////////////////////////////////////////////////////// - |SELECT - | tmp.Company AS Company, - | tmp.PlaningTransactionBasis AS BasisDocument, - | tmp.FromAccount AS FromAccount, - | tmp.ToAccount AS ToAccount, - | tmp.Currency AS Currency, - | tmp.Amount AS Amount, - | tmp.Period, - | tmp.Key - |FROM - | tmp AS tmp - |WHERE - | tmp.IsMoneyTransfer - |; - | - |//[2]////////////////////////////////////////////////////////////////////////////// - |SELECT - | tmp.Company AS Company, - | tmp.PlaningTransactionBasis AS BasisDocument, - | tmp.FromAccount_POS AS FromAccount, - | tmp.ToAccount_POS AS ToAccount, - | tmp.Currency AS Currency, - | tmp.Amount AS Amount, - | tmp.Period, - | tmp.Key - |FROM - | tmp AS tmp - |WHERE - | tmp.TransferFromPOS"; + CashInTransit = Metadata.AccumulationRegisters.CashInTransit; + Tables.Insert(CashInTransit.Name, CommonFunctionsServer.CreateTable(CashInTransit)); + + Return Tables; EndFunction Function PostingGetLockDataSource(Ref, Cancel, PostingMode, Parameters, AddInfo = Undefined) Export @@ -216,24 +51,11 @@ EndProcedure Function PostingGetPostingDataTables(Ref, Cancel, PostingMode, Parameters, AddInfo = Undefined) Export PostingDataTables = New Map; - - // CashInIransit - ArrayOfTables = New Array; - Table1 = Parameters.DocumentDataTables.CashInTransit.Copy(); - Table1.Columns.Add("RecordType", New TypeDescription("AccumulationRecordType")); - Table1.FillValues(AccumulationRecordType.Expense, "RecordType"); - ArrayOfTables.Add(Table1); - - Table2 = Parameters.DocumentDataTables.CashInTransit_POS.Copy(); - Table2.Columns.Add("RecordType", New TypeDescription("AccumulationRecordType")); - Table2.FillValues(AccumulationRecordType.Expense, "RecordType"); - ArrayOfTables.Add(Table2); - - PostingDataTables.Insert(Parameters.Object.RegisterRecords.CashInTransit, New Structure("RecordSet, WriteInTransaction", PostingServer.JoinTables(ArrayOfTables, - "RecordType, Period, Company, BasisDocument, FromAccount, ToAccount, Currency, Amount, Key"), Parameters.IsReposting)); - PostingServer.SetPostingDataTables(PostingDataTables, Parameters); - + + CashInTransit = Metadata.AccumulationRegisters.CashInTransit; + PostingServer.SetPostingDataTable(PostingDataTables, Parameters, CashInTransit.Name, Parameters.DocumentDataTables[CashInTransit.Name]); + Return PostingDataTables; EndFunction @@ -287,6 +109,7 @@ EndFunction Function GetQueryTextsMasterTables() QueryArray = New Array; + QueryArray.Add(CashInTransit()); QueryArray.Add(R1020B_AdvancesToVendors()); QueryArray.Add(R1021B_VendorsTransactions()); QueryArray.Add(R2020B_AdvancesFromCustomers()); @@ -429,6 +252,127 @@ EndFunction #Region Posting_MainTables +Function CashInTransit() + Return "SELECT + | BankReceiptPaymentList.Ref.Company AS Company, + | BankReceiptPaymentList.Ref.Currency AS Currency, + | BankReceiptPaymentList.Ref.CurrencyExchange AS CurrencyExchange, + | BankReceiptPaymentList.Ref.Account AS Account, + | BankReceiptPaymentList.Ref.TransitAccount AS TransitAccount, + | CASE + | WHEN BankReceiptPaymentList.Agreement.ApArPostingDetail = VALUE(Enum.ApArPostingDetail.ByDocuments) + | THEN CASE + | WHEN (VALUETYPE(BankReceiptPaymentList.PlaningTransactionBasis) = TYPE(Document.CashTransferOrder) + | OR VALUETYPE(BankReceiptPaymentList.PlaningTransactionBasis) = TYPE(Document.CashStatement)) + | AND NOT BankReceiptPaymentList.PlaningTransactionBasis.Date IS NULL + | AND + | BankReceiptPaymentList.PlaningTransactionBasis.SendCurrency <> BankReceiptPaymentList.PlaningTransactionBasis.ReceiveCurrency + | THEN BankReceiptPaymentList.PlaningTransactionBasis + | ELSE BankReceiptPaymentList.BasisDocument + | END + | ELSE UNDEFINED + | END AS BasisDocument, + | CASE + | WHEN BankReceiptPaymentList.Agreement = VALUE(Catalog.Agreements.EmptyRef) + | THEN TRUE + | ELSE FALSE + | END + | AND NOT CASE + | WHEN (VALUETYPE(BankReceiptPaymentList.PlaningTransactionBasis) = TYPE(Document.CashTransferOrder) + | OR VALUETYPE(BankReceiptPaymentList.PlaningTransactionBasis) = TYPE(Document.CashStatement)) + | AND NOT BankReceiptPaymentList.PlaningTransactionBasis.Date IS NULL + | AND + | BankReceiptPaymentList.PlaningTransactionBasis.SendCurrency <> BankReceiptPaymentList.PlaningTransactionBasis.ReceiveCurrency + | THEN TRUE + | ELSE FALSE + | END AS IsAdvance, + | BankReceiptPaymentList.PlaningTransactionBasis AS PlaningTransactionBasis, + | CASE + | WHEN BankReceiptPaymentList.Agreement.Kind = VALUE(Enum.AgreementKinds.Regular) + | AND BankReceiptPaymentList.Agreement.ApArPostingDetail = VALUE(Enum.ApArPostingDetail.ByStandardAgreement) + | THEN BankReceiptPaymentList.Agreement.StandardAgreement + | ELSE BankReceiptPaymentList.Agreement + | END AS Agreement, + | BankReceiptPaymentList.Partner AS Partner, + | BankReceiptPaymentList.Payer AS Payer, + | BankReceiptPaymentList.Ref.Date AS Period, + | BankReceiptPaymentList.TotalAmount AS Amount, + | BankReceiptPaymentList.AmountExchange AS AmountExchange, + | CASE + | WHEN VALUETYPE(BankReceiptPaymentList.PlaningTransactionBasis) = TYPE(Document.CashTransferOrder) + | AND NOT BankReceiptPaymentList.PlaningTransactionBasis.Date IS NULL + | AND + | BankReceiptPaymentList.PlaningTransactionBasis.SendCurrency = BankReceiptPaymentList.PlaningTransactionBasis.ReceiveCurrency + | THEN TRUE + | ELSE FALSE + | END AS IsMoneyTransfer, + | CASE + | WHEN VALUETYPE(BankReceiptPaymentList.PlaningTransactionBasis) = TYPE(Document.CashTransferOrder) + | AND NOT BankReceiptPaymentList.PlaningTransactionBasis.Date IS NULL + | AND + | BankReceiptPaymentList.PlaningTransactionBasis.SendCurrency <> BankReceiptPaymentList.PlaningTransactionBasis.ReceiveCurrency + | THEN TRUE + | ELSE FALSE + | END AS IsMoneyExchange, + | CASE + | WHEN VALUETYPE(BankReceiptPaymentList.PlaningTransactionBasis) = TYPE(Document.CashStatement) + | AND NOT BankReceiptPaymentList.PlaningTransactionBasis.Date IS NULL + | THEN TRUE + | ELSE FALSE + | END AS TransferFromPOS, + | BankReceiptPaymentList.Ref.Account AS ToAccount_POS, + | BankReceiptPaymentList.POSAccount AS FromAccount_POS, + | BankReceiptPaymentList.PlaningTransactionBasis.Sender AS FromAccount, + | BankReceiptPaymentList.PlaningTransactionBasis.Receiver AS ToAccount, + | BankReceiptPaymentList.Ref AS ReceiptDocument, + | BankReceiptPaymentList.Key, + | BankReceiptPaymentList.ProfitLossCenter AS ProfitLossCenter, + | BankReceiptPaymentList.ExpenseType AS ExpenseType, + | BankReceiptPaymentList.AdditionalAnalytic AS AdditionalAnalytic, + | BankReceiptPaymentList.Commission AS Commission, + | BankReceiptPaymentList.Ref.Branch AS Branch + |INTO TablePaymentList + |FROM + | Document.BankReceipt.PaymentList AS BankReceiptPaymentList + |WHERE + | BankReceiptPaymentList.Ref = &Ref + |; + | + |//////////////////////////////////////////////////////////////////////////////// + |SELECT + | VALUE(AccumulationRecordType.Expense) AS RecordType, + | tmp.Company AS Company, + | tmp.PlaningTransactionBasis AS BasisDocument, + | tmp.FromAccount AS FromAccount, + | tmp.ToAccount AS ToAccount, + | tmp.Currency AS Currency, + | tmp.Amount AS Amount, + | tmp.Period, + | tmp.Key + |INTO CashInTransit + |FROM + | TablePaymentList AS tmp + |WHERE + | tmp.IsMoneyTransfer + | + |UNION ALL + | + |SELECT + | VALUE(AccumulationRecordType.Expense), + | tmp.Company AS Company, + | tmp.PlaningTransactionBasis AS BasisDocument, + | tmp.FromAccount_POS AS FromAccount, + | tmp.ToAccount_POS AS ToAccount, + | tmp.Currency AS Currency, + | tmp.Amount AS Amount, + | tmp.Period, + | tmp.Key + |FROM + | TablePaymentList AS tmp + |WHERE + | tmp.TransferFromPOS"; +EndFunction + Function R3027B_EmployeeCashAdvance() Return "SELECT | VALUE(AccumulationRecordType.Expense) AS RecordType, @@ -1092,7 +1036,11 @@ Function GetAnalytics_DR_R3010B_CR_R2020B_R2021B(Parameters) AdditionalAnalytics.Insert("Account", Parameters.ObjectData.Account); AccountingServer.SetDebitExtDimensions(Parameters, AccountingAnalytics, AdditionalAnalytics); - Credit = AccountingServer.GetT9012S_AccountsPartner(AccountParameters, Parameters.RowData.Partner, Parameters.RowData.Agreement); + Credit = AccountingServer.GetT9012S_AccountsPartner(AccountParameters, + Parameters.RowData.Partner, + Parameters.RowData.Agreement, + Parameters.ObjectData.Currency); + IsAdvance = AccountingServer.IsAdvance(Parameters.RowData); If IsAdvance Then If ValueIsFilled(Credit.AccountAdvancesCustomer) Then @@ -1114,7 +1062,11 @@ Function GetAnalytics_DR_R2021B_CR_R2020B(Parameters) AccountingAnalytics = AccountingServer.GetAccountingAnalyticsResult(Parameters); AccountParameters = AccountingServer.GetAccountParameters(Parameters); - Accounts = AccountingServer.GetT9012S_AccountsPartner(AccountParameters, Parameters.RowData.Partner, Parameters.RowData.Agreement); + Accounts = AccountingServer.GetT9012S_AccountsPartner(AccountParameters, + Parameters.RowData.Partner, + Parameters.RowData.Agreement, + Parameters.ObjectData.Currency); + If ValueIsFilled(Accounts.AccountTransactionsCustomer) Then AccountingAnalytics.Debit = Accounts.AccountTransactionsCustomer; EndIf; diff --git a/IRP/src/Documents/CashPayment/ManagerModule.bsl b/IRP/src/Documents/CashPayment/ManagerModule.bsl index 932f3cb1dd..ad947b3fb7 100644 --- a/IRP/src/Documents/CashPayment/ManagerModule.bsl +++ b/IRP/src/Documents/CashPayment/ManagerModule.bsl @@ -9,151 +9,17 @@ EndFunction #Region Posting Function PostingGetDocumentDataTables(Ref, Cancel, PostingMode, Parameters, AddInfo = Undefined) Export - AccReg = Metadata.AccumulationRegisters; - Tables = New Structure; - Tables.Insert("CashInTransit", PostingServer.CreateTable(AccReg.CashInTransit)); - - QueryPaymentList = New Query; - QueryPaymentList.Text = GetQueryTextCashPaymentPaymentList(); - QueryPaymentList.SetParameter("Ref", Ref); - QueryResultsPaymentList = QueryPaymentList.Execute(); - QueryTablePaymentList = QueryResultsPaymentList.Unload(); - - Query = New Query; - Query.Text = GetQueryTextQueryTable(); - Query.SetParameter("QueryTable", QueryTablePaymentList); - QueryResults = Query.ExecuteBatch(); - - Tables.CashInTransit = QueryResults[1].Unload(); - QueryArray = GetQueryTextsSecondaryTables(); PostingServer.ExecuteQuery(Ref, QueryArray, Parameters); AccountingServer.CreateAccountingDataTables(Ref, Cancel, PostingMode, Parameters, AddInfo); - - Return Tables; -EndFunction -Function GetQueryTextCashPaymentPaymentList() - Return "SELECT - | CashPaymentPaymentList.Ref.Company AS Company, - | CashPaymentPaymentList.Ref.Currency AS Currency, - | CashPaymentPaymentList.Ref.CashAccount AS CashAccount, - | CASE - | WHEN CashPaymentPaymentList.Agreement.ApArPostingDetail = VALUE(Enum.ApArPostingDetail.ByDocuments) - | THEN CASE - | WHEN VALUETYPE(CashPaymentPaymentList.PlaningTransactionBasis) = TYPE(Document.CashTransferOrder) - | AND - | NOT CashPaymentPaymentList.PlaningTransactionBasis.Date IS NULL - | AND - | CashPaymentPaymentList.PlaningTransactionBasis.SendCurrency <> CashPaymentPaymentList.PlaningTransactionBasis.ReceiveCurrency - | THEN CashPaymentPaymentList.PlaningTransactionBasis - | ELSE CashPaymentPaymentList.BasisDocument - | END - | ELSE UNDEFINED - | END AS BasisDocument, - | CASE - | WHEN CashPaymentPaymentList.Agreement = VALUE(Catalog.Agreements.EmptyRef) - | THEN TRUE - | ELSE FALSE - | END - | AND - | NOT CASE - | WHEN VALUETYPE(CashPaymentPaymentList.PlaningTransactionBasis) = TYPE(Document.CashTransferOrder) - | AND - | NOT CashPaymentPaymentList.PlaningTransactionBasis.Date IS NULL - | AND - | CashPaymentPaymentList.PlaningTransactionBasis.SendCurrency <> CashPaymentPaymentList.PlaningTransactionBasis.ReceiveCurrency - | THEN TRUE - | ELSE FALSE - | END AS IsAdvance, - | CashPaymentPaymentList.PlaningTransactionBasis AS PlaningTransactionBasis, - | CASE - | WHEN CashPaymentPaymentList.Agreement.Kind = VALUE(Enum.AgreementKinds.Regular) - | AND CashPaymentPaymentList.Agreement.ApArPostingDetail = VALUE(Enum.ApArPostingDetail.ByStandardAgreement) - | THEN CashPaymentPaymentList.Agreement.StandardAgreement - | ELSE CashPaymentPaymentList.Agreement - | END AS Agreement, - | CashPaymentPaymentList.Partner AS Partner, - | CashPaymentPaymentList.Payee AS Payee, - | CashPaymentPaymentList.Ref.Date AS Period, - | CashPaymentPaymentList.TotalAmount AS Amount, - | CASE - | WHEN VALUETYPE(CashPaymentPaymentList.PlaningTransactionBasis) = TYPE(Document.CashTransferOrder) - | AND - | NOT CashPaymentPaymentList.PlaningTransactionBasis.Date IS NULL - | AND - | CashPaymentPaymentList.PlaningTransactionBasis.SendCurrency = CashPaymentPaymentList.PlaningTransactionBasis.ReceiveCurrency - | THEN TRUE - | ELSE FALSE - | END AS IsMoneyTransfer, - | CASE - | WHEN VALUETYPE(CashPaymentPaymentList.PlaningTransactionBasis) = TYPE(Document.CashTransferOrder) - | AND - | NOT CashPaymentPaymentList.PlaningTransactionBasis.Date IS NULL - | AND - | CashPaymentPaymentList.PlaningTransactionBasis.SendCurrency <> CashPaymentPaymentList.PlaningTransactionBasis.ReceiveCurrency - | THEN TRUE - | ELSE FALSE - | END AS IsMoneyExchange, - | CashPaymentPaymentList.PlaningTransactionBasis.Sender AS FromAccount, - | CashPaymentPaymentList.PlaningTransactionBasis.Receiver AS ToAccount, - | CashPaymentPaymentList.Ref AS PaymentDocument, - | CashPaymentPaymentList.Key AS Key, - | CashPaymentPaymentList.Ref.Branch AS Branch - |FROM - | Document.CashPayment.PaymentList AS CashPaymentPaymentList - |WHERE - | CashPaymentPaymentList.Ref = &Ref"; -EndFunction + Tables = New Structure; -Function GetQueryTextQueryTable() - Return "SELECT - | QueryTable.Company AS Company, - | QueryTable.Currency AS Currency, - | QueryTable.CashAccount AS CashAccount, - | QueryTable.BasisDocument AS BasisDocument, - | QueryTable.IsAdvance AS IsAdvance, - | QueryTable.PlaningTransactionBasis AS PlaningTransactionBasis, - | QueryTable.Agreement AS Agreement, - | QueryTable.Partner AS Partner, - | QueryTable.Payee AS Payee, - | QueryTable.Period AS Period, - | QueryTable.Amount AS Amount, - | QueryTable.IsMoneyTransfer AS IsMoneyTransfer, - | QueryTable.IsMoneyExchange AS IsMoneyExchange, - | QueryTable.FromAccount AS FromAccount, - | QueryTable.ToAccount AS ToAccount, - | QueryTable.PaymentDocument AS PaymentDocument, - | QueryTable.Key AS Key, - | QueryTable.Branch AS Branch - |INTO tmp - |FROM - | &QueryTable AS QueryTable - |; - | - |//[1]////////////////////////////////////////////////////////////////////////////// - |SELECT - | tmp.Company AS Company, - | tmp.PlaningTransactionBasis AS BasisDocument, - | tmp.FromAccount AS FromAccount, - | tmp.ToAccount AS ToAccount, - | tmp.Currency AS Currency, - | SUM(tmp.Amount) AS Amount, - | tmp.Period, - | tmp.Key - |FROM - | tmp AS tmp - |WHERE - | tmp.IsMoneyTransfer - |GROUP BY - | tmp.Company, - | tmp.PlaningTransactionBasis, - | tmp.FromAccount, - | tmp.ToAccount, - | tmp.Currency, - | tmp.Period, - | tmp.Key"; + CashInTransit = Metadata.AccumulationRegisters.CashInTransit; + Tables.Insert(CashInTransit.Name, CommonFunctionsServer.CreateTable(CashInTransit)); + + Return Tables; EndFunction Function PostingGetLockDataSource(Ref, Cancel, PostingMode, Parameters, AddInfo = Undefined) Export @@ -185,11 +51,11 @@ EndProcedure Function PostingGetPostingDataTables(Ref, Cancel, PostingMode, Parameters, AddInfo = Undefined) Export PostingDataTables = New Map; - - // CashInIransit - PostingDataTables.Insert(Parameters.Object.RegisterRecords.CashInTransit, New Structure("RecordType, RecordSet", AccumulationRecordType.Receipt, Parameters.DocumentDataTables.CashInTransit)); - PostingServer.SetPostingDataTables(PostingDataTables, Parameters); + + CashInTransit = Metadata.AccumulationRegisters.CashInTransit; + PostingServer.SetPostingDataTable(PostingDataTables, Parameters, CashInTransit.Name, Parameters.DocumentDataTables[CashInTransit.Name]); + Return PostingDataTables; EndFunction @@ -243,6 +109,7 @@ EndFunction Function GetQueryTextsMasterTables() QueryArray = New Array; + QueryArray.Add(CashInTransit()); QueryArray.Add(R1020B_AdvancesToVendors()); QueryArray.Add(R1021B_VendorsTransactions()); QueryArray.Add(R2020B_AdvancesFromCustomers()); @@ -347,6 +214,101 @@ EndFunction #Region Posting_MainTables +Function CashInTransit() + Return "SELECT + | CashPaymentPaymentList.Ref.Company AS Company, + | CashPaymentPaymentList.Ref.Currency AS Currency, + | CashPaymentPaymentList.Ref.CashAccount AS CashAccount, + | CASE + | WHEN CashPaymentPaymentList.Agreement.ApArPostingDetail = VALUE(Enum.ApArPostingDetail.ByDocuments) + | THEN CASE + | WHEN VALUETYPE(CashPaymentPaymentList.PlaningTransactionBasis) = TYPE(Document.CashTransferOrder) + | AND NOT CashPaymentPaymentList.PlaningTransactionBasis.Date IS NULL + | AND + | CashPaymentPaymentList.PlaningTransactionBasis.SendCurrency <> CashPaymentPaymentList.PlaningTransactionBasis.ReceiveCurrency + | THEN CashPaymentPaymentList.PlaningTransactionBasis + | ELSE CashPaymentPaymentList.BasisDocument + | END + | ELSE UNDEFINED + | END AS BasisDocument, + | CASE + | WHEN CashPaymentPaymentList.Agreement = VALUE(Catalog.Agreements.EmptyRef) + | THEN TRUE + | ELSE FALSE + | END + | AND NOT CASE + | WHEN VALUETYPE(CashPaymentPaymentList.PlaningTransactionBasis) = TYPE(Document.CashTransferOrder) + | AND NOT CashPaymentPaymentList.PlaningTransactionBasis.Date IS NULL + | AND + | CashPaymentPaymentList.PlaningTransactionBasis.SendCurrency <> CashPaymentPaymentList.PlaningTransactionBasis.ReceiveCurrency + | THEN TRUE + | ELSE FALSE + | END AS IsAdvance, + | CashPaymentPaymentList.PlaningTransactionBasis AS PlaningTransactionBasis, + | CASE + | WHEN CashPaymentPaymentList.Agreement.Kind = VALUE(Enum.AgreementKinds.Regular) + | AND CashPaymentPaymentList.Agreement.ApArPostingDetail = VALUE(Enum.ApArPostingDetail.ByStandardAgreement) + | THEN CashPaymentPaymentList.Agreement.StandardAgreement + | ELSE CashPaymentPaymentList.Agreement + | END AS Agreement, + | CashPaymentPaymentList.Partner AS Partner, + | CashPaymentPaymentList.Payee AS Payee, + | CashPaymentPaymentList.Ref.Date AS Period, + | CashPaymentPaymentList.TotalAmount AS Amount, + | CASE + | WHEN VALUETYPE(CashPaymentPaymentList.PlaningTransactionBasis) = TYPE(Document.CashTransferOrder) + | AND NOT CashPaymentPaymentList.PlaningTransactionBasis.Date IS NULL + | AND + | CashPaymentPaymentList.PlaningTransactionBasis.SendCurrency = CashPaymentPaymentList.PlaningTransactionBasis.ReceiveCurrency + | THEN TRUE + | ELSE FALSE + | END AS IsMoneyTransfer, + | CASE + | WHEN VALUETYPE(CashPaymentPaymentList.PlaningTransactionBasis) = TYPE(Document.CashTransferOrder) + | AND NOT CashPaymentPaymentList.PlaningTransactionBasis.Date IS NULL + | AND + | CashPaymentPaymentList.PlaningTransactionBasis.SendCurrency <> CashPaymentPaymentList.PlaningTransactionBasis.ReceiveCurrency + | THEN TRUE + | ELSE FALSE + | END AS IsMoneyExchange, + | CashPaymentPaymentList.PlaningTransactionBasis.Sender AS FromAccount, + | CashPaymentPaymentList.PlaningTransactionBasis.Receiver AS ToAccount, + | CashPaymentPaymentList.Ref AS PaymentDocument, + | CashPaymentPaymentList.Key AS Key, + | CashPaymentPaymentList.Ref.Branch AS Branch + |INTO TablePaymentList + |FROM + | Document.CashPayment.PaymentList AS CashPaymentPaymentList + |WHERE + | CashPaymentPaymentList.Ref = &Ref + |; + | + |//////////////////////////////////////////////////////////////////////////////// + |SELECT + | VALUE(AccumulationRecordType.Receipt) AS RecordType, + | tmp.Company AS Company, + | tmp.PlaningTransactionBasis AS BasisDocument, + | tmp.FromAccount AS FromAccount, + | tmp.ToAccount AS ToAccount, + | tmp.Currency AS Currency, + | SUM(tmp.Amount) AS Amount, + | tmp.Period, + | tmp.Key + |INTO CashInTransit + |FROM + | TablePaymentList AS tmp + |WHERE + | tmp.IsMoneyTransfer + |GROUP BY + | tmp.Company, + | tmp.PlaningTransactionBasis, + | tmp.FromAccount, + | tmp.ToAccount, + | tmp.Currency, + | tmp.Period, + | tmp.Key"; +EndFunction + Function R3021B_CashInTransitIncoming() Return "SELECT @@ -868,7 +830,11 @@ Function GetAnalytics_PaymentToVendor(Parameters) AccountingAnalytics = AccountingServer.GetAccountingAnalyticsResult(Parameters); AccountParameters = AccountingServer.GetAccountParameters(Parameters); - Debit = AccountingServer.GetT9012S_AccountsPartner(AccountParameters, Parameters.RowData.Partner, Parameters.RowData.Agreement); + Debit = AccountingServer.GetT9012S_AccountsPartner(AccountParameters, + Parameters.RowData.Partner, + Parameters.RowData.Agreement, + Parameters.ObjectData.Currency); + IsAdvance = AccountingServer.IsAdvance(Parameters.RowData); If IsAdvance Then If ValueIsFilled(Debit.AccountAdvancesVendor) Then @@ -898,7 +864,11 @@ Function GetAnalytics_OffsetOfAdvances(Parameters) AccountingAnalytics = AccountingServer.GetAccountingAnalyticsResult(Parameters); AccountParameters = AccountingServer.GetAccountParameters(Parameters); - Accounts = AccountingServer.GetT9012S_AccountsPartner(AccountParameters, Parameters.RowData.Partner, Parameters.RowData.Agreement); + Accounts = AccountingServer.GetT9012S_AccountsPartner(AccountParameters, + Parameters.RowData.Partner, + Parameters.RowData.Agreement, + Parameters.ObjectData.Currency); + If ValueIsFilled(Accounts.AccountTransactionsVendor) Then AccountingAnalytics.Debit = Accounts.AccountTransactionsVendor; EndIf; diff --git a/IRP/src/Documents/CashReceipt/ManagerModule.bsl b/IRP/src/Documents/CashReceipt/ManagerModule.bsl index de6392034f..1b8b963336 100644 --- a/IRP/src/Documents/CashReceipt/ManagerModule.bsl +++ b/IRP/src/Documents/CashReceipt/ManagerModule.bsl @@ -9,155 +9,17 @@ EndFunction #Region Posting Function PostingGetDocumentDataTables(Ref, Cancel, PostingMode, Parameters, AddInfo = Undefined) Export - AccReg = Metadata.AccumulationRegisters; - Tables = New Structure; - Tables.Insert("CashInTransit", PostingServer.CreateTable(AccReg.CashInTransit)); - - QueryPaymentList = New Query; - QueryPaymentList.Text = GetQueryTextCashReceiptPaymentList(); - QueryPaymentList.SetParameter("Ref", Ref); - QueryResultsPaymentList = QueryPaymentList.Execute(); - QueryTablePaymentList = QueryResultsPaymentList.Unload(); - - Query = New Query; - Query.Text = GetQueryTextQueryTable(); - Query.SetParameter("QueryTable", QueryTablePaymentList); - QueryResults = Query.ExecuteBatch(); - - Tables.CashInTransit = QueryResults[1].Unload(); - QueryArray = GetQueryTextsSecondaryTables(); PostingServer.ExecuteQuery(Ref, QueryArray, Parameters); AccountingServer.CreateAccountingDataTables(Ref, Cancel, PostingMode, Parameters, AddInfo); - - Return Tables; -EndFunction -Function GetQueryTextCashReceiptPaymentList() - Return "SELECT - | CashReceiptPaymentList.Ref.Company AS Company, - | CashReceiptPaymentList.Ref.Currency AS Currency, - | CashReceiptPaymentList.Ref.CurrencyExchange AS CurrencyExchange, - | CashReceiptPaymentList.Ref.CashAccount AS CashAccount, - | CASE - | WHEN CashReceiptPaymentList.Agreement.ApArPostingDetail = VALUE(Enum.ApArPostingDetail.ByDocuments) - | THEN CASE - | WHEN VALUETYPE(CashReceiptPaymentList.PlaningTransactionBasis) = TYPE(Document.CashTransferOrder) - | AND - | NOT CashReceiptPaymentList.PlaningTransactionBasis.Date IS NULL - | AND - | CashReceiptPaymentList.PlaningTransactionBasis.SendCurrency <> CashReceiptPaymentList.PlaningTransactionBasis.ReceiveCurrency - | THEN CashReceiptPaymentList.PlaningTransactionBasis - | ELSE CashReceiptPaymentList.BasisDocument - | END - | ELSE UNDEFINED - | END AS BasisDocument, - | CASE - | WHEN CashReceiptPaymentList.Agreement = VALUE(Catalog.Agreements.EmptyRef) - | THEN TRUE - | ELSE FALSE - | END - | AND - | NOT CASE - | WHEN VALUETYPE(CashReceiptPaymentList.PlaningTransactionBasis) = TYPE(Document.CashTransferOrder) - | AND - | NOT CashReceiptPaymentList.PlaningTransactionBasis.Date IS NULL - | AND - | CashReceiptPaymentList.PlaningTransactionBasis.SendCurrency <> CashReceiptPaymentList.PlaningTransactionBasis.ReceiveCurrency - | THEN TRUE - | ELSE FALSE - | END AS IsAdvance, - | CashReceiptPaymentList.PlaningTransactionBasis AS PlaningTransactionBasis, - | CASE - | WHEN CashReceiptPaymentList.Agreement.Kind = VALUE(Enum.AgreementKinds.Regular) - | AND CashReceiptPaymentList.Agreement.ApArPostingDetail = VALUE(Enum.ApArPostingDetail.ByStandardAgreement) - | THEN CashReceiptPaymentList.Agreement.StandardAgreement - | ELSE CashReceiptPaymentList.Agreement - | END AS Agreement, - | CashReceiptPaymentList.Partner AS Partner, - | CashReceiptPaymentList.Payer AS Payer, - | CashReceiptPaymentList.Ref.Date AS Period, - | CashReceiptPaymentList.TotalAmount AS Amount, - | CashReceiptPaymentList.AmountExchange AS AmountExchange, - | CASE - | WHEN VALUETYPE(CashReceiptPaymentList.PlaningTransactionBasis) = TYPE(Document.CashTransferOrder) - | AND - | NOT CashReceiptPaymentList.PlaningTransactionBasis.Date IS NULL - | AND - | CashReceiptPaymentList.PlaningTransactionBasis.SendCurrency = CashReceiptPaymentList.PlaningTransactionBasis.ReceiveCurrency - | THEN TRUE - | ELSE FALSE - | END AS IsMoneyTransfer, - | CASE - | WHEN VALUETYPE(CashReceiptPaymentList.PlaningTransactionBasis) = TYPE(Document.CashTransferOrder) - | AND - | NOT CashReceiptPaymentList.PlaningTransactionBasis.Date IS NULL - | AND - | CashReceiptPaymentList.PlaningTransactionBasis.SendCurrency <> CashReceiptPaymentList.PlaningTransactionBasis.ReceiveCurrency - | THEN TRUE - | ELSE FALSE - | END AS IsMoneyExchange, - | CashReceiptPaymentList.PlaningTransactionBasis.Sender AS FromAccount, - | CashReceiptPaymentList.PlaningTransactionBasis.Receiver AS ToAccount, - | CashReceiptPaymentList.Ref AS ReceiptDocument, - | CashReceiptPaymentList.Key AS Key, - | CashReceiptPaymentList.Ref.Branch AS Branch - |FROM - | Document.CashReceipt.PaymentList AS CashReceiptPaymentList - |WHERE - | CashReceiptPaymentList.Ref = &Ref"; -EndFunction + Tables = New Structure; -Function GetQueryTextQueryTable() - Return "SELECT - | QueryTable.Company AS Company, - | QueryTable.Currency AS Currency, - | QueryTable.CurrencyExchange AS CurrencyExchange, - | QueryTable.CashAccount AS CashAccount, - | QueryTable.BasisDocument AS BasisDocument, - | QueryTable.IsAdvance AS IsAdvance, - | QueryTable.PlaningTransactionBasis AS PlaningTransactionBasis, - | QueryTable.Agreement AS Agreement, - | QueryTable.Partner AS Partner, - | QueryTable.Payer AS Payer, - | QueryTable.Period AS Period, - | QueryTable.Amount AS Amount, - | QueryTable.AmountExchange AS AmountExchange, - | QueryTable.IsMoneyTransfer AS IsMoneyTransfer, - | QueryTable.IsMoneyExchange AS IsMoneyExchange, - | QueryTable.FromAccount AS FromAccount, - | QueryTable.ToAccount AS ToAccount, - | QueryTable.ReceiptDocument, - | QueryTable.Key AS Key, - | QueryTable.Branch AS Branch - |INTO tmp - |FROM - | &QueryTable AS QueryTable - |; - | - |//[1]////////////////////////////////////////////////////////////////////////////// - |SELECT - | tmp.Company AS Company, - | tmp.PlaningTransactionBasis AS BasisDocument, - | tmp.FromAccount AS FromAccount, - | tmp.ToAccount AS ToAccount, - | tmp.Currency AS Currency, - | SUM(tmp.Amount) AS Amount, - | tmp.Period, - | tmp.Key - |FROM - | tmp AS tmp - |WHERE - | tmp.IsMoneyTransfer - |GROUP BY - | tmp.Company, - | tmp.PlaningTransactionBasis, - | tmp.FromAccount, - | tmp.ToAccount, - | tmp.Currency, - | tmp.Period, - | tmp.Key"; + CashInTransit = Metadata.AccumulationRegisters.CashInTransit; + Tables.Insert(CashInTransit.Name, CommonFunctionsServer.CreateTable(CashInTransit)); + + Return Tables; EndFunction Function PostingGetLockDataSource(Ref, Cancel, PostingMode, Parameters, AddInfo = Undefined) Export @@ -188,11 +50,11 @@ EndProcedure Function PostingGetPostingDataTables(Ref, Cancel, PostingMode, Parameters, AddInfo = Undefined) Export PostingDataTables = New Map; - - // CashInIransit - PostingDataTables.Insert(Parameters.Object.RegisterRecords.CashInTransit, New Structure("RecordType, RecordSet", AccumulationRecordType.Expense, Parameters.DocumentDataTables.CashInTransit)); - PostingServer.SetPostingDataTables(PostingDataTables, Parameters); + + CashInTransit = Metadata.AccumulationRegisters.CashInTransit; + PostingServer.SetPostingDataTable(PostingDataTables, Parameters, CashInTransit.Name, Parameters.DocumentDataTables[CashInTransit.Name]); + Return PostingDataTables; EndFunction @@ -246,6 +108,7 @@ EndFunction Function GetQueryTextsMasterTables() QueryArray = New Array; + QueryArray.Add(CashInTransit()); QueryArray.Add(R1020B_AdvancesToVendors()); QueryArray.Add(R1021B_VendorsTransactions()); QueryArray.Add(R2020B_AdvancesFromCustomers()); @@ -346,6 +209,104 @@ EndFunction #Region Posting_MainTables + +Function CashInTransit() + Return "SELECT + | CashReceiptPaymentList.Ref.Company AS Company, + | CashReceiptPaymentList.Ref.Currency AS Currency, + | CashReceiptPaymentList.Ref.CurrencyExchange AS CurrencyExchange, + | CashReceiptPaymentList.Ref.CashAccount AS CashAccount, + | CASE + | WHEN CashReceiptPaymentList.Agreement.ApArPostingDetail = VALUE(Enum.ApArPostingDetail.ByDocuments) + | THEN CASE + | WHEN VALUETYPE(CashReceiptPaymentList.PlaningTransactionBasis) = TYPE(Document.CashTransferOrder) + | AND NOT CashReceiptPaymentList.PlaningTransactionBasis.Date IS NULL + | AND + | CashReceiptPaymentList.PlaningTransactionBasis.SendCurrency <> CashReceiptPaymentList.PlaningTransactionBasis.ReceiveCurrency + | THEN CashReceiptPaymentList.PlaningTransactionBasis + | ELSE CashReceiptPaymentList.BasisDocument + | END + | ELSE UNDEFINED + | END AS BasisDocument, + | CASE + | WHEN CashReceiptPaymentList.Agreement = VALUE(Catalog.Agreements.EmptyRef) + | THEN TRUE + | ELSE FALSE + | END + | AND NOT CASE + | WHEN VALUETYPE(CashReceiptPaymentList.PlaningTransactionBasis) = TYPE(Document.CashTransferOrder) + | AND NOT CashReceiptPaymentList.PlaningTransactionBasis.Date IS NULL + | AND + | CashReceiptPaymentList.PlaningTransactionBasis.SendCurrency <> CashReceiptPaymentList.PlaningTransactionBasis.ReceiveCurrency + | THEN TRUE + | ELSE FALSE + | END AS IsAdvance, + | CashReceiptPaymentList.PlaningTransactionBasis AS PlaningTransactionBasis, + | CASE + | WHEN CashReceiptPaymentList.Agreement.Kind = VALUE(Enum.AgreementKinds.Regular) + | AND CashReceiptPaymentList.Agreement.ApArPostingDetail = VALUE(Enum.ApArPostingDetail.ByStandardAgreement) + | THEN CashReceiptPaymentList.Agreement.StandardAgreement + | ELSE CashReceiptPaymentList.Agreement + | END AS Agreement, + | CashReceiptPaymentList.Partner AS Partner, + | CashReceiptPaymentList.Payer AS Payer, + | CashReceiptPaymentList.Ref.Date AS Period, + | CashReceiptPaymentList.TotalAmount AS Amount, + | CashReceiptPaymentList.AmountExchange AS AmountExchange, + | CASE + | WHEN VALUETYPE(CashReceiptPaymentList.PlaningTransactionBasis) = TYPE(Document.CashTransferOrder) + | AND NOT CashReceiptPaymentList.PlaningTransactionBasis.Date IS NULL + | AND + | CashReceiptPaymentList.PlaningTransactionBasis.SendCurrency = CashReceiptPaymentList.PlaningTransactionBasis.ReceiveCurrency + | THEN TRUE + | ELSE FALSE + | END AS IsMoneyTransfer, + | CASE + | WHEN VALUETYPE(CashReceiptPaymentList.PlaningTransactionBasis) = TYPE(Document.CashTransferOrder) + | AND NOT CashReceiptPaymentList.PlaningTransactionBasis.Date IS NULL + | AND + | CashReceiptPaymentList.PlaningTransactionBasis.SendCurrency <> CashReceiptPaymentList.PlaningTransactionBasis.ReceiveCurrency + | THEN TRUE + | ELSE FALSE + | END AS IsMoneyExchange, + | CashReceiptPaymentList.PlaningTransactionBasis.Sender AS FromAccount, + | CashReceiptPaymentList.PlaningTransactionBasis.Receiver AS ToAccount, + | CashReceiptPaymentList.Ref AS ReceiptDocument, + | CashReceiptPaymentList.Key AS Key, + | CashReceiptPaymentList.Ref.Branch AS Branch + |INTO TablePaymentList + |FROM + | Document.CashReceipt.PaymentList AS CashReceiptPaymentList + |WHERE + | CashReceiptPaymentList.Ref = &Ref + |; + | + |//////////////////////////////////////////////////////////////////////////////// + |SELECT + | VALUE(AccumulationRecordType.Expense) AS RecordType, + | tmp.Company AS Company, + | tmp.PlaningTransactionBasis AS BasisDocument, + | tmp.FromAccount AS FromAccount, + | tmp.ToAccount AS ToAccount, + | tmp.Currency AS Currency, + | SUM(tmp.Amount) AS Amount, + | tmp.Period, + | tmp.Key + |INTO CashInTransit + |FROM + | TablePaymentList AS tmp + |WHERE + | tmp.IsMoneyTransfer + |GROUP BY + | tmp.Company, + | tmp.PlaningTransactionBasis, + | tmp.FromAccount, + | tmp.ToAccount, + | tmp.Currency, + | tmp.Period, + | tmp.Key"; +EndFunction + Function R3027B_EmployeeCashAdvance() Return "SELECT | VALUE(AccumulationRecordType.Expense) AS RecordType, @@ -893,7 +854,11 @@ Function GetAnalytics_DR_R3010B_CR_R2020B_R2021B(Parameters) AdditionalAnalytics.Insert("Account", Parameters.ObjectData.CashAccount); AccountingServer.SetDebitExtDimensions(Parameters, AccountingAnalytics, AdditionalAnalytics); - Credit = AccountingServer.GetT9012S_AccountsPartner(AccountParameters, Parameters.RowData.Partner, Parameters.RowData.Agreement); + Credit = AccountingServer.GetT9012S_AccountsPartner(AccountParameters, + Parameters.RowData.Partner, + Parameters.RowData.Agreement, + Parameters.ObjectData.Currency); + IsAdvance = AccountingServer.IsAdvance(Parameters.RowData); If IsAdvance Then If ValueIsFilled(Credit.AccountAdvancesCustomer) Then @@ -915,7 +880,11 @@ Function GetAnalytics_DR_R2021B_CR_R2020B(Parameters) AccountingAnalytics = AccountingServer.GetAccountingAnalyticsResult(Parameters); AccountParameters = AccountingServer.GetAccountParameters(Parameters); - Accounts = AccountingServer.GetT9012S_AccountsPartner(AccountParameters, Parameters.RowData.Partner, Parameters.RowData.Agreement); + Accounts = AccountingServer.GetT9012S_AccountsPartner(AccountParameters, + Parameters.RowData.Partner, + Parameters.RowData.Agreement, + Parameters.ObjectData.Currency); + If ValueIsFilled(Accounts.AccountTransactionsCustomer) Then AccountingAnalytics.Debit = Accounts.AccountTransactionsCustomer; EndIf; diff --git a/IRP/src/Documents/CashStatement/ManagerModule.bsl b/IRP/src/Documents/CashStatement/ManagerModule.bsl index 341127bb1a..7047e7bb35 100644 --- a/IRP/src/Documents/CashStatement/ManagerModule.bsl +++ b/IRP/src/Documents/CashStatement/ManagerModule.bsl @@ -9,42 +9,17 @@ EndFunction #Region Posting Function PostingGetDocumentDataTables(Ref, Cancel, PostingMode, Parameters, AddInfo = Undefined) Export + QueryArray = GetQueryTextsSecondaryTables(); + PostingServer.ExecuteQuery(Ref, QueryArray, Parameters); - AccReg = Metadata.AccumulationRegisters; Tables = New Structure; - Tables.Insert("CashInTransit", PostingServer.CreateTable(AccReg.CashInTransit)); - - Query_CashInTransit = New Query; - Query_CashInTransit.Text = GetQueryText_CashStatement_CashInTransit(); - Query_CashInTransit.SetParameter("Ref", Ref); - QueryResult_CashInTransit = Query_CashInTransit.Execute(); - CashInTransit = QueryResult_CashInTransit.Unload(); - - Tables.CashInTransit = CashInTransit; - QueryArray = GetQueryTextsSecondaryTables(); - PostingServer.ExecuteQuery(Ref, QueryArray, Parameters); + CashInTransit = Metadata.AccumulationRegisters.CashInTransit; + Tables.Insert(CashInTransit.Name, CommonFunctionsServer.CreateTable(CashInTransit)); Return Tables; EndFunction -Function GetQueryText_CashStatement_CashInTransit() - Return "SELECT - | Table.Ref.Company AS Company, - | Table.Ref AS BasisDocument, - | Table.Account AS FromAccount, - | Table.ReceiptingAccount AS ToAccount, - | Table.Currency AS Currency, - | Table.Amount AS Amount, - | Table.Ref.Date AS Period, - | Table.Key - |FROM - | Document.CashStatement.PaymentList AS Table - |WHERE - | Table.Ref = &Ref - | AND Table.Account.Type = VALUE(Enum.CashAccountTypes.POS)"; -EndFunction - Function PostingGetLockDataSource(Ref, Cancel, PostingMode, Parameters, AddInfo = Undefined) Export DataMapWithLockFields = New Map; Return DataMapWithLockFields; @@ -59,19 +34,18 @@ Procedure PostingCheckBeforeWrite(Ref, Cancel, PostingMode, Parameters, AddInfo Tables.R3035T_CashPlanning.Columns.Add("Key", Metadata.DefinedTypes.typeRowID.Type); Tables.R3021B_CashInTransitIncoming.Columns.Add("Key", Metadata.DefinedTypes.typeRowID.Type); Tables.R3011T_CashFlow.Columns.Add("Key", Metadata.DefinedTypes.typeRowID.Type); + Tables.CashInTransit.Columns.Add("Key", Metadata.DefinedTypes.typeRowID.Type); PostingServer.FillPostingTables(Tables, Ref, QueryArray, Parameters); EndProcedure Function PostingGetPostingDataTables(Ref, Cancel, PostingMode, Parameters, AddInfo = Undefined) Export PostingDataTables = New Map; - - // CashInTransit - PostingDataTables.Insert(Parameters.Object.RegisterRecords.CashInTransit, - New Structure("RecordType, RecordSet", AccumulationRecordType.Receipt, Parameters.DocumentDataTables.CashInTransit)); - PostingServer.SetPostingDataTables(PostingDataTables, Parameters); - + + CashInTransit = Metadata.AccumulationRegisters.CashInTransit; + PostingServer.SetPostingDataTable(PostingDataTables, Parameters, CashInTransit.Name, Parameters.DocumentDataTables[CashInTransit.Name]); + Return PostingDataTables; EndFunction @@ -125,6 +99,7 @@ EndFunction Function GetQueryTextsMasterTables() QueryArray = New Array; + QueryArray.Add(CashInTransit()); QueryArray.Add(R3010B_CashOnHand()); QueryArray.Add(R3011T_CashFlow()); QueryArray.Add(R3021B_CashInTransitIncoming()); @@ -166,6 +141,25 @@ EndFunction #Region Posting_MainTables +Function CashInTransit() + Return "SELECT + | VALUE(AccumulationRecordType.Receipt) AS RecordType, + | Table.Ref.Company AS Company, + | Table.Ref AS BasisDocument, + | Table.Account AS FromAccount, + | Table.ReceiptingAccount AS ToAccount, + | Table.Currency AS Currency, + | Table.Amount AS Amount, + | Table.Ref.Date AS Period, + | Table.Key + |INTO CashInTransit + |FROM + | Document.CashStatement.PaymentList AS Table + |WHERE + | Table.Ref = &Ref + | AND Table.Account.Type = VALUE(Enum.CashAccountTypes.POS)"; +EndFunction + Function R3010B_CashOnHand() Return "SELECT | VALUE(AccumulationRecordType.Expense) AS RecordType, diff --git a/IRP/src/Documents/CommissioningOfFixedAsset/ManagerModule.bsl b/IRP/src/Documents/CommissioningOfFixedAsset/ManagerModule.bsl index 4c9974b0b0..9fb1133272 100644 --- a/IRP/src/Documents/CommissioningOfFixedAsset/ManagerModule.bsl +++ b/IRP/src/Documents/CommissioningOfFixedAsset/ManagerModule.bsl @@ -15,7 +15,7 @@ Function PostingGetDocumentDataTables(Ref, Cancel, PostingMode, Parameters, AddI QueryArray = GetQueryTextsSecondaryTables(); PostingServer.ExecuteQuery(Ref, QueryArray, Parameters); - CurrenciesServer.ExcludePostingDataTable(Parameters, Parameters.Object.RegisterRecords.T6020S_BatchKeysInfo.Metadata()); + CurrenciesServer.ExcludePostingDataTable(Parameters, Metadata.InformationRegisters.T6020S_BatchKeysInfo); Return Tables; EndFunction diff --git a/IRP/src/Documents/CreditNote/ManagerModule.bsl b/IRP/src/Documents/CreditNote/ManagerModule.bsl index cab8e06ae5..dbb2d51aa0 100644 --- a/IRP/src/Documents/CreditNote/ManagerModule.bsl +++ b/IRP/src/Documents/CreditNote/ManagerModule.bsl @@ -541,7 +541,11 @@ Function GetAnalytics_CustomerAdvancesExpenses(Parameters) AccountingAnalytics = AccountingServer.GetAccountingAnalyticsResult(Parameters); AccountParameters = AccountingServer.GetAccountParameters(Parameters); - Debit = AccountingServer.GetT9012S_AccountsPartner(AccountParameters, Parameters.RowData.Partner, Parameters.RowData.Agreement); + Debit = AccountingServer.GetT9012S_AccountsPartner(AccountParameters, + Parameters.RowData.Partner, + Parameters.RowData.Agreement, + Parameters.RowData.Currency); + AccountingAnalytics.Debit = Debit.AccountAdvancesCustomer; // Debit - Analytics AccountingServer.SetDebitExtDimensions(Parameters, AccountingAnalytics); @@ -561,7 +565,11 @@ Function GetAnalytics_OffsetOfAdvancesCustomer(Parameters) AccountingAnalytics = AccountingServer.GetAccountingAnalyticsResult(Parameters); AccountParameters = AccountingServer.GetAccountParameters(Parameters); - Accounts = AccountingServer.GetT9012S_AccountsPartner(AccountParameters, Parameters.RowData.Partner, Parameters.RowData.Agreement); + Accounts = AccountingServer.GetT9012S_AccountsPartner(AccountParameters, + Parameters.RowData.Partner, + Parameters.RowData.Agreement, + Parameters.RowData.Currency); + If ValueIsFilled(Accounts.AccountTransactionsCustomer) Then AccountingAnalytics.Debit = Accounts.AccountTransactionsCustomer; EndIf; @@ -582,7 +590,11 @@ Function GetAnalytics_VendorTransactionExpenses(Parameters) AccountingAnalytics = AccountingServer.GetAccountingAnalyticsResult(Parameters); AccountParameters = AccountingServer.GetAccountParameters(Parameters); - Debit = AccountingServer.GetT9012S_AccountsPartner(AccountParameters, Parameters.RowData.Partner, Parameters.RowData.Agreement); + Debit = AccountingServer.GetT9012S_AccountsPartner(AccountParameters, + Parameters.RowData.Partner, + Parameters.RowData.Agreement, + Parameters.RowData.Currency); + If ValueIsFilled(Debit.AccountTransactionsVendor) Then AccountingAnalytics.Debit = Debit.AccountTransactionsVendor; EndIf; diff --git a/IRP/src/Documents/DebitNote/ManagerModule.bsl b/IRP/src/Documents/DebitNote/ManagerModule.bsl index 49310e60c6..0e95d15293 100644 --- a/IRP/src/Documents/DebitNote/ManagerModule.bsl +++ b/IRP/src/Documents/DebitNote/ManagerModule.bsl @@ -540,7 +540,11 @@ Function GetAnalytics_VendorAdvancesRevenues(Parameters) AccountingAnalytics = AccountingServer.GetAccountingAnalyticsResult(Parameters); AccountParameters = AccountingServer.GetAccountParameters(Parameters); - Debit = AccountingServer.GetT9012S_AccountsPartner(AccountParameters, Parameters.RowData.Partner, Parameters.RowData.Agreement); + Debit = AccountingServer.GetT9012S_AccountsPartner(AccountParameters, + Parameters.RowData.Partner, + Parameters.RowData.Agreement, + Parameters.RowData.Currency); + AccountingAnalytics.Debit = Debit.AccountAdvancesVendor; // Debit - Analytics AccountingServer.SetDebitExtDimensions(Parameters, AccountingAnalytics); @@ -560,7 +564,11 @@ Function GetAnalytics_OffsetOfAdvancesVendor(Parameters) AccountingAnalytics = AccountingServer.GetAccountingAnalyticsResult(Parameters); AccountParameters = AccountingServer.GetAccountParameters(Parameters); - Accounts = AccountingServer.GetT9012S_AccountsPartner(AccountParameters, Parameters.RowData.Partner, Parameters.RowData.Agreement); + Accounts = AccountingServer.GetT9012S_AccountsPartner(AccountParameters, + Parameters.RowData.Partner, + Parameters.RowData.Agreement, + Parameters.RowData.Currency); + If ValueIsFilled(Accounts.AccountTransactionsVendor) Then AccountingAnalytics.Debit = Accounts.AccountTransactionsVendor; EndIf; @@ -581,7 +589,11 @@ Function GetAnalytics_CustomerTransactionRevenues(Parameters) AccountingAnalytics = AccountingServer.GetAccountingAnalyticsResult(Parameters); AccountParameters = AccountingServer.GetAccountParameters(Parameters); - Debit = AccountingServer.GetT9012S_AccountsPartner(AccountParameters, Parameters.RowData.Partner, Parameters.RowData.Agreement); + Debit = AccountingServer.GetT9012S_AccountsPartner(AccountParameters, + Parameters.RowData.Partner, + Parameters.RowData.Agreement, + Parameters.RowData.Currency); + If ValueIsFilled(Debit.AccountTransactionsCustomer) Then AccountingAnalytics.Debit = Debit.AccountTransactionsCustomer; EndIf; diff --git a/IRP/src/Documents/DecommissioningOfFixedAsset/ManagerModule.bsl b/IRP/src/Documents/DecommissioningOfFixedAsset/ManagerModule.bsl index 2cbdb542ac..9cfa2e14f9 100644 --- a/IRP/src/Documents/DecommissioningOfFixedAsset/ManagerModule.bsl +++ b/IRP/src/Documents/DecommissioningOfFixedAsset/ManagerModule.bsl @@ -16,7 +16,7 @@ Function PostingGetDocumentDataTables(Ref, Cancel, PostingMode, Parameters, AddI Parameters.Insert("QueryParameters", GetAdditionalQueryParameters(Ref)); PostingServer.ExecuteQuery(Ref, QueryArray, Parameters); - CurrenciesServer.ExcludePostingDataTable(Parameters, Parameters.Object.RegisterRecords.T6020S_BatchKeysInfo.Metadata()); + CurrenciesServer.ExcludePostingDataTable(Parameters, Metadata.InformationRegisters.T6020S_BatchKeysInfo); Return Tables; EndFunction diff --git a/IRP/src/Documents/ForeignCurrencyRevaluation/ManagerModule.bsl b/IRP/src/Documents/ForeignCurrencyRevaluation/ManagerModule.bsl index 6db10172c2..cc9e635b64 100644 --- a/IRP/src/Documents/ForeignCurrencyRevaluation/ManagerModule.bsl +++ b/IRP/src/Documents/ForeignCurrencyRevaluation/ManagerModule.bsl @@ -409,8 +409,8 @@ Function PostingGetDocumentDataTables(Ref, Cancel, PostingMode, Parameters, AddI Query.SetParameter("ExpensesTable", ExpenseRevenueInfo.ExpensesTable); Query.Execute(); - CurrenciesServer.ExcludePostingDataTable(Parameters, Parameters.Object.RegisterRecords.R5022T_Expenses.Metadata()); - CurrenciesServer.ExcludePostingDataTable(Parameters, Parameters.Object.RegisterRecords.R5021T_Revenues.Metadata()); + CurrenciesServer.ExcludePostingDataTable(Parameters, Metadata.AccumulationRegisters.R5022T_Expenses); + CurrenciesServer.ExcludePostingDataTable(Parameters, Metadata.AccumulationRegisters.R5021T_Revenues); // Accounting @@ -488,7 +488,11 @@ Function GetAnalytics_DR_R5022T_Expenses_CR_R2020B_AdvancesFromCustomers(Paramet AccountingServer.SetDebitExtDimensions(Parameters, AccountingAnalytics, AdditionalAnalytics); // Credit - Credit = AccountingServer.GetT9012S_AccountsPartner(AccountParameters, Parameters.RowData.Partner, Undefined); + Credit = AccountingServer.GetT9012S_AccountsPartner(AccountParameters, + Parameters.RowData.Partner, + Undefined, + Parameters.RowData.Currency); + If ValueIsFilled(Credit.AccountAdvancesCustomer) Then AccountingAnalytics.Credit = Credit.AccountAdvancesCustomer; EndIf; diff --git a/IRP/src/Documents/JournalEntry/Forms/DocumentForm/Form.form b/IRP/src/Documents/JournalEntry/Forms/DocumentForm/Form.form index ab5d5b7c53..7640aa6d68 100644 --- a/IRP/src/Documents/JournalEntry/Forms/DocumentForm/Form.form +++ b/IRP/src/Documents/JournalEntry/Forms/DocumentForm/Form.form @@ -2738,6 +2738,9 @@ <showInHeader>true</showInHeader> <headerHorizontalAlign>Left</headerHorizontalAlign> <showInFooter>true</showInFooter> + <footerDataPath xsi:type="form:DataPath"> + <segments>Object.Totals.TotalAmountCr</segments> + </footerDataPath> <extInfo xsi:type="form:InputFieldExtInfo"> <autoMaxWidth>true</autoMaxWidth> <autoMaxHeight>true</autoMaxHeight> @@ -2788,6 +2791,9 @@ <showInHeader>true</showInHeader> <headerHorizontalAlign>Left</headerHorizontalAlign> <showInFooter>true</showInFooter> + <footerDataPath xsi:type="form:DataPath"> + <segments>Object.Totals.TotalAmountCr</segments> + </footerDataPath> <extInfo xsi:type="form:InputFieldExtInfo"> <autoMaxWidth>true</autoMaxWidth> <autoMaxHeight>true</autoMaxHeight> @@ -2957,6 +2963,7 @@ <selectionMode>MultiRow</selectionMode> <header>true</header> <headerHeight>1</headerHeight> + <footer>true</footer> <footerHeight>1</footerHeight> <horizontalScrollBar>AutoUse</horizontalScrollBar> <verticalScrollBar>AutoUse</verticalScrollBar> diff --git a/IRP/src/Documents/ModernizationOfFixedAsset/ManagerModule.bsl b/IRP/src/Documents/ModernizationOfFixedAsset/ManagerModule.bsl index acb8e57001..e8008c1482 100644 --- a/IRP/src/Documents/ModernizationOfFixedAsset/ManagerModule.bsl +++ b/IRP/src/Documents/ModernizationOfFixedAsset/ManagerModule.bsl @@ -15,7 +15,7 @@ Function PostingGetDocumentDataTables(Ref, Cancel, PostingMode, Parameters, AddI QueryArray = GetQueryTextsSecondaryTables(); PostingServer.ExecuteQuery(Ref, QueryArray, Parameters); - CurrenciesServer.ExcludePostingDataTable(Parameters, Parameters.Object.RegisterRecords.T6020S_BatchKeysInfo.Metadata()); + CurrenciesServer.ExcludePostingDataTable(Parameters, Metadata.InformationRegisters.T6020S_BatchKeysInfo); Return Tables; EndFunction diff --git a/IRP/src/Documents/OpeningEntry/ManagerModule.bsl b/IRP/src/Documents/OpeningEntry/ManagerModule.bsl index e6dbb67c32..ca3d693fc8 100644 --- a/IRP/src/Documents/OpeningEntry/ManagerModule.bsl +++ b/IRP/src/Documents/OpeningEntry/ManagerModule.bsl @@ -12,6 +12,59 @@ Function PostingGetDocumentDataTables(Ref, Cancel, PostingMode, Parameters, AddI QueryArray = GetQueryTextsSecondaryTables(); PostingServer.ExecuteQuery(Ref, QueryArray, Parameters); + Calculate_BatchKeysInfo(Ref, Parameters, AddInfo); + + Tables = New Structure; + + CashInTransit = Metadata.AccumulationRegisters.CashInTransit; + Tables.Insert(CashInTransit.Name, CommonFunctionsServer.CreateTable(CashInTransit)); + + Return Tables; +EndFunction + +Function PostingGetLockDataSource(Ref, Cancel, PostingMode, Parameters, AddInfo = Undefined) Export + DataMapWithLockFields = New Map; + Return DataMapWithLockFields; +EndFunction + +Procedure PostingCheckBeforeWrite(Ref, Cancel, PostingMode, Parameters, AddInfo = Undefined) Export + Tables = Parameters.DocumentDataTables; + QueryArray = GetQueryTextsMasterTables(); + PostingServer.SetRegisters(Tables, Ref); + + + Tables.R3010B_CashOnHand.Columns.Add("Key", Metadata.DefinedTypes.typeRowID.Type); + Tables.R1020B_AdvancesToVendors.Columns.Add("Key", Metadata.DefinedTypes.typeRowID.Type); + Tables.R1021B_VendorsTransactions.Columns.Add("Key", Metadata.DefinedTypes.typeRowID.Type); + Tables.R2020B_AdvancesFromCustomers.Columns.Add("Key", Metadata.DefinedTypes.typeRowID.Type); + Tables.R2021B_CustomersTransactions.Columns.Add("Key", Metadata.DefinedTypes.typeRowID.Type); + Tables.R8015T_ConsignorPrices.Columns.Add("Key", Metadata.DefinedTypes.typeRowID.Type); + Tables.R3027B_EmployeeCashAdvance.Columns.Add("Key", Metadata.DefinedTypes.typeRowID.Type); + Tables.R9510B_SalaryPayment.Columns.Add("Key", Metadata.DefinedTypes.typeRowID.Type); + Tables.R5015B_OtherPartnersTransactions.Columns.Add("Key", Metadata.DefinedTypes.typeRowID.Type); + Tables.R3021B_CashInTransitIncoming.Columns.Add("Key", Metadata.DefinedTypes.typeRowID.Type); + Tables.R8510B_BookValueOfFixedAsset.Columns.Add("Key", Metadata.DefinedTypes.typeRowID.Type); + Tables.CashInTransit.Columns.Add("Key", Metadata.DefinedTypes.typeRowID.Type); + + PostingServer.FillPostingTables(Tables, Ref, QueryArray, Parameters); +EndProcedure + +Function PostingGetPostingDataTables(Ref, Cancel, PostingMode, Parameters, AddInfo = Undefined) Export + PostingDataTables = New Map; + PostingServer.SetPostingDataTables(PostingDataTables, Parameters); + + CashInTransit = Metadata.AccumulationRegisters.CashInTransit; + PostingServer.SetPostingDataTable(PostingDataTables, Parameters, CashInTransit.Name, Parameters.DocumentDataTables[CashInTransit.Name]); + + Return PostingDataTables; +EndFunction + +Procedure PostingCheckAfterWrite(Ref, Cancel, PostingMode, Parameters, AddInfo = Undefined) Export + CheckAfterWrite(Ref, Cancel, Parameters, AddInfo); +EndProcedure + +Procedure Calculate_BatchKeysInfo(Ref, Parameters, AddInfo) + Query = New Query; Query.Text = "SELECT @@ -63,108 +116,29 @@ Function PostingGetDocumentDataTables(Ref, Cancel, PostingMode, Parameters, AddI QueryResult = Query.Execute(); BatchKeysInfo = QueryResult.Unload(); - CurrencyTable = Ref.Currencies.UnloadColumns(); CurrencyMovementType = Ref.Company.LandedCostCurrencyMovementType; For Each Row In BatchKeysInfo Do CurrenciesServer.AddRowToCurrencyTable(Ref.Date, CurrencyTable, Row.Key, Row.Currency, CurrencyMovementType); EndDo; - - PostingDataTables = New Map; - PostingDataTables.Insert(Parameters.Object.RegisterRecords.T6020S_BatchKeysInfo, - New Structure("RecordSet, WriteInTransaction", BatchKeysInfo, Parameters.IsReposting)); - Parameters.Insert("PostingDataTables", PostingDataTables); + + T6020S_BatchKeysInfo = Metadata.InformationRegisters.T6020S_BatchKeysInfo; + T6020SSettings = PostingServer.PostingTableSettings(T6020S_BatchKeysInfo.Name, BatchKeysInfo, Parameters.Object.RegisterRecords.T6020S_BatchKeysInfo); + T6020SSettings.WriteInTransaction = Parameters.IsReposting; + Parameters.PostingDataTables.Insert(T6020S_BatchKeysInfo, T6020SSettings); + CurrenciesServer.PreparePostingDataTables(Parameters, CurrencyTable, AddInfo); - - CurrenciesServer.ExcludePostingDataTable(Parameters, Parameters.Object.RegisterRecords.T6020S_BatchKeysInfo.Metadata()); + CurrenciesServer.ExcludePostingDataTable(Parameters, T6020S_BatchKeysInfo); - BatchKeysInfo_DataTable = Parameters.PostingDataTables.Get( - Parameters.Object.RegisterRecords.T6020S_BatchKeysInfo).RecordSet; - BatchKeysInfo_DataTableGrouped = BatchKeysInfo_DataTable.CopyColumns(); - If BatchKeysInfo_DataTable.Count() Then - BatchKeysInfo_DataTableGrouped = BatchKeysInfo_DataTable.Copy( - New Structure("CurrencyMovementType", CurrencyMovementType)); - BatchKeysInfo_DataTableGrouped.GroupBy( - "Period, Direction, Company, Store, ItemKey, Currency, CurrencyMovementType, SerialLotNumber, SourceOfOrigin", - "Quantity, Amount, AmountTax"); - EndIf; - - Query = New Query; - Query.TempTablesManager = Parameters.TempTablesManager; - Query.Text = - "SELECT - | * - |INTO BatchKeysInfo - |FROM - | &T1 AS T1"; - Query.SetParameter("T1", BatchKeysInfo_DataTableGrouped); - Query.Execute(); - - AccReg = Metadata.AccumulationRegisters; - Tables = New Structure; - Tables.Insert("RegCashInTransit", PostingServer.CreateTable(AccReg.CashInTransit)); - - Query = New Query(); - Query.Text = - "SELECT - | VALUE(AccumulationRecordType.Receipt) AS RecordType, - | OpeningEntryCashInTransit.Ref.Date AS Period, - | OpeningEntryCashInTransit.Ref.Company, - | OpeningEntryCashInTransit.Account AS FromAccount, - | OpeningEntryCashInTransit.ReceiptingAccount AS ToAccount, - | OpeningEntryCashInTransit.Currency, - | OpeningEntryCashInTransit.Amount, - | OpeningEntryCashInTransit.Key - |FROM - | Document.OpeningEntry.CashInTransit AS OpeningEntryCashInTransit - |WHERE - | OpeningEntryCashInTransit.Ref = &Ref"; - Query.SetParameter("Ref", Ref); - QueryResult = Query.Execute(); - QueryTable = QueryResult.Unload(); - Tables.RegCashInTransit = QueryTable; - - Return Tables; -EndFunction - -Function PostingGetLockDataSource(Ref, Cancel, PostingMode, Parameters, AddInfo = Undefined) Export - DataMapWithLockFields = New Map; - Return DataMapWithLockFields; -EndFunction - -Procedure PostingCheckBeforeWrite(Ref, Cancel, PostingMode, Parameters, AddInfo = Undefined) Export - Tables = Parameters.DocumentDataTables; - QueryArray = GetQueryTextsMasterTables(); - PostingServer.SetRegisters(Tables, Ref); - - Tables.R3010B_CashOnHand.Columns.Add("Key", Metadata.DefinedTypes.typeRowID.Type); - Tables.R1020B_AdvancesToVendors.Columns.Add("Key", Metadata.DefinedTypes.typeRowID.Type); - Tables.R1021B_VendorsTransactions.Columns.Add("Key", Metadata.DefinedTypes.typeRowID.Type); - Tables.R2020B_AdvancesFromCustomers.Columns.Add("Key", Metadata.DefinedTypes.typeRowID.Type); - Tables.R2021B_CustomersTransactions.Columns.Add("Key", Metadata.DefinedTypes.typeRowID.Type); - Tables.R8015T_ConsignorPrices.Columns.Add("Key", Metadata.DefinedTypes.typeRowID.Type); - Tables.R3027B_EmployeeCashAdvance.Columns.Add("Key", Metadata.DefinedTypes.typeRowID.Type); - Tables.R9510B_SalaryPayment.Columns.Add("Key", Metadata.DefinedTypes.typeRowID.Type); - Tables.R5015B_OtherPartnersTransactions.Columns.Add("Key", Metadata.DefinedTypes.typeRowID.Type); - Tables.R3021B_CashInTransitIncoming.Columns.Add("Key", Metadata.DefinedTypes.typeRowID.Type); - Tables.R8510B_BookValueOfFixedAsset.Columns.Add("Key", Metadata.DefinedTypes.typeRowID.Type); - - PostingServer.FillPostingTables(Tables, Ref, QueryArray, Parameters); -EndProcedure - -Function PostingGetPostingDataTables(Ref, Cancel, PostingMode, Parameters, AddInfo = Undefined) Export - PostingDataTables = New Map; + BatchKeysInfo_DataTable = Parameters.PostingDataTables[T6020S_BatchKeysInfo].PrepareTable; - // CashInIransit - PostingDataTables.Insert(Parameters.Object.RegisterRecords.CashInTransit, - New Structure("RecordType, RecordSet", AccumulationRecordType.Receipt, Parameters.DocumentDataTables.RegCashInTransit)); + BatchKeysInfoSettings = PostingServer.GetBatchKeysInfoSettings(); + BatchKeysInfoSettings.DataTable = BatchKeysInfo_DataTable; + BatchKeysInfoSettings.Dimensions = "Period, Direction, Company, Store, ItemKey, Currency, CurrencyMovementType, SerialLotNumber, SourceOfOrigin"; + BatchKeysInfoSettings.Totals = "Quantity, Amount, AmountTax"; + BatchKeysInfoSettings.CurrencyMovementType = CurrencyMovementType; - PostingServer.SetPostingDataTables(PostingDataTables, Parameters); - Return PostingDataTables; -EndFunction - -Procedure PostingCheckAfterWrite(Ref, Cancel, PostingMode, Parameters, AddInfo = Undefined) Export - CheckAfterWrite(Ref, Cancel, Parameters, AddInfo); + PostingServer.SetBatchKeyInfoTable(Parameters, BatchKeysInfoSettings); EndProcedure #EndRegion @@ -202,9 +176,16 @@ Procedure CheckAfterWrite(Ref, Cancel, Parameters, AddInfo = Undefined) CheckAfterWrite_R4010B_R4011B(Ref, Cancel, Parameters, AddInfo); - If Not Cancel And Not AccReg.R4014B_SerialLotNumber.CheckBalance(Ref, LineNumberAndItemKeyFromItemList, - PostingServer.GetQueryTableByName("R4014B_SerialLotNumber", Parameters), PostingServer.GetQueryTableByName( - "Exists_R4014B_SerialLotNumber", Parameters), AccumulationRecordType.Receipt, Unposting, AddInfo) Then + If Not Cancel + And Not AccReg.R4014B_SerialLotNumber.CheckBalance( + Ref, + LineNumberAndItemKeyFromItemList, + PostingServer.GetQueryTableByName("R4014B_SerialLotNumber", Parameters), + PostingServer.GetQueryTableByName("Exists_R4014B_SerialLotNumber", Parameters), + AccumulationRecordType.Receipt, + Unposting, + AddInfo + ) Then Cancel = True; EndIf; EndProcedure @@ -249,7 +230,7 @@ Function GetQueryTextsSecondaryTables() QueryArray.Add(SalaryPayment()); QueryArray.Add(OtherVendorsTransactions()); QueryArray.Add(OtherCustomersTransactions()); - QueryArray.Add(CashInTransit()); + QueryArray.Add(CashInTransitDoc()); QueryArray.Add(FixedAssets()); QueryArray.Add(PostingServer.Exists_R4010B_ActualStocks()); QueryArray.Add(PostingServer.Exists_R4011B_FreeStocks()); @@ -259,6 +240,7 @@ EndFunction Function GetQueryTextsMasterTables() QueryArray = New Array; + QueryArray.Add(CashInTransit()); QueryArray.Add(R1020B_AdvancesToVendors()); QueryArray.Add(R1021B_VendorsTransactions()); QueryArray.Add(R2020B_AdvancesFromCustomers()); @@ -662,21 +644,21 @@ Function SalaryPayment() | SalaryPayment.Ref = &Ref"; EndFunction -Function CashInTransit() +Function CashInTransitDoc() Return "SELECT - | CashInTransit.Key, - | CashInTransit.Ref.Date AS Period, - | CashInTransit.Ref.Company AS Company, - | CashInTransit.ReceiptingBranch AS Branch, - | CashInTransit.ReceiptingAccount, - | CashInTransit.Currency, - | CashInTransit.Amount - |INTO CashInTransit + | CashInTransitDoc.Key, + | CashInTransitDoc.Ref.Date AS Period, + | CashInTransitDoc.Ref.Company AS Company, + | CashInTransitDoc.ReceiptingBranch AS Branch, + | CashInTransitDoc.ReceiptingAccount, + | CashInTransitDoc.Currency, + | CashInTransitDoc.Amount + |INTO CashInTransitDoc |FROM - | Document.OpeningEntry.CashInTransit AS CashInTransit + | Document.OpeningEntry.CashInTransit AS CashInTransitDoc |WHERE - | CashInTransit.Ref = &Ref"; + | CashInTransitDoc.Ref = &Ref"; EndFunction Function FixedAssets() @@ -704,6 +686,24 @@ EndFunction #Region Posting_MainTables +Function CashInTransit() + Return + "SELECT + | VALUE(AccumulationRecordType.Receipt) AS RecordType, + | OpeningEntryCashInTransit.Ref.Date AS Period, + | OpeningEntryCashInTransit.Ref.Company, + | OpeningEntryCashInTransit.Account AS FromAccount, + | OpeningEntryCashInTransit.ReceiptingAccount AS ToAccount, + | OpeningEntryCashInTransit.Currency, + | OpeningEntryCashInTransit.Amount, + | OpeningEntryCashInTransit.Key + |INTO CashInTransit + |FROM + | Document.OpeningEntry.CashInTransit AS OpeningEntryCashInTransit + |WHERE + | OpeningEntryCashInTransit.Ref = &Ref"; +EndFunction + Function R1020B_AdvancesToVendors() Return "SELECT | VALUE(AccumulationRecordType.Receipt) AS RecordType, @@ -949,16 +949,16 @@ Function R3021B_CashInTransitIncoming() Return "SELECT | VALUE(AccumulationRecordType.Receipt) AS RecordType, - | CashInTransit.Key, - | CashInTransit.Period, - | CashInTransit.Company, - | CashInTransit.Branch, - | CashInTransit.ReceiptingAccount AS Account, - | CashInTransit.Currency, - | CashInTransit.Amount + | CashInTransitDoc.Key, + | CashInTransitDoc.Period, + | CashInTransitDoc.Company, + | CashInTransitDoc.Branch, + | CashInTransitDoc.ReceiptingAccount AS Account, + | CashInTransitDoc.Currency, + | CashInTransitDoc.Amount |INTO R3021B_CashInTransitIncoming |FROM - | CashInTransit AS CashInTransit + | CashInTransitDoc AS CashInTransitDoc |WHERE | TRUE"; EndFunction @@ -1209,8 +1209,7 @@ Function T6010S_BatchesInfo() EndFunction Function T6020S_BatchKeysInfo() - Return - "SELECT + Return "SELECT | ItemList.Period, | ItemList.Company, | ItemList.Store, @@ -1397,6 +1396,7 @@ Function T6020S_BatchKeysInfo() | tmp_T6020S_BatchKeysInfo AS Table |WHERE | Table.Quantity > 0" + EndFunction Function R4050B_StockInventory() diff --git a/IRP/src/Documents/ProductionPlanning/ManagerModule.bsl b/IRP/src/Documents/ProductionPlanning/ManagerModule.bsl index 227252c416..c2852429c5 100644 --- a/IRP/src/Documents/ProductionPlanning/ManagerModule.bsl +++ b/IRP/src/Documents/ProductionPlanning/ManagerModule.bsl @@ -13,7 +13,7 @@ Function PostingGetDocumentDataTables(Ref, Cancel, PostingMode, Parameters, AddI Tables = New Structure; BillOfMaterialsTable = GetBillOfMaterials(Ref); - MaterialPlanningEmptyTable = PostingServer.CreateTable(AccReg.R7020T_MaterialPlanning); + MaterialPlanningEmptyTable = CommonFunctionsServer.CreateTable(AccReg.R7020T_MaterialPlanning); MaterialPlanningEmptyTable.Columns.Add("IsProduct", New TypeDescription("Boolean")); MaterialPlanningEmptyTable.Columns.Add("IsSemiproduct", New TypeDescription("Boolean")); MaterialPlanningEmptyTable.Columns.Add("IsMaterial", New TypeDescription("Boolean")); diff --git a/IRP/src/Documents/ProductionPlanningCorrection/ManagerModule.bsl b/IRP/src/Documents/ProductionPlanningCorrection/ManagerModule.bsl index d89942357a..067e587e42 100644 --- a/IRP/src/Documents/ProductionPlanningCorrection/ManagerModule.bsl +++ b/IRP/src/Documents/ProductionPlanningCorrection/ManagerModule.bsl @@ -12,10 +12,10 @@ Function PostingGetDocumentDataTables(Ref, Cancel, PostingMode, Parameters, AddI InfoReg = Metadata.InformationRegisters; AccReg = Metadata.AccumulationRegisters; Tables = New Structure; - Tables.Insert("BillOfMaterials", PostingServer.CreateTable(InfoReg.T7010S_BillOfMaterials)); - Tables.Insert("ProductionPlanning", PostingServer.CreateTable(AccReg.R7030T_ProductionPlanning)); - Tables.Insert("MaterialPlanning", PostingServer.CreateTable(AccReg.R7020T_MaterialPlanning)); - Tables.Insert("DetailingSupplies", PostingServer.CreateTable(AccReg.R7010T_DetailingSupplies)); + Tables.Insert("BillOfMaterials", CommonFunctionsServer.CreateTable(InfoReg.T7010S_BillOfMaterials)); + Tables.Insert("ProductionPlanning", CommonFunctionsServer.CreateTable(AccReg.R7030T_ProductionPlanning)); + Tables.Insert("MaterialPlanning", CommonFunctionsServer.CreateTable(AccReg.R7020T_MaterialPlanning)); + Tables.Insert("DetailingSupplies", CommonFunctionsServer.CreateTable(AccReg.R7010T_DetailingSupplies)); ObjectStatusesServer.WriteStatusToRegister(Ref, Ref.Status, CurrentUniversalDate()); StatusInfo = ObjectStatusesServer.GetLastStatusInfo(Ref); diff --git a/IRP/src/Documents/PurchaseInvoice/ManagerModule.bsl b/IRP/src/Documents/PurchaseInvoice/ManagerModule.bsl index 128177713d..33b03b80e1 100644 --- a/IRP/src/Documents/PurchaseInvoice/ManagerModule.bsl +++ b/IRP/src/Documents/PurchaseInvoice/ManagerModule.bsl @@ -16,6 +16,42 @@ Function PostingGetDocumentDataTables(Ref, Cancel, PostingMode, Parameters, AddI PostingServer.ExecuteQuery(Ref, QueryArray, Parameters); Tables.Insert("VendorsTransactions", PostingServer.GetQueryTableByName("VendorsTransactions", Parameters)); + Calculate_BatchKeysInfo(Ref, Parameters, AddInfo); + + AccountingServer.CreateAccountingDataTables(Ref, Cancel, PostingMode, Parameters, AddInfo); + + Return Tables; +EndFunction + +Function PostingGetLockDataSource(Ref, Cancel, PostingMode, Parameters, AddInfo = Undefined) Export + DataMapWithLockFields = New Map; + Return DataMapWithLockFields; +EndFunction + +Procedure PostingCheckBeforeWrite(Ref, Cancel, PostingMode, Parameters, AddInfo = Undefined) Export + Tables = Parameters.DocumentDataTables; + + IncomingStocksServer.ClosureIncomingStocks(Parameters); + + QueryArray = GetQueryTextsMasterTables(); + PostingServer.SetRegisters(Tables, Ref); + + Tables.R8015T_ConsignorPrices.Columns.Add("Key", Metadata.DefinedTypes.typeRowID.Type); + + PostingServer.FillPostingTables(Tables, Ref, QueryArray, Parameters); +EndProcedure + +Function PostingGetPostingDataTables(Ref, Cancel, PostingMode, Parameters, AddInfo = Undefined) Export + PostingDataTables = New Map; + PostingServer.SetPostingDataTables(PostingDataTables, Parameters); + Return PostingDataTables; +EndFunction + +Procedure PostingCheckAfterWrite(Ref, Cancel, PostingMode, Parameters, AddInfo = Undefined) Export + CheckAfterWrite(Ref, Cancel, Parameters, AddInfo); +EndProcedure + +Procedure Calculate_BatchKeysInfo(Ref, Parameters, AddInfo) Query = New Query; Query.Text = "SELECT @@ -27,7 +63,6 @@ Function PostingGetDocumentDataTables(Ref, Cancel, PostingMode, Parameters, AddI | Document.PurchaseInvoice.RowIDInfo AS RowIDInfo |WHERE | RowIDInfo.Ref = &Ref - | |GROUP BY | RowIDInfo.Ref, | RowIDInfo.Key @@ -35,17 +70,6 @@ Function PostingGetDocumentDataTables(Ref, Cancel, PostingMode, Parameters, AddI | |//////////////////////////////////////////////////////////////////////////////// |SELECT - | PurchaseInvoice.Ref AS Document, - | PurchaseInvoice.Company AS Company, - | PurchaseInvoice.Ref.Date AS Period - |FROM - | Document.PurchaseInvoice AS PurchaseInvoice - |WHERE - | PurchaseInvoice.Ref = &Ref - |; - | - |//////////////////////////////////////////////////////////////////////////////// - |SELECT | SourceOfOrigins.Key AS Key, | CASE | WHEN SourceOfOrigins.SerialLotNumber.BatchBalanceDetail @@ -63,7 +87,6 @@ Function PostingGetDocumentDataTables(Ref, Cancel, PostingMode, Parameters, AddI | Document.PurchaseInvoice.SourceOfOrigins AS SourceOfOrigins |WHERE | SourceOfOrigins.Ref = &Ref - | |GROUP BY | SourceOfOrigins.Key, | CASE @@ -96,12 +119,11 @@ Function PostingGetDocumentDataTables(Ref, Cancel, PostingMode, Parameters, AddI | Document.PurchaseInvoice.ItemList AS ItemList | INNER JOIN tmpRowIDInfo AS RowIDInfo | ON ItemList.Key = RowIDInfo.Key - | AND (RowIDInfo.Ref = &Ref) + | AND RowIDInfo.Ref = &Ref |WHERE | ItemList.Ref = &Ref | AND ItemList.ItemKey.Item.ItemType.Type = VALUE(Enum.ItemTypes.Product) | AND NOT ItemList.IsAdditionalItemCost - | |GROUP BY | ItemList.ItemKey, | ItemList.Store, @@ -110,7 +132,8 @@ Function PostingGetDocumentDataTables(Ref, Cancel, PostingMode, Parameters, AddI | ItemList.Key, | ItemList.Ref.Currency, | ItemList.IsAdditionalItemCost, - | RowIDInfo.RowID + | RowIDInfo.RowID, + | VALUE(Enum.BatchDirection.Receipt) |; | |//////////////////////////////////////////////////////////////////////////////// @@ -135,33 +158,24 @@ Function PostingGetDocumentDataTables(Ref, Cancel, PostingMode, Parameters, AddI | CASE | WHEN tmpItemList.Quantity <> 0 | THEN CASE - | WHEN ISNULL(tmpSourceOfOrigins.Quantity, 0) <> 0 - | THEN tmpItemList.Amount / tmpItemList.Quantity * ISNULL(tmpSourceOfOrigins.Quantity, 0) - | ELSE tmpItemList.Amount - | END + | WHEN ISNULL(tmpSourceOfOrigins.Quantity, 0) <> 0 + | THEN tmpItemList.Amount / tmpItemList.Quantity * ISNULL(tmpSourceOfOrigins.Quantity, 0) + | ELSE tmpItemList.Amount + | END | ELSE 0 | END AS Amount, | ISNULL(tmpSourceOfOrigins.SourceOfOrigin, VALUE(Catalog.SourceOfOrigins.EmptyRef)) AS SourceOfOrigin, - | ISNULL(tmpSourceOfOrigins.SerialLotNumber, VALUE(Catalog.SerialLotNumbers.EmptyRef)) AS SerialLotNumber + | ISNULL(tmpSourceOfOrigins.SerialLotNumber, VALUE(Catalog.SerialLotNumbers.EmptyRef)) AS SerialLotNumber, + | TRUE AS CreateBatch + |INTO BatchKeysInfo |FROM | tmpItemList AS tmpItemList | LEFT JOIN tmpSourceOfOrigins AS tmpSourceOfOrigins - | ON tmpItemList.Key = tmpSourceOfOrigins.Key"; - Query.SetParameter("Ref", Ref); - - QueryResults = Query.ExecuteBatch(); - - BatchesInfo = QueryResults[1].Unload(); - BatchKeysInfo = QueryResults[4].Unload(); - - If Not BatchKeysInfo.Count() Then - BatchesInfo.Clear(); - EndIf; - - // AmountTax to T6020S_BatchKeysInfo - Query = New Query; - Query.Text = - "SELECT + | ON tmpItemList.Key = tmpSourceOfOrigins.Key + |; + | + |//////////////////////////////////////////////////////////////////////////////// + |SELECT | Taxes.Key, | Taxes.Ref.Company AS Company, | &Vat AS Tax, @@ -199,17 +213,6 @@ Function PostingGetDocumentDataTables(Ref, Cancel, PostingMode, Parameters, AddI |//////////////////////////////////////////////////////////////////////////////// |SELECT | BatchKeysInfo.Key, - | BatchKeysInfo.TotalQuantity, - | BatchKeysInfo.Quantity, - | * - |INTO BatchKeysInfo - |FROM - | &BatchKeysInfo AS BatchKeysInfo - |; - | - |//////////////////////////////////////////////////////////////////////////////// - |SELECT - | BatchKeysInfo.Key, | case | when BatchKeysInfo.TotalQuantity <> 0 | then (isnull(TaxesAmounts.AmountTax, 0) / BatchKeysInfo.TotalQuantity) * BatchKeysInfo.Quantity @@ -219,14 +222,31 @@ Function PostingGetDocumentDataTables(Ref, Cancel, PostingMode, Parameters, AddI |FROM | BatchKeysInfo AS BatchKeysInfo | LEFT JOIN TaxesAmounts AS TaxesAmounts - | ON BatchKeysInfo.Key = TaxesAmounts.Key"; + | ON BatchKeysInfo.Key = TaxesAmounts.Key + |; + | + |//////////////////////////////////////////////////////////////////////////////// + |SELECT + | PurchaseInvoice.Ref AS Document, + | PurchaseInvoice.Company AS Company, + | PurchaseInvoice.Ref.Date AS Period + |FROM + | Document.PurchaseInvoice AS PurchaseInvoice + |WHERE + | PurchaseInvoice.Ref = &Ref + | AND TRUE IN + | (SELECT + | CreateBatch + | FROM + | BatchKeysInfo)"; Query.SetParameter("Ref", Ref); Query.SetParameter("Period", Ref.Date); - Query.SetParameter("BatchKeysInfo", BatchKeysInfo); Query.SetParameter("Vat", TaxesServer.GetVatRef()); - QueryResult = Query.Execute(); - BatchKeysInfo = QueryResult.Unload(); + + QueryResults = Query.ExecuteBatch(); + BatchKeysInfo = QueryResults[6].Unload(); + BatchesInfo = QueryResults[7].Unload(); CurrencyTable = Ref.Currencies.UnloadColumns(); CurrencyMovementType = Ref.Company.LandedCostCurrencyMovementType; @@ -245,76 +265,35 @@ Function PostingGetDocumentDataTables(Ref, Cancel, PostingMode, Parameters, AddI ArrayOfFixedRates); EndDo; - PostingDataTables = New Map; - PostingDataTables.Insert(Parameters.Object.RegisterRecords.T6020S_BatchKeysInfo, - New Structure("RecordSet, WriteInTransaction", BatchKeysInfo, Parameters.IsReposting)); - Parameters.Insert("PostingDataTables", PostingDataTables); + T6020S_BatchKeysInfo = Metadata.InformationRegisters.T6020S_BatchKeysInfo; + T6020SSettings = PostingServer.PostingTableSettings(T6020S_BatchKeysInfo.Name, BatchKeysInfo, Parameters.Object.RegisterRecords.T6020S_BatchKeysInfo); + T6020SSettings.WriteInTransaction = Parameters.IsReposting; + Parameters.PostingDataTables.Insert(T6020S_BatchKeysInfo, T6020SSettings); + CurrenciesServer.PreparePostingDataTables(Parameters, CurrencyTable, AddInfo); - - CurrenciesServer.ExcludePostingDataTable(Parameters, Parameters.Object.RegisterRecords.T6020S_BatchKeysInfo.Metadata()); + CurrenciesServer.ExcludePostingDataTable(Parameters, T6020S_BatchKeysInfo); + + BatchKeysInfo_DataTable = Parameters.PostingDataTables[T6020S_BatchKeysInfo].PrepareTable; + + BatchKeysInfoSettings = PostingServer.GetBatchKeysInfoSettings(); + BatchKeysInfoSettings.DataTable = BatchKeysInfo_DataTable; + BatchKeysInfoSettings.Dimensions = "Period, RowID, Direction, Company, Store, ItemKey, Currency, CurrencyMovementType, SourceOfOrigin, SerialLotNumber"; + BatchKeysInfoSettings.Totals = "Quantity, Amount, AmountTax"; + BatchKeysInfoSettings.CurrencyMovementType = CurrencyMovementType; + + PostingServer.SetBatchKeyInfoTable(Parameters, BatchKeysInfoSettings); - BatchKeysInfo_DataTable = Parameters.PostingDataTables.Get( - Parameters.Object.RegisterRecords.T6020S_BatchKeysInfo).RecordSet; - BatchKeysInfo_DataTableGrouped = BatchKeysInfo_DataTable.CopyColumns(); - If BatchKeysInfo_DataTable.Count() Then - BatchKeysInfo_DataTableGrouped = BatchKeysInfo_DataTable.Copy( - New Structure("CurrencyMovementType", CurrencyMovementType)); - BatchKeysInfo_DataTableGrouped.GroupBy( - "Period, RowID, Direction, Company, Store, ItemKey, Currency, CurrencyMovementType, SourceOfOrigin, SerialLotNumber", - "Quantity, Amount, AmountTax"); - EndIf; - Query = New Query; Query.TempTablesManager = Parameters.TempTablesManager; Query.Text = "SELECT - | * + | BatchesInfo.* |INTO BatchesInfo |FROM - | &T1 AS T1 - |; - | - |//////////////////////////////////////////////////////////////////////////////// - |SELECT - | * - |INTO BatchKeysInfo - |FROM - | &T2 AS T2"; - Query.SetParameter("T1", BatchesInfo); - Query.SetParameter("T2", BatchKeysInfo_DataTableGrouped); - Query.Execute(); - - AccountingServer.CreateAccountingDataTables(Ref, Cancel, PostingMode, Parameters, AddInfo); - - Return Tables; -EndFunction - -Function PostingGetLockDataSource(Ref, Cancel, PostingMode, Parameters, AddInfo = Undefined) Export - DataMapWithLockFields = New Map; - Return DataMapWithLockFields; -EndFunction - -Procedure PostingCheckBeforeWrite(Ref, Cancel, PostingMode, Parameters, AddInfo = Undefined) Export - Tables = Parameters.DocumentDataTables; - - IncomingStocksServer.ClosureIncomingStocks(Parameters); - - QueryArray = GetQueryTextsMasterTables(); - PostingServer.SetRegisters(Tables, Ref); - - Tables.R8015T_ConsignorPrices.Columns.Add("Key", Metadata.DefinedTypes.typeRowID.Type); - - PostingServer.FillPostingTables(Tables, Ref, QueryArray, Parameters); -EndProcedure - -Function PostingGetPostingDataTables(Ref, Cancel, PostingMode, Parameters, AddInfo = Undefined) Export - PostingDataTables = New Map; - PostingServer.SetPostingDataTables(PostingDataTables, Parameters); - Return PostingDataTables; -EndFunction - -Procedure PostingCheckAfterWrite(Ref, Cancel, PostingMode, Parameters, AddInfo = Undefined) Export - CheckAfterWrite(Ref, Cancel, Parameters, AddInfo); + | &BatchesInfo AS BatchesInfo"; + + Query.SetParameter("BatchesInfo", BatchesInfo); + Query.Execute(); EndProcedure #EndRegion @@ -1541,8 +1520,11 @@ Function GetAnalytics_ReceiptInventory(Parameters) AccountingServer.SetDebitExtDimensions(Parameters, AccountingAnalytics, AdditionalAnalytics); // Credit - Credit = AccountingServer.GetT9012S_AccountsPartner(AccountParameters, Parameters.ObjectData.Partner, - Parameters.ObjectData.Agreement); + Credit = AccountingServer.GetT9012S_AccountsPartner(AccountParameters, + Parameters.ObjectData.Partner, + Parameters.ObjectData.Agreement, + Parameters.ObjectData.Currency); + If ValueIsFilled(Credit.AccountTransactionsVendor) Then AccountingAnalytics.Credit = Credit.AccountTransactionsVendor; EndIf; @@ -1557,8 +1539,11 @@ Function GetAnalytics_OffsetOfAdvances(Parameters) AccountParameters = AccountingServer.GetAccountParameters(Parameters); // Debit - Accounts = AccountingServer.GetT9012S_AccountsPartner(AccountParameters, Parameters.ObjectData.Partner, - Parameters.ObjectData.Agreement); + Accounts = AccountingServer.GetT9012S_AccountsPartner(AccountParameters, + Parameters.ObjectData.Partner, + Parameters.ObjectData.Agreement, + Parameters.ObjectData.Currency); + If ValueIsFilled(Accounts.AccountTransactionsVendor) Then AccountingAnalytics.Debit = Accounts.AccountTransactionsVendor; EndIf; @@ -1586,8 +1571,11 @@ Function GetAnalytics_VATIncoming(Parameters) AccountingServer.SetDebitExtDimensions(Parameters, AccountingAnalytics, Parameters.RowData.TaxInfo); // Credit - Credit = AccountingServer.GetT9012S_AccountsPartner(AccountParameters, Parameters.ObjectData.Partner, - Parameters.ObjectData.Agreement); + Credit = AccountingServer.GetT9012S_AccountsPartner(AccountParameters, + Parameters.ObjectData.Partner, + Parameters.ObjectData.Agreement, + Parameters.ObjectData.Currency); + If ValueIsFilled(Credit.AccountTransactionsVendor) Then AccountingAnalytics.Credit = Credit.AccountTransactionsVendor; EndIf; diff --git a/IRP/src/Documents/PurchaseReturn/ManagerModule.bsl b/IRP/src/Documents/PurchaseReturn/ManagerModule.bsl index 8555da2909..57b84c6366 100644 --- a/IRP/src/Documents/PurchaseReturn/ManagerModule.bsl +++ b/IRP/src/Documents/PurchaseReturn/ManagerModule.bsl @@ -14,7 +14,7 @@ Function PostingGetDocumentDataTables(Ref, Cancel, PostingMode, Parameters, AddI Parameters.Insert("QueryParameters", GetAdditionalQueryParameters(Ref)); PostingServer.ExecuteQuery(Ref, QueryArray, Parameters); - CurrenciesServer.ExcludePostingDataTable(Parameters, Parameters.Object.RegisterRecords.T6020S_BatchKeysInfo.Metadata()); + CurrenciesServer.ExcludePostingDataTable(Parameters, Metadata.InformationRegisters.T6020S_BatchKeysInfo); Return Tables; EndFunction diff --git a/IRP/src/Documents/RetailReturnReceipt/ManagerModule.bsl b/IRP/src/Documents/RetailReturnReceipt/ManagerModule.bsl index 03bb80dcd3..81bf1f58cd 100644 --- a/IRP/src/Documents/RetailReturnReceipt/ManagerModule.bsl +++ b/IRP/src/Documents/RetailReturnReceipt/ManagerModule.bsl @@ -9,35 +9,51 @@ EndFunction #Region Posting Function PostingGetDocumentDataTables(Ref, Cancel, PostingMode, Parameters, AddInfo = Undefined) Export - AccReg = Metadata.AccumulationRegisters; - Tables = New Structure; - Tables.Insert("CashInTransit", PostingServer.CreateTable(AccReg.CashInTransit)); - QueryPayments = New Query; - QueryPayments.Text = - "SELECT - | Payments.Ref.Date AS Period, - | Payments.Ref.Company AS Company, - | Payments.Ref.Currency AS Currency, - | Payments.Account AS FromAccount, - | Payments.Ref AS BasisDocument, - | Payments.Amount, - | Payments.Commission - | - |FROM - | Document.RetailReturnReceipt.Payments AS Payments - |WHERE - | Payments.Ref = &Ref AND Payments.PostponedPayment"; - QueryPayments.SetParameter("Ref", Ref); - Tables.CashInTransit = QueryPayments.Execute().Unload(); - - Parameters.IsReposting = False; - QueryArray = GetQueryTextsSecondaryTables(); Parameters.Insert("QueryParameters", GetAdditionalQueryParameters(Ref)); PostingServer.ExecuteQuery(Ref, QueryArray, Parameters); + Parameters.IsReposting = False; + DocumentsServer.SalesBySerialLotNumbers(Parameters); + Calculate_BatchKeysInfo(Ref, Parameters, AddInfo); + + Tables = New Structure; + + CashInTransit = Metadata.AccumulationRegisters.CashInTransit; + Tables.Insert(CashInTransit.Name, CommonFunctionsServer.CreateTable(CashInTransit)); + + Return Tables; +EndFunction + +Function PostingGetLockDataSource(Ref, Cancel, PostingMode, Parameters, AddInfo = Undefined) Export + DataMapWithLockFields = New Map; + Return DataMapWithLockFields; +EndFunction + +Procedure PostingCheckBeforeWrite(Ref, Cancel, PostingMode, Parameters, AddInfo = Undefined) Export + Tables = Parameters.DocumentDataTables; + QueryArray = GetQueryTextsMasterTables(); + PostingServer.SetRegisters(Tables, Ref); + PostingServer.FillPostingTables(Tables, Ref, QueryArray, Parameters); +EndProcedure + +Function PostingGetPostingDataTables(Ref, Cancel, PostingMode, Parameters, AddInfo = Undefined) Export + PostingDataTables = New Map; + PostingServer.SetPostingDataTables(PostingDataTables, Parameters); + + CashInTransit = Metadata.AccumulationRegisters.CashInTransit; + PostingServer.SetPostingDataTable(PostingDataTables, Parameters, CashInTransit.Name, Parameters.DocumentDataTables[CashInTransit.Name]); + + Return PostingDataTables; +EndFunction + +Procedure PostingCheckAfterWrite(Ref, Cancel, PostingMode, Parameters, AddInfo = Undefined) Export + CheckAfterWrite(Ref, Cancel, Parameters, AddInfo); +EndProcedure + +Procedure Calculate_BatchKeysInfo(Ref, Parameters, AddInfo) Query = New Query; Query.Text = "SELECT @@ -77,7 +93,7 @@ Function PostingGetDocumentDataTables(Ref, Cancel, PostingMode, Parameters, AddI |; | |//////////////////////////////////////////////////////////////////////////////// - |SELECT // --[1] + |SELECT | RetailReturnReceiptItemList.ItemKey AS ItemKey, | RetailReturnReceiptItemList.Store AS Store, | RetailReturnReceiptItemList.Ref.Company AS Company, @@ -127,17 +143,6 @@ Function PostingGetDocumentDataTables(Ref, Cancel, PostingMode, Parameters, AddI |; | |//////////////////////////////////////////////////////////////////////////////// - |SELECT // --[0] - | RetailReturnReceipt.Ref AS Document, - | RetailReturnReceipt.Company AS Company, - | RetailReturnReceipt.Ref.Date AS Period - |FROM - | Document.RetailReturnReceipt AS RetailReturnReceipt - |WHERE - | RetailReturnReceipt.Ref = &Ref - |; - | - |//////////////////////////////////////////////////////////////////////////////// |SELECT | tmpItemList.ItemKey, | tmpItemList.Store, @@ -178,59 +183,48 @@ Function PostingGetDocumentDataTables(Ref, Cancel, PostingMode, Parameters, AddI | ISNULL(tmpSourceOfOrigins.SourceOfOrigin, VALUE(Catalog.SourceOfOrigins.EmptyRef)) AS SourceOfOrigin, | ISNULL(tmpSourceOfOrigins.SerialLotNumber, VALUE(Catalog.SerialLotNumbers.EmptyRef)) AS SerialLotNumber, | ISNULL(tmpSourceOfOrigins.SourceOfOriginStock, VALUE(Catalog.SourceOfOrigins.EmptyRef)) AS SourceOfOriginStock, - | ISNULL(tmpSourceOfOrigins.SerialLotNumberStock, VALUE(Catalog.SerialLotNumbers.EmptyRef)) AS SerialLotNumberStock + | ISNULL(tmpSourceOfOrigins.SerialLotNumberStock, VALUE(Catalog.SerialLotNumbers.EmptyRef)) AS SerialLotNumberStock, + | Not tmpItemList.SalesInvoiceIsFilled OR tmpItemList.Company <> tmpItemList.SalesInvoice_Company AS CreateBatch + |INTO tmpBatchKeysInfo |FROM | tmpItemList AS tmpItemList | LEFT JOIN tmpSourceOfOrigins AS tmpSourceOfOrigins - | ON tmpItemList.Key = tmpSourceOfOrigins.Key"; - - Query.SetParameter("Ref", Ref); - QueryResults = Query.ExecuteBatch(); - - BatchesInfo = QueryResults[2].Unload(); - BatchKeysInfo = QueryResults[3].Unload(); - - DontCreateBatch = True; - For Each BatchKey In BatchKeysInfo Do - If Not BatchKey.SalesInvoiceIsFilled Then - DontCreateBatch = False; // need create batch, invoice is empty - Break; - EndIf; - If BatchKey.Company <> BatchKey.SalesInvoice_Company Then - DontCreateBatch = False; // need create batch, company in invoice and in return not match - Break; - EndIf; - EndDo; - If DontCreateBatch Then - BatchesInfo.Clear(); - EndIf; - - // AmountTax to T6020S_BatchKeysInfo - Query = New Query; - Query.Text = - "SELECT - | BatchKeysInfo.Key, - | BatchKeysInfo.TotalQuantity, - | BatchKeysInfo.Quantity, - | * - |INTO BatchKeysInfo + | ON tmpItemList.Key = tmpSourceOfOrigins.Key + |; + | + |//////////////////////////////////////////////////////////////////////////////// + |SELECT + | Ref AS Document, + | Company AS Company, + | Ref.Date AS Period |FROM - | &BatchKeysInfo AS BatchKeysInfo + | Document.RetailReturnReceipt + |WHERE + | Ref = &Ref + | AND TRUE IN + | (SELECT + | BatchKeys.CreateBatch + | FROM + | tmpBatchKeysInfo AS BatchKeys) |; | |//////////////////////////////////////////////////////////////////////////////// |SELECT | BatchKeysInfo.Key, - | CASE WHEN NOT BatchKeysInfo.SalesInvoiceIsFilled THEN BatchKeysInfo.LandedCostTax ELSE 0 END AS AmountTax, - | + | CASE + | WHEN NOT BatchKeysInfo.SalesInvoiceIsFilled + | THEN BatchKeysInfo.LandedCostTax + | ELSE 0 + | END AS AmountTax, | BatchKeysInfo.* |FROM - | BatchKeysInfo AS BatchKeysInfo"; + | tmpBatchKeysInfo AS BatchKeysInfo"; Query.SetParameter("Ref", Ref); Query.SetParameter("Period", Ref.Date); - Query.SetParameter("BatchKeysInfo", BatchKeysInfo); - QueryResult = Query.Execute(); - BatchKeysInfo = QueryResult.Unload(); + + QueryResult = Query.ExecuteBatch(); + BatchesInfo = QueryResult[3].Unload(); + BatchKeysInfo = QueryResult[4].Unload(); CurrencyTable = Ref.Currencies.UnloadColumns(); CurrencyMovementType = Ref.Company.LandedCostCurrencyMovementType; @@ -238,75 +232,36 @@ Function PostingGetDocumentDataTables(Ref, Cancel, PostingMode, Parameters, AddI CurrenciesServer.AddRowToCurrencyTable(Ref.Date, CurrencyTable, Row.Key, Row.Currency, CurrencyMovementType); EndDo; - PostingDataTables = New Map; - PostingDataTables.Insert(Parameters.Object.RegisterRecords.T6020S_BatchKeysInfo, - New Structure("RecordSet, WriteInTransaction", BatchKeysInfo, Parameters.IsReposting)); - Parameters.Insert("PostingDataTables", PostingDataTables); + T6020S_BatchKeysInfo = Metadata.InformationRegisters.T6020S_BatchKeysInfo; + T6020SSettings = PostingServer.PostingTableSettings(T6020S_BatchKeysInfo.Name, BatchKeysInfo, Parameters.Object.RegisterRecords.T6020S_BatchKeysInfo); + T6020SSettings.WriteInTransaction = Parameters.IsReposting; + Parameters.PostingDataTables.Insert(T6020S_BatchKeysInfo, T6020SSettings); + CurrenciesServer.PreparePostingDataTables(Parameters, CurrencyTable, AddInfo); - - CurrenciesServer.ExcludePostingDataTable(Parameters, Parameters.Object.RegisterRecords.T6020S_BatchKeysInfo.Metadata()); + CurrenciesServer.ExcludePostingDataTable(Parameters, T6020S_BatchKeysInfo); + + BatchKeysInfo_DataTable = Parameters.PostingDataTables[T6020S_BatchKeysInfo].PrepareTable; + + BatchKeysInfoSettings = PostingServer.GetBatchKeysInfoSettings(); + BatchKeysInfoSettings.DataTable = BatchKeysInfo_DataTable; + BatchKeysInfoSettings.Dimensions = "Period, Direction, Company, Store, ItemKey, Currency, CurrencyMovementType, SalesInvoice, SourceOfOrigin, SerialLotNumber, SourceOfOriginStock, SerialLotNumberStock, Quantity, Amount, AmountTax"; + BatchKeysInfoSettings.Totals = ""; + BatchKeysInfoSettings.CurrencyMovementType = CurrencyMovementType; + + PostingServer.SetBatchKeyInfoTable(Parameters, BatchKeysInfoSettings); - BatchKeysInfo_DataTable = Parameters.PostingDataTables.Get( - Parameters.Object.RegisterRecords.T6020S_BatchKeysInfo).RecordSet; - BatchKeysInfo_DataTableGrouped = BatchKeysInfo_DataTable.CopyColumns(); - If BatchKeysInfo_DataTable.Count() Then - BatchKeysInfo_DataTableGrouped = BatchKeysInfo_DataTable.Copy( - New Structure("CurrencyMovementType", CurrencyMovementType)); - BatchKeysInfo_DataTableGrouped.GroupBy("Period, Direction, Company, Store, ItemKey, Currency, CurrencyMovementType, SalesInvoice, SourceOfOrigin, SerialLotNumber, SourceOfOriginStock, SerialLotNumberStock, - |Quantity, Amount, AmountTax"); - Else - BatchKeysInfo_DataTableGrouped.Columns.Add("CurrencyMovementType", New TypeDescription("ChartOfCharacteristicTypesRef.CurrencyMovementType")); - EndIf; - Query = New Query; Query.TempTablesManager = Parameters.TempTablesManager; Query.Text = "SELECT - | * + | BatchesInfo.* |INTO BatchesInfo |FROM - | &T1 AS T1 - |; - | - |//////////////////////////////////////////////////////////////////////////////// - |SELECT - | * - |INTO BatchKeysInfo - |FROM - | &T2 AS T2"; - Query.SetParameter("T1", BatchesInfo); - Query.SetParameter("T2", BatchKeysInfo_DataTableGrouped); - Query.Execute(); - - Return Tables; -EndFunction - -Function PostingGetLockDataSource(Ref, Cancel, PostingMode, Parameters, AddInfo = Undefined) Export - DataMapWithLockFields = New Map; - Return DataMapWithLockFields; -EndFunction - -Procedure PostingCheckBeforeWrite(Ref, Cancel, PostingMode, Parameters, AddInfo = Undefined) Export - Tables = Parameters.DocumentDataTables; - QueryArray = GetQueryTextsMasterTables(); - PostingServer.SetRegisters(Tables, Ref); - PostingServer.FillPostingTables(Tables, Ref, QueryArray, Parameters); -EndProcedure - -Function PostingGetPostingDataTables(Ref, Cancel, PostingMode, Parameters, AddInfo = Undefined) Export - PostingDataTables = New Map; + | &BatchesInfo AS BatchesInfo"; + + Query.SetParameter("BatchesInfo", BatchesInfo); + Query.Execute(); - // CashInTransit - PostingDataTables.Insert(Parameters.Object.RegisterRecords.CashInTransit, - New Structure("RecordType, RecordSet", AccumulationRecordType.Expense, Parameters.DocumentDataTables.CashInTransit)); - - PostingServer.SetPostingDataTables(PostingDataTables, Parameters); - - Return PostingDataTables; -EndFunction - -Procedure PostingCheckAfterWrite(Ref, Cancel, PostingMode, Parameters, AddInfo = Undefined) Export - CheckAfterWrite(Ref, Cancel, Parameters, AddInfo); EndProcedure #EndRegion @@ -390,6 +345,7 @@ EndFunction Function GetQueryTextsMasterTables() QueryArray = New Array; + QueryArray.Add(CashInTransit()); QueryArray.Add(R2001T_Sales()); QueryArray.Add(R2002T_SalesReturns()); QueryArray.Add(R2005T_SalesSpecialOffers()); @@ -736,6 +692,23 @@ EndFunction #Region Posting_MainTables +Function CashInTransit() + Return "SELECT + | VALUE(AccumulationRecordType.Expense) AS RecordType, + | Payments.Ref.Date AS Period, + | Payments.Ref.Company AS Company, + | Payments.Ref.Currency AS Currency, + | Payments.Account AS FromAccount, + | Payments.Ref AS BasisDocument, + | Payments.Amount, + | Payments.Commission + |FROM + | Document.RetailReturnReceipt.Payments AS Payments + |WHERE + | Payments.Ref = &Ref + | AND Payments.PostponedPayment"; +EndFunction + Function R9010B_SourceOfOriginStock() Return "SELECT | VALUE(AccumulationRecordType.Receipt) AS RecordType, diff --git a/IRP/src/Documents/RetailSalesReceipt/ManagerModule.bsl b/IRP/src/Documents/RetailSalesReceipt/ManagerModule.bsl index d7eb780323..b97b04bdf0 100644 --- a/IRP/src/Documents/RetailSalesReceipt/ManagerModule.bsl +++ b/IRP/src/Documents/RetailSalesReceipt/ManagerModule.bsl @@ -16,7 +16,7 @@ Function PostingGetDocumentDataTables(Ref, Cancel, PostingMode, Parameters, AddI DocumentsServer.SalesBySerialLotNumbers(Parameters); - CurrenciesServer.ExcludePostingDataTable(Parameters, Parameters.Object.RegisterRecords.T6020S_BatchKeysInfo.Metadata()); + CurrenciesServer.ExcludePostingDataTable(Parameters, Metadata.InformationRegisters.T6020S_BatchKeysInfo); AccountingServer.CreateAccountingDataTables(Ref, Cancel, PostingMode, Parameters, AddInfo); Return Tables; diff --git a/IRP/src/Documents/SalesInvoice/ManagerModule.bsl b/IRP/src/Documents/SalesInvoice/ManagerModule.bsl index 96be3c14cf..fffdda7f64 100644 --- a/IRP/src/Documents/SalesInvoice/ManagerModule.bsl +++ b/IRP/src/Documents/SalesInvoice/ManagerModule.bsl @@ -18,7 +18,7 @@ Function PostingGetDocumentDataTables(Ref, Cancel, PostingMode, Parameters, AddI Tables.Insert("CustomersTransactions", PostingServer.GetQueryTableByName("CustomersTransactions", Parameters)); - CurrenciesServer.ExcludePostingDataTable(Parameters, Parameters.Object.RegisterRecords.T6020S_BatchKeysInfo.Metadata()); + CurrenciesServer.ExcludePostingDataTable(Parameters, Metadata.InformationRegisters.T6020S_BatchKeysInfo); AccountingServer.CreateAccountingDataTables(Ref, Cancel, PostingMode, Parameters, AddInfo); Return Tables; @@ -1371,7 +1371,11 @@ Function GetAnalytics_RevenueFromSales(Parameters) AccountParameters = AccountingServer.GetAccountParameters(Parameters); // Debit - Debit = AccountingServer.GetT9012S_AccountsPartner(AccountParameters, Parameters.ObjectData.Partner, Parameters.ObjectData.Agreement); + Debit = AccountingServer.GetT9012S_AccountsPartner(AccountParameters, + Parameters.ObjectData.Partner, + Parameters.ObjectData.Agreement, + Parameters.ObjectData.Currency); + AccountingAnalytics.Debit = Debit.AccountTransactionsCustomer; // Debit - Analytics AdditionalAnalytics = New Structure(); @@ -1413,7 +1417,11 @@ EndFunction Function GetAnalytics_OffsetOfAdvances(Parameters) AccountingAnalytics = AccountingServer.GetAccountingAnalyticsResult(Parameters); AccountParameters = AccountingServer.GetAccountParameters(Parameters); - Accounts = AccountingServer.GetT9012S_AccountsPartner(AccountParameters, Parameters.ObjectData.Partner, Parameters.ObjectData.Agreement); + + Accounts = AccountingServer.GetT9012S_AccountsPartner(AccountParameters, + Parameters.ObjectData.Partner, + Parameters.ObjectData.Agreement, + Parameters.ObjectData.Currency); // Debit If ValueIsFilled(Accounts.AccountAdvancesCustomer) Then diff --git a/IRP/src/Documents/SalesReportFromTradeAgent/ManagerModule.bsl b/IRP/src/Documents/SalesReportFromTradeAgent/ManagerModule.bsl index 7f244beabc..afb3055574 100644 --- a/IRP/src/Documents/SalesReportFromTradeAgent/ManagerModule.bsl +++ b/IRP/src/Documents/SalesReportFromTradeAgent/ManagerModule.bsl @@ -18,7 +18,7 @@ Function PostingGetDocumentDataTables(Ref, Cancel, PostingMode, Parameters, AddI Tables.Insert("CustomersTransactions", PostingServer.GetQueryTableByName("CustomersTransactions", Parameters)); - CurrenciesServer.ExcludePostingDataTable(Parameters, Parameters.Object.RegisterRecords.T6020S_BatchKeysInfo.Metadata()); + CurrenciesServer.ExcludePostingDataTable(Parameters, Metadata.InformationRegisters.T6020S_BatchKeysInfo); Return Tables; EndFunction diff --git a/IRP/src/Documents/SalesReturn/ManagerModule.bsl b/IRP/src/Documents/SalesReturn/ManagerModule.bsl index 5b7e48dbb1..410e0d5720 100644 --- a/IRP/src/Documents/SalesReturn/ManagerModule.bsl +++ b/IRP/src/Documents/SalesReturn/ManagerModule.bsl @@ -17,6 +17,34 @@ Function PostingGetDocumentDataTables(Ref, Cancel, PostingMode, Parameters, AddI DocumentsServer.SalesBySerialLotNumbers(Parameters); + Calculate_BatchKeysInfo(Ref, Parameters, AddInfo); + + Return Tables; +EndFunction + +Function PostingGetLockDataSource(Ref, Cancel, PostingMode, Parameters, AddInfo = Undefined) Export + DataMapWithLockFields = New Map; + Return DataMapWithLockFields; +EndFunction + +Procedure PostingCheckBeforeWrite(Ref, Cancel, PostingMode, Parameters, AddInfo = Undefined) Export + Tables = Parameters.DocumentDataTables; + QueryArray = GetQueryTextsMasterTables(); + PostingServer.SetRegisters(Tables, Ref); + PostingServer.FillPostingTables(Tables, Ref, QueryArray, Parameters); +EndProcedure + +Function PostingGetPostingDataTables(Ref, Cancel, PostingMode, Parameters, AddInfo = Undefined) Export + PostingDataTables = New Map; + PostingServer.SetPostingDataTables(PostingDataTables, Parameters); + Return PostingDataTables; +EndFunction + +Procedure PostingCheckAfterWrite(Ref, Cancel, PostingMode, Parameters, AddInfo = Undefined) Export + CheckAfterWrite(Ref, Cancel, Parameters, AddInfo); +EndProcedure + +Procedure Calculate_BatchKeysInfo(Ref, Parameters, AddInfo) Query = New Query; Query.Text = "SELECT @@ -111,17 +139,6 @@ Function PostingGetDocumentDataTables(Ref, Cancel, PostingMode, Parameters, AddI | |//////////////////////////////////////////////////////////////////////////////// |SELECT - | SalesReturn.Ref AS Document, - | SalesReturn.Company AS Company, - | SalesReturn.Ref.Date AS Period - |FROM - | Document.SalesReturn AS SalesReturn - |WHERE - | SalesReturn.Ref = &Ref - |; - | - |//////////////////////////////////////////////////////////////////////////////// - |SELECT | tmpItemList.ItemKey, | tmpItemList.Store, | tmpItemList.Company, @@ -161,58 +178,43 @@ Function PostingGetDocumentDataTables(Ref, Cancel, PostingMode, Parameters, AddI | ISNULL(tmpSourceOfOrigins.SourceOfOrigin, VALUE(Catalog.SourceOfOrigins.EmptyRef)) AS SourceOfOrigin, | ISNULL(tmpSourceOfOrigins.SerialLotNumber, VALUE(Catalog.SerialLotNumbers.EmptyRef)) AS SerialLotNumber, | ISNULL(tmpSourceOfOrigins.SourceOfOriginStock, VALUE(Catalog.SourceOfOrigins.EmptyRef)) AS SourceOfOriginStock, - | ISNULL(tmpSourceOfOrigins.SerialLotNumberStock, VALUE(Catalog.SerialLotNumbers.EmptyRef)) AS SerialLotNumberStock + | ISNULL(tmpSourceOfOrigins.SerialLotNumberStock, VALUE(Catalog.SerialLotNumbers.EmptyRef)) AS SerialLotNumberStock, + | Not tmpItemList.SalesInvoiceIsFilled OR tmpItemList.Company <> tmpItemList.SalesInvoice_Company AS CreateBatch + |INTO BatchKeysInfo |FROM | tmpItemList AS tmpItemList | LEFT JOIN tmpSourceOfOrigins AS tmpSourceOfOrigins - | ON tmpItemList.Key = tmpSourceOfOrigins.Key"; - - Query.SetParameter("Ref", Ref); - QueryResults = Query.ExecuteBatch(); - - BatchesInfo = QueryResults[2].Unload(); - BatchKeysInfo = QueryResults[3].Unload(); - - DontCreateBatch = True; - For Each BatchKey In BatchKeysInfo Do - If Not BatchKey.SalesInvoiceIsFilled Then - DontCreateBatch = False; // need create batch, invoice is empty - Break; - EndIf; - If BatchKey.Company <> BatchKey.SalesInvoice_Company Then - DontCreateBatch = False; // need create batch, company in invoice and in return not match - Break; - EndIf; - EndDo; - If DontCreateBatch Then - BatchesInfo.Clear(); - EndIf; - - // AmountTax to T6020S_BatchKeysInfo - Query = New Query; - Query.Text = - "SELECT - | BatchKeysInfo.Key, - | BatchKeysInfo.TotalQuantity, - | BatchKeysInfo.Quantity, - | * - |INTO BatchKeysInfo - |FROM - | &BatchKeysInfo AS BatchKeysInfo + | ON tmpItemList.Key = tmpSourceOfOrigins.Key |; | |//////////////////////////////////////////////////////////////////////////////// |SELECT | BatchKeysInfo.Key, - | CASE WHEN NOT BatchKeysInfo.SalesInvoiceIsFilled THEN BatchKeysInfo.LandedCostTax ELSE 0 END AS AmountTax, + | CASE + | WHEN NOT BatchKeysInfo.SalesInvoiceIsFilled + | THEN BatchKeysInfo.LandedCostTax + | ELSE 0 + | END AS AmountTax, | BatchKeysInfo.* |FROM - | BatchKeysInfo AS BatchKeysInfo"; + | BatchKeysInfo AS BatchKeysInfo + |; + | + |//////////////////////////////////////////////////////////////////////////////// + |SELECT + | SalesReturn.Ref AS Document, + | SalesReturn.Company AS Company, + | SalesReturn.Ref.Date AS Period + |FROM + | Document.SalesReturn AS SalesReturn + |WHERE + | SalesReturn.Ref = &Ref AND TRUE IN (SELECT CreateBatch FROM BatchKeysInfo)"; Query.SetParameter("Ref", Ref); Query.SetParameter("Period", Ref.Date); - Query.SetParameter("BatchKeysInfo", BatchKeysInfo); - QueryResult = Query.Execute(); - BatchKeysInfo = QueryResult.Unload(); + + QueryResult = Query.ExecuteBatch(); + BatchesInfo = QueryResult[4].Unload(); + BatchKeysInfo = QueryResult[3].Unload(); CurrencyTable = Ref.Currencies.UnloadColumns(); CurrencyMovementType = Ref.Company.LandedCostCurrencyMovementType; @@ -220,69 +222,35 @@ Function PostingGetDocumentDataTables(Ref, Cancel, PostingMode, Parameters, AddI CurrenciesServer.AddRowToCurrencyTable(Ref.Date, CurrencyTable, Row.Key, Row.Currency, CurrencyMovementType); EndDo; - PostingDataTables = New Map; - PostingDataTables.Insert(Parameters.Object.RegisterRecords.T6020S_BatchKeysInfo, - New Structure("RecordSet, WriteInTransaction", BatchKeysInfo, Parameters.IsReposting)); - Parameters.Insert("PostingDataTables", PostingDataTables); + T6020S_BatchKeysInfo = Metadata.InformationRegisters.T6020S_BatchKeysInfo; + T6020SSettings = PostingServer.PostingTableSettings(T6020S_BatchKeysInfo.Name, BatchKeysInfo, Parameters.Object.RegisterRecords.T6020S_BatchKeysInfo); + T6020SSettings.WriteInTransaction = Parameters.IsReposting; + Parameters.PostingDataTables.Insert(T6020S_BatchKeysInfo, T6020SSettings); + CurrenciesServer.PreparePostingDataTables(Parameters, CurrencyTable, AddInfo); - - CurrenciesServer.ExcludePostingDataTable(Parameters, Parameters.Object.RegisterRecords.T6020S_BatchKeysInfo.Metadata()); + CurrenciesServer.ExcludePostingDataTable(Parameters, T6020S_BatchKeysInfo); + + BatchKeysInfo_DataTable = Parameters.PostingDataTables[T6020S_BatchKeysInfo].PrepareTable; + + BatchKeysInfoSettings = PostingServer.GetBatchKeysInfoSettings(); + BatchKeysInfoSettings.DataTable = BatchKeysInfo_DataTable; + BatchKeysInfoSettings.Dimensions = "Period, Direction, Company, Store, ItemKey, Currency, CurrencyMovementType, SalesInvoice, SourceOfOrigin, SerialLotNumber, SourceOfOriginStock, SerialLotNumberStock, Quantity, Amount, AmountTax"; + BatchKeysInfoSettings.Totals = ""; + BatchKeysInfoSettings.CurrencyMovementType = CurrencyMovementType; + + PostingServer.SetBatchKeyInfoTable(Parameters, BatchKeysInfoSettings); - BatchKeysInfo_DataTable = Parameters.PostingDataTables.Get( - Parameters.Object.RegisterRecords.T6020S_BatchKeysInfo).RecordSet; - BatchKeysInfo_DataTableGrouped = BatchKeysInfo_DataTable.CopyColumns(); - If BatchKeysInfo_DataTable.Count() Then - BatchKeysInfo_DataTableGrouped = BatchKeysInfo_DataTable.Copy( - New Structure("CurrencyMovementType", CurrencyMovementType)); - BatchKeysInfo_DataTableGrouped.GroupBy("Period, Direction, Company, Store, ItemKey, Currency, CurrencyMovementType, SalesInvoice, SourceOfOrigin, SerialLotNumber, SourceOfOriginStock, SerialLotNumberStock, - |Quantity, Amount, AmountTax"); - Else - BatchKeysInfo_DataTableGrouped.Columns.Add("CurrencyMovementType", New TypeDescription("ChartOfCharacteristicTypesRef.CurrencyMovementType")); - EndIf; - Query = New Query; Query.TempTablesManager = Parameters.TempTablesManager; Query.Text = "SELECT - | * + | BatchesInfo.* |INTO BatchesInfo |FROM - | &T1 AS T1 - |; - | - |//////////////////////////////////////////////////////////////////////////////// - |SELECT - | * - |INTO BatchKeysInfo - |FROM - | &T2 AS T2"; - Query.SetParameter("T1", BatchesInfo); - Query.SetParameter("T2", BatchKeysInfo_DataTableGrouped); - Query.Execute(); - - Return Tables; -EndFunction - -Function PostingGetLockDataSource(Ref, Cancel, PostingMode, Parameters, AddInfo = Undefined) Export - DataMapWithLockFields = New Map; - Return DataMapWithLockFields; -EndFunction - -Procedure PostingCheckBeforeWrite(Ref, Cancel, PostingMode, Parameters, AddInfo = Undefined) Export - Tables = Parameters.DocumentDataTables; - QueryArray = GetQueryTextsMasterTables(); - PostingServer.SetRegisters(Tables, Ref); - PostingServer.FillPostingTables(Tables, Ref, QueryArray, Parameters); -EndProcedure - -Function PostingGetPostingDataTables(Ref, Cancel, PostingMode, Parameters, AddInfo = Undefined) Export - PostingDataTables = New Map; - PostingServer.SetPostingDataTables(PostingDataTables, Parameters); - Return PostingDataTables; -EndFunction - -Procedure PostingCheckAfterWrite(Ref, Cancel, PostingMode, Parameters, AddInfo = Undefined) Export - CheckAfterWrite(Ref, Cancel, Parameters, AddInfo); + | &BatchesInfo AS BatchesInfo"; + + Query.SetParameter("BatchesInfo", BatchesInfo); + Query.Execute(); EndProcedure #EndRegion diff --git a/IRP/src/Documents/StockAdjustmentAsSurplus/ManagerModule.bsl b/IRP/src/Documents/StockAdjustmentAsSurplus/ManagerModule.bsl index e28ccc8f5f..5c6818488f 100644 --- a/IRP/src/Documents/StockAdjustmentAsSurplus/ManagerModule.bsl +++ b/IRP/src/Documents/StockAdjustmentAsSurplus/ManagerModule.bsl @@ -13,7 +13,7 @@ Function PostingGetDocumentDataTables(Ref, Cancel, PostingMode, Parameters, AddI QueryArray = GetQueryTextsSecondaryTables(); PostingServer.ExecuteQuery(Ref, QueryArray, Parameters); - CurrenciesServer.ExcludePostingDataTable(Parameters, Parameters.Object.RegisterRecords.T6020S_BatchKeysInfo.Metadata()); + CurrenciesServer.ExcludePostingDataTable(Parameters, Metadata.InformationRegisters.T6020S_BatchKeysInfo); Parameters.IsReposting = False; Return Tables; diff --git a/IRP/src/Documents/StockAdjustmentAsWriteOff/ManagerModule.bsl b/IRP/src/Documents/StockAdjustmentAsWriteOff/ManagerModule.bsl index ef388c5ea1..11364821d8 100644 --- a/IRP/src/Documents/StockAdjustmentAsWriteOff/ManagerModule.bsl +++ b/IRP/src/Documents/StockAdjustmentAsWriteOff/ManagerModule.bsl @@ -15,7 +15,7 @@ Function PostingGetDocumentDataTables(Ref, Cancel, PostingMode, Parameters, AddI QueryArray = GetQueryTextsSecondaryTables(); PostingServer.ExecuteQuery(Ref, QueryArray, Parameters); - CurrenciesServer.ExcludePostingDataTable(Parameters, Parameters.Object.RegisterRecords.T6020S_BatchKeysInfo.Metadata()); + CurrenciesServer.ExcludePostingDataTable(Parameters, Metadata.InformationRegisters.T6020S_BatchKeysInfo); Return Tables; EndFunction diff --git a/IRP/src/Documents/WorkSheet/ManagerModule.bsl b/IRP/src/Documents/WorkSheet/ManagerModule.bsl index a711245549..1f14434afa 100644 --- a/IRP/src/Documents/WorkSheet/ManagerModule.bsl +++ b/IRP/src/Documents/WorkSheet/ManagerModule.bsl @@ -14,7 +14,7 @@ Function PostingGetDocumentDataTables(Ref, Cancel, PostingMode, Parameters, AddI Parameters.Insert("QueryParameters", GetAdditionalQueryParameters(Ref)); PostingServer.ExecuteQuery(Ref, QueryArray, Parameters); - CurrenciesServer.ExcludePostingDataTable(Parameters, Parameters.Object.RegisterRecords.T6020S_BatchKeysInfo.Metadata()); + CurrenciesServer.ExcludePostingDataTable(Parameters, Metadata.InformationRegisters.T6020S_BatchKeysInfo); Return Tables; EndFunction diff --git a/IRP/src/FunctionalOptions/UseAccounting/UseAccounting.mdo b/IRP/src/FunctionalOptions/UseAccounting/UseAccounting.mdo index 5b760d0cea..cdce2a6be7 100644 --- a/IRP/src/FunctionalOptions/UseAccounting/UseAccounting.mdo +++ b/IRP/src/FunctionalOptions/UseAccounting/UseAccounting.mdo @@ -35,4 +35,8 @@ <content>InformationRegister.T9014S_AccountsExpenseRevenue</content> <content>Catalog.LedgerTypeVariants</content> <content>Catalog.Companies.Attribute.LandedCostExpenseType</content> + <content>Report.TrialBalance</content> + <content>Report.TrialBalanceByAccount</content> + <content>Report.AccountCard</content> + <content>Report.AccountAnalysis</content> </mdclass:FunctionalOption> \ No newline at end of file diff --git a/IRP/src/InformationRegisters/T9012S_AccountsPartner/Forms/RecordForm/Form.form b/IRP/src/InformationRegisters/T9012S_AccountsPartner/Forms/RecordForm/Form.form index d470474287..fb494401ed 100644 --- a/IRP/src/InformationRegisters/T9012S_AccountsPartner/Forms/RecordForm/Form.form +++ b/IRP/src/InformationRegisters/T9012S_AccountsPartner/Forms/RecordForm/Form.form @@ -312,6 +312,56 @@ <textEdit>true</textEdit> </extInfo> </items> + <items xsi:type="form:FormField"> + <name>Currency</name> + <id>57</id> + <visible>true</visible> + <enabled>true</enabled> + <userVisible> + <common>true</common> + </userVisible> + <dataPath xsi:type="form:DataPath"> + <segments>Record.Currency</segments> + </dataPath> + <extendedTooltip> + <name>CurrencyExtendedTooltip</name> + <id>59</id> + <visible>true</visible> + <enabled>true</enabled> + <userVisible> + <common>true</common> + </userVisible> + <type>Label</type> + <autoMaxWidth>true</autoMaxWidth> + <autoMaxHeight>true</autoMaxHeight> + <extInfo xsi:type="form:LabelDecorationExtInfo"> + <horizontalAlign>Left</horizontalAlign> + </extInfo> + </extendedTooltip> + <contextMenu> + <name>CurrencyContextMenu</name> + <id>58</id> + <visible>true</visible> + <enabled>true</enabled> + <userVisible> + <common>true</common> + </userVisible> + <autoFill>true</autoFill> + </contextMenu> + <type>InputField</type> + <editMode>Enter</editMode> + <showInHeader>true</showInHeader> + <headerHorizontalAlign>Left</headerHorizontalAlign> + <showInFooter>true</showInFooter> + <extInfo xsi:type="form:InputFieldExtInfo"> + <autoMaxWidth>true</autoMaxWidth> + <autoMaxHeight>true</autoMaxHeight> + <wrap>true</wrap> + <chooseType>true</chooseType> + <typeDomainEnabled>true</typeDomainEnabled> + <textEdit>true</textEdit> + </extInfo> + </items> <items xsi:type="form:FormGroup"> <name>GroupPartnerType</name> <id>46</id> diff --git a/IRP/src/InformationRegisters/T9012S_AccountsPartner/Forms/RecordForm/Module.bsl b/IRP/src/InformationRegisters/T9012S_AccountsPartner/Forms/RecordForm/Module.bsl index e3962d3038..e66db8c668 100644 --- a/IRP/src/InformationRegisters/T9012S_AccountsPartner/Forms/RecordForm/Module.bsl +++ b/IRP/src/InformationRegisters/T9012S_AccountsPartner/Forms/RecordForm/Module.bsl @@ -1,15 +1,17 @@ - &AtServer Procedure OnCreateAtServer(Cancel, StandardProcessing) ThisObject.Items.RecordType.ChoiceList.Add("All" , R().CLV_1); ThisObject.Items.RecordType.ChoiceList.Add("Partner" , Metadata.Catalogs.Partners.ObjectPresentation); ThisObject.Items.RecordType.ChoiceList.Add("Agreement" , Metadata.Catalogs.Agreements.ObjectPresentation); + ThisObject.Items.RecordType.ChoiceList.Add("Currency" , Metadata.Catalogs.Currencies.ObjectPresentation); If ValueIsFilled(Record.Partner) Then ThisObject.RecordType = "Partner"; ElsIf ValueIsFilled(Record.Agreement) Then ThisObject.RecordType = "Agreement"; + ElsIf ValueIsFilled(Record.Currency) Then + ThisObject.RecordType = "Currency"; Else ThisObject.RecordType = "All"; EndIf; @@ -57,6 +59,10 @@ Procedure BeforeWriteAtServer(Cancel, CurrentObject, WriteParameters) CurrentObject.Agreement = Undefined; EndIf; + If ThisObject.RecordType <> "Currency" Then + CurrentObject.Currency = Undefined; + EndIf; + If Not CurrentObject.Vendor Then CurrentObject.AccountAdvancesVendor = Undefined; CurrentObject.AccountTransactionsVendor = Undefined; @@ -77,6 +83,7 @@ EndProcedure Procedure SetVisible() Items.Partner.Visible = ThisObject.RecordType = "Partner"; Items.Agreement.Visible = ThisObject.RecordType = "Agreement"; + Items.Currency.Visible = ThisObject.RecordType = "Currency"; Items.GroupVendor.Visible = Record.Vendor; Items.AccountAdvancesVendor.Visible = Record.Vendor; diff --git a/IRP/src/InformationRegisters/T9012S_AccountsPartner/T9012S_AccountsPartner.mdo b/IRP/src/InformationRegisters/T9012S_AccountsPartner/T9012S_AccountsPartner.mdo index 99aef1ac1a..c9fdd55459 100644 --- a/IRP/src/InformationRegisters/T9012S_AccountsPartner/T9012S_AccountsPartner.mdo +++ b/IRP/src/InformationRegisters/T9012S_AccountsPartner/T9012S_AccountsPartner.mdo @@ -377,6 +377,30 @@ <fillValue xsi:type="core:UndefinedValue"/> <mainFilter>true</mainFilter> </dimensions> + <dimensions uuid="b97a3c39-cde2-4613-8ed8-cb492a34f131"> + <name>Currency</name> + <synonym> + <key>en</key> + <value>Currency</value> + </synonym> + <synonym> + <key>ru</key> + <value>Валюта</value> + </synonym> + <synonym> + <key>tr</key> + <value>Döviz</value> + </synonym> + <type> + <types>CatalogRef.Currencies</types> + </type> + <minValue xsi:type="core:UndefinedValue"/> + <maxValue xsi:type="core:UndefinedValue"/> + <fullTextSearch>Use</fullTextSearch> + <dataHistory>Use</dataHistory> + <fillValue xsi:type="core:UndefinedValue"/> + <mainFilter>true</mainFilter> + </dimensions> <forms uuid="f4d9c850-72e5-46e2-86fc-207034084f82"> <name>RecordForm</name> <synonym> diff --git a/IRP/src/Reports/AccountAnalysis/AccountAnalysis.mdo b/IRP/src/Reports/AccountAnalysis/AccountAnalysis.mdo new file mode 100644 index 0000000000..727acd505d --- /dev/null +++ b/IRP/src/Reports/AccountAnalysis/AccountAnalysis.mdo @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<mdclass:Report xmlns:mdclass="http://g5.1c.ru/v8/dt/metadata/mdclass" uuid="fd083131-5ffb-4515-a5e4-eecb912f1b42"> + <producedTypes> + <objectType typeId="0a7c42fe-3f16-4122-9283-751539e68ca6" valueTypeId="7d250c43-04c0-4bab-b593-5a8236861f68"/> + <managerType typeId="fe13622d-85bb-4bc6-a34d-2834b0be7130" valueTypeId="6d68c09e-c10a-4fd4-a208-d31e2577440b"/> + </producedTypes> + <name>AccountAnalysis</name> + <synonym> + <key>en</key> + <value>Account analysis</value> + </synonym> + <synonym> + <key>ru</key> + <value>Анализ счета</value> + </synonym> + <synonym> + <key>tr</key> + <value>Account analysis</value> + </synonym> + <useStandardCommands>true</useStandardCommands> + <mainDataCompositionSchema>Report.AccountAnalysis.Template.MainDataCompositionSchema</mainDataCompositionSchema> + <templates uuid="6a448db8-b9ca-40f9-8652-3d0bc16b9ab2"> + <name>MainDataCompositionSchema</name> + <synonym> + <key>en</key> + <value>Main data composition schema</value> + </synonym> + <synonym> + <key>ru</key> + <value>Основная схема компоновки</value> + </synonym> + <synonym> + <key>tr</key> + <value>Ana veri inşa edilme şeması</value> + </synonym> + <templateType>DataCompositionSchema</templateType> + </templates> +</mdclass:Report> \ No newline at end of file diff --git a/IRP/src/Reports/AccountAnalysis/ManagerModule.bsl b/IRP/src/Reports/AccountAnalysis/ManagerModule.bsl new file mode 100644 index 0000000000..16846d4763 --- /dev/null +++ b/IRP/src/Reports/AccountAnalysis/ManagerModule.bsl @@ -0,0 +1,94 @@ + +Function GetDetailsDataPaths() Export + Return "BalancedAccount, BalancedExtDimension1, BalancedExtDimension2, BalancedExtDimension3"; +EndFunction + +Function GetAdditionalDetailsActions(DetailValuesMap) Export + Result = New Structure(); + Result.Insert("MenuList", New ValueList()); + Result.Insert("OtherReportMapping", New Map()); + + Account = DetailValuesMap["BalancedAccount"]; + If Not ValueIsFilled(Account) Then + Return Result; + EndIf; + + Result.MenuList.Add(1, StrTemplate("%1: %2 = %3", Metadata.Reports.TrialBalanceByAccount.Synonym, + String(TypeOf(Account)), Account),, PictureLib.Report); + + Result.MenuList.Add(1, StrTemplate("%1: %2 = %3", Metadata.Reports.AccountCard.Synonym, + String(TypeOf(Account)), Account),, PictureLib.DebitCredit); + + Result.OtherReportMapping.Insert(1, "Report.TrialBalanceByAccount.ObjectForm"); + Result.OtherReportMapping.Insert(2, "Report.AccountCard.ObjectForm"); + + Return Result; +EndFunction + +Function GetApplyingFilters(SelectedAction, DetailValuesMap) Export + If SelectedAction = 1 Then + Return Details_AccountAnalisys(DetailValuesMap); + Else + Return Details_AccountCard(DetailValuesMap); + EndIf; +EndFunction + +Function Details_AccountAnalisys(DetailValuesMap) + Result = New Structure(); + Result.Insert("DataParameters", New Map()); + Result.Insert("UserFilters", New Map()); + Result.Insert("DetailsFilters", New Map()); + + Result.DataParameters.Insert("Period", "Period"); + + Result.UserFilters.Insert("Company", "Company"); + Result.UserFilters.Insert("LedgerType", "LedgerType"); + + Result.DetailsFilters.Insert(DetailValuesMap["BalancedAccount"], + New Structure("FieldName, ComparisonType", "Account", DataCompositionComparisonType.InHierarchy)); + + Return Result; +EndFunction + + +Function Details_AccountCard(DetailValuesMap) + Result = New Structure(); + Result.Insert("DataParameters", New Map()); + Result.Insert("UserFilters", New Map()); + Result.Insert("DetailsFilters", New Map()); + Result.Insert("DetailsFiltersGroupOR", New Array()); + + Result.DataParameters.Insert("Period", "Period"); + + Result.UserFilters.Insert("Company", "Company"); + Result.UserFilters.Insert("LedgerType", "LedgerType"); + + Result.DetailsFilters.Insert(DetailValuesMap["BalancedAccount"], + New Structure("FieldName, ComparisonType", "Account", DataCompositionComparisonType.InHierarchy)); + + + FilterByExtDimension(1, DetailValuesMap, Result.DetailsFiltersGroupOR); + FilterByExtDimension(2, DetailValuesMap, Result.DetailsFiltersGroupOR); + FilterByExtDimension(3, DetailValuesMap, Result.DetailsFiltersGroupOR); + + Return Result; +EndFunction + +Procedure FilterByExtDimension(Number, DetailValuesMap, DetailsFiltersGroupOR) + ArrayOfFilters_ExtDimension = New Array(); + If ValueIsFilled(DetailValuesMap["BalancedExtDimension"+Number]) Then + Filter_ExtDimensionDr = New Map(); + Filter_ExtDimensionDr.Insert(DetailValuesMap["BalancedExtDimension"+Number], + New Structure("FieldName, ComparisonType", "ExtDimensionDr"+Number, DataCompositionComparisonType.Equal)); + ArrayOfFilters_ExtDimension.Add(Filter_ExtDimensionDr); + + Filter_ExtDimensionCr = New Map(); + Filter_ExtDimensionCr.Insert(DetailValuesMap["BalancedExtDimension"+Number], + New Structure("FieldName, ComparisonType", "ExtDimensionCr"+Number, DataCompositionComparisonType.Equal)); + ArrayOfFilters_ExtDimension.Add(Filter_ExtDimensionCr); + EndIf; + If ArrayOfFilters_ExtDimension.Count() Then + DetailsFiltersGroupOR.Add(ArrayOfFilters_ExtDimension); + EndIf; +EndProcedure + diff --git a/IRP/src/Reports/AccountAnalysis/Templates/MainDataCompositionSchema/Template.dcs b/IRP/src/Reports/AccountAnalysis/Templates/MainDataCompositionSchema/Template.dcs new file mode 100644 index 0000000000..e7a21a7fde --- /dev/null +++ b/IRP/src/Reports/AccountAnalysis/Templates/MainDataCompositionSchema/Template.dcs @@ -0,0 +1,944 @@ +<?xml version="1.0" encoding="UTF-8"?> +<DataCompositionSchema xmlns="http://v8.1c.ru/8.1/data-composition-system/schema" xmlns:dcscom="http://v8.1c.ru/8.1/data-composition-system/common" xmlns:dcscor="http://v8.1c.ru/8.1/data-composition-system/core" xmlns:dcsset="http://v8.1c.ru/8.1/data-composition-system/settings" xmlns:v8="http://v8.1c.ru/8.1/data/core" xmlns:v8ui="http://v8.1c.ru/8.1/data/ui" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <dataSource> + <name>DataSource1</name> + <dataSourceType>Local</dataSourceType> + </dataSource> + <dataSet xsi:type="DataSetQuery"> + <name>DataSet1</name> + <field xsi:type="DataSetFieldField"> + <dataPath>Account</dataPath> + <field>Account</field> + <role> + <dcscom:dimension>true</dcscom:dimension> + </role> + <orderExpression> + <dcscom:expression>Account.Order</dcscom:expression> + <dcscom:orderType>Asc</dcscom:orderType> + <dcscom:autoOrder>false</dcscom:autoOrder> + </orderExpression> + <appearance/> + <inputParameters/> + </field> + <field xsi:type="DataSetFieldField"> + <dataPath>BalancedAccount</dataPath> + <field>BalancedAccount</field> + <title xsi:type="v8:LocalStringType"> + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Account (balanced)</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Корр. счет</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Account (balanced)</v8:content> + </v8:item> + + + true + + + BalancedAccount.Order + Asc + false + + + + + + ExtDimension1 + ExtDimension1 + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Extra dim.1</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Субконто 1</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Extra dim.1</v8:content> + </v8:item> + + + true + + + + + + ExtDimension2 + ExtDimension2 + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Extra dim.2</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Субконто 2</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Extra dim.2</v8:content> + </v8:item> + + + true + + + + + + ExtDimension3 + ExtDimension3 + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Extra dim.3</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Субконто 3</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Extra dim.3</v8:content> + </v8:item> + + + true + + + + + + BalancedExtDimension1 + BalancedExtDimension1 + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Extra dim.1 (balanced)</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Корр. субконто 1</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Extra dim.1 (balanced)</v8:content> + </v8:item> + + + true + + + + + + BalancedExtDimension2 + BalancedExtDimension2 + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Extra dim.2 (balanced)</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Корр. субконто 2</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Extra dim.2 (balanced)</v8:content> + </v8:item> + + + true + + + + + + BalancedExtDimension3 + BalancedExtDimension3 + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Extra dim3 (balanced)</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Корр. субконто 3</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Extra dim3 (balanced)</v8:content> + </v8:item> + + + true + + + + + + AmountTurnoverDr + AmountTurnoverDr + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>From Cr (Amt.)</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Из Кт (Сум.)</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>From Cr (Amt.)</v8:content> + </v8:item> + + + + Format + + + en + NFD=2 + + + ru + NFD=2 + + + tr + NFD=2 + + + + + MarkNegatives + true + + + + + + AmountTurnoverCr + AmountTurnoverCr + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>To Dr (Amt.)</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>В Дт (Сум.)</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>To Dr (Amt.)</v8:content> + </v8:item> + + + + Format + + + en + NFD=2 + + + ru + NFD=2 + + + tr + NFD=2 + + + + + MarkNegatives + true + + + + + + QuantityTurnoverDr + QuantityTurnoverDr + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>From Cr (Qty.)</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Из Кт (Колво.)</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>From Cr (Qty.)</v8:content> + </v8:item> + + + + Format + + + en + NFD=2 + + + ru + NFD=2 + + + tr + NFD=2 + + + + + MarkNegatives + true + + + + + + QuantityTurnoverCr + QuantityTurnoverCr + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>To Dr (Qty.)</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>В Дт (Колво.)</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>To Dr (Qty.)</v8:content> + </v8:item> + + + + Format + + + en + NFD=2 + + + ru + NFD=2 + + + tr + NFD=2 + + + + + MarkNegatives + true + + + + + + CurrencyAmountTurnoverDr + CurrencyAmountTurnoverDr + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>From Cr (Curr.)</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Из Кт (Вал.)</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>From Cr (Curr.)</v8:content> + </v8:item> + + + + Format + + + en + NFD=2 + + + ru + NFD=2 + + + tr + NFD=2 + + + + + MarkNegatives + true + + + + + + CurrencyAmountTurnoverCr + CurrencyAmountTurnoverCr + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>To Dr (Curr.)</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>В Дт (Вал.)</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>To Dr (Curr.)</v8:content> + </v8:item> + + + + Format + + + en + NFD=2 + + + ru + NFD=2 + + + tr + NFD=2 + + + + + MarkNegatives + true + + + + + + Company + Company + + true + + + + + ChoiceParameters + + + Filter.OurCompany + true + + + + + + + LedgerType + LedgerType + + true + + + + + + Currency + Currency + + true + + + + + + CurrencyBalanced + CurrencyBalanced + + true + + + + + + Indicators + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Indicators</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Идентификаторы</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Indicators</v8:content> + </v8:item> + + + DataSource1 + SELECT ALLOWED + BasicTurnovers.Account AS Account, + BasicTurnovers.BalancedAccount AS BalancedAccount, + BasicTurnovers.ExtDimension1 AS ExtDimension1, + BasicTurnovers.ExtDimension2 AS ExtDimension2, + BasicTurnovers.ExtDimension3 AS ExtDimension3, + BasicTurnovers.BalancedExtDimension1 AS BalancedExtDimension1, + BasicTurnovers.BalancedExtDimension2 AS BalancedExtDimension2, + BasicTurnovers.BalancedExtDimension3 AS BalancedExtDimension3, + BasicTurnovers.AmountTurnoverDr AS AmountTurnoverDr, + BasicTurnovers.AmountTurnoverCr AS AmountTurnoverCr, + BasicTurnovers.QuantityTurnoverDr AS QuantityTurnoverDr, + BasicTurnovers.QuantityTurnoverCr AS QuantityTurnoverCr, + BasicTurnovers.CurrencyAmountTurnoverDr AS CurrencyAmountTurnoverDr, + BasicTurnovers.CurrencyAmountTurnoverCr AS CurrencyAmountTurnoverCr, + BasicTurnovers.Company AS Company, + BasicTurnovers.LedgerType AS LedgerType, + BasicTurnovers.Currency AS Currency, + BasicTurnovers.CurrencyBalanced AS CurrencyBalanced +FROM + AccountingRegister.Basic.Turnovers({(&BeginPeriod)}, {(&EndPeriod)}, , , , {(Company).*, (LedgerType).*}, , ) AS BasicTurnovers + + + Indicators.Amount + "Amt." + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Indicator Amt</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Идентификатор Сумма</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Indicator Amt</v8:content> + </v8:item> + + + + + + Indicators.CurrencyAmount + "Curr." + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Indicator Curr</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Идентификатор Вал</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Indicator Curr</v8:content> + </v8:item> + + + + + + Indicators.Quantity + "Qty." + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Indicator Qty</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Идентификатор Колво</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Indicator Qty</v8:content> + </v8:item> + + + + + + AmountTurnoverDr + Sum(AmountTurnoverDr) + + + AmountTurnoverCr + Sum(AmountTurnoverCr) + + + CurrencyAmountTurnoverDr + Sum(CurrencyAmountTurnoverDr) + + + CurrencyAmountTurnoverCr + Sum(CurrencyAmountTurnoverCr) + + + QuantityTurnoverDr + Sum(QuantityTurnoverDr) + + + QuantityTurnoverCr + Sum(QuantityTurnoverCr) + + + Indicators.Amount + Max(Indicators.Amount) + + + Indicators.CurrencyAmount + Max(Indicators.CurrencyAmount) + + + Indicators.Quantity + Max(Indicators.Quantity) + + + BeginPeriod + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Begin period</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Начало периода</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Başlangıç tarihi</v8:content> + </v8:item> + + + true + &Period.StartDate + false + + + + EndPeriod + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>End period</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Конец периода</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Son tarih</v8:content> + </v8:item> + + + true + &Period.EndDate + false + + + + Period + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Period</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Период</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Dönem</v8:content> + </v8:item> + + + v8:StandardPeriod + + + Custom + 0001-01-01T00:00:00 + 0001-01-01T00:00:00 + + false + + + + AccountAnalisys + + + en + Account analysis + + + ru + Анализ счета + + + tr + Account analysis + + + + + + + + Indicators.Amount + + + + Indicators.CurrencyAmount + + + + Indicators.Quantity + + + Vertically + + + From Credit + + AmountTurnoverDr + + + + CurrencyAmountTurnoverDr + + + + QuantityTurnoverDr + + + Vertically + + + To Debit + + AmountTurnoverCr + + + + CurrencyAmountTurnoverCr + + + + QuantityTurnoverCr + + + Vertically + + + + + Company + Equal + Catalog.Companies.EmptyRef + ac6477ab-086f-43cb-87d7-c6ec608cc2c9 + + + LedgerType + Equal + Catalog.LedgerTypes.EmptyRef + 64e5e0d2-055f-4a91-9949-4964dc575e31 + + + Account + InHierarchy + ChartOfAccounts.Basic.EmptyRef + 151f876b-bcce-4af6-95ce-1ddf9dd70545 + + + + + false + BeginPeriod + + + + false + EndPeriod + + + + false + Period + + Custom + 0001-01-01T00:00:00 + 0001-01-01T00:00:00 + + 8be562df-1d14-4de5-974d-a88b0f6e7370 + + + + + + + AmountTurnoverDr + + + AmountTurnoverCr + + + + + + false + BorderStyle + + None + + + BorderStyle.Bottom + + None + + + + + + + + + CurrencyAmountTurnoverDr + + + CurrencyAmountTurnoverCr + + + + + + false + BorderStyle + + None + + + BorderStyle.Top + + None + + + + BorderStyle.Bottom + + None + + + + + + + + + QuantityTurnoverDr + + + QuantityTurnoverCr + + + + + + false + BorderStyle + + None + + + BorderStyle.Top + + None + + + + + + + + + AmountTurnoverDr + + + CurrencyAmountTurnoverDr + + + QuantityTurnoverDr + + + AmountTurnoverCr + + + CurrencyAmountTurnoverCr + + + QuantityTurnoverCr + + + + + + MinimumWidth + 15 + + + + + + + AppearanceTemplate + Sea + + + + + + BalancedAccount + Hierarchy + None + 0001-01-01T00:00:00 + 0001-01-01T00:00:00 + + + + + + + + + + + + + \ No newline at end of file diff --git a/IRP/src/Reports/AccountCard/AccountCard.mdo b/IRP/src/Reports/AccountCard/AccountCard.mdo new file mode 100644 index 0000000000..1383a2e2c3 --- /dev/null +++ b/IRP/src/Reports/AccountCard/AccountCard.mdo @@ -0,0 +1,38 @@ + + + + + + + AccountCard + + en + Account card + + + ru + Карточка счета + + + tr + Account card + + true + Report.AccountCard.Template.MainDataCompositionSchema + + MainDataCompositionSchema + + en + Main data composition schema + + + ru + Основная схема компоновки + + + tr + Ana veri inşa edilme şeması + + DataCompositionSchema + + \ No newline at end of file diff --git a/IRP/src/Reports/AccountCard/Templates/MainDataCompositionSchema/Template.dcs b/IRP/src/Reports/AccountCard/Templates/MainDataCompositionSchema/Template.dcs new file mode 100644 index 0000000000..3adfef83e1 --- /dev/null +++ b/IRP/src/Reports/AccountCard/Templates/MainDataCompositionSchema/Template.dcs @@ -0,0 +1,2396 @@ + + + + DataSource1 + Local + + + DataSet1 + + Account + Account + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Account</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Счет</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Hesap</v8:content> + </v8:item> + + + true + + + Account.Order + Asc + false + + + + Company + Company + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Company</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Организация</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Şirket</v8:content> + </v8:item> + + + true + + + + ChoiceParameters + + + Filter.OurCompany + true + + + + + + + Currency + Currency + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Currency</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Валюта</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Döviz</v8:content> + </v8:item> + + + true + + + + ExtDimension1 + ExtDimension1 + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Ext dim.1</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Субконто 1</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Ext dim.1</v8:content> + </v8:item> + + + true + + Presentation(Case When Not ValueIsFilled(ExtDimension1) Then "<...>" Else ExtDimension1 End) + + + ExtDimension2 + ExtDimension2 + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Ext dim.2</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Субконто 2</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Ext dim.2</v8:content> + </v8:item> + + + true + + Presentation(Case When Not ValueIsFilled(ExtDimension2) Then "<...>" Else ExtDimension2 End) + + + ExtDimension3 + ExtDimension3 + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Ext dim.3</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Субконто 3</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Ext dim.3</v8:content> + </v8:item> + + + true + + Presentation(Case When Not ValueIsFilled(ExtDimension3) Then "<...>" Else ExtDimension3 End) + + + Recorder + Recorder + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Recorder</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Документ</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>İşlem evrakı</v8:content> + </v8:item> + + + 1 + Main + + + + LedgerType + LedgerType + + true + + + + OpeningBalance.AmountOpeningBalanceDr + AmountOpeningBalanceDr + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Amount Dr (opening balance)</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Сумма Дт (Начальный остаток)</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Amount Dr (opening balance)</v8:content> + </v8:item> + + + true + AmountDr + OpeningBalance + + + + Format + + + en + NFD=2 + + + ru + NFD=2 + + + tr + NFD=2 + + + + + MarkNegatives + true + + + + + OpeningBalance.AmountOpeningBalanceCr + AmountOpeningBalanceCr + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Amount Cr (opening balance)</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Сумма Кт (Начальный остаток)</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Amount Cr (opening balance)</v8:content> + </v8:item> + + + true + AmountCr + OpeningBalance + + + + Format + + + en + NFD=2 + + + ru + NFD=2 + + + tr + NFD=2 + + + + + MarkNegatives + true + + + + + ClosingBalance.AmountClosingBalanceDr + AmountClosingBalanceDr + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Amount Dr (closing balance</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Сумма Дт (Конечный остаток)</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Amount Dr (closing balance</v8:content> + </v8:item> + + + true + AmountDr + ClosingBalance + + + + Format + + + en + NFD=2 + + + ru + NFD=2 + + + tr + NFD=2 + + + + + MarkNegatives + true + + + + + ClosingBalance.AmountClosingBalanceCr + AmountClosingBalanceCr + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Amount Cr (closing balance)</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Сумма Кт (Конечный остаток)</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Amount Cr (closing balance)</v8:content> + </v8:item> + + + true + AmountCr + ClosingBalance + + + + Format + + + en + NFD=2 + + + ru + NFD=2 + + + tr + NFD=2 + + + + + MarkNegatives + true + + + + + OpeningBalance.CurrencyAmountOpeningBalanceDr + CurrencyAmountOpeningBalanceDr + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Currency amt. Dr (opening balance)</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Валютнаы сумма Дт (Начальный остаток)</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Currency amt. Dr (opening balance)</v8:content> + </v8:item> + + + true + CurrencyAmountDr + OpeningBalance + + + + Format + + + en + NFD=2 + + + ru + NFD=2 + + + tr + NFD=2 + + + + + MarkNegatives + true + + + + + OpeningBalance.CurrencyAmountOpeningBalanceCr + CurrencyAmountOpeningBalanceCr + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Currency amt. Cr (opening balance)</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Валютнаы сумма Кт (Начальный остаток)</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Currency amt. Cr (opening balance)</v8:content> + </v8:item> + + + true + CurrencyAmountCr + OpeningBalance + + + + Format + + + en + NFD=2 + + + ru + NFD=2 + + + tr + NFD=2 + + + + + MarkNegatives + true + + + + + ClosingBalance.CurrencyAmountClosingBalanceDr + CurrencyAmountClosingBalanceDr + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Currency amt. Dr (closing balance)</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Валютнаы сумма Дт (Конечный остаток)</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Currency amt. Dr (closing balance)</v8:content> + </v8:item> + + + true + CurrencyAmountDr + ClosingBalance + + + + Format + + + en + NFD=2 + + + ru + NFD=2 + + + tr + NFD=2 + + + + + MarkNegatives + true + + + + + ClosingBalance.CurrencyAmountClosingBalanceCr + CurrencyAmountClosingBalanceCr + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Currency amt. Cr (closing balance)</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Валютная сумма Кт (Конечный остаток)</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Currency amt. Cr (closing balance)</v8:content> + </v8:item> + + + true + CurrencyAmountCr + ClosingBalance + + + + Format + + + en + NFD=2 + + + ru + NFD=2 + + + tr + NFD=2 + + + + + MarkNegatives + true + + + + + ClosingBalance.QuantityClosingBalanceDr + QuantityClosingBalanceDr + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Quantity Dr (closing balance)</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Количество Дт (Конечный остаток)</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Quantity Dr (closing balance)</v8:content> + </v8:item> + + + true + QuantityDr + ClosingBalance + + + + Format + + + en + NFD=3 + + + ru + NFD=3 + + + tr + NFD=3 + + + + + MarkNegatives + true + + + + + ClosingBalance.QuantityClosingBalanceCr + QuantityClosingBalanceCr + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Quantity Cr (closing balance)</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Количество Кт (Начальный остаток)</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Quantity Cr (closing balance)</v8:content> + </v8:item> + + + true + QuantityCr + ClosingBalance + + + + Format + + + en + NFD=3 + + + ru + NFD=3 + + + tr + NFD=3 + + + + + MarkNegatives + true + + + + + OpeningBalance.QuantityOpeningBalanceDr + QuantityOpeningBalanceDr + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Quantity Dr (opening balance)</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Количество Дт (Начальный остаток)</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Quantity Dr (opening balance)</v8:content> + </v8:item> + + + true + QuantityDr + OpeningBalance + + + + Format + + + en + NFD=3 + + + ru + NFD=3 + + + tr + NFD=3 + + + + + MarkNegatives + true + + + + + OpeningBalance.QuantityOpeningBalanceCr + QuantityOpeningBalanceCr + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Quantity Cr (opening balance)</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Количество Кт (Начальный остаток)</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Quantity Cr (opening balance)</v8:content> + </v8:item> + + + true + QuantityCr + OpeningBalance + + + + Format + + + en + NFD=3 + + + ru + NFD=3 + + + tr + NFD=3 + + + + + MarkNegatives + true + + + + + Turnovers.AmountTurnoverCr + AmountTurnoverCr + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Amount Cr (turnover)</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Сумма Кт (Оборот)</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Amount Cr (turnover)</v8:content> + </v8:item> + + + + Format + + + en + NFD=2 + + + ru + NFD=2 + + + tr + NFD=2 + + + + + MarkNegatives + true + + + + + Turnovers.AmountTurnoverDr + AmountTurnoverDr + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Amount Dr (turnover)</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Сумма Дт (Оборот)</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Amount Dr (turnover)</v8:content> + </v8:item> + + + + MarkNegatives + true + + + Format + + + en + NFD=2 + + + ru + NFD=2 + + + tr + NFD=2 + + + + + + + OpeningBalance + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Opening balance</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Начальный остаток</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Açılış tutarı</v8:content> + </v8:item> + + + + ClosingBalance + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Closing balance</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Конечный остаток</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Kapanış bakiyesi</v8:content> + </v8:item> + + + + Turnovers + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Turnovers</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Обороты</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Turnovers</v8:content> + </v8:item> + + + + Turnovers.QuantityTurnoverDr + QuantityTurnoverDr + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Quantity Dr (turnover)</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Количество Дт (Оборот)</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Quantity Dr (turnover)</v8:content> + </v8:item> + + + + Format + + + en + NFD=3 + + + ru + NFD=3 + + + tr + NFD=3 + + + + + MarkNegatives + true + + + + + Turnovers.QuantityTurnoverCr + QuantityTurnoverCr + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Quantity Cr (turnover)</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Количество Кт (Оборот)</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Quantity Cr (turnover)</v8:content> + </v8:item> + + + + Format + + + en + NFD=3 + + + ru + NFD=3 + + + tr + NFD=3 + + + + + MarkNegatives + true + + + + + Turnovers.CurrencyAmountTurnoverDr + CurrencyAmountTurnoverDr + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Currency amt. Dr (turnover)</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Валютнаы сумма Дт (Оборот)</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Currency amt. Dr (turnover)</v8:content> + </v8:item> + + + + Format + + + en + NFD=2 + + + ru + NFD=2 + + + tr + NFD=2 + + + + + MarkNegatives + true + + + + + Turnovers.CurrencyAmountTurnoverCr + CurrencyAmountTurnoverCr + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Currency amt. Cr (turnover)</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Валютнаы сумма Кт (Оборот)</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Currency amt. Cr (turnover)</v8:content> + </v8:item> + + + + Format + + + en + NFD=2 + + + ru + NFD=2 + + + tr + NFD=2 + + + + + MarkNegatives + true + + + + + Period + Period + + 2 + Main + + + + ExtDimensionCr1 + ExtDimensionCr1 + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Ext dim. Cr1</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Субконто Кт1</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Ext dim. Cr1</v8:content> + </v8:item> + + + true + + Presentation(Case When Not ValueIsFilled(ExtDimensionCr1) And ValueIsFilled(Recorder) Then "<...>" Else ExtDimensionCr1 End) + + + ExtDimensionCr2 + ExtDimensionCr2 + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Ext dim. Cr2</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Субконто Кт2</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Ext dim. Cr2</v8:content> + </v8:item> + + + true + + Presentation(Case When Not ValueIsFilled(ExtDimensionCr2) And ValueIsFilled(Recorder) Then "<...>" Else ExtDimensionCr2 End) + + + ExtDimensionCr3 + ExtDimensionCr3 + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Ext dim. Cr3</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Субконто Кт3</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Ext dim. Cr3</v8:content> + </v8:item> + + + true + + Presentation(Case When Not ValueIsFilled(ExtDimensionCr3) And ValueIsFilled(Recorder) Then "<...>" Else ExtDimensionCr3 End) + + + ExtDimensionDr1 + ExtDimensionDr1 + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Ext dim. Dr1</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Субконто Дт1</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Ext dim. Dr1</v8:content> + </v8:item> + + + true + + Presentation(Case When Not ValueIsFilled(ExtDimensionDr1) And ValueIsFilled(Recorder) Then "<...>" Else ExtDimensionDr1 End) + + + ExtDimensionDr2 + ExtDimensionDr2 + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Ext dim. Dr2</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Субконто Дт2</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Ext dim. Dr2</v8:content> + </v8:item> + + + true + + Presentation(Case When Not ValueIsFilled(ExtDimensionDr2) And ValueIsFilled(Recorder) Then "<...>" Else ExtDimensionDr2 End) + + + ExtDimensionDr3 + ExtDimensionDr3 + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Ext dim. Dr3</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Субконто Дт3</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Ext dim. Dr3</v8:content> + </v8:item> + + + true + + Presentation(Case When Not ValueIsFilled(ExtDimensionDr3) And ValueIsFilled(Recorder) Then "<...>" Else ExtDimensionDr3 End) + + + AccountDr + AccountDr + + true + + + + AccountCr + AccountCr + + true + + + + CurrencyDr + CurrencyDr + + true + + Presentation(Case When Not ValueIsFilled(Turnovers.CurrencyAmountTurnoverDr) Then UNDEFINED Else CurrencyDr End) + + + CurrencyCr + CurrencyCr + + true + + Presentation(Case When Not ValueIsFilled(Turnovers.CurrencyAmountTurnoverCr) Then UNDEFINED Else CurrencyCr End) + + + Operation + Operation + + + BalancedAccount + BalancedAccount + + + BalancedExtDimension1 + BalancedExtDimension1 + + + BalancedExtDimension2 + BalancedExtDimension2 + + + BalancedExtDimension3 + BalancedExtDimension3 + + + CurrencyBalanced + CurrencyBalanced + + + Indicators + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Indicators</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Идентификаторы</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Indicators</v8:content> + </v8:item> + + + DataSource1 + SELECT ALLOWED + CASE + WHEN RecordsWithExtDimensions.Recorder = UNDEFINED + THEN NULL + ELSE RecordsWithExtDimensions.Recorder + END AS Recorder, + RecordsWithExtDimensions.Period AS Period, + RecordsWithExtDimensions.ExtDimensionCr1 AS ExtDimensionCr1, + RecordsWithExtDimensions.ExtDimensionCr2 AS ExtDimensionCr2, + RecordsWithExtDimensions.ExtDimensionCr3 AS ExtDimensionCr3, + RecordsWithExtDimensions.ExtDimensionDr1 AS ExtDimensionDr1, + RecordsWithExtDimensions.ExtDimensionDr2 AS ExtDimensionDr2, + RecordsWithExtDimensions.ExtDimensionDr3 AS ExtDimensionDr3, + RecordsWithExtDimensions.AccountDr AS AccountDr, + RecordsWithExtDimensions.AccountCr AS AccountCr, + RecordsWithExtDimensions.CurrencyDr AS CurrencyDr, + RecordsWithExtDimensions.CurrencyCr AS CurrencyCr, + RecordsWithExtDimensions.Operation AS Operation, + BalanceAndTurnovers.Company AS Company, + BalanceAndTurnovers.LedgerType AS LedgerType, +// Amount + BalanceAndTurnovers.AmountOpeningBalanceDr, + BalanceAndTurnovers.AmountOpeningBalanceCr, + BalanceAndTurnovers.AmountClosingBalanceDr, + BalanceAndTurnovers.AmountClosingBalanceCr, + BalanceAndTurnovers.AmountTurnoverDr, + BalanceAndTurnovers.AmountTurnoverCr, +// Currency amount + BalanceAndTurnovers.CurrencyAmountOpeningBalanceDr, + BalanceAndTurnovers.CurrencyAmountOpeningBalanceCr, + BalanceAndTurnovers.CurrencyAmountClosingBalanceDr, + BalanceAndTurnovers.CurrencyAmountClosingBalanceCr, + BalanceAndTurnovers.CurrencyAmountTurnoverDr, + BalanceAndTurnovers.CurrencyAmountTurnoverCr, +// Quantity + BalanceAndTurnovers.QuantityClosingBalanceDr, + BalanceAndTurnovers.QuantityClosingBalanceCr, + BalanceAndTurnovers.QuantityOpeningBalanceDr, + BalanceAndTurnovers.QuantityOpeningBalanceCr, + BalanceAndTurnovers.QuantityTurnoverDr, + BalanceAndTurnovers.QuantityTurnoverCr +FROM + AccountingRegister.Basic.BalanceAndTurnovers({&BeginOfPeriod}, {&EndOfPeriod}, Record, + RegisterRecordsAndPeriodBoundaries, {(Account).* AS Account},, + NOT LedgerType.DeletionMark {(LedgerType).* AS LedgerType} {(Company).* AS Company} {(Currency).* AS Currency}) AS + BalanceAndTurnovers + INNER JOIN AccountingRegister.Basic.RecordsWithExtDimensions AS RecordsWithExtDimensions + ON BalanceAndTurnovers.Recorder = RecordsWithExtDimensions.Recorder + AND BalanceAndTurnovers.LineNumber = RecordsWithExtDimensions.LineNumber + + + Indicators.IndicatorAmount + "Amt" + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Indicator Amt</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Идентификатор Сумма</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Indicator Amt</v8:content> + </v8:item> + + + + Indicators.IndicatorQuantity + "Qty." + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Indicator Qty</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Идентификатор Колво</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Indicator Qty</v8:content> + </v8:item> + + + + Indicators.IndicatorCurrencyAmount + "Curr." + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Indicator Curr</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Идентификатор Вал</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Indicator Curr</v8:content> + </v8:item> + + + + Balance + Case + When ValueIsFilled(ClosingBalance.AmountClosingBalanceDr) Then ClosingBalance.AmountClosingBalanceDr + When ValueIsFilled(ClosingBalance.AmountClosingBalanceCr) Then ClosingBalance.AmountClosingBalanceCr +End + + + + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Balance</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Остаток</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Bakiye</v8:content> + </v8:item> + + + + Format + + + en + NFD=2 + + + ru + NFD=2 + + + tr + NFD=2 + + + + + MarkNegatives + true + + + + + OpeningBalance.AmountOpeningBalanceDr + Sum(OpeningBalance.AmountOpeningBalanceDr) + + + OpeningBalance.AmountOpeningBalanceCr + Sum(OpeningBalance.AmountOpeningBalanceCr) + + + ClosingBalance.AmountClosingBalanceDr + Sum(ClosingBalance.AmountClosingBalanceDr) + + + ClosingBalance.AmountClosingBalanceCr + Sum(ClosingBalance.AmountClosingBalanceCr) + + + OpeningBalance.QuantityOpeningBalanceCr + Sum(OpeningBalance.QuantityOpeningBalanceCr) + + + OpeningBalance.QuantityOpeningBalanceDr + Sum(OpeningBalance.QuantityOpeningBalanceDr) + + + ClosingBalance.QuantityClosingBalanceCr + Sum(ClosingBalance.QuantityClosingBalanceCr) + + + ClosingBalance.QuantityClosingBalanceDr + Sum(ClosingBalance.QuantityClosingBalanceDr) + + + OpeningBalance.CurrencyAmountOpeningBalanceCr + Sum(OpeningBalance.CurrencyAmountOpeningBalanceCr) + + + OpeningBalance.CurrencyAmountOpeningBalanceDr + Sum(OpeningBalance.CurrencyAmountOpeningBalanceDr) + + + ClosingBalance.CurrencyAmountClosingBalanceCr + Sum(ClosingBalance.CurrencyAmountClosingBalanceCr) + + + ClosingBalance.CurrencyAmountClosingBalanceDr + Sum(ClosingBalance.CurrencyAmountClosingBalanceDr) + + + Balance + Sum(Balance) + Recorder + + + Turnovers.AmountTurnoverCr + Sum(Turnovers.AmountTurnoverCr) + + + Turnovers.AmountTurnoverDr + Sum(Turnovers.AmountTurnoverDr) + + + Turnovers.CurrencyAmountTurnoverCr + Sum(Turnovers.CurrencyAmountTurnoverCr) + + + Turnovers.CurrencyAmountTurnoverDr + Sum(Turnovers.CurrencyAmountTurnoverDr) + + + Turnovers.QuantityTurnoverCr + Sum(Turnovers.QuantityTurnoverCr) + + + Turnovers.QuantityTurnoverDr + Sum(Turnovers.QuantityTurnoverDr) + + + Period + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Period</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Период</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Dönem</v8:content> + </v8:item> + + + v8:StandardPeriod + + + false + + + BeginOfPeriod + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Begin of period</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Начало периода</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Dönem başı</v8:content> + </v8:item> + + + xs:dateTime + + Date + + + + true + &Period.StartDate + false + + + EndOfPeriod + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>End of period</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Конец периода</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Dönem sonu</v8:content> + </v8:item> + + + xs:dateTime + + Date + + + + true + &Period.EndDate + false + + + Top + + <v8:item> + <v8:lang>en</v8:lang> + <v8:content>Top</v8:content> + </v8:item> + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Верх</v8:content> + </v8:item> + <v8:item> + <v8:lang>tr</v8:lang> + <v8:content>Üst</v8:content> + </v8:item> + + + xs:decimal + + 15 + 0 + Nonnegative + + + false + + + + + + + + + + + +