WITH “G/L Entry” DO BEGIN
IF “G/L Entry”.FIND(’-’) THEN BEGIN
REPEAT
WITH “Sales Invoice Line” DO BEGIN
REPEAT
IF “G/L Entry”.Amount>0 THEN BEGIN
CASE “Payment Method Code” OF
‘CASH’:
BEGIN
totalcash_posted:= totalcash_posted+“G/L Entry”.Amount;
END;
‘CREDCARD’:
BEGIN
totalcredit_posted:= totalcredit_posted+“G/L Entry”.Amount;
END;
ELSE BEGIN
totalother_posted:= totalother_posted+“G/L Entry”.Amount;
END;
END;
END;
IF GLine.“Inv. Discount (LCY)”>0 THEN BEGIN
CASE “Payment Method Code” OF
‘CASH’:
BEGIN
BycashtotalInvdiscountGline:= BycashtotalInvdiscountGline+GLine.“Inv. Discount (LCY)”;
END;
‘CREDCARD’:
BEGIN
BycredittotalInvdiscountGline:= BycredittotalInvdiscountGline+GLine.“Inv. Discount (LCY)”;
END;
ELSE BEGIN
ByothertotalInvdiscountGline:= ByothertotalInvdiscountGline+GLine.“Inv. Discount (LCY)”;
END;
END;
END;
IF GLine.“Payment Discount %”>0 THEN BEGIN
CASE “Payment Method Code” OF
‘CASH’:
BEGIN
BycashtotalPaydiscountGline:= BycashtotalPaydiscountGline+GLine.“Payment Discount %”;
END;
‘CREDCARD’:
BEGIN
BycredittotalPaydiscountGline:= BycredittotalPaydiscountGline+GLine.“Payment Discount %”;
END;
ELSE BEGIN
ByothertotalPaydiscountGline:= ByothertotalPaydiscountGline+GLine.“Payment Discount %”;
END;
END;
END;
IF GLine.“VAT Base Discount %”>0 THEN BEGIN
CASE “Payment Method Code” OF
‘CASH’:
BEGIN
BycashtotalVatdiscountGline:= BycashtotalVatdiscountGline+GLine.“VAT Base Discount %”;
END;
‘CREDCARD’:
BEGIN
BycredittotalVatdiscountGline:= BycredittotalVatdiscountGline+GLine.“VAT Base Discount %”;
END;
ELSE BEGIN
ByothertotalVatdiscountGline:= ByothertotalVatdiscountGline+GLine.“VAT Base Discount %”;
END;
END;
END;
IF GLine.“Job Line Discount %”>0 THEN BEGIN
CASE “Payment Method Code” OF
‘CASH’:
BEGIN
BycashtotalPaydiscountGline:= BycashtotalPaydiscountGline+GLine.“Job Line Discount %”;
END;
‘CREDCARD’:
BEGIN
BycredittotalPaydiscountGline:= BycredittotalPaydiscountGline+GLine.“Job Line Discount %”;
END;
ELSE BEGIN
ByothertotalPaydiscountGline:= ByothertotalPaydiscountGline+GLine.“Job Line Discount %”;
END;
END;
END;
IF “Sales Invoice Line”.“Line Discount %”>0 THEN BEGIN
CASE “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;
UNTIL “Sales Invoice Line”.NEXT<=0;
END;
UNTIL “G/L Entry”.NEXT<=0;
END;
END;
where should i check glentry.documentno=sales invoice line document no?