#ifndef __RELATION_H
#include <relation.h>
#endif

class TClifoVI:public TRelation
{
  // @DPRIV
  TArray _indirizzi;
  int _oldindirizzi; 
  bool _gesven;
  
  // @END
protected:
  // @FPROT
  int write_rec(bool re, const TRectype& r, TLocalisamfile& f);
  int cancella(TLocalisamfile& f, int da, int a);
  int registra(bool re, bool force);
  int read_indirizzi();
  // @END
public:
  virtual int next(TReclock lockop=_nolock) {return (lfile().next(lockop) || read_indirizzi());}
  virtual int prev(TReclock lockop=_nolock) {return (lfile().prev(lockop) || read_indirizzi());}
  virtual int first(TReclock lockop=_nolock) {return (lfile().first(lockop) || read_indirizzi());}
  virtual int last(TReclock lockop=_nolock) {return (lfile().last(lockop) || read_indirizzi());}
  virtual int skip(TReclock lockop=_nolock) {return (lfile().skip(lockop) || read_indirizzi());}
  virtual int read(TIsamop = _isgteq, TReclock lockop = _nolock, TDate& atdate = (TDate&) botime);
  virtual int write(bool force=TRUE, TDate& atdate = (TDate&) botime);
  virtual int rewrite(bool force=TRUE, TDate& atdate = (TDate&) botime);
  virtual int remove(TDate& atdate = (TDate&) botime);

  TRectype& indirizzo(int i);
  int indirizzi_items() const {return _indirizzi.items();}
  void destroy_rows();
  
  void gestione_vendite(bool gv) { _gesven = gv; }

  TClifoVI();
  virtual ~TClifoVI() {}
};
