campo-sirio/ve/sconti.h

76 lines
1.5 KiB
C
Raw Normal View History

#ifndef __SCONTI_H
#define __SCONTI_H
#ifndef __REAL_H
#include <real.h>
#endif
#ifndef __TCLIFOR_H
#include "tclifor.h"
#endif
#ifndef __MASK_H
#include <mask.h>
#endif
#ifndef __CONFIG_H
#include <config.h>
#endif
#define CHKVALID CHECK( _valid, "Tentativo di usare uno sconto non valido!" )
class TSconto : public TObject
{
private:
TString _exp;
bool _valid;
int _errorpos;
real _part;
static const real cento;
public:
TString& get( void ){ CHKVALID; return _exp; }
void set( const TString& exp, bool signal = FALSE );
bool is_valid( ){ return _valid; }
real sconto( );
char * scontostr( int len = 0, int dec = UNDEFINED, char pad = ' ' ){ CHKVALID; real p(sconto()); return p.stringa( len, dec, pad ); }
};
#undef CHKVALID
class TSconto_riga : public TSconto
{
private:
TCliFor* _clifo;
// TRelation _condv;
// Invece che la relazione uso i due files, poich<63> mi interessa sempre
// solo una delle righe
TLocalisamfile _condv;
TLocalisamfile _rcondv;
TLocalisamfile _anamag;
TLocalisamfile _sconti;
TConfig _ditta;
TMask* _testa;
TMask* _riga;
protected:
public:
TSconto_riga( TCliFor& clifo, TMask * testa = NULL, TMask * riga = NULL );
TCliFor& clifo( ){ return *_clifo; }
void set_testa( TMask& testa ){ _testa = &testa; }
TMask& testa( ){ return *_testa; }
void set_riga( TMask& riga ){ _riga = &riga; }
TMask& riga( ){ return *_riga; }
bool cerca_condv( int tiporicerca );
void calcola( );
};
#endif