YES, i am doing according to your suggestion. but payment method code in G/L entry table. when i loop through this table. it repeat data.
WITH “Sales Invoice Line” DO BEGIN
IF “Sales Invoice Line”.FIND(’-’) THEN BEGIN
REPEAT
WITH “G/L Entry” DO BEGIN
IF “G/L Entry”.FIND(’-’) THEN BEGIN
REPEAT
IF (( “G/L Entry”.“POS Order No.”= “Sales Invoice Line”.“POS Order No.”)
AND ( “Sales Invoice Line”.“Line Discount %”>0) ) THEN BEGIN
CASE “G/L Entry”.“Payment Method Code” OF
‘CASH’:
BEGIN
BycashtotalLinediscountSIn:= BycashtotalLinediscountSIn+“Sales Invoice Line”.“Line Discount %”;
END;
‘CREDCARD’:
BEGIN
BycredittotalLinediscountSIn:= BycredittotalLinediscountSIn+“Sales Invoice Line”.“Line Discount %”;
END;
ELSE BEGIN
ByothertotalLinediscountSIn:=ByothertotalLinediscountSIn+“Sales Invoice Line”.“Line Discount %”;
END;
END;
END;
IF (( “G/L Entry”.“POS Order No.”= “Sales Invoice Line”.“POS Order No.”)
AND ( “Sales Invoice Line”.“Inv. Discount Amount”>0) ) THEN BEGIN
CASE “G/L Entry”.“Payment Method Code” OF
‘CASH’:
BEGIN
BycashtotalInvdiscountSIn:= BycashtotalInvdiscountSIn+“Sales Invoice Line”.“Inv. Discount Amount”;
END;
‘CREDCARD’:
BEGIN
BycredittotalInvdiscountSIn:= BycredittotalInvdiscountSIn+“Sales Invoice Line”.“Inv. Discount Amount”;
END;
ELSE BEGIN
ByothertotalInvdiscountSIn:=ByothertotalInvdiscountSIn+“Sales Invoice Line”.“Inv. Discount Amount”;
END;
END;
END;
UNTIL “G/L Entry”.NEXT<=0;
END;
END;
UNTIL “Sales Invoice Line”.NEXT<=0;
END;
END;