Nitin Verma,
field("Estimated % Duration Weights"; "Estimated % Duration Weights")
{
ApplicationArea = All;
trigger OnValidate()
var
Job: Record Job;
begin
If Rec."Job Task Type" = "Job Task Type"::Posting then
If Job.Get(Rec."Job No.") then begin
Message('Job is %1 and %2', Job."No.", Job.Description);
End;
If "Job Task Type" = "Job Task Type"::Posting then Begin
Modify();
Reset();
SetCurrentKey("Job No.");
SetRange("Job No.", "Job No.");
SetRange("Job Task Type", "Job Task Type"::Posting);
If Findset() then
Repeat
CalcSums("Estimated % Duration Weights");
CalcFields("Schedule (Total Cost)");
MESSAGE('%1 Weights %2 Budget Cost %3', "Estimated % Duration Weights", "Schedule (Total Cost)", Job."Contract Sum");
If "Estimated % Duration Weights" > 100 then
Error('%1 Weights shouldn''t be greater than 100%!', "Estimated % Duration Weights");
If "Schedule (Total Cost)" > Job."Contract Sum" then
Error('The total lines amount %1 cannot be greater than %2 the contract sum!', "Schedule (Total Cost)", Job."Contract Sum");
Until Next = 1;
CurrPage.Update();
End
else Begin
Error('Percentage Weights can only be applied to Job Tasks of type Posting');
End;
end;
}