Rating:
0
Joined: Oct 7, 2020
Company: ABK Teknik İmalat ve Mühendislik Çözümleri
Hello, I was solving the Test Of the Second Module Of the Junior Developer Course. I think, I did what was requested in step 5. But when I test the program, I get the same error in step 5.
I attached screenshot of the error, Expense document Form and ExpenseType catalog as an attachment
Can you help me?
The request: Create the Other predefined element of the ExpenseTypes Catalog. If a user forgets to specify the expense type for the Expense document, it should be automatically set to Other.
These my codes belong that in Document Expense: Document Form:
Code
&AtServerNoContext
Function ExpenseTypesOther()
Return Catalogs.ExpenseTypes.Other;
EndFunction
&AtClient
Procedure FillingExpenseTypeWithOther()
For Each Line In Object.Details Do
If Line.ExpenseType.IsEmpty() Then
//MyMessage = "ExpenseType is null!!";
//Raise MyMessage;
Line.ExpenseType = ExpenseTypesOther();
EndIf;
EndDo;
EndProcedure
&AtClient
Procedure BeforeClose(Cancel, Exit, MessageText, StandardProcessing)
FillingExpenseTypeWithOther();
EndProcedure
&AtClient
Procedure DetailsAmountOnChange(Item)
FillingExpenseTypeWithOther();
EndProcedure
&AtClient
Procedure BeforeWrite(Cancel, WriteParameters)
FillingExpenseTypeWithOther();
EndProcedure
&AtClient
Procedure DetailsDescriptionOnChange(Item)
FillingExpenseTypeWithOther();
EndProcedure
And my codes belong that in Document Expense: Object Module:
Code
&AtServer
Function ExpenseTypesOther()
Return Catalogs.ExpenseTypes.Other;
EndFunction
Procedure OnWrite(Cancel)
For Each CurRowDetails In Details Do
If CurRowDetails.ExpenseType.IsEmpty() Then
//MyMessage = "ExpenseType is null!!";
//Raise MyMessage;
CurRowDetails.ExpenseType = ExpenseTypesOther();
EndIf;
EndDo;
EndProcedure
Procedure BeforeWrite(Cancel, WriteMode, PostingMode)
ThisObject.Total = 0;
For Each CurRowDetails In Details Do
ThisObject.Total = ThisObject.Total + CurRowDetails.Amount;
If CurRowDetails.ExpenseType.IsEmpty() Then
//MyMessage = "ExpenseType is null!!";
//Raise MyMessage;
CurRowDetails.ExpenseType = ExpenseTypesOther();
EndIf;
EndDo;
EndProcedure