Modifica dalla versione Linux sulla 2.1

git-svn-id: svn://10.65.10.50/trunk@11865 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2004-03-16 07:43:45 +00:00
parent d9955008ac
commit 70f6d6447f
19 changed files with 79 additions and 547 deletions

View File

@ -1,5 +1,5 @@
#define F_INIZIO1 101
#define F_INIZIO2 102
#define F_FINE1 201
#define F_FINE2 202
#define F_INIZIO1 101
#define F_INIZIO2 102
#define F_FINE1 201
#define F_FINE2 202
#define F_DETTAGLIO 301

View File

@ -123,7 +123,6 @@ TMask_movmag::~TMask_movmag()
// item varies from 1 to items()
void TMask_movmag::sheetrighe_get(TSheet_field &fld_righe, int item)
{
TMask_movmag &m=(TMask_movmag &)fld_righe.mask();
// prende il record della riga corrente dal record array
TRectype &rec= fld_righe.record()->row(item, TRUE);
TToken_string &row= fld_righe.row(item-1);
@ -137,7 +136,6 @@ void TMask_movmag::sheetrighe_get(TSheet_field &fld_righe, int item)
// item varies from 1 to items()
void TMask_movmag::sheetrighe_put(TSheet_field &fld_righe, int item)
{
TMask_movmag &m=(TMask_movmag &)fld_righe.mask();
TToken_string &row= fld_righe.row(item-1);
TRectype &recrighe= fld_righe.record()->row(item, TRUE);
@ -620,7 +618,7 @@ real TMask_movmag::proposed_price(const char *codart,
real quant, const char *causrig)
{
real rv;
TCausale_magazzino cau(causrig && *causrig ? causrig : get(F_CODCAUS));
TCausale_magazzino cau(causrig && *causrig ? causrig : (const char *) get(F_CODCAUS));
TLocalisamfile anamag(LF_ANAMAG);
anamag.put("CODART",codart);
anamag.read();
@ -656,7 +654,7 @@ bool TMask_movmag::handle_codcaus(TMask_field &fld, KEY k)
// aggiorna le righe di sheet
TMask_movmag &m=(TMask_movmag &)fld.mask();
TSheet_field & ss=(TSheet_field & )m.field(F_RIGHE);
bool added_some;
bool added_some = FALSE;
// aggiorna le righe che dipendono dalla causale movimento
for (int i=0; i< ss.items(); i++)

View File

@ -35,7 +35,7 @@ bool TMask_buildmov::handle_annoes(TMask_field &fld, KEY k)
if (mask.esercizi.exist(mask.get_int(F_ANNOES)))
{
const TEsercizio & e=mask.esercizi.esercizio(mask.get_int(F_ANNOES));
if (mask.esercizi.esercizio(mask.get_int(F_ANNOES)).chiusura_mag()!=TDate(NULLDATE))
if (e.chiusura_mag()!=TDate(NULLDATE))
{
fld.error_box("Il magazzino dell'esercizio indicato risulta chiuso \nImpossibile effettuare la ricostruzione saldi") ;
return FALSE;

View File

@ -1,2 +1,2 @@
#define F_ANNOES 101
#define F_DATA 102
#define F_ANNOES 101
#define F_DATA 102

View File

@ -174,7 +174,6 @@ bool TStampadatist_mask::handle_liv(TMask_field &fld, KEY k)
if (k == K_TAB)
{
TOperable_field &ftotmag=(TOperable_field &)fld.mask().field(F_TOTALIMAGAZZINI);
TOperable_field &fdettmag=(TOperable_field &)fld.mask().field(F_DETTAGLIOMAG);
TOperable_field &fdettgiac=(TOperable_field &)fld.mask().field(F_RAGGLIVGIAC);
if (fld.mask().get_int(F_TOLIVELLOART))
{

View File

@ -74,7 +74,6 @@ bool TStampadisp_mask::handle_liv(TMask_field &fld, KEY k)
if (k == K_TAB)
{
TOperable_field &ftotmag=(TOperable_field &)fld.mask().field(F_TOTALIMAGAZZINI);
TOperable_field &fdettmag=(TOperable_field &)fld.mask().field(F_DETTAGLIOMAG);
TOperable_field &fdettgiac=(TOperable_field &)fld.mask().field(F_RAGGLIVGIAC);
if (fld.mask().get(F_ORDINE)=="A")
{
@ -173,7 +172,6 @@ void TStampa_disp::on_firm_change()
void TStampa_disp::setprint_permagazzini()
{
char subordine=*_mask->get(F_ORDINEART);
TRectype darec(LF_MAG),arec(LF_MAG);
TString cfilter,sortexp,joinexp;
_form = new TForm_stampemg("mg3200b", "");

View File

@ -83,6 +83,9 @@ const char* TForm_schedemag::descr_tiposcheda() const
return ("Ordinato clienti");
case s_ordf:
return ("Ordinato fornitori");
case s_acq:
default:
break;
}
return "";
}
@ -105,6 +108,12 @@ const char* TForm_schedemag::nomecampo_scheda() const
return (MAG_ORDC);
case s_ordf:
return (MAG_ORDF);
case s_acq:
case s_ent:
case s_ven:
case s_usc:
default:
break;
}
return "";
}
@ -226,7 +235,7 @@ bool TForm_schedemag::validate(TForm_item &cf, TToken_string &s)
if (subcode=="CANPRINTSALDOPREC") // Determina se e' possibile stampare il saldo precedente
{
bool yes = TRUE;
const TDate datareg = movmag.get(MOVMAG_DATAREG);
const TDate datareg = movmag.get_date(MOVMAG_DATAREG);
// Se il movimento corrente e' >= la data inizio stampa allora posso sempre stampare il saldo ...
if (datareg < _data_inizio) // ... altrimenti devo fare altri controlli
{
@ -241,7 +250,7 @@ bool TForm_schedemag::validate(TForm_item &cf, TToken_string &s)
if (err == NOERR) // Se non sono sull'ultimo record ...
{
const TRectype& next_movmag = rmm.relation().curr(LF_MOVMAG);
const TDate next_datareg = next_movmag.get(MOVMAG_DATAREG);
const TDate next_datareg = next_movmag.get_date(MOVMAG_DATAREG);
// Se il prossimo record e' dopo la data iniziale devo stampre il saldo
// Lo stesso dicasi se la prossima data e' inferiore alla corrente (sono su un altro articolo!)
yes = next_datareg >= _data_inizio || next_datareg < datareg;
@ -269,7 +278,7 @@ bool TForm_schedemag::validate(TForm_item &cf, TToken_string &s)
{
const long next_num_reg = rmm.get_long(RMOVMAG_NUMREG);
const TRectype& next_movmag = cache().get(LF_MOVMAG, next_num_reg);
const TDate next_datareg = next_movmag.get(MOVMAG_DATAREG);
const TDate next_datareg = next_movmag.get_date(MOVMAG_DATAREG);
// Se il prossimo record e' dopo la data iniziale devo stampre il saldo
// Lo stesso dicasi se la prossima data e' inferiore alla corrente (sono su un altro articolo!)
yes = next_datareg >= _data_inizio || next_datareg < datareg;
@ -697,7 +706,6 @@ bool TStampa_schede_mag::cau_filter(const TRelation* rel)
void TStampa_schede_mag::setprint_permagazzini()
{
char subordine=*_mask->get(F_ORDINEART);
TRectype darec(LF_RMOVMAG),arec(LF_RMOVMAG);
TString cfilter;
@ -928,7 +936,7 @@ bool TStampa_schede_mag::handle_dadata(TMask_field& f, KEY k)
const int annoes = f.mask().get_int(F_ANNOES);
TEsercizi_contabili ec;
const TEsercizio& es = ec[annoes];
TDate data = f.get();
TDate data(f.get());
if (data < es.inizio())
return f.error_box ("La data di inizio non puo' essere anteriore al %s", es.inizio().string());
}
@ -942,7 +950,7 @@ bool TStampa_schede_mag::handle_adata(TMask_field& f, KEY k)
const int annoes = f.mask().get_int(F_ANNOES);
TEsercizi_contabili ec;
const TEsercizio& es = ec[annoes];
TDate data = f.get();
const TDate data(f.get());
if (data > es.fine())
return f.error_box ("La data di fine non puo' essere successiva al %s", es.fine().string());
}

View File

@ -82,8 +82,6 @@ void TStampa_listamov::setprint_x_mov()
TRectype darec(LF_RMOVMAG),arec(LF_RMOVMAG);
TSorted_cursor& cur = (TSorted_cursor& )*_form->cursor();
TLocalisamfile &main_file=cur.file();
TString sortexp;
TString filter,filterart,filtermov;

View File

@ -324,7 +324,6 @@ bool TStampainv_mask::handle_liv(TMask_field &fld, KEY k)
if (k == K_TAB)
{
TOperable_field &ftotmag=(TOperable_field &)fld.mask().field(F_TOTALIMAGAZZINI);
TOperable_field &fdettmag=(TOperable_field &)fld.mask().field(F_DETTAGLIOMAG);
if (fld.mask().get(F_ORDINE)=="A")
{
if (fld.mask().get_int(F_TOLIVELLOART) || fld.mask().get_int(F_TOLIVELLOGIAC))

View File

@ -66,11 +66,11 @@ class TGiornalemag : public TForm_stampemg
static int _annoes;
static int livello_giac;
long last_num_reg;
word last_pag_stampata;
TConfig *conf_ditta;
TArticolo_giacenza * _curr_art;
TString16 _codlist,_catven;
word last_pag_stampata;
long last_num_reg;
TRegistro_giornalemag *_reg_giorn;
private:
@ -265,7 +265,7 @@ const char * TGiornalemag::get_cronofield(TVariable_rectype & rmovmag)
valore = new TString16;
const TRectype& movmag = cache().get(LF_MOVMAG, rmovmag.get(RMOVMAG_NUMREG));
const TDate datamov = movmag.get(MOVMAG_DATAREG);
const TDate datamov = movmag.get_date(MOVMAG_DATAREG);
// gestione frequenza
valore->cut(0);
@ -470,7 +470,7 @@ bool TGiornalemag::filter_func(const TRelation* r)
const TRectype& rmovmag = r->curr(LF_RMOVMAG);
const TRectype& movmag = cache().get(LF_MOVMAG, rmovmag.get(RMOVMAG_NUMREG));
const TDate datareg = movmag.get(MOVMAG_DATAREG);
const TDate datareg = movmag.get_date(MOVMAG_DATAREG);
if (datareg.year() != _annoes)
return FALSE;
if (!_dadata.empty() && datareg < _dadata)

View File

@ -17,35 +17,35 @@
#endif
#ifndef __ANAMAG_H
#include "anamag.h"
#include "../mg/anamag.h"
#endif
#ifndef __UMART_H
#include "umart.h"
#include "../mg/umart.h"
#endif
#ifndef __CODCORR_H
#include "codcorr.h"
#include "../mg/codcorr.h"
#endif
#ifndef __DESLIN_H
#include "deslin.h"
#include "../mg/deslin.h"
#endif
#ifndef __MAG_H
#include "mag.h"
#include "../mg/mag.h"
#endif
#ifndef __STOMAG_H
#include "stomag.h"
#include "../mg/stomag.h"
#endif
#ifndef __MOVMAG_H
#include "movmag.h"
#include "../mg/movmag.h"
#endif
#ifndef __RMOVMAG_H
#include "rmovmag.h"
#include "../mg/rmovmag.h"
#endif
// campi comuni alla maschere di magazzino
@ -388,10 +388,10 @@ public:
// classe che incapsula tutti i magazzini
class TMagazzini : public TRecord_cache
{
long _last_firm;
TString16 _stdmag;
TString16 _stddep;
TConfig *_mgconfig;
long _last_firm;
bool _gestmag ;
bool _gestdep ;
char _gestubi ;
@ -610,7 +610,6 @@ class TCondizione_vendita : public TObject
{
TString80 _sconto;
TString16 _codiva;
bool _ivarid;
real _prezzo;
real _provv;
real _molt_sconto;
@ -621,6 +620,7 @@ class TCondizione_vendita : public TObject
TLocalisamfile * _umart; // file passato e posizionato esternamente
TConfig * _config_ditta;
bool _load_mask;
bool _ivarid;
bool cerca(int tiporicerca,const char * cod, const real & qta, const char *um=NULL);
@ -689,7 +689,7 @@ public:
bool stampa_intditta() const { return get_bool("B9"); }
void set_pag_stampate(int p) { put("I1",p); }
void set_last_print(TDate &d) { put("D3",d); }
void set_last_print(const TDate d) { put("D3",d); }
bool write(bool re) const ;
bool rewrite() const {return write(TRUE);}

View File

@ -292,7 +292,7 @@ TR_automa::TR_automa(TR_automa * aa,bool makedet)
int old_state=newstateset.get_first() ;
do
{
if (old_next=aa->trans_to(old_state,(unsigned char)symbol))
if ((old_next = aa->trans_to(old_state,(unsigned char)symbol)))
arrival.enclose(old_next);
} while ((old_state=newstateset.get_next())>0);
if (!arrival.is_empty())
@ -327,7 +327,7 @@ TR_automa::~TR_automa()
void TR_automa::set2label(const TStateset ss,TString & label)
{
char coded[MAXSTATES];
char c=0;
unsigned char c = 0;
for (int i= 0; i< MAXSTATES; i++)
if (ss.is_member(i))
coded[c++]=(char)(i+'0');

View File

@ -7,8 +7,8 @@
#include <progind.h>
#include "mglib.h"
#include "..\cg\cglib01.h"
#include "..\ve\veconf.h"
#include "../cg/cglib01.h"
#include "../ve/veconf.h"
#include "anamag.h"
#include "mag.h"
@ -420,7 +420,7 @@ const TString & TArticolo_giacenza::get_str(const char* fieldname) const
return mag(op1).row(index).get(op4);
break;
case LF_STOMAG:
if (index = 0)
if (index == 0)
index = find_storico(op1);
if (index > 0)
return storico(op1).row(index).get(op4);
@ -952,7 +952,9 @@ real TArticolo_giacenza::LIFO(const char * annoes, const char * codmag, const ch
real acq,valacq;
real giacenza;
TRecord_array & rmag = mag(annoes);
for (int i = find_mag(annoes, codmag, livello); i > 0; i = find_mag(annoes, codmag, livello, i))
int i;
for (i = find_mag(annoes, codmag, livello); i > 0; i = find_mag(annoes, codmag, livello, i))
{
const TRectype & rec = rmag.row(i);
@ -976,7 +978,7 @@ real TArticolo_giacenza::LIFO(const char * annoes, const char * codmag, const ch
for (i = find_storico(annoes, codmag); i > 0; i = find_storico(annoes, codmag, i))
{
TRectype & rec = rstorico[i];
const real qta = rec.get(STOMAG_QUANT);
const real qta = rec.get_real(STOMAG_QUANT);
if (qta > giacenza)
{
@ -1000,7 +1002,9 @@ real TArticolo_giacenza::FIFO(const char * annoes, const char * codmag, const ch
real acq,valacq;
real giacenza;
TRecord_array & rmag = mag(annoes);
for (int i = find_mag(annoes, codmag, livello); i > 0; i = find_mag(annoes, codmag, livello, i))
int i;
for (i = find_mag(annoes, codmag, livello); i > 0; i = find_mag(annoes, codmag, livello, i))
{
const TRectype & rec = rmag.row(i);
@ -1030,7 +1034,7 @@ real TArticolo_giacenza::FIFO(const char * annoes, const char * codmag, const ch
const TRectype & rec = rstorico.row(i);
if (codmag_len == 0 || rec.get(STOMAG_CODMAG).compare(codmag, codmag_len) == 0)
{
const real qta = rec.get(STOMAG_QUANT);
const real qta = rec.get_real(STOMAG_QUANT);
if (qta > res)
{
@ -1113,7 +1117,9 @@ void TArticolo_giacenza::add_storico(TRecord_array& nrstorico,const char * annoe
//CHECK(annorif && *annorif,"Add_storico: Indicare l'anno esercizio dello storico");
//TRecord_array & rstorico = storico(annorif);
TString8 annorif(nrstorico.key().get(STOMAG_ANNOESRIF));
for (int i=nrstorico.last_row(); i>0; i--)
int i;
for (i=nrstorico.last_row(); i>0; i--)
{
TString16 mag=nrstorico[i].get(STOMAG_CODMAG);
if (mag<=codmag)
@ -1142,7 +1148,9 @@ void TArticolo_giacenza::agg_storicoLIFO(const char * annoes, const char * codma
real rim,acq,valacq,giacenza;
TRecord_array & rmag = mag(annoes);
for (int i = find_mag(annoes, codmag, ""); i > 0; i = find_mag(annoes, codmag, "", i))
int i;
for (i = find_mag(annoes, codmag, ""); i > 0; i = find_mag(annoes, codmag, "", i))
{
const TRectype & rec = rmag.row(i);
rim += rec.get_real(MAG_RIM);
@ -1207,7 +1215,9 @@ void TArticolo_giacenza::agg_storicoFIFO(const char * annoes, const char * codma
CHECK(codmag && *codmag,"Necessario indicare il magazzino");
real rim,acq,valacq,giacenza;
TRecord_array & rmag = mag(annoes);
for (int i = find_mag(annoes, codmag, ""); i > 0; i = find_mag(annoes, codmag, "", i))
int i;
for (i = find_mag(annoes, codmag, ""); i > 0; i = find_mag(annoes, codmag, "", i))
{
const TRectype & rec = rmag.row(i);
rim += rec.get_real(MAG_RIM);
@ -1233,7 +1243,7 @@ void TArticolo_giacenza::agg_storicoFIFO(const char * annoes, const char * codma
for (i = find_storico(nuovo_storico, codmag); i > 0; i = find_storico(nuovo_storico, codmag, i))
{
TRectype & rec = nuovo_storico[i];
const real qta_sto = rec.get(STOMAG_QUANT);
const real qta_sto = rec.get_real(STOMAG_QUANT);
if (res > qta_sto)
{
res -= qta_sto;
@ -1293,7 +1303,7 @@ void TArticolo_giacenza::agg_storico(const char * annoes, const char * codmag,
void TArticolo_giacenza::put_ultimo_costo(const real& costo, const TDate& data)
{
TDate d = get(ANAMAG_DULTCOS1);
TDate d = get_date(ANAMAG_DULTCOS1);
if (data >= d)
{
if (data > d)
@ -1494,7 +1504,7 @@ void TArticolo_giacenza_data::al(const TDate& data, const char* codmag, const ch
for (cur = 0; cur.pos() < items; ++cur)
{
if (pi) pi->addstatus(1);
const TDate datacomp = movmag.get(MOVMAG_DATACOMP);
const TDate datacomp = movmag.get_date(MOVMAG_DATACOMP);
if (datacomp >= inizio && datacomp <= data)
{
const TString16 codmag = rmovmag.get(RMOVMAG_CODMAG);
@ -1694,7 +1704,7 @@ bool TCondizione_vendita::cerca( int tiporicerca, const char * codriga , const r
_rcondv.put( "CODCF", _condv.get( "CODCF"));
_rcondv.put("COD", _condv.get("COD"));
if( _condv.get_bool( "GESTUM" ) )
_rcondv.put( "UM", (um && *um ) ? um : cache().get(LF_UMART, cod).get("UM"));
_rcondv.put( "UM", (um && *um ) ? um : (const char *) cache().get(LF_UMART, cod).get("UM"));
if (gest_scagl)
_rcondv.put("NSCAGL", 1);
@ -1705,11 +1715,11 @@ bool TCondizione_vendita::cerca( int tiporicerca, const char * codriga , const r
case 'A':
{
_rcondv.put( "CODRIGA", codriga);
int err=_rcondv.read();
found = err == NOERR;
int err = _rcondv.read();
found = (err == NOERR);
if (!found)
if (err=_rcondv.prev() == NOERR)
if (err=_rcondv.get("TIPORIGA")[0] == 'A')
if ((err = _rcondv.prev()) == NOERR)
if (_rcondv.get("TIPORIGA")[0] == 'A')
{
const TString cod_found(_rcondv.get("CODRIGA"));
found = cod_found.compare(codriga, cod_found.len()) == 0;

View File

@ -118,7 +118,6 @@ real TForm_stampemg::ordinato(int flag) const
bool TForm_stampemg::validate(TForm_item &cf, TToken_string &s)
{
static TString *last_um=NULL;
const TFixed_string code = s.get(0); // prende il primo parametro, il codice del messaggio
if (code=="_USER")

View File

@ -6,486 +6,6 @@
//*****
#include <tabutil.h>
#include "mglib.h"
/*
int TMultiple_rectype::find(int logicnum, const char * fieldname, const char * s, int from, bool reverse) const
{
const TRecord_array & recarray = body(logicnum);
const int last = recarray.last_row();
const int len = s ? strlen(s) : 0;
if (reverse)
{
if (from > 0)
{
if (len == 0)
return from - 1;
for (int i = recarray.pred_row(from); i > 0; i = recarray.pred_row(i))
if (((TRectype &)recarray[i]).get(fieldname) == s)
return i;
}
}
else
{
if (last > from)
{
if (len == 0)
return from + 1;
for (int i = recarray.succ_row(from); i <= last; i = recarray.succ_row(i))
if (((TRectype &)recarray[i]).get(fieldname) == s)
return i;
}
}
return -1;
}
int TMultiple_rectype::write_rewrite(TBaseisamfile & f, bool re) const
{
int err = NOERR;
if (_nuovo && re) // E' nuovo di zecca! quindi ...
re = FALSE; // ... non fare la rewrite
if (re)
{
for (int i = _nfiles - 1; err == NOERR && i >= 0 ; i--)
{
TRecord_array * r = (TRecord_array *) _files.objptr(i);
if (r)
err = r->write(re);
}
// rewrite:
if (err == NOERR)
{
err = TRectype::rewrite(f);
if (err != NOERR)
err = TRectype::write(f);
}
}
else
{
// write:
if (_nuovo)
{
do
{
err = TRectype::write(f);
if (err == _isreinsert) // usa il flag _nuovo per decidere se
((TMultiple_rectype *)this)->renum();
} while (err == _isreinsert);
((TMultiple_rectype *)this)->_nuovo = FALSE;
}
else
{
err = TRectype::write(f);
if (err != NOERR)
err = TRectype::rewrite(f);
}
for (int i = _nfiles - 1; err == NOERR && i >= 0 ; i--)
{
TRecord_array * r = (TRecord_array *)_files.objptr(i);
if (r)
err = r->write(re);
}
}
return err;
}
void TMultiple_rectype::remove_body(int logicnum)
{
const int index = log2ind(logicnum);
if (_files.objptr(index) != NULL)
_files.remove(index);
}
int TMultiple_rectype::log2ind(int logicnum) const
{
if (logicnum == 0)
return 0;
for (int i = _nfiles - 1; i >= 0 ; i--)
if (_logicnums[i] == logicnum)
return i;
NFCHECK("Can't find file %d in multiple record", logicnum);
return 0;
}
void TMultiple_rectype::load_rows_file(int logicnum)
{
const int index = log2ind(logicnum);
TRectype & rec = get_body_record(logicnum);
set_body_key(rec);
TRecord_array * r = new TRecord_array(logicnum, (TString &) _numfields[index]);
_files.add( r, index);
}
TRecord_array & TMultiple_rectype::body(int logicnum) const
{
const int index = log2ind(logicnum);
if (_files.objptr(index) == NULL)
((TMultiple_rectype *) this)->load_rows_file(logicnum);
return (TRecord_array &) _files[index];
}
void TMultiple_rectype::renum_key(const char * kfield,const char * val)
{
TRectype::renum_key(kfield, val); // Aggiorna testata
for (int i = _nfiles - 1; i >= 0 ; i--)
body(_logicnums[i]).renum_key(kfield, val); // Aggiorna righe
}
TRectype & TMultiple_rectype::operator =(const TRectype & r)
{
TRectype::operator=(r);
reset_fields(*this);
set_fields(*this);
return *this;
}
TRectype & TMultiple_rectype::operator =(const char * r)
{
TRectype::operator=(r);
reset_fields(*this);
set_fields(*this);
return *this;
}
void TMultiple_rectype::zero(char c)
{
reset_fields(*this);
TAuto_variable_rectype::zero(c);
for (int i = _nfiles - 1; i >= 0 ; i--)
if (_files.objptr(i) != NULL)
_files.remove(i);
}
int TMultiple_rectype::read(TRectype & rec, word op, word lockop)
{
TLocalisamfile f(num());
*this = rec;
int err = TRectype::read(f, op, lockop);
for (int i = _nfiles - 1; i >= 0 ; i--)
if (_files.objptr(i) != NULL)
_files.remove(i);
_nuovo = err != NOERR;
return err;
}
int TMultiple_rectype::remove(TBaseisamfile & f) const
{
int err = NOERR;
for (int i = _nfiles - 1; err == NOERR && i >= 0 ; i--)
{
TRecord_array & r = body(_logicnums[i]);
r.remove();
}
if (err == NOERR)
err = TRectype::remove(f);
return err;
}
// @doc INTERNAL
TMultiple_rectype::TMultiple_rectype(int hfn)
: TAuto_variable_rectype(hfn), _nuovo(TRUE), _nfiles(0)
{
}
// @ cmember costruttore dal file
void TMultiple_rectype::add_file(int logicnum, const char * numfield)
{
CHECK(_nfiles < maxfiles, "Too many files added");
_logicnums[_nfiles] = logicnum;
_numfields.add(numfield, _nfiles++);
}
TMultiple_rectype::TMultiple_rectype(const TBaseisamfile* file)
:TAuto_variable_rectype(file), _nuovo(TRUE), _nfiles(0)
{
}
// @ cmember costruttore dal record
TMultiple_rectype::TMultiple_rectype(const TRectype & rec)
:TAuto_variable_rectype(rec), _nuovo(TRUE), _nfiles(0)
{
}
// @mfunc costruttore di copia
TMultiple_rectype::TMultiple_rectype(const TMultiple_rectype& r)
:TAuto_variable_rectype(r), _files(r._files)
{
// copia..
_nuovo=r._nuovo;
_nfiles=r._nfiles; // file delle righe
_numfields=r._numfields;
}
*/
// THead_lines_record
// metodi protected
/*
void THead_lines_record::renum_key(const char * kfield,const char * val)
{
TRectype::renum_key(kfield, val); // Aggiorna testata
_rows->renum_key(kfield, val); // Aggiorna righe
}
TRectype & THead_lines_record::row(int index) const // riga del corpo
{
if (index > _rows->rows() || index < 0)
CHECKD(FALSE, "Riga non esistente ", index);
return _rows->row(index, FALSE);
}
void THead_lines_record::put_str(const char* fieldname, const char* val)
{
TString v(val);
// cambio
//if (strcmp(fieldname, "TIPODOC") == 0 && TRectype::get("TIPODOC") != v)
//{
// TAuto_variable_rectype::put_str(fieldname, v);
// reset_fields(*this);
// set_fields(*this);
//}
//else
{
TAuto_variable_rectype::put_str(fieldname, v);
dirty_fields();
}
}
//*****
// metodi public
THead_lines_record::THead_lines_record(int hfn, int rfn,const char *numfield):
TAuto_variable_rectype(hfn),
_file(hfn),
_rfile(rfn),
_numfield(numfield)
{
_rows= new TRecord_array(rfn,numfield); // inizializza il record array delle righe
}
THead_lines_record::THead_lines_record(const TBaseisamfile* i,int rfn,const char *numfield):
TAuto_variable_rectype(i),
_numfield(numfield)
{
_rows= new TRecord_array(rfn,numfield); // inizializza il record array delle righe
}
THead_lines_record::THead_lines_record(const TRectype & r,int rfn,const char *numfield):
TAuto_variable_rectype(r),
_numfield(numfield)
{
_rows= new TRecord_array(rfn,numfield); // inizializza il record array delle righe
}
// @doc INTERNAL
// @mfunc costruttore di copia
THead_lines_record::THead_lines_record(const THead_lines_record& r):
TAuto_variable_rectype((TAuto_variable_rectype &)r)
{
// copia..
_rows= new TRecord_array(* r._rows); // inizializza il record array delle righe
_nuovo=r._nuovo;
_file=r._file; // file principale
_rfile=r._rfile; // file delle righe
_numfield=r._numfield;
}
THead_lines_record::~THead_lines_record()
{
delete _rows;
}
// setta a dirty i campi
void THead_lines_record::dirty_fields()
{
}
TRectype & THead_lines_record::operator =(const TRectype & r)
{
TRectype::operator=(r);
reset_fields(*this);
set_fields(*this);
return *this;
}
TRectype & THead_lines_record::operator =(const char * r)
{
TRectype::operator=(r);
reset_fields(*this);
set_fields(*this);
return *this;
}
void THead_lines_record::zero(const char * fieldname)
{
// resetta il record righe solo se .....
// if (strcmp(fieldname, "TIPODOC") == 0)
reset_fields(*this);
TAuto_variable_rectype::zero(fieldname);
dirty_fields();
}
void THead_lines_record::zero(char c)
{
reset_fields(*this);
TAuto_variable_rectype::zero(c);
}
// settaggio campi variabili
void THead_lines_record::set_fields(TAuto_variable_rectype & rec)
{
}
int THead_lines_record::read(TBaseisamfile& f, word op, word lockop)
{
TRectype line_key(_rfile);
int err = TRectype::read(f,op,lockop);
copy_linekey(head(),line_key);
if (err == NOERR)
{
_nuovo = FALSE;
_rows->read(line_key); //ok
}
else
{
// nuovo oggetto: resetta tutto
_nuovo = TRUE;
destroy_rows();
_rows->set_key((TRectype *)(line_key.dup())); // ok
}
return err;
}
int THead_lines_record::readat(TBaseisamfile& f, TRecnotype nrec, word lockop)
{
TRectype line_key(_rfile);
int err = TRectype::readat(f,nrec,lockop);
if (err == NOERR)
{
_nuovo = FALSE;
_rows->read(line_key); //ok
}
else
{
// nuovo oggetto: resetta tutto
_nuovo = TRUE;
destroy_rows();
_rows->set_key((TRectype *)(line_key.dup())); // ok
}
return err;
}
/*int THead_lines_record::read(const TRectype& rec)
{
head() = rec;
TRectype line_key(_rows->key());
copy_linekey(head(),line_key);
TLocalisamfile afile(_file);
int err = TRectype::read(afile);
if (err == NOERR)
{
_nuovo = FALSE;
_rows->read(line_key); //ok
}
else
{
// nuovo oggetto: resetta tutto
_nuovo = TRUE;
head() = rec;
destroy_rows();
_rows->set_key(&line_key); // ok
}
return err;
}
int THead_lines_record::write(TBaseisamfile& f) const
{
return write_rewrite(f,FALSE);
}
int THead_lines_record::rewrite(TBaseisamfile& f) const
{
return write_rewrite(f,TRUE);
}
int THead_lines_record::write_rewrite(TBaseisamfile& f,bool re ) const
{
const bool nuovo = _nuovo; // E' nuovo di zecca!
if (nuovo && re) // quindi ...
re = FALSE; // ... non fare la rewrite
int err = NOERR;
if (re)
{
// rewrite:
err = _rows->write(re);
if (err == NOERR)
{
err = TRectype::rewrite(f);
if (err != NOERR)
err = TRectype::write(f);
}
}
else
{
// write:
if (nuovo)
{
//THead_lines_record &myself=*this;
//if (numero() <= 0)
// myself.renum();
do
{
err = TRectype::write(f);
if (err == _isreinsert) // usa il flag _nuovo per decidere se
((THead_lines_record *)this)->renum();
} while (err == _isreinsert);
((THead_lines_record *)this)->_nuovo = FALSE;
}
else
{
err = TRectype::write(f);
if (err != NOERR)
err = TRectype::rewrite(f);
}
if (err == NOERR)
err = _rows->write(re);
}
return err;
}
int THead_lines_record::remove(TBaseisamfile& f) const
{
int err = _rows->remove();
if (err == NOERR)
err = TRectype::remove(f);
return err;
}
*/
// ************************************************
// TEMP!!!!!!!!!!!!!!!!

View File

@ -10,7 +10,7 @@
#endif
#ifndef __AGE_H
#include "agenti.h"
#include "../pr/agenti.h"
#endif
class TRata : public TSortable

View File

@ -115,7 +115,6 @@ int TProvvigioni_agente::rate2rows(int action)
if (_agente.not_empty())
{
TString_array kl;
int nrow = 1; // Numero riga per agente e per documento
const int items = documenti(kl); // Prende l'elenco dei documenti
kl.sort(); // ordina per documento
for (int i = 0; i < items && err == NOERR; i++)

View File

@ -224,6 +224,10 @@ const TDate & period2date(const int anno, int periodo, TFrequenza_statistiche f)
case fs_trimestrale: d.set_month(periodo*3); break;
case fs_quadrimestrale:d.set_month(periodo*4); break;
case fs_semestrale: d.set_month(periodo*6); break;
case fs_annuale:
case fs_nulla:
default:
break;
}
return d;
}
@ -390,7 +394,7 @@ TStats_agg::TStats_data& TStats_agg::find(const TRiga_documento& rdoc)
test_firm();
const TDocumento& doc = rdoc.doc();
const TDate datadoc = doc.get(DOC_DATADOC);
const TDate datadoc = doc.get_date(DOC_DATADOC);
TToken_string key(64);

View File

@ -6,10 +6,10 @@
#endif
#ifndef __VELIB_H
#include "..\ve\velib.h"
#include "../ve/velib.h"
#endif
#include "svlib09.h"
#include "../sv/svlib09.h"
enum TFrequenza_statistiche { fs_nulla, fs_giornaliera,
fs_settimanale, fs_quindicinale,