diff --git a/ve/ve0100.cpp b/ve/ve0100.cpp index 395156062..26eacdd4c 100755 --- a/ve/ve0100.cpp +++ b/ve/ve0100.cpp @@ -18,12 +18,12 @@ void TMotore_application::init_query_mode( TMask& m ) { - _msk->set( F_CODNUM, _codnum); - _msk->field(F_CODNUM).set_focusdirty(TRUE); - _msk->field(F_CODNUM).on_key(K_TAB); - _msk->field(F_CODNUM).set_dirty(FALSE); - - _msk->set( F_TIPODOC, _tipodoc, TRUE); + _msk->set( F_CODNUM, _codnum); + _msk->field(F_CODNUM).set_focusdirty(TRUE); + _msk->field(F_CODNUM).on_key(K_TAB); + _msk->field(F_CODNUM).set_dirty(FALSE); + + _msk->set( F_TIPODOC, _tipodoc, TRUE); } void TMotore_application::init_insert_mode( TMask& m ) @@ -117,7 +117,7 @@ TMask * TMotore_application::ss_getmask( int numriga, TMask& fullmask) return ((TTipo_riga_documento &)riga.tipo()).mask(); } else - return & fullmask; + return &fullmask; } void TMotore_application::user_set_handler( int fieldid, int index, TMask* m ) @@ -674,7 +674,7 @@ const char* TMotore_application::get_next_key( ) return key; } -int TMotore_application::read( TMask& m ) +int TMotore_application::read(TMask& m) { // m.autoload(*_rel); TRelation_application::read(m); @@ -690,9 +690,8 @@ int TMotore_application::read( TMask& m ) for (int i = 1; i <= rows; i++) { f.insert(-1, FALSE); - TToken_string & r = f.row(i -1); + TToken_string & r = f.row(i-1); TRiga_documento & rec = (*_doc)[i]; - rec.autoload(f); f.check_row(i - 1); } @@ -715,6 +714,45 @@ int TMotore_application::rewrite( const TMask& m ) // C 90 return TRelation_application::rewrite(m); } +// Riempie lo sheet con le righe documento specificate nel .ini +void TMotore_application::ini2mask(TConfig& ini, TMask& msk, bool query) +{ + TRelation_application::ini2mask(ini, msk, query); // Default processing + if (query) + { + } + else + { + TSheet_field& f = msk.sfield(F_SHEET); + TTipo_riga_documento tr; + + // Scorre tutti i pragrafi delle righe documento + for (int i = 1; ini.set_paragraph(format("%d,%d", LF_RIGHEDOC, i)); i++) + { + // Considera solo i tipi riga validi + const TString16 tipo = ini.get(RDOC_TIPORIGA); + if (tr.read(tipo) == NOERR) + { + // Crea una nuova riga documento + TRiga_documento& rec = _doc->new_row(tipo); + // Riempie i campi della nuova riga + TAssoc_array& var = ini.list_variables(); + FOR_EACH_ASSOC_STRING(var, obj, key, val) + { + if (stricmp(key, RDOC_NRIGA) != 0) // Ignora il numero riga + rec.put(key, val); + } + // solo la insert chiama la post_insert necessaria alla disabilitazione verifichiamo + // l'autoload ?? +// f.insert(-1, FALSE); + // Aggiunge la riga allo sheet + rec.autoload(f); + f.check_row(rec.numero()-1); + } + } + } +} + void TMotore_application::open_files(int logicnum, ...) { diff --git a/ve/ve0100.h b/ve/ve0100.h index 445ba3efa..2cac8ed3a 100755 --- a/ve/ve0100.h +++ b/ve/ve0100.h @@ -65,6 +65,7 @@ class TMotore_application : public TRelation_application virtual int read( TMask& m ); virtual int write( const TMask& m ); virtual int rewrite( const TMask& m ); + virtual void ini2mask(TConfig& ini, TMask& msk, bool query); // Funzioni da associare ad ogni procedura int user_function( int index ); @@ -105,8 +106,8 @@ protected: void configura_sheet( TSheet_field& sheet, TConfig& config ); public: - virtual TRelation* get_relation( ) const { return _rel;} + virtual const char* get_next_key( ); // Funzioni di accesso alle variabili private @@ -129,10 +130,8 @@ public: TSheet_field & ss( ) const { return *_sheet; } TMotore_application( ) { _pro = NULL; } virtual ~TMotore_application( ) { if ( _pro ) delete _pro; } - virtual const char* get_next_key( ); - }; -inline TMotore_application & app() { return (TMotore_application &) main_app(); } +inline TMotore_application& app() { return (TMotore_application &) main_app(); } #endif diff --git a/ve/ve0100c.cpp b/ve/ve0100c.cpp index 0be8db88e..aa1269ec7 100755 --- a/ve/ve0100c.cpp +++ b/ve/ve0100c.cpp @@ -37,7 +37,7 @@ #endif #ifndef __PAGAMENT_H -#include "..\cg\pagament.h" +#include "..\cg\cgpagame.h" #endif #ifndef __SCONTI_H diff --git a/ve/velib.h b/ve/velib.h index 36e462802..15f382388 100755 --- a/ve/velib.h +++ b/ve/velib.h @@ -316,7 +316,6 @@ class TTipo_riga_documento : public TRectype // velib02 protected: void read_formule(); - int read(const char* tiporig); public: TObject* dup() const { return new TTipo_riga_documento(codice()); } @@ -326,16 +325,17 @@ public: const TString& mask_name() const { return profile_name();} const TString& codice() const { return get("CODTAB");} bool mask_loaded() const { return _mask != NULL; } - TVariable_mask * mask(); + TVariable_mask* mask(); const TString& descrizione() const { return get("S0"); } char tipo() const { return get_char("S7"); } const TString& imponibile() const { return _imponibile;} const TString& provv() const { return _provv;} - TFormula_documento * first_formula() { return succ_formula(TRUE); } - TFormula_documento * succ_formula(bool restart = FALSE); + TFormula_documento* first_formula() { return succ_formula(TRUE); } + TFormula_documento* succ_formula(bool restart = FALSE); + int read(const char* tiporig); TTipo_riga_documento(const char* tiporig = NULL); TTipo_riga_documento(const TRectype& rec); virtual ~TTipo_riga_documento(); @@ -370,7 +370,7 @@ public: bool is_merce() const { return tipo().tipo() == 'M';} bool is_spese() const { return tipo().tipo() == 'S';} bool is_prestazione() const { return tipo().tipo() == 'P';} - bool is_sconto() const {return tipo().tipo() == 'C';} + bool is_sconto() const {return tipo().tipo() == 'C';} bool is_sconto_perc() const { return get(RDOC_SCONTO).not_empty();} bool is_omaggio() const { return tipo().tipo() == 'O';} bool is_descrizione() const { return tipo().tipo() == 'D';} diff --git a/ve/velib02.cpp b/ve/velib02.cpp index 04b6c6d1d..74923cb51 100755 --- a/ve/velib02.cpp +++ b/ve/velib02.cpp @@ -557,11 +557,11 @@ bool TRiga_documento::doc_dependent() const void TRiga_documento::put_str(const char* fieldname, const char* val) { - if (strcmp(fieldname, "TIPORIGA") == 0) + if (strcmp(fieldname, RDOC_TIPORIGA) == 0) { - const TString v(val); + const TString16 v(val); - if (TRectype::get("TIPORIGA") != v) + if (TRectype::get(RDOC_TIPORIGA) != v) { TAuto_variable_rectype::put_str(fieldname, v); reset_fields(*this);