From 5347a1dd32888309e58c4daceaff89b07be293e8 Mon Sep 17 00:00:00 2001 From: guy Date: Wed, 17 Mar 2010 16:04:48 +0000 Subject: [PATCH] Patch level : 678 Files correlati : ve0.exe fatturac.msk fatturaa.msk Ricompilazione Demo : [ ] Commento : Corretto e spostato prompt da "Liqidazione differita" a "Liquidazione differita" git-svn-id: svn://10.65.10.50/trunk@20239 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- ve/ve0300.cpp | 54 ++++++++++++++++++++++++++++++------------------- ve/ve0300a.src | 5 ++--- ve/velib.h | 2 +- ve/velib02.cpp | 15 ++++++++------ ve/velib03.cpp | 9 +++++---- ve/velib03a.cpp | 16 +++++---------- ve/velib06.cpp | 14 ++++++------- 7 files changed, 61 insertions(+), 54 deletions(-) diff --git a/ve/ve0300.cpp b/ve/ve0300.cpp index e7cd6966d..7185a6945 100755 --- a/ve/ve0300.cpp +++ b/ve/ve0300.cpp @@ -250,6 +250,7 @@ protected: // Genera la colonna dello sheet a partire da una linea del file VE0300B.DAT void genera_item_sheet( TToken_string _line ); + bool check_file(const char* filename) const; public: @@ -882,11 +883,19 @@ void TField::genera( ) // Definizione dei metodi di_generator // ----------------------------------------- -TMask_generator::TMask_generator(const TString& tablefile ) : _fieldsini( "ve0300a.ini" ), _groupsini( "ve0300c.ini" ) +bool TMask_generator::check_file(const char* filename) const { - CHECK( fexist( "ve0300a.ini" ), "Il file ve0300a.ini non esiste!" ); + if (fsize(filename) <= 0) + return cantread_box(filename); + return true; +} + +TMask_generator::TMask_generator(const TString& tablefile) : _fieldsini( "ve0300a.ini" ), _groupsini( "ve0300c.ini" ) +{ + if (!check_file("ve0300a.ini") || !check_file("ve0300b.dat")) + exit(1); + _fieldsini.list_paragraphs( _fields ); - CHECK( fexist( "ve0300b.dat" ), "Il file ve0300b.dat non esiste!" ); carica_tabella( "ve0300b.dat", _tab0300b ); carica_dati_campi( "ve0300a.ini", _gruppi ); _tablefile = tablefile; @@ -898,7 +907,7 @@ void TMask_generator::carica_dati_campi( const TFilename& fn, TAssoc_array& a ) TString line; TField *campo = NULL; TGruppo *gruppo = NULL; - TString16 curgruppo( "" ); + TString8 curgruppo; while ( infile.ok( ) ) { @@ -916,7 +925,7 @@ void TMask_generator::carica_dati_campi( const TFilename& fn, TAssoc_array& a ) line.strip( "[]" ); if ( campo ) { - TString16 fieldkey = GROUPKEY( campo->gruppo( ) ); + const TString8 fieldkey = GROUPKEY( campo->gruppo( ) ); if ( fieldkey != curgruppo ) { if ( gruppo ) @@ -1440,15 +1449,15 @@ void TMask_generator::genera( const TString& profilo ) TFilename proname( profilo ); // All'inizio il gruppo h 'chiuso' - _groupopen = FALSE; + _groupopen = false; // Forza l'estensione al profilo proname.ext( "ini" ); // Se il file di profilo non esiste, esci con un errore fatale - if (!fexist( proname)) + if (!proname.exist()) { - error_box( "Il profilo %s non esiste!", ( const char * )profilo); + cantread_box(profilo); return; } @@ -1607,14 +1616,14 @@ void TMask_generator::genera( const TString& profilo ) last = _pro->get_int( "NGROUPS", "ORDINEGRUPPI" ); for( i = 1; i <= last; i ++ ) { - chiave.format( "%d", i ); - const TString key(_pro->get( chiave, "ORDINEGRUPPI" )); + chiave.format("%d", i ); + const TString& key = _pro->get( chiave, "ORDINEGRUPPI"); - if (key.not_empty()) + if (key.full()) { if (isdigit(key[0])) { - chiavegruppo.GROUPKEY(atoi(key)); + chiavegruppo = GROUPKEY(atoi(key)); if( _gruppi.is_key( chiavegruppo ) ) sortedgroups.add( _gruppi[ (chiavegruppo) ] ); } @@ -1747,9 +1756,9 @@ protected: public: virtual void main_loop(); // @cmember Disabilita la verifica del modulo : essendo una anagrafica, va sempre abilitata - virtual bool check_autorization() const {return FALSE;} - void set_files(const bool b = TRUE) {_use_files = b;} - void set_tablefile(const TString& t) {_tablefile = t;} + virtual bool check_autorization() const { return false; } + void set_files(const bool b = true) { _use_files = b; } + void set_tablefile(const TString& t) {_tablefile = t; } }; @@ -1769,19 +1778,22 @@ void TGenMask_application::main_loop( ) int ve0300( int argc, char* argv[]) { + if (argc < 3) + { + error_box(Usage); + return -1; + } + TGenMask_application a; - a.set_files(TRUE); + a.set_files(true); TString tablefile; - if (argc < 3) - fatal_box( Usage ); - if ( argc > 3) { if (strncmp(argv[3],"-f",2) == 0) { - a.set_files(FALSE); + a.set_files(false); if (argv[3][2] > ' ') { tablefile = argv[3]; @@ -1792,6 +1804,6 @@ int ve0300( int argc, char* argv[]) } } a.set_tablefile(tablefile); - a.run ( argc, argv, "Generazione in corso ..." ); + a.run(argc, argv, TR("Generazione profili")); return 0; } diff --git a/ve/ve0300a.src b/ve/ve0300a.src index 559650f14..ef085f720 100755 --- a/ve/ve0300a.src +++ b/ve/ve0300a.src @@ -86,14 +86,13 @@ OUTPUT=@F_CODCF SIZE=16 [LIQDIFF] -// il campo e' letto nel file 20 clifo GROUP=100 -X=53 +X=48 Y=0 FIELDNAME=LIQDIFF MSKID=F_LIQDIFF TYPE=T_CHECKBOX -PROMPT="Liqidazione differita" +PROMPT="Liquidazione differita" [STATOPAIV] // il campo e' letto nel file 20 clifo diff --git a/ve/velib.h b/ve/velib.h index 36916837c..65a3ab741 100755 --- a/ve/velib.h +++ b/ve/velib.h @@ -734,7 +734,7 @@ public: void dirty_fields(); TAssoc_array & tabella_iva(bool solo_imponibili = false) { update_tabella_iva(solo_imponibili); return _tabella_iva; } - TCli_for & clifor() const; + TCli_for& clifor(bool force_reload = false) const; TOccasionale & occas() const; const TAgente & agente(bool first = true) const; const TString & riferimento(TString& rif) const { return tipo().riferimento(*this, rif); } diff --git a/ve/velib02.cpp b/ve/velib02.cpp index 454c1ad05..c201c549e 100755 --- a/ve/velib02.cpp +++ b/ve/velib02.cpp @@ -2,6 +2,8 @@ #include "vepriv.h" #include "../ca/commesse.h" +#include + /////////////////////////////////////////////////////////// // Tipo riga di un documento /////////////////////////////////////////////////////////// @@ -184,18 +186,19 @@ TRiga_documento::TRiga_documento(const TRiga_documento& rec, TDocumento* doc, const TTipo_riga_documento& TRiga_documento::tipo() const { - const TString4 tiporig(get(RDOC_TIPORIGA)); - CHECK(tiporig.not_empty(), "Tipo riga documento nullo"); + const TString4 tiporig = get(RDOC_TIPORIGA); + CHECK(tiporig.full(), "Tipo riga documento nullo"); TTipo_riga_documento* o = (TTipo_riga_documento*)_tipi.objptr(tiporig); if (o == NULL) { if (_tipi.items() == 0) { - TTable tri("%TRI"); // Tabella dei tipi riga - for (tri.first(); !tri.eof(); tri.next()) + TISAM_recordset tri("USE %TRI"); + for (bool ok = tri.move_first(); ok; ok = tri.move_next()) { - const TString4 codice = tri.get("CODTAB"); - _tipi.add(codice, new TTipo_riga_documento(tri.curr())); + const TString& codice = tri.get("CODTAB").as_string(); + if (codice.full() && codice.len() <= 2) + _tipi.add(codice, new TTipo_riga_documento(tri.cursor()->curr())); } } o = (TTipo_riga_documento*)_tipi.objptr(tiporig); diff --git a/ve/velib03.cpp b/ve/velib03.cpp index 0186cb0fd..e104bb4f1 100755 --- a/ve/velib03.cpp +++ b/ve/velib03.cpp @@ -2475,13 +2475,14 @@ void TDocumento::zero(const char * fieldname) dirty_fields(); } -TCli_for & TDocumento::clifor() const +TCli_for& TDocumento::clifor(bool force_reload) const { const char tipo = tipocf(); const long codice = codcf(); - if (_cli_for.empty() || _cli_for.tipo() != tipo || _cli_for.codice() != codice) - ((TDocumento *) this)->_cli_for.read(tipo, codice); - return (TCli_for &)_cli_for; + TCli_for& cf = (TCli_for&)_cli_for; + if (force_reload || cf.empty() || cf.tipo() != tipo || cf.codice() != codice) + cf.read(tipo, codice); + return cf; } TOccasionale& TDocumento::occas() const diff --git a/ve/velib03a.cpp b/ve/velib03a.cpp index 51d98bb08..4beb35e2d 100755 --- a/ve/velib03a.cpp +++ b/ve/velib03a.cpp @@ -127,22 +127,17 @@ bool TTipo_documento::mail_print_profile(TFilename& report) const } bool TTipo_documento::is_costo() const -{ - return _tipocr == 'C' || tipocf() == 'F'; -} +{ return _tipocr == 'C' || tipocf() == 'F'; } bool TTipo_documento::is_ricavo() const -{ - return _tipocr == 'R' || tipocf() == 'C'; -} +{ return _tipocr == 'R' || tipocf() == 'C'; } const char TTipo_documento::tipocf() const { if (_tipocf < ' ') { TFilename pn; profile_name(pn); - TConfig prof(pn); - (char&)_tipocf = prof.get_char("TIPOCF", "MAIN"); + (char&)_tipocf = ini_get_string(pn, "MAIN", "TIPOCF", "C")[0]; } return _tipocf; } @@ -170,8 +165,8 @@ const TString& TTipo_documento::riferimento(const TDocumento & doc, TString& rif rif.insert(field.read(doc), p); else { - TString16 key(doc.get(DOC_TIPOCF)); - key << "|" << doc.get(DOC_CODCF); + TString8 key(doc.get(DOC_TIPOCF)); + key << '|' << doc.get(DOC_CODCF); const TRectype& rec = cache().get(field.file(), key); rif.insert(field.read(rec), p); @@ -249,7 +244,6 @@ const TString_array& TTipo_documento::handlers() const { if (_handlers.empty()) { - TString16 chiave; TFilename pn; profile_name(pn); TConfig prof(pn, "HANDLERS"); diff --git a/ve/velib06.cpp b/ve/velib06.cpp index 62eb51966..a2d666ce2 100755 --- a/ve/velib06.cpp +++ b/ve/velib06.cpp @@ -1806,16 +1806,14 @@ bool TDocumento_mask::clifo_handler( TMask_field& f, KEY key ) { if (key != K_ENTER && f.to_check(key, true)) { - TDocumento_mask & m = (TDocumento_mask &) f.mask(); - TDocumento & d = m.doc(); + TDocumento_mask& m = (TDocumento_mask&)f.mask(); + TDocumento& d = m.doc(); - TTipo_documento& tdoc = (TTipo_documento&) d.tipo(); - d.put(DOC_TIPOCF, tdoc.tipocf()); - d.put(DOC_CODCF, f.get()); - - TCli_for & cli_for = d.clifor(); - cli_for.put(CLI_CODCF, ""); // force reload + TTipo_documento& tdoc = (TTipo_documento&)d.tipo(); + d.put(DOC_TIPOCF, tdoc.tipocf()); + d.put(DOC_CODCF, f.get()); + TCli_for& cli_for = d.clifor(true); // force reload if ( cli_for.get_bool(CLI_SOSPESO) ) return f.error_box( "Il codice '%ld' e' sospeso e non puo' essere utilizzato", atol(f.get()));