-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCreateNewPrice.Page.al
104 lines (96 loc) · 2.99 KB
/
CreateNewPrice.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
page 50100 "Create New Price"
{
Caption = 'Create New Price';
PageType = Card;
ApplicationArea = All;
layout
{
area(content)
{
field(PriceListCodeSale; PriceListCode)
{
Caption = 'Price List Code';
TableRelation = "Price List Header" where("Price Type" = const(Sale));
Visible = PriceType = PriceType::Sale;
}
field(CustomerNo; CustomerNo)
{
Caption = 'Customer No.';
TableRelation = Customer."No.";
Visible = PriceType = PriceType::Sale;
}
field(PriceListCodePurchase; PriceListCode)
{
Caption = 'Price List Code';
TableRelation = "Price List Header" where("Price Type" = const(Purchase));
Visible = PriceType = PriceType::Purchase;
}
field(VendorNo; VendorNo)
{
Caption = 'Vendor No.';
TableRelation = Vendor."No.";
Visible = PriceType = PriceType::Purchase;
}
field(CurrencyCode; CurrencyCode)
{
Caption = 'Currency Code';
TableRelation = Currency.Code;
}
field(UnitPrice; UnitPrice)
{
Caption = 'Unit Price';
Visible = PriceType = PriceType::Sale;
}
field(DirectUnitCost; DirectUnitCost)
{
Caption = 'Direct Unit Cost';
Visible = PriceType = PriceType::Purchase;
}
}
}
trigger OnOpenPage()
begin
if PriceType = PriceType::Sale then
SourceGroup := SourceGroup::Customer
else
SourceGroup := SourceGroup::Vendor;
PriceListCode := PriceListManagement.GetDefaultPriceListCode(PriceType, SourceGroup, true);
end;
var
PriceListManagement: Codeunit "Price List Management";
PriceListCode: Code[20];
CustomerNo: Code[20];
VendorNo: Code[20];
CurrencyCode: Code[10];
UnitPrice: Decimal;
DirectUnitCost: Decimal;
PriceType: Enum "Price Type";
SourceGroup: Enum "Price Source Group";
procedure SetPriceType(NewPriceType: Enum "Price Type")
begin
PriceType := NewPriceType;
end;
procedure GetPriceListCode(): Code[20];
begin
exit(PriceListCode);
end;
procedure GetSourceNo(): Code[20];
begin
if PriceType = PriceType::Sale then
exit(CustomerNo)
else
exit(VendorNo);
end;
procedure GetCurrencyCode(): Code[10];
begin
exit(CurrencyCode);
end;
procedure GetUnitPrice(): Decimal;
begin
exit(UnitPrice);
end;
procedure GetDirectUnitCost(): Decimal;
begin
exit(DirectUnitCost);
end;
}