Aggiornato uso dei fantastici Tdecoder

git-svn-id: svn://10.65.10.50/trunk@4000 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1996-12-12 16:17:35 +00:00
parent 431d1ca8c0
commit e32c43ce24
9 changed files with 17 additions and 114 deletions

View File

@ -1712,7 +1712,7 @@ bool CG1500_application::calcola(int g, int c, long s)
TLocalisamfile rmov(LF_RMOV);
TLocalisamfile mov(LF_MOV);
TDecoder causali(LF_CAUSALI, CAU_CODCAUS, CAU_MOVAP);
TDecoder causali(LF_CAUSALI, CAU_MOVAP);
_mov_periodo_dare = ZERO;
_mov_periodo_avere = ZERO;

View File

@ -1,6 +1,10 @@
#ifndef __CG2101_H
#define __CG2101_H
#ifndef __RECARRAY_H
#include <recarray.h>
#endif
#ifndef __RELATION_H
#include <relation.h>
#endif

View File

@ -146,7 +146,7 @@ const char* const PAYMASK = "cg2100s";
TPay_mask::TPay_mask(const TGame_mask& parent, int mod)
: TMask(PAYMASK), _parent(parent),
_causale(LF_CAUSALI, CAU_CODCAUS, CAU_DESCR)
_causale(LF_CAUSALI, CAU_DESCR)
{
set_mode(mod);
enable(DLG_DELREC, edit_mode());
@ -609,7 +609,7 @@ void TGame_mask::append_conto(TString& s) const
TGame_mask::TGame_mask(const TBill& bill, long numreg, int riga)
: TMask("cg2100p"), _conto(bill), _numreg(numreg), _numrig(riga),
_changed(FALSE), _valfirst(FALSE), _causali(LF_CAUSALI, "CODCAUS", "DESCR")
_changed(FALSE), _valfirst(FALSE), _causali(LF_CAUSALI, CAU_DESCR)
{
TString descr(80);
append_conto(descr);

View File

@ -2112,7 +2112,7 @@ public:
};
TMastrini_grid::TMastrini_grid(TMask* m)
: TGrid_field(m), _causali(LF_CAUSALI, CAU_CODCAUS, CAU_DESCR)
: TGrid_field(m), _causali(LF_CAUSALI, CAU_DESCR)
{
load_colors();
}

View File

@ -1,12 +1,8 @@
#ifndef __CGLIB_H
#define __CGLIB_H
#ifndef __ASSOC_H
#include <assoc.h>
#endif
#ifndef __TABUTIL_H
#include <tabutil.h>
#ifndef __RECARRAY_H
#include <recarray.h>
#endif
#ifndef __CONTO_H
@ -31,28 +27,6 @@ public:
~TCaus() {}
};
///////////////////////////////////////////////////////////
// TDecoder
///////////////////////////////////////////////////////////
class TDecoder : private TAssoc_array
{
TLocalisamfile* _file;
TString _if, _of;
long _last_firm;
protected:
void init_firm();
public:
const TString& decode(const char* code);
const TString& decode(long code);
TDecoder(int num, const char* inf, const char* outf);
TDecoder(const char* table, const char* outf = "S0");
virtual ~TDecoder();
};
///////////////////////////////////////////////////////////
// TSaldi_list
///////////////////////////////////////////////////////////

View File

@ -121,7 +121,7 @@ TSaldo::TSaldo() : _saldi(LF_SALDI), _saldoiniziale(ZERO), _saldo_iniziale(ZERO)
_prg_dare(ZERO), _prg_avere(ZERO), _saldo(ZERO), _annoes(0),
_indbil(0), _prec(FALSE), _movimentato(FALSE), _significativo(FALSE),
_rec_presente_ec(FALSE), _rec_presente_ep(FALSE),
_causali_apertura(LF_CAUSALI, CAU_CODCAUS, CAU_MOVAP)
_causali_apertura(LF_CAUSALI, CAU_MOVAP)
{}

View File

@ -8,10 +8,12 @@
#include <stdlib.h>
#include <prefix.h>
#include <saldi.h>
#include <tabutil.h>
#include <utility.h>
#include "cglib.h"
#include <saldi.h>
class TContoExt : public TConto
{
@ -110,79 +112,6 @@ void TTab_conti::aggiorna_conto(const TBill& tcon,
remove(*tc, anno_es, scaricato);
}
///////////////////////////////////////////////////////////
// TDecoder
///////////////////////////////////////////////////////////
TDecoder::TDecoder(int num, const char* inf, const char* outf)
: _file(new TLocalisamfile(num)), _if(inf), _of(outf)
{
init_firm();
}
TDecoder::TDecoder(const char* tab, const char* outf)
: _file(new TTable(tab)), _if("CODTAB"), _of(outf)
{
init_firm();
}
TDecoder::~TDecoder()
{
delete _file;
}
void TDecoder::init_firm()
{
TDir dir;
dir.get(_file->num());
// Se e' un file comune metti a -1, altrimenti alla ditta corrente
_last_firm = dir.is_com() ? -1 : prefix().get_codditta();
}
const TString& TDecoder::decode(const char* code)
{
if (_last_firm >= 0) // Se e' un file di ditta ...
{ // ... controlla che non sia cambiata
const long cur_firm = prefix().get_codditta();
if (cur_firm != _last_firm)
{
_last_firm = cur_firm;
destroy();
}
}
if (code == NULL)
code = "";
TObject* obj = objptr(code);
if (obj == NULL)
{
int err = ~NOERR;
if (*code)
{
_file->setkey(1);
_file->put(_if, code);
err = _file->read();
}
if (err == NOERR)
obj = new TString(_file->get(_of)); // Found
else
obj = new TString(1); // Not found
add(code, obj);
}
const TString& s = (const TString&)*obj;
return s;
}
const TString& TDecoder::decode(long code)
{
TString16 c;
if (code > 0)
c << code;
return decode(c);
}
///////////////////////////////////////////////////////////
// TSaldo_agg
///////////////////////////////////////////////////////////

View File

@ -1,6 +1,6 @@
#include <config.h>
#include <mask.h>
#include <tabutil.h>
#include <relation.h>
#include "saldacon.h"

View File

@ -1,12 +1,8 @@
#ifndef __SALDACON_H
#define __SALDACON_H
#ifndef __ASSOC_H
#include <assoc.h>
#endif
#ifndef __RELATION_H
#include <relation.h>
#ifndef __RECARRAY_H
#include <recarray.h>
#endif
#ifndef __MASK_H