#ifndef __SC100_H
#define __SC100_H

#ifndef __APPLICAT_H
#include <applicat.h>
#endif

#ifndef __SALDACON_H
#include "../cg/saldacon.h"
#endif

#ifndef __MASK_H
class TMask;
#endif

class TSaldaconto_app : public TApplication
{                     
  TMask* _msk;        
  TArray _file;
  
  TPartite_array _partite;
  
  bool _allow_firm;
  bool _ges_val; 
          
protected:  // TApplication
  virtual bool create();
  virtual bool destroy();
  virtual bool menu(MENU_TAG tag);
  virtual bool firm_change_enabled() const { return _allow_firm; }
  virtual void on_config_change();
  
protected:
  void open_files(int logicnum, ...);
  void close_files() { _file.destroy(); }
  
  void edit_partite(const TMask& m);
  
public:       
  TMask& curr_mask() { return *_msk; }
  TPartite_array& partite() { return _partite; }
  
  bool gestione_valuta() const { return _ges_val; }
  
  void gioca_cambi(TMask& m, int force = 0x0);
  static bool totale_handler(TMask_field& f, KEY k);
  static bool imposte_handler(TMask_field& f, KEY k);
  static bool totval_handler(TMask_field& f, KEY k);
  static bool cambio_handler(TMask_field& f, KEY k);
  static bool datacambio_handler(TMask_field& f, KEY k);
  static bool valuta_handler(TMask_field& f, KEY k);

  TSaldaconto_app();
  virtual ~TSaldaconto_app() {}
};

inline TSaldaconto_app& app() { return (TSaldaconto_app&)main_app(); }

#endif               
