How to take a range of days for an specific month

nacho

New Member
Hi everyone,

I'm having trouble doing a report in QAD. I am programming a report to make a sum of the ammounts in a group of accounts, and I give it as input to a function inside this program a range of dates (date0 and date1) to make the sum from date0 to date1.

How can I do to use the gr_ctrl table to take the range of dates from an specific month? For example, the user see this form:

Year: Period:
Date from: To:

The idea is that if the user puts in there year: 2009 and period: 9, the program automagically puts the dates from: 01-09-2009 to:30-09-2009.

It can be made using if-then-else logic, but I know/suppose there is a more elegant way to do this. I know that with gr_year and gr_per I can get the current year and period, but I don't know how to use this in my program.

Thanks a lot,
greetings!
 
Hi everyone,

I'm having trouble doing a report in QAD. I am programming a report to make a sum of the ammounts in a group of accounts, and I give it as input to a function inside this program a range of dates (date0 and date1) to make the sum from date0 to date1.

How can I do to use the gr_ctrl table to take the range of dates from an specific month? For example, the user see this form:

Year: Period:
Date from: To:

The idea is that if the user puts in there year: 2009 and period: 9, the program automagically puts the dates from: 01-09-2009 to:30-09-2009.

It can be made using if-then-else logic, but I know/suppose there is a more elegant way to do this. I know that with gr_year and gr_per I can get the current year and period, but I don't know how to use this in my program.

Thanks a lot,
greetings!
Auto response:

I find that I can use the calendar:

for first glc_cal where glc_cal.glc_domain = "foobar" and glc_year = 2009 and glc_per = 9 no-lock: end.

display glc_year glc_per glc_start glc_end.


The above code give as a result:

Year Per Per Beg Per End
----- ----- -------- --------
2009 9 01/09/09 30/09/09


Thanks to you all anyway.
 
Back
Top