naumit
26th August 2009, 12:02
Sir/ Madam
I want to calculate
No. of days = Current date - Receipt date
in a report
Could anybody please tell me that i could achieve it.
Thanx
DSchneider
26th August 2009, 12:27
In Baan IV and ERP LN, Date Format is a long value, that represents the number of Days since 0.0.0000. So you only have to substract the values from each other:
No. of days = date.num() - Receipt date
Where date.num() always gives the actual Date.
In ERP LN, there is additional (most used) the utc.format. With that you can change the utc Field to date-field with the function utc.to.local().
But with that function, I had some Problems in the past, so I always use utc.to.date() and then date.to.num().
Kozure Ohashi
26th August 2009, 14:00
Dear Naumit,
long days | number of days
days = date.num() - tdpur045.date
where date.num() is the current date in days since 01.01.0001.
Regards,
Kozure
naumit
31st August 2009, 13:27
Sir,
I tried but unfortunately i cannot get the required result.
What i really want is this
Todays date = 31.8.2009
Receipt Date = 1.7.2009
No of days = 31.8.2009 - 1.7.2009 = 61 days
should come out as the result
Kozure Ohashi
31st August 2009, 13:32
Dear numit,
please post your code.
Regards,
Kozure
naumit
31st August 2009, 13:49
functions:
function read.main.table()
{
select whinh312.*
from whinh312
where whinh312.rcno inrange {:rcno.f} and {:rcno.t}
and whinh312.ardt inrange {:ardt.f} and {:ardt.t}
and whinh312.sfbp inrange {:sfbp.f} and {:sfbp.t}
order by whinh312._index1
selectdo
select tdpur406.*
from tdpur406
where tdpur406.orno = :whinh312.orno
and tdpur406.pono = :whinh312.pono
and tdpur406.sqnb = :whinh312.seqn
and tdpur406.rcno = :whinh312.rcno
and tdpur406.rseq = :whinh312.rcln
selectdo
days = date.num() - whinh312.idat
get.item()
if tdpur406.qiap = 0 and tdpur406.qirj = 0 then
rprt_send()
endif
endselect
endselect
}
function get.item()
{
select tcibd001.*
from tcibd001
where tcibd001.item = :whinh312.item
selectdo
endselect
}
Kozure Ohashi
31st August 2009, 13:55
Please post your declaration of days.
Regards,
Kozure
naumit
31st August 2009, 14:02
sry i cannot get you
naumit
31st August 2009, 14:03
This is my code and that variable "days" is used for getting no of days.
wiggum
31st August 2009, 14:27
As table field whinh312.idat is in utc format read entry of DSchneider.