Hi Akram,
For PO# 7102, I see two separate Misc-Charges. Also, it looks like you want these charges to be taken into account just once.
Try this:
1) Insert groups on the following fields in the same order:
- PO number field
- Misc-Charge
2) Suppress Group Headers 1 and 2.
3) Suppress Group Footer 2
3) Place all required fields on the Details Section
4) Create a formula with this code and place this on the Group Header #2:
whileprintingrecords;
numbervar array arr;
numbervar x := x + 1;
redim preserve arr[x];
arr[x] := {Misc-Amount};
5) Create another formula with this code and place it on the Group Header 1:
whileprintingrecords;
numbervar array arr := 0;
numbervar x := 0;
stringvar s := "";
6) Create three Group Footer 1 sections - a, b and c
7) Create a formula with this code and place it on the Group Footer a section:
"Line Total :" & Sum({LineAmount}, {PONumber_GroupField})
8) Create a formula with this code and place on the Group Footer b section:
whileprintingrecords;
numbervar array arr;
numbervar i;
stringvar s;
for i := 1 to ubound(arr) do
(
s := s + totext(arr[i],0,"") + if ubound(arr) = i then "" else chr(13);
);
s;
Insert a text object with the text "Misc Charge" on this section and place this formula field inside this Text Object
9) One last formula to show the PO Total. This goes on the GF c section:
whileprintingrecords;
numbervar array arr;
"PO Total :" & Sum({LineAmount}, {PONumber_GroupField}) + Sum(arr)
-Abhilash