Hi Experts,
I have to build a report which stores its result to a newly created table named as Salesdata.
In Salesdata table I need to add the following things from various tables such as transheader,trans sales entry and trans payment entry
in the Salesdata tble i have the following fields
Field No. Field Name Data Type Length Description
50001 EntryId Integer ( key)
50002 Reciept No Code 100
50003 Date Date
50004 Time Time
50005 StaffId Code 20
50006 Storeno Code 20
50007 Gross Amount Decimal
50008 Net Amount Decimal
50009 Customer Id Code 10
50010 TerminalNo Code 10
50011 Tender Type Code 10
i created a report named Salesdata to get the Data from between date intervals from the request page of this report.
in c/al of the Salesdata report ,
Transaction Header - OnAfterGetRecord()
Salesdata.RESET;
Salesdata.DELETEALL;
Salesdata.SETCURRENTKEY("Reciept No");
Salesdata.SETRANGE("Reciept No" ,"Transaction Header"."Receipt No.");
//this is allow you to insert multiple recodrs else it will check the first record exist I the table or not
IF NOT Salesdata.FINDFIRST THEN
BEGIN
REPEAT
Salesdata.INIT;
Salesdata."Reciept No" := "Transaction Header"."Receipt No.";
Salesdata.Date := "Transaction Header".Date;
Salesdata.Time := "Transaction Header".Time;
Salesdata.StaffId := "Transaction Header"."Staff ID";
Salesdata.Storeno := "Transaction Header"."Store No.";
Salesdata.TerminalNo := "Transaction Header"."POS Terminal No.";
Salesdata."Gross Amount" := "Transaction Header"."Gross Amount";
Salesdata."Net Amount" := "Transaction Header"."Net Amount";
Salesdata."Customer Id" := "Transaction Header"."Customer No.";
Salesdata.INSERT;
Salesdata.MODIFY;
UNTIL Salesdata.NEXT = 0;
END;
its entering only the last data and not updating the recieptno.
Thanks in advanvce.
0
Answers
Transaction Header - OnPreDataItem()
Salesdata.DELETEALL;
Its working.
Thanks.