// 774200.h - Riporti dai quadri
#ifndef __774200_H
#define __774200_H

#include <mailbox.h>                

#include "base.h"
#include "basebis.h"
#include "quadroa.h"

bool filter_func (const TRelation *);

enum {A,A1,A2,A3,B,B1,C,D,D1,E,E1,E2,F,F1,F2,G,G1,H,I,N,P,Q,R,S,T};

const int CAMPI_IB1 = 61;
const int CAMPI_IB2 = 50;
const int CAMPI_A   = 53;

HIDDEN const char* _campi_I1[CAMPI_IB1] = { BSE_A0NFCOM,BSE_A0NLDIP,BSE_A0COBB,BSE_A0CNET,BSE_A0EPREV,BSE_A0IITRA,
                                            BSE_A0CTER,BSE_A0TIMP,BSE_A0ILOR,BSE_A0TDET,BSE_A0RTER,BSE_A0RDAT,
                                            BSE_A0ERIT,BSE_A0CARR,BSE_A0AARR,BSE_A0DARR,BSE_A0RARR,BSE_A0RITSI,
                                            BSE_A0CINPS,BSE_A0RITOPEVA,BSE_A0RITOPESA,BSE_A0CIIAUT,BSE_A0NADLAV,
                                            BSE_A0NACAAF,BSE_B0NFCOM,BSE_B0NLDIP,BSE_B0TFR93,BSE_B0AI,BSE_B0COLAV,
                                            BSE_B0TFR7492,BSE_B0AI7492,BSE_B0RITSI,BSE_B0IMP,BSE_B0TIMP,BSE_B0ROP,
                                            BSE_B0AIINPS,BSE_B0ROPESA,BSE_B0CIIAUT,BSE_B1NFCOM,BSE_B1NPER,BSE_B1TIND,
                                            BSE_B1TIRM,BSE_B1TICOM,BSE_C0NFCOM,BSE_C0NLASS,BSE_C0ACTOT,BSE_C0CONTSSN,BSE_C0SNSRIT,
                                            BSE_C0ROPE,BSE_C0CIIAUT,BSE_D0NFCOM,BSE_D0NLAUT,BSE_D0ACTOT,BSE_D0SNSRIT,
                                            BSE_D0ROPE,BSE_D0CIIAUT,BSE_D1NFCOM,BSE_D1NPER,BSE_D1TACOR,BSE_D1SNSRIT,
                                            BSE_D1ROPE};

HIDDEN const char* _campi_I2[CAMPI_IB2] = { BSB_E0NFCOM,BSB_E0NPER,BSB_E0AIMP,BSB_E0ROPE,BSB_E0SNSRIT,BSB_E1NFCOM,
                                            BSB_E1NPER,BSB_E1SCOR,BSB_E1BCOM,BSB_E1ROPE,BSB_E1ACOM,BSB_E1BCOM2,
                                            BSB_E1ROPE2,BSB_E2NFCOM,BSB_E2NPER,BSB_E2ROPE,BSB_E2SSRIT,BSB_F0SRITA,
                                            BSB_F0ROPEA,BSB_F0TACCA,BSB_F0EDACCA,BSB_F0ERIMA,BSB_F0SSRITBF,BSB_F0ROPEBF,
                                            BSB_F0SSVA,BSB_F0ROPEVA,BSB_F1SSRIT,BSB_F1ROPE,BSB_F2SSRIT,BSB_F2ROPE,
                                            BSB_G0NFCOM,BSB_G0NAZI1,BSB_G0UDEN1,BSB_G0UNAT1,BSB_G0IUTI2,BSB_G0ROPE,
                                            BSB_G0USRIT3,BSB_G0RACC3,BSB_G0RIMP3,BSB_G0UNSRIT3,BSB_G0USPE,BSB_G0UPAG,
                                            BSB_G0NPER,BSB_G1UCOR,BSB_G1USRIT,BSB_G1RACC,BSB_G1RIMP,BSB_G1UNSRIT,
                                            BSB_H0CODLAV,BSB_H0COLDIP};                                         
                                          
HIDDEN const char* _campi_A [CAMPI_A]   = { 
		QUA_DENARO,		QUA_NATURA,		QUA_COBBDIP,	QUA_COMPNETTI,
		QUA_AMMLORDO,	QUA_IACOBBCD,	QUA_NORIT,		QUA_TOTIMP,
		QUA_AIENTIPREV,	QUA_CCTAMMCONT,	QUA_TOTIMP2,	QUA_ICTOTIMP,
		QUA_DETCC,		QUA_DETFC,		QUA_DETAF,		QUA_DETLD,
		QUA_TOTDET,		QUA_INCDETFC,	QUA_AMRIOT,		QUA_AMRIODL,
		QUA_ECCRITRIMB,	QUA_AMMRITDOV,	QUA_ERSPSAN,	QUA_PRASSVI,
		QUA_CONPRECO,	QUA_COBBDIP2,	QUA_AMMIMP,		QUA_DETIMPOS,
		QUA_RITESEG,	QUA_SVNASSRI,	QUA_AIFCSSN,	QUA_CONEFF,
		QUA_IMPVERS,	QUA_INTERE,		QUA_CSSN95CV,	QUA_INTERE2,
		QUA_CNEFF,		QUA_RETCON,		QUA_IMPRIMB,	QUA_IMPVER,
		QUA_IMPVER2,	QUA_INTER,		QUA_STSIRPEF,	QUA_CONRIMB,
		QUA_INTER2,		QUA_CONVER2,	QUA_INTER3,		QUA_STSCSSN70, QUA_M730NLIQ,
		QUA_CODCAAF,	QUA_DETO,		QUA_INTIRPEF,	QUA_CONVER
};
                                            


class TRiporti  
{ 
  friend bool filter_func (const TRelation *);
  
  long      _codditta;
  int       _annodic;
  TString16 _quadro;

  void  setta_flag_quadri_comp (const long codditta, const int posquadro, const bool aur, TLocalisamfile& basebis, const long dich=0L);
// Setta flag di compilato guardando se esistono i riporti sul quadro I
  void  setta_flag_quadro_I (const long codditta, const long dich=0L);

  void  calcola_riporti_A (TCursor* cur, const long dich=0L); 
  void  calcola_riporti_A1(TCursor* cur, const long dich=0L);   
  void  calcola_riporti_A2(TCursor* cur, const long dich=0L);     
  void  calcola_riporti_A3(TCursor* cur, const long dich=0L);       
  void  calcola_riporti_B (TCursor* cur, const long dich=0L); 
  void  calcola_riporti_B1(TCursor* cur, const long dich=0L); 
  void  calcola_riporti_H (TCursor* cur, const long dich=0L); 
  void  calcola_riporti_C (TCursor* cur, const long dich=0L);
  void  calcola_riporti_D (TCursor* cur, const long dich=0L);
  void  calcola_riporti_D1(TCursor* cur, const long dich=0L);  
  void  calcola_riporti_E (TCursor* cur, const long dich=0L);
  void  calcola_riporti_E1(TCursor* cur, const long dich=0L);
  void  calcola_riporti_E2(TCursor* cur, const long dich=0L);
  void  calcola_riporti_F (TCursor* cur, const long dich=0L);
  void  calcola_riporti_F1(TCursor* cur, const long dich=0L);
  void  calcola_riporti_F2(TCursor* cur, const long dich=0L);    
  void  calcola_riporti_G (TCursor* cur, const long dich=0L);                                                
  void  calcola_riporti_G1(TCursor* cur, const long dich=0L);      
public:                                        
  bool  riporta_I_globale(const long dich);
  bool  riporti_dich(const long dich, const int anno);
  bool  set(const TString& quadro, int anno=0, const long codditta=0L, const long dichiarante=0L);
  void	set_compilato(const long codditta, const int posquadro, const bool compilato);

  TRiporti() {}
  virtual ~TRiporti() {}
};

#endif

