page 50153 "Vendor Payment"
{
PageType = List;
ApplicationArea = All;
UsageCategory = Lists;
SourceTable = "Vendor Ledger Entry";
SourceTableView = where("Document Type" = const(Invoice), "Remaining Amount" = filter(< 0), "Vendor Posting Group" = filter(<> 'BRANCH'));
InsertAllowed = false;
DeleteAllowed = false;
Permissions = tabledata "Vendor Ledger Entry" = M, tabledata "Payment Terms Line Purchase" = M, tabledata "Item Ledger Entry" = RM;
layout
{
area(Content)
{
repeater(GroupName)
{
field("Posting Date"; Rec."Posting Date")
{
ApplicationArea = All;
Editable = false;
}
field("Document Date"; Rec."Document Date")
{
ApplicationArea = All;
Editable = false;
}
field("Due Date"; Rec."Due Date")
{
ApplicationArea = All;
Editable = IsEditable;
}
field("Prepayment Due Date"; Rec."Prepayment Due Date")
{
ApplicationArea = all;
Caption = 'Prepayment Due Date';
Editable = false;
}
field("Document Type"; Rec."Document Type")
{
ApplicationArea = All;
Editable = false;
}
field("Document No."; Rec."Document No.")
{
ApplicationArea = All;
Editable = false;
}
field("Approval Status"; Rec."Approval Status")
{
ApplicationArea = All;
Editable = false;
Caption = 'Payment Approval';
}
field("Sender ID"; Rec."Sender ID")
{
ApplicationArea = all;
Editable = false;
Visible = calforApprove;
}
field("Approver ID"; Rec."Approver ID")
{
ApplicationArea = all;
Editable = false;
//Visible = calforApprove;
}
// field("Item Category"; ItemCategory)
// {
// ApplicationArea = all;
// Editable = false;
// }
field("Item Category Code"; Rec."Item Category Code")
{
ApplicationArea = All;
Editable = false;
}
field("External Document No."; Rec."External Document No.")
{
ApplicationArea = All;
Editable = false;
}
field("Reference Document No."; Rec."Reference Document No.")
{
ApplicationArea = All;
Editable = false;
}
field("Vendor No."; Rec."Vendor No.")
{
ApplicationArea = All;
Editable = false;
}
field("Vendor Name"; Rec."Vendor Name")
{
ApplicationArea = All;
Editable = false;
}
field("Global Dimension 2 Code"; Rec."Global Dimension 2 Code")
{
ApplicationArea = All;
Editable = false;
}
field("Global Dimension 1 Code"; Rec."Global Dimension 1 Code")
{
ApplicationArea = All;
Editable = false;
}
field("Project Name"; ProjectName)
{
ApplicationArea = all;
Editable = false;
}
field("Shortcut Dimension 3 Code"; Rec."Shortcut Dimension 3 Code")
{
ApplicationArea = All;
Editable = false;
}
field("Shortcut Dimension 4 Code"; Rec."Shortcut Dimension 4 Code")
{
ApplicationArea = All;
Editable = false;
}
// field("Shortcut Dimension 5 Code"; Rec."Shortcut Dimension 5 Code")
// {
// ApplicationArea = All;
// Editable = false;
// }
field(Department; Rec.Department)
{
ApplicationArea = All;
Editable = false;
}
field("Shortcut Dimension 8 Code"; Rec."Shortcut Dimension 8 Code")
{
ApplicationArea = All;
Editable = false;
}
field(Amount; Rec.Amount)
{
ApplicationArea = All;
Editable = false;
}
field("Remaining Amount"; Rec."Remaining Amount")
{
ApplicationArea = All;
Editable = false;
}
field("To be Paid"; Rec."To be Paid")
{
ApplicationArea = all;
trigger OnValidate()
begin
if Rec."To be Paid" > Abs(Rec."Remaining Amount") then
Error('To be Paid Must be Less than or equal to Remaining Amount!');
end;
}
field("Payment On Hold"; Rec."Payment On Hold")
{
ApplicationArea = All;
Editable = false;//calfromBankPay;
}
field("Payment Rejection Comment"; Rec."Payment Rejection Comment")
{
ApplicationArea = All;
Editable = false;//calfromBankPay;
}
field("Payment Rejected"; Rec."Payment Rejected")
{
ApplicationArea = All;
Editable = false;// calfromBankPay;
trigger OnValidate()
var
myInt: Integer;
begin
if Rec."Payment Rejected" then begin
Rec.TestField("Payment Rejection Comment");
Rec."Approval Status" := Rec."Approval Status"::Open;
Rec."Payment Rejected" := false;
CurrPage.Update();
end
else if Rec."Payment Rejection Comment" <> '' then
Error('Payment Rejection Comment Must be Blank!');
end;
}
field("Entry No."; Rec."Entry No.")
{
ApplicationArea = All;
Editable = false;
}
field(Open; Rec.Open)
{
ApplicationArea = All;
Editable = false;
}
field("Location Code"; Rec."Location Code")
{
ApplicationArea = All;
Editable = false;
}
field("Payment Entry Created"; Rec."Payment Entry Created")
{
ApplicationArea = all;
Editable = false;
}
field("PO Remarks"; PORemarks)
{
ApplicationArea = all;
Editable = false;
}
}
}
area(Factboxes)
{
}
}
actions
{
area(Processing)
{
action(SendApprovalRequest)
{
ApplicationArea = all;
Caption = 'Send A&pproval Request';
Image = SendApprovalRequest;
Visible = calforsendap;
Promoted = true;
PromotedCategory = Process;
PromotedIsBig = true;
ToolTip = 'Executes the Send A&pproval Request action.';
trigger OnAction()
var
WorkflowEvent: Codeunit "Workflow Events";
vendLedEntry: Record "Vendor Ledger Entry";
GenEvent: Codeunit "General Events";
begin
IF WorkflowEvent.CheckVendorPaymentApprovalsWorkflowEnabled(Rec) THEN begin
CurrPage.SetSelectionFilter(vendLedEntry);
if vendLedEntry.FindSet() then
repeat
//RKS290126-
vendLedEntry.CalcFields("Remaining Amount");
if vendLedEntry."To be Paid" = 0 then
GenEvent.CheckPOPayment(vendLedEntry."Reference Document No.", -1 * ROUND(vendLedEntry."Remaining Amount", 0.01, '='))
else begin
if vendLedEntry."To be Paid" > Abs(vendLedEntry."Remaining Amount") then
Error('To be Paid Must be Less than or equal to Remaining Amount! Doc No:- %1', vendLedEntry."Document No.");
GenEvent.CheckPOPayment(vendLedEntry."Reference Document No.", ROUND(ABS(vendLedEntry."To be Paid"), 0.01, '='));
end;
//RKS290126+
WorkflowEvent.OnSendVendorPaymentForApproval(vendLedEntry);
until vendLedEntry.Next() = 0;
end;
end;
}
action(CancelApprovalRequest)
{
ApplicationArea = all;
Caption = 'Cancel Approval Re&quest';
Image = Cancel;
Promoted = true;
Visible = calforsendap;
PromotedCategory = Process;
PromotedIsBig = true;
ToolTip = 'Executes the Cancel Approval Re&quest action.';
trigger OnAction()
var
WorkflowEvent: Codeunit "Workflow Events";
vendLedEntry: Record "Vendor Ledger Entry";
begin
CurrPage.SetSelectionFilter(vendLedEntry);
if vendLedEntry.FindSet() then
repeat
WorkflowEvent.OnCancelVendorPaymentForApproval(vendLedEntry);
until vendLedEntry.Next() = 0;
//WorkflowEvent.OnCancelVendorPaymentForApproval(Rec);
end;
}
action(Approve)
{
ApplicationArea = all;
Caption = 'Approve';
Image = Approve;
Promoted = true;
PromotedCategory = Process;
PromotedIsBig = true;
Visible = calforApprove;
ToolTip = 'Approve the requested changes.';
trigger OnAction()
var
ApprovalsMgmt: Codeunit "Approvals Mgmt.";
vendLedEntry: Record "Vendor Ledger Entry";
begin
CurrPage.SetSelectionFilter(vendLedEntry);
if vendLedEntry.FindSet() then
repeat
ApprovalsMgmt.ApproveRecordApprovalRequest(vendLedEntry.RecordId);
until vendLedEntry.Next() = 0;
end;
}
action(Reject)
{
ApplicationArea = all;
Caption = 'Reject';
Image = Approve;
Promoted = true;
PromotedCategory = Process;
PromotedIsBig = true;
Visible = calforApprove;
ToolTip = 'Reject the requested changes.';
trigger OnAction()
var
ApprovalsMgmt: Codeunit "Approvals Mgmt.";
vendLedEntry: Record "Vendor Ledger Entry";
begin
CurrPage.SetSelectionFilter(vendLedEntry);
if vendLedEntry.FindSet() then
repeat
ApprovalsMgmt.RejectRecordApprovalRequest(vendLedEntry.RecordId);
until vendLedEntry.Next() = 0;
end;
}
action(Comments)
{
ApplicationArea = All;
Caption = 'Comments';
Image = ViewComments;
Promoted = true;
PromotedCategory = Process;
PromotedIsBig = true;
Visible = calforApprove;
ToolTip = 'View or add comments for the record.';
trigger OnAction()
var
ApprovalsMgmt: Codeunit "Approvals Mgmt.";
RecRef: RecordRef;
AppEntry: Record "Approval Entry";
begin
AppEntry.Reset();
AppEntry.SetRange("Table ID", 25);
AppEntry.SetRange("Record ID to Approve", Rec.RecordID);
AppEntry.SetRange(Status, AppEntry.Status::Open);
AppEntry.SetRange("Approver ID", UserId);
AppEntry.SetRange("Related to Change", false);
if AppEntry.FindFirst() then begin
RecRef.Get(AppEntry."Record ID to Approve");
Clear(ApprovalsMgmt);
ApprovalsMgmt.GetApprovalCommentForWorkflowStepInstanceID(RecRef, AppEntry."Workflow Step Instance ID");
end;
end;
}
action(Approvals)
{
AccessByPermission = TableData "Approval Entry" = R;
ApplicationArea = Suite;
Caption = 'Approvals';
Image = Approvals;
Promoted = true;
PromotedCategory = Process;
PromotedIsBig = true;
//Visible = calforApprove;
ToolTip = 'View a list of the records that are waiting to be approved. For example, you can see who requested the record to be approved, when it was sent, and when it is due to be approved.';
trigger OnAction()
var
ApprovalsMgmt: Codeunit "Approvals Mgmt.";
begin
ApprovalsMgmt.OpenApprovalEntriesPage(Rec.RecordId);
end;
}
action("Create Bank Payment Voucher")
{
ApplicationArea = all;
Caption = 'Create Bank Payment Voucher';
Visible = ShowButton;
Promoted = true;
PromotedCategory = Process;
trigger OnAction()
var
GenJournalLine: Record "Gen. Journal Line";
GenJournalTemplate: Record "Gen. Journal Template";
GenJournalBatch: Record "Gen. Journal Batch";
// PurchaseHeader: Record "Purchase Header";
PurchasesPayablesSetup: Record "Purchases & Payables Setup";
DocumentNo: Code[20];
NoSeriesBatch: Codeunit "No. Series - Batch";
LineNo: Integer;
BankPaymentVoucher: Page "Bank Payment Voucher";
PurchaseLine: Record "Purchase Line";
VLE: Record "Vendor Ledger Entry";
VLE1: Record "Vendor Ledger Entry";
PPI: Record "Purch. Inv. Header";
OrderAddress: Record "Order Address";
VendorBankAccount: Record "Vendor Bank Account";
Vendor: Record Vendor;
NatureOfVendor: Record "Nature Of Vendor";
GenEvent: Codeunit "General Events";
TDSCode: code[10];
CentreCode: code[20];
begin
IF CONFIRM('Do you want to create payment Entries for Selected Lines') THEN BEGIN
DocumentNo := '';
PurchasesPayablesSetup.GET;
GenJournalTemplate.GET('BANK PAYM');
GenJournalBatch.GET('BANK PAYM', Rec."Global Dimension 2 Code" + '-' + 'BP');
GenJournalBatch.TESTFIELD("No. Series");
GenJournalBatch.TESTFIELD("Posting No. Series");
LineNo := 0;
GenJournalLine.RESET;
GenJournalLine.SETRANGE("Journal Template Name", 'BANK PAYM');
GenJournalLine.SETRANGE("Journal Batch Name", Rec."Global Dimension 2 Code" + '-' + 'BP');
IF GenJournalLine.FINDLAST THEN begin
LineNo := GenJournalLine."Line No.";
DocumentNo := GenJournalLine."Document No.";
end;
Clear(CentreCode);
CurrPage.SetSelectionFilter(VLE1);
if VLE1.FindFirst() then
repeat
if CentreCode <> '' then begin
if CentreCode <> VLE1."Global Dimension 2 Code" then
Error('Please select only one centre.');
end;
CentreCode := VLE1."Global Dimension 2 Code";
until VLE1.Next() = 0;
if DocumentNo = '' then
//DocumentNo := NoSeries.GetNextNo(GenJournalBatch."No. Series", TODAY, false)
DocumentNo := NoSeriesBatch.PeekNextNo(GenJournalBatch."No. Series", TODAY)
else
DocumentNo := IncStr(DocumentNo);
CurrPage.SetSelectionFilter(VLE);
if VLE.FindFirst() then
repeat
VLE.CalcFields("Payment Entry Created", "Remaining Amount");
VLE.TestField("Payment Entry Created", false);
VLE.TestField("Payment On Hold", false);
//RKS030326-
if VLE.Department <> 'SP ELECTRICAL' then
if VLE."Due Date" > Today then
Error('Due Date Must be Less Than Today for Doc. %1', VLE."Document No.");
//RKS030326+
if VLE."To be Paid" = 0 then
GenEvent.CheckPOPayment(VLE."Reference Document No.", -1 * ROUND(VLE."Remaining Amount", 0.01, '='))
else begin
if VLE."To be Paid" > Abs(VLE."Remaining Amount") then
Error('To be Paid Must be Less than or equal to Remaining Amount! Doc No:- %1', VLE."Document No.");
GenEvent.CheckPOPayment(VLE."Reference Document No.", ROUND(ABS(VLE."To be Paid"), 0.01, '='));
end;
GenJournalLine.INIT;
GenJournalLine."Journal Template Name" := 'BANK PAYM';
GenJournalLine."Journal Batch Name" := VLE."Global Dimension 2 Code" + '-' + 'BP';
GenJournalLine."Document No." := DocumentNo;
GenJournalLine."Line No." := LineNo + 10000;
GenJournalLine.VALIDATE("Posting Date", TODAY);
GenJournalLine.VALIDATE("Document Date", TODAY);
GenJournalLine.VALIDATE("Document Type", GenJournalLine."Document Type"::Payment);
GenJournalLine."Document No." := DocumentNo;
GenJournalLine.VALIDATE("Party Type", GenJournalLine."Party Type"::Vendor);
GenJournalLine.VALIDATE("Party Code", VLE."Vendor No.");
if VLE."To be Paid" = 0 then
GenJournalLine.VALIDATE(Amount, -1 * ROUND(VLE."Remaining Amount", 0.01, '='))
else
GenJournalLine.VALIDATE(Amount, ROUND(ABS(VLE."To be Paid"), 0.01, '='));
GenJournalLine."Source Code" := 'BANKPYMTV';
GenJournalLine."Bill-to/Pay-to No." := VLE."Vendor No.";
GenJournalLine."External Document Date" := TODAY;
GenJournalLine."Ref. Document Type" := GenJournalLine."Ref. Document Type"::Order;
GenJournalLine."Reference Document No." := VLE."Reference Document No.";
GenJournalLine."Responsibility Center" := VLE."Responsibility Center"; // ALLE AKUL ADD 080224
GenJournalLine."Posting Type" := GenJournalLine."Posting Type"::Running; // ALLE AKUL ADD 080224
GenJournalLine.VALIDATE("Bal. Account Type", GenJournalLine."Bal. Account Type"::"Bank Account");
IF GenJournalTemplate."Bal. Account Type" = GenJournalTemplate."Bal. Account Type"::"Bank Account" THEN
GenJournalLine.VALIDATE("Bal. Account No.", GenJournalTemplate."Bal. Account No.");
GenJournalLine."Transaction Type" := GenJournalLine."Transaction Type"::Purchase;
GenJournalLine."Initiator User ID" := USERID;
GenJournalLine.VALIDATE("Shortcut Dimension 1 Code", Rec."Global Dimension 1 Code");
GenJournalLine."Posting No. Series" := GenJournalBatch."Posting No. Series";
GenJournalLine."Shortcut Dimension 2 Code" := VLE."Global Dimension 2 Code";
GenJournalLine.Validate("Applies-to Doc. Type", GenJournalLine."Applies-to Doc. Type"::Invoice);
//GenJournalLine.Validate("Applies-to Doc. No.", VLE."Document No.");
GenJournalLine."Applies-to Doc. No." := VLE."Document No.";
GenJournalLine."VLE No." := VLE."Entry No.";
GenJournalLine."Auto Payment" := true;
GenJournalLine.INSERT;
LineNo := GenJournalLine."Line No.";
GenJournalLine.VALIDATE("Ref. Job No.");
GenJournalLine.VALIDATE("Posting Type");
GenJournalLine.Validate("Location Code", VLE."Location Code");
//RKS231025-
Vendor.Reset();
Vendor.get(VLE."Vendor No.");
if Vendor."Nature Of Vendor" <> '' then begin
NatureOfVendor.Reset();
NatureOfVendor.Get(Vendor."Nature Of Vendor");
if NatureOfVendor."Allow BankAcc Order Address" then begin
PPI.Reset();
PPI.SetRange("No.", VLE."Document No.");
if PPI.FindFirst() then begin
if PPI."Order Address Code" <> '' then begin
VendorBankAccount.Reset();
VendorBankAccount.SetRange("Vendor No.", VLE."Vendor No.");
VendorBankAccount.SetRange("Order Address Code", PPI."Order Address Code");
if VendorBankAccount.FindFirst() then
GenJournalLine."Recipient Bank Account" := VendorBankAccount.Code;
end;
end;
end;
end;
//RKS231025+
GenJournalLine.MODIFY;
DocumentNo := IncStr(DocumentNo);
until VLE.Next() = 0;
END ELSE
MESSAGE('Cancelled By User');
end;
}
action("Bank Payment Voucher")
{
ApplicationArea = all;
Caption = 'Bank Payment Voucher';
Visible = ShowButton;
Promoted = true;
PromotedCategory = Process;
RunObject = page "Bank Payment Voucher";
}
action("MarkHold")
{
ApplicationArea = all;
Caption = 'Mark Hold';
Visible = ShowButton;//ShowButton;
Promoted = true;
PromotedCategory = Process;
trigger OnAction()
var
VLE: Record "Vendor Ledger Entry";
begin
CurrPage.SetSelectionFilter(VLE);
if VLE.FindFirst() then
repeat
VLE."Payment On Hold" := true;
VLE.Modify(false);
until VLE.Next() = 0;
end;
}
action("MarkUnHold")
{
ApplicationArea = all;
Caption = 'Mark UnHold';
Visible = ShowButton;
Promoted = true;
PromotedCategory = Process;
trigger OnAction()
var
VLE: Record "Vendor Ledger Entry";
begin
CurrPage.SetSelectionFilter(VLE);
if VLE.FindFirst() then
repeat
VLE."Payment On Hold" := false;
VLE.Modify(false);
until VLE.Next() = 0;
end;
}
action("RejectPayment")
{
ApplicationArea = all;
Caption = 'Reject Payment';
Visible = ShowButton;
Promoted = true;
PromotedCategory = Process;
trigger OnAction()
var
VLE: Record "Vendor Ledger Entry";
begin
CurrPage.SetSelectionFilter(VLE);
if VLE.FindFirst() then
repeat
VLE.TestField("Payment Rejection Comment");
VLE."Approval Status" := VLE."Approval Status"::Open;
VLE."Payment Rejected" := false;
VLE.Modify(false);
until VLE.Next() = 0;
CurrPage.Update();
end;
}
action("RejectionComment")
{
ApplicationArea = all;
Caption = 'Input Rejection Comment';
Visible = ShowButton;
Promoted = true;
PromotedCategory = Process;
trigger OnAction()
var
VLE: Record "Vendor Ledger Entry";
InpComPage: page "Input Payment Rejec. Comment";
RejComent: text[100];
begin
CurrPage.SetSelectionFilter(VLE);
if VLE.FindFirst() then
repeat
Clear(RejComent);
Clear(InpComPage);
InpComPage.RunModal();
InpComPage.GetComment(RejComent);
if RejComent = '' then
Error('Please Input Rejction Comment!');
VLE."Payment Rejection Comment" := RejComent;
VLE.Modify(false);
until VLE.Next() = 0;
end;
}
action("UpdateDepartment")
{
ApplicationArea = all;
Caption = 'Update Department/ItemCate';
Promoted = true;
PromotedCategory = Process;
trigger OnAction()
var
PurOrd: Record "Purchase Header";
PurchInvHead: Record "Purch. Inv. Header";
VlE: Record "Vendor Ledger Entry";
begin
VlE.Reset();
VlE.SetRange("Document Type", VlE."Document Type"::Invoice);
VlE.SetRange(Department, '');
if VlE.FindSet() then
repeat
PurchInvHead.Reset();
PurchInvHead.SetRange("No.", VlE."Document No.");
if PurchInvHead.FindFirst() then begin
PurOrd.Reset();
PurOrd.SetRange("No.", PurchInvHead."Order No.");
if PurOrd.FindFirst() then begin
VlE.Department := PurOrd."Department";
VlE.Modify();
end;
end;
until VlE.Next() = 0;
VlE.Reset();
VlE.SetRange("Document Type", VlE."Document Type"::Invoice);
VlE.SetRange(VlE."Item Category Code", '');
if VlE.FindSet() then
repeat
PurchInvHead.Reset();
PurchInvHead.SetRange("No.", VlE."Document No.");
if PurchInvHead.FindFirst() then begin
PurOrd.Reset();
PurOrd.SetRange("No.", PurchInvHead."Order No.");
if PurOrd.FindFirst() then begin
VlE."Item Category Code" := PurOrd."Item Category Code";
VlE.Modify();
end;
end;
until VlE.Next() = 0;
Message('Updated!');
end;
}
action("UpdateSender")
{
ApplicationArea = all;
Caption = 'Update Sender ID';
Promoted = true;
PromotedCategory = Process;
trigger OnAction()
var
VlE: Record "Vendor Ledger Entry";
PTLP: Record "Payment Terms Line Purchase";
ApproEntry: Record "Approval Entry";
RecRef: RecordRef;
Variant: Variant;
begin
ApproEntry.Reset();
//ApproEntry.SetRange("Approver ID", USERID);
ApproEntry.SetFilter("Table ID", '%1|%2', Database::"Vendor Ledger Entry", Database::"Payment Terms Line Purchase");
ApproEntry.SetRange("Status", ApproEntry.Status::Open);
ApproEntry.SetRange("Related to Change", false);
if ApproEntry.FindSet() then begin
repeat
if RecRef.Get(ApproEntry."Record ID to Approve") then begin
case ApproEntry."Table ID" of
database::"Vendor Ledger Entry":
begin
Variant := RecRef;
VlE := Variant;
VlE."Sender ID" := ApproEntry."Sender ID";
VlE.Modify();
end;
database::"Payment Terms Line Purchase":
begin
Variant := RecRef;
PTLP := Variant;
PTLP."Sender ID" := ApproEntry."Sender ID";
PTLP.Modify();
end;
end;
end;
until ApproEntry.Next() = 0;
end;
end;
}
//
action("UpdateOrderNo")
{
ApplicationArea = all;
Caption = 'Update OrderNo Payment Term Line Purch.';
Promoted = true;
PromotedCategory = Process;
trigger OnAction()
var
PaymentTermLinePurch: Record "Payment Terms Line Purchase";
begin
PaymentTermLinePurch.Reset();
PaymentTermLinePurch.SetRange("Table ID", 38);
PaymentTermLinePurch.SetRange("Transaction Type", PaymentTermLinePurch."Transaction Type"::Purchase);
PaymentTermLinePurch.SetRange("Document Type", PaymentTermLinePurch."Document Type"::Order);
PaymentTermLinePurch.SetRange("Main Payment Type", PaymentTermLinePurch."Main Payment Type"::Advance);
PaymentTermLinePurch.SetRange(Status, PaymentTermLinePurch.Status::Released);
if PaymentTermLinePurch.FindSet() then
repeat
PaymentTermLinePurch."Order No." := PaymentTermLinePurch."Document No.";
PaymentTermLinePurch.Modify();
until PaymentTermLinePurch.Next() = 0;
Message('Updated!');
end;
}
//temp
action(UpdateFloorcode)
{
ApplicationArea = all;
Caption = 'Update Floor code ILE';
Image = UpdateDescription;
Promoted = true;
PromotedCategory = Process;
Visible = isVisble;
trigger OnAction()
var
ILE: Record "Item Ledger Entry";
GPH: Record "Gate Pass Header";
begin
GPH.Reset();
GPH.SetRange("Document Type", GPH."Document Type"::MIN);
GPH.SetRange(Status, GPH.Status::Close);
GPH.SetFilter("Floor Code", '<>%1', '');
if GPH.FindSet() then
repeat
ILE.Reset();
ILE.SetRange("Document No.", GPH."Document No.");
if ILE.FindSet() then
repeat
ILE."Floor Code" := GPH."Floor Code";
ILE."Floor Name" := GPH."Floor Name";
ILE.Modify();
until ILE.Next() = 0;
until GPH.Next() = 0;
Message('Updated!');
end;
}
}
}
trigger OnOpenPage()
var
UserSetup: Record "User Setup";
begin
UserSetup.Get(UserId);
Rec.FilterGroup(2);
if not UserSetup."Access to All Department" then begin
if UserSetup."Department Filter" <> '' then
//Rec.SetFilter("Shortcut Dimension 5 Code", UserSetup."Department Filter")
Rec.SetFilter(Department, UserSetup."Department Filter")
else
//Rec.SetRange("Shortcut Dimension 5 Code", UserSetup.Department);
Rec.SetRange(Department, UserSetup.Department);
end;
Rec.FilterGroup(0);
UserSetup.Get(UserId);
if UserSetup."Create Advance Bank Payment" then
ShowButton := true
else
ShowButton := false;
if (calfromBankPay) and (ShowButton) then
ShowButton := true
else
ShowButton := false;
//temp
if UserId in ['GAURAV.CHOUDHARY', 'MONU.MISHRA', 'ANKIT.AGARWAL', 'SW_D365_BC'] then
isVisble := true;
if UserSetup."AllowEdit DueDate onVend.Paymt" then
IsEditable := true
else
IsEditable := false;
end;
trigger OnAfterGetRecord()
var
//PurOrd: Record "Purch. Inv. Header";
begin
// PurOrd.SetRange("No.", Rec."Document No.");
// if PurOrd.FindFirst() then
// Rec."Shortcut Dimension 5 Code" := PurOrd."Department";
PH.Reset();
PH.SetRange("No.", Rec."Reference Document No.");
if PH.FindFirst() then begin
PORemarks := PH.Remarks;
ItemCategory := PH."Item Category Code";
end else begin
PORemarks := '';
ItemCategory := '';
end;
if Job.Get(Rec."Global Dimension 1 Code") then
ProjectName := Job.Description
else
ProjectName := '';
// if Rec."To be Paid" = 0 then
// Rec."To be Paid" := abs(Rec."Remaining Amount");//RKS150725
if Rec."Approval Status" = Rec."Approval Status"::Open then begin
Rec."To be Paid" := abs(Rec."Remaining Amount");
end else begin
if Rec."To be Paid" = 0 then
Rec."To be Paid" := abs(Rec."Remaining Amount");//RKS150725
end;
end;
procedure CalformApprove(calApp: Boolean)
begin
calforApprove := calApp;
end;
procedure CalforSendApp(Calsend: Boolean)
begin
calforsendap := Calsend;
end;
procedure CalforBankPay(BankPay: Boolean)
begin
calfromBankPay := BankPay;
end;
var
PH: Record "Purchase Header";
Job: Record Job;
PORemarks: Text;
ItemCategory: code[20];
ProjectName: Text[500];
ApprovalEntry: Record "Approval Entry";
calforApprove: Boolean;
calforsendap: Boolean;
calfromBankPay: Boolean;
ShowButton: Boolean;
isVisble: Boolean;
IsEditable: Boolean;
}
page takes approximate 5-10 mins to open