Advertisement
Guest User

Untitled

a guest
Apr 12th, 2018
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.27 KB | None | 0 0
  1. For each TabularSectionLine In Object.AccrualsDeductions Do
  2.  
  3. //--> BIT CP-465 GOTolok@firstbit.ae 21.03.18 - Fill in the structure for calculating the parameters
  4. FiltersStructure = FillFiltersStructure(TabularSectionLine);
  5. //<-- BIT CP-465 GOTolok@firstbit.ae 21.03.18
  6.  
  7. // 1. Check
  8. If NOT ValueIsFilled(TabularSectionLine.AccrualDeductionKind) Then
  9. Continue;
  10. EndIf;
  11. ArrayOfRepeats = QueryResult.FindRows(New Structure("Employee, AccrualDeductionKind", TabularSectionLine.Employee, TabularSectionLine.AccrualDeductionKind));
  12. If ArrayOfRepeats.Count() > 1 And ArrayOfRepeats[0].TotalForPeriod Then
  13.  
  14. TabularSectionLine.DaysWorked = 0;
  15. TabularSectionLine.HoursWorked = 0;
  16.  
  17. 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.'");
  18. MessageText = StrReplace(MessageText, "%Employee%", TabularSectionLine.Employee);
  19. MessageText = StrReplace(MessageText, "%AccrualKind%", TabularSectionLine.AccrualDeductionKind);
  20. MessageField = "Object.AccrualsDeductions[" + Object.AccrualsDeductions.IndexOf(TabularSectionLine) + "].Employee";
  21.  
  22. SmallBusinessServer.ShowMessageAboutError(Object, MessageText,,,MessageField);
  23.  
  24. EndIf;
  25.  
  26. // 2. Clearing
  27. For Counter = 1 To 3 Do
  28. TabularSectionLine["Indicator" + Counter] = "";
  29. TabularSectionLine["Presentation" + Counter] = Catalogs.CalculationParameters.EmptyRef();
  30. TabularSectionLine["Value" + Counter] = 0;
  31. EndDo;
  32.  
  33. // 3. Search all parameters-identifiers of formula
  34. ParametersStructure = New Structure;
  35. SmallBusinessServer.AddParametersToStructure(TabularSectionLine.AccrualDeductionKind.Formula, ParametersStructure);
  36. //--> BIT CP-465 GOTolok@firstbit.ae 21.03.18 - text
  37. ParametersStructure.Insert("PR");
  38. ParametersStructure.Insert("PRForSPA");
  39. If Not ParametersStructure.Property("SESPA") Then
  40. ParametersStructure.Insert("SESPA");
  41. EndIf;
  42. If Not ParametersStructure.Property("SESP") Then
  43. ParametersStructure.Insert("SESP");
  44. EndIf;
  45. If Not ParametersStructure.Property("TargetMin") Then
  46. ParametersStructure.Insert("TargetMin");
  47. EndIf;
  48. If Not ParametersStructure.Property("TargetMax") Then
  49. ParametersStructure.Insert("TargetMax");
  50. EndIf;
  51. ParametersStructure.Insert("Param21");
  52. ParametersStructure.Insert("Param22");
  53. ParametersStructure.Insert("Param31");
  54. ParametersStructure.Insert("Param211");
  55. ParametersStructure.Insert("Param212");
  56. ParametersStructure.Insert("Param321");
  57. ParametersStructure.Insert("Param322");
  58.  
  59. EmployeeNameStructure = New Structure;
  60. //<-- BIT CP-465 GOTolok@firstbit.ae 21.03.18
  61.  
  62. // 4. Add indicator
  63. Counter = 1; // BIT CP-465 GOTolok@firstbit.ae 21.03.18
  64. For Each StructureParameter In ParametersStructure Do
  65.  
  66. If StructureParameter.Key = "DaysWorked"
  67. OR StructureParameter.Key = "HoursWorked"
  68. OR StructureParameter.Key = "TariffRate" Then
  69. Continue;
  70. EndIf;
  71.  
  72. CalculationParameter = Catalogs.CalculationParameters.FindByAttribute("Id", StructureParameter.Key);
  73. If NOT ValueIsFilled(CalculationParameter) Then
  74. Message = New UserMessage();
  75. Message.Text = NStr("ru = 'Не найден параметр'; en = 'Parameter not found'") + CalculationParameter + NStr("ru = 'для сотрудника в строке №'; en = 'for the employee in the line #'") + (Object.AccrualsDeductions.IndexOf(TabularSectionLine) + 1);
  76. Message.Message();
  77. EndIf;
  78.  
  79. //--> 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.
  80. // If the parameter is obtained by a query, then calculate it.
  81. If Not CalculationParameter.SetValueDuringPayrollCalculation Then
  82. EmployeeNameStructure.Insert(StructureParameter.Key, SmallBusinessServer.CalculateParameterValue(FiltersStructure, CalculationParameter, NStr("ru = 'для сотрудника в строке №'; en = 'for the employee in the line #'") + (Object.AccrualsDeductions.IndexOf(TabularSectionLine) + 1)));
  83. Continue;
  84. EndIf;
  85. //<-- BIT CP-465 GOTolok@firstbit.ae 20.03.18
  86.  
  87. If Counter > 3 Then
  88. Continue; // BIT CP-465 GOTolok@firstbit.ae 21.03.18 - proceed to the next parameter
  89. EndIf;
  90.  
  91. TabularSectionLine["Indicator" + Counter] = StructureParameter.Key;
  92. TabularSectionLine["Presentation" + Counter] = CalculationParameter;
  93.  
  94. //--> BIT CP-465 GOTolok@firstbit.ae 21.03.18
  95. Counter = Counter + 1;
  96. //<-- BIT CP-465 GOTolok@firstbit.ae 21.03.18
  97.  
  98. // 5. Calculate indicator
  99.  
  100. // BIT CP-465 GOTolok@firstbit.ae 21.03.18 - block deleted, code is put into function FillFiltersStructure()
  101.  
  102. EndDo;
  103. //--> BIT CP-465 GOTolok@firstbit.ae 03.04.18
  104. AdditionalParametersStructure.Insert("_" + Format(TabularSectionLine.Employee.Code) + "_" + Format(StrReplace(TabularSectionLine.AccrualDeductionKind.Code, "-", "")), EmployeeNameStructure);
  105. //<-- BIT CP-465 GOTolok@firstbit.ae 03.04.18
  106.  
  107. EndDo;
  108.  
  109. RefreshFormFooter();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement