Files
roaimob/Programe/Vechi/reindexare.prg

708 lines
18 KiB
Plaintext

Parameters tcConditie
&& conditia suplimentara && ex: gcAppPath$calealfa
If !Empty(tcConditie)
lcConditie=Alltrim(tcConditie)
Else
lcConditie = []
Endif
*!* DIRFIRM=loc+'\'+NFSCURT
*!* *CALEFIRMA=ALLTRIM(M.CALEFIRM)
*!* SET DELETED OFF
*!* IF !DIRECTORY('&CALEFIRMA')
*!* DO MESAJrosu WITH 'Calea '+CALEFIRMA+' este incorecta!','Sugeram iesirea din program.'
*!* QUIT
*!* RETRY
*!* ENDIF
*!* DATE=CALEFIRMA+'\AN'+m.an+'\DATE'+M.nl
*!* DATEAN=CALEFIRMA+'\DATEAN'
*!* CALET=DIRFIRM+'\TEMPO'
*!* m.ANTET='S.C. '+M.FLUNG
*!* WAIT ' ' TIMEOUT 0.01
*!* CLOSE DATABASE
*!* LOCAL ll,aa
*!* ll=m.nl
*!* aa=m.an
*!* DO deschidf WITH '&dirgen\Imob2003\date\','&dirgen\Imob2003\date\','fistotvmf','fistotv','CALE',''
*!* *do deschidprog in totv.prg
*!* *-----------------
*!* BUTON=2
*!* DO dasaunu WITH 'Se reindexeaza fisierele lunare?'
*!* IF BUTON=1
*!* SET DELETED ON
*!* SELE 0
*!* USE &CALEFIRMA\DATEAN\calendar ALIAS calendar &&?????????????????????????????????
*!* SELECT DISTINCT an AS anan FroM calendar INTO CURSOR TANCAL
*!* SELECT TANCAL
*!* SCAN
*!* DO dasaunu WITH 'Se reindexeaza fisierele din anul '+anan+' ?'
*!* IF BUTON=1
*!* lc_an=anan
*!* SELE calendar
*!* SCAN FOR !DELETED() AND an=lc_an
*!* SCATTER MEMVAR
*!* DATE=CALEFIRMA+'\AN'+m.an+'\DATE'+M.nl
*!* BUTON=2
*!* DO dasaunu WITH 'Se reindexeaza fisierele din luna '+m.nl+' '+m.an+' ?'
*!* IF BUTON=1
*!* SELE fistotv
*!* Maxs=RECCOUNT()
*!* j=0
*!* OP=CREA('PROGRESBAR')
*!* OP.titlu.CAPTION='Se reindexeaza fisierele lunii '+m.nl+' '+m.an
*!* OP.SHOW()
*!* SELE fistotv
*!* SET FILTER TO
*!* *scan for inlist(allt(lower(cale)),'&date','&date\')
*!* SCAN FOR 'DATE'$UPPER(cale) AND !('DATEAN'$UPPER(cale)) AND 'IMOB2003'$allt(UPPER(calealfa))
*!* SCAT MEMV
*!* WAIT WIND m.numef NOWAIT
*!* DO reindf WITH m.calealfa,m.cale,m.numef,m.alias,m.ordine,m.exc
*!* DO PR WITH j
*!* ENDSCAN
*!* OP.RELEASE
*!* WAIT CLEAR
*!* ENDIF
*!* ENDSCAN
*!* ENDIF
*!* SELECT TANCAL
*!* ENDSCAN
*!* USE IN calendar
*!* ENDIF
*!* BUTON=2
*!* DO dasaunu WITH 'Se reindexeaza fisierele generale din DATEAN?'
*!* IF BUTON=1
*!* SELE fistotv
*!* Maxs=RECCOUNT()
*!* j=0
*!* OP=CREA('PROGRESBAR')
*!* OP.titlu.CAPTION='Se reindexeaza fisierele generale. Asteptati...'
*!* OP.SHOW()
*!* SELE fistotv
*!* SET FILTER TO !DELETED()
*!* *scan for inlist(allt(lower(cale)),'&calefirma\datean','&calefirma\datean\')
*!* SCAN FOR 'DATEAN'$ALLT(UPPER(cale)) AND 'IMOB2003'$allt(UPPER(calealfa))
*!* SCAT MEMV
*!* WAIT WIND m.numef NOWAIT
*!* DO reindf WITH m.calealfa,m.cale,m.numef,m.alias,m.ordine,m.exc
*!* DO PR WITH j
*!* ENDSCAN
*!* OP.RELEASE
*!* WAIT CLEAR
*!* ENDIF
*!* BUTON=2
*!* DO dasaunu WITH 'Se reindexeaza fisierele locale?'
*!* IF BUTON=1
*!* SELE fistotv
*!* Maxs=RECCOUNT()
*!* j=0
*!* OP=CREA('PROGRESBAR')
*!* OP.titlu.CAPTION='Se reindexeaza fisierele locale'
*!* OP.SHOW()
*!* SELE fistotv
*!* *set filter to inlist(allt(UPPER(cale)),'&LOC\&NFSCURT\TEMPO','&LOC\&NFSCURT\TEMPO\')
*!* SET FILTER TO 'LOC'$ALLT(UPPER(cale))
*!* *brow
*!* SCAN
*!* SCAT MEMV
*!* WAIT WIND m.numef NOWAIT
*!* DO reindf WITH m.calealfa,m.cale,m.numef,m.alias,m.ordine,m.exc
*!* DO PR WITH j
*!* ENDSCAN
*!* OP.RELEASE
*!* WAIT CLEAR
*!* ENDIF
*!* SET DELETED ON
*!* *---------------
*!* m.nl=ll
*!* m.an=aa
*!* DO totv
*!* RETURN
*!* *__________________________________________
*!* PROCEDURE reindf
*!* PARAM calealfa,cale,numef,ALIAS,ordine,exc
*!* LOCAL calea,calea1,CALEAL,CALEAL1,T,fisa,fisv,fisa1,fisv1,aliasa
*!* calea=ALLT(cale)+'\'+ALLT(numef)+'.dbf'
*!* calea1=ALLT(cale)+'\'+ALLT(numef)+'.*'
*!* CALEAL=ALLT(calealfa)+'\'+ALLT(numef)+'.dbf'
*!* CALEAL1=ALLT(calealfa)+'\'+ALLT(numef)+'.*'
*!* fisa=ALLT(cale)+'\'+ALLT(numef)+'a.dbf'
*!* fisa1=ALLT(cale)+'\'+ALLT(numef)+'a.*'
*!* fisv=ALLT(cale)+'\_%'+ALLT(numef)+'.dbf'
*!* fisv1=ALLT(cale)+'\_%'+ALLT(numef)+'.*'
*!* aliasa=ALLT(ALIAS)+'a'
*!* IF FILE('&calea')
*!* *wait wind calea
*!* DELE FILE &fisa1
*!* DELE FILE &fisv1
*!* COPY FILE &CALEAL1 TO &fisa1
*!* SELE 0
*!* T='use '+fisa+' AGAIN ALIAS '+aliasa+' exclusive '
*!* &T
*!* *wait wind t
*!* SELE &aliasa
*!* ZAP
*!* SELE &aliasa
*!* APPEND FROM &calea
*!* SELE &aliasa
*!* *!* WAIT WINDOW "reindex"
*!* *!* SELECT &aliasa
*!* REINDEX
*!* USE
*!* RENAME &calea1 TO &fisv1
*!* RENAME &fisa1 TO &calea1
*!* ENDIF
*!* RETURN
*!* *______________________
*!* PROC errdeschid
*!* PARAM calealfa,cale,numef,ALIAS,ordine
*!* LOCAL calea,calea2,CALEAL,CALEAL2
*!* calea=ALLT(cale)+'\'+ALLT(numef)+'.dbf'
*!* calea2=ALLT(cale)+'\'+ALLT(numef)+'.cdx'
*!* CALEAL=ALLT(calealfa)+'\'+ALLT(numef)+'.dbf'
*!* CALEAL2=ALLT(calealfa)+'\'+ALLT(numef)+'.cdx'
*!* DO CASE
*!* CASE ERROR()=24 &&Alias name is already in use
*!* RETURN
*!* CASE ERROR()=19 OR ERROR()=26 OR ERROR()=114 &&Index file does not match table. sau Table has no index order set.
*!* DO mesajatent WITH 'Se reindexeaza fisierul "'+ALLT(numef)+'"',''
*!* IF FILE('&caleal2') AND cale#calealfa
*!* COPY FILE &CALEAL2 TO &calea2
*!* USE &calea AGAIN ALIAS &ALIAS
*!* SET INDEX TO &calea2
*!* REINDEX
*!* ELSE
*!* DO MESAJrosu WITH 'Nu se poate reindexa fisierul "'+ALLT(numef)+'".','Sugeram iesirea din program.'
*!* QUIT
*!* RETRY
*!* ENDIF
*!* CASE ERROR()=15 &&Not a table.
*!* DO danuquit WITH 'Fisierul "'+ALLT(numef)+'" este defect. Il inlocuim cu o structura vida?'
*!* IF FILE('&caleal')
*!* COPY FILE &CALEAL1 TO &calea1
*!* RETRY
*!* ELSE
*!* DO MESAJrosu WITH 'Nu se poate inlocui fisierul "'+ALLT(numef)+'".','Sugeram iesirea din program.'
*!* QUIT
*!* RETRY
*!* ENDIF
*!* CASE ERROR()=3 OR ERROR()=1705 &&File is in use. or File access is denied.
*!* DO MESAJrosu WITH 'Fisierul "'+ALLT(numef)+'" este deschis de alt program.','Inchideti fisierul si apoi redeschideti programul.'
*!* QUIT
*!* RETRY
*!* OTHERWISE
*!* DO MESAJrosu WITH 'Eroare necunoscuta (Nr.'+ALLT(STR(ERROR()))+')', 'Sugeram iesirea din program.'
*!* QUIT
*!* RETRY
*!* ENDCASE
*!* RETURN
*!* *____________________
*!* PROC errgen
*!* DO MESAJrosu WITH 'Eroare necunoscuta (Nr.'+ALLT(STR(ERROR()))+')', 'Sugeram iesirea din program.'
*!* QUIT
*!* RETRY
*!* RETURN
*!* *___ PROCEDURA DE DESCHIDERE DIN AFARA LUI TOTV_________________________________________________
*!* PROC DES
*!* PARAM ALIASF
*!* IF !DIRECTORY('&CALEFIRMA')
*!* DO MESAJrosu WITH 'Calea '+CALEFIRMA+' este incorecta!','Sugeram iesirea din program.'
*!* QUIT
*!* RETRY
*!* ENDIF
*!* DATE=CALEFIRMA+'\AN'+M.an+'\DATE'+M.nl
*!* IF !USED('FISTOTV')
*!* DO deschidf WITH '&dirgen\Imob2003\date\','&dirgen\Imob2003\date\','fistotvmf','fistotv','CALE',''
*!* ENDIF
*!* SELE fistotv
*!* LOCA FOR ALLT(UPPER(ALIAS))=ALLT(UPPER(ALIASF))
*!* IF !FOUND()
*!* DO MESAJrosu WITH 'Alias '+ALIASF+' inexistent!','Sugeram iesirea din program.'
*!* QUIT
*!* RETRY
*!* ELSE
*!* SCAT MEMV
*!* DO deschidf WITH m.calealfa,m.cale,m.numef,m.alias,m.ordine,m.exc
*!* ENDIF
*!* RETURN
*!* *______________________________
*!* PROCEDURE reindexaretempo
*!* DIRFIRM=loc+'\'+NFSCURT
*!* *CALEFIRMA=ALLTRIM(M.CALEFIRM)
*!* IF !DIRECTORY('&CALEFIRMA')
*!* DO MESAJrosu WITH 'Calea '+CALEFIRMA+' este incorecta!','Sugeram iesirea din program.'
*!* QUIT
*!* RETRY
*!* ENDIF
*!* DATE=CALEFIRMA+'\AN'+m.an+'\DATE'+M.nl
*!* DATEAN=CALEFIRMA+'\DATEAN'
*!* CALET=DIRFIRM+'\TEMPO'
*!* m.ANTET='S.C. '+M.FLUNG
*!* WAIT ' ' TIMEOUT 0.01
*!* CLOSE DATABASE
*!* LOCAL ll,aa
*!* ll=m.nl
*!* aa=m.an
*!* DO deschidf WITH '&dirgen\Imob2003\date\','&dirgen\Imob2003\date\','fistotvmf','fistotv','CALE',''
*!* SELE fistotv
*!* Maxs=RECCOUNT()
*!* j=0
*!* OP=CREA('PROGRESBAR')
*!* OP.titlu.CAPTION='Se reindexeaza fisierele locale'
*!* OP.SHOW()
*!* SELE fistotv
*!* *set filter to inlist(allt(UPPER(cale)),'&LOC\&NFSCURT\TEMPO','&LOC\&NFSCURT\TEMPO\')
*!* SET FILTER TO 'LOC'$ALLT(UPPER(cale))
*!* *brow
*!* SCAN
*!* SCAT MEMV
*!* WAIT WIND m.numef NOWAIT
*!* DO reindf WITH m.calealfa,m.cale,m.numef,m.alias,m.ordine,m.exc
*!* DO PR WITH j
*!* ENDSCAN
*!* OP.RELEASE
*!* WAIT CLEAR
*!* m.nl=ll
*!* m.an=aa
*!* DO totv
*!* RETURN
**** sfarsit reindexare imobilizari
Wait ' ' Timeout 0.01
Close Database
Local ll,aa
ll=m.nl
aa=m.an
Do deschidprog In totv.prg
*-----------------
Local man
man=''
BUTON=2
*Do DANU With 'Se reindexeaza fisierele lunare?'
*If BUTON=1
Sele 0
Use &CALEFIRMA\DATEAN\calendar Alias calendar
Select Distinct an From calendar Into Cursor jan Order By an
Select jan
Scan
man=an
Do dasaunu With 'Se reindexeaza fisierele lunare din anul '+man+'?'
If BUTON=1
Set Deleted Off && pentru mf
Sele calendar
Scan For !Deleted() And an=man
Scatter Memvar
Date=CALEFIRMA+'\AN'+m.an+'\DATE'+M.nl
BUTON=2
Do dasaunu With 'Se reindexeaza fisierele din luna '+m.nl+' '+m.an+' ?'
If BUTON=1
Sele fistotv
MAXS=Reccount()
j=0
OP=Crea('PROGRESBAR')
OP.titlu.Caption='Se reindexeaza fisierele lunii '+m.nl+' '+m.an
OP.Show()
Sele fistotv
Set Filter To
*scan for inlist(allt(lower(cale)),'&date','&date\')
lcFiltru = ['DATE'$UPPER(cale) AND !('DATEAN'$UPPER(cale)) AND !('_ALFA'$ALLT(UPPER(cale)))]
lcFiltru = lcFiltru + Iif(!Empty(lcConditie),[ and ]+lcConditie,"")
Scan For &lcFiltru
Scat Name loFis
Wait Wind loFis.numef Nowait
Do reindf With loFis.calealfa,loFis.cale,loFis.numef,loFis.Alias,loFis.ordine,loFis.exc
Do PR With j
Endscan
OP.Release
Release loFis
Wait Clear
Endif
Endscan
Set Deleted On
Endif
Select jan
Endscan
Use In calendar
*Endif
BUTON=2
Do dasaunu With 'Se reindexeaza fisierele generale din DATEAN?'
If BUTON=1
Sele fistotv
MAXS=Reccount()
j=0
OP=Crea('PROGRESBAR')
OP.titlu.Caption='Se reindexeaza fisierele generale. Asteptati...'
OP.Show()
Sele fistotv
Set Filter To
*scan for inlist(allt(lower(cale)),'&calefirma\datean','&calefirma\datean\')
lcFiltru = ['DATEAN'$ALLT(UPPER(cale)) AND !('_ALFA'$ALLT(UPPER(cale)))]
lcFiltru = lcFiltru + Iif(!Empty(lcConditie),[ and ]+lcConditie,"")
Scan For &lcFiltru
Scat Name loFis
Wait Wind loFis.numef Nowait
Do reindf With loFis.calealfa,loFis.cale,loFis.numef,loFis.Alias,loFis.ordine,loFis.exc
Do PR With j
Endscan
OP.Release
Wait Clear
Endif
BUTON=2
Do dasaunu With 'Se reindexeaza fisierele locale?'
If BUTON=1
Sele fistotv
MAXS=Reccount()
j=0
OP=Crea('PROGRESBAR')
OP.titlu.Caption='Se reindexeaza fisierele locale'
OP.Show()
Sele fistotv
*set filter to inlist(allt(UPPER(cale)),'&LOC\&NFSCURT\TEMPO','&LOC\&NFSCURT\TEMPO\')
Set Filter To 'LOC'$Allt(Upper(cale))
*brow
Scan
Scat Name loFis
Wait Wind loFis.numef Nowait
Do reindf With loFis.calealfa,loFis.cale,loFis.numef,loFis.Alias,loFis.ordine,loFis.exc
Do PR With j
Endscan
OP.Release
Release loFis
Wait Clear
Endif
*---------------
m.nl=ll
m.an=aa
Do totv
Return
*__________________________________________
Procedure reindf
Param calealfa,cale,numef,Alias,ordine,exc
Local calea,calea1,CALEAL,CALEAL1,T,fisa,fisv,fisa1,fisv1,aliasa
calea=Allt(cale)+'\'+Allt(numef)+'.dbf'
calea1=Allt(cale)+'\'+Allt(numef)+'.*'
CALEAL=Allt(calealfa)+'\'+Allt(numef)+'.dbf'
CALEAL1=Allt(calealfa)+'\'+Allt(numef)+'.*'
fisa=Allt(cale)+'\'+Allt(numef)+'_a.dbf'
fisa1=Allt(cale)+'\'+Allt(numef)+'_a.*'
fisv=Allt(cale)+'\_%'+Allt(numef)+'.dbf'
fisv1=Allt(cale)+'\_%'+Allt(numef)+'.*'
aliasa=Allt(numef)+'_a'
lcFisierFirma=calea
lcAlias=Alltrim(Alias)
llUsed=.F.
If Used(lcAlias)
llUsed=.T.
lcFis=Juststem(Dbf(lcAlias))
Use In (lcAlias)
Endif
x=Fopen('&lcFisierFirma',12)
If x < 0
Do mesaj With "Fisierul "+lcFisierFirma," Este deschis de alt program. Nu se poate reindexa"
If llUsed
Do des With lcAlias
Endif
Return
Endif
Fclose(x)
If File('&calea')
Wait Window lcAlias+[ ]+"Se sterg fisierele temporare..." Nowait
Dele File &fisa1
Dele File &fisv1
Wait Window lcAlias+[ ]+"Se copiaza structurile vide..." Nowait
Copy File &CALEAL1 To &fisa1
Sele 0
T='use '+fisa+' AGAIN ALIAS '+aliasa+' exclusive '
&T
*wait wind t
Sele &aliasa
Zap
Wait Window lcAlias+[ ]+"Se copiaza datele originale..." Nowait
*!* SELE &aliasa
*!* APPEND FROM &calea
reindf_append(lcAlias,aliasa,calea)
Wait Window lcAlias+[ ]+"Se reindexeaza fisierul..." Nowait
Sele &aliasa
Reindex
Use
Rename &calea1 To &fisv1
Rename &fisa1 To &calea1
Wait Window lcAlias+[ ]+"Operatiune incheiata cu succes..." Nowait
Endif
Endproc && reindf
***----------------------------------------------------------------------------------
*** copie indexul din structurile vide, deschide exclusiv fisierul si da reindex
*** fisierul trebuie sa fie inchis
Procedure REINDFCDX
Parameters tcCaleAlfa,tcCale,tcNumef
*** calea structurii vide, calea fisierului, numele fisierului
Private lcCDXd,lcDBF,lcCDXs
lcCDXd=Allt(tcCale)+'\'+Allt(tcNumef)+'.cdx'
lcDBF=Allt(tcCale)+'\'+Allt(tcNumef)+'.dbf'
lcCDXs=Allt(tcCaleAlfa)+'\'+Allt(tcNumef)+'.cdx'
Wait Window "Se copiaza structurile vide..." Nowait
Copy File('&lcCDXs') To ('&lcCDXd')
Use ('&lcDBF') In 0 Excl Alias FisierR
Set Index To ('&lcCDXd')
Wait Window "Se reindexeaza fisierul..." Nowait
Select FisierR
Reindex
Use In FisierR
Wait Window "Operatiune incheiata cu succes..." Nowait
Endproc && REINDFCDX
*______________________
Proc errdeschid_r
Param calealfa,cale,numef,Alias,ordine
Local calea,calea2,CALEAL,CALEAL2
calea=Allt(cale)+'\'+Allt(numef)+'.dbf'
calea2=Allt(cale)+'\'+Allt(numef)+'.cdx'
CALEAL=Allt(calealfa)+'\'+Allt(numef)+'.dbf'
CALEAL2=Allt(calealfa)+'\'+Allt(numef)+'.cdx'
Do Case
Case Error()=24 &&Alias name is already in use
Return
Case Error()=19 Or Error()=26 Or Error()=114 &&Index file does not match table. sau Table has no index order set.
Do mesajatent With 'Se reindexeaza fisierul "'+Allt(numef)+'"',''
If File('&caleal2') And cale#calealfa
Copy File &CALEAL2 To &calea2
Use &calea Again Alias &Alias
Set Index To &calea2
Reindex
Else
Do MESAJrosu With 'Nu se poate reindexa fisierul "'+Allt(numef)+'".','Sugeram iesirea din program.'
Quit
Retry
Endif
Case Error()=15 &&Not a table.
Do danuquit With 'Fisierul "'+Allt(numef)+'" este defect. Il inlocuim cu o structura vida?'
If File('&caleal')
Copy File &CALEAL1 To &calea1
Retry
Else
Do MESAJrosu With 'Nu se poate inlocui fisierul "'+Allt(numef)+'".','Sugeram iesirea din program.'
Quit
Retry
Endif
Case Error()=1683 &&index tag is not found
Do MESAJrosu With "Structura vida a fisierului "+Alltrim(numef)+" este stricata!",""
*!* Do MESAJrosu With 'Fisierul "'+Allt(numef)+'" este deschis de alt program.','Inchideti fisierul si apoi redeschideti programul.'
Quit
Retry
Case Error()=3 Or Error()=1705 &&File is in use. or File access is denied.
Do MESAJrosu With 'Fisierul "'+Allt(numef)+'" este deschis de alt program.','Inchideti fisierul si apoi redeschideti programul.'
Quit
Retry
Otherwise
Do MESAJrosu With 'Eroare necunoscuta (Nr.'+Allt(Str(Error()))+')', 'Sugeram iesirea din program.'
Quit
Retry
Endcase
Endproc && errdeschid_r
*____________________
Proc errgen
Do MESAJrosu With 'Eroare necunoscuta (Nr.'+Allt(Str(Error()))+')', 'Sugeram iesirea din program.'
Quit
Retry
Return
*______________________________
Procedure reindexaretempo
DIRFIRM=loc+'\'+NFSCURT
*CALEFIRMA=ALLTRIM(M.CALEFIRM)
If !Directory('&CALEFIRMA')
Do MESAJrosu With 'Calea '+CALEFIRMA+' este incorecta!','Sugeram iesirea din program.'
Quit
Retry
Endif
Date=CALEFIRMA+'\AN'+m.an+'\DATE'+M.nl
DATEAN=CALEFIRMA+'\DATEAN'
CALET=DIRFIRM+'\TEMPO'
m.ANTET='S.C. '+M.FLUNG
Wait ' ' Timeout 0.01
Close Database
Local ll,aa
ll=m.nl
aa=m.an
*!* DO deschidf WITH '&dirgen\gestiuni\date\datean\','&dirgen\gestiuni\date\datean\','fistotvgest','fistotv','CALE',''
Do deschidprog In totv.prg
Sele fistotv
M=Reccount()
j=0
OP=Crea('PROGRESBAR')
OP.titlu.Caption='Se reindexeaza fisierele locale'
OP.Show()
Sele fistotv
*set filter to inlist(allt(UPPER(cale)),'&LOC\&NFSCURT\TEMPO','&LOC\&NFSCURT\TEMPO\')
Set Filter To 'LOC'$Allt(Upper(cale))
*brow
Scan
Scat Name loFis
Wait Wind loFis.numef Nowait
Do reindf With loFis.calealfa,loFis.cale,loFis.numef,loFis.Alias,loFis.ordine,loFis.exc
Do PR With j
Endscan
OP.Release
Release loFis
Wait Clear
m.nl=ll
m.an=aa
Do totv
Endproc && reindexaretempo
*** INCEPUT PROCEDURA reindf_append
Procedure reindf_append
Parameters tcAlias,tcAlias_A,tcFisOriginal
&& tcAlias: aliasul tabelului
&& tcAlias_A: aliasul tabelului vid+"_A"
&& tcFisOriginal: calea catre fisierul care se reindexeaza cu datE
Private lcAlias,lcAlias_A,lcFisOriginal,llUsed
lcAlias=Alltrim(Upper(tcAlias))
lcAlias_A=Alltrim(Upper(tcAlias_A))
lcFisOriginal=Alltrim(Upper(tcFisOriginal))
Do Case
Case Inlist(lcAlias,"DEBITOR","CREDITOR","ACHIT542")
If !EXISTACAMP(lcAlias_A,"LUAT") && daca in fisierul structura vida nu am campul <luat>
lcFisTemp=Alltrim(loc)+"\"+Alltrim(NFSCURT)+"\tempo\T"+lcAlias+".dbf"
lcFisTemp=Strtran(lcFisTemp,"\\","\")
&& deschid fisierul original
llUsed=.T.
If !Used(lcAlias)
llUsed=.F.
Use ('&lcFisOriginal') In 0 Shared Alias &lcAlias
Endif
Select(lcAlias)
If !EXISTACAMP(lcAlias,"LUAT") && DACA IN FISIERUL ORIGINAL NU EXISTA CAMPUL <LUAT> NU FAC NIMIC
If !llUsed
Use In (lcAlias)
Endif
Else
If Inlist(lcAlias,"DEBITOR","ACHIT542")
Select *,luat As debit,dat As credit From &lcAlias Into Cursor tt
Else
Select *,dat As debit,luat As credit From &lcAlias Into Cursor tt
Endif
If !llUsed
Use In (lcAlias)
Endif
Select (lcAlias_A)
Append From Dbf('tt')
Use In tt
Endif
Endif
Otherwise
Select (lcAlias_A)
Append From &lcFisOriginal
Endcase
Endproc
*** SFARSIT PROCEDURA reindf_append