Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- For each TabularSectionLine In Object.AccrualsDeductions Do
- //--> BIT CP-465 GOTolok@firstbit.ae 21.03.18 - Fill in the structure for calculating the parameters
- FiltersStructure = FillFiltersStructure(TabularSectionLine);
- //<-- BIT CP-465 GOTolok@firstbit.ae 21.03.18
- // 1. Check
- If NOT ValueIsFilled(TabularSectionLine.AccrualDeductionKind) Then
- Continue;
- EndIf;
- ArrayOfRepeats = QueryResult.FindRows(New Structure("Employee, AccrualDeductionKind", TabularSectionLine.Employee, TabularSectionLine.AccrualDeductionKind));
- If ArrayOfRepeats.Count() > 1 And ArrayOfRepeats[0].TotalForPeriod Then
- TabularSectionLine.DaysWorked = 0;
- TabularSectionLine.HoursWorked = 0;
- MessageText = NStr("ru = '%Employee%, %AccrualKind%: Данные об отработанном времени введены сводно. Расчет времени по каждому виду начисления (удержания) невозможен!'; en = '%Employee%, %AccrualKind%: Data on the worked time has been entered in a pivot table. Time calculation by each accrual cannot be done.'");
- MessageText = StrReplace(MessageText, "%Employee%", TabularSectionLine.Employee);
- MessageText = StrReplace(MessageText, "%AccrualKind%", TabularSectionLine.AccrualDeductionKind);
- MessageField = "Object.AccrualsDeductions[" + Object.AccrualsDeductions.IndexOf(TabularSectionLine) + "].Employee";
- SmallBusinessServer.ShowMessageAboutError(Object, MessageText,,,MessageField);
- EndIf;
- // 2. Clearing
- For Counter = 1 To 3 Do
- TabularSectionLine["Indicator" + Counter] = "";
- TabularSectionLine["Presentation" + Counter] = Catalogs.CalculationParameters.EmptyRef();
- TabularSectionLine["Value" + Counter] = 0;
- EndDo;
- // 3. Search all parameters-identifiers of formula
- ParametersStructure = New Structure;
- SmallBusinessServer.AddParametersToStructure(TabularSectionLine.AccrualDeductionKind.Formula, ParametersStructure);
- //--> BIT CP-465 GOTolok@firstbit.ae 21.03.18 - text
- ParametersStructure.Insert("PR");
- ParametersStructure.Insert("PRForSPA");
- If Not ParametersStructure.Property("SESPA") Then
- ParametersStructure.Insert("SESPA");
- EndIf;
- If Not ParametersStructure.Property("SESP") Then
- ParametersStructure.Insert("SESP");
- EndIf;
- If Not ParametersStructure.Property("TargetMin") Then
- ParametersStructure.Insert("TargetMin");
- EndIf;
- If Not ParametersStructure.Property("TargetMax") Then
- ParametersStructure.Insert("TargetMax");
- EndIf;
- ParametersStructure.Insert("Param21");
- ParametersStructure.Insert("Param22");
- ParametersStructure.Insert("Param31");
- ParametersStructure.Insert("Param211");
- ParametersStructure.Insert("Param212");
- ParametersStructure.Insert("Param321");
- ParametersStructure.Insert("Param322");
- EmployeeNameStructure = New Structure;
- //<-- BIT CP-465 GOTolok@firstbit.ae 21.03.18
- // 4. Add indicator
- Counter = 1; // BIT CP-465 GOTolok@firstbit.ae 21.03.18
- For Each StructureParameter In ParametersStructure Do
- If StructureParameter.Key = "DaysWorked"
- OR StructureParameter.Key = "HoursWorked"
- OR StructureParameter.Key = "TariffRate" Then
- Continue;
- EndIf;
- CalculationParameter = Catalogs.CalculationParameters.FindByAttribute("Id", StructureParameter.Key);
- If NOT ValueIsFilled(CalculationParameter) Then
- Message = New UserMessage();
- Message.Text = NStr("ru = 'Не найден параметр'; en = 'Parameter not found'") + CalculationParameter + NStr("ru = 'для сотрудника в строке №'; en = 'for the employee in the line #'") + (Object.AccrualsDeductions.IndexOf(TabularSectionLine) + 1);
- Message.Message();
- EndIf;
- //--> BIT CP-465 GOTolok@firstbit.ae 20.03.18 - If the parameter is obtained by a query, then there is no need to display it.
- // If the parameter is obtained by a query, then calculate it.
- If Not CalculationParameter.SetValueDuringPayrollCalculation Then
- EmployeeNameStructure.Insert(StructureParameter.Key, SmallBusinessServer.CalculateParameterValue(FiltersStructure, CalculationParameter, NStr("ru = 'для сотрудника в строке №'; en = 'for the employee in the line #'") + (Object.AccrualsDeductions.IndexOf(TabularSectionLine) + 1)));
- Continue;
- EndIf;
- //<-- BIT CP-465 GOTolok@firstbit.ae 20.03.18
- If Counter > 3 Then
- Continue; // BIT CP-465 GOTolok@firstbit.ae 21.03.18 - proceed to the next parameter
- EndIf;
- TabularSectionLine["Indicator" + Counter] = StructureParameter.Key;
- TabularSectionLine["Presentation" + Counter] = CalculationParameter;
- //--> BIT CP-465 GOTolok@firstbit.ae 21.03.18
- Counter = Counter + 1;
- //<-- BIT CP-465 GOTolok@firstbit.ae 21.03.18
- // 5. Calculate indicator
- // BIT CP-465 GOTolok@firstbit.ae 21.03.18 - block deleted, code is put into function FillFiltersStructure()
- EndDo;
- //--> BIT CP-465 GOTolok@firstbit.ae 03.04.18
- AdditionalParametersStructure.Insert("_" + Format(TabularSectionLine.Employee.Code) + "_" + Format(StrReplace(TabularSectionLine.AccrualDeductionKind.Code, "-", "")), EmployeeNameStructure);
- //<-- BIT CP-465 GOTolok@firstbit.ae 03.04.18
- EndDo;
- RefreshFormFooter();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement