pageextension 60018 jobcardExt extends "Job Card"
{
layout
{
modify("Starting Date")
{
ShowMandatory = true;
}
modify("Ending Date")
{
ShowMandatory = true;
}
modify(Completed)
{
trigger OnAfterValidate()
begin
CheckCompleted();
CurrPage.Update(true);
end;
}
addafter("Project Manager")
{
field("Previous Year Cost"; Rec."Previous Year Cost")
{
ApplicationArea = all;
Editable = IsEditable;
ToolTip = 'Specifies the Prev Yr Cost & Cannot be Editable once Enter and Confirm the value';
Caption = 'Previous Year Cost';
trigger OnValidate()
var
myInt: Integer;
Confirm: Label 'You have added a Prev Yr Cost Amount %1 for the Job %2. It should not be editable once confirmed';
begin
If Rec."Previous Year Cost" <> 0.00 then begin
If not (UserId = 'ANUSUYA') then begin
If Dialog.Confirm(StrSubstNo(Confirm, Rec."Previous Year Cost", Rec."No."), false) then begin
CheckEditable();
CurrPage.Update();
end else
Rec."Previous Year Cost" := 0.00;
end;
end;
end;
}
}
addafter("Previous Year Cost")
{
field("Previous Year Invoice"; Rec."Previous Year Invoice")
{
ApplicationArea = all;
ToolTip = 'Specifies the Prev Yr Inv & Cannot be Editable once Enter and Confirm the value';
Editable = IsEditablePrvInv;
Caption = 'Previous Year Invoice';
trigger OnValidate()
var
myInt: Integer;
Confirm: Label 'You have added a Prev Yr Inv Amount %1 for the Job %2. It should not be editable once confirmed';
begin
If Rec."Previous Year Invoice" <> 0.00 then begin
If not (UserId = 'ANUSUYA') then begin
If Dialog.Confirm(StrSubstNo(Confirm, Rec."Previous Year Invoice", Rec."No."), false) then begin
CheckEditable();
CurrPage.Update();
end else
Rec."Previous Year Invoice" := 0.00;
end;
end;
end;
}
}
addafter("Previous Year Invoice")
{
field("Project Cost"; Rec."Project Cost")
{
ApplicationArea = all;
ToolTip = 'Specifies the Proj Cost & Cannot be Editable once Enter and Confirm the value';
Editable = IsEditablePrvCost;
Caption = 'Project Revenue';
trigger OnValidate()
var
myInt: Integer;
Confirm: Label 'You have added a Cost Amount %1 for the Job %2. It should not be editable once confirmed';
begin
If Rec."Project Cost" <> 0.00 then begin
If not (UserId = 'ANUSUYA') then begin
If Dialog.Confirm(StrSubstNo(Confirm, Rec."Project Cost", Rec."No."), false) then begin
CheckEditable();
CurrPage.Update();
end else
Rec."Project Cost" := 0.00;
end;
end;
end;
}
}
addafter("Project Cost")
{
field("Project Expense"; Rec."Project Expense")
{
ApplicationArea = all;
ToolTip = 'Specifies the Proj Exp & Cannot be Editable once Enter and Confirm the value';
Editable = IsEditablePrjExp;
trigger OnValidate()
var
myInt: Integer;
Confirm: Label 'You have added a Expense Amount %1 for the Job %2. It should not be editable once confirmed';
begin
If Rec."Project Expense" <> 0.00 then begin
If not (UserId = 'ANUSUYA') then begin
If Dialog.Confirm(StrSubstNo(Confirm, Rec."Project Expense", Rec."No."), false) then begin
CheckEditable();
CurrPage.Update();
end else
Rec."Project Expense" := 0.00;
end;
end;
end;
}
}
}
/*CODE FOR ABOVE 4 FIELDS ARE NOT EDITABLE ONCE THEY CONFIRMED, ONLY ONE PERSON CAN EDIT*/
var
[InDataset]
IsEditable: Boolean;
IsEditablePrvInv: Boolean;
IsEditablePrvCost: Boolean;
IsEditablePrjExp: Boolean;
local procedure CheckEditable()
var
UserRec: Record "User Group Member";
begin
If Rec."Previous Year Cost" <> 0 then begin
If UserId = 'ANUSUYA' then
IsEditable := true
else
IsEditable := false;
end else
IsEditable := true;
If Rec."Previous Year Invoice" <> 0 then begin
If UserId = 'ANUSUYA' then
IsEditablePrvInv := true
else
IsEditablePrvInv := false;
end else
IsEditablePrvInv := true;
If Rec."Project Cost" <> 0 then begin
If UserId = 'ANUSUYA' then
IsEditablePrvCost := true
else
IsEditablePrvCost := false;
end else
IsEditablePrvCost := true;
If Rec."Project Expense" <> 0 then begin
If UserId = 'ANUSUYA' then
IsEditablePrjExp := true
else
IsEditablePrjExp := false;
end else
IsEditablePrjExp := true;
end;
/* Code for Disable the Page- Only User group (Job)members should have edit option*/
local procedure CheckCompleted()
var
UserGroupMember: Record "User Group Member";
begin
If Rec.Completed then begin
IF not UserGroupMember.Get('JOB', UserSecurityId(), CompanyName) then begin
CurrPage.Editable := false;
end
else
CurrPage.Editable := true;
end;
end;
trigger OnAfterGetCurrRecord()
begin
var
myInt: Integer;
//CheckCompleted();
CheckEditable()
end;
trigger OnOpenPage()
begin
var
myInt: Integer;
// CheckCompleted();
CheckEditable();
end;
trigger OnAfterGetRecord()
begin
var
myInt: Integer;
// CheckCompleted();
CheckEditable();
end;
/* Code for Making Fieldsd Mandatory */
trigger OnClosePage()
begin
//CheckCompleted();
If Rec."Starting Date" = 0D then
Error('Error');
end;
trigger OnQueryClosePage(CloseAction: Action): Boolean
var
myInt: Integer;
begin
If Rec."Starting Date" = 0D then begin
Error('Please enter the Starting date');
// CloseAction := CloseAction::Cancel;
end;
If Rec."Ending Date" = 0D then begin
Error('Please enter the Ending date');
//CloseAction := CloseAction::Cancel;
end;
end;
}