Closed fridrichovsky closed 3 years ago
@AlexanderYakunin - we need any reaction. It is blocking our business and we need to resolve it as soon as possible. Thanks Jiří Bureš CEO
Hi @fridrichovsky. Could you describe me what purpose of OnDrillDownAmountLCYOnBeforeVATPostSetupGet event? Could you provide me scenario of using? In this case is handled pattern used a little bit inconveniently so maybe we could find another solution for your scenario. Thanks
Hi @DavidHolusa. I found problem in our code. There should not be exit:
if IsHandled then
exit(true);
I fixed code in my first comment. Main point is that we would like skip some vat entries. I hope that it is more clear now.
Hi @fridrichovsky. Yes it looks better and it's more clear now. I would like to redesign the code a bit and create a new function for adding the vat entry to buffer. In this new function should be implemented handled pattern. But I would create this function with two parameters. First vat entry and second temporary vat entry. But in your requested event you have variable VIESDeclarationHeaderCZL. What is the purpose? Do you need some information from VIES Declaration Header?
Hello, yes we need information from header where we added new field that say which VAT Entries we use.
Couldn't you use the information from header as filter for VAT entry?
Is the following new function ok for you?
local procedure IsVATEntryIncludedToDrillDown(VATEntry: Record "VAT Entry") IsIncluded: Boolean
var
VATPostingSetup: Record "VAT Posting Setup";
IsHandled: Boolean;
begin
GetHeader();
OnBeforeIsVATEntryIncludedToDrillDown(VATEntry, Rec, VIESDeclarationHeaderCZL, IsIncluded, IsHandled);
if IsHandled then
exit(IsIncluded);
if not VATPostingSetup.Get(VATEntry."VAT Bus. Posting Group", VATEntry."VAT Prod. Posting Group") then
exit(false);
case "Trade Type" of
"Trade Type"::Sales:
exit(VATPostingSetup."VIES Sales CZL");
"Trade Type"::Purchase:
exit(VATPostingSetup."VIES Purchase CZL");
end;
exit(false);
end;
The DrillDownAmountLCY function looks like this:
procedure DrillDownAmountLCY()
var
VATEntry: Record "VAT Entry";
TempVATEntry: Record "VAT Entry" temporary;
begin
GetHeader();
VATEntry.SetCurrentKey(Type, "Country/Region Code");
VATEntry.SetRange(Type, "Trade Type" + 1);
VATEntry.SetRange("Country/Region Code", "Country/Region Code");
VATEntry.SetRange("VAT Registration No.", "VAT Registration No.");
case "Trade Role Type" of
"Trade Role Type"::"Direct Trade":
VATEntry.SetRange("EU 3-Party Trade", false);
"Trade Role Type"::"Intermediate Trade":
VATEntry.SetRange("EU 3-Party Trade", true);
"Trade Role Type"::"Property Movement":
exit;
end;
VATEntry.SetRange("VAT Date CZL", VIESDeclarationHeaderCZL."Start Date", VIESDeclarationHeaderCZL."End Date");
VATEntry.SetRange("EU Service", "EU Service");
OnDrillDownAmountLCYOnBeforeVATEntryFind(Rec, VIESDeclarationHeaderCZL, VATEntry);
if VATEntry.FindSet() then
repeat
if IsVATEntryIncludedToDrillDown(VATEntry) then begin
TempVATEntry := VATEntry;
TempVATEntry.Insert();
end
until VATEntry.Next() = 0;
Page.Run(0, TempVATEntry);
end;
Thanks for reporting this. We agree, and we’ll publish a fix asap, either in an update for the current version or in the next major release. Please do not reply to this, as we do not monitor closed issues. If you have follow-up questions or requests, please create a new issue where you reference this one.
Please add new events