campo-sirio/ve/velib01.h
guy 07bcd60df8 Cominciata nuova stesura del programma di fatturazione bolle e corrette le tabelle usate.
git-svn-id: svn://10.65.10.50/trunk@3339 c028cbd2-c16b-5b4b-a496-9718f37d4682
1996-08-08 09:24:17 +00:00

83 lines
2.3 KiB
C++
Executable File

#ifndef __VELIB01_H
#define __VELIB01_H
#ifndef __RELATION_H
#include <relation.h>
#endif
class TDocumento_vendita : public TObject
{
TRectype _head; // Record di testata
TRecord_array _rows; // Array di TRectype per le righe documenti di vendita.
public:
int rows() const { return _rows.rows(); }
const TRectype& head() const { return _head; } // Ritorna la testata del documento
const TRectype& operator[](int index) const { return _rows.row(index); } // Ritorna la riga n-esima del documento
TRectype& operator[](int index) { return _rows.row(index, FALSE); }
TRectype& add_row() { return _rows.row(-1, TRUE); }
bool destroy_row(int n) { return _rows.destroy_row(n); }
int read(const char* codnum, int anno, char provv, long numdoc);
int read(const TRectype& rec);
int write(bool re = FALSE) const;
int rewrite() const { return write(TRUE); }
int remove() const;
TDocumento_vendita ();
TDocumento_vendita(const char* codnum, int anno, char provv, long numdoc);
virtual ~TDocumento_vendita() { }
};
class TLista_clienti : public TObject
{
class TCliente : public TObject
{
long _codice;
long _agente;
long _zona;
protected:
void zero() { _codice = _agente = _zona = 0L; }
void init(const TRectype& rec);
bool read(long cod);
public: // TObject
virtual bool ok() const { return _codice > 0; }
public:
long codice() const { return _codice; }
long agente() const { return _agente; }
long zona() const { return _zona; }
TCliente() { zero(); }
TCliente(long cod) { read(cod); }
TCliente(const TRectype& rec);
virtual ~TCliente() { }
};
TArray _clienti;
protected:
const TCliente& cliente(int n) const { return (TCliente&)_clienti[n]; }
static int sort_by_code(const TObject** o1, const TObject** o2);
static int sort_by_agent(const TObject** o1, const TObject** o2);
static int sort_by_zone(const TObject** o1, const TObject** o2);
public:
int ordina_per_codice();
int ordina_per_agente();
int ordina_per_zona();
int leggi(long dc, long ac, long da = 0, long aa = 0, long dz = 0, long az = 0);
long operator[] (int n) const { return cliente(n).codice(); }
TLista_clienti() { }
virtual ~TLista_clienti() { }
};
#endif