local lunatrec,antrec,lunacrt,ancrt,dattrec,datcrt
set safety off

lunacrt=m.nl
ancrt=m.an

sele calendar
locate for m.an=an and m.nl=nl
skip -1
if bof()
		*este prima luna deschisa__________

		copy file &dirgen\mfix2000\date\*.* to &date\*.*

	else
		*nu este prima luna deschisa__________
	lunatrec=nl
	antrec=an
	dattrec=calefirma+'\AN'+antrec+'\DATE'+lunatrec+'\'+'mf.*'
	LOCAL DATTREC1
		dattrec1=calefirma+'\AN'+antrec+'\DATE'+lunatrec+'\'+'mf.DBF'


			*dar daca nici luna precedenta nu a fost dechisa__________
	if !file('&dattrec1')

		copy file &dirgen\mfix2000\date\*.* to &date\*.*

	 else

		copy file &dattrec to &date\*.*
	
	endif
	SELECT 0
	USE &date\mf.dbf;
		AGAIN ALIAS mf 
		repl all cod with 0
	sele mf
	use
endif

return
