-
-
Save jvanhoesen/030ee7529c1bd8aa45da04166cfc059a to your computer and use it in GitHub Desktop.
EPApproval RowInserting Additional Information
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Set additional information on the approval record for the approver | |
/// </summary> | |
protected virtual void _(Events.RowInserting<EPApproval> e) | |
{ | |
if (e.Row is EPApproval) | |
{ | |
AATimeRequest currentTR = Document.Current; | |
if (currentTR != null) | |
{ | |
e.Cache.SetValue<EPApproval.refNoteID>(e.Row, currentTR.NoteID); | |
EPEmployee employee = PXSelect<EPEmployee, Where<EPEmployee.bAccountID, Equal<Required<EPEmployee.bAccountID>>>>.Select(this, currentTR.EmployeeID); | |
if (employee != null) | |
{ | |
e.Cache.SetValue<EPApproval.documentOwnerID>(e.Row, employee.UserID); | |
e.Cache.SetValue<EPApproval.bAccountID>(e.Row, employee.BAccountID); | |
} | |
e.Cache.SetValue<EPApproval.docDate>(e.Row, currentTR.Date); | |
e.Cache.SetValue<EPApproval.descr>(e.Row, currentTR.Description); | |
string details = ""; | |
foreach(AATimeRequestDetail detail in Details.Select()) | |
{ | |
details += string.Format(AdvancedTimeCardMessages.TRApprovalDetails, detail.Date.Value.ToShortDateString(), detail.StartTime.Value.ToShortTimeString(), detail.EndTime.Value.ToShortTimeString()); | |
} | |
e.Cache.SetValue<EPApproval.details>(e.Row, details); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment