Hi all,
I am trying to fetch the line amount of sales line having Item Charges, so i have written the following code but its giving value 0. I have written the code under Integer OnPreSection trigger
globals i have used:
SalesInvoiceLine->Rec->Sales Invoice Line
FCharges->Decimal
//'FORWARDING CHARGES' :- A Item Charges No. i have created
IF SalesInvoiceLine.FIND('-') THEN
BEGIN
IF SalesInvoiceLine."No."='FORWARDING CHARGES' THEN
BEGIN
//SalesInvoiceLine.CALCFIELDS("Line Amount");
FCharges:=SalesInvoiceLine."Line Amount";
END;
END;
If i am removing the comment from the fifth line its fetching the line amount of the first line. Actually i want to fetch the line amount of the line having item no as 'FORWARDING CHARGES'
Can anubody tell me whats the problem.
0
Comments
And you really shouldn't hard code the No. field in the code like that.
My Blog - nav.education
Further move the code to "OnAfterGetRecord" rather than OnPreSection
http://ssdynamics.co.in
if i am using a loop then its causing another problem as some sections are not properly displayed
http://ssdynamics.co.in
My Blog - nav.education
i have tried this code but its not working
SalesInvoiceLine.RESET;
//SalesInvoiceLine.SETRANGE(SalesInvoiceLine."Document No.","Sales Invoice Header"."No.");
SalesInvoiceLine.SETRANGE(SalesInvoiceLine.Type,SalesInvoiceLine.Type::"Charge (Item)");
SalesInvoiceLine.SETFILTER(SalesInvoiceLine."No.",'FORWARDING CHARGES');
CCharges:=SalesInvoiceLine."Line Amount";
still its giving line amount from 1st line.
http://ssdynamics.co.in
SalesInvoiceLine.RESET;
//SalesInvoiceLine.SETRANGE(SalesInvoiceLine."Document No.","Sales Invoice Header"."No.");
SalesInvoiceLine.SETRANGE(SalesInvoiceLine.Type,SalesInvoiceLine.Type::"Charge (Item)");
SalesInvoiceLine.SETFILTER(SalesInvoiceLine."No.",'FORWARDING CHARGES');
IF SalesInvoiceLine.FIND('-') THEN
begin
CCharges:=SalesInvoiceLine."Line Amount";
end;
if i am writing this, still the result is same
ERP Consultant (not just Navision) & Navision challenger
Actually i am using this code on report so if i am using loop then file i am getting the records but some sections of the reports are not getting displayed. Can u plz suggest some solution.