85 lines
2.6 KiB
C++
Executable File
85 lines
2.6 KiB
C++
Executable File
#ifndef __SVLIB01_H
|
|
#define __SVLIB01_H
|
|
|
|
#ifndef __ASSOC_H
|
|
#include "assoc.h"
|
|
#endif
|
|
|
|
#ifndef __VELIB_H
|
|
#include "..\ve\velib.h"
|
|
#endif
|
|
|
|
enum TFrequenza_statistiche { fs_nulla, fs_giornaliera,
|
|
fs_settimanale, fs_quindicinale,
|
|
fs_mensile, fs_bimestrale,
|
|
fs_trimestrale, fs_quadrimestrale,
|
|
fs_semestrale, fs_annuale };
|
|
|
|
// Converte una carattere in una frequenza delle statisitiche
|
|
TFrequenza_statistiche char2frequency(char c);
|
|
// Converte una frequenza delle statisitiche in un carattere
|
|
char frequency2char(TFrequenza_statistiche f);
|
|
|
|
// 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 perido di un anno (primo = 1)
|
|
int last_period(int anno, TFrequenza_statistiche freq);
|
|
|
|
// Converte una data nella classe temporale definita dalla frequenza
|
|
int date2period(const TDate& data, TFrequenza_statistiche freq);
|
|
|
|
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, _omaggi, _omaggio_is_merce;
|
|
bool _art_nocode, _art_noanag, _art_noanag_grp;
|
|
bool _agente, _cliente, _zona, _articolo, _giacenza, _magazzino;
|
|
|
|
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();
|
|
|
|
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 omaggio_is_merce() const { test_firm(); return _omaggio_is_merce; }
|
|
|
|
TStats_agg();
|
|
virtual ~TStats_agg() { }
|
|
};
|
|
|
|
#endif
|