- Code: Select all Expand view RUN
select 4
use mete
index on mete->ME_mc_serl to mete
index on str(mete->year) + str(mete->month) to mete1
index on mete->me_date to mete2
/*
select 1
USE cust
INDEX ON upper(cust->cu_acct) TO cust
INDEX ON upper(cust->cu_name) TO cust1
INDEX ON upper(cust->cu_coun) TO cust2
INDEX ON upper(cust->cu_city) TO cust3
INDEX ON upper(cust->cu_gove) TO cust4
INDEX ON upper(cust->cu_stre) TO cust5
INDEX ON upper(cust->cu_phon) TO cust6
INDEX ON upper(cust->cu_fax ) TO cust7
INDEX ON upper(cust->cu_mobi) TO cust8
INDEX ON upper(cust->cu_man ) TO cust9
INDEX ON upper(cust->cu_appr) TO cust10
set INDEX TO cust
select 3
use mach
index on mach->MC_CU_ACCT to mach
index on UPPER(mach->MC_CU_name) to mach1
index on UPPER(mach->MC_ct_ctna) to mach2
index on UPPER(mach->MC_model) to mach3
index on UPPER(mach->MC_TYPE)+UPPER(mach->MC_model) to mach4
index on UPPER(mach->MC_serial) to mach5
index on UPPER(mach->MC_meres) to mach6
index on UPPER(mach->MC_brn) to mach7
index on UPPER(mach->MC_gateway) to mach8
set index to mach1
select 2
USE cont
INDEX ON cont->CT_CU_ACCT+dtoc(cont->ct_strd) TO cont
INDEX ON cont->CT_CU_name TO cont1
INDEX ON cont->ct_strd TO cont2
INDEX ON cont->ct_endd TO cont3
INDEX ON cont->CT_machno TO cont4
INDEX ON cont->CT_mamc TO cont5
INDEX ON cont->ct_paymet TO cont6
INDEX ON cont->ct_payamt TO cont7
INDEX ON cont->ct_currenc TO cont8
INDEX ON cont->ct_excmet TO cont9
INDEX ON cont->ct_excamt TO cont10
INDEX ON cont->ct_minvol TO cont11
INDEX ON cont->ct_ctna TO cont12
SET INDEX TO cont12*/
DEFINE DIALOG oDlgn TITLE "Meter Reads Sheet Filtering Creteria" ;
From 8, 2 TO 600, 700 PIXEL
@ 45,2 SAY "Customer name" OF oDlgn PIXEL
@ 45,50 SAY ":" OF oDlgn PIXEL
@ 45,55 COMBOBOX oCbx VAR v_cuna_cocmbo ITEMS aBase(4,"mete",256,"me_cu_name") SIZE 110,80 ;
OF oDlgn PIXEL ;
valid ( reset( v_cuna_cocmbo, oCbx2,"mete","me_cu_acct","me_cu_name") , .t. )
@ 60,2 SAY "Customer Account" OF oDlgn PIXEL
@ 60,50 SAY ":" OF oDlgn PIXEL
@ 60,55 COMBOBOX oCbx2 VAR v_cuac_cocmbo ITEMS aItems size 110,80 ;
OF oDlgn PIXEL;
valid ( reset( v_cuac_cocmbo, oCbx3,"mete","me_ct_ctna","me_cu_acct") , .t. )
@ 75,2 SAY "Contract name" OF oDlgn PIXEL
@ 75,50 SAY ":" OF oDlgn PIXEL
@ 75,55 COMBOBOX oCbx3 VAR v_cona_cocmbo ITEMS aItems size 110,80 OF oDlgn PIXEL
...
..
function reset( cItem,oCbx,cFile,fld_na,filter_name)
//---------------------------------------------------
local aItems:={}
local nArea:= select()
local y:=0
use (cFile) new
set filter to cItem = &(filter_name)
go top
do while ! eof()
y:=ASCAN(aItems,(cFile)->&fld_na)
if y==0
aAdd(aItems,(cFile)->&fld_na)
dbSkip()
else
dbSkip()
endif
ENDDO
*use
select( nArea )
oCbx:setItems( aItems )
oCbx:refresh()
return nil
//-----------------------------------------//
function aBase(x,cFile,xx,cField)
*--------------------------------
local aItems:={}
local y:=0
local nArea:=select()
aAdd(aItems,space(256)) //Put First element empty
use (cFile) new
index on &(cField) to temp
go top
do while ! eof()
y:=ASCAN(aItems,(cFile)->&cField)
if y==0
aAdd(aItems,(cFile)->&cField)
dbSkip()
else
dbSkip()
endif
enddo
ferase("temp.ntx")
select(nArea)
return aItems