Reports using Array...

Hi,

Im making a reports,that will get the data from Sales (Purchase Invoice header and Lines) the. and I use the Array to Show the header of the reports…consist only the Item that in the Purch. Inv. Line…and Base on that item in Header…I will display all the quantity that Sales inv Line.

ex. (header) Item001 Item002 item03 Item04

Sales Invoice No.1 Qty. Item001 Qty. Item002 Qty. Item003 Qty. Item002

Sales Invoice No.2 Qty = 1 0 0 Qty. = 2

I use the Array to Show the Header, and the Body…but the Quantity of item base on Sales inv. Line is not display correct to the Item in the Header. Any Idea…?

This Is my Code:

Header Text 100
ColumnQuantity Decimal
i Decimal
tempItemNo Code 100
recItem Record Item
TempItemLine Record Item
DataBody Decimal
recSalesInvoiceLine Record Sales Invoice Line
MaxCount Integer
CompanyInfo Record Company Information

DATA ITEM

DataItem Name
Sales Invoice Header,Sales Invoice Line,Integer

Sales Invoice header - Onafterget Records()

IF “Sales Invoice Line”.FIND(’-’) THEN
REPEAT
IF NOT TempItemLine.GET(“Sales Invoice Line”.“No.”) THEN
BEGIN
TempItemLine.INIT;
TempItemLine.“No.” := “Sales Invoice Line”.“No.”;
TempItemLine.“Unit Price” := “Sales Invoice Line”.Quantity;
TempItemLine.Description := “Sales Invoice Line”.Description;
TempItemLine.INSERT;
// MESSAGE(’%1’,TempItemLine.“No.”);
END;
UNTIL “Sales Invoice Line”.NEXT =0;

i := 1;
IF TempItemLine.FIND(’-’) THEN
REPEAT
Header[i] := FORMAT(TempItemLine.Description);
//Header[i] := TempItemLine.“No.”;
i := i + 1;
UNTIL TempItemLine.NEXT =0;

Sales Invoice Line - onafterGetrecords()

//CLEAR(DataBody);

MaxCount := TempItemLine.COUNT;

FOR i := 1 TO MaxCount DO BEGIN
IF “Sales Invoice Line”.Description = Header[i] THEN
DataBody[i] := “Sales Invoice Line”.Quantity;
END;

i := 1;
IF “Sales Invoice Line”.Description = Header[i] THEN BEGIN
REPEAT
DataBody[i] := “Sales Invoice Line”.Quantity;
i := i + 1;
UNTIL “Sales Invoice Line”.NEXT = 0;
END ELSE
DataBody[i] := 0;

Integer -Onpredataitem()

Integer.SETRANGE(Integer.Number,“Sales Invoice Line”.COUNT);

That is My code…I hope any can healp me…about this…thanks a lot.[:)]

Maybe check on where you put your displays. Which part of body or footer? Rgds!!

So What exactly do you want or expect? Yes your explanation is well detailed but you didn’t say what you want or what is not happening.

Plz do it.

Thanks

Hi,

The Quantity per transaction must be display in the body…actaul when I test the reports… some quantity is misplace… I dont get the what wrong with my Code…[:(]…any other advice or suggestion…I really apreciate it…TY

rpt

Please See the Link to show the sample picture of my reports…I only want to achievd is to disply the QUANTITY per transaction and That Quantity is base on the Item trnsacation in Sales invoice…But the item No. must be the header of the reports…and the body will display the Quantity per Sales invoice.[:S]

This is my reports picture Link:

http://ph.groups.yahoo.com/group/genesis_x/photos/view/684c?b=8&m=f&o=0

I see you used my suggestio, KiLL6. You’re welcome :slight_smile:

The first problem I see in your report, is that you are trying to store the quantity in your temporary item record. I don’t think you can do that. If you have the same item on two different invoice lines, you may be accessing the wrong quantity.

My structure would be something like this

Data Item SalesInvoiceLine #1

OnAfterGetRecord

tempItem.get( SalesInvoiceLine_1.“No.”) ;

if tempItem.insert then ;

NO BODY SECTIONS

DataItem SalesInvoiceHeader

OnPreDataItem

MAXITEMS := tempItem.count ;

OnAfterGetRecord

i := 0 ;

if tempItem.find(’-’) then repeat

i := i + 1 ;

SalesInvoiceLine2.setrange(“document no.”, “No.”) ;

SalesInvoiceLine2.setrange(“No.”, tempItem.“No.”) ;

Qty[i] := SalesInvoiceLine2.calcsums(Quantity) ;

until tempItem.next = 0 ;

Then in the BODY section, each column would have Qty[1], Qty[2], Qty[3] … as its source expression

Thank you very much…for replying…[:)]…I will try your suggestion…Thanks