Corretta stampa acuisti per cassa in liquidazione git-svn-id: svn://10.65.10.50/branches/R_10_00@22838 c028cbd2-c16b-5b4b-a496-9718f37d4682
106 lines
3.6 KiB
C++
Executable File
106 lines
3.6 KiB
C++
Executable File
#ifndef __CGSALDA3_H__
|
|
#define __CGSALDA3_H__
|
|
|
|
#ifndef __TREE_H
|
|
#include <tree.h>
|
|
#endif
|
|
|
|
#ifndef __CGSALDAC_H__
|
|
#include "../cg/cgsaldac.h"
|
|
#endif
|
|
|
|
///////////////////////////////////////////////////////////
|
|
// TPartite_cache
|
|
///////////////////////////////////////////////////////////
|
|
|
|
enum TSolder_tree_flags { sct_single_game, sct_open_games, sct_closed_games, sct_all_games, sct_show_val = 8 };
|
|
|
|
// Lista delle partite presenti in un TSolder_tree
|
|
class TPartite_cache : public TString_array
|
|
{
|
|
TPartite_array* _games;
|
|
TBill _bill; // Cliente corrente
|
|
long _numreg; // Numero di registrazione corrente
|
|
TString4 _codval; // Valuta corrente
|
|
TSolder_tree_flags _flags;
|
|
|
|
protected:
|
|
const TString& build_key(int anno, const char* partita) const;
|
|
|
|
public:
|
|
TPartite_array& partite() { CHECK(_games, "NULL _games"); return *_games; }
|
|
const TBill& bill() const { return _bill; }
|
|
long num_reg() const { return _numreg; }
|
|
const TString& codice_valuta() const { return _codval; }
|
|
void set_bill(TPartite_array& games, const TBill& conto, long numreg, const TString& codval, TSolder_tree_flags flags);
|
|
|
|
bool has_game(int id) const { return id >= 0 && id < items(); }
|
|
TPartita* find(int id) const; // Find by index (0 based)
|
|
TPartita& game(int id) const { TPartita* g = find(id); CHECKD(g, "NULL game ", id); return *g; }
|
|
int game_id(int anno, const char* num) const;
|
|
|
|
bool add_game(int anno, const char* partita);
|
|
bool add_game(const TRectype& rec);
|
|
bool add_game(const TPartita& part);
|
|
|
|
TPartite_cache() : _games(NULL) {}
|
|
};
|
|
|
|
///////////////////////////////////////////////////////////
|
|
// TSolder_tree
|
|
///////////////////////////////////////////////////////////
|
|
|
|
class TSolder_tree : public TBidirectional_tree
|
|
{
|
|
TPartite_cache _cache;
|
|
TToken_string _curr;
|
|
TString4 _codval;
|
|
real _cambio;
|
|
int _num_rig;
|
|
TSolder_tree_flags _flags;
|
|
|
|
protected:
|
|
void set_var_imp(TVariant& var, const TImporto& imp, bool in_value) const;
|
|
void set_var_real(TVariant& row, const real& imp, bool in_value) const;
|
|
|
|
public:
|
|
virtual bool goto_root();
|
|
virtual bool goto_firstson();
|
|
virtual bool goto_rbrother();
|
|
virtual bool goto_node(const TString &id) { _curr = id; return true; }
|
|
virtual bool could_have_son() const;
|
|
virtual bool has_son() const;
|
|
virtual bool has_rbrother() const;
|
|
virtual TObject* curr_node() const { return (TObject*)&_curr; }
|
|
virtual void node2id(const TObject* obj, TString& id) const { id = *(TString*)obj; }
|
|
|
|
virtual bool has_root() const;
|
|
virtual bool has_father() const;
|
|
virtual bool has_lbrother() const;
|
|
virtual bool goto_father();
|
|
virtual bool goto_lbrother();
|
|
virtual bool get_description(TString& desc) const;
|
|
virtual TFieldtypes get_var(const TString& name, TVariant& var) const;
|
|
virtual bool marked() const;
|
|
virtual TImage* image(bool selected) const;
|
|
|
|
public:
|
|
void set_root(TPartite_array& games, const TBill& conto, long numreg, int numrig,
|
|
const TString& codval, const real& cambio, TSolder_tree_flags flags);
|
|
long num_reg() const { return _cache.num_reg(); }
|
|
int num_rig() const { return _num_rig; }
|
|
const TString& codval() const { return _codval; }
|
|
const bool in_val() const { return _codval.full(); }
|
|
bool show_val() const { return (_flags & sct_show_val) != 0; }
|
|
|
|
TPartita* partita() const;
|
|
TRiga_partite* riga_partita() const;
|
|
TRiga_scadenze* scadenza() const;
|
|
TRectype* pagamento() const;
|
|
const TBill& bill() const { return _cache.bill(); }
|
|
bool goto_game(int anno, const char* numpart, int nriga, int nrata, int nrigp);
|
|
bool goto_single_game(int anno, const char* numpart, int nriga, int nrata, int nrigp);
|
|
};
|
|
|
|
#endif
|