// OBSOLETO
// 771233.h - Distinta quadro G
#include <relapp.h>
#include <config.h>
#include <msksheet.h>
#include <sort.h>
#include <tabutil.h>
#include <progind.h>
#include "77lib.h"

#include <scperc.h>
#include <rpag.h>
#include <perc.h>
#include <prospe1.h>
#include <defmask.h>

// #include "771235a.h" 
#include "774200.h"

class TDistintaQuadroG : public TRelation_application
{
/**********************************
  private:
    struct righe_pag
    {
     char tipoa;
     char codan[6];
     char codcau[3];
     char perc[7]; //3 + 2decimali + la virgola
     real somme;
     real impo;
     real rite;
     real comp;                            
     bool acim;
    };
    righe_pag*       _rig;   
*******************************************/    
    TRelation*       _rel;
    TMask*           _msk[2];
    TSort*           _sort;
    long             _codanagr;
    char             _tipoa, _tipoq;
    int              _nproga;
    int              _mode;
    int              _anno_dic;  // anno dichiarazione
    TLocalisamfile*  _per, *_scper, *_rpag, *_qd;
    TTable*         _ca7;                                  
    TString80		_title;
    TRiporti         _rip;
    
    bool  _registra;
    int   _file;
    
  private:               
    static bool nprog_handler   (TMask_field& f, KEY key);
    static bool codanagr_handler(TMask_field& f, KEY key);
    static bool genera_handler  (TMask_field& f, KEY key);
    static bool codditta_hnd    (TMask_field& f, KEY key);    
    static bool setta_nprog     (TMask_field& f);
    static bool imponibile_hnd  (TMask_field& f, KEY key);
  
  protected:
    virtual bool user_create() { return TRUE; }
    virtual bool user_destroy() { return TRUE; }
//    virtual int  rewrite(const TMask& m);
//    virtual int  write  (const TMask& m);  
//    virtual bool remove();
    virtual TRelation* get_relation() const { return _rel; }
    virtual TMask* get_mask(int mode) { return _msk[0]; }
    virtual bool changing_mask(int mode) { return TRUE; }
//    virtual void init_query_mode (TMask&);
//    virtual void init_query_insert_mode (TMask&);    
//    virtual void on_config_change();    

/****************************************************
    TMask* load_mask(int n);
    bool generazione(); 
    bool azzera_quadro();
    void riempi_record(char,long,int,const real&,const real&,const real&,const real&,const real&,bool);
    void init_sort(); 
    void leggi_sort(TProgind&);
    TRectype& look_causali(int c);
    int anno_dic() const { return _anno_dic; }
    bool scrivi_dati_per(TRectype& rec);
    void genera_prospetto(int,real&,real&,real&);
***********************************/
  public:                    
    const char* 	taitol() { return (const char*)_title; }  
  public:
    TDistintaQuadroG();
    virtual ~TDistintaQuadroG() {};
};                    

