IF (FromDate <> 0D) AND (ToDate > FromDate) THEN BEGIN Calendar.RESET; Calendar.SETRANGE("Period Type",Calendar."Period Type"::Month); Calendar.SETRANGE("Period Start",FromDate,ToDate); Months := Calendar.COUNT - 1; END ELSE Months := 0; //Ben.GET(Empid); IF(InitMonth <> DATE2DMY(Ben."Payment Date",2) ) THEN BEGIN NumPayments := NumPayments +1; InitMonth:= DATE2DMY(Ben."Payment Date",2) END; MonOutStand := Months - NumPayments;can anyone edit this or give me a code that can do what i want please.
Comments
i trying but no luck yet
thanks
Now i want to pick the last payment date for each employee on a table called benefit payment. here is what i have:
I am trying to use the GET function to get each employee using their employee No., but employee no. and entry no. are the primary key for the benefit payment table.
when i run the report with the debugger on, i have error saying "the expression code cannot be type converted to an interger value". the error is pointed to "Employee No.". any problem?
i also would like someone to add some code that can get me the last payment date for each employe on the code above. can someone help me out please?
thanks
i have tried your code but am have this error "A field from a record variable was expected. For example, record.Field Customer.Name"
Is there any variable to be included or defined.
Thanks
instead of
depending on how is defined the field in the Benefit table.
any ideas?
Thanks
Thanks
Anyhow, in priciple you should follow the following steps:
the benefit table has two primary keys that the employee no. and the entry no. I hope this will help you to help me
Thanks
The second is to ensure that you filter the payments from this table. You do this by using appropriate SETRANGE and/or SETFILTER instructions. Last thing, you pick the last record ('+').
It is what I tried to suggest with my code above.
How do you see this code: Its still not giving me anything.
Thanks
I assume you will have to define this new key.
Anything the problem?
Thanks
That said, I think what you need is a key (secondary) with this fields:
"Employee No.", "Payment Date"
On the OnAfterGetRecord of the Employee table, you should write something like this:
Ben.RESET;
Ben.SETCURRENTKEY("Employee No.","Payment date");
Ben.SETRANGE("Employee No.","No.");
Ben.SETFILTER("Payment Date",'<>%1',0D);
IF Ben.FIND('+') THEN
Paymtdate := Ben."Payment Date";
This will give you the last Payment date for each employee, that you should should in a Body Section of the dataitem Employee.
If nothing is showing, it's because you don't have any data or you are applying a filter somewhere.. you can follow the report with the debugger and see what's happening.
NoMonth := Employee."Date Filter" - Paymtdate;
NoMonth is interger. i am trying to subtract paymtdate from date filter on the employee table. The idea is when i am running this report, i use the date filter to run the report. I want the subtraction but its telling me "the date is not valid"
Anything the problem.
To obtain the data the user is putting there, you need to do
VarDateText := Employee.GETFILTER("Date filter"), on the OnPreReport.
This will give you a text , to convert it into a date, you can do:
IF NOT EVALUATE(VarDate,VarDateText) THEN; (it won't crash if they don't put any filter or they put something like 01/01/07..31/12/07).
And then you can do the substraction:
NoMonth := VarDate - Paymtdate
Before doing this, you must check both dates contain data, if not you will get an error and the report will stop:
if (VarDate <> 0D) and (Paymdate <> 0D) THEN
NoMonth := VarDate - Paymtdate
IF NOT EVALUATE(VarDate,VarDateText) THEN;
NoMonth := "Date Filter" - Paymtdate;
IF (VarDate <> 0D) and (Paymtdate <> 0D) THEN
NoMonth := VarDate - Paymtdate
I defined VarDate as Date and VarDateText as Text datatype
I ran but still telling me Nat valid.
Can you please take me through step by step.
Just remove the line in bold, you don't need it.
=D>