-
Notifications
You must be signed in to change notification settings - Fork 638
/
Copy pathAdvanceLetterApplEditCZZ.Page.al
183 lines (167 loc) · 7.54 KB
/
AdvanceLetterApplEditCZZ.Page.al
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
// ------------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// ------------------------------------------------------------------------------------------------
namespace Microsoft.Finance.AdvancePayments;
page 31175 "Advance Letter Appl. Edit CZZ"
{
Caption = 'Advance Letter Application';
PageType = List;
SourceTable = "Advance Letter Application CZZ";
SourceTableTemporary = true;
UsageCategory = None;
LinksAllowed = false;
layout
{
area(content)
{
repeater(General)
{
field("Advance Letter No."; Rec."Advance Letter No.")
{
ApplicationArea = Basic, Suite;
ToolTip = 'Specifies advance letter no.';
NotBlank = true;
trigger OnValidate()
begin
if Rec."Advance Letter No." <> '' then begin
TempAdvanceLetterApplication.Get(Rec."Advance Letter Type", Rec."Advance Letter No.", Rec."Document Type", Rec."Document No.");
Rec.CopyFrom(TempAdvanceLetterApplication);
end
end;
trigger OnLookup(var Text: Text): Boolean
begin
OnBeforeOnLookupAdvanceLetterNo(Rec, TempAdvanceLetterApplication);
if Page.RunModal(Page::"Advance Letter Application CZZ", TempAdvanceLetterApplication) = Action::LookupOK then begin
Rec.CopyFrom(TempAdvanceLetterApplication);
OnAfterOnLookupAdvanceLetterNo(Rec);
end;
end;
}
field("Posting Date"; Rec."Posting Date")
{
ApplicationArea = Basic, Suite;
ToolTip = 'Specifies posting date.';
}
field(Amount; Rec.Amount)
{
ApplicationArea = Basic, Suite;
ToolTip = 'Specifies amount.';
MinValue = 0;
trigger OnValidate()
begin
TempAdvanceLetterApplication.Get(Rec."Advance Letter Type", Rec."Advance Letter No.", Rec."Document Type", Rec."Document No.");
if Rec.Amount > TempAdvanceLetterApplication.Amount then
Error(AmountExceededErr, TempAdvanceLetterApplication.Amount);
end;
}
field("Job No."; Rec."Job No.")
{
ApplicationArea = Basic, Suite;
Visible = false;
}
field("Job Task No."; Rec."Job Task No.")
{
ApplicationArea = Basic, Suite;
Visible = false;
}
}
}
area(FactBoxes)
{
part(SalesAdvLetterFactBox; "Sales Adv. Letter FactBox CZZ")
{
ApplicationArea = Basic, Suite;
SubPageLink = "No." = field("Advance Letter No.");
Visible = Rec."Advance Letter Type" = Rec."Advance Letter Type"::Sales;
}
part(PurchAdvLetterFactBox; "Purch. Adv. Letter FactBox CZZ")
{
ApplicationArea = Basic, Suite;
SubPageLink = "No." = field("Advance Letter No.");
Visible = Rec."Advance Letter Type" = Rec."Advance Letter Type"::Purchase;
}
}
}
actions
{
area(Navigation)
{
action(AdvanceCard)
{
Caption = 'Advance Letter';
ToolTip = 'Show advance letter.';
ApplicationArea = Basic, Suite;
Image = "Invoicing-Document";
trigger OnAction()
var
SalesAdvLetterHeaderCZZ: Record "Sales Adv. Letter Header CZZ";
PurchAdvLetterHeaderCZZ: Record "Purch. Adv. Letter Header CZZ";
begin
if Rec."Advance Letter No." = '' then
exit;
case Rec."Advance Letter Type" of
Rec."Advance Letter Type"::Sales:
begin
SalesAdvLetterHeaderCZZ.Get(Rec."Advance Letter No.");
Page.Run(Page::"Sales Advance Letter CZZ", SalesAdvLetterHeaderCZZ);
end;
Rec."Advance Letter Type"::Purchase:
begin
PurchAdvLetterHeaderCZZ.Get(Rec."Advance Letter No.");
Page.Run(Page::"Purch. Advance Letter CZZ", PurchAdvLetterHeaderCZZ);
end;
end;
end;
}
}
area(Promoted)
{
group(Category_Process)
{
Caption = 'Process';
actionref(AdvanceCard_Promoted; AdvanceCard)
{
}
}
}
}
trigger OnNewRecord(BelowxRec: Boolean)
begin
Rec."Advance Letter Type" := AdvLetterType;
end;
var
TempAdvanceLetterApplication: Record "Advance Letter Application CZZ" temporary;
AdvLetterType: Enum "Advance Letter Type CZZ";
AmountExceededErr: Label 'Only %1 can be used.', Comment = '%1 = Maximal Amount';
procedure InitializeSales(NewFromAdvLetterUsageDocTypeCZZ: Enum "Adv. Letter Usage Doc.Type CZZ"; NewFromDocumentNo: Code[20]; NewBillToCustomerNo: Code[20]; NewPostingDate: Date; NewCurrencyCode: Code[10])
begin
AdvLetterType := AdvLetterType::Sales;
Rec.GetPossibleSalesAdvance(NewFromAdvLetterUsageDocTypeCZZ, NewFromDocumentNo, NewBillToCustomerNo, NewPostingDate, NewCurrencyCode, TempAdvanceLetterApplication);
Rec.GetAssignedAdvance(NewFromAdvLetterUsageDocTypeCZZ, NewFromDocumentNo, Rec);
end;
procedure InitializePurchase(NewFromAdvLetterUsageDocTypeCZZ: Enum "Adv. Letter Usage Doc.Type CZZ"; NewFromDocumentNo: Code[20]; NewPayToVendorNo: Code[20]; NewPostingDate: Date; NewCurrencyCode: Code[10])
begin
AdvLetterType := AdvLetterType::Purchase;
Rec.GetPossiblePurchAdvance(NewFromAdvLetterUsageDocTypeCZZ, NewFromDocumentNo, NewPayToVendorNo, NewPostingDate, NewCurrencyCode, TempAdvanceLetterApplication);
Rec.GetAssignedAdvance(NewFromAdvLetterUsageDocTypeCZZ, NewFromDocumentNo, Rec);
end;
procedure GetAssignedAdvance(var NewAdvanceLetterApplication: Record "Advance Letter Application CZZ")
begin
if Rec.FindSet() then
repeat
if Rec.Amount > 0 then begin
NewAdvanceLetterApplication := Rec;
NewAdvanceLetterApplication.Insert();
end;
until Rec.Next() = 0;
end;
[IntegrationEvent(true, false)]
local procedure OnBeforeOnLookupAdvanceLetterNo(var AdvanceLetterApplicationCZZ: Record "Advance Letter Application CZZ"; var TempAdvanceLetterApplicationCZZ: Record "Advance Letter Application CZZ" temporary)
begin
end;
[IntegrationEvent(false, false)]
local procedure OnAfterOnLookupAdvanceLetterNo(var AdvanceLetterApplicationCZZ: Record "Advance Letter Application CZZ")
begin
end;
}