diff --git a/ve/ve0100.cpp b/ve/ve0100.cpp index 6905e5cd7..2f9b3e883 100755 --- a/ve/ve0100.cpp +++ b/ve/ve0100.cpp @@ -515,12 +515,16 @@ TMask* TMotore_application::get_mask( int mode ) const TString & header = l.name(i); const int len = header.len() + 1; const int f_len = l.code_lenght(i); + _doc->set_liv_giac_len(i, f_len); _sheet->set_column_header(pos, l.name(i)); _sheet->set_column_width(pos, (len > f_len ? len : f_len) * 8); } else + { _sheet->delete_column(pos); + _doc->set_liv_giac_len(i, 0); + } } // configurazione campi diff --git a/ve/velib.h b/ve/velib.h index 717d88d23..a999f8076 100755 --- a/ve/velib.h +++ b/ve/velib.h @@ -351,6 +351,7 @@ class TDocumento : public TAuto_variable_rectype // velib03 TRecfield *_codcf; TRecfield *_cod_occas; static TAssoc_array _tipi; + int _liv_len[4]; TRecord_array _rows; // Array di TRectype per le righe documenti di vendita. bool _nuovo; @@ -402,7 +403,7 @@ public: virtual int read(TBaseisamfile& f, word op = _isequal, word lockop = _nolock); virtual int write(TBaseisamfile& f) const { return write_rewrite(f, FALSE); } virtual int rewrite(TBaseisamfile& f) const { return write_rewrite(f, TRUE); } - virtual int remove(TBaseisamfile& f) const; + virtual int remove(TBaseisamfile& f) const; int read(char provv, int anno, const char* codnum, long numdoc, word op = _isequal, word lockop = _nolock); int read(const TRectype& rec, word op = _isequal, word lockop = _nolock) { *this = rec; return read(op, lockop); } @@ -423,6 +424,8 @@ public: bool tipo_valido() const { return get("TIPODOC").not_empty(); } const TTipo_documento& tipo() const; void set_tipo(const char * tipo) { head().put("TIPODOC", tipo);} + void set_liv_giac_len(int liv, int len) { _liv_len[liv - 1] = len;} + int liv_giac_len(int liv) const { return _liv_len[liv - 1];} char stato() const { return get_char("STATO"); } void stato(char s) { put("STATO", s); } diff --git a/ve/velib02.cpp b/ve/velib02.cpp index cc6f25673..40b36b463 100755 --- a/ve/velib02.cpp +++ b/ve/velib02.cpp @@ -549,10 +549,11 @@ void TRiga_documento::autosave(TSheet_field & f) codmag << row.get( f.cid2index(FR_CODDEP )); put( "CODMAG", codmag); put( "CODART", row.get( f.cid2index(FR_CODART )) ); - put( "LIVELLO",row.get( f.cid2index(FR_LIV1 ))); // da modificare - put( "LIVELLO",row.get( f.cid2index(FR_LIV2 ))); - put( "LIVELLO",row.get( f.cid2index(FR_LIV3 ))); - put( "LIVELLO",row.get( f.cid2index(FR_LIV4 ))); + TString liv(row.get(f.cid2index(FR_LIV1))); + liv << row.get(f.cid2index(FR_LIV2)); + liv << row.get(f.cid2index(FR_LIV3)); + liv << row.get(f.cid2index(FR_LIV4)); + put( "LIVELLO", liv); // da modificare TString s(row.get(f.cid2index(FR_DESCR))); int split_pos = s.find('\n'); @@ -608,10 +609,32 @@ void TRiga_documento::autoload(TSheet_field & f) row.add( codmag.left(3), f.cid2index(FR_CODMAG )); row.add( codmag.mid(3), f.cid2index(FR_CODDEP )); row.add( get( "CODART" ), f.cid2index(FR_CODART )); - row.add( get( "LIVELLO" ), f.cid2index(FR_LIV1 )); // da modificare - row.add( get( "LIVELLO" ), f.cid2index(FR_LIV2 )); - row.add( get( "LIVELLO" ), f.cid2index(FR_LIV3 )); - row.add( get( "LIVELLO" ), f.cid2index(FR_LIV4 )); + TString liv(get("LIVELLO")); + + int l = doc().liv_giac_len(1); + if (l > 0) + { + row.add(liv.left(l), f.cid2index(FR_LIV1 )); + liv.ltrim(l); + } + l = doc().liv_giac_len(2); + if (l > 0) + { + row.add(liv.left(l), f.cid2index(FR_LIV2 )); + liv.ltrim(l); + } + l = doc().liv_giac_len(3); + if (l > 0) + { + row.add(liv.left(l), f.cid2index(FR_LIV3 )); + liv.ltrim(l); + } + l = doc().liv_giac_len(4); + if (l > 0) + { + row.add(liv.left(l), f.cid2index(FR_LIV4 )); + liv.ltrim(l); + } TString s(get("DESCR")); if (get_bool("DESCLUNGA")) s << get("DESCEST"); diff --git a/ve/velib03.cpp b/ve/velib03.cpp index 0f8953ed1..6f336b4a8 100755 --- a/ve/velib03.cpp +++ b/ve/velib03.cpp @@ -154,6 +154,7 @@ TDocumento::TDocumento() _codcf = new TRecfield(*this, "CODCF"); _cod_occas = new TRecfield(*this, "OCFPI"); set_memo_fld("G1"); + for (int i = 3 ; i >= 0; i--) _liv_len[i] = 0; } TDocumento::TDocumento(char provv, int anno, const char* codnum, long numdoc, @@ -176,6 +177,7 @@ TDocumento::TDocumento(char provv, int anno, const char* codnum, long numdoc, } else read(provv, anno, codnum, numdoc); + for (int i = 3 ; i >= 0; i--) _liv_len[i] = 0; } TDocumento::TDocumento(const TRectype& rec, TCond_vendita * condv, TRelation * rel) @@ -187,6 +189,7 @@ TDocumento::TDocumento(const TRectype& rec, TCond_vendita * condv, TRelation * r _cod_occas = new TRecfield(*this, "OCFPI"); set_memo_fld("G1"); read(rec); + for (int i = 3 ; i >= 0; i--) _liv_len[i] = 0; } TDocumento::~TDocumento()