#include <relapp.h>
#include <stdtypes.h>
#include <lffiles.h>
#include "ba4.h"
#include "ba4600.h"

class BA4600_application : public TRelation_application
{
	TMask* _msk;
	TRelation* _rel;
	TLocalisamfile* _anag;
	TLocalisamfile* _ditte;

	bool user_create() ;                         
	bool user_destroy() ;                        
	virtual TMask* get_mask(int mode) { return _msk;}
	virtual bool changing_mask(int mode) { return FALSE;}
	virtual TRelation* get_relation() const { return _rel;}

public:
  BA4600_application() {}
  virtual ~BA4600_application() {}
  virtual void init_query_mode(TMask& m) ;
  virtual void init_query_insert_mode(TMask& m) ;
};

void BA4600_application::init_query_mode(TMask& m)

{
	m.show(FLD_SC1_CODANAGRSOH);
	m.hide(FLD_SC1_CODANAGRSO);
}


void BA4600_application::init_query_insert_mode(TMask& m)

{
	m.show(FLD_SC1_CODANAGRSO);
	m.hide(FLD_SC1_CODANAGRSOH);
}


bool BA4600_application::user_create() 
{
  _msk = new TMask("ba4600a") ;
	_rel = new TRelation(LF_SOCI) ;
	_anag = new TLocalisamfile(LF_ANAG) ;
	_ditte = new TLocalisamfile(LF_NDITTE) ;
	set_search_field(FLD_SC1_CODANAGRSOH);
	return TRUE;
}

bool BA4600_application::user_destroy() 
{
  delete _msk;
	delete _rel;
	delete _anag;
	delete _ditte;
	return TRUE;
}

int ba4600(int argc, char* argv[])
{
  BA4600_application a ;
  a.run(argc, argv, "Anagrafica Soci");
  return 0;
}
