Corretti errori intermittenti di PG ??

Corretta registrazione occasionali
Aggiunta localita agli occasionali


git-svn-id: svn://10.65.10.50/trunk@5051 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 1997-08-06 12:31:10 +00:00
parent 4d1fcd3624
commit b799632efa
6 changed files with 120 additions and 65 deletions

View File

@ -450,7 +450,7 @@ TMask* TMotore_application::get_mask( int mode )
app( ).tipocf( tipocf[ 0 ] ); app( ).tipocf( tipocf[ 0 ] );
if (msk1 == NULL) if (msk1 == NULL)
{ {
msk1 = new TDocumento_mask(_doc->tipo().mask_name(), _doc); // prof msk1 = new TDocumento_mask(_doc->tipo().mask_name(), _doc, _rel); // prof
_doc_masks.add(tipodoc, msk1); _doc_masks.add(tipodoc, msk1);
_sheet = &( TSheet_field& )msk1->field( F_SHEET ); _sheet = &( TSheet_field& )msk1->field( F_SHEET );
sheet( ).set_notify( ss_handler ); sheet( ).set_notify( ss_handler );
@ -643,6 +643,7 @@ const char* TMotore_application::get_next_key( )
int TMotore_application::read( TMask& m ) int TMotore_application::read( TMask& m )
{ {
m.autoload(*_rel); m.autoload(*_rel);
*_doc = (TDocumento &) _rel->curr();
_codnum = m.get(F_CODNUM); _codnum = m.get(F_CODNUM);
_tipodoc = m.get(F_TIPODOC); _tipodoc = m.get(F_TIPODOC);
((TDocumento_mask &)m).cli2mask(app().doc().clifor(), app().doc().occas(), *(app()._config_ditta)); ((TDocumento_mask &)m).cli2mask(app().doc().clifor(), app().doc().occas(), *(app()._config_ditta));
@ -669,12 +670,11 @@ int TMotore_application::write( const TMask& m ) // C 90
if (err == NOERR) if (err == NOERR)
{ {
TDocumento & doc = (TDocumento &) _rel->curr();
doc = *_doc;
m.field(F_STATO).set( _pro->get( "STATOFINALE", "INSERIMENTO" ) ); m.field(F_STATO).set( _pro->get( "STATOFINALE", "INSERIMENTO" ) );
TRelation_application::write(m); TRelation_application::write(m);
// m.autosave(*_rel);
// err = _doc->write( );
// if (err == NOERR)
// _rel->read(); // per posizionare correttamente la relazione
} }
return err; return err;
@ -687,7 +687,12 @@ int TMotore_application::rewrite( const TMask& m ) // C 90
int err = esegui_procedura(OP_MODIFICA); int err = esegui_procedura(OP_MODIFICA);
if (err == NOERR) if (err == NOERR)
{
TDocumento & doc = (TDocumento &) _rel->curr();
doc = *_doc;
TRelation_application::rewrite(m); TRelation_application::rewrite(m);
}
return err; return err;
} }
@ -698,7 +703,6 @@ bool TMotore_application::remove( void ) // C 80
return TRUE; return TRUE;
int err = esegui_procedura(OP_CANCELLA); int err = esegui_procedura(OP_CANCELLA);
return TRelation_application::remove(); return TRelation_application::remove();
// return _doc->remove() == NOERR;
} }
void TMotore_application::open_files(int logicnum, ...) void TMotore_application::open_files(int logicnum, ...)
@ -732,12 +736,12 @@ bool TMotore_application::user_create( )
open_files(LF_RIGHEDOC, LF_CONDV, LF_RCONDV, LF_ANAMAG, LF_SCONTI, LF_UMART, LF_TAB, LF_TABCOM, LF_CLIFO, open_files(LF_RIGHEDOC, LF_CONDV, LF_RCONDV, LF_ANAMAG, LF_SCONTI, LF_UMART, LF_TAB, LF_TABCOM, LF_CLIFO,
LF_CFVEN, LF_INDSP, LF_OCCAS, LF_MOVMAG, LF_RMOVMAG, 0); LF_CFVEN, LF_INDSP, LF_OCCAS, LF_MOVMAG, LF_RMOVMAG, 0);
_doc = new TDocumento; _doc = new TDocumento;
_rel->lfile().set_curr(_doc); _rel->lfile().set_curr(new TDocumento);
_doc->set_relation(_rel);
_cod_num = NULL; _cod_num = NULL;
_condv = new TCond_vendita(&doc().clifor(), _config_ditta); _condv = new TCond_vendita(&doc().clifor(), _config_ditta);
_doc->set_condv(_condv); _doc->set_condv(_condv);
((TDocumento &) _rel->curr()).set_condv(_condv);
_msk = new TMask("ve0100a"); _msk = new TMask("ve0100a");
set_search_field(F_NDOC); set_search_field(F_NDOC);
@ -773,6 +777,7 @@ bool TMotore_application::user_destroy( )
delete _cod_num; delete _cod_num;
// Distruggo la relazione // Distruggo la relazione
delete _doc;
delete _rel; delete _rel;
delete _condv; delete _condv;

View File

@ -321,8 +321,8 @@ public:
bool is_omaggio() const { return tipo().tipo() == 'O';} bool is_omaggio() const { return tipo().tipo() == 'O';}
bool is_descrizione() const { return tipo().tipo() == 'D';} bool is_descrizione() const { return tipo().tipo() == 'D';}
bool is_articolo() const; bool is_articolo() const;
bool is_checked() const { return get_bool("CHECKED");} bool is_checked() const { return get_bool(RDOC_CHECKED);}
void checked(bool on = TRUE) { put("CHECKED", (bool)on); } void checked(bool on = TRUE) { put(RDOC_CHECKED, (bool)on); }
void unchecked() { checked(FALSE); } void unchecked() { checked(FALSE); }
// @cmember Assegna il documento corrente // @cmember Assegna il documento corrente
void set_doc(TDocumento * doc) { _doc = doc; } void set_doc(TDocumento * doc) { _doc = doc; }
@ -345,6 +345,8 @@ public:
bool sola_descrizione() const; bool sola_descrizione() const;
void forza_sola_descrizione(); void forza_sola_descrizione();
virtual TRiga_documento & copy(const TRiga_documento & r);
virtual TRiga_documento & operator =(const TRiga_documento & r) { return copy(r);}
virtual TRectype & operator =(const TRectype & r); virtual TRectype & operator =(const TRectype & r);
virtual TRectype & operator =(const char * r); virtual TRectype & operator =(const char * r);
@ -362,7 +364,9 @@ public:
real quantita() const { return get_real(RDOC_QTA); } real quantita() const { return get_real(RDOC_QTA); }
TRiga_documento(TDocumento* doc, const char* tipo = NULL); TRiga_documento(TDocumento* doc, const char* tipo = NULL);
TRiga_documento(const TRiga_documento & row);
TRiga_documento(const TRiga_documento& rec, TDocumento* doc, TRiga_documento(const TRiga_documento& rec, TDocumento* doc,
const char* tipo = NULL); const char* tipo = NULL);
virtual ~TRiga_documento() {} virtual ~TRiga_documento() {}
@ -381,7 +385,6 @@ class TDocumento : public TAuto_variable_rectype // velib03
TRecord_array _rows; // Array di TRectype per le righe documenti di vendita. TRecord_array _rows; // Array di TRectype per le righe documenti di vendita.
bool _nuovo; bool _nuovo;
TRelation * _rel;
TCond_vendita * _condv; TCond_vendita * _condv;
TCli_for _cli_for; TCli_for _cli_for;
TOccasionale _occas; TOccasionale _occas;
@ -397,6 +400,7 @@ protected:
void set_riga_sconto(); void set_riga_sconto();
void set_riga_esenzione(); void set_riga_esenzione();
int write_rewrite(TBaseisamfile & f, bool re) const; int write_rewrite(TBaseisamfile & f, bool re) const;
TObject* dup() const { return new TDocumento(*this); }
public: public:
void dirty_fields(); void dirty_fields();
@ -406,11 +410,10 @@ public:
TCond_vendita & condv() const {CHECK(_condv, "Condizioni di vendita nulle"); return *_condv;} TCond_vendita & condv() const {CHECK(_condv, "Condizioni di vendita nulle"); return *_condv;}
TCli_for & clifor() const; TCli_for & clifor() const;
TOccasionale & occas() const; TOccasionale & occas() const;
TRelation & get_relation() const {CHECK(_rel, "Relazione nulla"); return *_rel;}
void set_condv(TCond_vendita * condv) { _condv = condv; } void set_condv(TCond_vendita * condv) { _condv = condv; }
void set_relation(TRelation * rel) { _rel = rel; }
virtual TDocumento & operator =(const TDocumento & d); virtual TDocumento & copy(const TDocumento & d);
virtual TDocumento & operator =(const TDocumento & d) {return copy(d);}
virtual TRectype & operator =(const TRectype & r); virtual TRectype & operator =(const TRectype & r);
virtual TRectype & operator =(const char * r); virtual TRectype & operator =(const char * r);
virtual void zero(const char * fieldname); virtual void zero(const char * fieldname);
@ -490,8 +493,8 @@ public:
bool is_bolla() const { return tipo_valido() && tipo().is_bolla(); } bool is_bolla() const { return tipo_valido() && tipo().is_bolla(); }
bool is_ordine() const { return tipo_valido() && tipo().is_ordine(); } bool is_ordine() const { return tipo_valido() && tipo().is_ordine(); }
TDocumento (); TDocumento ();
TDocumento (const TDocumento & d);
TDocumento(char provv, int anno, const char* codnum, long numdoc, TDocumento(char provv, int anno, const char* codnum, long numdoc,
TCond_vendita * condv = NULL, TRelation * rel = NULL); TCond_vendita * condv = NULL, TRelation * rel = NULL);
TDocumento(const TRectype& doc, TCond_vendita * condv = NULL, TDocumento(const TRectype& doc, TCond_vendita * condv = NULL,
@ -504,6 +507,7 @@ class TDocumento_mask : public TVariable_mask // velib06
int _progs_page; // pagina in cui cominciano i progressivi int _progs_page; // pagina in cui cominciano i progressivi
int _last_prog; // numero dell'ultimo progressivo int _last_prog; // numero dell'ultimo progressivo
TDocumento * _doc; // documento TDocumento * _doc; // documento
TRelation * _rel;
protected: protected:
virtual void next_page(int p); virtual void next_page(int p);
@ -513,12 +517,11 @@ protected:
public: public:
virtual bool on_key(KEY key); virtual bool on_key(KEY key);
TDocumento & doc() const {CHECK(_doc, "Documento nullo"); return *_doc;} TDocumento & doc() const {CHECK(_doc, "Documento nullo"); return *_doc;}
TCond_vendita & condv() const {CHECK(_doc, "Documento nullo"); return _doc->condv();} TCond_vendita & condv() const { return doc().condv();}
TRelation & get_relation() const {CHECK(_doc, "Documento nullo"); return _doc->get_relation();}
void cli2mask( TCli_for & c, TOccasionale & o, TConfig & ditta); void cli2mask( TCli_for & c, TOccasionale & o, TConfig & ditta);
void occ2mask(TOccasionale & o); void occ2mask(TOccasionale & o);
TDocumento_mask(const char* name, TDocumento * _doc, int num = 0, int max = MAX_PAGES); TDocumento_mask(const char* name, TDocumento * _doc, TRelation * rel, int num = 0, int max = MAX_PAGES);
virtual ~TDocumento_mask() {} virtual ~TDocumento_mask() {}
}; };

View File

@ -31,6 +31,22 @@
#include "sconti.h" #include "sconti.h"
#endif #endif
#ifndef __ANAMAG_H
#include "../mg/anamag.h"
#endif
#ifndef __CODCORR_H
#include "../mg/codcorr.h"
#endif
#ifndef __DESLIN_H
#include "../mg/deslin.h"
#endif
#ifndef __UMART_H
#include "../mg/umart.h"
#endif
TSpesa_prest::TSpesa_prest(const char* codice, char tipo) TSpesa_prest::TSpesa_prest(const char* codice, char tipo)
: TRectype(LF_TAB) : TRectype(LF_TAB)
{ {
@ -183,24 +199,24 @@ bool data_hndl( TMask_field& field, KEY key )
const TDate datadoc(m.get(F_DATADOC)); const TDate datadoc(m.get(F_DATADOC));
doc.curr() = m.doc().head(); doc.curr() = m.doc().head();
const TString16 codnum(doc.get("CODNUM")); const TString16 codnum(doc.get(DOC_CODNUM));
const int anno = doc.get_int("ANNO"); const int anno = doc.get_int(DOC_ANNO);
const char tipo_num = doc.get_char("PROVV"); const char tipo_num = doc.get_char(DOC_PROVV);
if (doc.read(_isgreat) == NOERR && if (doc.read(_isgreat) == NOERR &&
codnum == doc.get("CODNUM") && codnum == doc.get(DOC_CODNUM) &&
anno == doc.get_int("ANNO") && anno == doc.get_int(DOC_ANNO) &&
tipo_num == doc.get_char("PROVV") && tipo_num == doc.get_char(DOC_PROVV) &&
datadoc > doc.get_date("DATADOC")) datadoc > doc.get_date(DOC_DATADOC))
return field.error_box("Data documento superiore alla data del documento successivo"); return field.error_box("Data documento superiore alla data del documento successivo");
doc.curr() = m.doc().head(); doc.curr() = m.doc().head();
doc.read(); doc.read();
if (doc.prev() == NOERR && if (doc.prev() == NOERR &&
codnum == doc.get("CODNUM") && codnum == doc.get(DOC_CODNUM) &&
anno == doc.get_int("ANNO") && anno == doc.get_int(DOC_ANNO) &&
tipo_num == doc.get_char("PROVV") && tipo_num == doc.get_char(DOC_PROVV) &&
datadoc < doc.get_date("DATADOC")) datadoc < doc.get_date(DOC_DATADOC))
return field.error_box("Data documento inferiore alla data del documento precedente"); return field.error_box("Data documento inferiore alla data del documento precedente");
} }
return TRUE; return TRUE;
@ -267,7 +283,7 @@ bool codart_handler( TMask_field& f, KEY key )
condv.set_umart(umart); condv.set_umart(umart);
TString80 codart(f.get()); TString80 codart(f.get());
anamag.setkey(1); anamag.setkey(1);
anamag.put("CODART", codart); anamag.put(ANAMAG_CODART, codart);
bool found = anamag.read() == NOERR; bool found = anamag.read() == NOERR;
if (found) if (found)
row_mask.set(FR_CODARTMAG, codart, TRUE); row_mask.set(FR_CODARTMAG, codart, TRUE);
@ -276,12 +292,12 @@ bool codart_handler( TMask_field& f, KEY key )
TLocalisamfile codalt(LF_CODCORR); TLocalisamfile codalt(LF_CODCORR);
codalt.setkey(2); codalt.setkey(2);
codalt.put("CODARTALT", codart); codalt.put(CODCORR_CODARTALT, codart);
if (codalt.read() == NOERR) if (codalt.read() == NOERR)
{ {
codart = codalt.get("CODART"); codart = codalt.get(CODCORR_CODART);
anamag.zero(); anamag.zero();
anamag.put("CODART", codart); anamag.put(ANAMAG_CODART, codart);
found = anamag.read() == NOERR; found = anamag.read() == NOERR;
if (found) if (found)
row_mask.set(FR_CODARTMAG, codart, TRUE); row_mask.set(FR_CODARTMAG, codart, TRUE);
@ -301,20 +317,20 @@ bool codart_handler( TMask_field& f, KEY key )
TLocalisamfile deslin(LF_DESLIN); TLocalisamfile deslin(LF_DESLIN);
deslin.setkey(2); deslin.setkey(2);
deslin.put("CODART", codart); deslin.put(DESLIN_CODART, codart);
deslin.put("CODLIN", lingua); deslin.put(DESLIN_CODLIN, lingua);
if (deslin.read() == NOERR) if (deslin.read() == NOERR)
desc = deslin.get("DESCR"); desc = deslin.get(DESLIN_DESCR);
} }
row_mask.set(FR_DESCR, desc); row_mask.set(FR_DESCR, desc);
umart.setkey(1); umart.setkey(1);
umart.zero(); umart.zero();
umart.put("CODART", codart); umart.put(UMART_CODART, codart);
if (umart.read(_isgteq) == NOERR && codart == umart.get("CODART")) if (umart.read(_isgteq) == NOERR && codart == umart.get(UMART_CODART))
{ {
curr_um = umart.get("UM"); curr_um = umart.get(UMART_UM);
curr_fc = umart.get_real("FC"); curr_fc = umart.get_real(UMART_FC);
} }
else else
{ {
@ -396,13 +412,13 @@ bool umart_handler( TMask_field& f, KEY key )
if (um.not_empty() && curr_um.not_empty() && um != curr_um) if (um.not_empty() && curr_um.not_empty() && um != curr_um)
{ {
umart.setkey(2); umart.setkey(2);
umart.put("CODART", row_mask.get(FR_CODART)); umart.put(UMART_CODART, row_mask.get(FR_CODARTMAG));
umart.put("UM", um); umart.put(UMART_UM, um);
if (umart.read() == NOERR) if (umart.read() == NOERR)
{ {
real qta(row_mask.get_real(FR_QTA)); real qta(row_mask.get_real(FR_QTA));
qta *= curr_fc; qta *= curr_fc;
fc = umart.get_real("FC"); fc = umart.get_real(UMART_FC);
qta /= fc; qta /= fc;
row_mask.set(FR_QTA, qta); row_mask.set(FR_QTA, qta);
} }
@ -425,10 +441,10 @@ bool descr_handler( TMask_field& f, KEY key )
anamag.zero(); anamag.zero();
anamag.setkey(2); anamag.setkey(2);
anamag.put("DESCR", ((TZoom_field &) f).get_first_line()); anamag.put(ANAMAG_DESCR, ((TZoom_field &) f).get_first_line());
if (anamag.read() == NOERR) if (anamag.read() == NOERR)
{ {
f.mask().set(FR_CODART, anamag.get("CODART")); f.mask().set(FR_CODART, anamag.get(ANAMAG_CODART));
f.mask().field(FR_CODART).set_dirty(); f.mask().field(FR_CODART).set_dirty();
f.mask().check_field(FR_CODART); f.mask().check_field(FR_CODART);
} }
@ -840,7 +856,7 @@ void TExpr_documento::evaluate_user_func(int index, int nparms, TEval_stack & st
if (_row) if (_row)
{ {
val = _row->importo(TRUE, FALSE, ndec) * _row->get_real("PERCPROV") / 100.0; val = _row->importo(TRUE, FALSE, ndec) * _row->get_real(RDOC_PERCPROV) / 100.0;
val.round(ndec); val.round(ndec);
} }
else else

View File

@ -186,6 +186,13 @@ TRiga_documento::TRiga_documento(TDocumento* doc, const char * tipo)
set_tipo(tipo); set_tipo(tipo);
} }
TRiga_documento::TRiga_documento(const TRiga_documento & row)
: TAuto_variable_rectype(LF_RIGHEDOC), _doc(NULL), _iva_calc(FALSE)
{
copy(row);
}
TRiga_documento::TRiga_documento(const TRiga_documento& rec, TDocumento* doc, TRiga_documento::TRiga_documento(const TRiga_documento& rec, TDocumento* doc,
const char * tipo) const char * tipo)
: TAuto_variable_rectype(rec), _doc(doc), _iva_calc(FALSE) : TAuto_variable_rectype(rec), _doc(doc), _iva_calc(FALSE)
@ -285,6 +292,13 @@ void TRiga_documento::forza_sola_descrizione()
} }
} }
TRiga_documento & TRiga_documento::copy(const TRiga_documento & r)
{
operator=((TRectype &)r);
_doc = r._doc;
return *this;
}
TRectype & TRiga_documento::operator =(const TRectype & r) TRectype & TRiga_documento::operator =(const TRectype & r)
{ {
TRectype::operator=(r); TRectype::operator=(r);

View File

@ -198,7 +198,7 @@ TAssoc_array TDocumento::_tipi;
TDocumento::TDocumento() TDocumento::TDocumento()
: TAuto_variable_rectype(LF_DOC), _rows(LF_RIGHEDOC, "NRIGA"), _nuovo(TRUE), : TAuto_variable_rectype(LF_DOC), _rows(LF_RIGHEDOC, "NRIGA"), _nuovo(TRUE),
_condv(NULL), _rel(NULL), _sconto(NULL), _esenzione(NULL) _condv(NULL), _sconto(NULL), _esenzione(NULL)
{ {
_tipocf = new TRecfield(*this, "TIPOCF"); _tipocf = new TRecfield(*this, "TIPOCF");
_codcf = new TRecfield(*this, "CODCF"); _codcf = new TRecfield(*this, "CODCF");
@ -207,10 +207,17 @@ TDocumento::TDocumento()
for (int i = 3 ; i >= 0; i--) _liv_len[i] = 0; for (int i = 3 ; i >= 0; i--) _liv_len[i] = 0;
} }
TDocumento::TDocumento(const TDocumento & d)
: TAuto_variable_rectype(LF_DOC), _rows(LF_RIGHEDOC, "NRIGA"), _nuovo(TRUE),
_condv(NULL), _sconto(NULL), _esenzione(NULL)
{
copy(d);
}
TDocumento::TDocumento(char provv, int anno, const char* codnum, long numdoc, TDocumento::TDocumento(char provv, int anno, const char* codnum, long numdoc,
TCond_vendita * condv, TRelation * rel) TCond_vendita * condv, TRelation * rel)
: TAuto_variable_rectype(LF_DOC), _rows(LF_RIGHEDOC, "NRIGA"), _nuovo(TRUE), : TAuto_variable_rectype(LF_DOC), _rows(LF_RIGHEDOC, "NRIGA"), _nuovo(TRUE),
_condv(condv), _rel(rel), _sconto(NULL), _esenzione(NULL) _condv(condv), _sconto(NULL), _esenzione(NULL)
{ {
_tipocf = new TRecfield(*this, "TIPOCF"); _tipocf = new TRecfield(*this, "TIPOCF");
_codcf = new TRecfield(*this, "CODCF"); _codcf = new TRecfield(*this, "CODCF");
@ -232,7 +239,7 @@ TDocumento::TDocumento(char provv, int anno, const char* codnum, long numdoc,
TDocumento::TDocumento(const TRectype& rec, TCond_vendita * condv, TRelation * rel) TDocumento::TDocumento(const TRectype& rec, TCond_vendita * condv, TRelation * rel)
: TAuto_variable_rectype(LF_DOC), _rows(LF_RIGHEDOC, "NRIGA"), _nuovo(FALSE), : TAuto_variable_rectype(LF_DOC), _rows(LF_RIGHEDOC, "NRIGA"), _nuovo(FALSE),
_condv(condv), _rel(rel), _sconto(NULL), _esenzione(NULL) _condv(condv), _sconto(NULL), _esenzione(NULL)
{ {
_tipocf = new TRecfield(*this, "TIPOCF"); _tipocf = new TRecfield(*this, "TIPOCF");
_codcf = new TRecfield(*this, "CODCF"); _codcf = new TRecfield(*this, "CODCF");
@ -1207,16 +1214,22 @@ TOccasionale & TDocumento::occas() const
return (TOccasionale &) _occas; return (TOccasionale &) _occas;
} }
TDocumento & TDocumento::operator =(const TDocumento & d) TDocumento & TDocumento::copy(const TDocumento & d)
{ {
zero();
operator=((TRectype &)d); operator=((TRectype &)d);
_rows = d._rows; _rows = d._rows;
for (int i = physical_rows(); i > 0; i--)
{
TRiga_documento & r = row(i);
r.set_doc(this);
}
for (i = 0; i < 3; i++)
_liv_len[i] = d._liv_len[i];
set_riga_sconto(); set_riga_sconto();
if (is_fattura()) if (is_fattura())
set_riga_esenzione(); set_riga_esenzione();
set_relation(d._rel);
set_condv(d._condv); set_condv(d._condv);
_nuovo = d._nuovo;
return *this; return *this;
} }

View File

@ -29,10 +29,10 @@
#include "sconti.h" #include "sconti.h"
#endif #endif
TDocumento_mask::TDocumento_mask(const char* name, TDocumento * doc, int num, TDocumento_mask::TDocumento_mask(const char* name, TDocumento * doc, TRelation * rel,
int max) int num, int max)
: TVariable_mask(name, num, max), _progs_page(-1), _last_prog(-1), : TVariable_mask(name, num, max), _progs_page(-1), _last_prog(-1),
_doc(doc) _doc(doc), _rel(rel)
{ {
const int pos = id2pos(BASE_PIEDE + 1); const int pos = id2pos(BASE_PIEDE + 1);
@ -51,13 +51,17 @@ void TDocumento_mask::next_page(int p)
if (curr_page() == _progs_page) if (curr_page() == _progs_page)
{ {
begin_wait(); begin_wait();
autosave(get_relation()); TDocumento & curr_doc = doc();
TDocumento & rel_doc = (TDocumento &) _rel->curr();
rel_doc = curr_doc;
autosave(*_rel);
for (int i = _last_prog; i > 0; i--) for (int i = _last_prog; i > 0; i--)
{ {
const short id = BASE_PIEDE + i; const short id = BASE_PIEDE + i;
const TString16 name(field(id).field()->name()); const TString16 name(field(id).field()->name());
set(id , doc().get(name)); set(id , rel_doc.get(name));
} }
end_wait(); end_wait();
} }
@ -314,7 +318,7 @@ void TDocumento_mask::spese2mask(TCli_for & c)
if (s.not_empty()) if (s.not_empty())
spese.add(s); spese.add(s);
} }
autosave(get_relation()); autosave(*_rel);
doc().put("SPESEUPD", FALSE); doc().put("SPESEUPD", FALSE);
doc().update_spese_aut(spese, FALSE, &sh); doc().update_spese_aut(spese, FALSE, &sh);
sh.force_update(); sh.force_update();