-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPriceListLine.TableExt.al
More file actions
49 lines (47 loc) · 2.21 KB
/
PriceListLine.TableExt.al
File metadata and controls
49 lines (47 loc) · 2.21 KB
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
tableextension 50100 "Price List Line" extends "Price List Line"
{
var
DeleteMsg: Label 'Do you want to delete selected prices?';
procedure CreateNewPriceListLine(PriceType: Enum "Price Type"; ItemNo: Code[20])
var
PriceListHeader: Record "Price List Header";
PriceListLine: Record "Price List Line";
Item: Record Item;
PriceListManagement: Codeunit "Price List Management";
CreateNewPrice: Page "Create New Price";
PriceListCode: Code[20];
begin
Item.Get(ItemNo);
CreateNewPrice.LookupMode(true);
CreateNewPrice.SetPriceType(PriceType);
if CreateNewPrice.RunModal() = Action::LookupOK then begin
Clear(PriceListLine);
PriceListHeader.Get(CreateNewPrice.GetPriceListCode());
PriceListLine."Price List Code" := PriceListHeader.Code;
PriceListLine.CopyFrom(PriceListHeader);
if PriceType = PriceType::Sale then
PriceListLine."Source Type" := PriceListLine."Source Type"::Customer
else
PriceListLine."Source Type" := PriceListLine."Source Type"::Vendor;
PriceListLine.Validate("Source No.", CreateNewPrice.GetSourceNo());
PriceListLine.Validate("Asset Type", PriceListLine."Asset Type"::Item);
PriceListLine.Validate("Asset No.", ItemNo);
PriceListLine."Unit of Measure Code" := Item."Base Unit of Measure";
PriceListLine."Currency Code" := CreateNewPrice.GetCurrencyCode();
if PriceType = PriceType::Sale then
PriceListLine."Unit Price" := CreateNewPrice.GetUnitPrice()
else
PriceListLine."Direct Unit Cost" := CreateNewPrice.GetDirectUnitCost();
PriceListLine.Insert(true);
Rec.Get(PriceListLine."Price List Code", PriceListLine."Line No.");
Rec.Mark(true);
Commit();
PriceListManagement.ActivateDraftLines(PriceListLine);
end;
end;
procedure DeleteSelectedPrices(var PriceListLine: Record "Price List Line")
begin
if Confirm(DeleteMsg, true) then
PriceListLine.DeleteAll(true);
end;
}