Aggiunto oggetto TAgente
Corretta rate2rows nel caso di agente non definito git-svn-id: svn://10.65.10.50/trunk@5450 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
3df5a55161
commit
cfa88b17dc
17
pr/prlib.h
17
pr/prlib.h
@ -124,4 +124,21 @@ public:
|
|||||||
~TProvvigioni_agente();
|
~TProvvigioni_agente();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class TAgente : public TRectype
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
int read(const char* codice);
|
||||||
|
virtual TAgente & copy(const TAgente & a) { return (TAgente &) TRectype::operator=((TRectype &)a);}
|
||||||
|
|
||||||
|
public:
|
||||||
|
TObject* dup() const { return new TAgente(*this); }
|
||||||
|
const TString& codice() const { return get("CODAGE");}
|
||||||
|
const TString& ragsoc() const { return get("RAGSOC"); }
|
||||||
|
const TString& campoprovv() const { return get("CAMPOPROVV"); }
|
||||||
|
|
||||||
|
TAgente(const char* codice = NULL);
|
||||||
|
TAgente(const TAgente & a);
|
||||||
|
TAgente(const TRectype& rec);
|
||||||
|
virtual ~TAgente() {}
|
||||||
|
};
|
||||||
#endif
|
#endif
|
||||||
|
@ -90,6 +90,10 @@ int TProvvigioni_agente::rate2rows(int action)
|
|||||||
// Scorre gli elementi di _rate (TDoc_rate) uno ad uno
|
// Scorre gli elementi di _rate (TDoc_rate) uno ad uno
|
||||||
// per settare le righe provvigionali
|
// per settare le righe provvigionali
|
||||||
// Scrive tramite chiave 1: utilizzando un solo record array (CODAGE+NROW)
|
// Scrive tramite chiave 1: utilizzando un solo record array (CODAGE+NROW)
|
||||||
|
int err = NOERR;
|
||||||
|
|
||||||
|
if (_agente.not_empty())
|
||||||
|
{
|
||||||
TRecord_array * rows = new TRecord_array(LF_PROVV,PROV_NROW);
|
TRecord_array * rows = new TRecord_array(LF_PROVV,PROV_NROW);
|
||||||
TRectype* k = new TRectype(LF_PROVV);
|
TRectype* k = new TRectype(LF_PROVV);
|
||||||
k->put(PROV_CODAGE, _agente);
|
k->put(PROV_CODAGE, _agente);
|
||||||
@ -98,7 +102,6 @@ int TProvvigioni_agente::rate2rows(int action)
|
|||||||
int nrow = 1; // Numero riga per agente e per documento
|
int nrow = 1; // Numero riga per agente e per documento
|
||||||
const int items = documenti(kl); // Prende l'elenco dei documenti
|
const int items = documenti(kl); // Prende l'elenco dei documenti
|
||||||
kl.sort(); // ordina per documento
|
kl.sort(); // ordina per documento
|
||||||
int err = NOERR;
|
|
||||||
for (int i = 0; i < items && err == NOERR; i++)
|
for (int i = 0; i < items && err == NOERR; i++)
|
||||||
{
|
{
|
||||||
TRate_doc& rd = (TRate_doc&)_rate[kl.row(i)];
|
TRate_doc& rd = (TRate_doc&)_rate[kl.row(i)];
|
||||||
@ -163,6 +166,7 @@ int TProvvigioni_agente::rate2rows(int action)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete rows;
|
delete rows;
|
||||||
|
}
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -324,3 +328,33 @@ TRata::TRata(TRectype& rec)
|
|||||||
set(rec);
|
set(rec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int TAgente::read(const char * codice)
|
||||||
|
{
|
||||||
|
TLocalisamfile f(LF_AGENTI);
|
||||||
|
|
||||||
|
put("CODAGE", codice);
|
||||||
|
int err = TRectype::read(f);
|
||||||
|
if (err != NOERR)
|
||||||
|
{
|
||||||
|
zero();
|
||||||
|
put("CODAGE", codice);
|
||||||
|
}
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
TAgente::TAgente(const char * codice)
|
||||||
|
: TRectype(LF_AGENTI)
|
||||||
|
{
|
||||||
|
read(codice);
|
||||||
|
}
|
||||||
|
|
||||||
|
TAgente::TAgente(const TAgente & a)
|
||||||
|
: TRectype(LF_AGENTI)
|
||||||
|
{
|
||||||
|
copy(a);
|
||||||
|
}
|
||||||
|
TAgente::TAgente(const TRectype & rec)
|
||||||
|
: TRectype(LF_AGENTI)
|
||||||
|
{
|
||||||
|
TRectype::operator=(rec);
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user