-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathTab50210.SCPostTransactions.al
124 lines (111 loc) · 4.27 KB
/
Tab50210.SCPostTransactions.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
table 50210 "SC Post Transactions"
{
DataClassification = ToBeClassified;
fields
{
field(1; ShipReq; Boolean)
{
DataClassification = ToBeClassified;
InitValue = false;
}
field(2; InvReq; Boolean)
{
DataClassification = ToBeClassified;
InitValue = false;
}
field(3; PostingDateReq; Date)
{
DataClassification = ToBeClassified;
}
field(4; ReplacePostingDate; Boolean)
{
DataClassification = ToBeClassified;
InitValue = false;
}
field(5; ReplaceDocumentDate; Boolean)
{
DataClassification = ToBeClassified;
InitValue = false;
}
field(6; DateFromFilter; Date)
{
DataClassification = ToBeClassified;
}
field(7; DateToFilter; Date)
{
DataClassification = ToBeClassified;
}
field(8; CalcInvDisc; Boolean)
{
DataClassification = ToBeClassified;
//InitValue = false;
}
field(9; DocumentType; Option)
{
DataClassification = ToBeClassified;
OptionMembers = "Sales Order","Sales Invoice","Sales Credit Memo","Purchase Order","Purchase Invoice","Purchase Credit Memo";
}
field(8000; ID; Guid)
{
DataClassification = ToBeClassified;
}
}
keys
{
key(ID; ID)
{
Clustered = true;
}
}
trigger OnInsert()
begin
ID := CreateGuid();
post();
end;
local procedure post()
var
SalesPostingProcedure: Codeunit "SC Sales Posting Procedures";
PurchPostingProcedure: Codeunit "SC Purch Posting Procedures";
SalesHeader: Record "Sales Header";
PurchHeader: Record "Purchase Header";
begin
case DocumentType of
0:
begin
SalesHeader.SETRANGE("Document Type", SalesHeader."Document Type"::Order);
SalesHeader.SETRANGE("Document Date", DateFromFilter, DateToFilter);
SalesPostingProcedure.RunBatch(SalesHeader, ReplacePostingDate, PostingDateReq, ReplaceDocumentDate, CalcInvDisc, ShipReq, InvReq);
end;
1:
begin
SalesHeader.SETRANGE("Document Type", SalesHeader."Document Type"::Invoice);
SalesHeader.SETRANGE("Document Date", DateFromFilter, DateToFilter);
SalesPostingProcedure.RunBatch(SalesHeader, ReplacePostingDate, PostingDateReq, ReplaceDocumentDate, CalcInvDisc, ShipReq, InvReq);
end;
2:
begin
SalesHeader.SETRANGE("Document Type", SalesHeader."Document Type"::"Credit Memo");
SalesHeader.SETRANGE("Document Date", DateFromFilter, DateToFilter);
SalesPostingProcedure.RunBatch(SalesHeader, ReplacePostingDate, PostingDateReq, ReplaceDocumentDate, CalcInvDisc, ShipReq, InvReq);
end;
3:
begin
PurchHeader.SETRANGE("Document Type", PurchHeader."Document Type"::Order);
PurchHeader.SETRANGE("Document Date", DateFromFilter, DateToFilter);
PurchPostingProcedure.RunBatch(PurchHeader, ReplacePostingDate, PostingDateReq, ReplaceDocumentDate, CalcInvDisc, ShipReq, InvReq);
end;
4:
begin
PurchHeader.SETRANGE("Document Type", PurchHeader."Document Type"::Invoice);
PurchHeader.SETRANGE("Document Date", DateFromFilter, DateToFilter);
PurchPostingProcedure.RunBatch(PurchHeader, ReplacePostingDate, PostingDateReq, ReplaceDocumentDate, CalcInvDisc, ShipReq, InvReq);
end;
5:
begin
PurchHeader.SETRANGE("Document Type", PurchHeader."Document Type"::"Credit Memo");
PurchHeader.SETRANGE("Document Date", DateFromFilter, DateToFilter);
PurchPostingProcedure.RunBatch(PurchHeader, ReplacePostingDate, PostingDateReq, ReplaceDocumentDate, CalcInvDisc, ShipReq, InvReq);
end;
end;
end;
}