cbb608d183
Files correlati : Ricompilazione Demo : [ ] Commento : Riportata la versione 1.5 fino alla patch 811 git-svn-id: svn://10.65.10.50/trunk@8985 c028cbd2-c16b-5b4b-a496-9718f37d4682
130 lines
4.0 KiB
C++
Executable File
130 lines
4.0 KiB
C++
Executable File
#ifndef __SVLIB01_H
|
||
#define __SVLIB01_H
|
||
|
||
#ifndef __VARREC_H
|
||
#include <varrec.h>
|
||
#endif
|
||
|
||
#ifndef __ASSOC_H
|
||
#include <assoc.h>
|
||
#endif
|
||
|
||
#ifndef __VELIB_H
|
||
class TRiga_documento;
|
||
#endif
|
||
|
||
#include "svlib09.h"
|
||
|
||
enum TFrequenza_statistiche { fs_nulla, fs_giornaliera,
|
||
fs_settimanale, fs_quindicinale,
|
||
fs_mensile, fs_bimestrale,
|
||
fs_trimestrale, fs_quadrimestrale,
|
||
fs_semestrale, fs_annuale };
|
||
|
||
//@cmember Converte una carattere in una frequenza delle statisitiche
|
||
TFrequenza_statistiche char2frequency(char c);
|
||
//@cmember Converte una frequenza delle statistiche in un carattere
|
||
char frequency2char(TFrequenza_statistiche f);
|
||
//@cmember Converte una carattere nel nome completo della frequenza
|
||
TString & char2freqname(char c);
|
||
|
||
//Arrotondamento di una data alla frequenza specificata
|
||
const TDate& floor(TDate& data, TFrequenza_statistiche freq);
|
||
const TDate& ceil(TDate& data, TFrequenza_statistiche freq);
|
||
|
||
//Ritorna il rapporto tra le frequenze: 0 se impossibile stabilirlo
|
||
int divide(TFrequenza_statistiche f1, TFrequenza_statistiche f2);
|
||
|
||
//Ritorna l'ultimo periodo di un anno (primo = 1)
|
||
int last_period(int anno, TFrequenza_statistiche freq);
|
||
int last_period(const TDate & d, TFrequenza_statistiche f);
|
||
|
||
//Ritorna la parte "periodo" di una data (l'anno si ottiene da year())
|
||
int date2period(const TDate& data, TFrequenza_statistiche freq);
|
||
|
||
//Converte una coppia anno+periodo in un TDate in base alla frequenza passata
|
||
const TDate & period2date(const int anno, int periodo, TFrequenza_statistiche f);
|
||
|
||
//Converte una data in un long in base alla frequenza passata
|
||
long date2long(const TDate d, TFrequenza_statistiche f);
|
||
|
||
//Converte una coppia anno+periodo in un long in base alla frequenza passata
|
||
long period2long(const int anno, const int periodo, TFrequenza_statistiche f);
|
||
|
||
class TStats_agg : public TObject
|
||
{
|
||
class TStats_data : public TObject
|
||
{
|
||
public:
|
||
real _quantita, _valore;
|
||
};
|
||
|
||
long _ditta;
|
||
TAssoc_array _data;
|
||
|
||
TFrequenza_statistiche _frequenza;
|
||
bool _merce, _prestazioni, _spesedoc, _omaggi, _omaggio_is_merce;
|
||
bool _art_nocode, _art_noanag, _art_noanag_grp;
|
||
bool _agente, _cliente, _zona, _articolo, _giacenza, _magazzino,_catvend;
|
||
TString16 _valfield;
|
||
|
||
protected:
|
||
void test_firm() const;
|
||
void put_key(TRectype& stat, TToken_string& key) const;
|
||
TStats_agg::TStats_data& find(const TRiga_documento& rdoc);
|
||
bool can_add(const TRiga_documento& rdoc) const;
|
||
|
||
public:
|
||
void init();
|
||
void reset();
|
||
bool sub(const TRiga_documento& rdoc);
|
||
bool add(const TRiga_documento& rdoc);
|
||
bool update();
|
||
// restituisce TRUE se l'archivio di riepilogo <20> vuoto
|
||
bool empty();
|
||
TFrequenza_statistiche frequency() const
|
||
{ return _frequenza; }
|
||
|
||
int date2period(const TDate& datadoc) const
|
||
{ return ::date2period(datadoc, _frequenza); }
|
||
|
||
bool grp_agente() const { test_firm(); return _agente; }
|
||
bool grp_cliente() const { test_firm(); return _cliente; }
|
||
bool grp_zona() const { test_firm(); return _zona; }
|
||
bool grp_articolo() const { test_firm(); return _articolo; }
|
||
bool grp_giacenza() const { test_firm(); return _giacenza; }
|
||
bool grp_magazzino() const { test_firm(); return _magazzino; }
|
||
bool grp_catven() const { test_firm(); return _catvend; }
|
||
|
||
bool omaggio_is_merce() const { test_firm(); return _omaggio_is_merce; }
|
||
|
||
TStats_agg();
|
||
virtual ~TStats_agg() { }
|
||
};
|
||
|
||
class TSVriep_record : public TVariable_rectype
|
||
{
|
||
public:
|
||
|
||
virtual const TString & get_str(const char* fieldname) const;
|
||
virtual void put_str(const char* fieldname, const char* val);
|
||
TSVriep_record();
|
||
virtual ~TSVriep_record();
|
||
};
|
||
|
||
const TString& get_partname(const char *lev_code) ;
|
||
|
||
class TStat_cache : public TRWrecord_cache
|
||
{
|
||
protected:
|
||
virtual const TString & getkey2discard();
|
||
public:
|
||
TStat_cache (TLocalisamfile &f, bool lock=FALSE);
|
||
TStat_cache (TLocalisamfile *f, bool lock=FALSE);
|
||
virtual ~TStat_cache()
|
||
{}
|
||
void zap();
|
||
};
|
||
#endif
|
||
|