AdriaticOrg / code

Source code for features that covers local functionality.
1 stars 3 forks source link

Input VAT Books #31

Closed boych83 closed 6 years ago

boych83 commented 6 years ago

Hi, I would like to setup calculation on a same column which include group of different "VAT Identificators" by Type:Sales and another group of "VAT Identificators" by Type::Purchase with "ReverseSign" grouped by "Document No.".

Current function for calculations only takes datefilter:
(codeunit 13062591) - VATBookCalc.EvaluateExpression(VATBookGroup, 0, '', DateFilter);

In case of "Input VAT Book" calculations we will need additional parameter to set "VAT Entry" with right filters. I would add whole "VAT Entry" as parameter.

GRM1989 commented 6 years ago

Hi Bojan,

I added additional filters on the matrix setup cell, within formula. You can use these filters to get summaries with defined filters below. [cid:image008.png@01D4443B.6E870A50]

[cid:image009.png@01D4443B.6E870A50] [cid:image010.png@01D4443B.6E870A50] [cid:image011.png@01D4443B.6E870A50]

Srdačan pozdrav, Milorad Grković NAV Developer GoPro d.o.o. | Solutions, not software. Prve pruge 27c | 11000 Belgrade | Serbia Phone +381 11 31 90 439 Mobile +381 63 269 171 Web www.gopro.rshttp://www.gopro.rs/

[cid:image006.jpg@01D3BF9D.0063FD80]

From: Bojan Ličen notifications@github.com Sent: Tuesday, September 4, 2018 10:00 AM To: AdriaticOrg/code code@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: [AdriaticOrg/code] Input VAT Books (#31)

Hi, I would like to setup calculation on a same column which include group of different "VAT Identificators" by Type:Sales and another group of "VAT Identificators" by Type::Purchase with "ReverseSign" grouped by "Document No.".

Current function for calculations only takes datefilter: (codeunit 13062591) - VATBookCalc.EvaluateExpression(VATBookGroup, 0, '', DateFilter);

In case of "Input VAT Book" calculations we will need additional parameter to set "VAT Entry" with right filters. I would add whole "VAT Entry" as parameter.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/AdriaticOrg/code/issues/31, or mute the threadhttps://github.com/notifications/unsubscribe-auth/Aoeb_c1jgMGY977vtCtHEjsONQYFscyvks5uXjL_gaJpZM4WYepy.

boych83 commented 6 years ago

I know that these filters exist and they can be set up. Last time we sad that for calculations we will use: procedure EvaluateExpression(VATBookGroup: Record "VAT Book Group-Adl"; ColumnNo: Integer; DateFilter: Text) Result: Decimal;

Let say that I need to calculate values grouped by "Document No.". This can not be done through page condition filters. I need to pass Document No. as filter of Value Entry

What would be the difference if I use below function for calculations? procedure CalculateValue(IsFirstValue: Boolean; var TempAmount: Decimal; VATBookViewFormula: Record "VAT Book View Formula-Adl"; VatEntry: Record "VAT Entry");

BR, Bojan

GRM1989 commented 6 years ago

Hi Bojan,

Sorry for late response, yesterday I had meetings all day. Yes, I think that you can use function CalculateValue, but you must set filters first, before you call that function.

I use similar code in "VAT Book-Adl" report, where I filter Value Entry on PreDataItem trigger, and then use function CalculateValue OnAfterGetRecord filter

   trigger OnAfterGetRecord();
                    begin
                        ColumnAmt := 0;
                        GetCustVendInfo;

                        if "VAT Book View Line".Operator1 <> "VAT Book View Line".Operator1::" " then
                            VATBookCalc.CalculateValue(true, ColumnAmt, "VAT Book View Line", "VAT Entry");
                        if "VAT Book View Line".Operator2 <> "VAT Book View Line".Operator2::" " then
                            VATBookCalc.CalculateValue(false, ColumnAmt, "VAT Book View Line", "VAT Entry");
                    end;

                    trigger OnPreDataItem();
                    begin
                        "VAT Book View Line".SetVATEntryFilters("VAT Entry");
                        if VATEntry.GetFilter("Posting Date") <> '' then
                            "VAT Entry".Setfilter("Posting Date", VATEntry.GetFilter("Posting Date"));
                        if VATEntry.GetFilter("Document No.") <> '' then
                            "VAT Entry".Setfilter("Document No.", VATEntry.GetFilter("Document No."));

                        if VATEntry.GetFilter("VAT Bus. Posting Group") <> '' then
                            "VAT Entry".Setfilter("VAT Bus. Posting Group", VATEntry.GetFilter("VAT Bus. Posting Group"));
                        if not FindSet then
                            NotFoundDetails := true;
                    end;

Srdačan pozdrav, Milorad Grković NAV Developer GoPro d.o.o. | Solutions, not software. Prve pruge 27c | 11000 Belgrade | Serbia Phone +381 11 31 90 439 Mobile +381 63 269 171 Web www.gopro.rshttp://www.gopro.rs/

[cid:image006.jpg@01D3BF9D.0063FD80]

From: Bojan Ličen notifications@github.com Sent: Tuesday, September 4, 2018 12:16 PM To: AdriaticOrg/code code@noreply.github.com Cc: Milorad Grković milorad.grkovic@gopro.rs; Comment comment@noreply.github.com Subject: Re: [AdriaticOrg/code] Input VAT Books (#31)

I know that these filters exist and they can be set up. Last time we sad that for calculations we will use: procedure EvaluateExpression(VATBookGroup: Record "VAT Book Group-Adl"; ColumnNo: Integer; DateFilter: Text) Result: Decimal;

Let say that I need to calculate values grouped by "Document No.". This can not be done through page condition filters. I need to pass Document No. as filter of Value Entry

What would be the difference if I use below function for calculations? procedure CalculateValue(IsFirstValue: Boolean; var TempAmount: Decimal; VATBookViewFormula: Record "VAT Book View Formula-Adl"; VatEntry: Record "VAT Entry");

BR, Bojan

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/AdriaticOrg/code/issues/31#issuecomment-418314919, or mute the threadhttps://github.com/notifications/unsubscribe-auth/Aoeb_UCIH5uV0WTgnBJccSdn_DRX0tfsks5uXlLUgaJpZM4WYepy.

boych83 commented 6 years ago

Hi,

tnx for answer.
Working that way only values are calculated without condition filters?

BR, Bojan

GRM1989 commented 6 years ago

Yes, but, you can do filtering before you call function CalculateValue. Conditional filters are included in this line of code (yellow mark), and you then use calculation only for filtered records.

   trigger OnAfterGetRecord();
                    begin
                        ColumnAmt := 0;
                        GetCustVendInfo;

                        if "VAT Book View Line".Operator1 <> "VAT Book View Line".Operator1::" " then
                            VATBookCalc.CalculateValue(true, ColumnAmt, "VAT Book View Line", "VAT Entry");
                        if "VAT Book View Line".Operator2 <> "VAT Book View Line".Operator2::" " then
                            VATBookCalc.CalculateValue(false, ColumnAmt, "VAT Book View Line", "VAT Entry");
                    end;

                    trigger OnPreDataItem();
                    begin
                        "VAT Book View Line".SetVATEntryFilters("VAT Entry");
                        if VATEntry.GetFilter("Posting Date") <> '' then
                            "VAT Entry".Setfilter("Posting Date", VATEntry.GetFilter("Posting Date"));
                        if VATEntry.GetFilter("Document No.") <> '' then
                            "VAT Entry".Setfilter("Document No.", VATEntry.GetFilter("Document No."));

                        if VATEntry.GetFilter("VAT Bus. Posting Group") <> '' then
                            "VAT Entry".Setfilter("VAT Bus. Posting Group", VATEntry.GetFilter("VAT Bus. Posting Group"));
                        if not FindSet then
                            NotFoundDetails := true;
                    end;

Srdačan pozdrav, Milorad Grković NAV Developer GoPro d.o.o. | Solutions, not software. Prve pruge 27c | 11000 Belgrade | Serbia Phone +381 11 31 90 439 Mobile +381 63 269 171 Web www.gopro.rshttp://www.gopro.rs/

[cid:image006.jpg@01D3BF9D.0063FD80]

From: Bojan Ličen notifications@github.com Sent: Wednesday, September 5, 2018 11:56 AM To: AdriaticOrg/code code@noreply.github.com Cc: Milorad Grković milorad.grkovic@gopro.rs; Comment comment@noreply.github.com Subject: Re: [AdriaticOrg/code] Input VAT Books (#31)

Hi,

tnx for answer. Working that way only values are calculated without condition filters?

BR, Bojan

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/AdriaticOrg/code/issues/31#issuecomment-418672623, or mute the threadhttps://github.com/notifications/unsubscribe-auth/Aoeb_cf5EMI9GPMoPv8YT3_-T3e4JLlbks5uX5_IgaJpZM4WYepy.