Kerbouchard
IS-IT--Management
I've been working on this for several days and can't seem to get it to filter by date.
There are 2 tables involved a_armast and a_arymst that I am pulling information from. lc_bdate and lc_edate are character fields on a grid that are then converted via function to dates(works fine). I need it to find all the invoices between the two dates selected. invdte in a_armast,a_arymst is the date field in the table. There are a number of other filters on the tables below, all of which work great I just can't get the dates to filter. Argggh! If I haven't given enough information about the program please let me know.
There are 2 tables involved a_armast and a_arymst that I am pulling information from. lc_bdate and lc_edate are character fields on a grid that are then converted via function to dates(works fine). I need it to find all the invoices between the two dates selected. invdte in a_armast,a_arymst is the date field in the table. There are a number of other filters on the tables below, all of which work great I just can't get the dates to filter. Argggh! If I haven't given enough information about the program please let me know.
Code:
ld_bdate = g_retdt(lc_bdate)
ld_edate = g_retdt(lc_edate)
IF lc_include = "N"
*-- New and changed invoices
*-- Initialize filter and copy expressions
STORE [VAL(invno) >= VAL(lc_binvno) AND ] + ;
[VAL(invno) <= VAL(lc_einvno) AND ] + ;
[&lc_malias.->balance = 0 AND ] + ;
[&lc_malias.->salsmn1 = lc_salsmn OR ] + ;
[&lc_malias.->salsmn2 = lc_salsmn OR ] + ;
[&lc_malias.->salsmn3 = lc_salsmn AND ] + ;
[&lc_malias.->prtid <> "P" AND ] + ;
[artype $ lc_type AND ] + ;
[LEFT(custno, ln_lc) = lc_xcustno AND ] + ;
[NOT DELETED()] ;
TO lc_mfilt, ;
lc_copy
ELSE
*-- All invoices
*-- Initialize filter and copy expressions
STORE [VAL(invno) >= VAL(lc_binvno) AND ] + ;
[VAL(invno) <= VAL(lc_einvno) AND ] + ;
[&lc_malias.->balance = 0 AND ] + ;
[&lc_malias.->salsmn1 = lc_salsmn OR ] + ;
[&lc_malias.->salsmn2 = lc_salsmn OR ] + ;
[&lc_malias.->salsmn3 = lc_salsmn AND ] + ;
[artype $ lc_type AND ] + ;
[LEFT(custno, ln_lc) = lc_xcustno AND ] + ;
[NOT DELETED()] ;
TO lc_mfilt, ;
lc_copy
[B]**Trouble starts here filtering by date**[/B]
IF NOT EMPTY(ld_bdate) AND NOT EMPTY(ld_edate)
SELECT A_ARMAST
set order to invdte1 in a_armast
IF NOT EMPTY(ld_bdate)
SEEK DTOS(ld_bdate)
lc_mfilt = lc_mfilt + [DTOS(invdte) >= "] + ;
DTOS(ld_bdate) + [" AND ]
ENDIF
IF NOT EMPTY(ld_edate)
SEEK DTOS(ld_edate)
lc_mfilt = lc_mfilt + [DTOS(invdte) >= "] + ;
DTOS(ld_edate) + [" AND ]
ENDIF
Else
SET ORDER TO 0 in a_armast
ENDIF